* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif;
       color: #1c2430; background: #f4f6f9; }
main { max-width: 1400px; margin: 0 auto; padding: 20px 24px 60px; }
h1 { font-size: 22px; margin: 14px 0; }
h2 { font-size: 16px; margin: 26px 0 10px; }
h3 { font-size: 14px; margin: 16px 0 8px; }
a { color: #1a5dc8; text-decoration: none; }
a:hover { text-decoration: underline; }

nav { display: flex; align-items: center; gap: 18px; background: #16223a; color: #dbe4f3;
      padding: 0 24px; height: 48px; }
nav .brand { font-weight: 700; color: #fff; margin-right: 8px; }
nav a { color: #b9c8e2; padding: 14px 2px; }
nav a.on { color: #fff; box-shadow: inset 0 -3px 0 #4f8ef7; }
nav .spacer { flex: 1; }
nav .fresh { font-size: 12px; color: #9fb3d4; }
nav .who { font-weight: 600; color: #fff; }
nav form.inline { display: inline; }
button.link { background: none; border: 0; color: #b9c8e2; cursor: pointer; font: inherit;
              text-decoration: underline; padding: 0; }
main button.link { color: #1a5dc8; }
main button.link.danger { color: #c02626; }
form.inline { display: inline; }

.login-box { max-width: 340px; margin: 12vh auto; background: #fff; padding: 28px 32px;
             border-radius: 10px; box-shadow: 0 6px 24px rgba(20,35,70,.12); }
.login-box h1 { text-align: center; }
.login-box label { display: block; margin: 12px 0; font-size: 13px; color: #4a5568; }
.login-box input { width: 100%; padding: 9px 10px; margin-top: 4px; border: 1px solid #cbd5e1;
                   border-radius: 6px; font-size: 14px; }
button.primary { background: #1a5dc8; color: #fff; border: 0; border-radius: 6px;
                 padding: 10px 18px; font-size: 14px; cursor: pointer; margin-top: 10px; }
button.primary:disabled { background: #9db4d8; cursor: default; }
button.primary:hover:not(:disabled) { background: #14498f; }

.err { background: #fdecec; color: #a02020; padding: 10px 14px; border-radius: 6px; }
.ok  { background: #e7f6ea; color: #1c6b30; padding: 10px 14px; border-radius: 6px; }
.muted { color: #64748b; }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.strong { font-weight: 700; }
.warn { color: #b7791f; font-weight: 700; cursor: help; }

.dropzone { border: 2px dashed #b7c4d8; border-radius: 12px; padding: 34px; text-align: center;
            background: #fff; margin: 14px 0; transition: .15s; }
.dropzone.drag { border-color: #1a5dc8; background: #eef4ff; }
.dropzone .btn { display: inline-block; background: #eef2f8; border: 1px solid #cbd5e1;
                 padding: 8px 16px; border-radius: 6px; cursor: pointer; }
.field { display: inline-block; margin: 6px 0; }
.field select, .row select, .row input { padding: 8px 10px; border: 1px solid #cbd5e1;
                                          border-radius: 6px; font-size: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
         gap: 14px; margin: 18px 0; }
.card { background: #fff; border-radius: 10px; padding: 14px 18px;
        box-shadow: 0 2px 8px rgba(20,35,70,.07); }
.card-h { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: #64748b; }
.card-v { font-size: 22px; font-weight: 700; margin-top: 4px; }
.card-v.small { font-size: 15px; }
.card-s { font-size: 12px; color: #64748b; margin-top: 4px; }
.card.bad .card-v { color: #c02626; }
.card.good .card-v { color: #1e7d3c; }

.tbl-wrap { overflow-x: auto; background: #fff; border-radius: 10px;
            box-shadow: 0 2px 8px rgba(20,35,70,.07); margin: 10px 0; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 8px 10px; border-bottom: 1px solid #edf1f6; text-align: left;
         white-space: nowrap; }
td.desc { white-space: normal; max-width: 340px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
thead th { background: #f8fafc; position: sticky; top: 0; font-weight: 600; color: #47546a; }
table.sortable thead th[data-k] { cursor: pointer; user-select: none; }
table.sortable thead th[data-k]:hover { color: #1a5dc8; }
th.sorted-asc::after { content: " ↑"; }
th.sorted-desc::after { content: " ↓"; }

tr.up   td { background: #fdeeee; }
tr.down td { background: #eaf7ee; }
tr.up td.num.strong { color: #c02626; }
tr.down td.num.strong { color: #1e7d3c; }
tr.nodata td { background: #f6f8fb; }
.t-up { color: #c02626; font-weight: 600; }
.t-down { color: #1e7d3c; font-weight: 600; }
tr.rowlink { cursor: pointer; }
tr.rowlink:hover td { background: #eef4ff; }

tr.expandable { cursor: pointer; }
.caret { display: inline-block; width: 14px; color: #64748b; font-size: 11px;
         transition: transform .12s; }
.caret.nocaret { visibility: hidden; }
tr.expandable.open .caret { transform: rotate(90deg); }
tr.hist { display: none; }
tr.hist.show { display: table-row; }
tr.hist td { background: #fbfcfe; color: #4a5568; font-size: 12.5px;
             border-bottom: 1px dashed #e2e8f2; }
tr.hist td.t-up { color: #c02626; }
tr.hist td.t-down { color: #1e7d3c; }

.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
              gap: 18px; }
.admin-grid section { background: #fff; border-radius: 10px; padding: 16px 20px;
                      box-shadow: 0 2px 8px rgba(20,35,70,.07); }
