/* TempleBiller — design system */
:root {
  --bg: #faf6ef;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f1f33;
  --text-2: #334155;
  --muted: #64748b;

  --primary: #8c1d18;
  --primary-600: #741812;
  --primary-700: #5c130e;
  --primary-50: #fbefe9;
  --primary-100: #f1d3c6;

  --sidebar: #3d1310;
  --sidebar-2: #4d1a15;
  --sidebar-text: #ecd5c9;

  --blue: #2563eb;   --blue-bg: #e8effd;
  --indigo: #4f46e5; --indigo-bg: #ecebfd;
  --purple: #8b3fd9; --purple-bg: #f3e9fd;
  --teal: #0d9488;   --teal-bg: #e0f5f2;
  --green: #15803d;  --green-bg: #e3f5e9;
  --amber: #b45309;  --amber-bg: #fdf1dc;
  --orange: #c2410c; --orange-bg: #fdebe1;
  --red: #c62828;    --red-bg: #fde8e8;
  --gray: #475569;   --gray-bg: #eef1f5;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(50, 20, 15, .06);
  --shadow: 0 1px 3px rgba(50, 20, 15, .07), 0 4px 14px rgba(50, 20, 15, .05);
  --shadow-lg: 0 20px 50px rgba(50, 20, 15, .2);
  --font: "Noto Sans Malayalam", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-700); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0 0 .75em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
[hidden] { display: none !important; }

