/*
| NasGate — dashboard stylesheet.
|
| Hand-written semantic CSS (no build step): the views use classes like .btn,
| .field, .panel, .table-wrap, .pill — never utility soup. Served straight from
| public/ and cache-busted by assetVersion() in the layout.
|
| The two brand colours are per-install settings, so :root gets --brand and
| --secondary from an inline <style> in layouts/app.blade.php; everything here
| derives from them. Prefer logical properties (inline-start/end, text-align:
| start) so LTR and RTL share one set of rules.
*/

:root {
    --bg: #f5f6f8;
    --card: var(--surface);
    --ink: #1a1d23;
    --muted: #6a707c;
    --muted-2: #9aa5b1;
    --line: #e3e6ea;
    /* --brand / --secondary come from the layout (theme settings). */
    --brand-50: color-mix(in srgb, var(--brand) 10%, var(--surface));
    --brand-100: color-mix(in srgb, var(--brand) 18%, var(--surface));
    --brand-ink: #ffffff;
    /* The brand AS text on a light surface (darkened for contrast by brandPalette()). */
    --brand-text: var(--brand);
    /* Secondary accent scale, derived from the `secondary` theme setting. */
    --secondary-50: color-mix(in srgb, var(--secondary) 12%, var(--surface));
    --secondary-100: color-mix(in srgb, var(--secondary) 22%, var(--surface));
    --secondary-ink: #ffffff;
    /* Status colours: fixed, never follow the brand (NasGate brand guidelines). */
    --danger: #a12d22;
    --danger-bg: #f9e3e0;
    --danger-line: #ebc7c2;
    --success: #1f6b41;
    --success-ink: #ffffff;
    --success-bg: #e3f2ea;
    --warn: #8a5a0b;
    --warn-bg: #fbf0dc;
    --info: #22539f;
    --info-bg: #e2ecfb;

    /* Console chrome: the NasGate sidebar is the platform's, not the tenant's,
       so it keeps these whatever theme colours a tenant picks. */
    --console-bg: #14100c;
    --console-ink: #f4f4f2;
    --console-muted: rgba(244, 244, 242, .5);
    --console-line: rgba(255, 255, 255, .08);
    --console-hover: rgba(255, 255, 255, .06);
    --console-accent: #f1bd19;
    --console-on-accent: #14100c;

    /* Surfaces. Kept separate from --card so a dark theme can flip them as a set. */
    --surface: #ffffff;
    --surface-2: #f3f5f7;
    --surface-3: #fafbfc;
    --surface-4: #eef0f3;
    --control-off: #d3d9df;

    /* Alias: some views reference --border; --line is the real token. */
    --border: var(--line);

    /* Focus ring, derived so it follows the install's brand colour. */
    --ring: color-mix(in srgb, var(--brand) 22%, transparent);

    --font-sans: 'Montserrat', 'Cairo', ui-sans-serif, system-ui, -apple-system,
        'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

    /* Spacing scale. Use these rather than ad-hoc pixel values in views. */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;

    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius: var(--radius-lg);

    --shadow-sm: 0 1px 2px rgba(27, 36, 48, .04);
    --shadow-md: 0 4px 16px rgba(27, 36, 48, .06);
    --shadow-lg: 0 14px 40px rgba(27, 36, 48, .12);

    --container: 1280px;
    --topbar-h: 63px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }

/* One visible focus treatment for everything reachable by keyboard. Scoped to
   :focus-visible so a mouse click never draws it. */
:where(a, button, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Anything that reads as "switched off" — a paginator edge, a delete that is
   not allowed. Replaces the inline opacity/pointer-events pairs in the views. */
.is-disabled, [aria-disabled="true"] {
    opacity: .45;
    pointer-events: none;
    cursor: not-allowed;
}

/* ---------- Auth (login) ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.card {
    width: 100%; max-width: 420px; background: var(--card);
    border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(27, 36, 48, 0.06); padding: 44px 40px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.card .brand { margin-bottom: 28px; gap: 11px; }
/* Legacy .dot: used by any surface not yet migrated to <x-brand>. */
.brand .dot {
    width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
    background: var(--brand); color: var(--brand-ink);
    display: grid; place-items: center; font-weight: 700;
}
.brand .name { font-weight: 700; font-size: 1.05rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand .dot img { width: 100%; height: 100%; object-fit: contain; border-radius: var(--radius-sm); }
.brand .dot:has(img) { background: var(--surface); padding: 3px; }
/* Logo mark — SVG component used by <x-brand> and the central sidebar. */
.brand-logo { flex: 0 0 auto; display: block; }
.brand-logo--img {
    width: 36px; height: 36px; border-radius: 10px; overflow: hidden;
    background: var(--surface); display: grid; place-items: center; padding: 3px;
}
.brand-logo--img img { width: 100%; height: 100%; object-fit: contain; border-radius: var(--radius-sm); }
h1 { font-size: 1.35rem; margin: 0 0 4px; }
.sub { color: var(--muted); font-size: .9rem; margin: 0 0 24px; }
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; }
.field {
    width: 100%; padding: 11px 13px; font-size: .95rem;
    border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
    outline: none; transition: border-color .15s, box-shadow .15s;
}
.field:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }

/* Password reveal. app.js wraps every <input type="password"> in .password-field
   and appends the eye button; the input keeps its own styling and only gives up
   room on its trailing edge, so the toggle sits inside the control in LTR and RTL
   alike. */
.password-field { position: relative; display: block; min-width: 0; }
.password-field > input { padding-inline-end: 42px; }
.password-reveal {
    position: absolute; inset-inline-end: 5px; inset-block-start: 50%;
    transform: translateY(-50%);
    display: flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; padding: 0;
    border: 0; border-radius: 8px; background: none; cursor: pointer;
    color: var(--muted-2); transition: color .15s, background .15s;
}
.password-reveal:hover { color: var(--ink); background: var(--surface-2); }
.password-reveal:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; color: var(--ink); }
.password-reveal svg { width: 18px; height: 18px; }
.row { margin-bottom: 18px; }
.check { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); font-weight: 400; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.btn {
    border: 0; cursor: pointer; padding: 12px 16px; background: var(--brand);
    color: var(--brand-ink); font-weight: 600; font-size: .95rem; border-radius: 10px;
    transition: filter .15s;
}
.btn:hover { filter: brightness(1.06); }
/* Disabled — e.g. a form's submit before anything in it changed (public/js/app.js). */
.btn:disabled, .btn:disabled:hover { opacity: .5; cursor: not-allowed; filter: none; }
.btn.block { width: 100%; }
.btn.secondary { background: var(--secondary); color: var(--secondary-ink); }
.btn.secondary:hover { filter: brightness(1.06); }
/* Soft/tinted secondary — for lower-emphasis accent actions. */
.btn.secondary-soft { background: var(--secondary-50); color: var(--secondary); border: 1px solid var(--secondary-100); }
.btn.secondary-soft:hover { background: var(--secondary-100); filter: none; }
.error { color: var(--danger); font-size: .82rem; margin-top: 6px; }
.alert {
    background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-line);
    padding: 10px 12px; border-radius: 10px; font-size: .85rem; margin-bottom: 18px;
}

/* A standalone notice on the auth background — the suspended-community page.
   Shares the login card's box; centres its contents rather than the form's
   left-aligned labels. */
/* Brand on one side, language toggle on the other, above a login form. */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: 24px; }
.card-head .brand { margin-bottom: 0; }

.card.notice { text-align: center; }
.card.notice .alert { text-align: start; margin-bottom: 0; }
.card.notice .notice-icon {
    width: 48px; height: 48px; margin: 0 auto var(--space-4); border-radius: 50%;
    display: grid; place-items: center; color: var(--danger); background: var(--danger-bg);
}
.card.notice .notice-icon svg { width: 24px; height: 24px; }
.card.notice .notice-foot { font-size: .82rem; margin: var(--space-4) 0 0; }

