/* Crane App Control — global styles.
   ----------------------------------------------------------------------------
   Design tokens (this :root block) are the single source of truth for the
   brand. Components below consume them via var(); nothing hardcodes a colour.
   This makes the per-tenant white-label theming possible: a tenant's overrides
   only need to set a handful of --brand-* / --sidebar-* values and the whole
   UI retints. The default values here are the Crane theme (brand blue #283583).
   ----------------------------------------------------------------------------*/

:root {
    /* Brand. Override --brand-primary / --brand-accent (e.g. per-tenant) and the
       derived tokens below retint automatically via color-mix. */
    --brand-primary: #283583;
    --brand-primary-hover: color-mix(in srgb, var(--brand-primary) 82%, #000);
    --brand-primary-soft: color-mix(in srgb, var(--brand-primary) 12%, #fff);  /* tinted bg (pills) */
    --brand-flash: color-mix(in srgb, var(--brand-primary) 18%, transparent);  /* live-row highlight */
    --brand-accent: #5b6bdd;                /* brighter accent for active/focus */
    --on-brand: #ffffff;                    /* text/icons on a brand fill */

    /* Ink ramp (text on light surfaces) */
    --ink: #1c2430;
    --ink-muted: #5b6675;
    --ink-faint: #9aa1ab;

    /* Surfaces (light content area) */
    --bg: #eef1f6;                          /* cool neutral tinted toward brand */
    --bg-accent: #e6eaf4;                   /* used in the content gradient wash */
    --surface: #ffffff;
    --surface-subtle: #f6f7f9;              /* table headers, code, hovers */
    --surface-inset: #eceef2;               /* placeholders, map backdrop */
    --surface-photo: #e7eaef;
    --topbar-bg: rgba(255, 255, 255, .82);  /* translucent sticky top bar */

    /* Borders / hairlines */
    --border: #cdd3db;
    --hairline: #eceef2;
    --hairline-strong: #e1e4ea;

    /* Sidebar (deep navy, tinted toward the Crane brand hue). Override --sidebar-bg
       per tenant; hover/border/gradient derive from it. */
    --sidebar-bg: #14172b;
    --sidebar-bg-hover: color-mix(in srgb, var(--sidebar-bg) 84%, #fff);
    --sidebar-border: color-mix(in srgb, var(--sidebar-bg) 76%, #fff);
    --sidebar-fg: #aab2c6;
    --sidebar-fg-strong: #ffffff;
    --sidebar-fg-faint: #717a95;
    --sidebar-btn-border: #2e3352;

    /* Login backdrop gradient stops */
    --login-grad-1: #202020;
    --login-grad-2: #2c2c2c;
    --login-grad-3: #1a1f2c;

    /* Status / semantic */
    --success-bg: #e8f5e9;
    --success-fg: #1b5e20;
    --danger: #b83b3b;
    --danger-hover: #952f2f;
    --danger-bg: #fdecec;
    --danger-border: #e5b5b5;
    --danger-fg: #8a3030;
    --neutral-bg: #eceef2;
    --neutral-fg: #5b6675;

    /* Radii */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-mark: 9px;
    --radius-lg: 12px;
    --radius-xl: 14px;
    --radius-pill: 20px;

    /* Shadows / elevation */
    --shadow-card: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .07);
    --shadow-card-hover: 0 10px 26px rgba(20, 23, 43, .12);
    --shadow-login: 0 24px 64px rgba(0, 0, 0, .35);
    --shadow-lightbox: 0 24px 64px rgba(0, 0, 0, .5);

    /* Focus ring (keyboard-visible) */
    --focus-ring: 0 0 0 3px rgba(40, 53, 131, .30);

    /* Type */
    --font-sans: "Segoe UI", "Open Sans", system-ui, sans-serif;
    --font-mono: "Consolas", "Cascadia Mono", "Courier New", monospace;

    /* Motion */
    --dur-fast: .12s;
    --ease: ease;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: var(--font-sans); color: var(--ink); }
body { background: var(--bg); }
a { color: inherit; text-decoration: none; }
h1 { font-size: 26px; line-height: 1.15; margin: 0 0 6px; color: var(--ink); font-weight: 800; letter-spacing: -.02em; }

/* ===== Login (chromeless) ===== */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--login-grad-1) 0%, var(--login-grad-2) 50%, var(--login-grad-3) 100%);
    padding: 32px 16px;
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 32px 28px;
    box-shadow: var(--shadow-login);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-mark {
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
}
.login-mark img { width: 40px; height: 40px; object-fit: contain; display: block; }
.login-name { font-weight: 700; font-size: 18px; }
.login-lede { color: var(--ink-muted); font-size: 13px; line-height: 1.5; margin: 0 0 22px; }
.login-error {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger-fg);
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
}
.login-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 12px; color: var(--ink-muted); font-weight: 600; letter-spacing: .3px; }
.field-input {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-size: 14px;
    background: var(--surface);
}
.field-input:focus { outline: 2px solid var(--brand-primary); outline-offset: -1px; border-color: var(--brand-primary); }
.login-btn {
    background: var(--brand-primary);
    color: var(--on-brand);
    border: none;
    border-radius: var(--radius);
    padding: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    margin-top: 4px;
}
.login-btn:hover { background: var(--brand-primary-hover); }

