/* ==========================================================================
   Hostel Admin — shared stylesheet
   v3.0 "Neo Glass": Inter type, soft colour-wash canvas with floating blobs,
   frosted glass sidebar/topbar/panels, indigo→cyan gradient accents,
   KPI cards with tinted icons, dot tags. Full dark mode (system or toggle).
   Tokens → base → layout → components → pages. One file, no build step.
   CSP-safe: fonts are self-hosted in shared/fonts, no inline styles needed.
   ========================================================================== */

@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("../fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;

  /* Text */
  --ink: #18181b;
  --ink-2: #3f3f46;
  --ink-3: #71717a;

  /* Surfaces */
  --canvas: #eef1f6;
  --panel: #ffffff;
  --panel-2: rgba(255, 255, 255, .55);
  --glass: rgba(255, 255, 255, .70);
  --glass-strong: rgba(255, 255, 255, .80);
  --glass-edge: rgba(255, 255, 255, .80);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .9);
  --fill: rgba(24, 24, 27, .05);
  --fill-strong: rgba(24, 24, 27, .09);
  --line: rgba(24, 24, 27, .12);
  --line-soft: rgba(24, 24, 27, .07);
  --field: rgba(255, 255, 255, .65);

  /* Accents */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: rgba(79, 70, 229, .12);
  --accent-2: #06b6d4;
  --accent-3: #ec4899;
  --grad: linear-gradient(135deg, #4f46e5, #06b6d4);
  --grad-shadow: 0 8px 20px rgba(79, 70, 229, .35), inset 0 1px 0 rgba(255, 255, 255, .30);
  --brass: #b45309;
  --brass-soft: rgba(245, 158, 11, .15);
  --ok: #059669;   --ok-bg: rgba(16, 185, 129, .13);
  --warn: #d97706; --warn-bg: rgba(245, 158, 11, .15);
  --bad: #dc2626;  --bad-bg: rgba(239, 68, 68, .12);
  --info: #4f46e5; --info-bg: rgba(79, 70, 229, .12);
  --muted: #71717a; --muted-bg: rgba(24, 24, 27, .07);

  /* Chrome */
  --nav: var(--glass);
  --nav-edge: var(--glass-edge);
  --side: var(--glass);
  --side-ink: var(--ink-2);
  --blur: saturate(180%) blur(28px);

  /* Background wash */
  --wash-1: rgba(99, 102, 241, .30);
  --wash-2: rgba(6, 182, 212, .24);
  --wash-3: rgba(236, 72, 153, .22);
  --wash-4: rgba(16, 185, 129, .18);
  --blob-1: rgba(99, 102, 241, .42);
  --blob-2: rgba(6, 182, 212, .34);
  --blob-3: rgba(236, 72, 153, .26);
  --blob-4: rgba(16, 185, 129, .24);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --fs-xs: 0.75rem; --fs-sm: 0.8125rem; --fs-md: 0.875rem; --fs-lg: 0.9375rem;
  --fs-xl: 1.25rem; --fs-2xl: 1.625rem;

  --r-sm: 9px; --r-md: 13px; --r-lg: 20px; --r-xl: 22px; --r-2xl: 26px; --r-pill: 100px;
  --gap: 1.25rem;

  --shadow-1: 0 10px 30px rgba(24, 24, 27, .06);
  --shadow-2: 0 12px 34px rgba(24, 24, 27, .07);
  --shadow-lift: 0 18px 40px rgba(24, 24, 27, .10);
  --shadow-pop: 0 10px 24px rgba(24, 24, 27, .10), 0 30px 70px rgba(24, 24, 27, .18);
  --focus: 0 0 0 4px rgba(79, 70, 229, .18);
  --ease: cubic-bezier(.32, .08, .24, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: var(--fs-md); line-height: 1.5;
  color: var(--ink); background-color: var(--canvas);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; font-weight: 700; letter-spacing: -.02em; }
h1 { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -.03em; }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
p { margin: 0 0 .75rem; }
a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; }
b, strong { font-weight: 700; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--panel); padding: .6rem 1.1rem; border-radius: var(--r-md); box-shadow: var(--shadow-pop); z-index: 100; }
.skip-link:focus { left: 1rem; top: 1rem; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--ink-3); }
.text-bad { color: var(--bad); } .text-ok { color: var(--ok); } .text-warn { color: var(--warn); }
[hidden] { display: none !important; }

/* Colour wash + soft blobs on ONE fixed, GPU-composited layer.
   Radial gradients instead of filter:blur() and no background-attachment:fixed —
   both were the cause of slow scrolling. */
.bg-blobs {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  contain: strict; transform: translateZ(0);
  background:
    radial-gradient(520px 520px at 0% 0%, var(--blob-1), transparent 70%),
    radial-gradient(460px 460px at 100% 18%, var(--blob-2), transparent 70%),
    radial-gradient(500px 500px at 32% 100%, var(--blob-3), transparent 70%),
    radial-gradient(420px 420px at 100% 100%, var(--blob-4), transparent 70%),
    radial-gradient(circle at 8% 12%, var(--wash-1), transparent 40%),
    radial-gradient(circle at 92% 8%, var(--wash-2), transparent 38%),
    radial-gradient(circle at 82% 88%, var(--wash-3), transparent 42%),
    radial-gradient(circle at 12% 92%, var(--wash-4), transparent 40%);
}
.blob { display: none; }

/* Reusable glass surface */
.topbar, .sidebar, .auth-card {
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}

/* ---------- Shell ---------- */
.shell {
  position: relative; z-index: 5;
  display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px;
  min-height: 100vh; padding: 20px; max-width: 1700px; margin: 0 auto;
}
.sidebar {
  position: sticky; top: 20px; height: calc(100vh - 40px); overflow-y: auto;
  display: flex; flex-direction: column; padding: 18px 14px;
  border-radius: var(--r-2xl); background: var(--side); border: 1px solid var(--glass-edge);
  box-shadow: 0 14px 40px rgba(24, 24, 27, .08), var(--glass-hi); color: var(--side-ink);
  scrollbar-width: none; overscroll-behavior: contain;
}
.sidebar::-webkit-scrollbar { display: none; }
.brand {
  display: flex; align-items: center; gap: 12px; padding: 2px 6px 16px; margin-bottom: 10px;
  border-bottom: 1px solid var(--line-soft); color: var(--ink); text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-size: 14px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.brand-sub { font-size: 9.5px; color: var(--ink-3); font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; margin-top: 3px; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--grad); color: #fff; font-size: 13px; font-weight: 800; box-shadow: var(--grad-shadow); }
.brand-logo { width: 42px; height: 42px; border-radius: 13px; flex: none; display: block; object-fit: cover; box-shadow: 0 8px 20px rgba(99, 102, 241, .30), 0 0 0 1px rgba(255, 255, 255, .7); }
.brand-logo-sm { width: 34px; height: 34px; border-radius: 11px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-group { margin: 12px 12px 5px; font-size: 9.5px; font-weight: 700; letter-spacing: 1.6px; color: var(--ink-3); text-transform: uppercase; }
.side-group:first-child { margin-top: 0; }
.side-link {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px;
  color: var(--ink-2); text-decoration: none; font-size: 13px; font-weight: 600; letter-spacing: -.01em;
  position: relative; transition: background .2s var(--ease), color .2s var(--ease);
}
.side-link .icon { color: currentColor; }
.side-link:hover { background: var(--glass-strong); color: var(--ink); }
.side-link[aria-current="page"] { color: #fff; background: var(--grad); box-shadow: var(--grad-shadow); }
.side-link[aria-current="page"] .icon { color: #fff; }
.side-badge { margin-left: auto; padding: 2px 7px; border-radius: var(--r-pill); font-size: 10px; font-weight: 700; background: rgba(236, 72, 153, .15); color: #db2777; font-variant-numeric: tabular-nums; }
.side-link[aria-current="page"] .side-badge { background: rgba(255, 255, 255, .25); color: #fff; }
.side-foot {
  margin-top: 14px; padding: 12px 14px; border-radius: 16px;
  background: linear-gradient(140deg, rgba(79, 70, 229, .12), rgba(6, 182, 212, .08));
  border: 1px solid rgba(79, 70, 229, .16);
}
.side-foot h4 { font-size: 12.5px; font-weight: 700; margin: 0 0 3px; color: var(--ink); }
.side-foot p { font-size: 11px; color: var(--ink-3); line-height: 1.45; margin: 0 0 10px; }
.side-foot .btn { width: 100%; }
.side-version { font-size: 10.5px !important; margin: 0 !important; font-variant-numeric: tabular-nums; }

.workspace { min-width: 0; display: flex; flex-direction: column; gap: 20px; }

/* ---------- Topbar: frosted glass bar ---------- */
.topbar {
  position: sticky; top: 20px; z-index: 20;
  display: flex; align-items: center; gap: 16px; padding: 12px 18px;
  border-radius: var(--r-xl); background: var(--nav); border: 1px solid var(--nav-edge);
  box-shadow: 0 14px 40px rgba(24, 24, 27, .07), var(--glass-hi);
}
.global-search { flex: 1; max-width: 420px; position: relative; display: flex; align-items: center; color: var(--ink-3); }
.global-search .icon { position: absolute; left: 14px; width: 16px; height: 16px; pointer-events: none; stroke-width: 2; }
.global-search input {
  width: 100%; padding: 11px 16px 11px 40px; border-radius: var(--r-md);
  border: 1px solid var(--line-soft); background: var(--field);
  font: inherit; font-size: 13px; font-weight: 500; color: var(--ink); outline: none;
  transition: border-color .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
}
.global-search input::placeholder { color: var(--ink-3); }
.global-search input:focus { border-color: rgba(79, 70, 229, .4); background: var(--panel); box-shadow: var(--focus); }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.divider-v { width: 1px; height: 28px; background: var(--line); }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 5px 14px 5px 5px; border-radius: var(--r-pill);
  background: var(--panel-2); border: 1px solid var(--glass-edge); text-decoration: none; color: var(--ink);
  transition: background .2s var(--ease);
}
.user-chip:hover { background: var(--glass-strong); color: var(--ink); }
.user-av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; background: var(--grad); flex: none; }
.user-info { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-size: 12.5px; font-weight: 700; }
.user-role { font-size: 9.5px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; position: relative;
  border-radius: 12px; border: 1px solid var(--glass-edge); background: var(--glass);
  color: var(--ink-2); cursor: pointer; text-decoration: none;
  transition: background .2s var(--ease), transform .2s var(--ease), color .2s var(--ease);
}
.icon-btn .icon { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--glass-strong); color: var(--ink); transform: translateY(-1px); }
.icon-btn:active { transform: none; }
.icon-btn .dot {
  position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-3); box-shadow: 0 0 0 2px rgba(255, 255, 255, .9), 0 0 10px rgba(236, 72, 153, .6);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.7); opacity: .7; } }
