/* ===== Lab Management System — no build step required ===== */
:root {
  --ink: #0b1f2a;
  --ink-2: #33475b;
  --muted: #6b7c8f;
  --line: #e3e8ee;
  --bg: #f4f6f8;
  --card: #ffffff;
  --brand: #0e7c86;
  --brand-dark: #0a5c64;
  --brand-soft: #e3f4f5;
  --side: #0b2530;
  --side-2: #12333f;
  --red: #c2352b;   --red-soft: #fdecea;
  --amber: #b26b00; --amber-soft: #fff4e0;
  --green: #1e7d4f; --green-soft: #e5f5ec;
  --blue: #2457b3;  --blue-soft: #e8effc;
  --violet: #6a3fb5; --violet-soft: #f0eafb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 40, 60, .06), 0 1px 1px rgba(16, 40, 60, .04);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; color: var(--ink); background: var(--bg); line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---- Shell ---- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--side) 236px, transparent 236px); }
.side { background: var(--side); color: #c8d6dd; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.logo { display: flex; gap: 10px; align-items: center; color: #fff; padding: 4px 8px 18px; }
.logo-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; font-weight: 800; color: #fff; }
.logo b { display: block; font-size: 14px; line-height: 1.2; }
.logo span { font-size: 11px; color: #8fb0bd; }
.nav-label { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #6e8f9c; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; color: #c8d6dd; padding: 8px 10px; border-radius: 7px; font-weight: 500; }
.nav a:hover { background: var(--side-2); text-decoration: none; color: #fff; }
.nav a.active { background: var(--brand); color: #fff; }
.nav svg { width: 17px; height: 17px; flex: none; opacity: .9; }
.side-user { margin-top: 20px; padding: 12px 10px; border-top: 1px solid #1f4250; font-size: 12px; }
.side-user b { color: #fff; display: block; font-size: 13px; }
.side-user button { margin-top: 8px; }

.main { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 28px; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar .crumb { color: var(--muted); font-size: 13px; }
.content { padding: 24px 28px 48px; max-width: 1280px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 2px 0 0; color: var(--muted); }

/* ---- Cards & grid ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.stack > * + * { margin-top: 16px; }

.stat { padding: 16px 18px; }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12px; color: var(--muted); }
.stat.alert .v { color: var(--red); }
.stat a { color: inherit; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #fafbfc; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfcfd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }

/* ---- Badges ---- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: #eef1f4; color: var(--ink-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.b-registered, .b-unpaid, .b-partial, .b-collected { background: var(--amber-soft); color: var(--amber); }
.b-paid { background: var(--blue-soft); color: var(--blue); }
.b-in_lab, .b-dispatched, .b-received { background: var(--violet-soft); color: var(--violet); }
.b-completed, .b-pay-paid { background: var(--green-soft); color: var(--green); }
.b-cancelled, .b-rejected, .b-overdue { background: var(--red-soft); color: var(--red); }
.flag-H, .flag-L { color: var(--red); font-weight: 700; }

/* ---- Forms ---- */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field { margin-bottom: 14px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=tel], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #cfd8e1; border-radius: 8px; font: inherit; color: var(--ink); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(14,124,134,.25); border-color: var(--brand); }
textarea { min-height: 70px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin: 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.filters .field { margin: 0; min-width: 140px; }
.error-text { color: var(--red); font-size: 12px; margin-top: 4px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; background: var(--brand); color: #fff; white-space: nowrap; }
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn-light { background: #fff; color: var(--ink); border-color: #cfd8e1; }
.btn-light:hover { background: #f3f6f8; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #a42a21; }
.btn-ghost { background: transparent; color: var(--muted); border: 0; padding: 6px 8px; }
.btn-ghost:hover { background: rgba(255,255,255,.08); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Alerts ---- */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; font-weight: 500; }
.alert-success { background: var(--green-soft); border-color: #bfe3cf; color: #145c39; }
.alert-error { background: var(--red-soft); border-color: #f3c5c0; color: #8f241c; }
.alert-info { background: var(--brand-soft); border-color: #bfe2e5; color: var(--brand-dark); }
.alert ul { margin: 4px 0 0 18px; padding: 0; }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 14px; }
.tabs a { padding: 12px 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: #eef1f4; font-size: 11px; text-align: center; margin-left: 4px; }

/* ---- Test picker ---- */
.picker-cat { padding: 10px 20px 4px; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; padding: 6px 20px 14px; }
.pick { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; cursor: pointer; font-weight: 500; margin: 0; }
.pick:hover { border-color: #b6c5d1; }
.pick input { margin-top: 3px; accent-color: var(--brand); width: 16px; height: 16px; }
.pick .t { flex: 1; color: var(--ink); }
.pick .t small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; }
.pick .p { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; }
.pick:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.totals { font-variant-numeric: tabular-nums; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .grand { font-size: 18px; font-weight: 700; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.sticky { position: sticky; top: 16px; }

/* ---- Timeline ---- */
.timeline { list-style: none; margin: 0; padding: 4px 20px 16px; }
.timeline li { position: relative; padding: 8px 0 8px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 13px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--brand); }
.timeline .when { font-size: 11.5px; color: var(--muted); }

/* ---- Pipeline / progress ---- */
.pipeline { display: flex; gap: 0; margin: 4px 0 2px; }
.pipeline div { flex: 1; text-align: center; font-size: 11.5px; font-weight: 600; color: var(--muted); position: relative; padding-top: 18px; }
.pipeline div::before { content: ""; position: absolute; top: 5px; left: 0; right: 0; height: 3px; background: var(--line); }
.pipeline div::after { content: ""; position: absolute; top: 0; left: calc(50% - 7px); width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--line); }
.pipeline div.done { color: var(--brand-dark); }
.pipeline div.done::before, .pipeline div.done::after { background: var(--brand); border-color: var(--brand); }
.pipeline div.now::after { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }

/* ---- Credentials box ---- */
.cred { border: 2px dashed var(--brand); background: var(--brand-soft); border-radius: 10px; padding: 14px 16px; }
.cred .mono { font-size: 16px; font-weight: 700; color: var(--ink); }

/* ---- Pagination ---- */
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.pager .links { display: flex; gap: 6px; }

/* ---- Public / portal ---- */
.public { min-height: 100vh; display: flex; flex-direction: column; background: linear-gradient(180deg, #e8f3f4 0, var(--bg) 360px); }
.pub-top { display: flex; justify-content: space-between; align-items: center; padding: 18px 32px; max-width: 1120px; width: 100%; margin: 0 auto; }
.pub-top .logo { color: var(--ink); padding: 0; }
.pub-top .logo span { color: var(--muted); }
.pub-main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 12px 32px 48px; }
.auth-card { max-width: 410px; margin: 40px auto; }
.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; padding: 40px 0; }
.hero h1 { font-size: 40px; letter-spacing: -.03em; line-height: 1.08; }
.hero p.lead { font-size: 17px; color: var(--ink-2); max-width: 520px; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; }
.steps .card { padding: 16px; }
.steps .n { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 13px; margin-bottom: 8px; }
.pub-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }
.report-tile { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.report-tile:last-child { border-bottom: 0; }

.empty { padding: 34px 20px; text-align: center; color: var(--muted); }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .split, .g3, .g4, .hero, .steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .split, .g2, .g3, .g4, .hero, .steps { grid-template-columns: 1fr; }
  .content, .pub-main { padding: 16px; }
  .topbar, .pub-top { padding: 12px 16px; }
  .hero h1 { font-size: 30px; }
}