/* The brand selector (D29) is an ordinary .field-input select inside the form, so it needs no
   rules of its own - which is rather the point of it being one control among three rather than a
   separate route in. */

/* ===== Shell (sidebar + main) ===== */
.admin-shell { display: flex; min-height: 100vh; }

.admin-sidebar {
    width: 264px;
    flex-shrink: 0;
    background: linear-gradient(180deg, color-mix(in srgb, var(--sidebar-bg) 78%, #fff) 0%, var(--sidebar-bg) 58%);
    color: var(--sidebar-fg-strong);
    display: flex;
    flex-direction: column;
    padding: 22px 0;
    border-right: 1px solid var(--sidebar-border);
}
.admin-brand { display: flex; align-items: center; gap: 12px; padding: 0 22px 22px; border-bottom: 1px solid var(--sidebar-border); }
.brand-mark {
    width: 40px; height: 40px;
    border-radius: var(--radius-mark);
    background: var(--surface);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.brand-mark img, .login-mark img { width: 26px; height: 26px; object-fit: contain; display: block; }
.brand-text .brand-name { font-weight: 700; font-size: 15px; }
.brand-text .brand-sub { font-size: 11px; color: var(--sidebar-fg-faint); margin-top: 2px; }

.admin-nav { flex: 1; padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; }
.admin-navlink {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--sidebar-fg);
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.admin-navlink:hover { background: var(--sidebar-bg-hover); color: var(--sidebar-fg-strong); }
.admin-navlink.active {
    background: linear-gradient(180deg, var(--brand-accent), var(--brand-primary));
    color: var(--on-brand);
    box-shadow: 0 6px 16px rgba(40, 53, 131, .45);
}
.admin-navlink.active .nav-icon { opacity: 1; }
.nav-icon { display: inline-flex; width: 18px; justify-content: center; opacity: .7; font-size: 13px; }

/* Small section label between nav groups */
.admin-nav .nav-section { font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--sidebar-fg-faint); padding: 16px 14px 6px; }

.admin-footer { padding: 16px 22px; border-top: 1px solid var(--sidebar-border); display: flex; flex-direction: column; gap: 10px; }
.who-email { font-size: 13px; font-weight: 600; color: var(--sidebar-fg-strong); word-break: break-all; }
.who-role { font-size: 11px; color: var(--sidebar-fg-faint); margin-top: 2px; }
.logout-form { margin: 0; }
.logout-btn {
    width: 100%;
    background: transparent;
    color: var(--sidebar-fg);
    border: 1px solid var(--sidebar-btn-border);
    border-radius: var(--radius);
    padding: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.logout-btn:hover { background: var(--sidebar-bg-hover); color: var(--sidebar-fg-strong); }

.admin-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(1100px 380px at 82% -12%, var(--bg-accent), transparent 62%),
        var(--bg);
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 60px;
    padding: 0 36px;
    background: var(--topbar-bg);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
}
.topbar-title { font-weight: 700; font-size: 14px; color: var(--ink); letter-spacing: -.01em; }
.topbar-title .topbar-sub { font-weight: 500; color: var(--ink-muted); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(180deg, var(--brand-accent), var(--brand-primary));
    color: var(--on-brand);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-meta .u-email { font-size: 12px; font-weight: 600; color: var(--ink); }
.user-meta .u-role { font-size: 11px; color: var(--ink-muted); }
.topbar-signout {
    background: var(--surface); color: var(--ink-muted);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 7px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.topbar-signout:hover { background: var(--surface-subtle); color: var(--ink); }
.sidebar-toggle { display: none; }

.admin-main { flex: 1; padding: 30px 36px 48px; overflow-y: auto; }

/* ===== Dashboard ===== */
.page-header { margin-bottom: 24px; }
.page-lede { color: var(--ink-muted); font-size: 14px; margin: 0; line-height: 1.5; }

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    margin-top: 16px;
}
.tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-card);
    transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }
.tile-disabled { opacity: .65; cursor: default; }
.tile-disabled:hover { transform: none; box-shadow: none; }
.tile-title { font-weight: 700; font-size: 16px; }
.tile-sub { color: var(--ink-muted); font-size: 13px; line-height: 1.5; flex: 1; }
.tile-status {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--brand-primary);
    background: var(--brand-primary-soft);
    padding: 4px 8px;
    border-radius: var(--radius-pill);
    align-self: flex-start;
}

