/* ============================================================
   Hostelity components — layered on styles.css (the shared design
   system carried over from FileIt). Uses only the theme tokens
   (--card, --line, --bg, --ink, --muted, --accent, --navy-*), so
   every component follows dark mode automatically.
   ============================================================ */

:root {
  --ok: #0d7a56;  --ok-bg: #e2f5ec;
  --warn: #96700e; --warn-tint: #fdf3dc;
  --info-bg: #ebeaf8;
  --danger-bg: #fdeceb;
  --bed-vacant: #009c99; --bed-occupied: #1d14a0; --bed-reserved: #e0a100; --bed-oos: #9aa4b2;
}
:root[data-theme="dark"] {
  --ok: #5fd3a6;  --ok-bg: rgba(46,180,130,.16);
  --warn: #f1c46b; --warn-tint: rgba(241,196,107,.14);
  --info-bg: rgba(106, 98, 240,.16);
  --danger-bg: rgba(239,123,112,.15);
  --bed-vacant: #2fd3cf; --bed-occupied: #6a62f0; --bed-reserved: #fdba1b; --bed-oos: #5d6a7b;
  /* Hover / selected tints were only defined for light, so dark fell back to
     near-white behind light text (CR #344271). */
  --hover: rgba(255, 255, 255, .07); --accent-soft: rgba(106, 98, 240, .20); --accent-line: rgba(106, 98, 240, .45);
}

/* ---------- sidebar extras ---------- */
.hx-biz { display: flex; align-items: center; gap: 9px; margin: -8px 4px 12px; padding: 8px 12px; border-radius: 9px;
  background: var(--bg); border: 1px solid var(--line); font-size: .82rem; font-weight: 600; color: var(--navy-900); }
.hx-biz span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hx-biz i { color: var(--accent); }
.side-nav-label { padding: 12px 12px 4px; }
@media (max-width: 820px) { .hx-biz { display: none; } }
.hx-impersonate { background: #fff5d6; color: #6b4e00; border-bottom: 1px solid #eedb9c; padding: 9px 44px; font-size: .9rem; }
.hx-impersonate a { font-weight: 700; margin-inline-start: 8px; }
[data-theme="dark"] .hx-impersonate { background: #2b2617; color: #f1d58b; border-color: #4a3f1f; }

/* ---------- page head ---------- */
.page-head .hx-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.page-head .crumbs a { color: var(--muted); }
.btn i { margin-inline-end: 4px; }
.btn-light { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); }
.btn-light:hover { border-color: #cbc9e1; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-xs { padding: 3px 10px; font-size: .78rem; border-radius: 7px; }

/* ---------- status pills ---------- */
.st { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: .76rem;
  font-weight: 650; line-height: 1.6; white-space: nowrap; }
.st i { font-size: .68rem; }
.st-ok { background: var(--ok-bg); color: var(--ok); }
.st-warn { background: var(--warn-tint); color: var(--warn); }
.st-danger { background: var(--danger-bg); color: var(--danger); }
.st-info { background: var(--info-bg); color: var(--accent); }
.st-muted { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.st-accent { background: var(--accent); color: #fff; }

/* ---------- filter toolbar + tabs ---------- */
.hx-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.hx-toolbar input, .hx-toolbar select { padding: 8px 11px; border: 1.5px solid var(--line); border-radius: 9px; font: inherit;
  font-size: .9rem; background: var(--card); color: var(--ink); min-width: 0; }
.hx-toolbar input[type=search] { min-width: 230px; flex: 0 1 300px; }
/* Filters in a panel head (check-in → Bed). Padded here because styles.css's "*" reset
   wipes base.css's field padding, which put the text under the dropdown arrow. */
.hx-panel-head:has(.hx-head-filters) { flex-wrap: wrap; }
.hx-head-filters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-inline-start: auto; }
.hx-head-filters select, .hx-head-filters input { padding: 8px 11px; border: 1.5px solid var(--line); border-radius: 9px;
  font: inherit; font-size: .9rem; background-color: var(--card); color: var(--ink); min-height: 38px; flex: 0 0 auto; }
.hx-head-filters select { padding-inline-end: 34px; max-width: 240px; text-overflow: ellipsis; }
.hx-head-filters input[type=search] { width: 190px; }
@media (max-width: 640px) { .hx-head-filters { width: 100%; justify-content: stretch; }
  .hx-head-filters select, .hx-head-filters input[type=search] { flex: 1 1 140px; max-width: none; width: auto; } }
.hx-toolbar .grow { flex: 1; }
.hx-toolbar label.inline { font-size: .82rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.hx-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 11px; background: var(--card);
  border: 1px solid var(--line); margin-bottom: 16px; }
.hx-tab { padding: 6px 14px; border-radius: 8px; font-size: .88rem; font-weight: 600; color: var(--muted); }
.hx-tab:hover { color: var(--navy-900); text-decoration: none; background: var(--bg); }
.hx-tab.on { background: var(--accent); color: #fff; }
.hx-count { display: inline-block; min-width: 20px; padding: 0 6px; margin-inline-start: 4px; border-radius: 999px;
  background: rgba(0,0,0,.07); font-size: .74rem; text-align: center; }
.hx-tab.on .hx-count { background: rgba(255,255,255,.25); }
.hx-head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- panels ---------- */
.hx-panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 20px; overflow: hidden; }
.hx-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px;
  border-bottom: 1px solid var(--line); }
.hx-panel-head h3 { font-size: 1rem; color: var(--navy-900); display: flex; align-items: center; gap: 9px; }
.hx-panel-head h3 i { color: var(--accent); }
.hx-panel-head .muted a { font-weight: 600; }
.hx-panel-body { padding: 16px 18px; }
.hx-panel .table { box-shadow: none; border-radius: 0; background: transparent; }
.hx-panel .table th { background: transparent; }
.hx-panel-empty { padding: 26px 18px; text-align: center; color: var(--muted); font-size: .9rem; }
.hx-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.hx-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.hx-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .hx-split, .hx-grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 820px) { .hx-grid-2 { grid-template-columns: 1fr; } }

/* ---------- tables ---------- */
.table .num, .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.actions { text-align: end; white-space: nowrap; width: 1%; }
.table td .sub { display: block; font-size: .78rem; color: var(--muted); }
.table tr.is-dim td { opacity: .6; }
.table tfoot td { font-weight: 700; background: var(--bg); border-top: 1px solid var(--line); }
.table a.strong { font-weight: 650; color: var(--navy-900); }
.hx-table-wrap { overflow-x: auto; border-radius: var(--radius); }
.hx-table-wrap > .table { min-width: 640px; }

/* ---------- key-value lists ---------- */
.hx-kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 9px 14px; font-size: .9rem; }
.hx-kv dt { color: var(--muted); }
.hx-kv dd { color: var(--ink); font-weight: 550; word-break: break-word; }

