/* Indie Stays design system — ported from the product artifacts. */
:root {
  color-scheme: light;
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bg: #eef0f6; --app: #f7f8fb; --surface: #ffffff; --surface-2: #f2f4f9;
  --fg: #12162a; --muted: #667085; --faint: #6b7280; --border: #e7eaf3; --border-strong: #d6dbec;
  --primary: #4f46e5; --primary-ink: #fff; --primary-soft: #ecebfe; --primary-deep: #3730a3;
  --good: #10b981; --good-soft: #d9f5ea; --good-ink: #05674a;
  --warn: #f59e0b; --warn-soft: #fdeecd; --warn-ink: #8a5a00;
  --bad: #ef4444; --bad-soft: #fde3e3; --bad-ink: #9b1c1c;
  --shadow-card: 0 1px 2px rgba(16,22,42,.04), 0 8px 24px -16px rgba(16,22,42,.18);
  --shadow-lift: 0 18px 40px -20px rgba(30,26,90,.45);
  --radius: 16px;
}
:root:not([data-theme="light"]) { @media (prefers-color-scheme: dark) {
  color-scheme: dark;
  --bg: #070912; --app: #0d1019; --surface: #171b29; --surface-2: #1e2333;
  --fg: #eef1fb; --muted: #a2abc4; --faint: #8b94ad; --border: #262c3f; --border-strong: #333b4f;
  --primary: #7c78f0; --primary-ink: #0a0c15; --primary-soft: #23233f; --primary-deep: #a5a1f7;
  --good: #34d399; --good-soft: #123024; --good-ink: #7ff0c6;
  --warn: #fbbf24; --warn-soft: #33270a; --warn-ink: #fcd97a;
  --bad: #f87171; --bad-soft: #351919; --bad-ink: #f9b4b4;
  --shadow-card: 0 1px 2px rgba(0,0,0,.3), 0 10px 26px -18px rgba(0,0,0,.6);
  --shadow-lift: 0 20px 44px -22px rgba(0,0,0,.75);
} }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070912; --app: #0d1019; --surface: #171b29; --surface-2: #1e2333;
  --fg: #eef1fb; --muted: #a2abc4; --faint: #8b94ad; --border: #262c3f; --border-strong: #333b4f;
  --primary: #7c78f0; --primary-ink: #0a0c15; --primary-soft: #23233f; --primary-deep: #a5a1f7;
  --good: #34d399; --good-soft: #123024; --good-ink: #7ff0c6;
  --warn: #fbbf24; --warn-soft: #33270a; --warn-ink: #fcd97a;
  --bad: #f87171; --bad-soft: #351919; --bad-ink: #f9b4b4;
  --shadow-card: 0 1px 2px rgba(0,0,0,.3), 0 10px 26px -18px rgba(0,0,0,.6);
  --shadow-lift: 0 20px 44px -22px rgba(0,0,0,.75);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--app); color: var(--fg); min-height: 100dvh; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font-family: inherit; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

/* form controls */
label.lbl, .lbl { display: block; font-size: 13px; font-weight: 600; color: var(--fg); margin-bottom: 6px; }
.input, input:not([type]), input[type=text], input[type=email], input[type=number], input[type=tel],
input[type=date], input[type=time], input[type=month], input[type=password], input[type=search],
input[type=file], select, textarea {
  width: 100%; border: 1px solid var(--border-strong); background: var(--surface); color: var(--fg);
  border-radius: 11px; padding: 10px 12px; font-size: 14px; transition: border-color .15s ease, box-shadow .15s ease;
}
input[type=file] { padding: 8px 12px; font-size: 13px; cursor: pointer; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: auto; }
.field { margin: 0; }
.err { color: var(--bad-ink); font-size: 12.5px; margin-top: 5px; }