.tile-count {
    font-size: 40px;
    font-weight: 800;
    color: var(--brand-primary);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
    margin-bottom: 4px;
}
.tile-disabled .tile-count { color: var(--ink-muted); }

/* Rich dashboard tiles */
.tile-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.tile-icon {
    width: 42px; height: 42px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px;
    background: var(--brand-primary-soft); color: var(--brand-primary);
}
.tile-icon.i-jobs { background: #e3f3ec; color: #0f7a51; }
.tile-icon.i-users { background: #ece6fb; color: #6233ca; }

.live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: #0f7a51; }
.live-dot::before {
    content: ""; width: 8px; height: 8px; border-radius: 50%; background: #18a866;
    box-shadow: 0 0 0 0 rgba(24, 168, 102, .55); animation: live-pulse 2.2s ease-out infinite;
}
@keyframes live-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(24, 168, 102, .55); }
    70%  { box-shadow: 0 0 0 7px rgba(24, 168, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(24, 168, 102, 0); }
}

/* Primary (hero) tile: the brand surface carries the lead metric */
.tile-primary {
    background: linear-gradient(150deg, var(--brand-accent) 0%, var(--brand-primary) 70%);
    border-color: transparent;
    color: var(--on-brand);
    box-shadow: 0 12px 30px rgba(40, 53, 131, .28);
}
.tile-primary .tile-count,
.tile-primary .tile-title { color: var(--on-brand); }
.tile-primary .tile-sub { color: rgba(255, 255, 255, .82); }
.tile-primary .tile-icon { background: rgba(255, 255, 255, .18); color: var(--on-brand); }
.tile-primary .live-dot { color: #d7f5e6; }
.tile-primary .live-dot::before { background: #8ef0bf; box-shadow: 0 0 0 0 rgba(142, 240, 191, .5); }
.tile-primary:hover { box-shadow: 0 18px 40px rgba(40, 53, 131, .38); }

@media (prefers-reduced-motion: reduce) {
    .live-dot::before { animation: none; }
}

/* ===== Results list ===== */
.loading { color: var(--ink-muted); font-size: 14px; padding: 18px 0; }
.empty-state {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
}
.empty-title { font-weight: 700; font-size: 16px; color: var(--ink); margin-bottom: 6px; }
.empty-sub { color: var(--ink-muted); font-size: 13px; max-width: 420px; margin: 0 auto; line-height: 1.5; }

.data-table {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}
.data-table th, .data-table td {
    text-align: left;
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--hairline);
}
.data-table th {
    background: var(--surface-subtle);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--ink-muted);
}
.data-table tbody tr { transition: background var(--dur-fast) var(--ease); }
.data-table tbody tr:hover { background: var(--surface-subtle); }
.data-table tr:last-child td { border-bottom: none; }
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table th.num { text-align: right; }
.data-table .row-action a { color: var(--brand-primary); font-weight: 600; }
.data-table .row-action a:hover { text-decoration: underline; }
.data-table tr.row-new { animation: row-flash 1.8s ease-out 1; }
@keyframes row-flash {
    0%   { background-color: var(--brand-flash); }
    100% { background-color: transparent; }
}

/* ===== Result detail ===== */
.back-link { color: var(--brand-primary); font-size: 13px; font-weight: 600; }
.back-link:hover { text-decoration: underline; }
.detail-grid { display: flex; flex-direction: column; gap: 18px; max-width: 960px; }
.detail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-card);
}
.detail-card h2 { font-size: 14px; font-weight: 700; margin: 0 0 12px; color: var(--ink); }

