/* Sunrise Family Clinics — Clinic Management System */
:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --bg: #f2f5f8;
  --bg-2: #e9eef4;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef3f7;
  --border: #dce5ec;
  --border-strong: #c8d5e0;
  --text: #152235;
  --text-2: #34465c;
  --muted: #667a90;
  --faint: #8b9bad;
  --accent: #0f766e;
  --accent-strong: #0b5d57;
  --accent-soft: #d9f3ef;
  --accent-ink: #0b4f4a;
  --blue: #2563eb;
  --blue-soft: #e3ecff;
  --danger: #dc2626;
  --danger-soft: #fee7e7;
  --warning: #b45309;
  --warning-soft: #fdf0d5;
  --success: #15803d;
  --success-soft: #e2f6e8;
  --violet: #6d4aff;
  --violet-soft: #eee9ff;
  --sidebar: #0b1727;
  --sidebar-2: #0f2035;
  --sidebar-text: #c7d3e2;
  --sidebar-muted: #7f93aa;
  --sidebar-border: #1b2d44;
  --shadow-sm: 0 1px 2px rgba(15, 32, 53, .06);
  --shadow: 0 10px 30px rgba(15, 32, 53, .08);
  --shadow-lg: 0 24px 60px rgba(8, 20, 36, .2);
  --radius: 14px;
  --radius-sm: 9px;
  --ring: 0 0 0 3px rgba(15, 118, 110, .22);
  --header-h: 64px;
  --sidebar-w: 258px;
}
[data-theme="dark"] {
  --bg: #080f19;
  --bg-2: #0b1421;
  --surface: #0f1b2b;
  --surface-2: #122134;
  --surface-3: #18283d;
  --border: #20344b;
  --border-strong: #2c4562;
  --text: #e8eff8;
  --text-2: #c2d0e0;
  --muted: #8fa4bb;
  --faint: #6e839b;
  --accent: #2dd4bf;
  --accent-strong: #5eead4;
  --accent-soft: #103832;
  --accent-ink: #8ff5e6;
  --blue: #7aa9ff;
  --blue-soft: #14294a;
  --danger: #f87171;
  --danger-soft: #3a1c20;
  --warning: #fbbf24;
  --warning-soft: #3a2c12;
  --success: #4ade80;
  --success-soft: #123122;
  --violet: #a78bfa;
  --violet-soft: #261f45;
  --sidebar: #07101c;
  --sidebar-2: #0b1929;
  --sidebar-text: #c8d6e6;
  --sidebar-muted: #7d93ab;
  --sidebar-border: #17283d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 14px 34px rgba(0, 0, 0, .28);
  --shadow-lg: 0 30px 70px rgba(0, 0, 0, .5);
  --ring: 0 0 0 3px rgba(45, 212, 191, .25);
}
* { box-sizing: border-box; }
svg.icon { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: -3px; }
html, body { min-height: 100%; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1,h2,h3,h4 { margin: 0; line-height: 1.25; letter-spacing: -.015em; }
h1 { font-size: 26px; font-weight: 680; }
h2 { font-size: 20px; font-weight: 650; }
h3 { font-size: 16px; font-weight: 650; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

/* Boot */
.boot-screen { min-height: 100vh; display: grid; place-content: center; gap: 16px; justify-items: center; color: var(--muted); }
.boot-mark { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Shell */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--sidebar);
  border-right: 1px solid var(--sidebar-border); display: flex; flex-direction: column; z-index: 40;
  transition: transform .22s ease;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px 16px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 40px;
  background: linear-gradient(145deg, #2dd4bf, #0f766e); display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(45, 212, 191, .25);
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-name { font-weight: 700; font-size: 15px; color: #f2f7fc; letter-spacing: -.01em; }
.brand-sub { font-size: 11px; color: var(--sidebar-muted); letter-spacing: .04em; text-transform: uppercase; }
.branch-chip {
  margin: 0 14px 12px; padding: 10px 12px; border: 1px solid var(--sidebar-border); border-radius: 10px;
  background: rgba(255,255,255,.035); color: var(--sidebar-text); font-size: 12px; display: flex; gap: 8px; align-items: center;
}
.branch-chip svg { width: 15px; height: 15px; color: var(--accent); flex: none; }
.branch-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { flex: 1; overflow-y: auto; padding: 2px 10px 18px; scrollbar-width: thin; }
.nav-group { margin-top: 14px; }
.nav-label { padding: 0 10px 7px; font-size: 10px; font-weight: 700; letter-spacing: .12em; color: var(--sidebar-muted); text-transform: uppercase; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; margin: 2px 0; border-radius: 8px;
  color: var(--sidebar-text); font-size: 13.5px; font-weight: 500; border: 1px solid transparent; cursor: pointer;
}
.nav-link svg { width: 18px; height: 18px; opacity: .85; flex: none; }
.nav-link:hover { background: rgba(255,255,255,.055); text-decoration: none; color: #fff; }
.nav-link.active { background: rgba(45,212,191,.12); border-color: rgba(45,212,191,.22); color: #d9fff9; }
.nav-link.active svg { color: var(--accent); opacity: 1; }
.sidebar-foot { padding: 12px 16px 16px; border-top: 1px solid var(--sidebar-border); font-size: 11px; color: var(--sidebar-muted); }
.sidebar-foot strong { color: var(--sidebar-text); font-weight: 600; display: block; font-size: 12px; }
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--header-h); display: flex; align-items: center; gap: 14px;
  padding: 0 24px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 15px; font-weight: 650; white-space: nowrap; }
.topbar-crumb { color: var(--faint); font-size: 12px; margin-left: 2px; }
.topbar-spacer { flex: 1; }
.global-search { position: relative; width: 280px; max-width: 34vw; }
.global-search input { width: 100%; height: 36px; padding: 0 12px 0 36px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.global-search svg { position: absolute; left: 11px; top: 9px; width: 17px; height: 17px; color: var(--faint); pointer-events: none; }
.branch-select { height: 36px; max-width: 230px; padding: 0 30px 0 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: 12.5px; }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-wrap { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 170px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 5px; z-index: 60;
}
.menu-pop button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; background: none; color: var(--text); text-align: left; border-radius: 7px; cursor: pointer; font-size: 13px; }
.menu-pop button:hover { background: var(--surface-3); }
.menu-pop button.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.menu-pop .menu-title { padding: 7px 10px 4px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.user-box { display: flex; align-items: center; gap: 9px; padding-left: 8px; border-left: 1px solid var(--border); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(145deg, #134e4a, #0f766e); color: #d5fff9; font-size: 12px; font-weight: 700; }
.user-meta { line-height: 1.25; }
.user-meta strong { display: block; font-size: 12.5px; font-weight: 650; }
.user-meta span { font-size: 10.5px; color: var(--muted); }
.menu-btn { display: none; }
.content { padding: 24px 28px 64px; width: 100%; max-width: 1560px; margin: 0 auto; flex: 1; }
.sidebar-overlay { display: none; }

/* Page header */
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .page-title { flex: 1; min-width: 220px; }
.page-head p { color: var(--muted); margin-top: 5px; font-size: 13px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Cards & grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 14.5px; }
.card-body { padding: 18px 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }
.split { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(300px,1fr); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12px; }
.right { text-align: right; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.w-full { width: 100%; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { position: relative; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 13px; box-shadow: var(--shadow-sm); overflow: hidden; }
.kpi-label { font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -.03em; margin-top: 6px; line-height: 1.1; }
.kpi-sub { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.kpi-icon { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.kpi-icon svg { width: 18px; height: 18px; }
.kpi-icon.blue { background: var(--blue-soft); color: var(--blue); }
.kpi-icon.warn { background: var(--warning-soft); color: var(--warning); }
.kpi-icon.violet { background: var(--violet-soft); color: var(--violet); }
.kpi-icon.danger { background: var(--danger-soft); color: var(--danger); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font-weight: 550; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-theme="dark"] .btn-primary { color: #04221f; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.93); background: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 11.5px; border-radius: 6px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-link { border: 0; background: none; color: var(--accent); padding: 0; height: auto; cursor: pointer; font-size: 13px; }
.btn-link:hover { text-decoration: underline; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.field .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.textarea { min-height: 84px; resize: vertical; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.check input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.form-section { border: 1px solid var(--border); border-radius: 10px; padding: 14px; background: var(--surface-2); }
.form-section-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.inline-search { display: flex; gap: 8px; align-items: center; }
.inline-search .input { flex: 1; }
.form-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 4px; flex-wrap: wrap; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--radius) var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.actions { white-space: nowrap; text-align: right; }
table.data td.actions .btn { margin-left: 4px; }
table.compact th, table.compact td { padding: 7px 10px; }
.table-foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); flex-wrap: wrap; gap: 8px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 650; letter-spacing: .02em; white-space: nowrap; background: var(--surface-3); color: var(--text-2); border: 1px solid transparent; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge.green, .badge.completed, .badge.paid, .badge.approved, .badge.received, .badge.ok, .badge.active, .badge.sent { background: var(--success-soft); color: var(--success); }
.badge.amber, .badge.low, .badge.partial, .badge.pending, .badge.pending_approval, .badge.booked, .badge.queued, .badge.expiring, .badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.red, .badge.rejected, .badge.no_show, .badge.cancelled, .badge.out, .badge.failed, .badge.critical, .badge.expired { background: var(--danger-soft); color: var(--danger); }
.badge.blue, .badge.submitted, .badge.dispatched, .badge.in_consultation, .badge.arrived, .badge.called { background: var(--blue-soft); color: var(--blue); }
.badge.violet, .badge.draft, .badge.requested, .badge.waiting { background: var(--violet-soft); color: var(--violet); }
.badge.grey, .badge.acknowledged, .badge.skipped, .badge.inactive { background: var(--surface-3); color: var(--muted); }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 0; background: none; color: var(--muted); padding: 10px 13px; font-size: 13px; font-weight: 550; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 650; }
.pill-tabs { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: 9px; gap: 2px; }
.pill-tabs button { border: 0; background: transparent; color: var(--muted); padding: 6px 11px; border-radius: 7px; font-size: 12px; font-weight: 550; cursor: pointer; }
.pill-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Alerts / banners */
.banner { display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font-size: 13px; }
.banner svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.banner strong { font-weight: 650; }
.banner.danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); background: var(--danger-soft); color: var(--danger); }
.banner.warning { border-color: color-mix(in srgb, var(--warning) 35%, var(--border)); background: var(--warning-soft); color: var(--warning); }
.banner.info { border-color: color-mix(in srgb, var(--blue) 28%, var(--border)); background: var(--blue-soft); color: var(--blue); }
.banner.success { border-color: color-mix(in srgb, var(--success) 30%, var(--border)); background: var(--success-soft); color: var(--success); }
.banner .banner-body { flex: 1; }

/* Empty & loading */
.empty { text-align: center; padding: 46px 22px; color: var(--muted); }
.empty-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; margin: 0 auto 12px; background: var(--surface-3); color: var(--faint); }
.empty-icon svg { width: 22px; height: 22px; }
.empty h3 { color: var(--text); font-size: 14px; margin-bottom: 5px; }
.empty p { font-size: 12.5px; max-width: 420px; margin: 0 auto 14px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.2s ease infinite; border-radius: 8px; height: 14px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.loading-block { display: flex; flex-direction: column; gap: 12px; padding: 24px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(7, 16, 28, .55); backdrop-filter: blur(3px); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 32px 16px; overflow-y: auto; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 640px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); animation: pop .18s ease; margin: auto 0; }
.modal.wide { max-width: 880px; }
.modal.narrow { max-width: 440px; }
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: .6; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-head p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.modal-body { padding: 18px 20px; max-height: min(70vh, 720px); overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 16px 16px; flex-wrap: wrap; }
.modal-close { width: 30px; height: 30px; border: 0; background: var(--surface-3); color: var(--muted); border-radius: 8px; cursor: pointer; display: grid; place-items: center; flex: none; }
.modal-close:hover { color: var(--text); }

/* Toast */
.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 12.5px; animation: slidein .2s ease; }
.toast svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.toast.success svg { color: var(--success); } .toast.error svg { color: var(--danger); } .toast.info svg { color: var(--blue); }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } }

/* Login */
.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(440px, .95fr); background: var(--bg); }
.login-brand { position: relative; overflow: hidden; background: linear-gradient(150deg, #061523 0%, #0b2a38 55%, #0c4a46 100%); color: #e9f6f5; padding: 54px 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-brand::before { content: ""; position: absolute; width: 620px; height: 620px; border-radius: 50%; border: 1px solid rgba(94, 234, 212, .15); right: -240px; top: -180px; }
.login-brand::after { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(45,212,191,.2), transparent 65%); right: -120px; top: -40px; }
.login-brand .brand { padding: 0; }
.login-brand .brand-name { color: #f0fdfa; }
.login-brand .brand-sub { color: #87b9b3; }
.login-copy { position: relative; z-index: 1; max-width: 560px; }
.login-copy h1 { font-size: 40px; line-height: 1.13; letter-spacing: -.035em; font-weight: 700; color: #f4fffd; }
.login-copy p { margin-top: 16px; color: #a9c9c5; font-size: 15px; line-height: 1.65; max-width: 480px; }
.login-points { display: grid; gap: 12px; margin-top: 30px; }
.login-point { display: flex; gap: 11px; align-items: flex-start; font-size: 13px; color: #c3dedb; }
.login-point svg { width: 17px; height: 17px; color: #5eead4; flex: none; margin-top: 2px; }
.login-foot { position: relative; z-index: 1; color: #7fa9a4; font-size: 11.5px; line-height: 1.6; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 28px; position: relative; }
.login-card { width: 100%; max-width: 400px; }
.login-card h2 { font-size: 24px; letter-spacing: -.025em; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-top: 6px; margin-bottom: 24px; }
.login-form { display: flex; flex-direction: column; gap: 15px; }
.login-error { display: none; }
.login-error.show { display: flex; }
.login-note { margin-top: 18px; font-size: 11.5px; color: var(--muted); line-height: 1.6; border-top: 1px solid var(--border); padding-top: 14px; }
.login-theme { position: absolute; right: 20px; top: 18px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 5px; top: 5px; width: 30px; height: 30px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 6px; }
.pw-toggle:hover { background: var(--surface-3); }
.turnstile-box { min-height: 65px; }
.login-help { font-size: 12px; color: var(--muted); text-align: center; margin-top: 14px; }

/* Dashboard bits */
.hello { background: linear-gradient(120deg, var(--surface), var(--surface-2)); border: 1px solid var(--border); border-radius: 15px; padding: 22px 24px; margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; position: relative; overflow: hidden; }
.hello::after { content: ""; position: absolute; width: 280px; height: 280px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%); right: -60px; top: -120px; pointer-events: none; }
.hello h1 { font-size: 24px; }
.hello p { color: var(--muted); margin-top: 4px; font-size: 12.5px; }
.hello .hello-actions { display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }
.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.quick { display: flex; gap: 11px; align-items: flex-start; padding: 14px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); cursor: pointer; text-align: left; }
.quick:hover { border-color: var(--accent); background: var(--surface-2); text-decoration: none; }
.quick-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.quick-icon svg { width: 16px; height: 16px; }
.quick strong { display: block; font-size: 12.5px; color: var(--text); }
.quick span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.chart { display: flex; align-items: flex-end; gap: 12px; height: 160px; padding-top: 10px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.chart-bar { width: 100%; max-width: 42px; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--surface))); min-height: 3px; transition: height .4s ease; }
.chart-bar.alt { background: linear-gradient(180deg, var(--blue), color-mix(in srgb, var(--blue) 55%, var(--surface))); }
.chart-label { font-size: 10px; color: var(--muted); }
.chart-value { font-size: 10px; color: var(--text-2); font-weight: 600; }
.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut { width: 124px; height: 124px; border-radius: 50%; position: relative; flex: none; }
.donut::after { content: ""; position: absolute; inset: 24px; border-radius: 50%; background: var(--surface); }
.donut-legend { display: flex; flex-direction: column; gap: 7px; font-size: 11.5px; flex: 1; }
.donut-legend div { display: flex; align-items: center; gap: 7px; justify-content: space-between; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-main { flex: 1; min-width: 0; }
.list-main strong { display: block; font-size: 12.5px; font-weight: 600; }
.list-main span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; }
.list-time { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* Patient record */
.patient-hero { padding: 18px 20px; display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.patient-ident { display: flex; gap: 14px; align-items: center; flex: 1; min-width: 240px; }
.patient-avatar { width: 52px; height: 52px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; font-size: 17px; flex: none; }
.patient-ident h2 { font-size: 20px; }
.patient-ident .meta { color: var(--muted); font-size: 12px; margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }
.demog-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px 20px; }
.demog-item .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); font-weight: 650; }
.demog-item .v { font-size: 13px; margin-top: 3px; color: var(--text-2); overflow-wrap: anywhere; }
.visit { border: 1px solid var(--border); border-radius: 11px; background: var(--surface); margin-bottom: 10px; overflow: hidden; }
.visit-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.visit-body { padding: 14px; display: grid; gap: 12px; }
.visit-body .kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px; font-size: 12.5px; }
.visit-body .kv .k { color: var(--muted); }
.visit-body .kv .v { color: var(--text-2); white-space: pre-wrap; }
.subtable { width: 100%; border-collapse: collapse; font-size: 12px; }
.subtable th { text-align: left; color: var(--muted); font-weight: 600; padding: 5px 8px; border-bottom: 1px solid var(--border); }
.subtable td { padding: 6px 8px; border-bottom: 1px dashed var(--border); }
.subtable tr:last-child td { border-bottom: 0; }

/* Appointments */
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 7px; }
.slot { border: 1px solid var(--border); border-radius: 8px; padding: 8px 6px; text-align: center; font-size: 12px; background: var(--surface); cursor: pointer; color: var(--text-2); }
.slot:hover { border-color: var(--accent); background: var(--accent-soft); }
.slot.booked { background: var(--surface-3); color: var(--faint); cursor: not-allowed; border-style: dashed; }
.slot.booked:hover { border-color: var(--border); background: var(--surface-3); }
.slot strong { display: block; font-size: 12.5px; color: var(--text); }
.slot.booked strong { color: var(--faint); }
.slot small { font-size: 10px; color: var(--muted); }
.queue-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.queue-no { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; background: var(--accent-soft); color: var(--accent-ink); flex: none; }
.queue-no.called { background: var(--blue-soft); color: var(--blue); }
.queue-no.done { background: var(--surface-3); color: var(--faint); }
.weekday-grid { display: grid; grid-template-columns: 90px repeat(7, 1fr); gap: 6px; align-items: center; font-size: 12px; }
.weekday-grid .head { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); text-align: center; font-weight: 650; }
.weekday-cell { border: 1px dashed var(--border); border-radius: 6px; min-height: 34px; display: grid; place-items: center; color: var(--faint); cursor: pointer; background: var(--surface-2); font-size: 10.5px; }
.weekday-cell.on { border-style: solid; border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); background: var(--accent-soft); color: var(--accent-ink); }

/* Misc */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 6px; font-size: 10.5px; background: var(--surface-3); color: var(--muted); }
.code { font-family: var(--mono); font-size: 11.5px; background: var(--surface-3); padding: 2px 6px; border-radius: 5px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .input, .toolbar .select { width: auto; min-width: 150px; }
.toolbar .grow { flex: 1; min-width: 180px; }
.statline { display: flex; gap: 22px; flex-wrap: wrap; }
.statline div { display: flex; flex-direction: column; }
.statline strong { font-size: 19px; letter-spacing: -.02em; }
.statline span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.print-link { cursor: pointer; }
.pagination { display: flex; gap: 5px; align-items: center; }
.pagination button { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; font-size: 11.5px; }
.pagination button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination button:disabled { opacity: .45; cursor: default; }
.only-mobile { display: none; }

/* Responsive */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .quick-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .demog-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-btn { display: grid; }
  .sidebar-overlay.show { display: block; position: fixed; inset: 0; background: rgba(3, 10, 20, .5); z-index: 35; }
  .topbar { padding: 0 14px; gap: 9px; }
  .global-search { display: none; }
  .content { padding: 18px 16px 56px; }
  .login-page { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-panel { min-height: 100vh; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpi-value { font-size: 23px; }
  .kpi-label { font-size: 9px; letter-spacing: .04em; padding-right: 28px; }
  .kpi-icon { width: 28px; height: 28px; right: 10px; top: 10px; }
  .kpi-icon svg { width: 15px; height: 15px; }
  .kpi-sub { font-size: 10.5px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .demog-grid { grid-template-columns: 1fr 1fr; }
  .user-meta { display: none; }
  .branch-select { max-width: 158px; }
  .topbar-title { display: none; }
  .topbar-crumb { display: none; }
  .quick-grid { grid-template-columns: 1fr; }
  .only-mobile { display: initial; }
  .page-head h1 { font-size: 22px; }
  .visit-body .kv { grid-template-columns: 1fr; gap: 2px; }
  .visit-body .kv .k { margin-top: 6px; }
  .hello { padding: 18px; }
  .hello h1 { font-size: 20px; }
  .modal-backdrop { padding: 10px; }
  .modal-body { max-height: 78vh; }
}
@media print {
  .sidebar, .topbar, .page-actions, .tabs, .toast-root { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #ccc; box-shadow: none; }
}
