:root {
  --slb: #0014dc;
  --slb-dark: #051464;
  --slb-soft: #e8ebfd;
  --ink: #141a33;
  --muted: #5b6382;
  --line: #dfe3ef;
  --bg: #f4f6fb;
  --card: #ffffff;
  --ok: #15803d;
  --ok-soft: #e3f5ea;
  --warn: #b45309;
  --warn-soft: #fff3df;
  --bad: #b91c1c;
  --bad-soft: #fde8e8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 26, 51, .06), 0 4px 16px rgba(20, 26, 51, .05);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); font-size: 14px; line-height: 1.45; }
a { color: var(--slb); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; }
.wrap { flex-wrap: wrap; }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: #b9c0d8; }
.btn.primary { background: var(--slb); border-color: var(--slb); color: #fff; }
.btn.primary:hover { background: #0010b5; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--slb); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: default; }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid rgba(0, 20, 220, .35); outline-offset: 1px; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-weight: 600; margin-bottom: 4px; }

/* login */
.auth-page { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(135deg, var(--slb-dark), var(--slb) 70%); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 14px; padding: 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.auth-card .logo { height: 54px; margin: -8px 0 6px -14px; }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card .btn.primary { width: 100%; justify-content: center; padding: 10px; }
.notice { padding: 10px 12px; border-radius: 8px; background: var(--slb-soft); color: var(--slb-dark); margin: 12px 0; font-size: 13px; }
.notice.error { background: var(--bad-soft); color: var(--bad); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }

/* app shell */
.topbar { height: 56px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 16px; gap: 14px; position: sticky; top: 0; z-index: 20; }
.topbar .logo { height: 40px; margin-left: -10px; }
.topbar .title { font-weight: 700; color: var(--slb-dark); }
.topbar .title small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.viewas { display: flex; align-items: center; gap: 6px; background: var(--warn-soft); border: 1px solid #f5d29a; padding: 4px 8px; border-radius: 8px; font-size: 12px; }
.viewas select { width: 230px; padding: 3px 6px; font-size: 12px; }
.userchip { text-align: right; font-size: 12px; line-height: 1.2; }
.userchip b { display: block; font-size: 13px; }
.main { max-width: 1100px; margin: 0 auto; padding: 20px; }
@media (max-width: 1000px) {
  .userchip { display: none; }
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.pagehead { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.pagehead h1 { font-size: 22px; color: var(--slb-dark); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .02em; background: var(--slb-soft); color: var(--slb-dark); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.gray { background: #eef0f5; color: var(--muted); }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.kpi .v { font-size: 24px; font-weight: 700; color: var(--slb-dark); font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 12px; }
.kpi.good .v { color: var(--ok); }
.kpi.bad .v { color: var(--bad); }
.kpi.warn .v { color: var(--warn); }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tab { border: 0; background: none; padding: 9px 14px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--slb); border-color: var(--slb); }

/* tables */
table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.grid th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfe; position: sticky; top: 0; z-index: 1; }
table.grid tr.clickable { cursor: pointer; }
table.grid tr.group-row td { background: #eef2fb; border-bottom: 1px solid var(--line); padding: 8px; }
table.grid tr.group-row[data-group] { cursor: pointer; user-select: none; }
table.grid tr.group-row .caret { display: inline-block; width: 14px; color: var(--muted); }
table.grid tr.clickable:hover td { background: #f6f8ff; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow: auto; max-height: 62vh; border: 1px solid var(--line); border-radius: 8px; }
.table-wrap table.grid th { border-top: 0; }
input.count { width: 70px; text-align: right; padding: 4px 6px; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 14, 40, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; padding: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal h2 { margin-bottom: 4px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 60; box-shadow: var(--shadow); max-width: 90vw; }
.toast.error { background: var(--bad); }
.overlay { position: fixed; inset: 0; background: rgba(255, 255, 255, .75); display: grid; place-items: center; z-index: 55; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--slb-soft); border-top-color: var(--slb); border-radius: 50%; animation: spin .9s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.md ul { margin: 6px 0; padding-left: 20px; }
.md li { margin: 3px 0; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty h2 { color: var(--ink); margin-bottom: 6px; }
.overlay.boot { background: var(--bg); text-align: center; }


/* Maxwell's Exam */
.topbar nav { display: flex; gap: 4px; }
.topbar nav a { text-decoration: none; padding: 6px 10px; border-radius: 8px; font-weight: 600; color: var(--muted); }
.topbar nav a.active { background: var(--slb-soft); color: var(--slb); }
.files { display: flex; flex-direction: column; gap: 6px; }
.file { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; flex-wrap: wrap; }
.file .name { flex: 1; min-width: 160px; font-weight: 600; word-break: break-all; }
.file .name small { display: block; font-weight: 400; color: var(--muted); }
.file select { width: auto; }
.ftype { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px; background: #eef0f5; color: var(--ink); min-width: 44px; text-align: center; }
.ftype.LAS { background: #e3f5ea; color: #15803d; }
.ftype.DLIS { background: #e8ebfd; color: #0014dc; }
.ftype.PDS { background: #f3e8ff; color: #7048e8; }
.ftype.PDF { background: #fde8e8; color: #b91c1c; }
.drop { border: 2px dashed var(--line); border-radius: 10px; padding: 16px; text-align: center; color: var(--muted); cursor: pointer; background: #fafbfe; }
.drop.over { border-color: var(--slb); background: var(--slb-soft); }
.progress { height: 6px; background: #eef0f6; border-radius: 3px; overflow: hidden; margin-top: 4px; }
.progress > i { display: block; height: 100%; background: var(--slb); width: 0; transition: width .2s; }
.items { width: 100%; border-collapse: collapse; }
.items td, .items th { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.items th { font-size: 12px; color: var(--muted); }
.mistakes { margin: 4px 0 0; padding-left: 18px; }
.score { font-size: 28px; font-weight: 700; color: var(--slb-dark); }
textarea { min-height: 80px; resize: vertical; }
pre.pw { background: #f4f6fb; border: 1px solid var(--line); border-radius: 8px; padding: 10px; white-space: pre-wrap; user-select: all; }
@media (max-width: 700px) { .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; } .main { padding: 12px; } }