/* --- Domain triage (/tenants/domains) --- */
/* Stacked cards, one per email domain, so several groups are read down the page. */
.domain-card + .domain-card { margin-top: 16px; }
.domain-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.domain-head h2 { margin: 0; }
.domain-meta { font-size: 13px; color: var(--ink-muted); }
.domain-note { font-size: 13px; color: var(--ink-muted); margin: 0 0 12px; line-height: 1.5; }

/* The one-time invite token (D26). Accented because it is shown once and never again, so it must
   not read as just another read-only field the admin can come back to later. */
.issued-card { border-color: var(--brand-primary); }
.token-field { font-family: var(--font-mono); font-size: 12px; }
.json-block {
    background: var(--surface-subtle);
    border: 1px solid var(--hairline-strong);
    border-radius: var(--radius);
    padding: 14px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    overflow-x: auto;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
.photo-tile {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface-subtle);
}
.photo-tile img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: var(--surface-photo);
}
.photo-caption {
    padding: 8px 10px;
    font-size: 11px;
    color: var(--ink-muted);
    background: var(--surface);
    border-top: 1px solid var(--hairline);
}

/* ===== Toolbar + buttons ===== */
.toolbar { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }

.btn-primary {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--brand-primary);
    color: var(--on-brand);
    border: none;
    border-radius: var(--radius);
    padding: 10px 16px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
}
.btn-primary {
    box-shadow: 0 1px 2px rgba(40, 53, 131, .25);
    transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn-primary:hover { background: var(--brand-primary-hover); box-shadow: 0 4px 12px rgba(40, 53, 131, .30); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; }

.btn-secondary {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 16px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
}
.btn-secondary:hover { background: var(--surface-subtle); }

.btn-danger {
    background: var(--danger);
    color: var(--on-brand);
    border: none;
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
}
.btn-danger:hover { background: var(--danger-hover); }

.btn-link {
    background: transparent;
    border: none;
    color: var(--brand-primary);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    text-decoration: none;
}
.btn-link:hover { text-decoration: underline; }
.btn-link-danger { color: var(--danger); }

/* ===== Focus-visible (keyboard) ===== */
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible,
.btn-link:focus-visible,
.login-btn:focus-visible,
.logout-btn:focus-visible,
.toggle-pill:focus-visible,
.admin-navlink:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-muted); cursor: pointer; }
.toggle input { accent-color: var(--brand-primary); width: 16px; height: 16px; }

.row-actions { display: flex; gap: 4px; align-items: center; justify-content: flex-end; }
.row-archived td { opacity: .55; }

