:root {
    color-scheme: light;
    --ink: #18212f;
    --muted: #657085;
    --line: #dfe4eb;
    --surface: #ffffff;
    --background: #f4f6f9;
    --primary: #2357d9;
    --primary-dark: #153d9f;
    --danger: #a52a2a;
    --success: #12643a;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--ink); font-size: 15px; }
a { color: var(--primary); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }
h1 { margin: 0 0 1.25rem; font-size: clamp(1.65rem, 3vw, 2.25rem); }
h2 { margin-top: 0; font-size: 1.15rem; }
.muted { color: var(--muted); }
.topbar { min-height: 64px; display: flex; align-items: center; gap: 2rem; padding: .75rem max(1rem, calc((100vw - 1180px) / 2)); background: #111827; color: white; }
.topbar a { color: #e8edff; }
.brand { font-size: 1.1rem; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
.topbar nav { display: flex; gap: 1.1rem; flex: 1; }
.account { display: flex; align-items: center; gap: .75rem; font-size: .85rem; }
.account form { margin: 0; }
.container { max-width: 1180px; margin: 0 auto; padding: 2rem 1rem 4rem; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(circle at top, #e3eaff, var(--background) 42%); }
.panel, .login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 26px rgb(31 45 73 / 8%); }
.panel { padding: 1.25rem; margin-bottom: 1.25rem; }
.login-card { width: min(440px, 100%); padding: 2rem; }
.login-card .eyebrow { color: var(--primary); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; }
.field { display: grid; gap: .4rem; margin-bottom: 1rem; }
label { font-weight: 650; }
input, select { width: 100%; min-height: 42px; padding: .65rem .75rem; border: 1px solid #b8c0cd; border-radius: 7px; background: white; color: var(--ink); font: inherit; }
input:focus, select:focus, button:focus, a:focus { outline: 3px solid rgb(35 87 217 / 25%); outline-offset: 1px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: .55rem .9rem; border: 1px solid transparent; border-radius: 7px; background: var(--primary); color: white; font: inherit; font-weight: 650; cursor: pointer; }
.button:hover { background: var(--primary-dark); text-decoration: none; }
.button-secondary { background: transparent; border-color: #64748b; color: white; }
.button-muted { background: #e9edf4; color: #233149; }
.button-danger { background: var(--danger); }
.button-full { width: 100%; }
.filters { display: grid; grid-template-columns: minmax(180px, 2fr) repeat(3, minmax(130px, 1fr)) auto; gap: .75rem; align-items: end; }
.filters .field { margin: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.stat { padding: 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.stat strong { display: block; margin-top: .25rem; font-size: 1.55rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .75rem .65rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: #49566b; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; padding: .25rem .5rem; border-radius: 99px; background: #e8eefc; color: #214ba7; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.details { display: grid; grid-template-columns: 160px 1fr; gap: .45rem 1rem; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.flash { width: 100%; padding: .8rem 1rem; margin-bottom: 1rem; border-radius: 7px; border: 1px solid; }
.flash-error { background: #fff1f1; border-color: #e4b3b3; color: #7d2020; }
.flash-success { background: #ecfaf2; border-color: #a9d8bd; color: var(--success); }
.metadata { max-width: 360px; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px ui-monospace, monospace; color: #4b5563; }
.inline-form { display: flex; align-items: end; gap: .75rem; flex-wrap: wrap; }
.inline-form .field { margin: 0; flex: 1 1 170px; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }
@media (max-width: 850px) {
    .topbar { align-items: flex-start; flex-wrap: wrap; gap: .75rem; }
    .topbar nav { order: 3; flex-basis: 100%; overflow-x: auto; }
    .account { margin-left: auto; }
    .filters, .stats, .grid-2 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
    .filters, .stats, .grid-2 { grid-template-columns: 1fr; }
    .page-head { display: block; }
    .page-head .button { margin-top: .75rem; }
    .account span { display: none; }
}