/* app shell (console) */
.app { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 18px 14px; gap: 4px; position: sticky; top: 0; height: 100dvh; overflow-y: auto; }
.main { min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.wrap { padding: 24px 28px 60px; max-width: 1280px; width: 100%; }
@media (max-width: 900px) {
  /* Phone: sidebar hidden — navigation is the bottom tab bar + "More" sheet. */
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .wrap { padding: 18px 16px 90px; }
}

.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 14px; }
.brand .logo { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, var(--primary), #8b5cf6); display: grid; place-items: center; color: #fff; flex: 0 0 auto; }
.brand .logo svg { width: 21px; height: 21px; }
.brand .bt { font-size: 16px; font-weight: 800; letter-spacing: -.02em; }
.brand .bs { font-size: 11px; color: var(--faint); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }

.navlabel { font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); padding: 12px 10px 4px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav span.dis { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px; color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; transition: .15s ease; }
.nav a svg, .nav span.dis svg { width: 19px; height: 19px; flex: 0 0 auto; }
.nav a .badge { margin-left: auto; font-size: 11px; font-weight: 800; background: var(--bad); color: #fff; border-radius: 999px; padding: 1px 7px; }
.nav a:hover { background: var(--surface-2); color: var(--fg); }
.nav a.active { background: var(--primary-soft); color: var(--primary-deep); font-weight: 700; }
.nav span.dis { color: var(--faint); cursor: default; }
.nav span.dis .soon { margin-left: auto; font-size: 9px; font-weight: 800; letter-spacing: .05em; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }
.me-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); }
.me-card .av { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg,#0ea5e9,#4f46e5); color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; flex: 0 0 auto; }
.me-card .nm { font-size: 13px; font-weight: 700; line-height: 1.15; }
.me-card .rl { font-size: 11px; color: var(--muted); }

/* topbar */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--app) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 16px; padding: 14px 28px; }
.topbar h1 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.topbar .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.topbar .spacer { margin-left: auto; }
.nav-toggle { display: none; width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--fg); place-items: center; cursor: pointer; flex: 0 0 auto; padding: 0; }
.nav-toggle svg { width: 20px; height: 20px; }
@media (max-width: 900px) { .topbar { padding: 12px 16px; } .nav-toggle { display: grid; } }

/* Mobile: topbar carries only the brand + switcher/bell; the page title moves
   into the page (.page-hd). The sidebar brand is hidden on phones. */
.topbar-brand { display: none; }
.page-hd { display: none; }
@media (max-width: 900px) {
  .topbar-title { display: none; }
  .topbar-brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: inherit; }
  .topbar-brand .tb-logo { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--primary), #8b5cf6); display: grid; place-items: center; color: #fff; flex: 0 0 auto; }
  .topbar-brand .tb-logo svg { width: 17px; height: 17px; }
  .topbar-brand .tb-name { font-size: 16px; font-weight: 800; letter-spacing: -.02em; color: var(--fg); }
  .page-hd { display: block; margin: 2px 2px 16px; }
  .page-hd h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
  .page-hd .sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
}

/* Mobile bottom tab bar (Pocket-style) */
.cbar { display: none; }
@media (max-width: 900px) {
  .cbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 45; background: color-mix(in srgb, var(--surface) 96%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--border); padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0px)); }
  .cbar a, .cbar button { border: 0; background: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 700; cursor: pointer; padding: 4px 2px; border-radius: 10px; text-decoration: none; font-family: inherit; }
  .cbar a svg, .cbar button svg { width: 22px; height: 22px; }
  .cbar a.on, .cbar button.on { color: var(--primary-deep); }
}

/* "More" bottom sheet — sections not on the tab bar, appearance + sign out */
.msheet-scrim { position: fixed; inset: 0; z-index: 70; background: rgba(10,12,21,.5); backdrop-filter: blur(2px); display: flex; align-items: flex-end; justify-content: center; }
.msheet { background: var(--surface); width: 100%; max-width: 520px; border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lift); padding: 8px 16px calc(18px + env(safe-area-inset-bottom, 0px)); max-height: 86dvh; overflow-y: auto; animation: msheet-rise .22s ease; }
@media (min-width: 560px) { .msheet { border-radius: 22px; margin-bottom: 24px; } }
@keyframes msheet-rise { from { transform: translateY(28px); opacity: .5; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .msheet { animation: none; } }
.msheet-grip { width: 40px; height: 4px; border-radius: 999px; background: var(--border-strong); margin: 4px auto 10px; }
.msheet-label { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin: 14px 4px 8px; }
.msheet-label:first-of-type { margin-top: 2px; }
.msheet-list { display: flex; flex-direction: column; gap: 8px; }
.msheet-list form { margin: 0; }
.msheet-opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 13px; padding: 12px; cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 700; color: var(--fg); text-decoration: none; }
.msheet-opt:hover, .msheet-opt.on { border-color: var(--primary); background: var(--surface-2); }
.msheet-opt.on { color: var(--primary-deep); }
.msheet-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); color: var(--primary-deep); display: grid; place-items: center; flex: 0 0 auto; }
.msheet-ic svg { width: 18px; height: 18px; }
.msheet-t { flex: 1; }
.msheet-go { width: 17px; height: 17px; color: var(--faint); flex: 0 0 auto; }
.msheet-opt.danger { color: var(--bad-ink); }
.msheet-opt.danger .msheet-ic { background: var(--bad-soft); color: var(--bad-ink); }
.msheet-close { width: 100%; margin-top: 16px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--fg); font-weight: 800; font-size: 15px; padding: 13px; border-radius: 13px; cursor: pointer; font-family: inherit; }