.icon { width: 18px; height: 18px; flex-shrink: 0; }
.icon-xs { width: 14px; height: 14px; }
.icon-lg { width: 22px; height: 22px; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 252px; background: linear-gradient(180deg, var(--sidebar) 0%, #2a0b09 100%); color: var(--sidebar-text); display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 40; transition: transform .2s ease; }
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 18px; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #e2a73c, var(--primary)); display: grid; place-items: center; color: #fff; box-shadow: 0 4px 12px rgba(226, 167, 60, .35); flex-shrink: 0; }
.brand-mark .icon { width: 20px; height: 20px; fill: #fff; stroke: none; }
.brand-name { color: #fff; font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; }
.brand-sub { font-size: 11.5px; color: #cfa999; }
.nav { flex: 1; overflow-y: auto; padding: 6px 12px 16px; }
.nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #c39484; font-weight: 600; padding: 18px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 8px; color: var(--sidebar-text); font-weight: 500; margin: 1px 0; transition: background .15s, color .15s; }
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link.active { background: rgba(226, 167, 60, .16); color: #fff; box-shadow: inset 3px 0 0 #e9b649; }
.nav-link.active .icon { color: #f2c96a; }
.sidebar-foot { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-top: 1px solid rgba(255, 255, 255, .07); }
.sidebar-user .name { color: #fff; font-weight: 600; font-size: 13px; }
.sidebar-user .role { font-size: 11.5px; color: #cfa999; }
.sidebar-backdrop { display: none; }

.main { flex: 1; margin-left: 252px; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 62px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 0 26px; position: sticky; top: 0; z-index: 30; }
.topbar-title { font-size: 16px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-date { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.topbar-date .icon { width: 16px; height: 16px; }
.branch-switch { display: flex; align-items: center; gap: 6px; background: var(--primary-50); border: 1px solid var(--primary-100); color: var(--primary-700); border-radius: 8px; padding: 0 4px 0 10px; height: 36px; }
.branch-switch .icon { width: 16px; height: 16px; }
.branch-switch select { border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--primary-700); height: 34px; padding: 0 6px; cursor: pointer; outline: none; box-shadow: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--primary-50); color: var(--primary-700); border: 1px solid var(--primary-100); border-radius: 999px; padding: 5px 12px; font-weight: 600; font-size: 12.5px; }
.chip .icon { width: 15px; height: 15px; }
.icon-btn { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; width: 36px; height: 36px; display: inline-grid; place-items: center; cursor: pointer; color: var(--text-2); }
.only-mobile { display: none; }

.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #c2541f, var(--primary-700)); color: #fff; display: inline-grid; place-items: center; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 54px; height: 54px; font-size: 18px; }

.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 4px; cursor: pointer; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu .menu { position: absolute; right: 0; top: 46px; width: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; }
.menu-head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; display: flex; flex-direction: column; }
.menu-head span { color: var(--muted); font-size: 12.5px; word-break: break-all; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 7px; color: var(--text-2); font: inherit; background: none; border: 0; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-2); color: var(--text); }

.content { padding: 24px 26px 48px; max-width: 1480px; width: 100%; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; font-weight: 700; }
.page-head .sub { color: var(--muted); margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-head h2 .icon, .card-head h3 .icon { color: var(--primary); }
.card-head .meta { color: var(--muted); font-size: 12.5px; }
.card-body { padding: 18px; }
.card-foot { padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.card-flush .table-wrap { border: 0; border-radius: 0; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 360px; }
.grid-main-wide { grid-template-columns: minmax(0, 1fr) 400px; }
.stack > * + * { margin-top: 18px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-sm); }
.stat-icon { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }
.stat-icon .icon { width: 22px; height: 22px; }
.stat-label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat-value { font-size: 23px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.stat-hint { font-size: 12px; color: var(--muted); }
a.stat:hover { border-color: var(--primary-100); box-shadow: var(--shadow); }
.tone-blue { background: var(--blue-bg); color: var(--blue); }
.tone-teal { background: var(--teal-bg); color: var(--teal); }
.tone-green { background: var(--green-bg); color: var(--green); }
.tone-amber { background: var(--amber-bg); color: var(--amber); }
.tone-purple { background: var(--purple-bg); color: var(--purple); }
.tone-orange { background: var(--orange-bg); color: var(--orange); }
.tone-red { background: var(--red-bg); color: var(--red); }
.tone-indigo { background: var(--indigo-bg); color: var(--indigo); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; text-decoration: none; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(140, 29, 24, .3); }
.btn-primary:hover { background: var(--primary-600); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #116632; color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #a51f1f; color: #fff; }
.btn-warning { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; color: #fff; }
.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text-2); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--gray-bg); color: var(--text); }
.btn-soft { background: var(--primary-50); color: var(--primary-700); }
.btn-soft:hover { background: var(--primary-100); color: var(--primary-700); }
.btn-sm { height: 31px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
form.inline { display: inline; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px 16px; }
.col-12 { grid-column: span 12; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-2 { grid-column: span 2; } .col-9 { grid-column: span 9; }
.field label, .label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.req { color: var(--red); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], input[type=search], select, textarea {
  width: 100%; height: 38px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 11px; font: inherit; color: var(--text); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
textarea { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(140, 29, 24, .15); }
input[readonly] { background: var(--surface-2); }
input::placeholder, textarea::placeholder { color: #9aa8b9; }
.field-error { color: var(--red); font-size: 12px; margin-top: 4px; }
.help { color: var(--muted); font-size: 12px; margin-top: 4px; }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 17px; height: 17px; }
.input-icon input { padding-left: 36px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.radio-cards { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-cards label { border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-weight: 500; margin: 0; }
.radio-cards input { accent-color: var(--primary); }
.radio-cards label:has(input:checked) { border-color: var(--primary); background: var(--primary-50); color: var(--primary-700); }
.form-section { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); grid-column: span 12; padding-top: 6px; border-top: 1px dashed var(--border); margin-top: 4px; padding-top: 14px; }
.form-section:first-child { border-top: 0; margin-top: 0; padding-top: 0; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.toolbar .field { min-width: 150px; }
.toolbar .grow { flex: 1; min-width: 220px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafcfe; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--border); }
.table-compact td { padding: 8px 12px; }
.table-compact th { padding: 8px 12px; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12.5px; color: var(--muted); }
.person { display: flex; align-items: center; gap: 10px; }
.token { display: inline-grid; place-items: center; min-width: 34px; height: 34px; border-radius: 9px; background: var(--primary-50); color: var(--primary-700); font-weight: 700; font-size: 14px; padding: 0 6px; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .02em; font-weight: 600; }
.text-muted { color: var(--muted); }
.text-danger { color: var(--red); }
.text-success { color: var(--green); }
.text-right { text-align: right; }
.fw-600 { font-weight: 600; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.flex { display: flex; align-items: center; gap: 8px; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-gray { background: var(--gray-bg); color: var(--gray); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-indigo { background: var(--indigo-bg); color: var(--indigo); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-teal { background: var(--teal-bg); color: var(--teal); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-red { background: var(--red-bg); color: var(--red); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--gray-bg); color: var(--text-2); font-size: 12px; font-weight: 500; }
.tag-red { background: var(--red-bg); color: var(--red); }

/* ---------- Alerts ---------- */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 9px; margin-bottom: 16px; border: 1px solid; font-weight: 500; }
.alert .icon { margin-top: 1px; }
.alert span { flex: 1; }
.alert-success { background: #edf9f1; border-color: #bfe7cd; color: #14532d; }
.alert-error { background: #fdf0f0; border-color: #f4c7c7; color: #8a1c1c; }
.alert-warning { background: #fff8e8; border-color: #f6dfa5; color: #7a4a06; }
.alert-info { background: #ecf3fe; border-color: #c4d8fb; color: #1e3a8a; }
.alert-close { background: none; border: 0; font-size: 20px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; padding: 0 2px; }
.callout { border-left: 3px solid var(--red); background: var(--red-bg); color: #7f1d1d; padding: 9px 12px; border-radius: 0 8px 8px 0; font-size: 13px; }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty .icon { width: 40px; height: 40px; color: #b7c3d2; margin-bottom: 8px; }
.empty h3 { color: var(--text-2); font-size: 15px; margin-bottom: 4px; }

/* ---------- Patient banner ---------- */
.patient-banner { display: flex; align-items: center; gap: 16px; padding: 16px 18px; flex-wrap: wrap; }
.patient-banner .pb-main { flex: 1; min-width: 220px; }
.pb-name { font-size: 18px; font-weight: 700; }
.pb-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 13px; margin-top: 3px; }
.pb-meta b { color: var(--text-2); font-weight: 600; }
.pb-side { display: flex; gap: 8px; flex-wrap: wrap; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 9px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }

.vitals { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.vital { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; }
.vital .v-label { font-size: 11.5px; color: var(--muted); font-weight: 500; display: flex; gap: 5px; align-items: center; }
.vital .v-label .icon { width: 13px; height: 13px; }
.vital .v-value { font-size: 16px; font-weight: 700; }
.vital .v-unit { font-size: 11.5px; color: var(--muted); font-weight: 500; }

/* ---------- Stepper (visit workflow) ---------- */
.stepper { display: flex; gap: 0; padding: 18px; overflow-x: auto; }
.step { flex: 1; min-width: 96px; text-align: center; position: relative; font-size: 12px; color: var(--muted); font-weight: 500; }
.step::before { content: ""; position: absolute; top: 14px; left: -50%; right: 50%; height: 2px; background: var(--border); z-index: 0; }
.step:first-child::before { display: none; }
.step .dot { width: 30px; height: 30px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); display: grid; place-items: center; margin: 0 auto 6px; position: relative; z-index: 1; color: var(--muted); font-weight: 700; font-size: 12px; }
.step .dot .icon { width: 15px; height: 15px; }
.step.done { color: var(--text-2); }
.step.done .dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.step.done::before, .step.current::before { background: var(--primary); }
.step.current { color: var(--primary-700); font-weight: 700; }
.step.current .dot { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-50); }
.step.skipped .dot { border-style: dashed; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 26px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: -6px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 1px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--primary); }
.timeline .t-title { font-weight: 600; }
.timeline .t-time { font-size: 12px; color: var(--muted); }

/* ---------- Queue ---------- */
.queue-item { display: flex; align-items: center; gap: 14px; padding: 13px 18px; border-bottom: 1px solid var(--border); }
.queue-item:last-child { border-bottom: 0; }
.queue-item .qi-main { flex: 1; min-width: 0; }
.queue-item .qi-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.queue-item.highlight { background: linear-gradient(90deg, var(--purple-bg), transparent 60%); }
.count-pill { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--gray-bg); color: var(--text-2); font-size: 12px; font-weight: 700; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 12px; overflow-x: auto; }
.tabs a { padding: 12px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs a:hover { color: var(--text); }

/* ---------- Consultation / prescription builder ---------- */
.rx-table td { padding: 7px 8px; vertical-align: top; }
.rx-table th { padding: 8px; }
.rx-table input, .rx-table select { height: 34px; }
.test-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.test-option { display: flex; gap: 9px; align-items: flex-start; border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; cursor: pointer; transition: border-color .15s, background .15s; }
.test-option:hover { border-color: var(--primary-100); }
.test-option:has(input:checked) { border-color: var(--primary); background: var(--primary-50); }
.test-option input { margin-top: 2px; accent-color: var(--primary); }
.test-option.ordered { opacity: .6; cursor: default; background: var(--surface-2); }
.test-option .t-name { display: block; font-weight: 600; font-size: 13px; line-height: 1.35; }
.test-option .t-meta { display: block; font-size: 12px; color: var(--muted); }
.test-cat { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 14px 0 8px; }
.test-cat:first-child { margin-top: 0; }
.note-block { border: 1px solid var(--border); border-radius: 9px; padding: 12px 14px; background: var(--surface-2); }
.note-block + .note-block { margin-top: 10px; }
.note-block h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; display: flex; justify-content: space-between; }
.note-row { font-size: 13px; margin-bottom: 4px; }
.note-row b { color: var(--text-2); }
.result-abnormal { color: var(--red); font-weight: 700; }
.sticky-actions { position: sticky; bottom: 0; z-index: 10; background: rgba(255, 255, 255, .96); backdrop-filter: blur(4px); border-top: 1px solid var(--border); padding: 12px 18px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- Billing ---------- */
.bill-total { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }
.bill-total.grand { font-size: 20px; font-weight: 700; border-top: 2px solid var(--text); margin-top: 6px; padding-top: 12px; }
.pay-box { background: var(--primary-50); border: 1px solid var(--primary-100); border-radius: 10px; padding: 16px; }
.change-due { font-size: 15px; font-weight: 700; color: var(--green); }

/* ---------- Pagination ---------- */
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; flex-wrap: wrap; gap: 8px; }
.pager .pages { display: flex; gap: 4px; }
.pager a, .pager span.cur { min-width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: 7px; border: 1px solid var(--border); color: var(--text-2); padding: 0 8px; }
.pager span.cur { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- Bars (reports) ---------- */
.bar-row { display: grid; grid-template-columns: 130px 1fr 110px; gap: 12px; align-items: center; padding: 7px 0; font-size: 13px; }
.bar-track { height: 10px; background: var(--gray-bg); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #d9822b, var(--primary)); border-radius: 999px; }
.col-chart { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding: 10px 4px 0; }
.col-chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.col-chart .col-bar { width: 100%; max-width: 46px; background: linear-gradient(180deg, #d9822b, var(--primary)); border-radius: 6px 6px 0 0; min-height: 3px; }
.col-chart .col-val { font-size: 11px; color: var(--text-2); font-weight: 600; }
.col-chart .col-lbl { font-size: 11px; color: var(--muted); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(45, 12, 10, .45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal-card { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); width: 100%; max-width: 420px; padding: 22px; }
.modal-title { font-size: 16px; margin-bottom: 8px; }
.modal-text { color: var(--text-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------- Auth ---------- */
body.guest { background: var(--surface); }
.auth-wrap { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-hero { background: radial-gradient(circle at 20% 10%, #8c3b12 0%, transparent 45%), radial-gradient(circle at 90% 90%, #7a1c1c 0%, transparent 50%), linear-gradient(160deg, #3d1310, #250a08); color: #f5e6dc; padding: 40px 56px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.auth-hero::after { content: ""; position: absolute; right: -120px; top: 40%; width: 420px; height: 420px; border-radius: 50%; border: 60px solid rgba(255, 255, 255, .03); }
.brand-lg .brand-mark { width: 46px; height: 46px; }
.brand-lg .brand-name { font-size: 19px; }
.brand-lg { padding: 0; }
.auth-hero-body { margin: auto 0; max-width: 470px; position: relative; z-index: 1; }
.auth-hero h1 { color: #fff; font-size: 34px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; margin-bottom: 14px; }
.auth-hero p { color: #e3c3b5; font-size: 15.5px; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; }
.auth-points li { display: flex; align-items: center; gap: 12px; font-weight: 500; }
.auth-points .icon { width: 34px; height: 34px; padding: 8px; border-radius: 9px; background: rgba(242, 201, 106, .12); color: #f2c96a; }
.auth-hero-foot { font-size: 12.5px; color: #b98f80; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 40px; max-width: 480px; width: 100%; margin: 0 auto; }
.auth-panel h2 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.auth-panel .sub { color: var(--muted); margin-bottom: 26px; }
.auth-panel .field { margin-bottom: 16px; }
.demo-logins { margin-top: 24px; border: 1px dashed var(--border-strong); border-radius: 10px; padding: 12px 14px; font-size: 12.5px; color: var(--muted); }
.demo-logins table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.demo-logins td { padding: 3px 0; }
.demo-logins button { background: none; border: 0; color: var(--primary); cursor: pointer; font: inherit; font-weight: 600; padding: 0; }

/* ---------- Print ---------- */
.print-body { background: #e9eef3; }
.print-actions { max-width: 820px; margin: 18px auto 0; display: flex; gap: 8px; }
.print-page { background: #fff; max-width: 820px; margin: 14px auto 30px; padding: 34px 40px; box-shadow: var(--shadow); border-radius: 6px; color: #111; }
.letterhead { display: flex; align-items: center; gap: 14px; border-bottom: 2px solid var(--primary); padding-bottom: 14px; margin-bottom: 18px; }
.lh-main { flex: 1; }
.lh-name { font-size: 20px; font-weight: 700; color: var(--primary-700); }
.lh-sub { font-size: 12px; color: #555; }
.lh-doc { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #333; border: 1.5px solid #333; padding: 5px 10px; border-radius: 4px; }
.print-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 30px; font-size: 13px; margin-bottom: 16px; }
.print-grid div span { color: #666; display: inline-block; min-width: 110px; }
.print-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0 16px; }
.print-table th { text-align: left; background: #f1f5f9; padding: 7px 9px; border: 1px solid #d5dde6; font-size: 12px; }
.print-table td { padding: 7px 9px; border: 1px solid #d5dde6; }
.print-section { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--primary-700); margin: 16px 0 6px; }
.signature { margin-top: 50px; display: flex; justify-content: flex-end; }
.signature div { text-align: center; border-top: 1px solid #333; padding-top: 6px; min-width: 200px; font-size: 13px; }
.print-foot { margin-top: 30px; font-size: 11px; color: #888; text-align: center; border-top: 1px solid #e3e3e3; padding-top: 10px; }
.slip-token { font-size: 54px; font-weight: 800; color: var(--primary-700); line-height: 1; }
@media print {
  .no-print { display: none !important; }
  body, .print-body { background: #fff; }
  .print-page { box-shadow: none; margin: 0; max-width: none; padding: 0; }
  @page { margin: 14mm; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .grid-main-wide { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(45, 12, 10, .45); z-index: 35; }
  .main { margin-left: 0; }
  .only-mobile { display: inline-grid; }
  .hide-mobile { display: none !important; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px 40px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
}
@media (max-width: 640px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .form-grid > [class*="col-"] { grid-column: span 12; }
  .branch-switch select { max-width: 120px; }
  .kv { grid-template-columns: 110px 1fr; }
  .bar-row { grid-template-columns: 90px 1fr 80px; }
  .queue-item { flex-wrap: wrap; }
  .print-page { padding: 20px; }
  .print-grid { grid-template-columns: 1fr; }
}

/* ================= TempleBiller additions ================= */
body { font-size: 14.5px; }
.logo { flex-shrink: 0; border-radius: 12px; box-shadow: 0 4px 12px rgba(0, 0, 0, .25); }
.nav-link.nav-cta { background: linear-gradient(135deg, #e2a73c, #c9782a); color: #2a0b09; font-weight: 700; margin-bottom: 6px; }
.nav-link.nav-cta .icon { color: #2a0b09 !important; }
.nav-link.nav-cta:hover, .nav-link.nav-cta.active { background: linear-gradient(135deg, #f0bb52, #d98a32); color: #2a0b09; box-shadow: none; }
.icon-btn-sm { width: 30px; height: 30px; }
.icon-btn-sm .icon { width: 15px; height: 15px; }
.icon-btn:hover { border-color: var(--red); color: var(--red); }
kbd { font: 600 11px/1 var(--font); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px; background: var(--surface); }
.text-center { text-align: center; }
.stack-sm > * + * { margin-top: 14px; }

/* Billing screen */
.bill-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.bill-main > .card + .card { margin-top: 18px; }
.sticky-card { position: sticky; top: 80px; }
.vz-block { padding: 16px 18px; border-bottom: 1px solid var(--border); }
.vz-block:nth-child(even) { background: #fffcf8; }
.vz-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 10px; }
.vz-no { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; margin-bottom: 4px; }
.vz-name-field { flex: 1; }
.vz-name { font-size: 16px; font-weight: 600; height: 42px !important; }
.vz-rate-field { width: 150px; }
.vz-rate[readonly] { color: var(--primary-700); font-weight: 700; }
.persons { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.persons input, .bill-items input { height: 36px; }
.vz-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.vz-amount { color: var(--text-2); }
.vz-amount b { color: var(--primary-700); font-size: 15px; }
.bill-summary { border-top: 1px dashed var(--border-strong); padding-top: 12px; max-height: 260px; overflow: auto; font-size: 13.5px; }
.sum-row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.bill-grand { display: flex; justify-content: space-between; align-items: baseline; border-top: 2px solid var(--text); padding-top: 10px; }
.bill-grand strong { font-size: 28px; color: var(--primary-700); letter-spacing: -.02em; }

/* Suggestions dropdown */
.suggest { position: absolute; z-index: 200; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 320px; overflow: auto; padding: 4px; }
.sg-item { display: flex; align-items: baseline; gap: 8px; padding: 9px 11px; border-radius: 7px; cursor: pointer; font-size: 15px; }
.sg-item b { font-weight: 600; }
.sg-item.on, .sg-item:hover { background: var(--primary-50); }
.sg-item.on b { color: var(--primary-700); }
.sg-sub { color: var(--muted); font-size: 12.5px; }
.sg-right { margin-left: auto; padding-left: 14px; color: var(--text-2); font-size: 12.5px; white-space: nowrap; font-weight: 600; }

/* Lists */
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--primary-50); color: var(--primary-700); border: 1px solid var(--primary-100); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600; }
.pill b { background: var(--primary); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 12px; }
a.pill:hover { border-color: var(--primary); }
.stock-num { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.row-cancelled td { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(198, 40, 40, .5); }
.row-cancelled td.actions, .row-cancelled td .badge { text-decoration: none; }
.kv-wide { grid-template-columns: 170px 1fr; }

/* Small thermal-style receipt */
.receipt-body { background: #ece6dd; margin: 0; font-family: var(--font); }
.receipt-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 16px; }
.receipt { background: #fff; color: #000; width: 80mm; margin: 0 auto 30px; padding: 5mm 4mm; box-shadow: var(--shadow); font-size: 12.5px; line-height: 1.4; }
.receipt.w58 { width: 58mm; font-size: 11px; padding: 4mm 3mm; }
.rc-head { text-align: center; border-bottom: 1px dashed #000; padding-bottom: 6px; margin-bottom: 6px; }
.rc-temple { font-size: 15px; font-weight: 700; line-height: 1.3; }
.w58 .rc-temple { font-size: 13px; }
.rc-sub { font-size: 11px; }
.rc-title { display: inline-block; margin-top: 5px; font-weight: 700; border: 1px solid #000; padding: 1px 8px; border-radius: 3px; font-size: 12px; }
.rc-meta { display: flex; justify-content: space-between; gap: 6px; font-size: 11.5px; }
.rc-line { border-top: 1px dashed #000; margin: 6px 0; }
.rc-vz { margin: 6px 0 2px; display: flex; justify-content: space-between; gap: 6px; font-weight: 700; }
.rc-person { display: flex; justify-content: space-between; gap: 6px; padding-left: 8px; font-size: 12px; }
.w58 .rc-person { font-size: 10.5px; }
.rc-person span:last-child { white-space: nowrap; }
.rc-calc { text-align: right; font-size: 11px; }
.rc-item { display: flex; justify-content: space-between; gap: 6px; }
.rc-total { display: flex; justify-content: space-between; font-size: 16px; font-weight: 800; border-top: 1.5px solid #000; border-bottom: 1.5px solid #000; padding: 4px 0; margin-top: 6px; }
.rc-words { font-size: 10.5px; margin-top: 4px; }
.rc-foot { text-align: center; margin-top: 8px; font-size: 11.5px; }
.rc-cancel { text-align: center; font-weight: 800; font-size: 16px; border: 2px solid #000; margin: 6px 0; padding: 2px; }
@media print {
  .receipt-body { background: #fff; }
  .receipt { box-shadow: none; margin: 0; }
}

@media (max-width: 1100px) {
  .bill-layout { grid-template-columns: minmax(0, 1fr); }
  .sticky-card { position: static; }
}
@media (max-width: 640px) {
  .vz-head { flex-wrap: wrap; }
  .vz-name-field { flex-basis: calc(100% - 50px); }
  .vz-rate-field { width: auto; flex: 1; }
}