/* ===== Forms ===== */
.form-card { max-width: 720px; padding: 28px; }
.form-row { display: flex; flex-direction: column; margin-bottom: 18px; }
.form-row-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
/* Let grid cells shrink to their track instead of expanding past the card. */
.form-row-2col > .field, .form-row-3col > .field { min-width: 0; }
.form-row .field { margin-bottom: 0; }
.field-textarea { font-family: var(--font-mono); font-size: 12px; min-height: 120px; resize: vertical; }
.field-hint { font-size: 11px; color: var(--ink-muted); margin-top: 4px; line-height: 1.4; }
.checkbox-row { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.checkbox-row input { accent-color: var(--brand-primary); width: 18px; height: 18px; }

.form-actions { display: flex; gap: 10px; margin-top: 8px; }

.validation-message {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
}

/* ===== Section-based form ===== */
.form-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--brand-primary);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin: 24px 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--hairline-strong);
}

.toggle-group {
    display: inline-flex;
    gap: 6px;
    margin-top: 4px;
}
.toggle-pill {
    background: var(--surface);
    color: var(--ink-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.toggle-pill:hover { background: var(--surface-subtle); }
.toggle-pill-active {
    background: var(--brand-primary);
    color: var(--on-brand);
    border-color: var(--brand-primary);
}
.toggle-pill-active:hover { background: var(--brand-primary-hover); }

/* ===== Result detail — references grid ===== */
.refs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    margin: 0;
}
.ref-item {
    background: var(--surface-subtle);
    border: 1px solid var(--hairline-strong);
    border-radius: var(--radius);
    padding: 10px 14px;
}
.ref-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
    margin: 0 0 4px;
}
.ref-value {
    font-size: 14px;
    color: var(--ink);
    margin: 0;
    word-break: break-word;
}

/* ===== Bolt + pressure attempt table ===== */
.bolt-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.bolt-table th, .bolt-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--hairline);
    text-align: left;
    font-size: 13px;
    vertical-align: middle;
}
.bolt-table th {
    background: var(--surface-subtle);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--ink-muted);
}
.bolt-table td.num, .bolt-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.bolt-table tr:last-child td { border-bottom: none; }

.status-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .3px;
    padding: 3px 10px;
    border-radius: var(--radius-lg);
    text-transform: uppercase;
}
.status-pass { background: var(--success-bg); color: var(--success-fg); }
.status-fail { background: var(--danger-bg); color: var(--danger-fg); }
.status-unknown { background: var(--neutral-bg); color: var(--neutral-fg); }

.geo {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-muted);
}

/* ===== Collapsible raw JSON ===== */
.json-collapse { padding: 0; }
.json-collapse > summary {
    padding: 16px 22px;
    font-weight: 600;
    color: var(--ink-muted);
    cursor: pointer;
    list-style: none;
}
.json-collapse > summary::before { content: "▸  "; color: var(--brand-primary); }
.json-collapse[open] > summary::before { content: "▾  "; }
.json-collapse > summary + h3 { margin-top: 0; padding: 0 22px; font-size: 13px; color: var(--ink-muted); }
.json-collapse > h3 { padding: 0 22px; font-size: 13px; color: var(--ink-muted); margin-top: 12px; }
.json-collapse > .json-block { margin: 8px 22px 16px; }

/* ===== Photo lightbox ===== */
.photo-tile-button {
    border: 1px solid var(--border);
    cursor: pointer;
    padding: 0;
    font: inherit;
    text-align: left;
}
.photo-tile-button:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

.lightbox-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 22, 0.88);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    animation: lb-fade 120ms ease-out;
}
@keyframes lb-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.lightbox-content {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.lightbox-content img {
    max-width: 100%;
    max-height: calc(100vh - 140px);
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lightbox);
    background: var(--login-grad-3);
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 22px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: var(--on-brand);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.22); }

.lightbox-download {
    color: var(--sidebar-fg);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.08);
    padding: 8px 14px;
    border-radius: var(--radius);
}
.lightbox-download:hover { background: rgba(255, 255, 255, 0.18); color: var(--on-brand); }

/* ===== Result location map ===== */
.result-map {
    width: 100%;
    height: 320px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface-inset);
}
.result-map .leaflet-control-attribution { font-size: 10px; }