.iconbtn { width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); color: var(--fg); display: grid; place-items: center; cursor: pointer; position: relative; }
.iconbtn:hover { border-color: var(--primary); color: var(--primary-deep); }
.iconbtn svg { width: 18px; height: 18px; }

/* topbar right: location + notifications bell */
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 12px; position: relative; }
.locpick { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 11px; padding: 8px 12px; font-size: 13.5px; font-weight: 700; color: var(--fg); }
.locpick .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: 0 0 auto; }
.iconbtn.bell::after { content: ""; position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); border: 2px solid var(--surface); }
.iconbtn.bell.read::after { display: none; }
details.notifdd > summary { list-style: none; }
details.notifdd > summary::-webkit-details-marker { display: none; }
.notif { position: absolute; top: calc(100% + 10px); right: 0; width: 340px; max-width: 86vw; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lift); z-index: 40; overflow: hidden; }
.notif-head { padding: 13px 16px; font-size: 13px; font-weight: 800; border-bottom: 1px solid var(--border); }
.notif-item { display: flex; gap: 11px; align-items: flex-start; width: 100%; text-align: left; border-top: 1px solid var(--border); padding: 12px 16px; text-decoration: none; color: var(--fg); }
.notif-item:first-of-type { border-top: 0; }
.notif-item:hover { background: var(--surface-2); }
.notif-item .ni { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; }
.notif-item .ni svg { width: 16px; height: 16px; }
.notif-item .ntx { flex: 1; min-width: 0; }
.notif-item .nt { font-size: 13.5px; font-weight: 700; }
.notif-item .nd { font-size: 12px; color: var(--muted); margin-top: 1px; line-height: 1.4; }
.notif-item .go { align-self: center; color: var(--faint); flex: 0 0 auto; }
.notif-empty { padding: 22px 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.pad { padding: 18px; }
.section-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin: 26px 2px 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); gap: 12px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.card-head h3 svg { width: 17px; height: 17px; color: var(--muted); }
.card-head a, .link { color: var(--primary-deep); font-weight: 700; font-size: 13px; text-decoration: none; cursor: pointer; }
.h2 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; margin: 0; }
.lead { color: var(--muted); margin: 4px 0 0; font-size: 14px; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1000px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) {
  /* Phones: keep the four KPIs as a 2x2 grid (Pocket-style), a touch more compact. */
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .kpi { padding: 15px; gap: 8px; }
  .kpi .n { font-size: 25px; }
  .kpi .n small { font-size: 14px; }
  .kpi .l { font-size: 12px; }
}
.kpi { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.kpi .top { display: flex; align-items: center; justify-content: space-between; }
.ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; }
.ico svg { width: 19px; height: 19px; }
.ico.i-primary { background: var(--primary-soft); color: var(--primary-deep); }
.ico.i-good { background: var(--good-soft); color: var(--good-ink); }
.ico.i-warn { background: var(--warn-soft); color: var(--warn-ink); }
.ico.i-bad { background: var(--bad-soft); color: var(--bad-ink); }
.ico.i-neutral { background: var(--surface-2); color: var(--muted); }
.kpi .n { font-size: 30px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.kpi .n small { font-size: 16px; color: var(--muted); font-weight: 700; }
.kpi .l { font-size: 13px; color: var(--muted); font-weight: 600; }

/* pills / badges */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill svg { width: 13px; height: 13px; }
.pill.good { background: var(--good-soft); color: var(--good-ink); }
.pill.warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill.bad { background: var(--bad-soft); color: var(--bad-ink); }
.pill.info { background: var(--primary-soft); color: var(--primary-deep); }
.pill.neutral { background: var(--surface-2); color: var(--muted); }

/* buttons */
.btn { border: 1px solid var(--border-strong); background: var(--surface); color: var(--fg); font-weight: 700; font-size: 12.5px; padding: 8px 12px; border-radius: 9px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: .15s ease; text-decoration: none; }
.btn:hover { border-color: var(--primary); color: var(--primary-deep); }
.btn svg { width: 14px; height: 14px; }
.btn.sm { font-size: 12px; padding: 7px 11px; border-radius: 9px; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn:disabled:hover, .btn[disabled]:hover { border-color: var(--border-strong); color: var(--fg); }
.btn.primary:disabled:hover, .btn.primary[disabled]:hover { border-color: var(--primary); color: var(--primary-ink); }
.btn.block { width: 100%; }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-deep); color: #fff; }
.btn.approve, .btn.good { background: var(--good); color: #fff; border-color: var(--good); }
.btn.approve:hover, .btn.good:hover { filter: brightness(1.05); color: #fff; }
.btn.reject { background: var(--surface); color: var(--bad-ink); border-color: var(--border-strong); }
.btn.reject:hover { border-color: var(--bad); color: var(--bad-ink); }
.btn.danger { background: var(--bad-soft); color: var(--bad-ink); border-color: transparent; }
.btn.warnbtn { background: var(--warn-soft); color: var(--warn-ink); border-color: transparent; }
.btn-soft { border: 1px solid var(--border); background: var(--surface-2); color: var(--fg); font-weight: 700; font-size: 13px; padding: 10px; border-radius: 11px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; width: 100%; text-decoration: none; }
.btn-soft:hover { border-color: var(--primary); color: var(--primary-deep); }
.row-actions { display: inline-flex; gap: 7px; align-items: center; }

/* chips + search */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); font-size: 12.5px; font-weight: 700; padding: 8px 13px; border-radius: 999px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.chip.on { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.search { flex: 1; min-width: 220px; display: flex; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 11px; padding: 10px 13px; }
.search svg { width: 17px; height: 17px; color: var(--faint); }
.search input { border: 0; box-shadow: none; padding: 0; font-size: 14px; width: 100%; }

/* tables */
.tablewrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
table.tbl thead th { text-align: left; font-size: 11.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); padding: 13px 16px; white-space: nowrap; }
table.tbl td { padding: 13px 16px; border-top: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
table.tbl tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
/* On phones a wide table can't fit — stack each row into a card: the lead
   cell (usually the resident) on top, the rest (status / amount / action) in a
   wrapping row below, with the last cell (action) pushed to the right. */
@media (max-width: 720px) {
  .tablewrap { overflow-x: visible; }
  table.tbl, table.tbl tbody { display: block; width: 100%; }
  table.tbl thead { display: none; }
  table.tbl tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 13px 14px; border-top: 1px solid var(--border); }
  table.tbl tbody tr:first-child { border-top: 0; }
  table.tbl td { display: block; padding: 0; border: 0; }
  table.tbl td:first-child { flex: 1 1 100%; }
  table.tbl td:last-child { margin-left: auto; }
}
.who { display: flex; align-items: center; gap: 11px; }
.who .av { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg,#8b5cf6,#4f46e5); color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; flex: 0 0 auto; }
.who .nm { font-weight: 700; font-size: 14px; }
.who .nm a { text-decoration: none; }
.who .nm a:hover { color: var(--primary-deep); }
.who .bd { font-size: 12px; color: var(--muted); }

/* meal cards */
.meals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 900px) { .meals { grid-template-columns: 1fr; } }
.mealc { overflow: hidden; }
.mealc .mh { padding: 16px 18px; display: flex; align-items: center; gap: 12px; color: #fff; }
.mealc .mh .mi { width: 40px; height: 40px; border-radius: 11px; background: rgba(255,255,255,.2); display: grid; place-items: center; }
.mealc .mh .mt { font-size: 15px; font-weight: 800; text-transform: capitalize; }
.mealc .mh .ms { font-size: 12px; opacity: .9; }
.mh.h-break { background: linear-gradient(135deg,#f59e0b,#f97316); }
.mh.h-lunch { background: linear-gradient(135deg,#10b981,#0ea5e9); }
.mh.h-dinner { background: linear-gradient(135deg,#6366f1,#a855f7); }
.mealc .mb { padding: 18px; }
.mealc .count { display: flex; align-items: baseline; gap: 8px; }
.mealc .count .big { font-size: 40px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.mealc .count .of { font-size: 14px; color: var(--muted); font-weight: 700; }

/* alerts */
.alert { display: flex; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border); align-items: flex-start; }
.alert:first-child { border-top: 0; }
.alert .ai { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; }
.alert .at { font-size: 13.5px; font-weight: 700; }
.alert .ad { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.alert .ai svg { width: 18px; height: 18px; }
.alert .act { margin-left: auto; }

/* check-in progress (dashboard) */
.progwrap { padding: 18px; }
.progbar { height: 12px; border-radius: 999px; background: var(--surface-2); overflow: hidden; display: flex; }
.progbar span { height: 100%; display: block; }
.seg-good { background: var(--good); } .seg-warn { background: var(--warn); } .seg-bad { background: var(--bad); } .seg-info { background: var(--primary); }
.ci-brk { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 16px; }
.ci-brk td { padding: 11px 6px; border-top: 1px solid var(--border); vertical-align: top; font-size: 13.5px; }
.ci-brk tr:first-child td { border-top: 0; }
.ci-brk .st { width: 96px; }
.ci-brk .c { text-align: center; width: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ci-brk .nm { color: var(--muted); line-height: 1.45; }
.progcap { font-size: 12.5px; color: var(--faint); margin: 14px 0 0; }

/* flash */
.flash { border-radius: 12px; padding: 12px 16px; font-size: 14px; font-weight: 600; margin-bottom: 16px; }
.flash.ok { background: var(--good-soft); color: var(--good-ink); }
.flash.warn { background: var(--warn-soft); color: var(--warn-ink); }
.flash.bad { background: var(--bad-soft); color: var(--bad-ink); }

/* grids / layout helpers */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.cols { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start; }
.layout { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .cols, .layout, .g2, .g3 { grid-template-columns: 1fr; } }
.note { font-size: 12.5px; color: var(--muted); line-height: 1.55; margin: 16px 2px 0; }

/* compact tiles (property, staff) */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-card); padding: 15px 16px; }
.tile .n { font-size: 24px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile .n small { font-size: 15px; color: var(--muted); font-weight: 700; }
.tile .l { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.tile .bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.tile .bar span { display: block; height: 100%; background: var(--good); }
@media (max-width: 1000px) { .tiles { grid-template-columns: repeat(2, 1fr); } }

/* five-up KPI row (overview) */
.kpis.k5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) { .kpis.k5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .kpis.k5 { grid-template-columns: repeat(2, 1fr); } }

/* settings — gray-band cards */
.set-card { overflow: hidden; }
.set-h { padding: 14px 18px; border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 800; background: var(--surface-2); display: flex; align-items: center; gap: 9px; }
.set-h svg { width: 17px; height: 17px; color: var(--muted); }
.set-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.set-body .grid2, .set-body .grid3 { gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.help { font-size: 12px; color: var(--faint); line-height: 1.5; }
.set-save { display: flex; justify-content: flex-end; margin-top: 16px; }
/* Explicit layout: Location matches the stacked Meal cards; Evening check-in matches Dues. */
.set-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
        "loc  meals"
        "loc  opts"
        "eve  dues";
    gap: 18px;
    align-items: stretch;
}
.set-layout .a-loc { grid-area: loc; }
.set-layout .a-meals { grid-area: meals; }
.set-layout .a-opts { grid-area: opts; }
.set-layout .a-eve { grid-area: eve; }
.set-layout .a-dues { grid-area: dues; }
/* cards fill their grid area so bottoms align; body grows to push help text down */
.set-layout .set-card { display: flex; flex-direction: column; }
.set-layout .set-card .set-body { flex: 1; }
@media (max-width: 1000px) {
    .set-layout { grid-template-columns: 1fr; grid-template-areas: "loc" "meals" "opts" "eve" "dues"; }
}
.cd-add { display: grid; grid-template-columns: auto 1fr 1.4fr auto; gap: 10px; align-items: center; }
.rate-card { border: 1px solid var(--border); border-radius: 13px; padding: 14px; background: var(--surface); }
.rate-card .rt { font-weight: 800; font-size: 14px; margin-bottom: 10px; }
.ov-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface-2); border-radius: 10px; padding: 9px 12px; font-size: 13.5px; }
@media (max-width: 1000px) { .set-masonry { column-count: 1; } .grid3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .cd-add { grid-template-columns: 1fr; } .grid3, .grid2 { grid-template-columns: 1fr; } }

/* simple table (locations, etc.) */
table.stbl { width: 100%; border-collapse: separate; border-spacing: 0; }
table.stbl thead th { text-align: left; font-size: 11.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); padding: 12px 16px; white-space: nowrap; }
table.stbl td { padding: 13px 16px; border-top: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
table.stbl tbody tr:first-child td { border-top: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.rowflex { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* dropdown via <details> */
details.dd { position: relative; }
details.dd > summary { list-style: none; cursor: pointer; }
details.dd > summary::-webkit-details-marker { display: none; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lift); padding: 8px; }
details.dd[open] { z-index: 50; }
details.dd[open] > summary { position: relative; z-index: 51; }
.menu.pad { padding: 14px; }
.menu-head { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 6px 12px 8px; }
.menu button.item, .menu a.item { display: flex; width: 100%; align-items: center; gap: 9px; padding: 10px 12px; border: 0; background: none; color: var(--fg); font-size: 13.5px; font-weight: 600; text-align: left; border-radius: 9px; cursor: pointer; text-decoration: none; }
.menu button.item:hover, .menu a.item:hover { background: var(--surface-2); }

/* modal */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(10,12,21,.5); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; padding: 20px; }
.sheet { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; width: 100%; max-width: 440px; padding: 22px; box-shadow: var(--shadow-lift); max-height: 90vh; overflow-y: auto; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.m-btn { padding: 11px 14px; border-radius: 11px; font-weight: 700; font-size: 14px; cursor: pointer; border: 1px solid var(--border-strong); background: var(--surface); color: var(--fg); }
.m-btn.ghost:hover { background: var(--surface-2); }
.m-btn.solid { background: var(--primary); border-color: var(--primary); color: #fff; }
.m-btn.solid:hover { background: var(--primary-deep); }
.m-btn.del { background: var(--bad); border-color: var(--bad); color: #fff; }

/* choice options (email chooser, etc.) */
.em-opts { display: flex; flex-direction: column; gap: 10px; }
.em-opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 13px; padding: 13px 14px; cursor: pointer; }
.em-opt:hover { border-color: var(--primary); background: var(--surface-2); }
.em-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; }
.em-ic svg { width: 18px; height: 18px; }
.em-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.em-t { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.em-d { font-size: 12.5px; color: var(--muted); }
.em-go { width: 18px; height: 18px; flex: 0 0 auto; }

/* clickable table rows */
.tbl tr.rowlink { cursor: pointer; }
.tbl tr.rowlink:hover { background: var(--surface-2); }

/* night rounds — register rows + In/Not-in toggle */
.reg-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.reg-row:first-child { border-top: 0; }
.reg-flag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--bad); }
.vtoggle { display: inline-flex; gap: 6px; margin-left: auto; }
.vtoggle label { display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: 9px; font-size: 12.5px; font-weight: 700; cursor: pointer; color: var(--muted); }
.vtoggle input { display: none; }
.vtoggle label:has(input[value="in"]:checked) { background: color-mix(in srgb, var(--good) 16%, transparent); border-color: var(--good); color: var(--good); }
.vtoggle label:has(input[value="out"]:checked) { background: color-mix(in srgb, var(--bad) 16%, transparent); border-color: var(--bad); color: var(--bad); }

/* attendance register grid */
.regg { border-collapse: separate; border-spacing: 3px; }
.regg th.dh { font-size: 10px; color: var(--faint); font-weight: 700; text-align: center; min-width: 20px; }
.regg td.rn, .regg th.rn { text-align: left; position: sticky; left: 0; background: var(--surface); padding-right: 12px; white-space: nowrap; }
.regg .cell { display: block; width: 18px; height: 18px; border-radius: 5px; }
.c-present { background: var(--good); } .c-late { background: var(--warn); } .c-absent { background: var(--bad); } .c-leave { background: var(--primary); }
.c-none, .c-awaiting { background: var(--surface-2); border: 1px solid var(--border); }
.reg-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 8px 0 14px; }
.reg-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* property — occupancy bar */
.pbar { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.pbar > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }

/* property — floors → rooms tree */
.tree { padding: 8px; }
.floor { border-radius: 12px; margin-bottom: 6px; }
.floor-row { display: flex; align-items: center; gap: 10px; padding: 11px 12px; cursor: pointer; border-radius: 10px; }
.floor-row:hover { background: var(--surface-2); }
.floor-row .chev { width: 16px; height: 16px; color: var(--faint); transition: transform .18s ease; flex: 0 0 auto; }
.floor.open .floor-row .chev { transform: rotate(90deg); }
.floor-row .fi { width: 30px; height: 30px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-deep); display: grid; place-items: center; flex: 0 0 auto; }
.floor-row .fi svg { width: 16px; height: 16px; }
.floor-row .ft { font-weight: 700; font-size: 14px; flex: 1; }
.floor-row .fc { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.icon-edit, .icon-del { border: 0; background: none; cursor: pointer; padding: 5px; border-radius: 8px; color: var(--faint); display: inline-grid; place-items: center; flex: 0 0 auto; }
.icon-edit svg, .icon-del svg { width: 16px; height: 16px; }
.icon-edit:hover { background: var(--surface-2); color: var(--fg); }
.icon-del:hover { background: var(--bad-soft); color: var(--bad-ink); }
.rooms { display: none; padding: 2px 6px 8px 20px; flex-direction: column; gap: 3px; }
.floor.open .rooms { display: flex; }
.room-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px; cursor: pointer; border: 1px solid transparent; text-decoration: none; color: var(--fg); }
.room-row:hover { background: var(--surface-2); }
.room-row.sel { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.room-row .rt { font-weight: 600; font-size: 13.5px; flex: 1; }
.room-row .occ { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.occ.full { background: var(--good-soft); color: var(--good-ink); }
.occ.part { background: var(--warn-soft); color: var(--warn-ink); }
.occ.empty { background: var(--surface-2); color: var(--muted); }
.addrow { display: flex; padding: 6px 8px; }
.add-link { border: 0; background: none; color: var(--primary-deep); font-weight: 700; font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 6px; border-radius: 8px; text-decoration: none; }
.add-link:hover { background: var(--surface-2); }
.add-link svg { width: 14px; height: 14px; }

/* property — room detail */
.detail-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.detail-head .rt { font-size: 17px; font-weight: 800; }
.detail-head .path { font-size: 12.5px; color: var(--muted); }
.beds { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 18px; }
.bed { border: 1px solid var(--border); border-radius: 13px; padding: 14px; display: flex; align-items: center; gap: 12px; }
.bed.vacant { border-style: dashed; border-color: var(--border-strong); background: var(--surface-2); }
.bed .bl { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; flex: 0 0 auto; }
.bed .bl.occ { background: linear-gradient(135deg, #8b5cf6, #4f46e5); color: #fff; }
.bed .bl.vac { background: var(--surface); border: 1px dashed var(--border-strong); color: var(--faint); }
.bed .bi { flex: 1; min-width: 0; }
.bed .bi .bt2 { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 700; }
.bed .bi .nm { font-size: 14px; font-weight: 700; }
.bed .bi .nm.vac { color: var(--muted); font-weight: 600; }
.bed form { margin: 0; }
.detail-empty { padding: 60px 24px; text-align: center; color: var(--muted); }
.detail-empty svg { width: 40px; height: 40px; color: var(--faint); margin-bottom: 12px; }
.del-room:hover { border-color: var(--bad); color: var(--bad-ink); }

.flow { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--muted); padding: 12px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.flow .step { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); padding: 4px 10px; border-radius: 999px; }
.flow svg { width: 13px; height: 13px; color: var(--faint); }

/* meals — planner controls + headcount split */
.mp-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.split .v { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.split .k { font-size: 11.5px; color: var(--muted); font-weight: 600; }

/* ---- mobile portal frame ---- */
.phone { max-width: 460px; margin: 0 auto; min-height: 100dvh; background: var(--app); display: flex; flex-direction: column; }
.phone-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: color-mix(in srgb, var(--app) 90%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.phone-body { flex: 1; padding: 16px 16px 96px; }
.tabbar { position: sticky; bottom: 0; display: grid; grid-template-columns: repeat(var(--tabs, 5), 1fr); border-top: 1px solid var(--border); background: var(--surface); padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px)); }
.tab { border: 0; background: transparent; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 2px; color: var(--faint); border-radius: 12px; text-decoration: none; }
.tab svg { width: 23px; height: 23px; }
.tab .lb { font-size: 10.5px; font-weight: 700; }
.tab.active { color: var(--primary); }
.tab .dot { position: absolute; }

/* auth */
.auth-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; background:
  radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--primary) 12%, transparent), transparent), var(--app); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-lift); padding: 30px 28px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--border); }

[hidden] { display: none !important; }
