/* =========================================================================
   Yalla Sokhna admin — "Red Sea Shore" design system v2
   Type: Alexandria (display, numbers) + Almarai (text)
   Deep-sea navy for structure, sea teal for action, Galala-sun amber as the one warm accent.
   Light / dark themes via [data-theme] on <html> (set by theme.js before paint).
   ========================================================================= */
:root {
  --bg: #eef3f4;
  --surface: #ffffff;
  --surface-2: #f6f9fa;
  --line: #dce5e8;
  --line-strong: #c3d1d6;
  --text: #15262e;
  --heading: #0a2a38;
  --muted: #5b6e76;
  --primary: #0e8a8c;
  --primary-strong: #0a6e70;
  --primary-soft: #dff1f0;
  --on-primary: #ffffff;
  --accent: #f2a93b;
  --accent-ink: #8a5300;
  --sidebar: #0a2a38;
  --sidebar-2: #12394b;
  --sidebar-text: #c9dde2;
  --sidebar-muted: #7d9ca6;
  --field-bg: #ffffff;
  --ok: #1f7a52; --ok-bg: #e1f3ea;
  --warn: #8a5a00; --warn-bg: #fdf0d5;
  --bad: #b03a26; --bad-bg: #fbe5e0;
  --info: #22609e; --info-bg: #e3edf8;
  --muted-bg: #e9eef0;
  --conf-bg: #fff8ee; --conf-line: #f0d9b8; --conf-ink: #85521b;
  --shadow: 0 1px 2px rgba(10, 42, 56, .06), 0 8px 24px -12px rgba(10, 42, 56, .18);
  --radius-sm: 8px;
  --radius: 14px;
  --font-body: "Almarai", "Segoe UI", Tahoma, Arial, sans-serif;
  --font-head: "Alexandria", "Almarai", "Segoe UI", Tahoma, sans-serif;
  --sidebar-w: 264px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #08141b;
  --surface: #0f1f29;
  --surface-2: #132834;
  --line: #1f3745;
  --line-strong: #2b4757;
  --text: #dfe9ed;
  --heading: #f2f7f8;
  --muted: #8ea6b0;
  --primary: #24b4b1;
  --primary-strong: #3fcbc7;
  --primary-soft: #0f3a3d;
  --on-primary: #04161a;
  --accent: #f5b54e;
  --accent-ink: #f5b54e;
  --sidebar: #050e13;
  --sidebar-2: #0f2430;
  --sidebar-text: #c2d6dc;
  --sidebar-muted: #6b8a95;
  --field-bg: #0b1820;
  --ok: #5fd39c; --ok-bg: #0f3324;
  --warn: #f3c46b; --warn-bg: #3a2a0b;
  --bad: #ff8c76; --bad-bg: #3d1610;
  --info: #84b9f0; --info-bg: #10263d;
  --muted-bg: #1a2d38;
  --conf-bg: #1d1a12; --conf-line: #4a3a1c; --conf-ink: #f0c27a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -14px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-body); color: var(--text); background: var(--bg); line-height: 1.7; -webkit-font-smoothing: antialiased; }
a { color: var(--primary-strong); text-underline-offset: 3px; }
a:hover { color: var(--heading); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--font-head); color: var(--heading); line-height: 1.35; margin: 0 0 .6rem; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 600; }
h3 { font-size: .98rem; font-weight: 600; }
code { font-family: ui-monospace, Consolas, monospace; background: var(--muted-bg); padding: .05rem .35rem; border-radius: 5px; }
.skip { position: absolute; right: -999px; top: 0; background: var(--surface); padding: .5rem 1rem; z-index: 99; }
.skip:focus { right: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mt-1 { margin-top: 1rem; }
.ltr { direction: ltr; text-align: left; unicode-bidi: isolate; }
td.ltr { text-align: right; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); padding: 1.4rem 0 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: .75rem; padding: 0 1.4rem 1.4rem; color: #fff; text-decoration: none; }
.brand svg { flex: none; }
.brand strong { font-family: var(--font-head); font-size: 1.45rem; font-weight: 700; display: block; line-height: 1.1; color: #fff; }
.brand small { color: var(--sidebar-muted); font-size: .78rem; }
.nav { list-style: none; margin: 0; padding: 0 .8rem; }
.nav-group { color: var(--sidebar-muted); font-size: .76rem; font-weight: 700; padding: 1.1rem .8rem .35rem; }
.nav a { position: relative; display: flex; align-items: center; gap: .7rem; padding: .62rem .85rem; color: var(--sidebar-text); text-decoration: none; border-radius: 10px; font-weight: 700; font-size: .93rem; transition: background .15s, color .15s; }
.nav a:hover { background: var(--sidebar-2); color: #fff; }
.nav a[aria-current="page"] { background: var(--sidebar-2); color: #fff; }
.nav a[aria-current="page"]::before { content: ""; position: absolute; right: -.8rem; top: 22%; bottom: 22%; width: 4px; border-radius: 4px 0 0 4px; background: var(--accent); }
.nav a[aria-current="page"] svg { color: var(--accent); }
.nav svg { width: 19px; height: 19px; flex: none; }
.tide { margin-top: auto; padding: 1.2rem 1.4rem 0; }
.tide svg { width: 100%; height: 30px; display: block; }

.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

/* ---------- Header ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 2rem; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; min-height: 64px; }
.topbar-start { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.topbar .today { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.topbar .today b { color: var(--heading); font-family: var(--font-head); font-weight: 600; }
.who { display: flex; align-items: center; gap: .5rem; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--heading); cursor: pointer; position: relative; text-decoration: none; transition: border-color .15s, background .15s; }
.icon-btn:hover { border-color: var(--line-strong); background: var(--surface-2); color: var(--heading); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn b { position: absolute; top: -6px; left: -6px; background: var(--accent); color: #2b1a00; border-radius: 999px; font-size: .7rem; min-width: 19px; height: 19px; display: grid; place-items: center; padding: 0 5px; font-family: var(--font-head); border: 2px solid var(--surface); }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
.menu-toggle { display: none; }

.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: .6rem; cursor: pointer; padding: .25rem .35rem .25rem .7rem; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { border-color: var(--line-strong); }
.avatar { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); font-family: var(--font-head); font-weight: 700; font-size: .95rem; }
.user-menu .uname { font-weight: 700; font-size: .9rem; color: var(--heading); max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu .chev { width: 14px; height: 14px; color: var(--muted); }
.user-menu[open] .chev { transform: rotate(180deg); }
.menu-pop { position: absolute; left: 0; top: calc(100% + 8px); min-width: 210px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: .4rem; z-index: 30; }
.menu-pop a, .menu-pop button { display: flex; width: 100%; align-items: center; gap: .55rem; padding: .55rem .7rem; border-radius: 8px; color: var(--text); text-decoration: none; background: none; border: 0; font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; text-align: right; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); }
.menu-pop .danger { color: var(--bad); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: .3rem 0; }
.menu-pop .meta { padding: .4rem .7rem .5rem; color: var(--muted); font-size: .8rem; }

.content { padding: 1.75rem 2rem 2.5rem; max-width: 1320px; width: 100%; flex: 1; }

/* ---------- Footer ---------- */
.app-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem 1.5rem; padding: 1.1rem 2rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; background: var(--surface); }
.app-footer .credit { direction: ltr; display: inline-flex; align-items: center; gap: .45rem; font-family: var(--font-head); font-size: .8rem; letter-spacing: .02em; }
.app-footer .credit a { color: var(--heading); font-weight: 600; text-decoration: none; padding: .2rem .55rem; border-radius: 8px; border: 1px solid var(--line); transition: border-color .15s, color .15s; }
.app-footer .credit a:hover { border-color: var(--accent); color: var(--accent-ink); }
.auth-footer { background: transparent; border: 0; justify-content: center; text-align: center; }
.auth-form .auth-footer { position: absolute; inset: auto 0 0 0; }

/* ---------- Page head ---------- */
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }
.crumbs a { color: var(--muted); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.page-head p { margin: 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.35rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); }
.panel > h2 { padding-bottom: .7rem; border-bottom: 1px solid var(--line); margin-bottom: 1.05rem; display: flex; align-items: center; gap: .5rem; }
.panel > h2::before { content: ""; width: 4px; height: 1.05em; border-radius: 3px; background: var(--primary); }
.panel.confidential { border-color: var(--conf-line); background: var(--conf-bg); }
.panel.confidential > h2 { color: var(--conf-ink); border-bottom-color: var(--conf-line); }
.panel.confidential > h2::before { background: var(--accent); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }

/* ---------- Buttons ---------- */
.btn { white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font: inherit; font-weight: 700; font-size: .92rem; padding: .62rem 1.15rem; border-radius: 10px; border: 1px solid transparent; cursor: pointer; text-decoration: none; background: var(--primary); color: var(--on-primary); line-height: 1.4; box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 6px 14px -8px var(--primary); transition: background .15s, transform .05s; }
.btn:hover { background: var(--primary-strong); color: var(--on-primary); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: var(--surface); color: var(--heading); border-color: var(--line-strong); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); color: var(--heading); }
.btn-danger { background: var(--bad); color: #fff; box-shadow: none; }
:root[data-theme="dark"] .btn-danger { background: #c4452f; }
.btn-danger:hover { background: #8a2e1f; color: #fff; }
.btn-sm { padding: .38rem .8rem; font-size: .84rem; border-radius: 8px; }
.btn[disabled] { opacity: .6; cursor: progress; }
.linkbtn { background: none; border: 0; color: var(--primary-strong); font: inherit; font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
form.inline { display: inline; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field label, .field legend { font-weight: 700; font-size: .88rem; color: var(--heading); }
.req { color: var(--bad); }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea {
  font: inherit; font-size: .95rem; color: var(--text); background: var(--field-bg); border: 1px solid var(--line-strong); border-radius: 10px; padding: .6rem .8rem; width: 100%; min-width: 0; transition: border-color .15s, box-shadow .15s;
}
input[type=file] { padding: .45rem; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 4px var(--primary-soft); }
input[dir=ltr] { text-align: left; }
input[type=checkbox] { accent-color: var(--primary); width: 17px; height: 17px; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.hint { color: var(--muted); font-size: .8rem; }
.error { color: var(--bad); font-size: .82rem; font-weight: 700; }
.field-check label { display: flex; gap: .55rem; align-items: center; font-weight: 700; padding-top: 1.7rem; cursor: pointer; }
.chips { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .45rem; flex-direction: row; }
.chips legend { width: 100%; margin-bottom: .45rem; }
.chip { display: inline-flex; position: relative; }
.chip input { position: absolute; opacity: 0; }
.chip span { border: 1px solid var(--line-strong); background: var(--field-bg); border-radius: 999px; padding: .32rem .9rem; cursor: pointer; font-size: .87rem; font-weight: 700; transition: all .15s; }
.chip input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip input:focus-visible + span { outline: 3px solid var(--accent); }
.form-foot { display: flex; gap: .6rem; margin-top: 1.3rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }

/* ---------- Filters & tables ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .7rem; align-items: flex-end; margin-bottom: 1rem; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.filters .field { min-width: 160px; flex: 1 1 170px; max-width: 280px; }
.filters .field-check label { padding-top: 0; padding-bottom: .6rem; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel .table-wrap { box-shadow: none; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .8rem 1rem; text-align: right; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--surface-2); font-weight: 700; color: var(--muted); white-space: nowrap; font-size: .82rem; }
th a { color: inherit; text-decoration: none; }
th a:hover { color: var(--heading); }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td > a:first-child { font-weight: 700; }
td .sub { display: block; color: var(--muted); font-size: .79rem; margin-top: .1rem; }
.num { font-variant-numeric: tabular-nums; font-family: var(--font-head); }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty strong { display: block; color: var(--heading); font-family: var(--font-head); font-size: 1.1rem; margin-bottom: .35rem; }
.pager { display: flex; gap: .35rem; justify-content: center; margin-top: 1.1rem; flex-wrap: wrap; }
.pager a, .pager span { min-width: 38px; text-align: center; padding: .38rem .7rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); text-decoration: none; font-family: var(--font-head); color: var(--text); }
.pager a:hover { border-color: var(--primary); }
.pager .current { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.count { color: var(--muted); font-size: .85rem; margin: -.3rem 0 .6rem; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .16rem .62rem; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; vertical-align: middle; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--muted-bg); color: var(--muted); }
h1 .badge { font-size: .8rem; font-family: var(--font-body); }

/* ---------- Flash ---------- */
.flash { padding: .85rem 1.1rem; border-radius: 12px; margin-bottom: 1.1rem; border: 1px solid; font-weight: 700; display: flex; gap: .6rem; align-items: center; }
.flash::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.flash-success { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok); }
.flash-error { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 30%, transparent); color: var(--bad); }

/* ---------- Detail lists ---------- */
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .55rem 1.4rem; margin: 0; }
dl.facts dt { color: var(--muted); font-size: .87rem; font-weight: 700; }
dl.facts dd { margin: 0; }
.prose { white-space: pre-line; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: .45rem 0; display: flex; gap: .6rem; align-items: center; border-bottom: 1px dashed var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist .yes::before, .checklist .no::before { flex: none; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-weight: 700; font-size: .8rem; }
.checklist .yes::before { content: "✓"; background: var(--ok-bg); color: var(--ok); }
.checklist .no::before { content: "✕"; background: var(--bad-bg); color: var(--bad); }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.timeline li { padding: .55rem 1.1rem .55rem 0; border-right: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; right: -7px; top: 1rem; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--primary); }
.timeline time { color: var(--muted); font-size: .78rem; display: block; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .7rem; }
.thumbs figure { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.thumbs img { width: 100%; height: 96px; object-fit: cover; display: block; }
.thumbs figcaption { font-size: .75rem; padding: .35rem .5rem; display: flex; justify-content: space-between; gap: .3rem; }

/* ---------- Dashboard ---------- */
.hero { position: relative; overflow: hidden; border-radius: 20px; background: var(--sidebar); color: #d7e8ec; padding: 1.8rem 2rem 2.2rem; margin-bottom: 1.4rem; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1.2rem; isolation: isolate; }
.hero h1 { color: #fff; font-size: 2rem; margin-bottom: .3rem; }
.hero p { margin: 0; color: #a9c6cd; max-width: 46ch; }
.hero .actions .btn-ghost { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.22); color: #fff; }
.hero .actions .btn-ghost:hover { background: rgba(255,255,255,.16); }
.hero .btn { box-shadow: none; }
.hero-art { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.hero-art::before { content: ""; position: absolute; left: 12%; top: 30%; width: 64px; height: 64px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 10px rgba(242,169,59,.12), 0 0 60px rgba(242,169,59,.35); }
.hero-art svg { position: absolute; inset: auto 0 0 0; width: 100%; height: 75%; }
:root[data-theme="dark"] .hero { border: 1px solid var(--line); }
.ledgers { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.1rem; margin-bottom: 1.4rem; }
.ledger { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.ledger-head { display: flex; align-items: center; gap: .8rem; padding: 1.1rem 1.2rem 1rem; }
.ledger h2 { margin: 0; font-size: 1rem; flex: 1; }
.ledger .big { font-family: var(--font-head); font-size: 2.2rem; font-weight: 700; color: var(--heading); font-variant-numeric: tabular-nums; line-height: 1; }
.ledger .ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-strong); flex: none; }
.ledger .ico svg { width: 20px; height: 20px; }
.ledger ul { list-style: none; margin: 0; padding: .3rem 0 .5rem; border-top: 1px solid var(--line); }
.ledger li a, .ledger li > span { display: flex; justify-content: space-between; padding: .45rem 1.2rem; text-decoration: none; color: var(--text); font-size: .9rem; }
.ledger li a:hover { background: var(--surface-2); }
.ledger li b { font-variant-numeric: tabular-nums; font-weight: 700; font-family: var(--font-head); }
.ledger li.alert b { color: var(--accent-ink); background: var(--warn-bg); padding: 0 .5rem; border-radius: 6px; }

/* ---------- Auth & installer ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }
.auth-art { background: var(--sidebar); color: #dbe9ea; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art h1 { color: #fff; font-size: 3.2rem; font-weight: 700; margin-top: 2.2rem; line-height: 1.15; }
.auth-art p { max-width: 34ch; color: #a9c5c8; font-size: 1.05rem; }
.auth-art svg.waves { position: absolute; inset: auto 0 0 0; width: 100%; height: 42%; }
.auth-art::after { content: ""; position: absolute; left: 16%; bottom: 30%; width: 96px; height: 96px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 80px rgba(242,169,59,.4); }
.auth-form { display: grid; place-items: center; padding: 2rem 2rem 5rem; background: var(--surface); position: relative; }
.auth-form form { width: 100%; max-width: 390px; display: grid; gap: 1.05rem; }
.auth-form h2 { font-size: 1.6rem; margin-bottom: 0; }
.auth-form .lead { color: var(--muted); margin: -.6rem 0 .4rem; }
.auth-form .btn { padding: .78rem 1rem; font-size: 1rem; }
.auth-tools { position: absolute; top: 1.2rem; left: 1.2rem; }
.install { max-width: 780px; margin: 2rem auto 5rem; padding: 0 1rem; }
.install-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }

/* ---------- Error pages ---------- */
.error-page { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 2rem; }
.error-page .code { font-family: var(--font-head); font-size: 6rem; font-weight: 700; color: var(--primary); line-height: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .form-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 0 0 auto; width: 280px; transform: translateX(100%); transition: transform .22s ease; z-index: 40; }
  body.nav-open .sidebar { transform: none; box-shadow: -12px 0 40px rgba(0,0,0,.35); }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(5,14,19,.45); z-index: 35; }
  .menu-toggle { display: inline-grid; }
  .content { padding: 1.1rem; }
  .topbar { padding: .6rem 1rem; }
  .topbar .today, .user-menu .uname, .user-menu .chev { display: none; }
  .user-menu summary { padding: .25rem; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 230px; padding: 1.6rem; }
  .auth-art h1 { font-size: 2.1rem; margin-top: .6rem; }
  .table-wrap table { min-width: 640px; }
  .hero { padding: 1.4rem 1.3rem 1.6rem; }
  .hero h1 { font-size: 1.5rem; }
  .app-footer { padding: 1rem; justify-content: center; text-align: center; }
  .auth-footer { position: static; }
  h1 { font-size: 1.45rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .sidebar, .topbar, .actions, .filters, .pager, .app-footer { display: none !important; } .shell { display: block; } }
.auth-art { isolation: isolate; }
.auth-art::after { z-index: 0; }
.auth-art svg.waves { z-index: 1; }
.auth-art > div { position: relative; z-index: 2; }
dd.ltr { text-align: right; }
.auth-art::after { bottom: 20%; }
@media (max-width: 860px) {
  .hero-art::before { display: none; }
  .auth-art::after { width: 60px; height: 60px; bottom: 26%; }
}

/* ---------- Phase 2 components ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .9rem; margin-bottom: 1.3rem; }
.stat-row.compact { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; margin-bottom: 0; }
.stat { display: flex; flex-direction: column; gap: .2rem; padding: .95rem 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
a.stat:hover { border-color: var(--primary); color: var(--text); transform: translateY(-1px); }
.stat span { color: var(--muted); font-size: .82rem; font-weight: 700; }
.stat b { font-family: var(--font-head); font-size: 1.35rem; font-weight: 700; color: var(--heading); }
.panel .stat { box-shadow: none; background: var(--surface-2); }
.tabs { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .9rem; }
.tabs a { padding: .42rem .9rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 700; font-size: .87rem; }
.tabs a:hover { border-color: var(--primary); }
.tabs a[aria-current="page"] { background: var(--heading); border-color: var(--heading); color: var(--surface); }
.meter { display: block; height: 5px; background: var(--muted-bg); border-radius: 4px; margin-top: .3rem; overflow: hidden; width: 110px; }
.meter i { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.meter .w0 { width: 0; } .meter .w10 { width: 10%; } .meter .w20 { width: 20%; } .meter .w30 { width: 30%; } .meter .w40 { width: 40%; } .meter .w50 { width: 50%; }
.meter .w60 { width: 60%; } .meter .w70 { width: 70%; } .meter .w80 { width: 80%; } .meter .w90 { width: 90%; } .meter .w100 { width: 100%; background: var(--ok); }
.qr { display: grid; place-items: center; padding: .8rem; background: #fff; border-radius: 12px; width: fit-content; margin: 0 auto .8rem; }
.qr img, .qr canvas { display: block; }
.qr-print { text-align: center; }
.qr-lg { padding: 1.4rem; }
.legend { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; font-size: .82rem; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.legend span::before { content: ""; width: 14px; height: 14px; border-radius: 4px; }
table.cal { font-size: .78rem; min-width: 900px; }
table.cal th, table.cal td { padding: 0; text-align: center; border: 1px solid var(--line); height: 34px; min-width: 26px; }
table.cal th.cal-name { text-align: right; padding: .35rem .7rem; min-width: 170px; position: sticky; right: 0; background: var(--surface); z-index: 1; font-size: .85rem; }
table.cal thead th { padding: .35rem 0; }
table.cal th.we { color: var(--accent-ink); }
table.cal th.today { background: var(--primary); color: var(--on-primary); }
table.cal td a, table.cal td span { display: block; width: 100%; height: 100%; min-height: 32px; }
.cal-pending, .legend .cal-pending::before { background: var(--warn-bg); }
td.cal-pending { background: repeating-linear-gradient(45deg, var(--warn-bg), var(--warn-bg) 4px, transparent 4px, transparent 8px); }
td.cal-confirmed, .legend .cal-confirmed::before { background: var(--primary); }
td.cal-completed, .legend .cal-completed::before { background: color-mix(in srgb, var(--primary) 45%, var(--surface)); }
td.cal-blocked, .legend .cal-blocked::before { background: var(--muted-bg); }
td.cal-blocked { background: repeating-linear-gradient(-45deg, var(--muted-bg), var(--muted-bg) 3px, var(--surface-2) 3px, var(--surface-2) 6px); }
.legend .cal-pending::before { border: 1px dashed var(--warn); }
.checkin { max-width: 620px; margin: 0 auto; }
.checkin-status { font-family: var(--font-head); font-size: 1.6rem; font-weight: 700; text-align: center; padding: 1.2rem; border-radius: var(--radius); margin-bottom: 1rem; }
.is-valid .checkin-status { background: var(--ok-bg); color: var(--ok); }
.is-invalid .checkin-status { background: var(--bad-bg); color: var(--bad); }
@media print {
  .qr-panel, .qr-print { box-shadow: none; border: 0; }
  .panel:not(.qr-panel):not(.qr-print), .page-head .actions, .crumbs, .grid-2 > div:first-child { display: none !important; }
  .grid-2 { display: block; }
}
.table-wrap { position: relative; }
th .sub { display: block; font-weight: 400; color: var(--muted); font-size: .75rem; }

/* ---------- Phase 3 ---------- */
.nav-count { margin-inline-start: auto; background: var(--accent); color: #2b1a00; border-radius: 999px; font-size: .72rem; padding: 0 .45rem; font-family: var(--font-head); }
.stars { color: var(--accent); letter-spacing: 1px; }
.stars .off { color: var(--line-strong); }
/* Print sheets (reports, legal records) */
.print-body { background: #e9eef0; }
.print-toolbar { display: flex; gap: .6rem; align-items: center; justify-content: center; padding: 1rem; }
.sheet { background: #fff; color: #111; width: 210mm; min-height: 297mm; margin: 0 auto 2rem; padding: 16mm 14mm; box-shadow: 0 4px 30px rgba(0,0,0,.12); font-size: 12.5px; }
.sheet h1 { font-size: 18px; margin: 0; color: #0a2a38; }
.sheet h2 { font-size: 14px; margin: 0 0 6px; color: #0a2a38; border-bottom: 2px solid #0e8a8c; padding-bottom: 4px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid #0a2a38; padding-bottom: 10px; margin-bottom: 14px; }
.sheet-head > div:first-child { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-size: 18px; color: #0a2a38; }
.sheet-meta { text-align: left; } .sheet-meta span { color: #555; font-size: 11px; }
.sheet-sec { margin-bottom: 14px; break-inside: avoid; }
.sheet table { width: 100%; border-collapse: collapse; }
.sheet table.grid th, .sheet table.grid td, .sheet table.kv th, .sheet table.kv td { border: 1px solid #c9d3d6; padding: 5px 7px; text-align: right; vertical-align: top; }
.sheet table.grid th, .sheet table.kv th { background: #eef4f5; font-weight: 700; color: #0a2a38; }
.sheet tr.total td { font-weight: 700; background: #f6f9fa; }
.sheet .mono { font-family: ui-monospace, Consolas, monospace; font-size: 9px; word-break: break-all; }
.sheet-foot { display: flex; justify-content: space-between; border-top: 1px solid #c9d3d6; margin-top: 18px; padding-top: 6px; color: #666; font-size: 10px; }
.signs { display: flex; justify-content: space-between; gap: 2rem; margin-top: 28px; }
.signs div { flex: 1; border-top: 1px dashed #777; padding-top: 6px; text-align: center; color: #444; }
@media print {
  @page { size: A4; margin: 0; }
  .print-body { background: #fff; }
  .print-toolbar { display: none; }
  .sheet { box-shadow: none; margin: 0; width: auto; min-height: auto; }
}

/* ---------- Phase 4 ---------- */
.banner-thumb { width: 120px; height: 50px; object-fit: cover; border-radius: 8px; display: block; }
.guest-qr { max-width: 460px; margin: 0 auto; padding: 2rem 1.2rem 6rem; text-align: center; }
.guest-qr dl.facts { text-align: right; margin-top: 1rem; background: var(--surface); padding: 1rem; border-radius: var(--radius); border: 1px solid var(--line); }
.guest-qr h1 { margin-top: .6rem; }

/* ---------- Phase 5 ---------- */
.btn-lg { padding: .9rem 1.6rem; font-size: 1.05rem; border-radius: 12px; }
.clock { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; }
.clock > div:first-child h2::before { display: none; }
.clock > div:first-child h2 { border: 0; padding: 0; }
.sched-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .5rem; align-items: center; padding: .3rem 0; }
.sched-row label { display: flex; gap: .45rem; align-items: center; font-weight: 700; }
.log { max-height: 420px; overflow: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: .8rem; font-size: .75rem; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, Consolas, monospace; }
.error-detail { background: var(--bad-bg); color: var(--bad); padding: .7rem 1rem; border-radius: 10px; max-width: 720px; margin: 1rem auto; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; word-break: break-word; }
.amenity-row { display: grid; grid-template-columns: 70px 1fr auto auto; gap: .5rem; align-items: center; }
.amenity-row input[name=icon] { text-align: center; font-size: 1.2rem; }
.whats-new { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem 1rem; margin-bottom: 1rem; border-radius: 12px; background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent); font-weight: 700; color: var(--heading); }
.guide-search { position: sticky; top: 70px; z-index: 5; margin-bottom: 1rem; }
.guide-toc { columns: 2; gap: 1.5rem; margin: 0; padding-inline-start: 1.2rem; }
.guide-sec h2 { scroll-margin-top: 90px; }
.guide-sec ol, .guide-sec ul { padding-inline-start: 1.3rem; margin: .4rem 0 .8rem; }
.guide-sec li { margin-bottom: .3rem; }
.tip { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: .6rem .9rem; font-weight: 700; margin: .6rem 0; }
.endpoint { border-top: 1px solid var(--line); padding: .8rem 0; }
.endpoint code.m { font-weight: 700; padding: .1rem .45rem; border-radius: 6px; margin-inline-end: .4rem; }
.m-GET { background: var(--info-bg); color: var(--info); } .m-POST { background: var(--ok-bg); color: var(--ok); } .m-PUT { background: var(--warn-bg); color: var(--warn); } .m-DELETE { background: var(--bad-bg); color: var(--bad); }
pre.code { direction: ltr; text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: .8rem; overflow-x: auto; font-size: .8rem; font-family: ui-monospace, Consolas, monospace; }
@media (max-width: 860px) { .guide-toc { columns: 1; } }
