/* ClinicFlow — application styles (no external framework) */
:root {
  --primary: #0f766e; --primary-600: #0d6560; --primary-50: #ecfdf8; --accent: #0ea5e9;
  --text: #0f172a; --muted: #64748b; --border: #e2e8f0; --bg: #f6f8fa; --card: #fff;
  --red: #dc2626; --red-50: #fef2f2; --amber: #b45309; --amber-50: #fffbeb; --green: #15803d; --green-50: #f0fdf4; --blue: #1d4ed8; --blue-50: #eff6ff;
  --radius: 10px; --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .04);
  --sidebar: 248px; --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --urdu: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Urdu Typesetting", "Alvi Nastaleeq", serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); }
[dir="rtl"] body, .urdu, [lang="ur"] { font-family: var(--urdu); }
[dir="rtl"] body { font-size: 15px; line-height: 2; }
.urdu, [lang="ur"] { line-height: 2; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .6em; line-height: 1.25; }
h2 { font-size: 1.3rem; } h3 { font-size: 1.02rem; } h4 { font-size: .95rem; }
p { margin: 0 0 .8em; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.muted { color: var(--muted); } .small { font-size: .85em; } .text-red { color: var(--red); }
.nowrap { white-space: nowrap; } .center { text-align: center; } .right { float: inline-end; }
.mt { margin-top: 1rem; } .mb { margin-bottom: 1rem; } .pad { padding: 1rem 1.1rem 0; }
[hidden] { display: none !important; }

/* Layout */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); background: #0b3b38; color: #d6f2ee; position: fixed; inset-block: 0; inset-inline-start: 0; overflow-y: auto; z-index: 40; transition: transform .2s; }
.is-admin .sidebar { background: #1e293b; color: #e2e8f0; }
.brand { display: flex; gap: .7rem; align-items: center; padding: 1.1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand strong { display: block; color: #fff; font-size: .95rem; line-height: 1.2; }
.brand small { color: rgba(255,255,255,.6); font-size: .78rem; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--primary); color: #fff; font-weight: 800; font-size: 1.3rem; flex: none; }
.sidebar nav { padding: .6rem .5rem 2rem; }
.sidebar nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: 8px; color: inherit; font-weight: 500; }
.sidebar nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.sidebar nav a.active { background: rgba(255,255,255,.14); color: #fff; }
.sidebar .count { margin-inline-start: auto; font-style: normal; background: var(--red); color: #fff; border-radius: 99px; font-size: .72rem; padding: 0 .45rem; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.main { flex: 1; margin-inline-start: var(--sidebar); min-width: 0; }
.topbar { height: 58px; display: flex; align-items: center; gap: .8rem; padding: 0 1.2rem; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.page-title { font-size: 1.1rem; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: .5rem; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; border: 0; background: transparent; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--bg); }
.icon-btn .dot { position: absolute; top: 7px; inset-inline-end: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.menu-toggle { display: none; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: .5rem; cursor: pointer; padding: .25rem .4rem; border-radius: 8px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu .menu { position: absolute; inset-inline-end: 0; top: 110%; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.08); min-width: 170px; padding: .3rem; z-index: 50; }
.user-menu .menu a, .user-menu .menu button { display: block; width: 100%; text-align: start; padding: .5rem .7rem; border: 0; background: none; color: var(--text); border-radius: 6px; font: inherit; cursor: pointer; }
.user-menu .menu a:hover, .user-menu .menu button:hover { background: var(--bg); text-decoration: none; }
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--primary-50); color: var(--primary); font-weight: 700; }
.content { padding: 1.3rem; max-width: 1400px; }
.support-bar { background: #7c2d12; color: #fff; padding: .45rem 1rem; text-align: center; font-size: .88rem; position: sticky; top: 0; z-index: 60; }
.backdrop { display: none; }

/* Cards & grids */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; margin-bottom: 1rem; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 720px; }
.card.center { text-align: center; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.card-head h2, .card-head h3 { margin: 0; }
.grid-2, .grid-3, .grid-4, .grid-2-1 { display: grid; gap: 1rem; }
.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-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-2 > .card, .grid-2-1 > .card, .grid-2-1 > div > .card:last-child { margin-bottom: 0; }
.grid-2, .grid-2-1 { margin-bottom: 1rem; }
form .grid-2, form .grid-3, form .grid-4 { margin-bottom: 0; gap: 0 1rem; }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; }
.align-end { display: flex; align-items: flex-end; gap: .5rem; padding-bottom: .8rem; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; display: flex; flex-direction: column; gap: .2rem; color: var(--text); box-shadow: var(--shadow); }
a.stat:hover { border-color: var(--primary); text-decoration: none; }
.stat-label { color: var(--muted); font-size: .8rem; font-weight: 500; }
.stat-value { font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; }
.stat.highlight { border-color: var(--primary); background: var(--primary-50); }
.small-stats .stat-value { font-size: 1.1rem; }
.quick-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }

/* Forms */
label { display: block; font-weight: 500; font-size: .86rem; color: #334155; margin-bottom: .8rem; }
.label { font-weight: 500; font-size: .86rem; color: #334155; margin: .2rem 0 .4rem; }
input, select, textarea { display: block; width: 100%; margin-top: .3rem; padding: .55rem .7rem; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; font-weight: 400; color: var(--text); background: #fff; min-height: 40px; }
textarea { min-height: 0; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(15,118,110,.25); border-color: var(--primary); }
input[readonly] { background: #f8fafc; }
input[type=checkbox], input[type=radio] { display: inline-block; width: 1.05rem; height: 1.05rem; min-height: 0; margin: 0; vertical-align: -2px; accent-color: var(--primary); }
input[type=file] { padding: .4rem; }
label.check, .check { display: flex; align-items: flex-start; gap: .5rem; font-weight: 400; }
label.check input { margin-top: .2rem; flex: none; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
legend { font-weight: 700; font-size: 1.05rem; margin-bottom: .8rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; align-items: center; }
.sticky-actions { position: sticky; bottom: 0; background: var(--card); padding: .7rem 0; border-top: 1px solid var(--border); }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.filters input, .filters select { width: auto; margin: 0; min-width: 0; }
.filters input[type=search] { min-width: 240px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar-right { display: flex; gap: .5rem; flex-wrap: wrap; }
.inline { display: inline; } .inline-form { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { margin: 0; }
.chip-grid { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.chip { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .8rem; border: 1px solid var(--border); border-radius: 99px; background: #fff; cursor: pointer; font-weight: 500; margin: 0; }
.chip:has(input:checked) { border-color: var(--primary); background: var(--primary-50); color: var(--primary-600); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; margin-bottom: 1rem; }
.seg label { margin: 0; padding: .45rem .9rem; display: flex; gap: .4rem; align-items: center; cursor: pointer; }
.seg label:has(input:checked) { background: var(--primary-50); color: var(--primary-600); }
.seg-links, .subnav { display: inline-flex; flex-wrap: wrap; gap: .25rem; background: #eef2f6; padding: .25rem; border-radius: 9px; }
.seg-links a, .subnav a { padding: .35rem .8rem; border-radius: 7px; color: var(--text); font-weight: 500; font-size: .88rem; }
.seg-links a.active, .subnav a.active { background: #fff; box-shadow: var(--shadow); color: var(--primary); }
.seg-links a:hover, .subnav a:hover { text-decoration: none; }
.subnav { margin-bottom: 1rem; }
.period { margin-bottom: 1rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--primary); background: var(--primary); color: #fff; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; min-height: 40px; line-height: 1.2; }
.btn:hover { background: var(--primary-600); text-decoration: none; }
.btn-light { background: #fff; color: var(--text); border-color: var(--border); }
.btn-light:hover { background: #f1f5f9; }
.btn-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover { background: #f1f5f9; color: var(--text); }
.btn-danger { background: #fff; color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: var(--red-50); }
.btn-sm { padding: .3rem .65rem; min-height: 32px; font-size: .84rem; }
.btn-lg { padding: .8rem 1.4rem; font-size: 1.02rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .65rem .9rem; border-bottom: 1px solid var(--border); text-align: start; vertical-align: top; }
.table th { background: #f8fafc; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; white-space: nowrap; }
.table tbody tr:hover { background: #fafcfd; }
.table.compact th, .table.compact td { padding: .45rem .7rem; }
.table tfoot td { border-bottom: 0; padding-block: .35rem; }
.table tfoot .strong td, .strong td { font-weight: 700; }
.table td.num, .table th.num, td.num { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .actions { text-align: end; white-space: nowrap; }
.table input, .table select { margin: 0; }
.empty { text-align: center; color: var(--muted); padding: 1.6rem !important; }
.perm-table td.center, .perm-table th.center { text-align: center; }
.pager { display: flex; gap: .3rem; align-items: center; margin: .5rem 0 1rem; flex-wrap: wrap; }
.pager a, .pager .current { padding: .3rem .65rem; border-radius: 6px; border: 1px solid var(--border); background: #fff; }
.pager .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Badges & alerts */
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .74rem; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.badge-green { background: var(--green-50); color: var(--green); } .badge-blue { background: var(--blue-50); color: var(--blue); }
.badge-amber { background: var(--amber-50); color: var(--amber); } .badge-red { background: var(--red-50); color: var(--red); } .badge-gray { background: #f1f5f9; color: #475569; }
.alert { padding: .75rem 1rem; border-radius: 9px; margin-bottom: 1rem; border: 1px solid; }
.alert-success { background: var(--green-50); border-color: #bbf7d0; color: #14532d; }
.alert-error { background: var(--red-50); border-color: #fecaca; color: #7f1d1d; }
.alert-warning { background: var(--amber-50); border-color: #fde68a; color: #78350f; }
.alert-info { background: var(--blue-50); border-color: #bfdbfe; color: #1e3a8a; }
.info-box { background: #f8fafc; border: 1px solid var(--border); border-radius: 9px; padding: .8rem 1rem; margin-bottom: 1rem; }
.allergy { display: inline-block; margin-top: .3rem; background: var(--red-50); color: var(--red); border: 1px solid #fecaca; border-radius: 7px; padding: .15rem .55rem; font-weight: 600; font-size: .86rem; }

/* Definition lists, timeline */
.dl-grid { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.2rem; margin: 0 0 1rem; }
.dl-grid dt { color: var(--muted); font-size: .86rem; } .dl-grid dd { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: .4rem 0 .4rem 1rem; border-inline-start: 2px solid var(--border); position: relative; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -5px; top: .85rem; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.list { list-style: none; padding: 0; margin: 0; } .list li { padding: .4rem 0; border-bottom: 1px solid var(--border); }
.note { padding: .55rem 0; border-bottom: 1px dashed var(--border); }

/* Patients */
.profile-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; }
.profile-id { display: flex; gap: 1rem; align-items: center; }
.profile-id h2 { margin: 0 0 .2rem; }
.avatar-lg { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; display: inline-grid; place-items: center; background: var(--primary-50); color: var(--primary); font-size: 1.6rem; font-weight: 700; flex: none; }
.profile-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: .6rem .9rem; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.visit-head { margin-bottom: .4rem; }
.patient-strip { display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; align-items: center; padding: .8rem 1.1rem; }

/* Autocomplete */
.ac { position: relative; }
.ac-list { position: absolute; inset-inline: 0; top: 100%; z-index: 20; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,.08); max-height: 280px; overflow-y: auto; display: none; }
.ac-list.open { display: block; }
.ac-item { padding: .55rem .75rem; cursor: pointer; font-weight: 400; }
.ac-item:hover, .ac-item.active { background: var(--primary-50); }

/* Appointments */
.slots { display: flex; flex-wrap: wrap; gap: .4rem; margin: .3rem 0 1rem; }
.slot { padding: .4rem .7rem; border: 1px solid var(--border); border-radius: 7px; background: #fff; cursor: pointer; font: inherit; font-size: .86rem; }
.slot:hover { border-color: var(--primary); }
.slot.selected { background: var(--primary); color: #fff; border-color: var(--primary); }
.slot[disabled] { background: #f1f5f9; color: #94a3b8; text-decoration: line-through; cursor: not-allowed; }
.section-title { margin: .3rem 0 .8rem; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); gap: .5rem; overflow-x: auto; }
.week-col { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem; min-height: 220px; }
.week-col.today { border-color: var(--primary); }
.week-head { display: block; text-align: center; color: var(--text); padding-bottom: .4rem; border-bottom: 1px solid var(--border); margin-bottom: .4rem; }
.appt-chip { display: block; padding: .35rem .5rem; border-radius: 7px; background: var(--primary-50); color: var(--text); margin-bottom: .35rem; font-size: .82rem; border-inline-start: 3px solid var(--primary); }
.appt-chip small { display: block; color: var(--muted); }
.appt-chip.status-cancelled, .appt-chip.status-no_show { opacity: .5; text-decoration: line-through; border-color: var(--red); }
.appt-chip.status-completed { border-color: var(--green); background: var(--green-50); }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.month-dow { text-align: center; font-weight: 600; font-size: .8rem; color: var(--muted); padding: .3rem; }
.month-cell { background: var(--card); border: 1px solid var(--border); border-radius: 8px; min-height: 92px; padding: .35rem .45rem; color: var(--text); display: flex; flex-direction: column; gap: 2px; font-size: .78rem; overflow: hidden; }
.month-cell.blank { background: transparent; border-color: transparent; }
.month-cell.today { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
a.month-cell:hover { text-decoration: none; border-color: var(--primary); }
.month-day { font-weight: 700; } .month-count { color: var(--primary); font-weight: 600; } .month-item { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Queue */
.queue-board { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.token-row { display: flex; gap: .8rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.token-row.active .token-no { background: var(--primary); color: #fff; }
.token-no { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; background: #f1f5f9; font-size: 1.35rem; font-weight: 800; flex: none; }
.token-info { flex: 1; min-width: 160px; }
.token-actions { display: flex; gap: .3rem; flex-wrap: wrap; }
.queue-add .ac label { margin-bottom: .8rem; }

/* Consultation */
.vitals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0 .8rem; }

/* Prescriptions editor */
.rx-tools { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; margin: .5rem 0; }
.rx-tools h3 { margin: 0; } .rx-tools-right { display: flex; gap: .5rem; flex-wrap: wrap; } .rx-tools select { width: auto; margin: 0; }
.rx-row { display: grid; grid-template-columns: 26px minmax(220px, 3fr) 1.2fr 1.6fr 1fr 1.2fr minmax(70px, .7fr); gap: .4rem; align-items: center; padding: .6rem 0; border-bottom: 1px dashed var(--border); }
.rx-row [data-f=instructions] { grid-column: 2 / 4; } .rx-row [data-f=instructions_ur] { grid-column: 4 / 6; }
.rx-row input, .rx-row select { margin: 0; }
.rx-row .check { margin: 0; white-space: nowrap; }
.rx-num { font-weight: 700; color: var(--muted); }

/* Invoice */
.inv-summary { max-width: 360px; margin: 1rem 0 1rem auto; }
.inv-summary > div { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .3rem 0; }
.inv-summary input { width: 140px; margin: 0; text-align: end; }
.inv-total { border-top: 2px solid var(--text); font-size: 1.15rem; }

/* Charts */
.chart { width: 100%; height: 220px; display: block; }
.chart rect { transition: opacity .15s; } .chart rect:hover { opacity: .8; }
.chart-val { font-size: 11px; fill: #334155; text-anchor: middle; font-weight: 600; }
.chart-lbl { font-size: 10px; fill: var(--muted); text-anchor: middle; }
.chart-axis { stroke: var(--border); }
.empty-chart { height: 140px; display: grid; place-items: center; color: var(--muted); background: #fafbfc; border-radius: 8px; }
.hbars { display: flex; flex-direction: column; gap: .5rem; }
.hbar { display: grid; grid-template-columns: minmax(90px, 30%) 1fr auto; gap: .6rem; align-items: center; font-size: .86rem; }
.hbar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { height: 10px; background: #f1f5f9; border-radius: 99px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.hbar-val { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Reports */
.report-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 1rem; }
.report-nav { display: flex; flex-direction: column; gap: .2rem; }
.report-nav a { padding: .5rem .75rem; border-radius: 8px; color: var(--text); font-weight: 500; }
.report-nav a.active { background: var(--primary-50); color: var(--primary); }

/* Notifications */
.notif { display: flex; justify-content: space-between; gap: 1rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--border); align-items: center; }
.notif.unread { background: #f5fbfa; border-inline-start: 3px solid var(--primary); }

/* Misc */
.logo-preview { display: flex; gap: .6rem; align-items: center; margin-top: .4rem; } .logo-preview img { max-height: 40px; border-radius: 6px; }
.receipt-img { max-width: 100%; border: 1px solid var(--border); border-radius: 8px; }
.inline-details { position: relative; display: inline-block; } .inline-details summary { list-style: none; } .inline-details summary::-webkit-details-marker { display: none; }
.popover { position: absolute; inset-inline-end: 0; z-index: 25; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: .8rem; width: 260px; box-shadow: 0 10px 30px rgba(0,0,0,.1); }
details.card > summary { cursor: pointer; }
.err-code { font-size: 3.5rem; font-weight: 800; color: var(--primary); }

/* Auth & landing */
.auth-body { background: linear-gradient(160deg, #ecfdf8 0%, #f6f8fa 40%) fixed; min-height: 100vh; }
.auth-wrap { max-width: 440px; margin: 0 auto; padding: 2.5rem 1rem; }
.auth-wrap.wide { max-width: 1040px; }
.auth-brand { display: flex; align-items: center; gap: .6rem; font-size: 1.25rem; font-weight: 800; color: var(--text); margin-bottom: 1.5rem; justify-content: center; }
.auth-brand:hover { text-decoration: none; }
.auth-card { padding: 1.6rem; }
.auth-links { text-align: center; margin-top: 1rem; color: var(--muted); }
.hero { text-align: center; padding: 2.5rem 0 2rem; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.7rem); letter-spacing: -.02em; }
.lead { font-size: 1.12rem; color: #475569; max-width: 680px; margin: 0 auto 1.4rem; }
.hero-cta { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin: 1.5rem 0 2.5rem; }
.feature { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; }
.feature h3 { color: var(--primary-600); }
.plans h2 { text-align: center; margin-bottom: 1rem; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.plan-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 1.2rem; position: relative; display: flex; flex-direction: column; margin: 0; font-weight: 400; }
.plan-card.selectable { cursor: pointer; }
.plan-card.selectable input[type=radio] { position: absolute; top: 1rem; inset-inline-end: 1rem; }
.plan-card:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.plan-card .price { font-size: 1.6rem; font-weight: 800; margin: .2rem 0; } .plan-card .price small { font-size: .85rem; font-weight: 500; color: var(--muted); }
.plan-card ul { padding: 0; list-style: none; margin: .6rem 0 1rem; flex: 1; }
.plan-card li { padding: .2rem 0; padding-inline-start: 1.3rem; position: relative; }
.plan-card li::before { content: "✓"; position: absolute; inset-inline-start: 0; color: var(--primary); font-weight: 700; }
.plan-card li.off { color: #94a3b8; text-decoration: line-through; } .plan-card li.off::before { content: "–"; color: #94a3b8; }

/* Registration wizard */
.steps { display: flex; gap: .3rem; list-style: none; padding: 0; margin: 0 0 1.4rem; overflow-x: auto; }
.steps li { flex: 1; min-width: 90px; font-size: .8rem; color: var(--muted); padding-top: .5rem; border-top: 3px solid var(--border); white-space: nowrap; }
.steps li span { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--border); color: var(--text); font-size: .72rem; font-weight: 700; margin-inline-end: .2rem; }
.steps li.done, .steps li.current { border-color: var(--primary); color: var(--text); }
.steps li.current span, .steps li.done span { background: var(--primary); color: #fff; }
.wizard-nav { display: flex; justify-content: space-between; gap: .5rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.pay-methods { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }

/* TV display */
.tv { background: #062925; color: #fff; min-height: 100vh; display: flex; flex-direction: column; font-size: 18px; }
.tv-head { display: flex; justify-content: space-between; align-items: center; padding: 1.2rem 2rem; background: rgba(255,255,255,.04); }
.tv-head h1 { margin: 0; font-size: 2rem; } .tv-brand { display: flex; gap: 1rem; align-items: center; }
.tv-clock { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tv-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 1.5rem; padding: 1.5rem 2rem; align-content: start; }
.tv-card { background: rgba(255,255,255,.06); border-radius: 18px; padding: 1.4rem; }
.tv-card h2 { font-size: 1.5rem; margin: 0 0 1rem; color: #99f6e4; }
.tv-now { display: flex; align-items: center; gap: 1.2rem; background: #0f766e; border-radius: 14px; padding: 1rem 1.3rem; margin-bottom: 1rem; }
.tv-now.flash { animation: flash 1s ease-in-out 3; }
@keyframes flash { 50% { background: #f59e0b; } }
.tv-now .num { font-size: 4.5rem; font-weight: 900; line-height: 1; } .tv-now .lbl { font-size: 1rem; opacity: .85; } .tv-now .nm { font-size: 1.6rem; font-weight: 700; }
.tv-next { display: flex; flex-wrap: wrap; gap: .6rem; }
.tv-next span { background: rgba(255,255,255,.1); border-radius: 10px; padding: .5rem .9rem; font-size: 1.4rem; font-weight: 700; }
.tv-empty { opacity: .7; font-size: 1.4rem; text-align: center; grid-column: 1 / -1; padding-top: 4rem; }
.tv-foot { padding: .8rem 2rem; opacity: .75; text-align: center; font-size: 1rem; }
.tv-sound { background: rgba(255,255,255,.12); border: 0; color: #fff; padding: .3rem .7rem; border-radius: 7px; cursor: pointer; font: inherit; }

/* Responsive */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rx-row { grid-template-columns: 22px 1fr 1fr; }
  .rx-row .rx-med { grid-column: 2 / 4; }
  .rx-row [data-f=instructions], .rx-row [data-f=instructions_ur] { grid-column: 2 / 4; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 35; }
  .main { margin-inline-start: 0; }
  .menu-toggle { display: inline-grid; }
  .grid-2, .grid-3, .grid-2-1, .queue-board, .report-layout { grid-template-columns: minmax(0, 1fr); }
  .report-nav { flex-direction: row; overflow-x: auto; }
  .report-nav a { white-space: nowrap; }
  .span-2, .span-3 { grid-column: auto; }
  .hide-sm { display: none; }
  .content { padding: 1rem .8rem; }
}
@media (max-width: 560px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-value { font-size: 1.1rem; }
  .filters input[type=search] { min-width: 0; flex: 1 1 100%; }
  .filters > * { flex: 1 1 auto; }
  .toolbar > .btn { width: 100%; }
  .dl-grid { grid-template-columns: 1fr; gap: .1rem; } .dl-grid dd { margin-bottom: .5rem; }
  .month-cell { min-height: 60px; } .month-item { display: none; }
  .tv-grid { grid-template-columns: 1fr; padding: 1rem; }
  .topbar { padding: 0 .6rem; }
}
@media print {
  .sidebar, .topbar, .no-print, .toolbar, .backdrop, .support-bar { display: none !important; }
  .main { margin: 0; } .content { padding: 0; max-width: none; } body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; } .report-layout { grid-template-columns: 1fr; }
}
