:root {
  --ink: #17332e;
  --muted: #64756f;
  --paper: #ffffff;
  --canvas: #f3f7f5;
  --line: #dce7e2;
  --primary: #087f68;
  --primary-dark: #056652;
  --primary-soft: #dff3ed;
  --accent: #e9b949;
  --danger: #b73a45;
  --danger-soft: #fbe8ea;
  --success: #176f52;
  --shadow: 0 12px 32px rgba(24, 58, 49, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { font-family: Tahoma, Arial, sans-serif; background: var(--canvas); color: var(--ink); }
body { margin: 0; min-height: 100vh; line-height: 1.65; }
a { color: inherit; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
.shell { width: min(100% - 28px, 1100px); margin-inline: auto; }
.site-header { background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); }
.header-row { min-height: 68px; padding-block: 8px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 18px; }
.brand { color: var(--primary-dark); font-size: 1.08rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-inline: -10px; }
nav a, .link-button { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 10px; border: 0; background: transparent; color: var(--ink); text-decoration: none; white-space: nowrap; }
nav a:hover, .link-button:hover { color: var(--primary); }
main.shell { padding-block: 34px 56px; }
.site-footer { padding-block: 22px 36px; color: var(--muted); text-align: center; font-size: .88rem; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(1.85rem, 7vw, 3.3rem); line-height: 1.2; letter-spacing: -.03em; }
h2 { font-size: 1.3rem; }
h3 { margin-bottom: 4px; }
.eyebrow { margin-bottom: 7px; color: var(--primary); font-size: .82rem; font-weight: 800; letter-spacing: .04em; }
.hero { padding: 34px 0 28px; max-width: 760px; }
.hero > p:last-child, .page-heading > p:last-child { color: var(--muted); font-size: 1.05rem; }
.page-heading { margin-bottom: 26px; }
.staff-heading { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.action-grid, .compact-grid, .summary-grid, .admin-doctor-list { display: grid; gap: 14px; }
.action-card { min-height: 145px; padding: 22px; display: flex; flex-direction: column; justify-content: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; transition: transform .15s ease, border-color .15s ease; }
.action-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.action-card strong { font-size: 1.2rem; }
.action-card small { color: var(--muted); }
.primary-card { background: var(--primary); color: #fff; border-color: var(--primary); }
.primary-card small { color: #d9fff5; }
.action-icon { width: 36px; height: 36px; margin-bottom: 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-dark); border-radius: 50%; font-weight: 800; }
.primary-card .action-icon { background: rgba(255,255,255,.18); color: #fff; }
.section-block { margin-top: 32px; }
.doctor-chip { display: flex; justify-content: space-between; gap: 12px; padding: 17px 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; }
.doctor-chip span { color: var(--muted); }
.card { padding: 21px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.narrow-card { max-width: 580px; }
.form-stack { display: grid; gap: 12px; }
.form-stack label, .form-row label, .filter-row label { font-weight: 700; }
input, select { width: 100%; min-height: 50px; padding: 10px 13px; color: var(--ink); background: #fff; border: 1px solid #bccdc6; border-radius: 11px; outline: none; }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(8,127,104,.13); }
.input-action, .form-row, .filter-row, .button-row { display: flex; flex-direction: column; gap: 10px; }
.button { min-height: 48px; padding: 10px 17px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 11px; font-weight: 800; text-decoration: none; text-align: center; }
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { background: var(--primary-soft); color: var(--primary-dark); border-color: #b7dfd4; }
.button.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.button.danger { background: var(--danger-soft); color: var(--danger); border-color: #f1c6cb; }
.button.full { width: 100%; }
.inline-form { display: inline; }
.field-help, .muted, .empty-state { color: var(--muted); }
.field-help { margin-top: -8px; font-size: .84rem; }
.no-margin { margin: 0; }
.center { text-align: center; }
hr { width: 100%; margin: 17px 0; border: 0; border-top: 1px solid var(--line); }
.selected-doctor { margin-bottom: 12px; padding: 13px 15px; display: flex; align-items: center; gap: 12px; background: var(--primary-soft); border-radius: 11px; }
.selected-doctor span { color: var(--muted); font-size: .88rem; }
.selected-doctor strong { flex: 1; }
.selected-doctor a { min-height: 32px; display: inline-flex; align-items: center; color: var(--primary-dark); font-size: .9rem; }
.ltr-input { direction: ltr; text-align: left; }
.section-title { margin-top: 22px; }
.steps { margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; list-style: none; }
.steps li { padding: 8px 4px; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); background: var(--paper); border: 1px solid var(--line); border-radius: 11px; font-size: .86rem; font-weight: 700; }
.steps span { width: 22px; height: 22px; display: grid; place-items: center; background: var(--canvas); border-radius: 50%; }
.steps .active { color: #fff; background: var(--primary); border-color: var(--primary); }
.steps .active span { color: var(--primary-dark); background: #fff; }
.steps .finished { color: var(--primary-dark); background: var(--primary-soft); border-color: #b7dfd4; }
.tap-list { display: grid; gap: 10px; }
.tap-row { min-height: 64px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--canvas); border: 1px solid var(--line); border-radius: 13px; font-size: 1.08rem; text-decoration: none; }
.tap-row:hover, .day-tile:not(.disabled):hover, .chip:hover { border-color: var(--primary); }
.tap-row span { color: var(--primary); font-size: 1.5rem; line-height: 1; }
.day-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.day-grid .empty-state { grid-column: 1 / -1; }
.day-tile { min-height: 84px; padding: 11px 12px; display: grid; align-content: center; gap: 3px; background: var(--paper); border: 1px solid #bccdc6; border-radius: 13px; text-decoration: none; }
.day-tile strong { line-height: 1.35; }
.day-tile .places { color: var(--primary-dark); font-size: .88rem; font-weight: 700; }
.day-tile.selected { background: var(--primary-soft); border: 2px solid var(--primary); }
.day-tile.disabled { color: var(--muted); background: var(--canvas); border-color: var(--line); font-size: .9rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 8px 14px; display: inline-flex; align-items: center; background: var(--paper); border: 1px solid #bccdc6; border-radius: 999px; text-decoration: none; }
.chip.selected { color: #fff; background: var(--primary); border-color: var(--primary); }
.confirm-bar { margin-top: 18px; padding: 15px; background: var(--primary-soft); border-radius: 13px; }
.alert { margin-bottom: 20px; padding: 14px 16px; border-radius: 12px; font-weight: 700; }
.alert-error { color: #8f2530; background: var(--danger-soft); border: 1px solid #efc4ca; }
.alert-success, .valid-note { color: var(--success); background: #e2f5ed; border: 1px solid #bee5d6; }
.alert-warning { color: #6b4c00; background: #fff3cd; border: 1px solid #ead38a; }
.valid-note { padding: 11px 13px; border-radius: 10px; }
.booking-list { display: grid; gap: 13px; }
.booking-card { padding: 18px; display: flex; flex-direction: column; gap: 17px; background: var(--paper); border: 1px solid var(--line); border-radius: 15px; }
.badge { display: inline-flex; padding: 4px 9px; border-radius: 999px; font-size: .78rem; font-weight: 800; }
.status-booked { background: #fff2cf; color: #805b00; }
.status-checked_in { background: var(--primary-soft); color: var(--primary-dark); }
.status-called { background: #dcecff; color: #164f8f; }
.status-done { background: #e8ecea; color: #50615b; }
.status-cancelled { background: var(--danger-soft); color: var(--danger); }
.choice-card { padding: 14px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.choice-card input { width: 23px; min-height: 23px; }
.choice-card span { display: grid; }
.choice-card small { color: var(--muted); }
.code-input { direction: ltr; text-align: center; font-size: 1.7rem; letter-spacing: .28em; font-weight: 800; }
.ticket { max-width: 720px; margin-inline: auto; padding: 30px 20px; background: var(--paper); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); text-align: center; }
.ticket-label, .current-number { color: var(--primary-dark); font-size: clamp(3.2rem, 15vw, 6.5rem); font-weight: 900; line-height: 1.15; direction: ltr; }
.ticket-status { font-weight: 800; }
.ticket-stats { margin-block: 26px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.ticket-stats > div { padding: 18px 9px; display: grid; }
.ticket-stats > div + div { border-right: 1px solid var(--line); }
.ticket-stats span, .ticket-stats small { color: var(--muted); }
.ticket-stats strong { font-size: 2.2rem; direction: ltr; }
.ticket:not([data-status="checked_in"]) .ahead-stat { display: none; }
.ticket:not([data-status="checked_in"]) .ahead-stat + div { border-right: 0; }
.ticket-status { font-size: 1.15rem; }
.ticket[data-status="called"] { color: #fff; background: var(--primary); border-color: var(--primary); }
.ticket[data-status="called"] .eyebrow, .ticket[data-status="called"] .ticket-label, .ticket[data-status="called"] .muted, .ticket[data-status="called"] .ticket-stats span { color: #fff; }
.ticket[data-status="called"] .ticket-status { font-size: 1.6rem; }
.ticket[data-status="called"] .ticket-stats { border-color: rgba(255,255,255,.35); }
.ticket[data-status="done"] .ticket-label, .ticket[data-status="cancelled"] .ticket-label { color: var(--muted); }
.ticket[data-status="done"] .ticket-note, .ticket[data-status="cancelled"] .ticket-note { display: none; }
.call-button { min-height: 66px; margin-top: 14px; font-size: 1.2rem; }
.summary-line { margin: 12px 0 0; }
.staff-grid, .two-columns { display: grid; gap: 15px; }
.current-card { text-align: center; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.mini-stats div { padding: 12px 5px; display: grid; text-align: center; background: var(--canvas); border-radius: 10px; }
.mini-stats strong { font-size: 1.5rem; }
.mini-stats span { color: var(--muted); font-size: .76rem; }
.queue-list, .plain-list { margin: 0; padding: 0; list-style: none; }
.queue-list li, .plain-list li { padding: 12px 4px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.queue-list strong { direction: ltr; font-size: 1.25rem; }
.plain-list small { color: var(--muted); }
details summary { min-height: 48px; display: flex; align-items: center; font-weight: 800; cursor: pointer; }
.details-form { padding-top: 15px; }
fieldset { margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 11px; }
legend { padding-inline: 7px; font-weight: 800; }
.checkbox-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.checkbox-grid label, .switch-row { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.checkbox-grid input, .switch-row input { width: 22px; min-height: 22px; }
.danger-zone { margin-top: 32px; padding: 20px; background: var(--danger-soft); border: 1px solid #efc4ca; border-radius: var(--radius); }
.summary-grid { grid-template-columns: repeat(2, 1fr); }
.summary-card { padding: 17px; display: grid; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; }
.summary-card strong { font-size: 2rem; direction: ltr; }
.summary-card small { color: var(--muted); }
.card-title-row { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card-title-row > div { display: flex; align-items: center; gap: 10px; }
.queue-prefix { width: 40px; height: 40px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-dark); border-radius: 10px; font-weight: 900; }
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 13px; border-bottom: 1px solid var(--line); text-align: right; }
th { background: #edf4f1; }
.print-card { max-width: 680px; margin-inline: auto; padding: 30px; background: #fff; border: 1px solid var(--line); border-radius: 20px; text-align: center; }
.qr-code { max-width: 330px; margin: 16px auto; background: #fff; }
.qr-code svg { width: 100%; height: auto; display: block; }
.print-hint { font-size: 1.15rem; }
.ltr-text { direction: ltr; display: block; overflow-wrap: anywhere; color: var(--muted); }
.print-actions { margin-top: 24px; display: grid; gap: 9px; }
.reception-page main.shell { width: min(100% - 28px, 1600px); padding-block: 20px; }
.reception-screen { text-align: center; }
.reception-checkin { display: grid; gap: 20px; align-items: stretch; }
.qr-panel { padding: 20px; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; }
.qr-panel .qr-code { max-width: min(100%, 52vh); }
.code-panel { padding: 24px 14px; display: grid; align-content: center; gap: 10px; background: var(--primary); color: #fff; border-radius: 20px; font-size: 1.2rem; }
.code-panel strong { font-size: clamp(3rem, 15vw, 10rem); line-height: 1.1; direction: ltr; letter-spacing: .06em; }
.code-panel small { color: #d4fff4; }
.serving-board { margin-top: 26px; }
.serving-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.serving-grid article { padding: 17px 8px; display: grid; background: #fff; border: 1px solid var(--line); border-radius: 15px; }
.serving-grid strong { color: var(--primary-dark); font-size: clamp(2.4rem, 5vw, 4rem); line-height: 1.2; direction: ltr; }
.serving-grid small { color: var(--muted); }
.screen-exit { display: inline-block; margin-top: 20px; color: var(--muted); }
.server-error-page { display: grid; place-items: center; padding: 32px; text-align: center; }
.server-error-card { width: min(100%, 580px); padding: 28px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* analytics */
.analytics-filter { display: grid; gap: 12px; }
.analytics-filter .chip { min-height: 38px; padding: 5px 12px; font-size: .88rem; }
.filter-note { margin: 0; color: var(--muted); font-size: .84rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.kpi-card { padding: 15px; display: grid; gap: 3px; align-content: start; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.kpi-card > span { color: var(--muted); font-size: .84rem; }
.kpi-card strong { font-size: 1.85rem; line-height: 1.25; }
.kpi-card small { color: var(--muted); font-size: .76rem; }
.trend { font-size: .82rem; font-weight: 800; color: var(--muted); }
.trend-good { color: var(--success); }
.trend-bad { color: var(--danger); }
.recommendations { background: var(--primary-soft); border-color: #b7dfd4; }
.recommendations ul { margin: 0; padding: 0; display: grid; gap: 8px; list-style: none; }
.recommendations li { padding: 10px 13px; background: var(--paper); border-radius: 11px; }
.fact-row { margin: 0 0 14px; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); }
.fact-row div { padding: 9px 11px; background: var(--canvas); border-radius: 10px; }
.fact-row dt { color: var(--muted); font-size: .78rem; }
.fact-row dd { margin: 0; font-weight: 800; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg text { fill: var(--muted); font-size: 15px; text-anchor: middle; }
.chart-svg .chart-value { fill: var(--ink); font-size: 17px; font-weight: 800; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-base { stroke: #9fb3ab; stroke-width: 1; }
.chart-bar { fill: #7cc4b3; }
.chart-bar.is-peak { fill: var(--primary-dark); }
.chart-bar:hover { fill: var(--primary); }
.table-note { margin: 8px 0 0; color: var(--muted); font-size: .8rem; }
.hbars { display: grid; gap: 12px; }
.hbar-row { display: grid; gap: 3px; }
.hbar-head { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; }
.hbar-head small { color: var(--muted); }
.hbar-track { height: 10px; overflow: hidden; background: var(--canvas); border-radius: 4px; }
.hbar-fill { height: 100%; background: var(--primary); border-radius: 4px; }
.hbar-fill.is-second { background: #7cc4b3; }
.hbar-track + .hbar-track { margin-top: 2px; }
.chart-legend { margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 14px; font-size: .84rem; }
.legend-swatch { width: 12px; height: 12px; margin-inline-end: 5px; display: inline-block; vertical-align: -1px; background: var(--primary); border-radius: 3px; }
.legend-swatch.is-second { background: #7cc4b3; }
.heat-table { font-size: .84rem; text-align: center; }
.heat-table th, .heat-table td { min-width: 42px; padding: 8px 4px; border: 2px solid var(--paper); text-align: center; }
.heat-table th { background: transparent; color: var(--muted); font-weight: 700; }
.heat-table tbody th { text-align: right; }
.heat-scale { margin-top: 8px; display: flex; align-items: center; gap: 2px; color: var(--muted); font-size: .78rem; }
.heat-scale i { width: 20px; height: 12px; display: block; }
.heat-scale span { margin-inline: 5px; }
.day-list { max-height: 300px; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.day-list li { padding: 8px 2px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.day-list small { color: var(--muted); }
.upcoming-table th, .upcoming-table td { padding: 7px 8px; font-size: .8rem; text-align: center; }
.upcoming-table th:first-child { position: sticky; inset-inline-start: 0; z-index: 1; background: #edf4f1; text-align: right; }
.upcoming-table th small { display: block; color: var(--muted); font-weight: 400; }
.upcoming-table td { min-width: 64px; }
.upcoming-table td strong { display: block; direction: ltr; font-size: .92rem; }
.slot-full { background: var(--danger-soft); color: #8f2530; }
.slot-nearly_full { background: #fff3cd; color: #6b4c00; }
.slot-room { background: #e2f5ed; color: var(--success); }
.slot-closed { background: var(--canvas); color: var(--muted); }
.table-bar { min-width: 90px; }
.details-table { margin-top: 10px; max-height: 420px; overflow-y: auto; }
.heat-0 { background: #f3f7f5; color: var(--ink); }
.heat-1 { background: #e0f2ec; color: var(--ink); }
.heat-2 { background: #c6e7dd; color: var(--ink); }
.heat-3 { background: #a8dacc; color: var(--ink); }
.heat-4 { background: #88cbb8; color: var(--ink); }
.heat-5 { background: #67baa3; color: var(--ink); }
.heat-6 { background: #46a68c; color: #ffffff; }
.heat-7 { background: #2a9077; color: #ffffff; }
.heat-8 { background: #117a63; color: #ffffff; }
.heat-9 { background: #056652; color: #ffffff; }
.w-0 { width: 0%; }
.w-5 { width: 5%; }
.w-10 { width: 10%; }
.w-15 { width: 15%; }
.w-20 { width: 20%; }
.w-25 { width: 25%; }
.w-30 { width: 30%; }
.w-35 { width: 35%; }
.w-40 { width: 40%; }
.w-45 { width: 45%; }
.w-50 { width: 50%; }
.w-55 { width: 55%; }
.w-60 { width: 60%; }
.w-65 { width: 65%; }
.w-70 { width: 70%; }
.w-75 { width: 75%; }
.w-80 { width: 80%; }
.w-85 { width: 85%; }
.w-90 { width: 90%; }
.w-95 { width: 95%; }
.w-100 { width: 100%; }

@media (min-width: 700px) {
  .shell { width: min(100% - 56px, 1100px); }
  .site-header { position: sticky; top: 0; z-index: 10; backdrop-filter: blur(10px); }
  .action-grid { grid-template-columns: repeat(3, 1fr); }
  .compact-grid { grid-template-columns: repeat(2, 1fr); }
  .day-grid { grid-template-columns: repeat(3, 1fr); }
  .input-action, .form-row, .filter-row, .button-row { flex-direction: row; align-items: end; }
  .input-action select, .form-row select { flex: 1; }
  .booking-card { flex-direction: row; align-items: center; justify-content: space-between; }
  .staff-heading { flex-direction: row; justify-content: space-between; align-items: center; }
  .staff-grid { grid-template-columns: 1.3fr .7fr; }
  .two-columns { grid-template-columns: 1fr 1fr; }
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
  .admin-doctor-list { grid-template-columns: repeat(2, 1fr); }
  .checkbox-grid { grid-template-columns: repeat(4, 1fr); }
  .reception-checkin { grid-template-columns: 1fr 1.2fr; }
  .serving-grid { grid-template-columns: repeat(3, 1fr); }
  .kpi-grid { grid-template-columns: repeat(5, 1fr); }
  .analytics-filter .filter-row label { flex: 1; }
}

@media print {
  .site-header, .site-footer, .print-actions { display: none !important; }
  body, html { background: #fff; }
  main.shell { padding: 0; }
  .print-card { border: 0; box-shadow: none; }
  .print-card .qr-code { max-width: 12cm; }
  .analytics-filter { display: none; }
}
