/* Alma Vida design system — calm clinical UI, works in both directions (logical properties only). */
:root {
  --navy: #1F3A5C; --navy-2: #172B44; --teal: #2F7F86; --teal-d: #256A70; --sage: #7FBDA6; --aqua: #A3D7E3; --mist: #E8F4F5;
  --bg: #F6F8FA; --surface: #FFFFFF; --line: #E3E8EE; --line-2: #EEF1F4; --ink: #172B44; --ink-2: #44546A; --muted: #51606F; --faint: #8A96A3;
  --ok: #1E6B45; --ok-bg: #E3F3EA; --warn: #8A4A06; --warn-bg: #FDF0DF; --info: #24578C; --info-bg: #E6EFF8; --bad: #A12C23; --bad-bg: #FBE7E5; --neutral-bg: #F1F4F7;
  --r-sm: 8px; --r: 12px; --r-lg: 16px; --shadow: 0 1px 2px rgba(23, 43, 68, .05); --shadow-lg: 0 18px 50px rgba(23, 43, 68, .18);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-ar: 'IBM Plex Sans Arabic', 'Inter', system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
html[lang="ar"] body { font-family: var(--font-ar); }
a { color: var(--teal); text-decoration: none; } a:hover { color: var(--navy); }
h1, h2, h3, h4 { margin: 0; color: var(--navy); letter-spacing: -0.01em; }
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3 { letter-spacing: 0; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.flip-rtl { transform: scaleX(1); } [dir="rtl"] .flip-rtl { transform: scaleX(-1); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: isolate; } .muted { color: var(--muted); } .small { font-size: 12.5px; } .strong { font-weight: 600; }
.row { display: flex; align-items: center; gap: 8px; } .row-wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.between { justify-content: space-between; } .grow { flex: 1; min-width: 0; } .stack { display: flex; flex-direction: column; gap: 12px; } .stack-sm { display: flex; flex-direction: column; gap: 6px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; } .grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.span-2 { grid-column: 1 / -1; }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.btn-md { min-height: 40px; padding: 0 16px; font-size: 14px; } .btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; } .btn-lg { min-height: 48px; padding: 0 22px; font-size: 15px; }
.btn-primary { background: var(--teal); color: #fff; } .btn-primary:hover { background: var(--teal-d); }
.btn-navy { background: var(--navy); color: #fff; } .btn-navy:hover { background: var(--navy-2); }
.btn-secondary { background: var(--surface); border-color: #D5DCE4; color: var(--navy); } .btn-secondary:hover { border-color: #B9C4CF; background: #FAFBFC; }
.btn-ghost { background: transparent; color: var(--navy); } .btn-ghost:hover { background: var(--neutral-bg); }
.btn-danger { background: var(--bad); color: #fff; } .btn-danger:hover { background: #8a241d; }
.btn-soft-danger { background: var(--bad-bg); color: var(--bad); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn:hover { background: var(--neutral-bg); color: var(--navy); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); } .req { color: var(--bad); }
.field-hint { font-size: 12px; color: var(--muted); } .field-error { font-size: 12px; color: var(--bad); font-weight: 500; }
.input { width: 100%; min-height: 42px; border: 1px solid #D5DCE4; border-radius: 10px; padding: 0 12px; background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(47, 127, 134, .14); }
.input:disabled { background: var(--neutral-bg); color: var(--muted); }
.textarea { padding: 10px 12px; min-height: 84px; resize: vertical; line-height: 1.55; }
.select { padding-inline-end: 32px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2351606F' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
[dir="rtl"] .select { background-position: left 12px center; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 32px; font-size: 14px; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid #B9C4CF; display: inline-flex; align-items: center; justify-content: center; color: transparent; background: #fff; flex: none; }
.check input:checked + .check-box { background: var(--teal); border-color: var(--teal); color: #fff; }
.check input:focus-visible + .check-box { outline: 2px solid var(--teal); outline-offset: 2px; }
.check.is-disabled { opacity: .55; cursor: not-allowed; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.toggle-text { display: flex; flex-direction: column; gap: 2px; } .toggle-text small { color: var(--muted); font-size: 12.5px; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track { width: 42px; height: 24px; border-radius: 12px; background: #C9D2DB; position: relative; flex: none; transition: background .15s; }
.toggle-thumb { position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: inset-inline-start .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked + .toggle-track { background: var(--teal); } .toggle input:checked + .toggle-track .toggle-thumb { inset-inline-start: 21px; }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--teal); outline-offset: 2px; }
.segmented { display: inline-flex; gap: 4px; background: #EEF1F4; padding: 4px; border-radius: 11px; flex-wrap: wrap; }
.segmented button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.segmented button.on { background: #fff; color: var(--navy); box-shadow: var(--shadow); }
.chips-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 42px; border: 1px solid #D5DCE4; border-radius: 10px; padding: 5px 8px; background: #fff; }
.chips-input:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(47, 127, 134, .14); }
.chips-input input { border: 0; outline: none; flex: 1; min-width: 120px; min-height: 30px; background: transparent; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; padding: 4px 8px 4px 10px; border-radius: 8px; background: var(--neutral-bg); color: #3D4C5E; }
[dir="rtl"] .chip { padding: 4px 10px 4px 8px; }
.chip button { border: 0; background: none; padding: 2px; display: inline-flex; color: inherit; cursor: pointer; opacity: .7; }
.chip-bad { background: var(--bad-bg); color: var(--bad); } .chip-teal { background: var(--mist); color: #1F6168; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.card-head h2 { font-size: 15px; } .card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-body { padding: 16px 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-label { font-size: 12.5px; color: var(--muted); } .stat-value { font-size: 24px; font-weight: 700; color: var(--navy); line-height: 1.25; } .stat-sub { font-size: 12px; color: var(--muted); }
.tone-warn { color: var(--warn); } .tone-ok { color: var(--ok); } .tone-bad { color: var(--bad); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; line-height: 1.6; }
.badge-neutral { background: var(--neutral-bg); color: #3D4C5E; } .badge-ok { background: var(--ok-bg); color: var(--ok); } .badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-info { background: var(--info-bg); color: var(--info); } .badge-bad { background: var(--bad-bg); color: var(--bad); } .badge-teal { background: var(--mist); color: #1F6168; } .badge-navy { background: var(--navy); color: #fff; }
.avatar { border-radius: 30%; background: var(--mist); color: var(--teal); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 40px 20px; color: var(--muted); }
.empty-icon { width: 54px; height: 54px; border-radius: 16px; background: var(--neutral-bg); display: flex; align-items: center; justify-content: center; color: var(--muted); margin-bottom: 6px; }
.empty strong { color: var(--navy); font-size: 15px; } .empty p { max-width: 380px; }
.loading { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 40px; color: var(--muted); }
.skeleton { display: flex; flex-direction: column; gap: 10px; padding: 16px; } .sk-row { height: 18px; border-radius: 6px; background: linear-gradient(90deg, #EEF1F4, #F6F8FA, #EEF1F4); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; }
.notice-warn { background: var(--warn-bg); color: #6E3B05; } .notice-info { background: var(--info-bg); color: #1C4673; } .notice-bad { background: var(--bad-bg); color: #8E2A22; } .notice-ok { background: var(--ok-bg); color: var(--ok); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 14px; border: 0; background: none; color: var(--muted); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--navy); } .tab.on { color: var(--navy); border-bottom-color: var(--teal); }
.tab-count { font-size: 11.5px; background: var(--neutral-bg); color: var(--muted); padding: 1px 7px; border-radius: 999px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; background: #F9FAFB; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
html[lang="ar"] .table th { text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table-dense td { padding: 8px 14px; }
.table-click tbody tr { cursor: pointer; } .table-click tbody tr:hover { background: #FAFBFC; }
.cell-main { font-weight: 600; color: var(--ink); } .cell-sub { font-size: 12.5px; color: var(--muted); }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(23, 43, 68, .38); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; animation: fade .12s; }
.overlay-side { justify-content: flex-end; padding: 0; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 18px; width: 100%; max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal-sm { max-width: 440px; } .modal-md { max-width: 620px; } .modal-lg { max-width: 880px; } .modal-xl { max-width: 1100px; }
.drawer { height: 100vh; max-height: 100vh; border-radius: 0; max-width: 560px; animation: slide .18s; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } } [dir="rtl"] .drawer { animation-name: slide-rtl; } @keyframes slide-rtl { from { transform: translateX(-30px); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.dialog-text { color: var(--ink-2); margin-bottom: 12px; line-height: 1.6; }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 20px; inset-inline-end: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 80; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; background: var(--navy); color: #fff; box-shadow: var(--shadow-lg); font-weight: 500; animation: fade .2s; }
.toast-error { background: #8E2A22; } .toast .icon { flex: none; margin-top: 1px; }

/* ---------- app shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: 248px; flex: none; background: var(--navy); color: #fff; display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-logo { height: 36px; margin: 2px 8px 22px; align-self: flex-start; }
.side-org { margin: -8px 8px 16px; font-size: 12.5px; color: #A9BBCD; line-height: 1.35; }
.side-org strong { display: block; color: #fff; font-size: 13.5px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 10px; color: #D3DEE9; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; } .nav a.on { background: rgba(255,255,255,.13); color: #fff; font-weight: 600; }
.nav-sep { height: 1px; background: rgba(255,255,255,.12); margin: 10px 8px; }
.side-foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid rgba(255,255,255,.14); font-size: 11px; color: #A9BBCD; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.96); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); padding: 10px 24px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.topbar .search-trigger { flex: 1 1 280px; max-width: 520px; display: flex; align-items: center; gap: 10px; min-height: 40px; border: 1px solid #D5DCE4; border-radius: 10px; padding: 0 12px; background: #F9FAFB; color: var(--muted); cursor: text; text-align: start; }
.kbd { font-size: 11px; font-weight: 600; color: var(--muted); border: 1px solid #D5DCE4; border-radius: 6px; padding: 1px 6px; margin-inline-start: auto; background: #fff; }
.content { padding: 24px; display: flex; flex-direction: column; gap: 20px; max-width: 1480px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-title { display: flex; gap: 12px; align-items: center; } .page-title h1 { font-size: 23px; } .page-title p { color: var(--muted); margin-top: 3px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.back-link { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; color: var(--navy); background: #fff; }
.banner { padding: 10px 24px; font-size: 13.5px; display: flex; gap: 10px; align-items: center; }
.banner-warn { background: var(--warn-bg); color: #6E3B05; } .banner-bad { background: var(--bad-bg); color: #8E2A22; } .banner-info { background: var(--mist); color: #1F4E54; }
.mobile-bar { display: none; }
@media (max-width: 980px) {
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  [dir="rtl"] .side { transform: translateX(100%); }
  .side.open { transform: none; box-shadow: var(--shadow-lg); }
  .mobile-bar { display: inline-flex; }
  .content { padding: 16px; } .topbar { padding: 10px 16px; }
}
.split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.split > .split-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.split > .split-side { flex: 1 1 300px; max-width: 380px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 980px) { .split > .split-side { max-width: none; } }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
.auth-brand { background: var(--navy); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.auth-brand h2 { color: #fff; font-size: 34px; line-height: 1.2; max-width: 460px; }
.auth-brand p { color: #C9D6E3; font-size: 16px; line-height: 1.6; max-width: 460px; margin-top: 14px; }
.auth-points { display: grid; gap: 14px; max-width: 460px; } .auth-points div { display: flex; gap: 12px; color: #D3DEE9; } .auth-points .icon { color: var(--aqua); flex: none; margin-top: 2px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #fff; }
.auth-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 18px; }
.auth-card h1 { font-size: 26px; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-brand { padding: 32px 24px; } .auth-brand .auth-points { display: none; } }

/* ---------- command palette ---------- */
.palette { position: fixed; inset: 0; background: rgba(23,43,68,.38); z-index: 70; display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px; }
.palette-box { width: 100%; max-width: 640px; background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.palette-input input { border: 0; outline: none; flex: 1; font-size: 16px; min-height: 30px; }
.palette-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.palette-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 10px; border: 0; background: none; cursor: pointer; text-align: start; }
.palette-item:hover, .palette-item.on { background: var(--mist); }

/* ---------- queue / reception ---------- */
.serving { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.serving:last-child { border-bottom: 0; } .serving-no { font-size: 24px; font-weight: 700; color: var(--teal); min-width: 34px; text-align: center; }
.qno { font-weight: 700; color: var(--navy); font-size: 15px; }
.prio { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--bad); }

/* ---------- calendar ---------- */
.cal { display: grid; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff; overflow: auto; max-height: calc(100vh - 230px); }
.cal-head { position: sticky; top: 0; z-index: 3; background: #F9FAFB; border-bottom: 1px solid var(--line); padding: 10px; font-weight: 600; font-size: 13px; color: var(--navy); display: flex; gap: 8px; align-items: center; }
.cal-times { position: sticky; inset-inline-start: 0; z-index: 2; background: #fff; border-inline-end: 1px solid var(--line); }
.cal-time { height: 60px; font-size: 11px; color: var(--muted); padding: 2px 6px; white-space: nowrap; border-bottom: 1px dashed var(--line-2); }
.cal-col { position: relative; border-inline-end: 1px solid var(--line-2); min-width: 200px; }
.cal-slot { height: 30px; border-bottom: 1px dashed var(--line-2); cursor: pointer; } .cal-slot:nth-child(2n) { border-bottom-style: solid; border-bottom-color: var(--line-2); }
.cal-slot:hover { background: #F2F8F8; }
.cal-event { position: absolute; border-radius: 8px; padding: 4px 8px; font-size: 12px; overflow: hidden; cursor: pointer; border-inline-start: 3px solid var(--teal); background: var(--mist); color: var(--navy); text-align: start; border-top: 0; border-bottom: 0; border-inline-end: 0; }
.cal-event strong { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-off { position: absolute; inset-inline: 0; background: repeating-linear-gradient(135deg, #F6F8FA, #F6F8FA 6px, #EEF1F4 6px, #EEF1F4 12px); pointer-events: none; }
.cal-now { position: absolute; inset-inline: 0; height: 2px; background: var(--bad); z-index: 2; pointer-events: none; }

/* ---------- slots ---------- */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.slot { min-height: 40px; border: 1px solid #D5DCE4; border-radius: 10px; background: #fff; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--ink); }
.slot:hover { border-color: var(--teal); } .slot.on { background: var(--teal); color: #fff; border-color: var(--teal); }
.slot:disabled { background: var(--bg); color: var(--faint); text-decoration: line-through; border-style: dashed; cursor: not-allowed; }

/* ---------- patient / visit ---------- */
.patient-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; }
.patient-head h1 { font-size: 21px; }
.alert-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 7px 12px; border-radius: 10px; background: var(--bad-bg); color: var(--bad); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; }
.vitals-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.vital { background: #F9FAFB; border-radius: 10px; padding: 9px 11px; } .vital span { display: block; font-size: 11.5px; color: var(--muted); } .vital strong { font-size: 17px; color: var(--ink); }
.list-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; } .list-row:last-child { border-bottom: 0; }
.rx-item { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr) minmax(0, .8fr) auto; gap: 10px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
@media (max-width: 760px) { .rx-item { grid-template-columns: 1fr; } }
.suggest { position: relative; }
.suggest-list { position: absolute; inset-inline: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 30; max-height: 280px; overflow-y: auto; padding: 4px; }
.suggest-item { display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: start; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-size: 14px; }
.suggest-item:hover, .suggest-item.on { background: var(--mist); }
.trend { width: 100%; height: 110px; display: block; }

/* ---------- dental ---------- */
.odontogram { direction: ltr; display: flex; flex-direction: column; gap: 8px; min-width: 720px; }
.teeth-row { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 5px; }
.teeth-row.child { grid-template-columns: repeat(10, minmax(0, 1fr)); padding: 0 12.5%; }
.tooth { min-height: 62px; border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 1px solid #D5DCE4; background: #fff; color: var(--ink); }
.tooth small { font-size: 9.5px; font-weight: 700; letter-spacing: .03em; }
.tooth.sel { box-shadow: 0 0 0 3px var(--navy); }
.t-caries { background: #FBE7E5; border: 2px solid #C0362C; color: #8E2A22; } .t-filled { background: #E6EFF8; border: 2px solid #2F6FB0; color: #1C4673; }
.t-crown { background: #F4EBD9; border: 2px solid #9A6B12; color: #6B4A0C; } .t-root_canal { background: #fff; border: 2px dashed var(--teal); color: #1F6168; }
.t-missing { background: #EEF0F3; border: 2px solid #A8B2BD; color: #5A6673; } .t-implant { background: #E8F4F5; border: 2px solid var(--navy); color: var(--navy); }
.t-bridge { background: #F1ECF8; border: 2px solid #6B4FA0; color: #4B3575; } .t-extraction_needed { background: #fff; border: 2px solid #C0362C; color: #8E2A22; }
.teeth-mid { height: 2px; background: var(--line); margin: 4px 0; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--ink-2); } .legend span { display: inline-flex; gap: 6px; align-items: center; } .legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---------- print ---------- */
.print-page { background: #fff; color: #111; margin: 0 auto; padding: 28px 32px; font-size: 13px; }
.print-a5 { width: 148mm; min-height: 210mm; } .print-a4 { width: 210mm; min-height: 297mm; } .print-80 { width: 80mm; padding: 10px; font-size: 12px; }
.print-toolbar { position: sticky; top: 0; display: flex; gap: 10px; justify-content: center; padding: 12px; background: var(--bg); border-bottom: 1px solid var(--line); z-index: 5; }
.rx-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--navy); padding-bottom: 12px; }
.rx-head h2 { font-size: 17px; } .rx-sym { font-size: 28px; font-weight: 700; color: var(--navy); font-family: Georgia, serif; }
.rx-lines { margin: 14px 0; } .rx-line { padding: 9px 0; border-bottom: 1px dashed #ccd; } .rx-line strong { font-size: 14px; }
.rx-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; border-top: 1px solid #ccd; padding-top: 12px; margin-top: 18px; font-size: 11.5px; }
@media print {
  @page { margin: 8mm; }
  body { background: #fff; }
  .no-print, .print-toolbar, .side, .topbar, .banner, .toasts { display: none !important; }
  .print-page { padding: 0; width: auto; min-height: 0; }
}

/* ---------- misc ---------- */
.public-page { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; }
.bar-chart { display: flex; align-items: stretch; gap: 6px; height: 190px; padding-top: 18px; direction: ltr; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to top, transparent 0, transparent 47px, var(--line-2) 47px, var(--line-2) 48px); }
.bar-chart .bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
.bar-chart .bar { width: 100%; max-width: 36px; background: var(--navy); border-radius: 4px 4px 0 0; min-height: 2px; transition: background .15s; }
.bar-chart .bar-zero { background: var(--line); }
.bar-chart .bar-col:hover .bar { background: var(--teal); }
.bar-chart .bar-val { font-size: 11px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.bar-labels { display: flex; gap: 6px; direction: ltr; font-size: 10.5px; color: var(--muted); margin-top: 6px; } .bar-labels span { flex: 1; text-align: center; overflow: visible; white-space: nowrap; min-width: 0; unicode-bidi: isolate; }
.perm-table td, .perm-table th { text-align: center !important; } .perm-table td:first-child, .perm-table th:first-child { text-align: start !important; }
.sched-row { display: grid; grid-template-columns: 120px repeat(3, minmax(0, 1fr)) auto; gap: 8px; align-items: center; padding: 6px 0; }
@media (max-width: 720px) { .sched-row { grid-template-columns: 1fr 1fr; } }
.demo-roles { display: grid; gap: 8px; } .demo-role { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; text-align: start; }
.demo-role:hover { border-color: var(--teal); background: #F7FBFB; }

/* trend labels: value over date, each isolated so Arabic dates never get reordered */
.trend-labels { display: flex; justify-content: space-between; direction: ltr; gap: 8px; margin-top: 6px; }
.trend-labels span { display: flex; flex-direction: column; align-items: center; unicode-bidi: isolate; direction: inherit; font-size: 12px; color: var(--muted); }
[dir="rtl"] .trend-labels span { direction: rtl; }
.trend-labels strong { direction: ltr; unicode-bidi: isolate; font-size: 13px; color: var(--ink-2, #34445a); font-weight: 600; font-variant-numeric: tabular-nums; }
.trend-labels .last strong { color: var(--ink, #14233a); font-weight: 700; }
.trend-labels em { font-style: normal; }

/* small screens: lighter top bar, tables scroll instead of clipping */
@media (max-width: 720px) {
  .kbd { display: none; }
  .search-trigger { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .card .table-wrap, .card > table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .banner { padding: 8px 16px; font-size: 12.5px; }
}

.cal-event span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; color: var(--ink-2); }
.cal-event-short { padding-block: 3px; } .cal-event-short span { display: none; }
.table .toggle { border: 0; padding: 0; display: inline-flex; } .table .toggle-text:empty, .table .toggle-text > span:empty { display: none; }
