/* HWP Diagnostic admin panel */
:root {
  --navy: #0E3F6C; --navy-deep: #082B4B; --red: #E00646; --ink: #0B1B2E; --soft: #56677D; --faint: #8A98AA;
  --line: #E2E9F1; --paper: #F5F8FB; --white: #fff; --green: #12915A; --green-soft: #E5F6EE; --amber: #B7791F;
  --amber-soft: #FEF6E7; --red-soft: #FDE8EE; --blue-soft: #E8F0F8; --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14.5px/1.5 Inter, system-ui, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--paper); }
a { color: var(--navy); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 24px; margin: 0; letter-spacing: -.01em; } h2 { font-size: 17px; margin: 0; }
.muted { color: var(--soft); } .faint { color: var(--faint); font-size: 12.5px; }

/* login */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, var(--navy-deep), var(--navy)); }
.login-card { width: 100%; max-width: 400px; background: var(--white); border-radius: 20px; padding: 32px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-card .brand { font-weight: 800; font-size: 20px; color: var(--navy); }
.login-card .brand span { color: var(--red); }

/* shell */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100%; }
.side { background: var(--navy-deep); color: #fff; padding: 20px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { font-weight: 800; font-size: 18px; padding: 4px 12px 18px; }
.side .brand span { color: #FF7A9E; } .side .brand small { display: block; font-weight: 500; font-size: 11.5px; color: rgba(255,255,255,.55); }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 10px; color: rgba(255,255,255,.78); font-weight: 600; }
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.nav a.on { background: var(--red); color: #fff; }
.nav .count { background: #fff; color: var(--red); border-radius: 999px; font-size: 11.5px; font-weight: 800; padding: 1px 7px; }
.nav a.on .count { color: var(--red); }
.side .foot { margin-top: 18px; padding: 12px; border-top: 1px solid rgba(255,255,255,.12); font-size: 12.5px; color: rgba(255,255,255,.6); }
.side .foot button { margin-top: 8px; background: rgba(255,255,255,.1); border: 0; color: #fff; padding: 8px 12px; border-radius: 8px; cursor: pointer; width: 100%; }
.main { padding: 26px 28px 60px; min-width: 0; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.topbar { display: none; }

/* pieces */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; gap: 14px; } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat .n { font-size: 28px; font-weight: 800; letter-spacing: -.02em; } .stat .l { color: var(--soft); font-size: 13px; }
.stat.hot { border-color: var(--red); background: var(--red-soft); } .stat.hot .n { color: var(--red); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { border: 1px solid var(--line); background: var(--white); border-radius: 10px; padding: 8px 14px; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--navy); } .btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; } .btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; } .btn.ghost { border-color: transparent; color: var(--navy); }
.btn.sm { padding: 5px 10px; font-size: 13px; } .btn.danger { color: var(--red); }
.in { border: 1px solid var(--line); background: var(--white); border-radius: 10px; padding: 9px 12px; width: 100%; outline: none; }
.in:focus { border-color: var(--navy); } .in.auto { width: auto; } .in.num { width: 96px; text-align: right; }
label.f { display: block; font-weight: 600; font-size: 13px; } label.f .in { margin-top: 5px; font-weight: 400; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--line); background: var(--white); padding: 7px 14px; border-radius: 999px; font-weight: 600; cursor: pointer; }
.tabs button.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.badge { display: inline-block; border-radius: 6px; padding: 2px 8px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; background: var(--paper); color: var(--soft); }
.badge.new, .badge.rejected { background: var(--red-soft); color: var(--red); } .badge.contacted, .badge.pending, .badge.scheduled { background: var(--amber-soft); color: var(--amber); }
.badge.confirmed, .badge.booked, .badge.approved, .badge.published, .badge.active { background: var(--green-soft); color: var(--green); }
.badge.sample_collected, .badge.processing { background: var(--amber-soft); color: var(--amber); }
.badge.report_ready, .badge.completed { background: var(--green-soft); color: var(--green); }
.badge.sent { background: var(--blue-soft); color: var(--navy); }
table { width: 100%; border-collapse: collapse; } th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); padding: 10px 12px; background: var(--paper); }
td { padding: 11px 12px; border-top: 1px solid var(--line); vertical-align: top; } .tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.lead { display: grid; gap: 8px; } .lead .top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.lead .name { font-weight: 700; font-size: 15.5px; } .lead .phone { font-weight: 800; color: var(--navy); margin-left: 8px; }
.empty { padding: 34px; text-align: center; color: var(--soft); }
.err { background: var(--red-soft); color: var(--red); border-radius: 10px; padding: 10px 12px; font-weight: 600; margin-bottom: 12px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 110px; } .bars div { flex: 1; background: var(--navy); border-radius: 5px 5px 0 0; min-height: 3px; position: relative; }
.bars div span { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--faint); white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
#toast { position: fixed; right: 20px; bottom: 20px; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 600; opacity: 0; transform: translateY(10px); transition: .2s; pointer-events: none; max-width: 360px; z-index: 50; }
#toast.show { opacity: 1; transform: none; } #toast.bad { background: var(--red); }
textarea.in { min-height: 240px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 40; transform: translateX(-102%); transition: .2s; height: auto; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
  .topbar { display: flex; align-items: center; gap: 12px; background: var(--navy-deep); color: #fff; padding: 12px 16px; font-weight: 800; position: sticky; top: 0; z-index: 30; }
  .topbar button { background: rgba(255,255,255,.12); border: 0; color: #fff; border-radius: 8px; padding: 6px 10px; cursor: pointer; }
  .main { padding: 18px 14px 60px; } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g2 { grid-template-columns: 1fr; }
}
