/* CareQueue V1 — clean professional medical UI: white / slate / teal.
   Hospital brand color is applied at runtime via --brand. */
:root {
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-soft: #ccfbf1;
  --ink: #0f172a;
  --slate: #475569;
  --muted: #94a3b8;
  --line: #e2e8f0;
  --bg: #eef2f6;
  --card: #ffffff;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --info: #1d4ed8;
  --info-bg: #dbeafe;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
button { font: inherit; }

/* ---------- generic ---------- */
.boot, .loading { text-align: center; padding: 48px 20px; color: var(--slate); }
.spin {
  width: 34px; height: 34px; margin: 0 auto 12px;
  border: 3px solid var(--line); border-top-color: var(--brand);
  border-radius: 50%; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.err {
  background: var(--bad-bg); color: var(--bad);
  border: 1px solid #fecaca; border-radius: 8px;
  padding: 10px 12px; margin: 12px 0; font-size: 14px;
  white-space: pre-wrap; word-break: break-word;
}
.okmsg {
  background: var(--ok-bg); color: var(--ok);
  border: 1px solid #bbf7d0; border-radius: 8px;
  padding: 10px 12px; margin: 12px 0; font-size: 14px;
}
.note {
  background: #f8fafc; color: var(--slate);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; margin: 12px 0; font-size: 13px;
}
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.grow { flex: 1; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; border: 1px solid var(--line);
  background: #fff; color: var(--ink);
  border-radius: 10px; padding: 10px 16px; cursor: pointer;
  font-weight: 600; text-decoration: none; text-align: center;
}
.btn:hover { background: #f8fafc; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #991b1b; }
.btn-ghost { border-color: transparent; color: var(--brand); background: transparent; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn-block { display: block; width: 100%; margin: 8px 0; padding: 13px; font-size: 16px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.linklike { background: none; border: none; color: var(--brand); cursor: pointer; padding: 4px; font-weight: 600; }

/* ---------- forms ---------- */
.field { margin: 12px 0; }
.field label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 14px; }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
.input:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea.input { min-height: 74px; resize: vertical; }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.f3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
fieldset.vitals { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 14px 0; }
fieldset.vitals legend { font-weight: 700; padding: 0 6px; font-size: 14px; }

/* ---------- cards / tables ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin: 12px 0;
}
.card h3 { margin: 0 0 8px; font-size: 16px; }
.tablewrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.table th, table.table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.table th { color: var(--slate); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; background: #f8fafc; }
table.table tr:last-child td { border-bottom: none; }
table.table tr.clickable { cursor: pointer; }
table.table tr.clickable:hover td { background: #f8fafc; }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
.b-booked { background: var(--info-bg); color: var(--info); }
.b-checkin, .b-checkedin { background: var(--warn-bg); color: var(--warn); }
.b-completed { background: var(--ok-bg); color: var(--ok); }
.b-cancelled { background: #f1f5f9; color: var(--slate); }
.b-active { background: var(--ok-bg); color: var(--ok); }
.b-inactive { background: #f1f5f9; color: var(--slate); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 10px; font-size: 14px; }
.kv dt { color: var(--slate); } .kv dd { margin: 0; font-weight: 600; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 12px 0; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.stat .n { font-size: 26px; font-weight: 800; color: var(--brand-dark); }
.stat .l { font-size: 13px; color: var(--slate); margin-top: 2px; }

/* ---------- patient app (mobile-first) ---------- */
.patient-shell {
  max-width: 480px; margin: 0 auto; min-height: 100dvh;
  background: #fff; box-shadow: 0 0 24px rgba(15, 23, 42, 0.10);
  display: flex; flex-direction: column;
}
.p-head { background: var(--brand); color: #fff; padding: 14px 16px; }
.p-brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: #fff; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 10px; background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800; color: #fff;
}
.p-name { font-size: 18px; font-weight: 800; }
.p-tag { font-size: 12px; opacity: 0.85; }
.p-body { padding: 16px; flex: 1; }
.p-foot { padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; text-align: center; }
.p-foot a { color: var(--brand); }
.hero-logo { width: 84px; height: 84px; border-radius: 18px; object-fit: cover; margin: 8px auto; display: block; }
.hero-mark {
  width: 84px; height: 84px; border-radius: 18px; margin: 8px auto;
  background: var(--brand-soft); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center; font-size: 44px; font-weight: 800;
}
.backlink { display: inline-block; margin-bottom: 6px; color: var(--slate); text-decoration: none; font-weight: 600; font-size: 14px; }
.menu-btn {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 10px 0; cursor: pointer; text-align: left; box-shadow: var(--shadow);
  font-size: 16px; font-weight: 700; color: var(--ink);
}
.menu-btn:hover { border-color: var(--brand); }
.menu-btn .ico {
  width: 42px; height: 42px; border-radius: 10px; flex: none;
  background: var(--brand-soft); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800;
}
.menu-btn small { display: block; font-weight: 400; color: var(--slate); font-size: 13px; }
.doc-card {
  display: flex; gap: 12px; align-items: center; width: 100%;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
  padding: 14px; margin: 8px 0; cursor: pointer; text-align: left; box-shadow: var(--shadow);
}
.doc-card:hover { border-color: var(--brand); }
.doc-av {
  width: 48px; height: 48px; border-radius: 50%; flex: none;
  background: var(--brand-soft); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800;
}
.slot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.slot {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 10px 4px; font-size: 14px; font-weight: 700; cursor: pointer; color: var(--ink);
}
.slot:hover { border-color: var(--brand); }
.slot.sel { background: var(--brand); border-color: var(--brand); color: #fff; }
.token-big {
  font-size: 56px; font-weight: 800; color: var(--brand-dark);
  text-align: center; margin: 8px 0;
}
.idcard {
  border: 2px solid var(--brand); border-radius: 16px; padding: 20px; margin: 12px 0;
  background: linear-gradient(180deg, #fff, #f8fafc);
}
.idcard .h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.file-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.file-row:last-child { border-bottom: none; }
.otp-input { font-size: 24px !important; letter-spacing: 0.5em; text-align: center; font-weight: 800; }

/* ---------- staff / owner panels ---------- */
.staff-shell { display: flex; min-height: 100dvh; }
.side {
  width: 236px; flex: none; background: #0f172a; color: #e2e8f0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh;
}
.side .sbrand { padding: 18px 16px; border-bottom: 1px solid #1e293b; }
.side .sbrand .n { font-weight: 800; font-size: 16px; color: #fff; }
.side .sbrand .r { font-size: 12px; color: #94a3b8; text-transform: capitalize; }
.snav { flex: 1; overflow-y: auto; padding: 8px; }
.snav button {
  display: block; width: 100%; text-align: left; background: none; border: none;
  color: #cbd5e1; padding: 11px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600;
}
.snav button:hover { background: #1e293b; color: #fff; }
.snav button.on { background: var(--brand); color: #fff; }
.side .sfoot { padding: 12px 16px; border-top: 1px solid #1e293b; font-size: 13px; color: #94a3b8; }
.main { flex: 1; min-width: 0; padding: 20px 22px; max-width: 1180px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.topbar h1 { font-size: 20px; margin: 0; }
.login-wrap { max-width: 400px; margin: 8vh auto; }
.login-wrap .card { padding: 26px; }
.expand { background: #f8fafc; border: 1px dashed var(--line); border-radius: 10px; padding: 12px; margin: 10px 0; }
.qrow td .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* timing editor */
.tday { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin: 8px 0; }
.tday .dh { font-weight: 700; margin-bottom: 6px; }
.rrange { display: flex; gap: 6px; align-items: center; margin: 6px 0; }
.rrange .input { max-width: 150px; }

/* ---------- print: OPD slip ---------- */
#print-root { display: none; }
@media print {
  #app, .no-print { display: none !important; }
  #print-root { display: block !important; }
  body { background: #fff; font-size: 13px; }
}
.slip { max-width: 720px; margin: 0 auto; color: #111; font-family: Arial, Helvetica, sans-serif; }
.slip-head { display: flex; gap: 14px; align-items: center; border-bottom: 3px solid var(--brand); padding-bottom: 10px; }
.slip-head img { width: 64px; height: 64px; object-fit: contain; }
.slip-head .hn { font-size: 22px; font-weight: 800; }
.slip-head .ht { font-size: 12px; color: #444; }
.slip-head .hc { font-size: 12px; color: #444; margin-left: auto; text-align: right; }
.slip h2 { text-align: center; font-size: 18px; margin: 12px 0; letter-spacing: 1px; }
.slip table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.slip table th, .slip table td { border: 1px solid #999; padding: 6px 8px; font-size: 13px; text-align: left; }
.slip table th { background: #f1f5f9; }
.slip .sec { font-weight: 800; margin: 12px 0 4px; font-size: 14px; border-bottom: 1px solid #ccc; padding-bottom: 3px; }
.slip .tok { font-size: 20px; font-weight: 800; }
.slip .sign { display: flex; justify-content: space-between; margin-top: 34px; font-size: 13px; }
.slip .sign div { border-top: 1px solid #333; padding-top: 4px; width: 40%; text-align: center; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .staff-shell { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; }
  .snav { display: flex; overflow-x: auto; padding: 6px; }
  .snav button { white-space: nowrap; width: auto; }
  .side .sfoot { display: none; }
  .main { padding: 14px; }
  .f2, .f3 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 110px 1fr; }
}