/* Arabic: Cairo first, so Latin fragments inside Arabic text still use Montserrat. */
[dir="rtl"] { --font-sans: 'Cairo', 'Montserrat', ui-sans-serif, system-ui, -apple-system,
    'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; }

/* ---------- Dashboard shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: clamp(260px, 30vw, 380px); flex: 0 0 clamp(260px, 30vw, 380px); background: var(--console-bg); color: var(--console-ink);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.sidebar-head { padding: 20px 20px 16px; }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; overscroll-behavior: contain; scrollbar-color: rgba(255, 255, 255, .18) transparent; }
.nav-group { margin-bottom: 14px; }
.nav-group h6 {
    margin: 0 0 4px; padding: 0 10px; font-size: .68rem; letter-spacing: .06em;
    text-transform: uppercase; color: var(--console-muted); font-weight: 700;
}
.nav-item {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
    color: var(--console-ink); opacity: .78; font-size: .87rem; font-weight: 500; margin-bottom: 2px;
    transition: background .12s, opacity .12s;
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 auto; }
.nav-item:hover { background: var(--console-hover); opacity: 1; }
.nav-item.active { background: var(--console-accent); color: var(--console-on-accent); opacity: 1; font-weight: 600; }
.sidebar-foot { padding: 14px 20px 18px; border-top: 1px solid var(--console-line); }

/* Platform brand (top of the sidebar): NasGate mark + "Nas" light / "Gate" bold. */
.platform-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.platform-brand .platform-logo { height: 30px; width: auto; max-width: 120px; object-fit: contain; flex: 0 0 auto; }
.platform-brand .nasgate-mark { flex: 0 0 auto; }
.platform-brand .wordmark { font-size: 1.1rem; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.platform-brand .wordmark .n { font-weight: 300; color: var(--console-accent); }
.platform-brand .wordmark .g { font-weight: 600; color: var(--console-ink); }

/* "A product of" + the company mark, at the foot of the sidebar. */
.product-of { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
.product-of .label { font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; color: rgba(255, 255, 255, .7); }
.product-of img { height: 24px; width: auto; max-width: 140px; object-fit: contain; }
.product-of .vendor-name { font-weight: 600; font-size: .95rem; }
.dotshub-logo { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 3px; line-height: 1; }
.dotshub-logo .dots { display: inline-flex; gap: 3px; }
.dotshub-logo .dots i { width: 5px; height: 5px; border-radius: 50%; display: inline-block; }
.dotshub-logo .dots i:nth-child(1) { background: #f9510e; }
.dotshub-logo .dots i:nth-child(2) { background: #6eb008; }
.dotshub-logo .dots i:nth-child(3) { background: #068be0; }
.dotshub-logo .dots i:nth-child(4) { background: #f1c007; }
.dotshub-logo .word { font-size: 15px; letter-spacing: -.2px; white-space: nowrap; direction: ltr; }
.dotshub-logo .light { font-weight: 300; }
.dotshub-logo .bold { font-weight: 700; }

/* Topbar: whose console this is (tenant logo + name). */
.console-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.console-logo { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; overflow: hidden; }
.console-logo img { width: 100%; height: 100%; object-fit: contain; }
.console-name { display: flex; flex-direction: column; min-width: 0; }
.console-name strong { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.console-name small { color: var(--muted); font-size: .76rem; }

/* Page breadcrumb + title, at the top of the content (moved out of the topbar). */
.page-crumb { display: flex; align-items: center; gap: 6px; margin-bottom: var(--space-4); font-size: .82rem; color: var(--muted); }
.page-crumb svg { width: 14px; height: 14px; }
.page-crumb strong { color: var(--ink); font-weight: 600; }
[dir="rtl"] .page-crumb svg { transform: scaleX(-1); }

/* Mobile nav: hamburger (in the topbar) + off-canvas backdrop. Both are
   hidden on desktop and revealed in the ≤860px media query below. */
.menu-toggle {
    display: none; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 10px; margin-inline-end: 12px;
    border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer;
}
.menu-toggle svg { width: 20px; height: 20px; }
.nav-backdrop { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    background: var(--card); border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px; position: sticky; top: 0; z-index: 20; min-height: var(--topbar-h);
}
.topbar-title { display: flex; align-items: center; min-width: 0; }
.topbar h1 { font-size: 1.15rem; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .crumb { color: var(--muted-2); font-size: .78rem; margin-top: 2px; }
.content { padding: var(--space-5) var(--space-5) var(--space-6); }
.container { max-width: var(--container); margin: 0 auto; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.muted { color: var(--muted); }

.avatar {
    width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto; overflow: hidden;
    background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; font-size: .9rem;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar:has(img) { background: transparent; }

/* Topbar actions (language toggle + profile) */
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.lang-toggle { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); overflow: hidden; }
.lang-toggle a { padding: 6px 12px; font-size: .8rem; font-weight: 600; line-height: 1; color: var(--muted); transition: background .12s, color .12s; }
.lang-toggle a.active { background: var(--brand); color: var(--brand-ink); }
.lang-toggle a:not(.active):hover { background: var(--surface-2); color: var(--ink); }

/* Profile dropdown (native <details>) */
details.profile { position: relative; }
details.profile > summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
    padding-block: 5px; padding-inline: 5px 8px; border-radius: 999px; border: 1px solid var(--line);
}
details.profile > summary::-webkit-details-marker { display: none; }
details.profile > summary:hover { background: var(--surface-2); }
details.profile .pname { font-size: .88rem; font-weight: 600; }
details.profile .chev { width: 15px; height: 15px; color: var(--muted-2); }
details.profile .menu {
    position: absolute; inset-inline-end: 0; top: calc(100% + 8px); width: 210px; background: var(--surface);
    border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
    padding: 6px; z-index: 30;
}
details.profile .menu a, details.profile .menu button {
    display: flex; align-items: center; gap: 10px; width: 100%; text-align: start;
    padding: 9px 10px; border-radius: 8px; font-size: .88rem; color: var(--ink);
    background: none; border: 0; cursor: pointer; font-family: inherit;
}
details.profile .menu a:hover, details.profile .menu button:hover { background: var(--surface-2); }
details.profile .menu svg { width: 16px; height: 16px; color: var(--muted); }
details.profile .menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
details.profile .menu .danger { color: var(--danger); }
details.profile .menu .danger svg { color: var(--danger); }

/* Stat cards + placeholder */
.grid { display: grid; gap: 16px; }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) {
    .grid.c3 { grid-template-columns: 1fr; }
    .menu-toggle { display: inline-flex; }
    /* Sidebar becomes an off-canvas drawer sliding in from the start side. */
    .sidebar {
        position: fixed; top: 0; inset-inline-start: 0; z-index: 50; height: 100vh;
        width: min(300px, 85vw); flex-basis: auto;
        transform: translateX(-100%); transition: transform .22s ease;
        box-shadow: 0 10px 40px rgba(15, 23, 32, .22);
    }
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    body.nav-open .sidebar { transform: translateX(0); }
    .nav-backdrop {
        display: block; position: fixed; inset: 0; z-index: 40;
        background: rgba(15, 23, 32, .45);
        opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
    }
    body.nav-open .nav-backdrop { opacity: 1; visibility: visible; }
}
.stat { border-inline-start: 3px solid var(--secondary); display: block; padding: 18px 20px; }
.stat .k { color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: 7px; }
.stat .k svg { width: 15px; height: 15px; flex: 0 0 auto; }
.stat .v { font-size: 1.8rem; font-weight: 700; margin-top: 4px; color: var(--secondary); line-height: 1.15; }
.stat .sub { font-size: .8rem; margin-top: 2px; }
/* A stat you can drill into: the whole card is the link to its filtered list. */
a.stat-link { transition: border-color .12s, box-shadow .12s, transform .12s; }
a.stat-link:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat.tone-warn { border-inline-start-color: var(--warn); }
.stat.tone-warn .v { color: var(--warn); }
.stat.tone-danger { border-inline-start-color: var(--danger); }
.stat.tone-danger .v { color: var(--danger); }
.badge { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--brand-text); background: var(--brand-50); padding: 3px 8px; border-radius: 999px; }
.badge.secondary { color: var(--secondary); background: var(--secondary-50); }

.placeholder { text-align: center; padding: 56px 24px; }
.placeholder p { margin: 0 auto; max-width: 46ch; }
.placeholder .cta { margin-top: 18px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.placeholder .ic {
    width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 16px; background: var(--brand-50);
    color: var(--brand-text); display: grid; place-items: center;
}
.placeholder .ic svg { width: 28px; height: 28px; }
.placeholder h2 { margin: 0 0 6px; font-size: 1.2rem; }

/* Tabs — the settings group navigation. */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tabs a { padding: 10px 14px; font-size: .9rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--brand-text); border-bottom-color: var(--brand); font-weight: 600; }

/* ---------- Page header + toolbar ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
/* A second heading further down a page (a table below a detail panel). */
.page-head.stacked { margin-top: var(--space-5); }
/* A status pill sitting inside a page title. */
.page-head h2 .title-pill { margin-inline-start: 8px; vertical-align: middle; }
.page-head .lead h2 { margin: 0 0 2px; font-size: 1.2rem; }
.page-head .lead p { margin: 0; }
.page-head .actions { display: flex; gap: 8px; align-items: center; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .field { max-width: 300px; }

/* ---------- Data table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 640px; }
table.data th, table.data td {
    text-align: start; padding: 12px 16px; border-bottom: 1px solid var(--line);
    white-space: nowrap; vertical-align: middle;
}
table.data thead th {
    background: var(--surface-3); color: var(--muted); font-weight: 600;
    font-size: .74rem; text-transform: uppercase; letter-spacing: .04em;
}
table.data tbody tr:last-child td { border-bottom: 0; }
/* A brand tint rather than grey, so hover reads as "this row is live" and does
   not collide with the header's own grey. */
table.data tbody tr:hover { background: color-mix(in srgb, var(--brand) 4%, var(--surface)); }
table.data td .sub { color: var(--muted-2); font-size: .8rem; }
/* Two lines in one cell — a name over the kind of thing it is. */
table.data td .cell-stack { display: flex; flex-direction: column; }
table.data td.nowrap, table.data td .nowrap { white-space: nowrap; }

/* Column + cell modifiers. `.col-actions` replaces the inline text-align:right
   that every index used to carry — `end` flips correctly under RTL. */
.col-actions { text-align: end; }
.col-num { text-align: end; font-variant-numeric: tabular-nums; }
table.data td.wrap, table.data th.wrap { white-space: normal; }
.truncate { display: inline-block; max-width: 28ch; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; white-space: nowrap; }
/* Denser rows for long, scannable logs. */
table.data.compact th, table.data.compact td { padding: 9px 14px; font-size: .85rem; }
/* Numbers line up column-wise wherever they are stacked. */
table.data, .stat .v, .pagination { font-variant-numeric: tabular-nums; }
.cell-main { display: flex; align-items: center; gap: 11px; }
.thumb { width: 36px; height: 36px; border-radius: 9px; flex: 0 0 auto; background: var(--brand-50);
    color: var(--brand-text); display: grid; place-items: center; font-weight: 700; font-size: .85rem; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
/* A pill with no tone is still a pill — before, a toneless status (a submitted
   request, an active pass) rendered as bare text. */
.pill {
    display: inline-block; font-size: .72rem; font-weight: 600; padding: 3px 10px;
    border-radius: 999px; text-transform: capitalize;
    color: var(--muted); background: var(--surface-4); border: 1px solid transparent;
}
.pill.on { color: var(--success); background: var(--success-bg); }
.pill.off { color: var(--muted); background: var(--surface-4); }
.pill.info { color: var(--info); background: var(--info-bg); }
.pill.danger { color: var(--danger); background: var(--danger-bg); }
/* Emitted by VisitPassStatus::INSIDE and ActivityEvent::tone(); previously
   undefined, so those pills rendered with no tone at all. */
.pill.warn { color: var(--warn); background: var(--warn-bg); }
/* `.row-actions` sits on the <td> itself in every index. `display: flex` there
   takes the cell out of table layout: it stops honouring its column's width and
   stops painting the row's bottom border, which only becomes visible once a row
   carries more than a button or two. Laying the children out inline keeps the
   cell a cell and looks identical. */
.row-actions { white-space: nowrap; text-align: end; }
.row-actions > * { display: inline-flex; vertical-align: middle; }
.row-actions > * + * { margin-inline-start: 6px; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
    border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger-line); background: var(--danger-bg); }

/* Button variants */
.btn.sm { padding: 8px 13px; font-size: .85rem; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--surface-2); filter: none; }
.btn.danger { background: var(--danger); }
.btn svg { width: 16px; height: 16px; vertical-align: -3px; margin-inline-end: 5px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.form-grid .col-span-2 { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.hint { color: var(--muted-2); font-size: .78rem; margin-top: 6px; }
/* A native colour swatch needs room; the default input padding squashes it. */
.color-field { height: 44px; padding: 4px; }
.field-group { min-width: 0; }
/* The required marker used to be rendered in the muted grey — invisible as a
   signal. It is the one thing in the label that should catch the eye. */
.field-group label .req { color: var(--danger); margin-inline-start: 2px; font-weight: 700; }
.translatable-field .locales { display: flex; gap: 14px; }
.translatable-field .loc { flex: 1; min-width: 0; }
.translatable-field .loc-label {
    display: block; font-size: .72rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .04em; color: var(--muted-2); margin-bottom: 4px;
}
@media (max-width: 720px) { .translatable-field .locales { flex-direction: column; gap: 10px; } }
textarea.field { resize: vertical; min-height: 90px; font-family: inherit; }
select.field { appearance: none; background: var(--surface); }
.logo-field { display: flex; align-items: center; gap: 14px; }
.logo-field .thumb { width: 56px; height: 56px; border-radius: 12px; font-size: 1.15rem; }

/* ---------- Role permission picker ---------- */
/* One fieldset per permission group, auto-fitting into as many columns as the
   panel allows. Shared by the dashboard's staff roles and the control plane's
   operator roles. */
.perm-heading { margin: 20px 0 4px; }
.perm-lede { margin: 0 0 14px; }
.perm-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.perm-group { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px 14px; }
.perm-group > legend { padding: 0 6px; display: flex; align-items: center; gap: 10px; width: 100%; }
.perm-group-name { font-weight: 600; font-size: .85rem; }
.perm-group-all {
    display: inline-flex; align-items: center; gap: 5px; font-weight: 400;
    font-size: .72rem; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.perm-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; font-weight: 400; }

/* ---------- Toggle switch (reusable for any boolean/checkbox) ---------- */
/* Rendered by the x-toggle Blade component — a hidden checkbox drives a sliding pill. */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; margin-top: 4px; }
.switch > input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
    position: relative; width: 46px; height: 26px; flex: 0 0 auto; border-radius: 999px;
    background: var(--control-off); transition: background .18s ease;
}
.switch .track::after {
    content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%;
    background: var(--surface); box-shadow: 0 1px 3px rgba(27, 36, 48, .25); transition: inset-inline-start .18s ease;
}
.switch > input:checked + .track { background: var(--brand); }
.switch > input:checked + .track::after { inset-inline-start: 23px; }
.switch > input:focus-visible + .track { box-shadow: 0 0 0 3px var(--brand-100); }
.switch > input:disabled + .track { opacity: .5; cursor: not-allowed; }
.switch .switch-label { font-size: .9rem; font-weight: 500; color: var(--ink); }

/* ---------- Tom Select (searchable dropdowns) — themed to match .field ---------- */
/* The original <select class="field"> is hidden; Tom Select copies its classes to the
   wrapper, so neutralize the .field box on the wrapper and re-apply it to .ts-control. */
.ts-wrapper.field { padding: 0; border: 0; background: transparent; }
/* High specificity (4 classes) so Tom Select's own .multi/.rtl padding
   rules don't win; logical padding auto-flips for RTL. */
.ts-wrapper.field.single .ts-control,
.ts-wrapper.field.multi .ts-control {
    border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
    padding-block: 10px; font-size: .95rem; min-height: 44px;
    /* !important beats Tom Select's own `.ts-control:not(.rtl) { padding-right: … !important }`
       (its rtl class is on the wrapper, not the control, so it mis-fires in RTL). */
    padding-inline-start: 13px !important; padding-inline-end: 13px !important;
    box-shadow: none; color: var(--ink); cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
/* Single-select caret + room for it at the inline-end (flips in RTL). */
.ts-wrapper.field.single .ts-control {
    padding-inline-end: 34px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7784' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}
[dir="rtl"] .ts-wrapper.field.single .ts-control { background-position: left 12px center; }
.ts-wrapper.focus .ts-control { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.ts-wrapper.disabled .ts-control { opacity: .55; background: var(--bg); cursor: not-allowed; }
.ts-wrapper .ts-control input { font-size: .95rem; color: var(--ink); }
.ts-wrapper .ts-control input::placeholder { color: var(--muted-2); }
.ts-wrapper.single .ts-control > .item { line-height: 1.4; }
/* Filter bars: each Tom Select fills its grid column; chips wrap (no
   inner scrollbars) and the field simply grows taller as needed. */
.filters .ts-wrapper { width: 100%; }
.ts-dropdown {
    border: 1px solid var(--line); border-radius: 10px; margin-top: 4px;
    box-shadow: 0 14px 40px rgba(27, 36, 48, .12); overflow: hidden;
}
.ts-dropdown .ts-dropdown-content .option { padding: 9px 13px; font-size: .9rem; }
.ts-dropdown .active { background: var(--brand-50); color: var(--brand-text); }
.ts-dropdown .no-results { padding: 9px 13px; font-size: .9rem; color: var(--muted); }

/* ---------- SweetAlert2 (confirmations) ---------- */
.swal2-popup { border-radius: var(--radius); font-family: inherit; padding: 26px 24px 20px; }
.swal2-title { font-size: 1.12rem; font-weight: 700; color: var(--ink); }
.swal2-html-container { font-size: .92rem; color: var(--muted); margin-top: 6px; }
.swal2-actions { gap: 8px; margin-top: 20px; }
.swal2-actions .swal2-styled {
    border-radius: 10px; font-size: .88rem; font-weight: 600;
    padding: 10px 20px; margin: 0; box-shadow: none;
}
.swal2-actions .swal2-cancel { color: var(--ink); }
.swal2-toast { border-radius: 12px; box-shadow: 0 10px 34px rgba(27, 36, 48, .14); padding: 14px 16px; }
.swal2-toast .swal2-title { font-size: .92rem; font-weight: 600; color: var(--ink); margin: 0; }
.swal2-toast .swal2-timer-progress-bar { background: var(--brand); }
.swal2-toast .swal2-progress-danger { background: var(--danger); }
/* Clear the sticky topbar so a toast never sits on the avatar menu. */
.swal2-container.swal2-top-end { padding: calc(var(--topbar-h) + 20px) 20px 0; }

/* A compact label/value list where a full .data table would overflow a
   narrow panel (it carries a 640px min-width). */
.kv-list { display: flex; flex-direction: column; font-size: .9rem; }
.kv-list > div {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line);
}
.kv-list > div:last-child { border-bottom: 0; }
.kv-list .kv-value { text-align: end; white-space: nowrap; }

/* ---------- Filter bar (the x-filters / x-filter-field components) ----------
   Every index used to inline the same grid + label styles. The column count is
   a data attribute so a page with one filter and a page with five share this. */
.filters {
    margin-bottom: var(--space-4);
    display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: end;
}
/* Fields grow to fill the row and wrap when they run out of space, so a bar with
   two filters and one with seven both look deliberate without per-page styling.
   --col-min tunes how eagerly they wrap; data-cols sets it from the view. */
.filters .filter-field { flex: 1 1 var(--col-min, 220px); min-width: 0; }
/* Caps how far a lone field on the last row stretches — without this a
   single trailing date picker grows to the full bar width. */
.filters .filter-field:not(.span-full) { max-width: 380px; }
.filters[data-cols="1"] { --col-min: 100%; }
.filters[data-cols="2"] { --col-min: 280px; }
.filters[data-cols="3"] { --col-min: 200px; }
.filters[data-cols="4"] { --col-min: 170px; }
.filters .filter-field.span-2 { flex-grow: 2; }
.filters .filter-field.span-full { flex-basis: 100%; }
.filters .filter-field > label {
    font-size: .78rem; font-weight: 600; color: var(--muted);
    display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
/* Buttons ride at the end of the last row when there is room for them. */
.filters .filter-actions {
    display: flex; gap: var(--space-2); align-items: center;
    margin-inline-start: auto; flex: 0 0 auto;
}
@media (max-width: 620px) {
    .filters .filter-field { flex-basis: 100%; }
    .filters .filter-actions { width: 100%; justify-content: flex-end; }
}

/* ---------- Pagination (the x-pagination component) ----------
   Replaces the hand-rolled prev/next block every index carried: page numbers,
   a result count, and first/last jumps. */
.pagination {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-3); margin-top: var(--space-4); flex-wrap: wrap;
}
.pagination .summary { color: var(--muted); font-size: .85rem; }
.pagination .pages { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pagination .pages a, .pagination .pages span {
    display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 9px;
    border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface);
    color: var(--ink); font-size: .85rem; font-weight: 500;
    transition: background .12s, border-color .12s, color .12s;
}
.pagination .pages a:hover { background: var(--surface-2); }
.pagination .pages .current {
    background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600;
}
.pagination .pages .gap { border-color: transparent; background: none; color: var(--muted-2); min-width: 20px; }
.pagination .pages svg { width: 15px; height: 15px; }
/* The prev/next chevrons point at the reading direction, not at the screen. */
[dir="rtl"] .pagination .pages .edge svg { transform: scaleX(-1); }

/* ---------- Key/value detail grid (the x-detail-list component) ----------
   One shape for the three different <dl>/label-over-value layouts the show
   pages had grown. */
.detail-list { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 10px 18px; margin: 0; }
.detail-list dt { color: var(--muted); font-size: .85rem; }
.detail-list dd { margin: 0; min-width: 0; }
.detail-list dd.pre { white-space: pre-wrap; }
@media (max-width: 560px) {
    .detail-list { grid-template-columns: 1fr; gap: 2px 0; }
    .detail-list dd { margin-bottom: 10px; }
}

/* Free text that may be English inside an Arabic page (or the reverse): let the
   browser pick the direction per string so trailing punctuation stays put. */
.autodir { unicode-bidi: plaintext; }

/* Before/after values in the audit trail: monospace-ish, wrapping, no overflow. */
pre.change { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: .82rem; font-family: inherit; }

/* ---------- Dashboard landing page ---------- */
.stat-grid {
    display: grid; gap: var(--space-4); margin-bottom: var(--space-4);
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .stat-grid { grid-template-columns: minmax(0, 1fr); } }
.dash-split {
    display: grid; gap: var(--space-4); margin-bottom: var(--space-4);
    grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch;
}
.dash-split.wide { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 980px) { .dash-split.wide { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 980px) { .dash-split { grid-template-columns: minmax(0, 1fr); } }

.panel-title {
    margin: 0 0 var(--space-4); font-size: 1rem;
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
}
.panel-title .btn { font-weight: 500; }

/* Requests-by-status: one flex segment per status, sized by its own count. No
   chart library — the tones come from the same tokens the pills use. */
.statusbar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-4); }
.statusbar .seg { display: block; min-width: 3px; flex: var(--n, 1); }
.statusbar .tone-on, .statuskey .tone-on { background: var(--success); }
.statusbar .tone-warn, .statuskey .tone-warn { background: var(--warn); }
.statusbar .tone-off, .statuskey .tone-off { background: var(--muted-2); }
.statusbar .tone-danger, .statuskey .tone-danger { background: var(--danger); }
.statusbar .tone-info, .statuskey .tone-info,
.statusbar .tone-neutral, .statuskey .tone-neutral { background: var(--brand); }

.statuskey { list-style: none; margin: var(--space-4) 0 0; padding: 0; display: grid; gap: 2px; }
/* As a full-width strip the legend runs along one row instead of stacking. */
.panel.breakdown { margin-bottom: var(--space-4); }
.panel.breakdown .statuskey { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); }
.panel.breakdown .statuskey li { flex: 0 1 auto; }
.panel.breakdown .statuskey .label { flex: 0 1 auto; }
.panel.breakdown .statuskey .count { margin-inline-start: 2px; }
.statuskey a {
    display: flex; align-items: center; gap: 10px; padding: 7px 8px;
    border-radius: var(--radius-sm); font-size: .88rem;
}
.statuskey a:hover { background: var(--surface-2); }
.statuskey .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.statuskey .label { flex: 1; min-width: 0; }
.statuskey .count { font-weight: 600; font-variant-numeric: tabular-nums; }

/* A queue row: the oldest open requests, the latest audit entries. */
.queue-row {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
    padding: 11px 8px; border-radius: var(--radius-sm); border-bottom: 1px solid var(--line);
}
.queue-row:last-child { border-bottom: 0; }
.queue-row:not(.static):hover { background: var(--surface-2); }
.queue-main { min-width: 0; }
.queue-main > div:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-row .sub { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.queue-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: 0 0 auto; text-align: end; }
.queue-row .placeholder { padding: 28px 12px; }

/* ---------- Detail / show pages ---------- */
.detail-split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
@media (max-width: 980px) { .detail-split { grid-template-columns: minmax(0, 1fr); } }
.panel.spaced { margin-top: var(--space-4); }
.detail-list dd.stack { display: flex; flex-direction: column; gap: 6px; }
.filelink { display: inline-flex; align-items: center; gap: 6px; }
.filelink svg { width: 15px; height: 15px; }

/* A small label above a control in a side panel — the filter-bar label, reused. */
label.minor { font-size: .78rem; font-weight: 600; color: var(--muted); }
.action-form { margin-bottom: var(--space-4); }
.inline-row { display: flex; gap: var(--space-2); align-items: center; }
.inline-row > .field { flex: 1; }
hr.rule { border: 0; border-top: 1px solid var(--line); margin: var(--space-4) 0; }
/* Button tones beyond the brand: a soft destructive and a positive confirm. */
.btn.soft-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-line); }
.btn.soft-danger:hover { background: color-mix(in srgb, var(--danger) 16%, var(--surface)); filter: none; }
.btn.success { background: var(--success); color: var(--success-ink); }
/* A stacked form's trailing button needs air above it. */
.btn.block + .btn.block, .field + .btn.block, .error + .btn.block, textarea + .btn.block { margin-top: var(--space-2); }

/* Activity timeline on a detail page. */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.timeline > li {
    display: flex; gap: var(--space-3); align-items: flex-start;
    border-inline-start: 2px solid var(--line); padding-inline-start: var(--space-3);
}
.timeline .entry { flex: 1; min-width: 0; }
.timeline .note { white-space: pre-wrap; margin-top: 2px; }

/* A row of small "label above value" facts, as the audit detail uses. */
.panel.stack-4 { display: grid; gap: var(--space-4); }
.facts { display: grid; gap: var(--space-4); }
.facts.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.facts.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.facts.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .facts.c3, .facts.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .facts[class*="c"] { grid-template-columns: minmax(0, 1fr); } }
.fact-label { color: var(--muted); font-size: .8rem; }
.fact-sub { color: var(--muted); font-size: .78rem; }
.breakall { word-break: break-all; }
.eyebrow { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.note-line { margin: .4rem 0 .6rem; font-size: .85rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
pre.spaced-sm { margin-top: .6rem; }

/* ---------- Activity feed (dashboard) ----------
   One line per entry: a tinted glyph for the event, the sentence, the time.
   Denser than a table and readable at a glance, which a column of identical
   status pills was not. */
.feed { list-style: none; margin: 0; padding: 0; }
.feed > li {
    display: grid; grid-template-columns: 30px minmax(0, 1fr) max-content;
    align-items: center; gap: var(--space-3);
    padding: 9px 2px; border-bottom: 1px solid var(--line);
}
.feed > li:last-child { border-bottom: 0; }
.feed .mark {
    width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
    background: var(--surface-4); color: var(--muted);
}
.feed .mark svg { width: 15px; height: 15px; }
/* Tinted, not filled — the glyph carries the colour, the row stays calm. */
.feed .mark.tone-on { background: var(--success-bg); color: var(--success); }
.feed .mark.tone-warn { background: var(--warn-bg); color: var(--warn); }
.feed .mark.tone-danger { background: var(--danger-bg); color: var(--danger); }
.feed .mark.tone-info { background: var(--brand-50); color: var(--brand-text); }
.feed .line { min-width: 0; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .verb { color: var(--muted); }
.feed .subject { font-weight: 600; }
.feed .kind { color: var(--muted-2); font-size: .8rem; }
.feed .when { color: var(--muted-2); font-size: .8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 620px) {
    .feed > li { grid-template-columns: 30px minmax(0, 1fr); }
    .feed .when { grid-column: 2; font-size: .75rem; }
    .feed .line { white-space: normal; }
}

/* Hover tip
   ----------------------------------------------------------------------------
   A small popover fed by the `data-tip` attribute — used on the permission
   checkboxes so each one explains itself in the active language. Pure CSS: the
   text is an attribute, so it needs no extra markup and no script, and it
   follows the writing direction on its own (logical inset + `text-align:start`).
   `:focus-within` mirrors the hover so it is reachable from the keyboard. */
.tip { position: relative; }
.tip[data-tip]::after {
    content: attr(data-tip);
    position: absolute; z-index: 40;
    inset-block-end: calc(100% + 6px); inset-inline-start: 0;
    inline-size: max-content; max-inline-size: 260px;
    padding: 7px 10px; border-radius: var(--radius-sm);
    background: var(--ink); color: #fff;
    font-size: .75rem; font-weight: 400; line-height: 1.5; text-align: start;
    white-space: normal; box-shadow: var(--shadow-md);
    opacity: 0; visibility: hidden; transform: translateY(3px);
    transition: opacity .12s ease, transform .12s ease, visibility .12s;
    pointer-events: none;
}
.tip[data-tip]:hover::after,
.tip[data-tip]:focus-within::after { opacity: 1; visibility: visible; transform: none; }

/* ---------- Central control plane ----------
   The operator panel wears the tenant dashboard's shell (.shell / .sidebar /
   .topbar) unchanged; only the brand block and the sign-in screen are its own. */

/* Sidebar brand: logo mark + org name + "Control plane" tag.
   The tag lets an operator tell this console from a tenant's dashboard at a glance. */
.sidebar-head .brand { color: var(--console-ink); gap: 12px; align-items: center; }
.sidebar-head .brand-logo { border-radius: 10px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; gap: 1px; }
.brand-text .name { font-size: 1rem; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-tag {
    font-size: .65rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
    color: var(--console-accent); opacity: .9;
}

/* Split sign-in: a dark brand panel beside the form. */
.auth-split { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-aside {
    background: var(--secondary); color: #f2efe7;
    display: flex; flex-direction: column; justify-content: space-between; gap: var(--space-6);
    padding: clamp(28px, 4vw, 56px);
    position: relative; overflow: hidden;
}
/* A quiet gold grid in the corner — the panel's one decoration. */
.auth-aside::after {
    content: ""; position: absolute; inset-block-end: -80px; inset-inline-end: -80px;
    width: 320px; height: 320px; border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--brand) 28%, transparent), transparent 70%);
    pointer-events: none;
}
.auth-aside .brand .name { color: #f2efe7; font-size: 1.1rem; }
.auth-aside .brand { gap: 12px; align-items: center; }
.auth-aside-body { max-width: 440px; position: relative; z-index: 1; }
.auth-eyebrow {
    margin: 0 0 var(--space-3); font-size: .74rem; font-weight: 700;
    letter-spacing: .16em; text-transform: uppercase; color: var(--brand);
}
.auth-aside h2 { margin: 0 0 var(--space-5); font-size: clamp(1.6rem, 2.6vw, 2.2rem); line-height: 1.2; letter-spacing: -.02em; }
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); }
.auth-points li { display: flex; align-items: flex-start; gap: var(--space-3); color: rgba(242, 239, 231, .78); font-size: .92rem; line-height: 1.55; }
.auth-points svg {
    width: 32px; height: 32px; flex: 0 0 auto; padding: 7px; border-radius: 9px;
    background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand);
}
.auth-aside-foot { margin: 0; font-size: .8rem; color: rgba(242, 239, 231, .5); position: relative; z-index: 1; }

.auth-main { display: grid; place-items: center; padding: clamp(24px, 4vw, 56px); background: var(--bg); }
.auth-form { width: 100%; max-width: 400px; }
.auth-form-head { display: flex; justify-content: flex-end; margin-bottom: var(--space-6); }

@media (max-width: 900px) {
    .auth-split { grid-template-columns: minmax(0, 1fr); }
    /* On a phone the panel shrinks to a brand strip; the fields come first. */
    .auth-aside { padding: var(--space-4); }
    .auth-aside-body, .auth-aside-foot, .auth-aside::after { display: none; }
    .auth-main { place-items: start center; }
    .auth-form-head { margin-bottom: var(--space-4); }
}

/* ---------- Central control plane login — fixed dark palette ----------
   Intentionally different from the tenant login so an operator cannot
   mistake the two surfaces. The aside ignores --secondary entirely and
   uses a fixed charcoal, an amber badge, and a dot-grid texture.        */
.cp-aside {
    background: #0f1621;
    /* Override the generic ::after glow — we have our own decoration */
}
.cp-aside::after { display: none; }

/* Repeating dot-grid SVG background — subtle, not noisy */
.cp-grid {
    position: absolute; inset: 0; pointer-events: none; z-index: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,.13) 1px, transparent 1px);
    background-size: 22px 22px;
    mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%);
}

/* Brand stack: name + amber "Control plane" pill stacked vertically */
.cp-brand-stack { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cp-brand-stack .name { color: #f2efe7; font-size: 1.1rem; font-weight: 700; line-height: 1; }
.cp-badge {
    display: inline-flex; align-items: center;
    font-size: .6rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
    background: rgba(234, 179, 8, .15); color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, .3);
    padding: 2px 7px; border-radius: 999px; width: fit-content;
}

/* Make the brand row align the logo with the two-line stack */
.cp-aside .brand { align-items: center; gap: 12px; position: relative; z-index: 1; }

/* Eyebrow in amber instead of --brand */
.cp-eyebrow {
    margin: 0 0 var(--space-3); font-size: .74rem; font-weight: 700;
    letter-spacing: .16em; text-transform: uppercase; color: #fbbf24;
}

/* Bullet icons: amber tint on a dark fill */
.cp-points svg {
    background: rgba(251, 191, 36, .1); color: #fbbf24;
}

/* Body and foot stay above the dot-grid */
.cp-aside .auth-aside-body,
.cp-aside .auth-aside-foot { position: relative; z-index: 1; }

/* Form side: very dark background so the two halves read as clearly separate surfaces */
.cp-main { background: #111827; }
.cp-main h1,
.cp-main label { color: #f2efe7; }
.cp-main .sub { color: rgba(242, 239, 231, .55); }
.cp-main .field {
    background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.12);
    color: #f2efe7;
}
.cp-main .field:focus { border-color: #fbbf24; box-shadow: 0 0 0 3px rgba(251,191,36,.15); }
.cp-main .lang-toggle { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.15); }
.cp-main .lang-toggle a { color: rgba(242, 239, 231, .5); }
.cp-main .lang-toggle a.active { background: rgba(255,255,255,.15); color: #f2efe7; border-color: transparent; }
.cp-main .lang-toggle a:not(.active):hover { background: rgba(255,255,255,.06); color: rgba(242,239,231,.8); }
.cp-main .switch-label { color: rgba(242, 239, 231, .85); }
.cp-main .switch .track { background: rgba(255,255,255,.18); }
.cp-main .switch .track::after { background: #f2efe7; box-shadow: none; }
.cp-main .switch > input:checked + .track { background: #fbbf24; }
.cp-main .switch > input:checked + .track::after { background: #0f1621; }

@media (max-width: 900px) {
    .cp-aside .cp-grid { display: none; }
    .cp-main { background: var(--bg); }
    .cp-main h1, .cp-main label { color: var(--ink); }
    .cp-main .sub { color: var(--muted); }
    .cp-main .field { background: var(--surface); border-color: var(--line); color: var(--ink); }
    .cp-main .lang-toggle { background: var(--surface); border-color: var(--line); }
    .cp-main .lang-toggle a { color: var(--muted); }
    .cp-main .lang-toggle a.active { color: var(--ink); border-color: var(--line); }
    .cp-main .switch-label { color: var(--ink); }
    .cp-main .switch .track { background: var(--control-off); }
    .cp-main .switch .track::after { background: var(--surface); box-shadow: 0 1px 3px rgba(27,36,48,.25); }
    .cp-main .switch > input:checked + .track { background: var(--brand); }
    .cp-main .switch > input:checked + .track::after { background: var(--surface); }
}

/* ---------- Public landing page (central root) ----------
   The one page with no signed-in reader, and the only one that is not the
   dashboard — so it gets its own palette and its own display face, scoped
   entirely under `.lp` so nothing here can reach the app's screens.

   Palette: the materials of the thing itself. Limestone and warm sand for the
   ground, a planted green-black for the ink panels, brass for the accent —
   address plates, gate fittings, building numbers. Deliberately not the
   dashboard's grey-blue: this page is about compounds, not about software.

   Type: Readex Pro carries the display voice in BOTH scripts, so the page has
   one personality either side of the language toggle instead of two. Plex Mono
   appears only on unit identifiers and step numbers, neither of which is ever
   translated.

   Every rule uses logical properties: the whole page mirrors for Arabic with
   no RTL overrides. */
.lp {
    --lp-ink: #1a160c;
    --lp-ink-soft: #262011;
    --lp-ink-mid: #312a1a;
    --lp-field: #f2efe7;
    --lp-paper: #fdfcf9;
    --lp-brass: #f2c014;
    /* Gold dark enough to read on the light field. */
    --lp-brass-deep: #7a5c00;
    --lp-brass-dim: rgba(242, 192, 20, .15);
    --lp-sage: #5f7a63;
    --lp-line: #ddd6c8;
    --lp-ink-line: rgba(242, 239, 231, .12);
    --lp-ink-line-mid: rgba(242, 239, 231, .22);
    --lp-text: #1f1a10;
    --lp-muted: #736d5e;
    --lp-muted-light: rgba(242, 239, 231, .55);

    --lp-display: 'Readex Pro', 'Cairo', system-ui, sans-serif;
    --lp-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--lp-field);
    color: var(--lp-text);
}

.lp-wrap { width: min(1200px, 100% - clamp(24px, 6vw, 96px)); margin-inline: auto; }

/* -- navbar -- */
.lp-bar {
    background: rgba(253, 252, 249, .92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--lp-line);
    position: sticky; top: 0; z-index: 20;
}
.lp-bar-inner {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-4); padding-block: 13px;
}
.lp-brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.lp-mark {
    width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto; overflow: hidden;
    background: var(--lp-ink); color: var(--lp-field);
    display: grid; place-items: center; font-weight: 600; font-size: .9rem;
    box-shadow: 0 1px 3px rgba(26, 22, 12, .25);
}
.lp-mark img { width: 100%; height: 100%; object-fit: contain; background: var(--lp-paper); padding: 3px; }
.lp-brand-name { font-family: var(--lp-display); font-weight: 600; font-size: 1.04rem; letter-spacing: -.015em; }
.lp-bar-actions { display: flex; align-items: center; gap: var(--space-3); }
.lp .lang-toggle { border-color: var(--lp-line); background: var(--lp-field); }

/* -- hero -- */
.lp-hero {
    background: var(--lp-ink);
    color: var(--lp-field);
    padding-block: clamp(64px, 10vw, 128px);
    /* Subtle topographic texture via repeating diagonal lines */
    background-image:
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 28px,
            rgba(242, 239, 231, .025) 28px,
            rgba(242, 239, 231, .025) 29px
        );
}
.lp-hero-grid {
    display: grid; gap: clamp(48px, 7vw, 88px);
    align-items: center;
    grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 940px) {
    .lp-hero-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }
}

.lp-eyebrow {
    font-family: var(--lp-mono); font-size: .7rem; letter-spacing: .2em; text-transform: uppercase;
    color: var(--lp-brass); margin: 0 0 var(--space-4);
    display: inline-flex; align-items: center; gap: 10px;
}
.lp-eyebrow::before {
    content: ''; display: block; width: 20px; height: 1px; background: var(--lp-brass); flex: 0 0 auto;
}
.lp-hero h1 {
    font-family: var(--lp-display); font-weight: 600;
    font-size: clamp(2.2rem, 5vw, 3.8rem); line-height: 1.06; letter-spacing: -.03em;
    margin: 0 0 var(--space-5); max-width: 14ch;
}
.lp-hero h1 em {
    font-style: normal;
    color: var(--lp-brass);
}
.lp-lede {
    font-size: clamp(1rem, 1.5vw, 1.1rem); line-height: 1.72; margin: 0;
    max-width: 52ch; color: rgba(242, 239, 231, .68);
}

/* -- site plan: the page's one memorable element -- */
.lp-plan { margin: 0; }
.lp-plan-grid {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
    padding: clamp(16px, 2.6vw, 28px);
    border: 1px solid var(--lp-ink-line-mid); border-radius: 16px;
    background:
        linear-gradient(var(--lp-ink-line) 1px, transparent 1px) 0 0 / 100% 25%,
        var(--lp-ink-soft);
    box-shadow: inset 0 1px 0 rgba(242, 239, 231, .06), 0 0 0 1px rgba(242, 239, 231, .04);
}
.lp-unit {
    font-family: var(--lp-mono); font-size: .66rem; letter-spacing: .03em;
    display: grid; place-items: center; aspect-ratio: 1 / .7;
    border-radius: 8px; border: 1px solid var(--lp-ink-line);
    background: rgba(242, 239, 231, .04); color: rgba(242, 239, 231, .36);
    opacity: 0; animation: lp-plate .45s ease-out forwards;
    transition: background .15s, border-color .15s;
}
.lp-unit:nth-child(1)  { animation-delay:  80ms; }
.lp-unit:nth-child(2)  { animation-delay: 110ms; }
.lp-unit:nth-child(3)  { animation-delay: 140ms; }
.lp-unit:nth-child(4)  { animation-delay: 170ms; }
.lp-unit:nth-child(5)  { animation-delay: 200ms; }
.lp-unit:nth-child(6)  { animation-delay: 230ms; }
.lp-unit:nth-child(7)  { animation-delay: 260ms; }
.lp-unit:nth-child(8)  { animation-delay: 290ms; }
.lp-unit:nth-child(9)  { animation-delay: 320ms; }
.lp-unit:nth-child(10) { animation-delay: 350ms; }
.lp-unit:nth-child(11) { animation-delay: 380ms; }
.lp-unit:nth-child(12) { animation-delay: 410ms; }
.lp-unit:nth-child(13) { animation-delay: 440ms; }
.lp-unit:nth-child(14) { animation-delay: 470ms; }
.lp-unit:nth-child(15) { animation-delay: 500ms; }
.lp-unit:nth-child(16) { animation-delay: 530ms; }
.lp-unit:nth-child(17) { animation-delay: 560ms; }
.lp-unit:nth-child(18) { animation-delay: 590ms; }
.lp-unit:nth-child(19) { animation-delay: 620ms; }
.lp-unit:nth-child(20) { animation-delay: 650ms; }
.lp-unit.request {
    border-color: rgba(242, 192, 20, .6); color: #f7d867;
    background: rgba(242, 192, 20, .14);
    box-shadow: 0 0 0 1px rgba(242, 192, 20, .2) inset;
}
.lp-unit.gate {
    border-color: rgba(125, 156, 130, .6); color: #cfe3d1;
    background: rgba(95, 122, 99, .36);
}
@keyframes lp-plate {
    from { opacity: 0; transform: scale(.94) translateY(4px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.lp-plan-label {
    font-family: var(--lp-mono); font-size: .62rem; letter-spacing: .12em; text-transform: uppercase;
    color: rgba(242, 239, 231, .3); margin-block-end: 10px;
}

.lp-legend {
    display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5);
    margin-top: var(--space-4); font-size: .76rem; color: rgba(242, 239, 231, .5);
    font-family: var(--lp-mono);
}
.lp-legend span { display: inline-flex; align-items: center; gap: 8px; letter-spacing: .04em; }
.lp-dot { width: 8px; height: 8px; border-radius: 2px; background: rgba(242, 239, 231, .4); flex: 0 0 auto; }
.lp-dot.request { background: var(--lp-brass); }
.lp-dot.gate { background: #7d9c82; }

/* -- shared section rhythm -- */
.lp-section { padding-block: clamp(56px, 8vw, 104px); }
.lp-section-header { margin-block-end: clamp(32px, 4vw, 52px); }
.lp-h2 {
    font-family: var(--lp-display); font-weight: 600;
    font-size: clamp(1.4rem, 2.4vw, 2rem); letter-spacing: -.025em; margin: 0 0 var(--space-3);
}
.lp-section-lede {
    color: var(--lp-muted); margin: 0; max-width: 56ch; line-height: 1.72;
    font-size: clamp(.9rem, 1.2vw, 1rem);
}

/* -- loop: four numbered steps, connected by a brass rule -- */
.lp-loop-section { background: var(--lp-paper); border-block: 1px solid var(--lp-line); }
.lp-loop {
    list-style: none; margin: 0; padding: 0;
    display: grid; gap: 0;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    border: 1px solid var(--lp-line); border-radius: 14px;
    overflow: hidden;
}
.lp-loop li {
    padding: var(--space-5) var(--space-5) var(--space-5);
    border-inline-end: 1px solid var(--lp-line);
    position: relative;
    background: var(--lp-paper);
    transition: background .14s;
}
.lp-loop li:last-child { border-inline-end: none; }
.lp-loop li::before {
    content: ''; position: absolute; inset-block-start: 0; inset-inline: 0;
    height: 3px; background: var(--lp-brass);
}
.lp-step {
    font-family: var(--lp-mono); font-size: .7rem; color: var(--lp-brass-deep);
    letter-spacing: .12em; display: block; margin-block-end: var(--space-3);
}
.lp-loop h3 {
    font-family: var(--lp-display); font-weight: 600; font-size: 1.05rem;
    margin: 0 0 var(--space-2); letter-spacing: -.01em;
}
.lp-loop p { margin: 0; color: var(--lp-muted); font-size: .88rem; line-height: 1.68; }
@media (max-width: 680px) {
    .lp-loop { border-radius: 0; border-inline: none; }
    .lp-loop li { border-inline-end: none; border-block-end: 1px solid var(--lp-line); }
    .lp-loop li:last-child { border-block-end: none; }
}

/* -- directory: two-column building index -- */
.lp-directory {
    margin: 0; display: grid; gap: 0;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    column-gap: clamp(40px, 6vw, 80px);
    border-block-start: 1px solid var(--lp-line);
}
.lp-entry {
    border-block-end: 1px solid var(--lp-line);
    padding-block: var(--space-4) var(--space-4);
    display: grid; grid-template-columns: 160px 1fr; gap: 0 var(--space-4);
    align-items: baseline;
    transition: background .12s;
}
.lp-entry:hover { background: rgba(242, 239, 231, .6); }
.lp-entry dt {
    font-family: var(--lp-display); font-weight: 600; font-size: .95rem;
    padding-inline-end: var(--space-4);
    border-inline-end: 1px solid var(--lp-line);
}
.lp-entry dd { margin: 0; color: var(--lp-muted); font-size: .88rem; line-height: 1.65; padding-inline-start: 0; }
@media (max-width: 540px) {
    .lp-entry { grid-template-columns: 1fr; gap: 4px; }
    .lp-entry dt { border-inline-end: none; padding-inline-end: 0; }
}

/* -- the three apps -- */
.lp-apps-section { background: var(--lp-ink); color: var(--lp-field); }
.lp-apps-section .lp-h2 { color: var(--lp-field); }
.lp-apps-section .lp-section-lede { color: var(--lp-muted-light); }
.lp-apps {
    display: grid; gap: 1px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    margin-top: var(--space-6);
    background: var(--lp-ink-line-mid);
    border: 1px solid var(--lp-ink-line-mid); border-radius: 16px; overflow: hidden;
}
.lp-app {
    padding: clamp(24px, 3vw, 36px);
    background: var(--lp-ink-soft);
    display: flex; flex-direction: column; gap: var(--space-3);
    transition: background .14s;
}
.lp-app:hover { background: var(--lp-ink-mid); }
.lp-for {
    font-family: var(--lp-mono); font-size: .66rem; letter-spacing: .18em;
    text-transform: uppercase; color: var(--lp-brass);
    display: inline-flex; align-items: center; gap: 8px;
}
.lp-for::before { content: ''; width: 12px; height: 1px; background: var(--lp-brass); flex: 0 0 auto; }
.lp-app h3 {
    font-family: var(--lp-display); font-weight: 600; font-size: 1.1rem;
    margin: 0; letter-spacing: -.015em;
}
.lp-app p { margin: 0; color: rgba(242, 239, 231, .6); font-size: .88rem; line-height: 1.68; }

/* -- isolation / data note section -- */
.lp-cta-section { background: var(--lp-paper); border-block: 1px solid var(--lp-line); }
.lp-cta-box {
    padding: clamp(28px, 4vw, 52px) clamp(24px, 4vw, 52px);
    background: var(--lp-field);
    border: 1px solid var(--lp-line); border-radius: 18px;
    border-inline-start: 4px solid var(--lp-brass);
}
.lp-cta-box .lp-h2 { margin: 0 0 var(--space-3); }
.lp-cta-body p { margin: 0; color: var(--lp-muted); max-width: 68ch; line-height: 1.75; font-size: .95rem; }

/* -- foot -- */
.lp-foot { margin-top: auto; background: var(--lp-paper); border-top: 1px solid var(--lp-line); }
.lp-foot-inner {
    padding-block: var(--space-4); font-size: .82rem; color: var(--lp-muted);
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
    flex-wrap: wrap;
}
.lp-foot-brand {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--lp-display); font-weight: 600; font-size: .84rem; color: var(--lp-text);
}
.lp-foot-mark {
    width: 20px; height: 20px; border-radius: 5px; flex: 0 0 auto;
    background: var(--lp-ink); color: var(--lp-field);
    display: grid; place-items: center; font-size: .6rem; font-weight: 700;
}
.lp-foot-mark img { width: 100%; height: 100%; object-fit: contain; }

@media (prefers-reduced-motion: reduce) {
    .lp-unit { animation: none; opacity: 1; }
}

/* Provisioning progress. Indeterminate by design: the pipeline reports which
   STEP it is on, never a percentage, and inventing one would be a lie. */
.progress { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: var(--space-3); }
.progress .bar { height: 100%; border-radius: 999px; background: var(--brand); }
.progress .bar.indeterminate { width: 40%; animation: progress-slide 1.4s ease-in-out infinite; }
@keyframes progress-slide {
    0%   { margin-inline-start: -40%; }
    100% { margin-inline-start: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .progress .bar.indeterminate { animation: none; width: 100%; opacity: .5; }
}

/* Irreversible actions get their own visually separated block, so "drop this
   tenant and its database" never sits inline with ordinary buttons. */
.danger-zone { border-color: var(--danger, #b42318); }
.danger-zone h2 { color: var(--danger, #b42318); }

/* Form panels. A bare stack of <x-field> has no margins of its own (.field-group
   deliberately carries none), so the panel owns the rhythm — otherwise every
   central form collapses into the tight, unspaced column it used to be. */
.form-panel { display: grid; gap: var(--space-4); align-content: start; }
.form-panel > .form-actions { margin-top: 0; }
.form-panel > .panel-title { margin-bottom: 0; }

/* A field that ends in fixed text, e.g. the subdomain followed by ".example.com". */
.input-suffix { display: flex; align-items: center; gap: var(--space-2); }
.input-suffix .field { flex: 1; min-width: 0; }
.input-suffix .suffix { white-space: nowrap; }

/* Lifecycle controls on a tenant/server: each is its own <form>, so they are
   laid out as a wrapping row rather than stacked block elements. */
.inline-actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); }
.inline-actions form { display: flex; align-items: flex-end; gap: var(--space-2); }
.inline-actions .field-group { flex: 1; min-width: 200px; }

/* The role checklist on the admin editor. */
.check-list { display: grid; gap: var(--space-2); }

/* A pick-one list where each option carries a name and a line of explanation —
   a bare radio beside a label is too thin to read as a choice between roles. */
.choice-list { display: grid; gap: var(--space-2); }
.choice {
    display: flex; align-items: flex-start; gap: var(--space-3); cursor: pointer;
    padding: var(--space-3) var(--space-4); border: 1px solid var(--line);
    border-radius: var(--radius-md); background: var(--surface);
    font-weight: 400; margin: 0; transition: border-color .12s, background .12s;
}
.choice:hover { background: var(--surface-2); }
.choice > input { margin-top: 3px; accent-color: var(--brand); flex: 0 0 auto; }
.choice:has(> input:checked) { border-color: var(--brand); background: var(--brand-50); }
.choice > input:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.choice-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.choice-title { font-weight: 600; font-size: .9rem; }
.choice-sub { color: var(--muted); font-size: .8rem; }

.alert.success { background: var(--success-50, #ecfdf3); border-color: var(--success, #067647); color: var(--success, #067647); }
/* Informational, not a problem — `.alert` alone is the danger tone. */
.alert.info { background: var(--brand-50); border-color: var(--brand-100); color: var(--ink); }
label.inline { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 500; }

/* Remote run output and deploy keys: long, unwrappable, and read by eye. */
.code-block {
    background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-md);
    padding: var(--space-3); font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .78rem; line-height: 1.5; overflow-x: auto; white-space: pre-wrap;
    word-break: break-all; max-height: 420px; overflow-y: auto; margin: 0;
}

/* -- Impersonation banner (docs/IMPERSONATION.md) --------------------------
   Every dashboard page while an operator is signed in as someone else. The
   secondary (near-black) band with brand-coloured accents reads as "not the
   usual chrome" in any tenant palette. */
.impersonation-banner {
    display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
    padding: var(--space-2) var(--space-5);
    background: var(--secondary); color: var(--secondary-ink);
    border-block-end: 3px solid var(--brand);
    font-size: .9rem;
}
.impersonation-banner > svg { width: 18px; height: 18px; color: var(--brand); flex: 0 0 auto; }
.impersonation-banner-text { flex: 1 1 auto; min-width: 0; }
.impersonation-banner-text .muted { color: inherit; opacity: .72; margin-inline-start: var(--space-2); }
.impersonation-banner form { margin: 0; }

.form-actions > .muted { align-self: center; font-size: .85rem; }

/* -- Backups (docs/BACKUPS.md) ------------------------------------------- */
.check-list.spaced, .inline-actions.spaced, details.spaced { margin-top: var(--space-4); }
.check-list li { display: flex; align-items: baseline; gap: var(--space-2); flex-wrap: wrap; }
details.spaced > summary { cursor: pointer; font-weight: 600; }
.setup-steps { margin: var(--space-3) 0; padding-inline-start: var(--space-5); display: grid; gap: var(--space-2); }
.panel + .table-wrap, .alert + .table-wrap { margin-top: var(--space-4); }
/* Long archive names wrap, so the row's actions stay on screen. */
.backup-name { word-break: break-all; }

/* ---------- Page-level shapes (formerly inline style="" in the views) ----------
   Grouped by what they are for; every value matches what the view used to inline. */

/* Panel padding variants: the show/review pages use a slightly tighter box. */
.panel.tight { padding: 20px; }
.panel.snug { padding: 18px; }
.spaced-below { margin-bottom: var(--space-4); }

/* A heading + optional lede at the top of a panel section. */
.section-h { margin: 0 0 14px; }
.section-h.has-lede { margin-bottom: 4px; }
h3.top-flush { margin-top: 0; }
.section-h.after-table { margin: 22px 0 4px; }
.section-lede { margin: 0 0 14px; }
.section-lede.small { font-size: .85rem; }
.section-lede.small.near { margin-bottom: 12px; }
.section-note { margin: 0; }
/* Heading on one side, a pill / control on the other. */
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head > h3 { margin: 0; }
.panel-head.wrap { gap: 12px; flex-wrap: wrap; }
.alert.trailing { margin-top: 14px; }
.hint.loose { margin-top: 10px; }

/* Two equal columns on a detail page (review, amenity rules + hours). */
.detail-split.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.detail-split.spaced { margin-top: var(--space-4); }
.detail-split.main-wide { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
@media (max-width: 980px) { .detail-split.even, .detail-split.main-wide { grid-template-columns: minmax(0, 1fr); } }
/* A detail list with a fixed label column. */
.detail-list.fixed-label { grid-template-columns: 130px 1fr; gap: 10px 14px; }

/* Smallest button, for a row action that is text rather than an icon. */
.btn.xs { padding: 6px 12px; }
.icon-btn.success { color: var(--success); }
/* A row action that exists but is not allowed (keeps its tooltip, unlike .is-disabled). */
.icon-btn.is-locked { opacity: .4; cursor: not-allowed; }
.icon-btn svg.lg { width: 18px; height: 18px; }

/* Inline link with a leading/trailing glyph (map pin, external link). */
.icon-link { display: inline-flex; align-items: center; gap: 4px; color: var(--brand-text); }
.icon-link svg { width: 14px; height: 14px; }
.icon-link.trailing { gap: 5px; }
.icon-link.trailing svg { width: 13px; height: 13px; }
.pill.inline-tag { margin-inline-start: 4px; }
/* Unit links listed in a residents row. */
.pill.unit-chip { margin-block-end: 2px; margin-inline-end: 2px; }

/* Auth pages: the line under the form. */
.card .sub.foot-link { margin-top: 16px; text-align: center; }

/* ---------- Announcements ---------- */
.announcement-image { margin-top: .4rem; max-width: 100%; max-height: 320px; border-radius: 12px; object-fit: cover; }
.announcement-body { white-space: pre-wrap; margin: .4rem 0 0; }
.cell-img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; }

/* ---------- Compound map picker ---------- */
#map-search { margin-bottom: 8px; }
.map-canvas { height: 320px; border-radius: 12px; border: 1px solid var(--line); }

/* ---------- Gate pass activity ---------- */
.activity-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.activity-row > .grow { flex: 1; }
.activity-row > .when { font-size: .85rem; }

/* ---------- Resident review ---------- */
.doc-item { margin-bottom: 16px; }
.doc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.doc-preview { width: 100%; max-height: 420px; object-fit: contain; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-3); }
.doc-frame { width: 100%; height: 420px; border: 1px solid var(--border); border-radius: 10px; }
.decision-row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.decision-row .reject-form { flex: 1; min-width: 260px; }
.decision-row .reject-form .btn { margin-top: var(--space-2); }

/* ---------- Resident form: unit links ---------- */
.unit-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.unit-list.new { gap: 10px; }
.unit-row.linked {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
}
.unit-row.editable { display: grid; grid-template-columns: 2fr 1fr auto auto; gap: 8px; align-items: center; }
.btn.add-row { margin-top: 10px; }

/* ---------- Amenity week calendar ---------- */
th.col-day { width: 40%; }
th.col-open { width: 15%; }
.week-nav { display: flex; gap: 6px; align-items: center; }
.week-nav .field { width: auto; }
.cal-scroll { overflow-x: auto; }
.cal-grid { min-width: 900px; display: grid; grid-template-columns: 76px repeat(7, minmax(112px, 1fr)); gap: 6px; }
.cal-day { padding: 8px 6px; border-radius: 8px; text-align: center; }
.cal-day.is-selected { background: #eef2ff; box-shadow: inset 0 0 0 1px #c7d2fe; }
.cal-day .name { font-weight: 600; }
.cal-day .date { font-size: .8rem; }
.cal-day .pill { margin-top: 4px; }
.cal-time { font-size: .8rem; padding-top: 10px; text-align: end; }
.cal-empty { border-radius: 8px; border: 1px dashed #e5e7eb; min-height: 52px; }
.cal-empty.is-selected { background: #fafbff; }
.slot { border-radius: 8px; min-height: 52px; padding: 6px 8px; border: 1px solid; font-size: .8rem; }
.slot-top { display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.slot-top .count { white-space: nowrap; }
.slot .reason { margin-top: 2px; }
.slot .booking { margin-top: 4px; line-height: 1.25; }
.slot .booking .who { font-weight: 600; }
/* Slot states (App\Enums\SlotState) — background / border / text. */
.state-available { background: #eafaf1; border-color: #bfe8d2; color: #1a7f52; }
.state-full      { background: #fff4e5; border-color: #f6d9a8; color: #8a5a00; }
.state-reserved  { background: #eef2ff; border-color: #c7d2fe; color: #3730a3; }
.state-blackout  { background: #fdecea; border-color: #f5c6c2; color: #b3261e; }
.state-past      { background: #f4f5f7; border-color: #e5e7eb; color: #6b7280; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 14px; font-size: .8rem; }
.cal-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend .swatch { width: 14px; height: 14px; border-radius: 4px; border: 1px solid; display: inline-block; }
/* The blackout form beside the table: label above each control. */
.stack-form .field + label.minor, .stack-form .error + label.minor { margin-top: 10px; }
.stack-form .btn.block { margin-top: 12px; }