/* ===== Responsive ===== */
/* Hidden checkbox drives the mobile sidebar drawer (CSS-only, no JS). */
.nav-toggle { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.nav-scrim { display: none; }

@media (max-width: 1024px) {
    .admin-topbar { padding: 0 20px; }
    .admin-main { padding: 24px 20px 40px; }
    .form-row-3col { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
    .sidebar-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        width: 38px; height: 38px; border-radius: var(--radius);
        border: 1px solid var(--border); background: var(--surface);
        color: var(--ink); font-size: 18px; cursor: pointer;
    }
    .admin-sidebar {
        position: fixed; top: 0; bottom: 0; left: 0;
        transform: translateX(-100%);
        transition: transform .22s cubic-bezier(.16, 1, .3, 1);
        z-index: 80;
    }
    .nav-toggle:checked ~ .admin-sidebar { transform: translateX(0); }
    .nav-toggle:checked ~ .nav-scrim {
        display: block; position: fixed; inset: 0; z-index: 70;
        background: rgba(10, 13, 25, .5);
    }
    .topbar-user .user-meta { display: none; }
    .admin-main { padding: 20px 16px 36px; overflow-x: auto; }
    .form-row-2col, .form-row-3col { grid-template-columns: 1fr; }
    .tile-grid { gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .admin-sidebar { transition: none; }
}

/* ===== Branding settings ===== */
.branding-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.save-ok {
    background: var(--success-bg); color: var(--success-fg);
    border: 1px solid color-mix(in srgb, var(--success-fg) 25%, #fff);
    padding: 10px 12px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px;
}
/* Shown when the selected tenant has no custom-branding entitlement: what is
   edited here is stored, but their console still renders the Crane default. */
.branding-lapsed {
    background: var(--surface); border: 1px dashed var(--border); color: var(--ink-muted);
    padding: 10px 12px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px;
    line-height: 1.5;
}
.branding-lapsed strong { color: var(--ink); display: block; margin-bottom: 2px; }

.color-input-row { display: flex; align-items: center; gap: 8px; }
.color-swatch {
    width: 38px; height: 38px; padding: 0; flex-shrink: 0;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: none; cursor: pointer;
}
.color-input-row .field-input { flex: 1; min-width: 0; width: 100%; }
.logo-row { display: flex; gap: 16px; align-items: center; }
.logo-chip {
    width: 64px; height: 64px; border-radius: 14px; flex-shrink: 0;
    background: var(--surface); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center; overflow: hidden;
    box-shadow: var(--shadow-card);
}
.logo-chip img { width: 44px; height: 44px; object-fit: contain; }
.logo-actions { display: flex; flex-direction: column; gap: 6px; }

.branding-preview h2 { font-size: 14px; font-weight: 700; margin: 0 0 12px; color: var(--ink); }
.theme-preview {
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    overflow: hidden; display: flex; min-height: 210px;
}
.tp-side {
    width: 96px; padding: 12px 8px; display: flex; flex-direction: column; gap: 6px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--sidebar-bg) 78%, #fff), var(--sidebar-bg) 60%);
}
.tp-logo { width: 30px; height: 30px; border-radius: 8px; background: #fff; display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.tp-logo img { width: 20px; height: 20px; object-fit: contain; }
.tp-nav { font-size: 10px; color: color-mix(in srgb, #fff 72%, var(--sidebar-bg)); padding: 6px 8px; border-radius: 6px; }
.tp-nav-active { background: linear-gradient(180deg, var(--brand-accent), var(--brand-primary)); color: #fff; font-weight: 700; }
.tp-body { flex: 1; padding: 16px; background: var(--bg); display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.tp-hero {
    align-self: stretch; border-radius: var(--radius-lg); padding: 16px; color: #fff;
    background: linear-gradient(150deg, var(--brand-accent), var(--brand-primary) 70%);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--brand-primary) 30%, transparent);
}
.tp-hero-num { font-size: 30px; font-weight: 800; line-height: 1; }
.tp-hero-label { font-size: 12px; opacity: .85; margin-top: 4px; }

@media (max-width: 980px) { .branding-grid { grid-template-columns: 1fr; } }