.theme-toggle .icon-moon { display: none; }
.icon-btn.nav-toggle, .nav-toggle { display: none; }

.main { padding: 0 0 3rem; width: 100%; outline: none; display: flex; flex-direction: column; min-width: 0; }
.main > * { margin-top: 0; }
.crumbs { display: flex; flex-wrap: wrap; gap: .4rem; font-size: var(--fs-sm); font-weight: 500; color: var(--ink-3); margin: 0 6px .9rem; }
.crumbs > * + *::before { content: "/"; margin-right: .4rem; color: var(--line); }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.scrim { display: none; }

/* ---------- Page heading ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; padding: 4px 6px; margin-bottom: var(--gap); }
.page-head h1 { margin: 0; }
.page-head p, .page-head .sub { margin: 5px 0 0; color: var(--ink-3); font-size: 13px; font-weight: 500; }
.page-head .sub b { color: var(--ink-2); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 17px; border-radius: var(--r-md); border: 1px solid var(--glass-edge);
  background: var(--glass); color: var(--ink-2);
  font: inherit; font-weight: 700; font-size: 12px; letter-spacing: .01em; line-height: 1.3; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  transition: background .2s var(--ease), color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}
.btn:hover { transform: translateY(-1px); background: var(--glass-strong); color: var(--ink); }
.btn:active { transform: none; }
.btn .icon { width: 14px; height: 14px; stroke-width: 2.2; }
.btn-primary { color: #fff; border-color: transparent; background: var(--grad); box-shadow: 0 8px 20px rgba(79, 70, 229, .38), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn-primary:hover { color: #fff; background: var(--grad); box-shadow: 0 12px 26px rgba(79, 70, 229, .5), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn-secondary { background: var(--glass); color: var(--ink-2); }
.btn-secondary:hover { background: var(--glass-strong); color: var(--ink); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--glass-strong); color: var(--ink); }
.btn-danger { background: var(--bad-bg); border-color: transparent; color: var(--bad); }
.btn-danger:hover { background: var(--bad); color: #fff; }
.btn-danger-solid { background: linear-gradient(135deg, #ef4444, #db2777); border-color: transparent; color: #fff; box-shadow: 0 8px 20px rgba(239, 68, 68, .35); }
.btn-danger-solid:hover { background: linear-gradient(135deg, #dc2626, #be185d); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 11px; border-radius: 10px; }
.btn-lg { padding: 13px 24px; font-size: var(--fs-md); }
.btn-wide { width: 100%; justify-content: center; margin-top: .6rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.inline-form { display: inline; margin: 0; }

/* ---------- Panels ---------- */
.panel {
  background: var(--glass); border: 1px solid var(--glass-edge); border-radius: var(--r-xl);
  box-shadow: var(--shadow-2), var(--glass-hi); margin-bottom: var(--gap); overflow: hidden;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 20px 22px 0; }