/* ---------- people bits ---------- */
.hx-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--info-bg); color: var(--accent); display: inline-flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; flex-shrink: 0; }
.hx-avatar.lg { width: 64px; height: 64px; font-size: 1.3rem; }
.hx-avatar.f { background: #fbe9f2; color: #b03a76; }
[data-theme="dark"] .hx-avatar.f { background: rgba(214,96,156,.16); color: #f19cc6; }
.hx-who { display: flex; align-items: center; gap: 11px; min-width: 0; }
.hx-who b { display: block; color: var(--navy-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hx-who > div > span { display: block; font-size: .78rem; color: var(--muted); }   /* not the avatar, a span too (CR #601430) */
.hx-profile-head { display: flex; align-items: center; gap: 18px; }
.hx-profile-head h1 { margin-bottom: 4px; }

/* ---------- list rows ---------- */
.hx-list { list-style: none; }
.hx-list li { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.hx-list li:last-child { border-bottom: none; }
.hx-list .grow { flex: 1; min-width: 0; }
.hx-list .meta { font-size: .8rem; color: var(--muted); }

/* ---------- meters ---------- */
.hx-meter { height: 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.hx-meter > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.hx-meter.ok > span { background: var(--bed-vacant); }
.hx-meter.warn > span { background: var(--bed-reserved); }
.hx-stack { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--bg); }
.hx-stack span { display: block; height: 100%; }
.hx-stack .occ { background: var(--bed-occupied); }
.hx-stack .res { background: var(--bed-reserved); }
.hx-stack .vac { background: var(--bed-vacant); opacity: .45; }

/* ---------- hostel cards ---------- */
.hx-hostels { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.hx-hostel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex;
  flex-direction: column; gap: 14px; transition: box-shadow .15s, transform .15s; color: inherit; }
a.hx-hostel:hover { text-decoration: none; box-shadow: 0 10px 26px rgba(12, 8, 72,.10); transform: translateY(-2px); }
.hx-hostel-top { display: flex; gap: 12px; align-items: flex-start; }
.hx-hostel-ic { width: 44px; height: 44px; border-radius: 12px; background: var(--info-bg); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.hx-hostel h3 { font-size: 1.05rem; color: var(--navy-900); }
.hx-hostel-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.hx-hostel-nums b { display: block; font-size: 1.15rem; color: var(--navy-900); }
.hx-hostel-nums span { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- bed board ---------- */
.bb-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .82rem; color: var(--muted); align-items: center; }
.bb-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-inline-end: 5px; vertical-align: -1px; }
.bb-legend .vacant { border: 2px solid var(--bed-vacant); }
.bb-legend .occupied { background: var(--bed-occupied); }
.bb-legend .reserved { background: var(--bed-reserved); }
.bb-legend .oos { background: repeating-linear-gradient(45deg, var(--bed-oos) 0 3px, transparent 3px 6px); border: 1px solid var(--bed-oos); }
.bb-group { margin-bottom: 26px; }
.bb-group-title { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
  margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.bb-group-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.bb-rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 12px; }
.bb-room { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px 12px; }
.bb-room.is-maint { background: repeating-linear-gradient(135deg, var(--card) 0 10px, var(--bg) 10px 20px); }
.bb-room-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 9px; }
.bb-room-head a { font-weight: 750; color: var(--navy-900); font-size: .98rem; }
.bb-room-head span { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.bb-beds { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
.bb-bed { display: flex; flex-direction: column; gap: 1px; padding: 6px 8px; border-radius: 8px; font-size: .74rem; line-height: 1.25;
  border: 2px solid transparent; min-height: 44px; text-align: start; color: inherit; cursor: pointer; background: none; font-family: inherit; }
.bb-bed:hover { text-decoration: none; filter: brightness(1.04); transform: translateY(-1px); }
.bb-bed b { font-size: .78rem; }
.bb-bed span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bb-bed.vacant { border-color: var(--bed-vacant); color: var(--bed-vacant); background: color-mix(in srgb, var(--bed-vacant) 8%, transparent); }
.bb-bed.occupied { background: var(--bed-occupied); color: #fff; }
.bb-bed.reserved { background: var(--bed-reserved); color: #3d2a00; }      /* dark text on yellow: readable (CR #344271) */
.bb-bed.oos { background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--bed-oos) 30%, transparent) 0 4px, transparent 4px 8px);
  border-color: var(--bed-oos); color: var(--muted); cursor: default; }
.bb-totals { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- forms in modals & pages ---------- */
.modal-form.wide { width: min(760px, 100%); }
.modal-form.mid { width: min(580px, 100%); }
.modal-form .hx-modal-sub { margin: -10px 0 16px; color: var(--muted); font-size: .88rem; }
.modal-form .hx-form-actions, .hx-form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.field-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.hx-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.hx-form-grid .wide { grid-column: 1 / -1; }
@media (max-width: 620px) { .hx-form-grid, .field-grid-3, .modal-form .field-grid { grid-template-columns: 1fr; } }
.hx-checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.hx-checks label { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; font-size: .88rem; color: var(--ink); cursor: pointer; }
.hx-checks input { width: auto; }
.hx-check-row { display: flex; align-items: center; gap: 9px; margin: 6px 0 12px; font-size: .9rem; cursor: pointer; }
.hx-check-row input { width: auto; }
.hx-attach { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: .9rem; text-decoration: none; color: inherit; }
.hx-attach .fa-file-pdf { color: #d9473f; font-size: 1.1rem; }
.hx-attach:hover { border-color: var(--accent, #1d14a0); }
.field select, .field input, .field textarea { color: var(--ink); }
.hx-section-title { font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
  margin: 18px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.hx-radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 14px; }
.hx-radio-cards label { border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; font-size: .86rem; }
.hx-radio-cards label b { display: block; color: var(--navy-900); font-size: .9rem; }
.hx-radio-cards label span { color: var(--muted); font-size: .78rem; }
.hx-radio-cards input { display: none; }
.hx-radio-cards label:has(input:checked) { border-color: var(--accent); background: var(--info-bg); }

/* resident type-ahead */
.hx-lookup { position: relative; }
.hx-lookup-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 14px 34px rgba(12, 8, 72,.18); padding: 5px; max-height: 280px; overflow-y: auto; }
.hx-lookup-item { display: block; width: 100%; text-align: start; border: 0; background: none; padding: 8px 10px; border-radius: 7px;
  cursor: pointer; font: inherit; color: var(--ink); }
.hx-lookup-item:hover { background: var(--bg); }
.hx-lookup-item b { display: block; font-size: .9rem; }
.hx-lookup-item span { font-size: .78rem; color: var(--muted); }
.hx-lookup-empty { padding: 10px; font-size: .85rem; color: var(--muted); }
.hx-lookup.has-value input[type=search] { border-color: var(--ok); }
[data-theme="dark"] .hx-lookup-list { background: #1f1d33; }

/* bed picker (check-in, transfer) */
.hx-bedpick { max-height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.hx-bedpick label { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: .9rem; }
.hx-bedpick label:last-child { border-bottom: none; }
.hx-bedpick label:hover { background: var(--bg); }
.hx-bedpick label:has(input:checked) { background: var(--info-bg); }
.hx-bedpick input { width: auto; }
.hx-bedpick .grow { flex: 1; }
.hx-bedpick .meta { color: var(--muted); font-size: .8rem; }

/* invoice lines editor */
.hx-lines { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.hx-lines th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: start; padding: 6px 4px; }
.hx-lines td { padding: 4px; }
.hx-lines input { width: 100%; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 8px; font: inherit; background: var(--card); color: var(--ink); }
.hx-lines .qty { width: 80px; } .hx-lines .amt { width: 140px; } .hx-lines .x { width: 36px; }

/* ---------- invoice / receipt document ---------- */
.hx-doc { background: #fff; color: #211f3a; border: 1px solid var(--line); border-radius: 14px; padding: 38px 40px; max-width: 860px;
  box-shadow: var(--shadow); }
[data-theme="dark"] .hx-doc { background: #fff; color: #211f3a; }
.hx-doc h1, .hx-doc h2, .hx-doc h3 { color: #0c0848; }
.hx-doc-top { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 26px; flex-wrap: wrap; }
.hx-doc-brand b { display: block; font-size: 1.25rem; color: #0c0848; }
.hx-doc-brand span { display: block; font-size: .85rem; color: #5d5b78; }
.hx-doc-title { text-align: end; }
.hx-doc-title h2 { font-size: 1.6rem; letter-spacing: .04em; text-transform: uppercase; }
.hx-doc-title span { display: block; font-size: .88rem; color: #5d5b78; }
.hx-doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 26px; font-size: .9rem; }
.hx-doc-parties h4 { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #8a94a6; margin-bottom: 6px; }
.hx-doc table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.hx-doc th { text-align: start; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: #8a94a6;
  border-bottom: 2px solid #e6e4ef; padding: 9px 6px; }
.hx-doc td { padding: 10px 6px; border-bottom: 1px solid #efeef6; }
.hx-doc th.num, .hx-doc td.num { text-align: end; }      /* headings sit over their numbers (CR #213802) */
.hx-doc .totals { margin-top: 14px; margin-inline-start: auto; width: min(320px, 100%); font-size: .92rem; }
.hx-doc .totals div { display: flex; justify-content: space-between; padding: 6px 6px; }
.hx-doc .totals .grand { border-top: 2px solid #0c0848; font-weight: 800; font-size: 1.05rem; margin-top: 4px; padding-top: 10px; }
.hx-doc .stamp { display: inline-block; border: 2.5px solid currentColor; border-radius: 8px; padding: 4px 14px; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase; transform: rotate(-6deg); }
.hx-doc .stamp.paid { color: #009c99; } .hx-doc .stamp.due { color: #c0392b; } .hx-doc .stamp.void { color: #8a94a6; }
.hx-doc-foot { margin-top: 30px; padding-top: 16px; border-top: 1px solid #efeef6; font-size: .82rem; color: #5d5b78; white-space: pre-wrap; }

/* ---------- activity timeline ---------- */
.hx-feed { list-style: none; }
.hx-feed li { display: flex; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); font-size: .88rem; }
.hx-feed li:last-child { border-bottom: none; }
.hx-feed .dot { width: 30px; height: 30px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: .8rem; }
.hx-feed .grow { flex: 1; min-width: 0; }
.hx-feed .meta { font-size: .76rem; color: var(--muted); }

/* ---------- notices ---------- */
.hx-notice { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin-bottom: 14px; }
.hx-notice.pinned { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.hx-notice h3 { color: var(--navy-900); font-size: 1.02rem; display: flex; gap: 8px; align-items: center; }
.hx-notice p { white-space: pre-wrap; margin-top: 6px; font-size: .92rem; }
.hx-notice .meta { font-size: .78rem; color: var(--muted); margin-top: 10px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* ---------- charts ---------- */
.hx-chart { position: relative; height: 260px; }

/* ---------- reports ---------- */
.hx-report-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.hx-report-card { display: flex; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px;
  color: inherit; transition: box-shadow .15s, transform .15s; }
.hx-report-card:hover { text-decoration: none; box-shadow: 0 10px 26px rgba(12, 8, 72,.10); transform: translateY(-2px); }
.hx-report-card h3 { font-size: 1rem; color: var(--navy-900); margin-bottom: 4px; }
.hx-report-card p { font-size: .86rem; color: var(--muted); }

/* ---------- empty states ---------- */
.hx-empty h3 { color: var(--navy-900); margin-bottom: 6px; }
.hx-empty p { max-width: 460px; margin: 0 auto 16px; }

/* ============================================================
   Public site additions
   ============================================================ */
.hx-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 40px; align-items: center; max-width: 1240px; }
.hx-hero-grid { position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(80% 70% at 70% 40%, #000 30%, transparent 75%); }
.hx-hero-visual { position: relative; }
.hx-mock { background: rgba(255,255,255,.97); color: #1f1d3a; border-radius: 18px; padding: 14px 16px 18px; box-shadow: 0 40px 90px rgba(0,0,0,.45);
  transform: perspective(1400px) rotateY(-8deg) rotateX(4deg); }
.hx-mock-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.hx-mock-room { border: 1px solid #e7e6f2; border-radius: 10px; padding: 8px 10px; font-size: .78rem; }
.hx-mock-room b { display: block; margin-bottom: 6px; color: #0c0848; }
.hx-mock-room div { display: flex; gap: 6px; }
.hx-mock-bed { display: inline-block; width: 28px; height: 20px; border-radius: 6px; }
.hx-mock-bed.occ { background: #1d14a0; }
.hx-mock-bed.vac { border: 2px solid #009c99; }
.hx-mock-bed.res { background: #e0a100; }
.hx-mock-bed.oos { background: repeating-linear-gradient(45deg, #c4ccd6 0 3px, transparent 3px 6px); border: 1px solid #b6c0cc; }
.hx-mock-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hx-mock-stats div { background: #f4f4fb; border-radius: 10px; padding: 9px 10px; }
.hx-mock-stats b { display: block; color: #0c0848; font-size: 1.02rem; }
.hx-mock-stats span { font-size: .72rem; color: #6b7686; }
@media (max-width: 980px) { .hx-hero { grid-template-columns: 1fr; } .hx-hero-visual { display: none; } }
.hx-feature-board { display: grid; grid-template-columns: repeat(6, 34px); gap: 8px; margin-bottom: 18px; }
.hx-feature-board .hx-mock-bed { width: 34px; height: 24px; }
.hx-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.hx-steps .hp-num { display: inline-block; font-weight: 800; color: var(--accent); margin-bottom: 8px; }
@media (max-width: 860px) { .hx-steps { grid-template-columns: 1fr; } }
.hx-prose { max-width: 760px; }
.hx-prose h2 { font-size: 1.2rem; color: var(--navy-900); margin: 26px 0 8px; }
.hx-prose p { margin-top: 12px; color: var(--ink); }
.hx-contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.hx-contact-list { list-style: none; margin-top: 22px; display: grid; gap: 10px; }
.hx-contact-list i { color: var(--accent); margin-inline-end: 8px; }
@media (max-width: 860px) { .hx-contact { grid-template-columns: 1fr; } }
.auth-legal { font-size: .8rem; color: var(--muted); margin-top: 14px; text-align: center; }

/* ============================================================
   Print — invoices, receipts, reports
   ============================================================ */
@media print {
  @page { margin: 14mm; }
  body.app { background: #fff; }
  .app-sidebar, .no-print, .page-head .hx-actions, .hx-impersonate, .app-toast-wrap, .hx-toolbar, .hx-tabs { display: none !important; }
  .app-main { margin: 0 !important; }
  body.app .container { padding: 0 !important; }
  .hx-doc { border: none; box-shadow: none; padding: 0; max-width: none; }
  .hx-panel, .table { box-shadow: none !important; }
  a { color: inherit; }
}

/* Sidebar logo: a light and a dark variant instead of FileIt's inverted PNG. */
.side-logo img { filter: none !important; }
.side-logo .logo-dark { display: none; }
[data-theme="dark"] .side-logo .logo-light { display: none; }
[data-theme="dark"] .side-logo .logo-dark { display: block; }
.stat-cards { grid-template-columns: repeat(auto-fit, minmax(134px, 1fr)); }
.nav-logo-full { filter: none !important; }
/* The script wordmark carries more air (sparks, the y's tail) than the old one, so it sits a touch taller. */
.side-logo .logo-light, .side-logo .logo-dark { height: 40px; }
/* Desktop sidebar: the wordmark 20% larger (48px) and centred over the menu. */
@media (min-width: 821px) {
  .side-top .side-logo { justify-content: center; padding-inline: 0; }
  .side-logo .logo-light, .side-logo .logo-dark { height: 48px; }
}
.table td.nowrap { white-space: nowrap; }
.hx-panel .table td, .hx-panel .table th { padding-inline: 12px; }

/* ---------- sidebar hostel switcher (ADR-0008) ---------- */
.hx-switch { position: relative; margin: -8px 0 12px; }
.hx-switch > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); cursor: pointer; user-select: none; }
.hx-switch > summary::-webkit-details-marker { display: none; }
.hx-switch > summary:hover { border-color: #cbc9e1; }
.hx-switch.is-scoped > summary { border-color: var(--accent); background: var(--info-bg); }
.hx-switch-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--card); color: var(--accent); display: inline-flex;
  align-items: center; justify-content: center; flex-shrink: 0; border: 1px solid var(--line); }
.hx-switch-txt { flex: 1; min-width: 0; line-height: 1.2; }
.hx-switch-txt small { display: block; font-size: .68rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hx-switch-txt b { display: block; font-size: .86rem; color: var(--navy-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hx-switch-caret { font-size: .7rem; color: var(--muted); }
.hx-switch[open] .hx-switch-caret { transform: rotate(180deg); }
.hx-switch-menu { position: absolute; z-index: 70; left: 0; right: 0; top: calc(100% + 6px); background: var(--card); border: 1px solid var(--line);
  border-radius: 11px; box-shadow: 0 14px 34px rgba(12, 8, 72,.2); padding: 6px; max-height: 60vh; overflow-y: auto; }
.hx-switch-menu a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--ink); font-size: .88rem; }
.hx-switch-menu a span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hx-switch-menu a:hover { background: var(--bg); text-decoration: none; }
.hx-switch-menu a.on { color: var(--accent); font-weight: 650; }
.hx-switch-menu a > i:first-child { width: 16px; text-align: center; color: var(--muted); }
.hx-switch-menu a .fa-check { color: var(--accent); font-size: .78rem; }
.hx-switch-sep { height: 1px; background: var(--line); margin: 5px 4px; }
[data-theme="dark"] .hx-switch-menu { background: #1f1d33; }
@media (max-width: 820px) { .hx-switch { margin: 0 8px; } .hx-switch-txt small { display: none; } .hx-switch-menu { min-width: 240px; } }
.hx-scope-note { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--accent); background: var(--info-bg);
  padding: 2px 10px; border-radius: 999px; }
.hx-scope-bar { display: flex; align-items: center; gap: 8px; padding: 8px 44px; font-size: .86rem; color: var(--accent-dark);
  background: var(--info-bg); border-bottom: 1px solid var(--line); }
.hx-scope-bar a { margin-inline-start: auto; font-weight: 650; }
@media (max-width: 820px) { .hx-scope-bar { padding: 8px 16px; } }
.hx-kv-src dd { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kebab-menu a.kebab-link { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 7px; font-size: .88rem; color: var(--ink); }

/* ---------- row menus (⋮ + right-click) ---------- */
.table td.row-menu { width: 1%; padding-top: 4px; padding-bottom: 4px; text-align: end; }
.kebab-menu a.danger, .kebab-menu a.danger i { color: #c22f42; }
.kebab-menu .ctx-sep { margin: 5px 4px; }
[data-theme="dark"] .kebab-menu a:hover, [data-theme="dark"] .kebab-menu button:hover { background: rgba(255,255,255,.06); }
[data-theme="dark"] .kebab > summary:hover { background: rgba(255,255,255,.08); }
tr:has(details.kebab[open]) > td { background: var(--info-bg); }
.rep-table td.row-menu { width: 1%; padding: 2px 8px; text-align: end; }

/* ---------- section pages with a secondary left nav (Financials, Operations) ---------- */
.hx-section { display: grid; grid-template-columns: 214px minmax(0, 1fr); align-items: start; }
.hx-subnav { position: sticky; top: 0; padding: 34px 0 20px 30px; }
.hx-subnav-title { display: flex; align-items: center; gap: 9px; font-size: .74rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); padding: 6px 12px 10px; }
.hx-subnav-title i { color: var(--accent); }
body.app .hx-section-main > .container { padding-inline-start: 30px; }
@media (max-width: 980px) {
  .hx-section { grid-template-columns: 1fr; }
  .hx-subnav { position: static; padding: 16px 16px 0; display: flex; flex-wrap: wrap; gap: 6px; }
  .hx-subnav-title { width: 100%; padding-bottom: 4px; }
  body.app .hx-section-main > .container { padding-inline-start: 16px; }
}

/* Wide admin tables scroll sideways inside the content column (menus are fixed, so never clipped). */
.admin-content { min-width: 0; }
.hx-admin-scroll { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.hx-admin-scroll > .admin-table { box-shadow: none; }
.hx-admin-scroll .admin-table td, .hx-admin-scroll .admin-table th { white-space: nowrap; }
.admin-table td:has(.stor-cell) { min-width: 150px; }
/* Codes and numbers never break across lines. */
.table td > a.strong:first-child { white-space: nowrap; }
/* The ⋮ column stays pinned to the right edge while a wide admin table scrolls. */
.hx-admin-scroll .admin-table td.admin-actions,
.hx-admin-scroll .admin-table tr > th:last-child { position: sticky; right: 0; background: var(--card); box-shadow: -8px 0 10px -8px rgba(12, 8, 72,.18); }
.hx-admin-scroll .admin-table tr > th:last-child { background: #fbfbfe; }
[data-theme="dark"] .hx-admin-scroll .admin-table tr > th:last-child { background: var(--card); }
.hx-admin-scroll .admin-table td.admin-actions:has(details.kebab[open]) { z-index: 50; }

/* ---------- Residents (FileIt's People page) ---------- */
.person-avatar.is-f { background: #fbe9f2; color: #b03a76; }
[data-theme="dark"] .person-avatar.is-f { background: rgba(214,96,156,.18); color: #f19cc6; }
.person-card .badge { white-space: nowrap; }
.person-card.menu-open, .person-card.menu-open .person-menu { z-index: 60; }
.person-card.menu-open { position: relative; }
.bb-ac { color: #00a3a0; font-size: .78em; }
[data-theme="dark"] .bb-ac { color: #2fd3cf; }
.stay-money { margin-top: 6px; }
.people-grid.is-list .stay-card .stay-money { margin: 0; }

/* ============================================================
   Sidebar: common search, collapse to an icon rail, collapsible groups.
   The collapse control is HireSide's: a round arrow on the separator line.
   ============================================================ */
.side-top { display: flex; align-items: center; }
.side-top .side-logo { flex: 1; min-width: 0; }
.side-logo .logo-mark { display: none; height: 36px; width: 36px; }
.side-toggle { display: none; }
.side-tip { position: fixed; z-index: 500; transform: translateY(-50%); pointer-events: none; white-space: nowrap;
  background: #17143a; color: #fff; font-size: .8rem; font-weight: 600; line-height: 1.3; padding: 6px 10px;
  border-radius: 7px; box-shadow: 0 6px 18px rgba(12, 8, 72, .25); }
[data-theme="dark"] .side-tip { background: #2e2b52; border: 1px solid rgba(255, 255, 255, .1); }
/* search sits right under the hostel switcher */
.app-sidebar .side-search { margin: 0 0 12px; position: relative; }
/* A clean text box (CR #670032): no icon unless the sidebar is collapsed. Font Awesome
   swaps the <i> for an <svg> at runtime, so both are matched. */
.app-sidebar .side-search > i, .app-sidebar .side-search > svg { display: none; }
.side-collapsed .app-sidebar .side-search > i, .side-collapsed .app-sidebar .side-search > svg { display: inline-block; }
/* Searches whose wrapper draws the box: the field itself gets no focus ring of its own,
   or a box shows inside the box (CR #405068). The wrapper shows focus instead. */
.side-search input:focus, .people-search input:focus, .admin-search input:focus { box-shadow: none; border: 0; outline: none; }
.side-search-kbd { font-size: .7rem; padding: 0 6px; line-height: 1.5; color: var(--muted); flex-shrink: 0; }
.side-search:focus-within .side-search-kbd { display: none; }
.side-search-results { z-index: 80; }
.ssr-item.is-active { background: var(--info-bg); }
/* groups */
.side-group-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 0; background: none;
  cursor: pointer; font-family: inherit; font-size: .68rem; font-weight: 400; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); text-align: start; border-radius: 6px; padding: 12px 12px 4px; line-height: 1.6; }
.side-group-toggle:hover { color: var(--ink); }
.side-group-toggle i, .side-group-toggle svg { font-size: .6rem; width: .6rem; transition: transform .15s; opacity: .7; }
.side-group.is-closed .side-group-toggle i, .side-group.is-closed .side-group-toggle svg { transform: rotate(-90deg); }
.side-group-items { display: flex; flex-direction: column; gap: 3px; }
.side-group.is-closed .side-group-items { display: none; }

@media (min-width: 821px) {
  .app-sidebar { transition: width .18s ease, padding .18s ease; }
  .app-main { transition: margin-inline-start .18s ease; }
  /* the arrow on the separator line */
  .side-toggle { display: inline-flex; align-items: center; justify-content: center; position: absolute; z-index: 3;
    top: 30px; inset-inline-end: -13px; width: 26px; height: 26px; padding: 0; border-radius: 50%;
    border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: .66rem; cursor: pointer;
    box-shadow: 0 1px 4px rgba(12, 8, 72, .14); transition: color .12s, border-color .12s; }
  .side-toggle:hover { color: var(--accent); border-color: var(--accent); }
  .side-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .side-toggle-ico { display: inline-flex; transition: transform .18s ease; }
  /* the chevron points at the side the nav folds to: start when open, end when collapsed */
  .side-collapsed .app-sidebar > .side-toggle .side-toggle-ico,
  .subnav-collapsed .subnav-toggle .side-toggle-ico { transform: scaleX(-1); }

  /* the icon rail */
  .side-collapsed .app-sidebar { width: 72px; padding-inline: 12px; }
  .side-collapsed .app-main { margin-inline-start: 72px; }
  .side-collapsed .side-logo { justify-content: center; padding-inline: 0; }
  .side-collapsed .side-logo .logo-light, .side-collapsed .side-logo .logo-dark { display: none !important; }
  .side-collapsed .side-logo .logo-mark { display: block; }
  .side-collapsed .hx-switch > summary { justify-content: center; padding: 6px; }
  .side-collapsed .hx-switch-txt, .side-collapsed .hx-switch-caret { display: none; }
  .side-collapsed .hx-switch-menu { left: 0; right: auto; width: 250px; }
  .side-collapsed .app-sidebar .side-search { justify-content: center; padding: 0; cursor: pointer; height: 38px; }
  .side-collapsed .app-sidebar .side-search input, .side-collapsed .side-search-kbd { display: none; }
  .side-collapsed .side-item { justify-content: center; padding-inline: 0; gap: 0; }
  .side-collapsed .side-item i { font-size: 1.05rem; }
  .side-collapsed .side-item > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .side-collapsed .side-group-toggle { justify-content: center; padding: 8px 0 6px; pointer-events: none; }
  .side-collapsed .side-group-toggle span { display: none; }
  .side-collapsed .side-group-toggle::before { content: ""; display: block; width: 22px; height: 1px; background: var(--line); }
  .side-collapsed .side-group-toggle i, .side-collapsed .side-group-toggle svg { display: none; }
  .side-collapsed .side-group.is-closed .side-group-items { display: flex; }      /* the rail always shows every icon */
  .side-collapsed .user-pill { justify-content: center; padding: 6px 0; }
  .side-collapsed .user-pill-meta, .side-collapsed .user-pill > i, .side-collapsed .user-pill > svg { display: none; }
  .side-collapsed .user-menu { width: 230px; right: auto; }
}
/* the section nav (Financials / Operations): its own separator line and arrow */
@media (min-width: 981px) {
  .hx-subnav { position: sticky; border-inline-end: 1px solid var(--line); min-height: calc(100vh - 40px); padding-inline-end: 18px; }
  .hx-section { transition: grid-template-columns .18s ease; }
  .subnav-toggle { top: 38px; }
  .subnav-collapsed .hx-section { grid-template-columns: 74px minmax(0, 1fr); }
  .subnav-collapsed .hx-subnav { padding-inline: 14px; }
  .subnav-collapsed .hx-subnav-title { justify-content: center; padding-inline: 0; }
  .subnav-collapsed .hx-subnav-title > span { display: none; }
  .subnav-collapsed .hx-subnav .anav { justify-content: center; padding-inline: 0; }
  .subnav-collapsed .hx-subnav .anav span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 980px) { .subnav-toggle { display: none !important; } }
@media (max-width: 820px) { .side-search-kbd { display: none; } .app-sidebar .side-search { display: none; } }
@media (prefers-reduced-motion: reduce) { .app-sidebar, .app-main, .side-toggle-ico, .hx-section { transition: none; } }

/* ---------- resident photos (ADR-0016) ---------- */
.hx-avatar, .person-avatar { overflow: hidden; }
.hx-avatar.has-photo, .person-avatar.has-photo { background: var(--bg); }
.hx-avatar img, .person-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.person-avatar.has-photo { box-shadow: 0 0 0 3px var(--card), 0 0 0 4px var(--line); }
.hx-photo-wrap { position: relative; flex-shrink: 0; }
.hx-photo-btn { position: absolute; right: -2px; bottom: -2px; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--card);
  background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; cursor: pointer; }
.hx-photo-btn:hover { filter: brightness(1.1); }
.hx-cam { position: relative; width: 100%; aspect-ratio: 1 / 1; max-width: 320px; margin: 0 auto 12px; border-radius: 16px; overflow: hidden;
  background: #0c0848; display: flex; align-items: center; justify-content: center; }
.hx-cam video, .hx-cam img, .hx-cam canvas { width: 100%; height: 100%; object-fit: cover; }
.hx-cam video { transform: scaleX(-1); }               /* a mirror, like every selfie camera */
.hx-cam .hx-cam-ring { position: absolute; inset: 14%; border: 2px dashed rgba(255,255,255,.55); border-radius: 50%; pointer-events: none; }
.hx-cam-msg { color: #cac8e2; font-size: .88rem; padding: 18px; text-align: center; }
.hx-photo-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.ssr-item .ssr-photo { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }

/* ---- resident documents (ADR-0017) ---- */
.hx-idcards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hx-idcard { position: relative; aspect-ratio: 85.6 / 54; border-radius: 10px; overflow: hidden; border: 1px solid var(--line);
  background: var(--bg); font: inherit; color: inherit; padding: 0; }
.hx-idcard > a { display: block; width: 100%; height: 100%; }
.hx-idcard img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hx-idcard .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 10px 6px; color: #fff; font-size: .72rem; font-weight: 600;
  background: linear-gradient(transparent, rgba(8, 18, 34, .72)); }
.hx-idcard-pdf { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; font-size: 2rem; color: #c0392b; }
.hx-idcard-pdf svg { width: 2rem; height: 2rem; }
.hx-idcard .kebab { position: absolute; top: 5px; right: 5px; }
.hx-idcard .kebab > summary { width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.92); color: #1f1d3a;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.hx-idcard.is-missing { border: 1.5px dashed var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--muted); font-size: .76rem; text-align: center; }
.hx-idcard.is-missing i, .hx-idcard.is-missing svg { font-size: 1.3rem; width: 1.3rem; height: 1.3rem; margin-bottom: 4px; color: var(--accent); }
.hx-idcard.is-missing b { color: var(--ink); font-size: .8rem; }
button.hx-idcard.is-missing { cursor: pointer; transition: border-color .15s, background .15s; }
button.hx-idcard.is-missing:hover { border-color: var(--accent); background: var(--info-bg); }
.hx-doclist { margin: 12px -18px -16px; border-top: 1px solid var(--line); }
.hx-doc-ico { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: var(--info-bg); color: var(--accent); }
.hx-doc-ico.is-pdf { background: var(--danger-bg); color: var(--danger); }
.hx-doc-missing .hx-doc-ico { background: var(--bg); color: var(--muted); }
.hx-doc-missing .meta { font-style: italic; }
.hx-docdrop { position: relative; min-height: 180px; border: 1.5px dashed var(--line); border-radius: 14px; margin-bottom: 12px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; background: var(--bg); cursor: pointer; transition: border-color .15s, background .15s; }
.hx-docdrop:hover, .hx-docdrop.is-over, .hx-docdrop:focus-visible { border-color: var(--accent); background: var(--info-bg); outline: none; }
.hx-docdrop img, .hx-docdrop video { display: block; max-width: 100%; max-height: 300px; object-fit: contain; }
.hx-docdrop-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 24px; text-align: center; color: var(--muted); font-size: .82rem; }
.hx-docdrop-empty i, .hx-docdrop-empty svg { font-size: 1.8rem; width: 1.8rem; height: 1.8rem; color: var(--accent); margin-bottom: 6px; }
.hx-docdrop-empty b { color: var(--ink); font-size: .92rem; }
.hx-docdrop-pdf { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px; color: var(--ink); font-size: .86rem; word-break: break-all; }
.hx-docdrop-pdf i, .hx-docdrop-pdf svg { font-size: 2.4rem; width: 2.4rem; height: 2.4rem; color: #c0392b; }

/* ---- ID card on the check-in form (ADR-0018) ---- */
.hx-idattach { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.hx-idattach-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.hx-idattach-head b { display: inline-flex; align-items: center; gap: 6px; }
.hx-idattach > p { font-size: .82rem; margin: 0 0 10px; }
.hx-idattach-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 400px; }
.hx-idslot { position: relative; aspect-ratio: 85.6 / 54; border: 1.5px dashed var(--line); border-radius: 10px; overflow: hidden; cursor: pointer;
  display: flex; align-items: center; justify-content: center; background: var(--bg); transition: border-color .15s, background .15s; }
.hx-idslot:hover, .hx-idslot:focus-within { border-color: var(--accent); background: var(--info-bg); }
.hx-idslot input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.hx-idslot-empty { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: .76rem; pointer-events: none; }
.hx-idslot-empty i, .hx-idslot-empty svg { font-size: 1.2rem; width: 1.2rem; height: 1.2rem; color: var(--accent); margin-bottom: 3px; }
.hx-idslot-empty b { color: var(--ink); font-size: .82rem; }
.hx-idslot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.hx-idslot-name { font-size: .78rem; padding: 8px; text-align: center; word-break: break-all; pointer-events: none; }
.hx-idslot.has-file { border-style: solid; border-color: var(--ok); }
.hx-idslot.has-file .hx-idslot-empty { display: none; }

/* Payables aging (ADR-0024): one bar per supplier, current → 90+ days late. */
.hx-aging { display: flex; height: 6px; border-radius: 3px; overflow: hidden; margin-top: 6px; background: var(--line); }
.ag { display: inline-block; }
.ag-0 { background: #857fd6; } .ag-1 { background: #f0b44c; } .ag-2 { background: #e8833a; } .ag-3 { background: #d9573f; } .ag-4 { background: #a8302a; }
.hx-aging-key { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .78rem; color: var(--muted); border-top: 1px solid var(--line); }
.hx-aging-key i.ag { width: 9px; height: 9px; border-radius: 2px; vertical-align: -1px; }
.hx-owe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0; }
.hx-owe { display: block; padding: 12px 16px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.hx-owe:hover { background: var(--hover, #f5f5fc); }
.hx-owe-top { display: flex; justify-content: space-between; gap: 10px; }
.hx-owe .meta { font-size: .8rem; color: var(--muted); margin-top: 6px; }
.hx-panel-head .hx-aging-key { border: 0; padding: 0; }
.hx-owe-top b:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hx-owe-top b:last-child { white-space: nowrap; }

/* ---- Settings page (ADR-0031): a section with the second left nav ---- */
.sp-page { max-width: 860px; }
.sp-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 26px 28px 28px; }
.sp-card > .field, .sp-card #billingForm .field { max-width: 560px; }
.sp-card #billingForm .fields-2 { max-width: 560px; }
.sp-card .photo-row { margin-bottom: 18px; }
@media (max-width: 640px) { .sp-card { padding: 20px 16px; border-radius: 12px; } }

/* Hostel setup flow (ADR-0039): a step bar and the Back / Skip / Next row. */
.hx-steps { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.hx-step { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1.5px solid var(--line);
  border-radius: 999px; background: var(--card); color: var(--muted); font-weight: 600; font-size: .88rem; text-decoration: none; }
.hx-step b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--line);
  color: var(--ink); font-size: .75rem; }
.hx-step.done { color: var(--ok, #0d7a56); border-color: rgba(13, 122, 86, .35); }
.hx-step.done b { background: rgba(13, 122, 86, .14); color: var(--ok, #0d7a56); }
.hx-step.on { color: var(--accent); border-color: var(--accent); background: rgba(29, 20, 160, .06); }
.hx-step.on b { background: var(--accent); color: #fff; }
.hx-step-nav { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 24px; }
.hx-step-nav .grow { flex: 1; }
.hx-step-nav .btn.disabled { pointer-events: none; opacity: .5; }
.hx-cell-input { width: 100%; max-width: 280px; }
.hx-order { display: flex; gap: 4px; }
.hx-order form { display: inline-flex; margin: 0; }
.admin-search:focus-within { border-color: var(--accent); }

/* Date fields (flatpickr, CR #714999): the visible box looks like any other field. */
input.hx-date { cursor: pointer; }
.flatpickr-calendar { font-family: inherit; border-radius: 12px; box-shadow: 0 16px 40px rgba(12, 8, 72, .18); }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: var(--accent); border-color: var(--accent); }
.flatpickr-day.today { border-color: var(--accent); }
:root[data-theme="dark"] .flatpickr-calendar { background: var(--card); color: var(--ink); }
:root[data-theme="dark"] .flatpickr-day { color: var(--ink); }
:root[data-theme="dark"] .flatpickr-months .flatpickr-month, :root[data-theme="dark"] .flatpickr-current-month,
:root[data-theme="dark"] span.flatpickr-weekday { color: var(--ink); fill: var(--ink); background: transparent; }

/* A Filters panel above a list (Expenses, CR #648316). */
.hx-filters { padding: 14px 18px; margin-bottom: 18px; }
.hx-filters-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; color: var(--navy-900); }
.hx-filters-head i { color: var(--accent); }
.hx-filters-head a { font-size: .85rem; font-weight: 600; }
.hx-filters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 14px; }
.hx-filters-grid .field { margin-bottom: 10px; }
.hx-filters-actions { display: flex; justify-content: flex-end; }

/* A required field (CR #524431). */
label .req { color: var(--danger, #c0392b); font-weight: 700; margin-inline-start: 2px; }

/* Cards that filter the list under them (Visitor log, CR #904235): the chosen one is marked. */
.hx-filter-cards { margin-bottom: 16px; }
.hx-filter-cards .stat-card.is-on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft, #ebeaf8); background: rgba(29, 20, 160, .04); }

/* Stat cards everywhere (CR #250273, #980298, #533255): a sensible minimum width, the
   text may shrink inside the card instead of spilling out, and numbers scale with the
   card so "PKR 1,320,000" stays on one line inside it. Money gets its own scale. */
.stat-cards { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat-card { min-width: 0; container-type: inline-size; }
.stat-card > div:last-child { min-width: 0; flex: 1 1 auto; }
.stat-n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: clamp(1.25rem, 13cqi, 1.7rem); }
.stat-n.is-money { font-size: clamp(.98rem, 7.4cqi, 1.45rem); }
.stat-l { overflow-wrap: anywhere; line-height: 1.3; }
.hx-panel .stat-n { font-size: 1.6rem; }                 /* the big totals on the dashboard */
.hx-panel .stat-n.is-money { font-size: clamp(1.2rem, 2.2vw, 1.75rem); }

/* Card rows split evenly by count (CR #250273): 4 → 4 or 2+2, 6 → 6 or 3+3, 8 → 4+4,
   so a row never ends with one card on its own. Measured against the page column. */
.container { container-type: inline-size; container-name: page; }
@container page (min-width: 880px) {
  .stat-cards:has(> :nth-child(4):last-child), .stat-cards:has(> :nth-child(8):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stat-cards:has(> :nth-child(6):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@container page (min-width: 1280px) {
  .stat-cards:has(> :nth-child(6):last-child) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .stat-cards:has(> :nth-child(5):last-child) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@container page (max-width: 879px) {
  .stat-cards:has(> :nth-child(4):last-child), .stat-cards:has(> :nth-child(8):last-child),
  .stat-cards:has(> :nth-child(6):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container page (max-width: 440px) { .stat-cards { grid-template-columns: minmax(0, 1fr) !important; } }

/* Dashboard (CR #438906, #530216): module sections of cards and one card per hostel. */
.hx-dash-head { display: flex; justify-content: flex-end; margin: -8px 0 4px; font-size: .8rem; }
.hx-dash-group { margin-bottom: 18px; }
.hx-dash-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700;
  display: flex; align-items: center; gap: 8px; margin: 0 0 10px; }
.hx-dash-title i { color: var(--accent); }
.hx-dash-group .stat-cards { margin-bottom: 0; }
.hx-flash { animation: hxFlash 1.2s ease-out; }
@keyframes hxFlash { from { color: var(--accent); } to { color: inherit; } }
.hx-hostel-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; padding: 16px 18px; }
.hx-hostel-card { display: block; border: 1px solid var(--line); border-radius: 12px; padding: 14px; color: inherit; text-decoration: none;
  background: var(--card); transition: box-shadow .15s, border-color .15s; min-width: 0; }
.hx-hostel-card:hover { border-color: var(--accent); box-shadow: 0 8px 22px rgba(12, 8, 72, .08); text-decoration: none; }
.hx-hc-name b { display: block; color: var(--navy-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hx-hc-name span { font-size: .8rem; color: var(--muted); }
.hx-hostel-card .hx-stack { margin: 10px 0 4px; }
.hx-hc-pct { font-size: .8rem; color: var(--muted); }
.hx-hc-nums { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin-top: 10px; text-align: center; }
.hx-hc-nums b { display: block; font-size: 1.05rem; color: var(--navy-900); }
.hx-hc-nums span { font-size: .66rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.hx-hc-nums .is-warn b { color: var(--warn, #b0620a); }

/* Back button above each page title (CR #305508). */
.hx-back { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--muted);
  text-decoration: none; margin-bottom: 6px; padding: 2px 8px 2px 4px; border-radius: 8px; }
.hx-back:hover { color: var(--accent); background: var(--accent-soft, #ebeaf8); text-decoration: none; }
@media print { .hx-back { display: none; } }

/* A menu item that can't be used yet, with the reason under it (CR #364317). */
.kebab-link.is-disabled { opacity: .5; cursor: not-allowed; }
.kebab-note { font-size: .78rem; color: var(--muted); padding: 2px 12px 8px 36px; max-width: 260px; line-height: 1.4; }
.kebab-note a { display: inline !important; padding: 0 !important; margin: 0 !important; font-size: inherit; font-weight: 600; color: var(--accent); background: none !important; }

/* Calendar (flatpickr, CR #717323): its month list and year box are not form fields,
   so they keep none of base.css's field look (border, padding, arrow space), and the
   header lines up: ‹ Month Year ›, then the weekdays, then the days. */
.flatpickr-calendar { width: 308px; padding: 8px 8px 10px; border: 1px solid var(--line); }
.flatpickr-calendar.arrowTop::before, .flatpickr-calendar.arrowTop::after { display: none; }
.flatpickr-months { align-items: center; padding: 2px 0 6px; }
.flatpickr-months .flatpickr-month { height: 36px; }
.flatpickr-months .flatpickr-prev-month, .flatpickr-months .flatpickr-next-month { position: static; height: 32px; width: 32px; padding: 8px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.flatpickr-months .flatpickr-prev-month:hover, .flatpickr-months .flatpickr-next-month:hover { background: var(--hover, #f2f1f9); }
.flatpickr-months .flatpickr-prev-month:hover svg, .flatpickr-months .flatpickr-next-month:hover svg { fill: var(--accent); }
.flatpickr-current-month { position: static; width: auto; left: auto; padding: 0; height: 36px; display: flex; align-items: center;
  justify-content: center; gap: 4px; font-size: 1rem; }
.flatpickr-current-month select.flatpickr-monthDropdown-months, .flatpickr-current-month input.cur-year {
  border: 0 !important; box-shadow: none !important; min-height: 0; height: 30px; line-height: 30px; margin: 0;
  padding: 0 6px !important; background: transparent none !important; font: 600 .98rem inherit; color: var(--ink); border-radius: 6px; }
.flatpickr-current-month select.flatpickr-monthDropdown-months { -webkit-appearance: menulist; appearance: menulist; cursor: pointer; }
.flatpickr-current-month select.flatpickr-monthDropdown-months:hover, .flatpickr-current-month .numInputWrapper:hover { background: var(--hover, #f2f1f9) !important; }
.flatpickr-current-month .numInputWrapper { width: 5.2ch; }
.flatpickr-weekdays { height: 30px; }
span.flatpickr-weekday { font-size: .74rem; font-weight: 700; color: var(--muted); }
.flatpickr-days, .dayContainer { width: 292px; min-width: 292px; max-width: 292px; }
.flatpickr-day { max-width: 40px; height: 38px; line-height: 38px; border-radius: 9px; font-size: .88rem; }
.flatpickr-day:hover { background: var(--hover, #f2f1f9); border-color: transparent; }
.flatpickr-day.prevMonthDay, .flatpickr-day.nextMonthDay { color: var(--muted); opacity: .55; }
.flatpickr-day.flatpickr-disabled, .flatpickr-day.flatpickr-disabled:hover { opacity: .3; background: none; }
:root[data-theme="dark"] .flatpickr-calendar { box-shadow: 0 16px 40px rgba(0, 0, 0, .5); }
:root[data-theme="dark"] .flatpickr-months .flatpickr-prev-month svg, :root[data-theme="dark"] .flatpickr-months .flatpickr-next-month svg { fill: var(--ink); }
:root[data-theme="dark"] .flatpickr-day.today { border-color: var(--accent); }
:root[data-theme="dark"] .flatpickr-current-month select.flatpickr-monthDropdown-months option { background: var(--card); color: var(--ink); }
.stat-card.is-on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft, #ebeaf8); }
html { scroll-behavior: smooth; } .hx-panel[id] { scroll-margin-top: 16px; }