.panel-head h2, .panel-head h3 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; margin: 0; }
.panel-head p, .panel-head .sub { margin: 3px 0 0; color: var(--ink-3); font-size: 11.5px; font-weight: 500; }
.panel-head + .table-wrap, .panel-head + .table, .panel-head + .doc-list, .panel-head + .empty,
.panel-head + .portal-list, .panel-head + .filters, .panel-head + .chips, .panel-head + form > .filters { margin-top: 14px; }
.panel-body { padding: 18px 22px 22px; }
.panel-flush { padding: 0; }
.glass { background: var(--glass); border: 1px solid var(--glass-edge); border-radius: var(--r-xl); box-shadow: var(--shadow-2), var(--glass-hi); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.grid-2 > *, .grid-3 > * { min-width: 0; }
.grid-2 > .panel, .grid-3 > .panel, .grid-3 > div > .panel:last-child { margin-bottom: 0; }
.grid-2, .grid-3 { margin-bottom: var(--gap); }

/* Figures: headline numbers as glass KPI tiles */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 0 0 var(--gap); }
.figure {
  position: relative; overflow: hidden; margin: 0; padding: 18px 20px;
  background: var(--glass); border: 1px solid var(--glass-edge); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1), var(--glass-hi);
}
.figure::after { content: ""; position: absolute; top: -50px; right: -50px; width: 130px; height: 130px; border-radius: 50%; background: radial-gradient(circle, var(--tint, rgba(79, 70, 229, .22)), transparent 70%); opacity: .6; pointer-events: none; }
.figure:nth-child(4n+2) { --tint: rgba(16, 185, 129, .24); }
.figure:nth-child(4n+3) { --tint: rgba(245, 158, 11, .24); }
.figure:nth-child(4n+4) { --tint: rgba(236, 72, 153, .22); }
.figure dt { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.figure dd { margin: .3rem 0 0; font-size: 1.625rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.03em; line-height: 1.15; }
.figure small { display: block; margin-top: .25rem; font-size: var(--fs-xs); color: var(--ink-3); font-weight: 500; letter-spacing: 0; }
.figure-bad dd { color: var(--bad); } .figure-ok dd { color: var(--ok); }
a.figure { text-decoration: none; color: inherit; transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
a.figure:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift), var(--glass-hi); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--fill-strong) transparent; }
.table-wrap::-webkit-scrollbar, .chart-wrap::-webkit-scrollbar { height: 6px; }
.table-wrap::-webkit-scrollbar-thumb, .chart-wrap::-webkit-scrollbar-thumb { background: var(--fill-strong); border-radius: 6px; }
.table-wrap::-webkit-scrollbar-track, .chart-wrap::-webkit-scrollbar-track { background: transparent; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th {
  text-align: left; font-weight: 700; font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--ink-3); padding: 10px 14px 12px; border-bottom: 1px solid var(--line-soft); background: transparent; white-space: nowrap;
}
.table th:first-child, .table td:first-child { padding-left: 22px; }
.table th:last-child, .table td:last-child { padding-right: 22px; }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; font-weight: 500; }
.table tbody tr { transition: background .2s var(--ease); }
.table tbody tr:hover { background: var(--panel-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num { font-weight: 700; letter-spacing: -.01em; }
.table .row-void td { color: var(--ink-3); text-decoration: line-through; text-decoration-color: rgba(113, 113, 122, .5); }
.table .row-void td.no-strike { text-decoration: none; }
.table tfoot td { font-weight: 800; border-top: 1px solid var(--line); background: var(--panel-2); }
.cell-person { display: flex; align-items: center; gap: 11px; min-width: 200px; }
.cell-person a { font-weight: 700; text-decoration: none; color: var(--ink); letter-spacing: -.01em; font-size: 13px; }
.cell-person a:hover { color: var(--primary); }
.cell-sub { display: block; font-size: 10.5px; color: var(--ink-3); font-weight: 500; margin-top: 2px; }
.cell-actions { text-align: right; white-space: nowrap; }
.cell-actions > * + * { margin-left: 4px; }
.table-count { margin: 0; font-size: var(--fs-sm); color: var(--ink-3); padding: 14px 22px; font-weight: 500; }
.pagination { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line-soft); padding: .35rem 1rem .35rem 0; }
.pagination div { display: flex; align-items: center; gap: .2rem; }
.page-link, .page-current { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 .45rem; border-radius: 10px; text-decoration: none; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }
.page-link:hover { background: var(--glass-strong); color: var(--ink); }
.page-current { background: var(--grad); color: #fff; box-shadow: 0 6px 14px rgba(79, 70, 229, .3); }

/* ---------- Filters & chips (segmented) ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 16px 22px; border-bottom: 1px solid var(--line-soft); }
.filters .field { margin: 0; min-width: 140px; }
.filters .field label { font-size: 10px; }
.filters .field-grow { flex: 1; min-width: 220px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; padding: 16px 22px 0; }
.chip {
  padding: 6px 13px; border-radius: 10px; border: 1px solid transparent;
  font-size: 11.5px; font-weight: 700; text-decoration: none; color: var(--ink-3); background: var(--fill);
  transition: background .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease);
}
.chip:hover { background: var(--fill-strong); color: var(--ink); }
.chip[aria-current="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 2px 6px rgba(24, 24, 27, .08); }
.chip span { font-variant-numeric: tabular-nums; opacity: .6; margin-left: .3rem; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem 1.1rem; }
.form-grid-1 { grid-template-columns: 1fr !important; }
.field { display: flex; flex-direction: column; gap: .4rem; margin: 0; }
.field-wide { grid-column: 1 / -1; }
.field label { font-size: 10.5px; font-weight: 700; color: var(--ink-3); letter-spacing: .8px; text-transform: uppercase; }
.field-check label { font-weight: 500; font-size: var(--fs-md); letter-spacing: 0; text-transform: none; display: flex; gap: .5rem; align-items: center; color: var(--ink); }
.req { color: var(--bad); }
.input {
  width: 100%; font: inherit; font-size: 13px; font-weight: 500; color: var(--ink); background: var(--field);
  border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 10px 14px; min-height: 42px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
}
.input::placeholder { color: var(--ink-3); }
.input:hover { border-color: var(--line); }
.input:focus { outline: none; border-color: rgba(79, 70, 229, .45); background: var(--panel); box-shadow: var(--focus); }
textarea.input { resize: vertical; line-height: 1.5; }
select.input { padding-right: 2rem; }
.input-sm { padding: 6px 10px; min-height: 34px; font-size: var(--fs-sm); min-width: 0; border-radius: 10px; }
.has-error .input { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: var(--fs-xs); font-weight: 600; margin: 0; }
.hint { color: var(--ink-3); font-size: var(--fs-xs); margin: 0; }
.form-section { padding: 22px; border-top: 1px solid var(--line-soft); }
.form-section:first-child { border-top: 0; }
.form-section > h2 { font-size: 15px; margin-bottom: .25rem; }
.form-section > p { color: var(--ink-3); font-size: var(--fs-sm); margin-bottom: 1rem; }
.form-footer {
  display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px;
  border-top: 1px solid var(--line-soft); background: var(--glass-strong);
  position: sticky; bottom: 0;
}
.repeat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .7rem .9rem; padding: 14px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel-2); margin-bottom: .6rem; position: relative; }
.repeat-row .remove-row { position: absolute; top: .35rem; right: .35rem; }
.dropzone { border: 1.5px dashed var(--line); border-radius: var(--r-md); padding: 1.15rem; background: var(--panel-2); transition: border-color .2s var(--ease), background .2s var(--ease); }
.dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }
.check { display: flex; gap: .55rem; align-items: flex-start; margin: .8rem 0; }
.check-sm { display: inline-flex; align-items: center; gap: .3rem; font-size: var(--fs-xs); color: var(--ink-2); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.rename-form { display: flex; gap: .4rem; align-items: center; }
.rename-form .input { flex: 1 1 auto; max-width: 16rem; }
.steps { margin: 0; padding-left: 1.2rem; display: grid; gap: .5rem; font-size: var(--fs-md); }
.stack > * + * { margin-top: .9rem; }
.subhead { font-size: var(--fs-md); font-weight: 700; color: var(--ink); margin: 1.4rem 0 .6rem; padding-top: .9rem; border-top: 1px solid var(--line-soft); }
.form-section > .subhead:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }

/* ---------- Tags (badges), alerts, toasts ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: var(--r-pill);
  font-size: 10.5px; font-weight: 700; line-height: 1.4; white-space: nowrap; letter-spacing: .01em;
  vertical-align: middle;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--muted-bg); color: var(--muted); }
.alert {
  display: block; border-radius: 16px; padding: 13px 16px; margin-bottom: var(--gap); border: 1px solid transparent;
  font-size: 13px; font-weight: 500;
}
.alert .icon { vertical-align: -4px; margin-right: 4px; }
.alert a { font-weight: 700; }
.alert ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.alert-bad { background: rgba(254, 226, 226, .75); border-color: rgba(239, 68, 68, .22); color: #991b1b; }
.alert-warn { background: rgba(254, 243, 199, .75); border-color: rgba(245, 158, 11, .25); color: #92400e; }
.alert-info { background: rgba(224, 231, 255, .75); border-color: rgba(79, 70, 229, .22); color: #3730a3; }
.alert-sensitive { display: flex; gap: .65rem; align-items: flex-start; background: rgba(254, 243, 199, .75); border-color: rgba(245, 158, 11, .25); color: #92400e; }
.toasts { position: fixed; right: 1.25rem; bottom: 1.25rem; display: flex; flex-direction: column; gap: .6rem; z-index: 60; max-width: min(420px, calc(100vw - 2rem)); }
.toast {
  display: flex; gap: .75rem; align-items: flex-start; color: var(--ink); font-weight: 500; font-size: 13px;
  background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge); border-left: 4px solid #10b981;
  border-radius: 16px; padding: 13px 14px 13px 16px;
  box-shadow: var(--shadow-pop); animation: toast-in .28s var(--ease);
}
.toast p { margin: 0; flex: 1; }
.toast-error { border-left-color: #ef4444; } .toast-warning { border-left-color: #f59e0b; } .toast-info { border-left-color: #4f46e5; }
.toast-close { border: 0; background: transparent; color: var(--ink-3); font-size: 1.25rem; line-height: 1; cursor: pointer; padding: 0 .2rem; }
.toast-close:hover { color: var(--ink); }
.toast.is-leaving { opacity: 0; transform: translateY(8px) scale(.98); transition: .22s var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }

/* ---------- Modal ---------- */
.modal { border: 1px solid var(--glass-edge); border-radius: var(--r-2xl); padding: 0; width: min(460px, calc(100vw - 2rem)); background: var(--panel); box-shadow: var(--shadow-pop); color: var(--ink); animation: modal-in .24s var(--ease); }
.modal::backdrop { background: rgba(24, 24, 27, .30); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.modal-body { padding: 24px 24px 20px; display: flex; flex-direction: column; gap: .7rem; }
.modal-wide { width: min(720px, calc(100vw - 2rem)); }
.modal-title { font-size: var(--fs-xl); margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: .5rem; }
@keyframes modal-in { from { opacity: 0; transform: scale(.94); } }

/* ---------- Segmented tabs & subject header ---------- */
.subject { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 0 6px var(--gap); }
.subject-main { flex: 1; min-width: 240px; }
.subject h1 { margin: 0 0 .25rem; }
.subject-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; color: var(--ink-3); margin: 0 0 .5rem; font-size: 13px; font-weight: 500; }
.subject-badges { margin: 0; display: flex; gap: .35rem; flex-wrap: wrap; }
.subject-balance { text-align: right; padding: 12px 18px; border-radius: var(--r-lg); background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-1), var(--glass-hi); }
.subject-balance span { display: block; font-size: 10.5px; color: var(--ink-3); font-weight: 700; text-transform: uppercase; letter-spacing: .8px; }
.subject-balance strong { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.balance-outstanding strong { color: var(--bad); } .balance-advance strong { color: var(--info); } .balance-clear strong { color: var(--ok); }
.subject + .actions { margin: 0 6px var(--gap); }
.tabs {
  display: flex; gap: 2px; margin-bottom: var(--gap); overflow-x: auto;
  background: var(--glass); border: 1px solid var(--glass-edge); border-radius: 14px; padding: 4px; max-width: max-content;
  box-shadow: var(--shadow-1); scrollbar-width: none;
}
.tabs a {
  padding: 7px 14px; text-decoration: none; color: var(--ink-3); border-radius: 10px;
  white-space: nowrap; font-weight: 700; font-size: 12px;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--grad); color: #fff; box-shadow: 0 6px 14px rgba(79, 70, 229, .3); }
.report-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--gap); }
.report-nav .chip { background: var(--glass); border-color: var(--glass-edge); }
.report-nav .chip[aria-current="true"] { background: var(--grad); color: #fff; box-shadow: 0 6px 14px rgba(79, 70, 229, .3); }

.avatar { display: inline-grid; place-items: center; border-radius: 11px; background: var(--grad); color: #fff; font-weight: 800; object-fit: cover; flex: none; letter-spacing: .01em; }
.avatar-p1 { background: linear-gradient(140deg, #6366f1, #06b6d4); }
.avatar-p2 { background: linear-gradient(140deg, #ec4899, #f59e0b); }
.avatar-p3 { background: linear-gradient(140deg, #10b981, #06b6d4); }
.avatar-p4 { background: linear-gradient(140deg, #8b5cf6, #ec4899); }
img.avatar { background: var(--fill); }
.avatar-sm { width: 34px; height: 34px; font-size: 11px; border-radius: 10px; }
.avatar-md { width: 40px; height: 40px; font-size: 12px; }
.avatar-lg { width: 68px; height: 68px; font-size: 1.2rem; border-radius: 18px; box-shadow: 0 10px 24px rgba(79, 70, 229, .25); }
.avatar-xl { width: 120px; height: 120px; font-size: 2rem; border-radius: var(--r-xl); }

/* ---------- Data lists ---------- */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .9rem 1.35rem; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: var(--fs-xs); color: var(--ink-3); }
.facts dd { margin: .15rem 0 0; overflow-wrap: anywhere; }
.facts .wide { grid-column: 1 / -1; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .55rem 0; border-bottom: 1px solid var(--line-soft); }
.checklist li:last-child { border-bottom: 0; }
.checklist .check-mark { flex: none; display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; }
.checklist .check-mark .icon { width: .95rem; height: .95rem; }
.checklist li[class^="check-"] { justify-content: flex-start; padding-inline: 1rem; }
.check-ok .check-mark { background: var(--ok-bg); color: var(--ok); }
.check-warn .check-mark { background: var(--warn-bg); color: var(--warn); }
.check-bad .check-mark { background: var(--bad-bg); color: var(--bad); }
.progress { height: 6px; border-radius: var(--r-pill); background: var(--fill); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--primary); border-radius: var(--r-pill); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.5rem; border-left: 2px solid var(--line-soft); margin-left: .35rem; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--panel); border: 2px solid var(--ink-3); }
.timeline li.is-current::before { background: var(--primary); border-color: var(--primary); }
.stepper { display: flex; gap: 4px; list-style: none; margin: 0 0 var(--gap); padding: 0; overflow-x: auto; }
.stepper li { flex: 1; min-width: 110px; font-size: var(--fs-xs); color: var(--ink-3); padding-top: .6rem; border-top: 3px solid var(--line-soft); border-radius: 3px; }
.stepper li.done { color: var(--ink-2); border-top-color: var(--primary); }
.stepper li.current { color: var(--ink); font-weight: 600; border-top-color: var(--primary); }
.stepper li.stopped { color: var(--bad); border-top-color: var(--bad); font-weight: 600; }
.occ { display: inline-flex; align-items: center; gap: .5rem; min-width: 120px; }
.occ .progress { flex: 1; min-width: 60px; }
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix .group-row td { background: var(--panel-2); font-weight: 600; font-size: var(--fs-sm); color: var(--ink-2); text-align: left; }
.amount-in { color: var(--ok); } .amount-out { color: var(--bad); }
.code { font-family: var(--mono); font-size: var(--fs-xs); overflow-wrap: anywhere; }
hr.rule { border: 0; border-top: 1px solid var(--line-soft); margin: .8rem 0; }
hr.rule:last-child { display: none; }
.row-muted td { opacity: .5; }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--ink-3); }
.empty p { margin-bottom: .85rem; }

/* ---------- Key rack: the room/bed board ----------
   Rooms as keys on the warden's board; each pip is a bed. */
.rack { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: .6rem; }
.rack-floor { grid-column: 1 / -1; font-size: var(--fs-sm); color: var(--ink-3); font-weight: 600; margin: .6rem 0 -.1rem; padding-bottom: .3rem; border-bottom: 1px solid var(--line-soft); }
.rack-floor:first-child { margin-top: 0; }
.key {
  display: flex; flex-direction: column; gap: .4rem; padding: .65rem .7rem .7rem;
  border: 1px solid var(--line-soft); border-radius: 14px; background: var(--panel);
  box-shadow: var(--shadow-1); text-decoration: none; color: var(--ink); position: relative;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.key:hover { color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.key::before { content: none; }
.key-top { display: flex; justify-content: space-between; align-items: baseline; gap: .3rem; }
.key-no { font-size: 1.1rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.key-type { font-size: .7rem; font-weight: 600; color: var(--ink-3); }
.key-type-ac { color: var(--info); }
.key-pips { display: flex; flex-wrap: wrap; gap: 4px; }
.pip { width: 14px; height: 14px; border-radius: 5px; border: 1.5px solid var(--line); background: transparent; }
.pip-on { background: var(--primary); border-color: var(--primary); }
.key-foot { font-size: var(--fs-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.key-full { background: var(--panel-2); }
.key-full .key-foot { color: var(--ink-2); }
.key-maintenance { background: repeating-linear-gradient(-45deg, var(--panel), var(--panel) 7px, var(--warn-bg) 7px, var(--warn-bg) 14px); }
.key-inactive { opacity: .45; }
.rack-legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: var(--fs-xs); color: var(--ink-3); margin: 0; }
.rack-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.bed-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .65rem; }
.bed { display: flex; gap: .75rem; align-items: center; padding: .75rem; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--panel); }
.bed-label { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; font-weight: 600; background: var(--fill); color: var(--ink-2); flex: none; }
.bed-taken .bed-label { background: var(--primary); color: #fff; }

/* ---------- Documents ---------- */
.doc-list { list-style: none; margin: 0; padding: 0; }
.doc { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .85rem; align-items: center; padding: .75rem 1.15rem; border-bottom: 1px solid var(--line-soft); }
.doc:last-child { border-bottom: 0; }
.doc-icon { display: grid; place-items: center; width: 38px; height: 44px; border-radius: var(--r-sm); background: var(--fill); color: var(--ink-3); font-size: .62rem; font-weight: 600; }
.doc-icon-sensitive { background: var(--brass-soft); color: var(--brass); }
.doc-title { font-weight: 600; overflow-wrap: anywhere; letter-spacing: -.01em; }
.doc-actions { display: flex; flex-wrap: wrap; gap: .3rem; justify-content: flex-end; }
.med-flag { display: flex; gap: .65rem; padding: .8rem .9rem; border-radius: var(--r-md); background: var(--bad-bg); color: #96000f; margin-bottom: .65rem; }
.med-block { white-space: pre-wrap; }

/* ---------- Row action menu (<details>) ---------- */
.menu { position: relative; display: inline-block; text-align: left; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px;
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-md);
  box-shadow: var(--shadow-pop); padding: .35rem; z-index: 30; display: flex; flex-direction: column;
  animation: menu-in .16s var(--ease);
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menu-list a, .menu-list button { display: block; width: 100%; text-align: left; padding: .45rem .65rem; border: 0; background: none; font: inherit; color: var(--ink); text-decoration: none; border-radius: var(--r-sm); cursor: pointer; }
.menu-list a:hover, .menu-list button:hover { background: var(--primary); color: #fff; }
.menu-list .menu-danger { color: var(--bad); }
.menu-list .menu-danger:hover { background: var(--bad); color: #fff; }
.menu-list hr { border: 0; border-top: 1px solid var(--line-soft); margin: .3rem 0; }
.menu-list form { display: block; }
details.panel > summary { cursor: pointer; list-style: none; }
details.panel > summary::-webkit-details-marker { display: none; }
.status-manual { border-top: 1px solid var(--line-soft); padding-top: .65rem; }
.status-manual > summary { cursor: pointer; font-size: var(--fs-sm); color: var(--ink-3); padding: .2rem 0 .6rem; }
.status-manual[open] > summary { color: var(--ink); font-weight: 600; }

/* ---------- Auth ---------- */
.auth-body {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: var(--canvas);
  background-image:
    radial-gradient(760px 520px at 12% -5%, rgba(0, 113, 227, .14), transparent 62%),
    radial-gradient(620px 520px at 95% 100%, rgba(94, 92, 230, .12), transparent 60%);
  background-attachment: fixed;
}
.auth-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-xl); width: min(420px, 100%); padding: 2rem 1.9rem; box-shadow: var(--shadow-pop); }
.auth-card .brand { color: var(--ink); padding: 0 0 1.35rem; justify-content: center; }
.auth-card form { display: flex; flex-direction: column; gap: 1rem; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: .7rem; padding: 0 0 1.4rem; font-weight: 600; font-size: var(--fs-xl); letter-spacing: -.02em; text-align: center; color: var(--ink); }
.auth-logo { width: 112px; height: 112px; border-radius: 50%; display: block; box-shadow: 0 0 0 1px var(--line-soft), var(--shadow-2); }
.auth-note { font-size: var(--fs-xs); color: var(--ink-3); margin: 1.25rem 0 0; text-align: center; }
.auth-alt { text-align: center; margin: 1.1rem 0 0; font-size: var(--fs-sm); }
.auth-alt a { font-weight: 600; }
.error-page { text-align: left; padding: 2rem 0; max-width: 520px; }
.error-code { font-size: 3.5rem; font-weight: 600; letter-spacing: -.03em; color: var(--ink-3); opacity: .45; margin: 0; line-height: 1; }


/* ---------- Dashboard ---------- */
.dash-head { margin-bottom: var(--gap); }

/* KPI cards: tinted icon, delta pill, big value, sparkline */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: var(--gap); }
.kpi {
  position: relative; overflow: hidden; display: block; padding: 20px;
  border-radius: var(--r-lg); background: var(--glass); border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow-1), var(--glass-hi); color: var(--ink); text-decoration: none;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
a.kpi:hover { color: var(--ink); transform: translateY(-3px); box-shadow: var(--shadow-lift), var(--glass-hi); }
.kpi::after { content: ""; position: absolute; top: -50px; right: -50px; width: 130px; height: 130px; border-radius: 50%; background: radial-gradient(circle, var(--c), transparent 70%); opacity: .5; pointer-events: none; }
.kpi-a { --c: rgba(79, 70, 229, .30); --k: #4f46e5; --kb: rgba(79, 70, 229, .14); }
.kpi-b { --c: rgba(16, 185, 129, .30); --k: #10b981; --kb: rgba(16, 185, 129, .14); }
.kpi-c { --c: rgba(245, 158, 11, .30); --k: #f59e0b; --kb: rgba(245, 158, 11, .16); }
.kpi-d { --c: rgba(236, 72, 153, .28); --k: #ec4899; --kb: rgba(236, 72, 153, .14); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.kpi-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--kb); color: var(--k); }
.kpi-ic .icon { width: 18px; height: 18px; stroke-width: 2; }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: var(--r-pill); font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.delta .icon { width: 10px; height: 10px; stroke-width: 2.6; }
.delta-up { background: rgba(16, 185, 129, .13); color: #059669; }
.delta-down { background: rgba(239, 68, 68, .11); color: #dc2626; }
.delta-flat { background: var(--fill); color: var(--ink-3); }
.kpi-val { font-size: 30px; font-weight: 800; letter-spacing: -.035em; font-variant-numeric: tabular-nums; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-lbl { font-size: 11.5px; color: var(--ink-3); font-weight: 600; margin-top: 7px; }
.kpi-sub { font-size: 11px; color: var(--ink-3); font-weight: 500; margin-top: 2px; }
.spark { display: block; margin-top: 12px; height: 26px; width: 100%; }
.spark-line { fill: none; stroke: var(--k); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.spark-area { fill: var(--k); opacity: .16; }
.kpi-bar { margin-top: 14px; height: 6px; border-radius: var(--r-pill); background: var(--fill); overflow: hidden; }
.kpi-bar > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--k); }

/* Secondary mini figures strip */
.mini-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: var(--gap); }
.mini {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px;
  background: var(--glass); border: 1px solid var(--glass-edge); text-decoration: none; color: var(--ink);
  transition: background .2s var(--ease), transform .2s var(--ease);
}
a.mini:hover { background: var(--glass-strong); color: var(--ink); transform: translateY(-1px); }
.mini-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.mini-ic .icon { width: 16px; height: 16px; }
.mini div { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.mini strong { font-size: 15px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini span { font-size: 11px; color: var(--ink-3); font-weight: 600; }
.mini-bad strong { color: var(--bad); } .mini-ok strong { color: var(--ok); }

/* Quick actions */
.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Main grid */
.grid-main { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: var(--gap); margin-bottom: var(--gap); align-items: stretch; }
.grid-main > div { display: flex; flex-direction: column; min-width: 0; }
.grid-main > div > .panel:last-child { flex: 1; }
.table-fit .cell-person { min-width: 0; }
.table-fit td, .table-fit th { white-space: nowrap; }
.table-fit td:first-child { white-space: normal; }
.grid-main > .panel, .grid-main > div > .panel:last-child { margin-bottom: 0; }
.grid-main > div > .panel { margin-bottom: var(--gap); }
.grid-charts { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: var(--gap); margin-bottom: var(--gap); }
.grid-charts > .panel { margin-bottom: 0; }

/* Area chart (revenue) */
.area-chart { width: 100%; height: 220px; display: block; overflow: visible; }
.area-grid { stroke: var(--line-soft); stroke-width: 1; vector-effect: non-scaling-stroke; }
.area-line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.area-line2 { fill: none; stroke: var(--accent-3); stroke-width: 2; stroke-dasharray: 6 5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; opacity: .85; }
.area-dots circle { fill: var(--panel); stroke: var(--primary); stroke-width: 3; }
.chart-x { display: flex; justify-content: space-between; margin-top: 10px; font-size: 10.5px; color: var(--ink-3); font-weight: 600; }
.chart-x span { flex: 1; text-align: center; }
.chart-x span:first-child { text-align: left; } .chart-x span:last-child { text-align: right; }
.chart-total { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
.chart-total strong { font-size: 22px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.chart-total span { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }

/* Bar chart (utility history etc.) */
.chart-wrap { width: 100%; overflow-x: auto; }
.chart { width: 100%; min-width: 420px; height: auto; display: block; }
.chart-grid { stroke: var(--line-soft); stroke-width: 1; }
.chart-axis, .chart-label { fill: var(--ink-3); font-size: 11px; font-weight: 600; font-family: var(--font); }
.chart-bar { fill: var(--primary); }
.chart-bar2 { fill: var(--accent-3); }
.chart-bar:hover, .chart-bar2:hover { opacity: .75; }
.chart-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 11.5px; font-weight: 600; color: var(--ink-3); margin-top: .75rem; }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .4rem; vertical-align: -1px; }
.lg1 { background: var(--grad); } .lg2 { background: var(--accent-3); }

/* Occupancy donut */
.occ-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.occ-donut { width: 180px; height: 180px; position: relative; }
.occ-donut svg { width: 100%; height: 100%; display: block; }
.occ-track { fill: none; stroke: var(--fill); stroke-width: 12; }
.occ-value { fill: none; stroke-width: 12; stroke-linecap: round; }
.occ-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.occ-big { font-size: 30px; font-weight: 800; letter-spacing: -.035em; font-variant-numeric: tabular-nums; line-height: 1; }
.occ-small { font-size: 10.5px; color: var(--ink-3); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }
.legend { width: 100%; display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.legend li { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 600; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.sw-occ { background: var(--grad); } .sw-vac { background: var(--fill-strong); } .sw-mnt { background: #f59e0b; } .sw-col { background: #10b981; }
.legend .nm { color: var(--ink-2); }
.legend .vl { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Small donuts (kept for other pages) */
.donuts { display: grid; gap: 1rem; }
.donut { display: flex; align-items: center; gap: 1rem; }
.donut svg { width: 96px; height: 96px; flex: none; }
.donut div { display: flex; flex-direction: column; }
.donut span { color: var(--ink-3); font-size: var(--fs-sm); }
.donut-track { fill: none; stroke: var(--fill); stroke-width: 12; }
.donut-value { fill: none; stroke: var(--primary); stroke-width: 12; stroke-linecap: round; }
.donut-text { font-size: 20px; font-weight: 800; fill: var(--ink); font-family: var(--font); }

/* Activity feed */
.activity { display: flex; flex-direction: column; gap: 16px; margin: 0; padding: 0; list-style: none; }
.act-item { display: flex; gap: 12px; }
.act-ic { width: 34px; height: 34px; flex: none; border-radius: 11px; display: grid; place-items: center; }
.act-ic .icon { width: 15px; height: 15px; stroke-width: 2; }
.act-pay { background: rgba(16, 185, 129, .14); color: #10b981; }
.act-new { background: rgba(79, 70, 229, .14); color: #4f46e5; }
.act-alert { background: rgba(245, 158, 11, .16); color: #f59e0b; }
.act-out { background: rgba(236, 72, 153, .14); color: #ec4899; }
.act-body { flex: 1; min-width: 0; }
.act-body p { font-size: 12.5px; font-weight: 500; color: var(--ink-2); line-height: 1.45; margin: 0; }
.act-body p b, .act-body p a { font-weight: 700; color: var(--ink); text-decoration: none; }
.act-body p a:hover { color: var(--primary); }
.act-time { font-size: 10.5px; color: var(--ink-3); font-weight: 600; margin-top: 3px; }
.link-more { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--primary); text-decoration: none; white-space: nowrap; }
.link-more .icon { width: 12px; height: 12px; stroke-width: 2.4; }
.link-more:hover { color: var(--primary-hover); }

/* Hero (kept for compatibility; dashboard now uses .page-head + .kpis) */
.hero { position: relative; overflow: hidden; border-radius: var(--r-xl); margin-bottom: var(--gap); padding: 22px; background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-2), var(--glass-hi); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 1.5rem; }
.hero-btn { display: flex; flex-direction: column; align-items: center; gap: .4rem; min-width: 98px; padding: .8rem .85rem; border-radius: 16px; color: var(--ink); text-decoration: none; font-size: var(--fs-sm); font-weight: 600; background: var(--glass); border: 1px solid var(--glass-edge); }

/* ---------- Stat tiles & payment details ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { border-radius: var(--r-md); padding: .95rem 1.1rem; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line-soft); box-shadow: var(--shadow-1); }
.stat-label { font-size: var(--fs-sm); color: var(--ink-3); }
.stat-value { font-size: 1.5rem; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: var(--fs-xs); color: var(--ink-3); }
.inline-rate { display: flex; align-items: center; justify-content: flex-end; gap: .35rem; flex-wrap: wrap; }
.inline-rate .input { width: 6.5rem; text-align: right; }
.pay-box h3 { margin: 0 0 .6rem; font-size: var(--fs-lg); }
.pay-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .6rem; }
.pay-item { display: flex; flex-direction: column; padding: .7rem .85rem; border-radius: var(--r-md); background: var(--panel-2); border: 1px solid var(--line-soft); }
.pay-item strong { margin-bottom: .15rem; }
.pay-item span { font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.pay-note { margin: .65rem 0 0; font-size: var(--fs-sm); color: var(--ink-3); }

/* ---------- Quick admission, danger zone, uploads ---------- */
.quick-admit {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem 1rem; flex-wrap: wrap;
  padding: .9rem 1.05rem; margin: 0 0 1rem; border: 1px solid rgba(29, 138, 74, .18);
  border-radius: var(--r-md); background: var(--ok-bg);
}
.quick-admit strong { display: block; font-size: var(--fs-md); }
.quick-admit p { margin: .15rem 0 0; font-size: var(--fs-sm); color: var(--ink-2); }
.apk-bar { height: 8px; border-radius: var(--r-pill); background: var(--fill); overflow: hidden; }
.apk-bar span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s var(--ease); }
.danger-zone { border-color: rgba(215, 0, 21, .22); }
.danger-zone .panel-head h2 { color: var(--bad); }
.purge-counts { margin: .3rem 0 .8rem; padding-left: 1.2rem; }
.text-danger { color: var(--bad); }

/* ---------- Receipt / printable document (also on screen) ---------- */
.paper { background: #fff; border: 1px solid var(--line-soft); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: 2.25rem; max-width: 820px; margin: 0 auto var(--gap); color: #1d1d1f; }
.paper-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-bottom: 2px solid #1d1d1f; padding-bottom: .85rem; margin-bottom: 1.1rem; }
.paper-head h1 { font-size: var(--fs-xl); margin: 0; }
.paper-logo { width: 64px; height: 64px; border-radius: 50%; flex: none; }
.paper-title { flex: 1; min-width: 0; }
.paper-sign { display: flex; justify-content: space-between; gap: 2rem; margin-top: 3rem; }
.paper-sign div { flex: 1; border-top: 1px solid #6e6e73; padding-top: .35rem; font-size: var(--fs-sm); color: #6e6e73; }
.receipt-amount { font-size: 1.875rem; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.receipt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem 2rem; margin: 1rem 0; }
.receipt-grid dt { color: #6e6e73; font-size: var(--fs-sm); } .receipt-grid dd { margin: 0 0 .4rem; }
.print-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.print-logo { width: 52px; height: 52px; border-radius: 50%; }
.print-only { display: none; }
.rules-preview h3 { margin: 1rem 0 .35rem; font-size: var(--fs-lg); }
.rules-preview h3:first-child { margin-top: 0; }
.rules-preview ol { margin: 0; padding-left: 1.6rem; display: grid; gap: .3rem; }

/* ---------- Online application page ---------- */
.apply-body { display: block; padding: 1.5rem 1rem 3.5rem; place-items: initial; }
.apply-wrap { max-width: 880px; margin: 0 auto; }
.apply-head { display: flex; align-items: center; gap: 1.1rem; padding: 1.25rem 1.4rem; border-radius: var(--r-xl); background: var(--panel); border: 1px solid var(--line-soft); box-shadow: var(--shadow-2); margin-bottom: 1rem; }
.apply-head h1 { margin: 0; }
.apply-head p { margin: .2rem 0 0; color: var(--ink-3); }
.apply-logo { width: 68px; height: 68px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px var(--line-soft); }
.apply-form .panel h2 { font-size: var(--fs-lg); }
.apply-form .field.wide { grid-column: 1 / -1; }
.apply-done h2 { color: var(--ok); }
.apply-foot { text-align: center; margin-top: 1.25rem; color: var(--ink-3); font-size: var(--fs-sm); }
.apply-foot a, .apply-body .apply-foot a { color: var(--primary); font-weight: 600; }

/* ---------- Resident portal ---------- */
.credential { display: grid; gap: .85rem; margin: 0 0 1rem; }
.credential dt { font-size: var(--fs-sm); color: var(--ink-3); }
.credential dd { margin: .15rem 0 0; }
.credential-value { font-size: 1.4rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .01em; user-select: all; }
.portal-body { background: var(--canvas); min-height: 100vh; }
.portal-top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .65rem max(1rem, calc((100% - 760px) / 2));
  background: var(--nav); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--line-soft); color: var(--ink);
}
.portal-brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; font-weight: 600; letter-spacing: -.02em; }
.portal-signout { color: var(--ink-2); }
.portal-signout:hover { background: var(--fill); color: var(--ink); }
.portal-nav {
  display: flex; gap: .25rem; padding: .4rem max(.5rem, calc((100% - 760px) / 2));
  background: var(--nav); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; z-index: 5;
}
.portal-nav a { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .4rem .25rem; border-radius: var(--r-md); color: var(--ink-3); text-decoration: none; font-size: var(--fs-xs); font-weight: 500; transition: background .16s var(--ease), color .16s var(--ease); }
.portal-nav a:hover { background: var(--fill); color: var(--ink); }
.portal-nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.portal-main { max-width: 760px; margin: 0 auto; padding: 1.15rem 1rem 3rem; }
.portal-hello h1 { font-size: var(--fs-xl); margin: .3rem 0 .15rem; }
.portal-hello p { margin: 0 0 1rem; color: var(--ink-3); }
.portal-balance { border-radius: var(--r-lg); padding: 1.25rem 1.35rem; margin-bottom: var(--gap); border: 1px solid var(--line-soft); background: var(--panel); box-shadow: var(--shadow-2); }
.portal-balance.is-due { border-color: rgba(215, 0, 21, .18); background: var(--bad-bg); box-shadow: none; }
.portal-balance.is-clear { border-color: rgba(29, 138, 74, .18); background: var(--ok-bg); box-shadow: none; }
.portal-balance p { margin: 0; }
.portal-balance-label { font-size: var(--fs-sm); color: var(--ink-3); }
.portal-balance-amount { font-size: 2.25rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.is-due .portal-balance-amount { color: var(--bad); }
.is-clear .portal-balance-amount { color: var(--ok); }
.portal-balance-sub { font-size: var(--fs-sm); color: var(--ink-2); }
.portal-list { list-style: none; margin: 0; padding: 0; }
.portal-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem 1.15rem; border-bottom: 1px solid var(--line-soft); }
.portal-list li:last-child { border-bottom: 0; }
.portal-list .num { text-align: right; }
.portal-list .cell-sub { display: block; }
.portal-narrow { max-width: 460px; margin-inline: auto; }
.portal-form { grid-template-columns: 1fr; }
.portal-foot { text-align: center; color: var(--ink-3); font-size: var(--fs-xs); margin: 1.75rem 0 .5rem; }
.h2 { font-size: var(--fs-lg); margin: 0; }


/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .grid-charts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding: 14px; gap: 14px; }
  .workspace { gap: 14px; }
  .sidebar {
    position: fixed; top: 12px; bottom: 12px; left: 12px; height: auto; width: 272px; z-index: 50;
    transform: translateX(calc(-100% - 24px)); transition: transform .3s var(--ease);
    background: var(--glass-strong); box-shadow: var(--shadow-pop);
  }
  .sidebar.is-open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(24, 24, 27, .28); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); z-index: 40; }
  .icon-btn.nav-toggle, .nav-toggle { display: inline-grid; }
  .topbar { top: 14px; padding: 10px 12px; gap: 10px; }
  /* Phones and tablets: no live blur at all (it is what makes scrolling stutter). */
  .topbar, .sidebar, .auth-card, .menu-list, .portal-top, .portal-nav, .scrim { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .topbar { background: var(--glass-strong); }
  .sidebar { background: var(--panel); }
  .panel, .kpi, .figure, .mini, .stat, .tabs { box-shadow: var(--shadow-1); }
}
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .figures { grid-template-columns: repeat(2, 1fr); }
  .tabs { max-width: 100%; }
  .doc { grid-template-columns: auto minmax(0, 1fr); }
  .doc-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .subject-balance { text-align: left; }
  .paper { padding: 1.5rem 1.15rem; }
  /* Stack tables into cards */
  .table-stack thead { display: none; }
  .table-stack tr { display: block; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); }
  .table-stack td, .table-stack td:first-child, .table-stack td:last-child { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px 6px; border: 0; padding: 5px 0; text-align: right; }
  .table-stack td::before { content: attr(data-label); margin-right: auto; padding-right: 12px; color: var(--ink-3); font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; text-align: left; }
  .table-stack td[data-label=""] { justify-content: flex-start; text-align: left; padding-bottom: 8px; }
  .table-stack td.cell-actions { gap: 6px; }
  .table-stack td.cell-actions { justify-content: flex-end; padding-top: 8px; }
  .table-stack td.cell-actions::before, .table-stack td[data-label=""]::before { content: none; }
  .table-stack .cell-person { min-width: 0; }
}
@media (max-width: 600px) {
  .topbar { flex-wrap: wrap; }
  .global-search { max-width: none; order: 3; flex-basis: 100%; }
  .user-info, .divider-v { display: none; }
  .user-chip { padding: 4px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; border-radius: 16px; }
  .kpi-top { margin-bottom: 10px; }
  .kpi-ic { width: 32px; height: 32px; border-radius: 10px; }
  .kpi-val { font-size: 22px; }
  .kpi-lbl { font-size: 11px; }
  .kpi .delta { font-size: 9.5px; padding: 2px 6px; }
  .mini-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .page-head h1 { font-size: 22px; }
  .panel-head { padding: 18px 18px 0; }
  .panel-body { padding: 16px 18px 18px; }
  .table th:first-child, .table td:first-child { padding-left: 18px; }
  .table th:last-child, .table td:last-child { padding-right: 18px; }
  .receipt-grid { grid-template-columns: 1fr; }
  .quick-admit .btn { width: 100%; justify-content: center; }
  .rename-form .input { max-width: none; }
  .auth-card { padding: 1.6rem 1.35rem; }
  .quick-actions .btn { flex: 1 1 45%; }
  .blob { opacity: .7; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Printable blank forms (forms/) — intentionally plain, ink on paper ---------- */
.rules-preview h3 { margin: .9rem 0 .3rem; font-size: var(--fs-lg); }
.rules-preview h3:first-child { margin-top: 0; }
.rules-preview ol { margin: 0; padding-left: 1.6rem; display: grid; gap: .25rem; }

.bf-body { background: var(--canvas); color: #000; }
.bf-toolbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); }
.bf-page { box-sizing: border-box; width: 210mm; min-height: 297mm; margin: 1rem auto; padding: 12mm 13mm 10mm; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.12); font-size: 9.5pt; line-height: 1.3; position: relative; display: flex; flex-direction: column; }
.bf-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 6mm; border-bottom: 2px solid #000; padding-bottom: 3mm; margin-bottom: 2mm; }
.bf-head > div:first-of-type { flex: 1; }
.bf-logo { width: 26mm; height: 26mm; border-radius: 50%; flex: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.bf-logo-sm { width: 18mm; height: 18mm; }
.bf-head-slim .bf-logo-sm { align-self: center; }
.bf-head h1 { margin: 0; font-size: 17pt; letter-spacing: .02em; }
.bf-contact { margin: .3mm 0 0; font-size: 8.5pt; color: #333; }
.bf-title { margin: .5mm 0 2mm; font-size: 11.5pt; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.bf-head-slim { align-items: flex-end; }
.bf-head-slim .bf-meta { width: 55mm; grid-template-columns: 1fr; }
.bf-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 3mm 6mm; max-width: 120mm; }
.bf-photo { width: 27mm; height: 33mm; border: 1px dashed #000; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 7.5pt; color: #555; flex: none; }
.bf-note { margin: 0 0 1mm; font-size: 8pt; color: #333; font-style: italic; }
.bf-h { font-size: 9.5pt; margin: 2.4mm 0 1.4mm; padding: .8mm 2mm; background: #e9e9e9; border-left: 3px solid #000; text-transform: uppercase; letter-spacing: .04em; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.bf-h small { text-transform: none; font-weight: 400; letter-spacing: 0; }
.bf-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.8mm 5mm; }
.bf-grid-2 { grid-template-columns: 1fr 1fr; }
.bf-grid .span-2 { grid-column: span 2; }
.bf-grid .span-3 { grid-column: span 3; }
.bf-grid .span-4 { grid-column: 1 / -1; }
.bf-field { display: flex; align-items: flex-end; gap: 1.5mm; min-width: 0; }
.bf-label { white-space: nowrap; font-size: 8.5pt; }
.bf-line { flex: 1; min-width: 8mm; border-bottom: 1px solid #000; height: 5mm; }
.bf-choices { align-items: flex-end; min-height: 5mm; }
.bf-choices .bf-options { display: flex; flex-wrap: nowrap; gap: 3mm; white-space: nowrap; }
.bf-choice { display: inline-flex; align-items: center; gap: 1.2mm; font-size: 8.5pt; }
.bf-box { display: inline-block; width: 3.2mm; height: 3.2mm; border: 1px solid #000; flex: none; }
.bf-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 8pt; }
.bf-table th, .bf-table td { border: 1px solid #000; padding: .8mm 1.5mm; text-align: left; vertical-align: top; }
.bf-table thead th { background: #f2f2f2; font-weight: 600; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.bf-table thead th:first-child { width: 25mm; }
.bf-table thead th:nth-child(3), .bf-table thead th:nth-child(4), .bf-table thead th:nth-child(5) { width: 26mm; }
.bf-table td.bf-na { background: #f2f2f2; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.bf-table tbody th { font-weight: 600; }
.bf-table tbody td, .bf-table tbody th { height: 7.5mm; }
.bf-split { display: grid; grid-template-columns: 1fr 1fr; gap: 6mm; }
.bf-checklist { list-style: none; margin: 0 0 1.5mm; padding: 0; display: grid; gap: 1.1mm; }
.bf-checklist li { display: flex; align-items: center; gap: 2mm; }
.bf-office { border: 1.5px solid #000; padding: 0 3mm 2.5mm; margin-top: 2.4mm; }
.bf-office .bf-h { margin-top: 2mm; }
.bf-foot { margin: auto 0 0; padding-top: 2mm; font-size: 7pt; color: #555; text-align: center; }

.bf-rules { font-size: 8.6pt; }
.bf-rule-cols { column-count: 2; column-gap: 7mm; }
.bf-rule-cols { margin-top: 1.5mm; }
.bf-rule-group { break-inside: avoid-column; padding-bottom: 1.5mm; }
.bf-rule-group .bf-h { margin-top: 0; }
.bf-rule-cols ol { margin: 0 0 1mm; padding-left: 6mm; }
.bf-rule-cols li { margin-bottom: .7mm; }
.bf-declare { margin: 0 0 1.5mm; line-height: 1.5; }
.bf-inline { display: inline-block; width: 45mm; border-bottom: 1px solid #000; }
.bf-dense { font-size: 8pt; }
.bf-dense .bf-rule-cols li { margin-bottom: .3mm; }
.bf-dense .bf-sign { margin-top: 6mm; }
.bf-denser { font-size: 7.3pt; }
.bf-denser .bf-rule-cols li { margin-bottom: 0; }
.bf-denser .bf-h { margin-bottom: .8mm; }
.bf-denser .bf-sign { margin-top: 5mm; }
.bf-sign { display: flex; gap: 8mm; margin-top: 8mm; }
.bf-sign div { flex: 1; font-size: 8pt; text-align: center; }
.bf-sign .bf-line { display: block; height: 0; margin-bottom: 1mm; }

@media (max-width: 860px) {
  .bf-page { width: auto; min-height: 0; margin: .5rem; padding: 1rem; }
}


/* ==========================================================================
   Dark mode — follows the system setting unless the user picks a theme with
   the topbar toggle (html[data-theme]). Only tokens flip.
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #f4f4f5; --ink-2: #d4d4d8; --ink-3: #a1a1aa;
    --canvas: #0b0c14; --panel: #1a1b26; --panel-2: rgba(255, 255, 255, .05);
    --glass: rgba(26, 27, 40, .80); --glass-strong: rgba(36, 38, 54, .85); --glass-edge: rgba(255, 255, 255, .09);
    --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .06);
    --fill: rgba(255, 255, 255, .07); --fill-strong: rgba(255, 255, 255, .13);
    --line: rgba(255, 255, 255, .16); --line-soft: rgba(255, 255, 255, .08); --field: rgba(255, 255, 255, .05);
    --primary: #818cf8; --primary-hover: #a5b4fc; --primary-soft: rgba(129, 140, 248, .16);
    --ok: #34d399; --ok-bg: rgba(52, 211, 153, .14);
    --warn: #fbbf24; --warn-bg: rgba(251, 191, 36, .14);
    --bad: #f87171; --bad-bg: rgba(248, 113, 113, .15);
    --info: #818cf8; --info-bg: rgba(129, 140, 248, .15);
    --muted: #a1a1aa; --muted-bg: rgba(255, 255, 255, .09);
    --brass: #fbbf24; --brass-soft: rgba(251, 191, 36, .14);
    --wash-1: rgba(99, 102, 241, .22); --wash-2: rgba(6, 182, 212, .14); --wash-3: rgba(236, 72, 153, .14); --wash-4: rgba(16, 185, 129, .10);
    --blob-1: rgba(99, 102, 241, .30); --blob-2: rgba(6, 182, 212, .18); --blob-3: rgba(236, 72, 153, .16); --blob-4: rgba(16, 185, 129, .12);
    --shadow-1: 0 10px 30px rgba(0, 0, 0, .30); --shadow-2: 0 12px 34px rgba(0, 0, 0, .35);
    --shadow-lift: 0 18px 40px rgba(0, 0, 0, .45); --shadow-pop: 0 30px 70px rgba(0, 0, 0, .6);
    --focus: 0 0 0 4px rgba(129, 140, 248, .28);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f4f4f5; --ink-2: #d4d4d8; --ink-3: #a1a1aa;
  --canvas: #0b0c14; --panel: #1a1b26; --panel-2: rgba(255, 255, 255, .05);
  --glass: rgba(26, 27, 40, .80); --glass-strong: rgba(36, 38, 54, .85); --glass-edge: rgba(255, 255, 255, .09);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .06);
  --fill: rgba(255, 255, 255, .07); --fill-strong: rgba(255, 255, 255, .13);
  --line: rgba(255, 255, 255, .16); --line-soft: rgba(255, 255, 255, .08); --field: rgba(255, 255, 255, .05);
  --primary: #818cf8; --primary-hover: #a5b4fc; --primary-soft: rgba(129, 140, 248, .16);
  --ok: #34d399; --ok-bg: rgba(52, 211, 153, .14);
  --warn: #fbbf24; --warn-bg: rgba(251, 191, 36, .14);
  --bad: #f87171; --bad-bg: rgba(248, 113, 113, .15);
  --info: #818cf8; --info-bg: rgba(129, 140, 248, .15);
  --muted: #a1a1aa; --muted-bg: rgba(255, 255, 255, .09);
  --brass: #fbbf24; --brass-soft: rgba(251, 191, 36, .14);
  --wash-1: rgba(99, 102, 241, .22); --wash-2: rgba(6, 182, 212, .14); --wash-3: rgba(236, 72, 153, .14); --wash-4: rgba(16, 185, 129, .10);
  --blob-1: rgba(99, 102, 241, .30); --blob-2: rgba(6, 182, 212, .18); --blob-3: rgba(236, 72, 153, .16); --blob-4: rgba(16, 185, 129, .12);
  --shadow-1: 0 10px 30px rgba(0, 0, 0, .30); --shadow-2: 0 12px 34px rgba(0, 0, 0, .35);
  --shadow-lift: 0 18px 40px rgba(0, 0, 0, .45); --shadow-pop: 0 30px 70px rgba(0, 0, 0, .6);
  --focus: 0 0 0 4px rgba(129, 140, 248, .28);
}
/* Component tweaks that tokens alone can't express (same list for both dark triggers). */
:root[data-theme="dark"] .alert-bad { background: rgba(127, 29, 29, .35); color: #fecaca; }
:root[data-theme="dark"] .alert-warn, :root[data-theme="dark"] .alert-sensitive { background: rgba(120, 53, 15, .35); color: #fde68a; }
:root[data-theme="dark"] .alert-info { background: rgba(49, 46, 129, .40); color: #c7d2fe; }
:root[data-theme="dark"] .med-flag { color: #fecaca; }
:root[data-theme="dark"] .side-badge { color: #f9a8d4; }
:root[data-theme="dark"] .delta-up { color: #34d399; } :root[data-theme="dark"] .delta-down { color: #f87171; }
:root[data-theme="dark"] .icon-btn .dot { box-shadow: 0 0 0 2px rgba(26, 27, 40, .9), 0 0 10px rgba(236, 72, 153, .6); }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .alert-bad { background: rgba(127, 29, 29, .35); color: #fecaca; }
  :root:not([data-theme="light"]) .alert-warn, :root:not([data-theme="light"]) .alert-sensitive { background: rgba(120, 53, 15, .35); color: #fde68a; }
  :root:not([data-theme="light"]) .alert-info { background: rgba(49, 46, 129, .40); color: #c7d2fe; }
  :root:not([data-theme="light"]) .med-flag { color: #fecaca; }
  :root:not([data-theme="light"]) .side-badge { color: #f9a8d4; }
  :root:not([data-theme="light"]) .delta-up { color: #34d399; } :root:not([data-theme="light"]) .delta-down { color: #f87171; }
  :root:not([data-theme="light"]) .icon-btn .dot { box-shadow: 0 0 0 2px rgba(26, 27, 40, .9), 0 0 10px rgba(236, 72, 153, .6); }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}
/* Paper keeps its ink-on-white look even at night — it is going to a printer. */
.paper { background: #fff; color: #1d1d1f; border-color: rgba(0, 0, 0, .1); }
.paper-head { border-bottom-color: #1d1d1f; }
.paper-sign div { border-top-color: #6e6e73; }
.receipt-grid dt { color: #6e6e73; }

/* ---------- Meters, share links (v1.7) ---------- */
.room-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem; margin-bottom: .75rem; }
.room-pick { display: flex; align-items: center; gap: .5rem; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2, #fff); cursor: pointer; }
.room-pick.is-on, .room-pick:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.room-pick span { display: flex; flex-direction: column; min-width: 0; }
.room-pick small { color: var(--ink-3); font-size: var(--fs-xs); }
.wa-preview { white-space: pre-wrap; word-break: break-word; font-family: var(--font); font-size: var(--fs-sm); background: var(--fill, rgba(0,0,0,.04));
  border: 1px solid var(--line-soft); border-radius: 14px; padding: 1rem; margin: 0 0 1rem; max-height: 340px; overflow: auto; }
.plain-list { margin: 0; padding-left: 1.1rem; display: grid; gap: .3rem; font-size: var(--fs-sm); color: var(--ink-2); }

/* ==========================================================================
   Neo Glass skin for the remaining v1.x components (rack, docs, menus, auth,
   portal, stats). Kept last so it wins over the base rules above.
   ========================================================================== */
.facts dt, .credential dt { font-size: 10.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--ink-3); }
.facts dd { font-weight: 500; }
.progress { background: var(--fill); }
.progress > span { background: var(--grad); }
.timeline li.is-current::before { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.stepper li { border-top-width: 4px; font-weight: 600; }
.stepper li.done, .stepper li.current { border-image: var(--grad) 1; }
.empty { padding: 2.5rem 1.25rem; font-weight: 500; }

/* Room board keys */
.rack { gap: 12px; }
.rack-floor { font-size: 10px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--ink-3); }
.key { border-radius: 16px; background: var(--panel-2); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-1), var(--glass-hi); padding: 12px; }
.key:hover { box-shadow: var(--shadow-lift), var(--glass-hi); transform: translateY(-3px); }
.key-no { font-weight: 800; }
.key-type { font-weight: 700; }
.pip { border-radius: 5px; border-color: var(--line); }
.pip-on { background: var(--grad); border-color: transparent; }
.key-full { background: rgba(79, 70, 229, .07); }
.key-maintenance { background: repeating-linear-gradient(-45deg, var(--panel-2), var(--panel-2) 7px, var(--warn-bg) 7px, var(--warn-bg) 14px); }
.bed { background: var(--panel-2); border-color: var(--glass-edge); border-radius: 16px; }
.bed-label { border-radius: 11px; font-weight: 800; }
.bed-taken .bed-label { background: var(--grad); }

/* Documents & lists */
.doc { padding: 12px 22px; }
.doc-title { font-weight: 700; font-size: 13px; color: var(--ink); text-decoration: none; }
a.doc-title:hover { color: var(--primary); }
.doc-icon { border-radius: 10px; font-weight: 800; background: var(--primary-soft); color: var(--primary); }
.checklist li[class^="check-"] { padding-inline: 22px; }
.portal-list li { padding: 12px 22px; }

/* Menus */
.menu-list { border-radius: 16px; border-color: var(--glass-edge); padding: 6px; background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.menu-list a, .menu-list button { border-radius: 10px; font-size: 13px; font-weight: 600; }
.menu-list a:hover, .menu-list button:hover { background: var(--grad); color: #fff; }
.menu > summary.row-btn, .row-btn {
  width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 9px;
  border: 1px solid var(--line-soft); background: var(--panel-2); color: var(--ink-3); cursor: pointer;
}
.row-btn:hover { background: var(--panel); color: var(--ink); }

/* Stats & payment blocks */
.stat { border-radius: var(--r-lg); padding: 16px 18px; background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-1), var(--glass-hi); }
.stat-label { font-size: 11.5px; font-weight: 600; }
.stat-value { font-weight: 800; }
.pay-item { background: var(--panel-2); border-color: var(--glass-edge); border-radius: 14px; }
.quick-admit { border-radius: 16px; background: var(--ok-bg); border-color: rgba(16, 185, 129, .25); }
.apk-bar span { background: var(--grad); }
.room-pick { background: var(--panel-2); border-color: var(--line-soft); border-radius: 13px; }
.wa-preview { background: var(--panel-2); border-color: var(--glass-edge); }

/* Auth pages */
.auth-body { position: relative; }
.auth-body > *:not(.bg-blobs) { position: relative; z-index: 2; }
.auth-card { background: var(--glass); border: 1px solid var(--glass-edge); border-radius: var(--r-2xl); box-shadow: var(--shadow-pop), var(--glass-hi); }
.auth-card .btn-primary { padding: 12px 18px; font-size: 13px; }
.auth-brand { font-weight: 800; letter-spacing: -.03em; }
.auth-logo { border-radius: 28px; box-shadow: 0 16px 36px rgba(79, 70, 229, .30), 0 0 0 1px rgba(255, 255, 255, .7); }
.error-code { font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; opacity: 1; }
.apply-head { background: var(--glass); border-color: var(--glass-edge); box-shadow: var(--shadow-2), var(--glass-hi); }
.apply-logo { border-radius: 18px; }

/* Resident portal */
.portal-body { position: relative; }
.portal-top, .portal-nav, .portal-main { position: relative; z-index: 5; }
.portal-top { margin: 14px auto 0; max-width: 760px; width: calc(100% - 28px); padding: 10px 14px; border-radius: var(--r-xl); border: 1px solid var(--glass-edge); background: var(--glass); box-shadow: var(--shadow-1), var(--glass-hi); }
.portal-brand { font-weight: 800; }
.portal-nav { top: 10px; margin: 10px auto 0; max-width: 760px; width: calc(100% - 28px); padding: 5px; border-radius: 16px; border: 1px solid var(--glass-edge); background: var(--glass-strong); z-index: 10; }
.portal-nav a { font-weight: 700; border-radius: 12px; }
.portal-nav a[aria-current="page"] { background: var(--grad); color: #fff; box-shadow: 0 6px 14px rgba(79, 70, 229, .3); }
.portal-balance { background: var(--glass); border-color: var(--glass-edge); border-radius: var(--r-xl); box-shadow: var(--shadow-2), var(--glass-hi); }
.portal-balance-amount { font-weight: 800; }
.portal-balance-label { font-weight: 600; }

/* Auth / portal / apply pages: the wash comes from the fixed .bg-blobs layer. */
.auth-body, .portal-body { background: var(--canvas); background-attachment: scroll; }

/* ---------- Document ticks ---------- */
.doc-ticks { display: inline-flex; flex-wrap: nowrap; gap: 4px; margin-left: 6px; vertical-align: middle; }
td .doc-ticks { display: flex; margin: 6px 0 0; }
.dt { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px 2px 5px; border-radius: 7px; font-size: 10.5px; font-weight: 700; line-height: 1.4; white-space: nowrap; }
.dt .icon { width: 12px; height: 12px; stroke-width: 3; }
.dt-ok { background: var(--ok-bg); color: var(--ok); }
.dt-no { background: var(--bad-bg); color: var(--bad); }
.dt-wait { background: var(--warn-bg); color: var(--warn); }
.menu-list a.menu-docs { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.menu-list a.menu-docs .doc-ticks { margin: 0; }
.menu-list a.menu-docs:hover .dt { background: rgba(255, 255, 255, .22); color: #fff; }
.cell-stack { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.cell-stack .doc-ticks { margin: 0; }
@media (max-width: 860px) { .table-stack .cell-stack { align-items: flex-end; } .table-stack td .doc-ticks { justify-content: flex-end; } }

/* ---------- Photo editor ---------- */
.subject-photo { position: relative; flex: none; }
.photo-edit {
  position: absolute; right: -6px; bottom: -6px; width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 10px; border: 2px solid var(--panel); background: var(--grad); color: #fff; cursor: pointer;
  box-shadow: 0 6px 14px rgba(79, 70, 229, .35); transition: transform .2s var(--ease);
}
.photo-edit .icon { width: 14px; height: 14px; stroke-width: 2.2; }
.photo-edit:hover { transform: scale(1.08); }
.modal-crop { width: min(420px, calc(100vw - 1.5rem)); }
.crop-stage { position: relative; display: grid; place-items: center; background: repeating-conic-gradient(var(--fill) 0% 25%, transparent 0% 50%) 0 0 / 18px 18px; border-radius: 18px; overflow: hidden; min-height: 240px; touch-action: none; }
.crop-stage canvas { display: block; cursor: grab; max-width: 100%; }
.crop-stage canvas:active { cursor: grabbing; }
.crop-empty { position: absolute; margin: 0; color: var(--ink-3); font-weight: 600; font-size: 13px; }
.crop-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.crop-zoom { flex: 1; min-width: 140px; display: flex; align-items: center; gap: 8px; color: var(--ink-3); }
.crop-zoom input { flex: 1; accent-color: var(--primary); }
.crop-tools .btn { cursor: pointer; }

/* ---------- Attendance ---------- */
.moves { display: flex; flex-wrap: wrap; gap: 4px; }
.move { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 8px; font-size: 10.5px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.move-in { background: var(--ok-bg); color: var(--ok); }
.move-out { background: var(--muted-bg); color: var(--ink-2); }
.move-late { background: var(--bad-bg); color: var(--bad); box-shadow: inset 0 0 0 1px rgba(239, 68, 68, .25); }
.doc.punch { grid-template-columns: auto minmax(0, 1fr) auto; }
.row-void-li { opacity: .55; }
.row-void-li .doc-title { text-decoration: line-through; }
.token-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0 0; }
.token-row .code { font-size: 13px; padding: 6px 10px; background: var(--panel); border-radius: 8px; user-select: all; }
@media (max-width: 860px) { .table-stack td .moves { justify-content: flex-end; } }
.nowrap { white-space: nowrap; }

/* Filter bars fold away on phones (app.js adds the toggle). */
.filters-toggle { display: none; }
@media (max-width: 860px) {
  .filters.can-fold .filters-toggle { display: inline-flex; }
  .filters.can-fold.is-folded .filter-extra { display: none; }
  .filters .field, .filters .field-grow { min-width: 0; flex: 1 1 140px; }
  .filters .field-grow { flex-basis: 100%; }
}
.crop-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.crop-head .badge::before { content: none; }
.modal-crop { width: min(440px, calc(100vw - 1.5rem)); }
.doc-thumb { width: 38px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--fill); display: block; }

/* ---------- Integrations ---------- */
.hook { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 14px; padding: 16px 22px; border-bottom: 1px solid var(--line-soft); }
.hook:last-child { border-bottom: 0; }
.hook-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hook-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.hook-url { overflow-wrap: anywhere; color: var(--ink-2); }
.hook-events { display: flex; flex-wrap: wrap; gap: 4px; }
.hook-edit { grid-column: 1 / -1; border-top: 1px dashed var(--line-soft); padding-top: 8px; }
.hook-edit > summary { cursor: pointer; font-size: 12px; font-weight: 700; color: var(--primary); }
.hook-edit[open] > summary { margin-bottom: 10px; }
.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.event-box { align-items: flex-start !important; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 11px; background: var(--panel-2); cursor: pointer; }
.event-box input { margin-top: 3px; }
.event-box span { display: flex; flex-direction: column; }
.event-box strong { font-size: 11.5px; font-family: var(--mono); font-weight: 600; color: var(--ink); }
.event-box small { font-size: 11px; color: var(--ink-3); }
.event-box:has(input:checked) { border-color: rgba(79, 70, 229, .4); background: var(--primary-soft); }
.payload-box { min-width: min(460px, 86vw); max-width: 86vw; }
.payload-box .wa-preview { font-family: var(--mono); font-size: 11px; margin: 0; }
@media (max-width: 600px) { .hook { grid-template-columns: 1fr; padding: 14px 18px; } .hook .doc-actions { justify-content: flex-start; } }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 22px; border-bottom: 1px solid var(--line-soft); background: var(--panel-2); }
.bulk-bar .input { flex: 1 1 200px; max-width: 320px; }
.table .col-check { width: 36px; padding-right: 0; }
.col-check input { width: 16px; height: 16px; }
@media (max-width: 860px) { .table-stack td.col-check { justify-content: flex-start; padding-bottom: 0; } }
.field label.event-box, .event-box * { text-transform: none; letter-spacing: 0; }
.event-box small { font-weight: 500; }
.subnote { margin: .75rem 0 .35rem; }
.quick-received { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; font-size: 14px; }
.quick-received small { color: var(--ink-3); font-size: 11.5px; }

/* Quick-receive payment modal + residents table columns.
   Kept here (not inline) because CSP is `style-src 'self'` — inline
   <style> blocks and style="" attributes are blocked by the browser. */
.modal-form { display: contents; }
.qr-btn { padding: 1px 8px; font-size: .78em; margin-top: 3px; }
#qr-modal .modal-body { gap: 1.1rem; }
#qr-modal .qr-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
#qr-modal #qr-close { flex-shrink: 0; margin-top: -2px; }
#qr-modal #qr-hint { margin-top: -8px; }
#qr-modal .form-footer { border-radius: 0 0 var(--r-2xl) var(--r-2xl); }
#qr-ref-field { display: none; }
#qr-ref-field.show { display: flex; }
@media (max-width: 1199px) { .col-phone { display: none !important; } }
@media (max-width: 899px)  { .col-room  { display: none !important; } }
