/* ============================================================================
   DataCar — single shared stylesheet
   ----------------------------------------------------------------------------
   Every page links this file. Reusable components (public/js/components/*.js)
   also inject a <link> to it inside their shadow roots, so chrome rendered by
   a component is styled by the exact same rules as the page light-DOM content.

   SECURITY NOTE: component markup (logo.js, lang-switcher.js, etc.) is
   ALWAYS static, server-controlled strings. Never build component innerHTML /
   shadow content from user or upstream data — that is the one rule that keeps
   web components injection-safe (see SESSION_NOTES).
   ========================================================================== */

/* ---------------------------------------------------------------------------
   1. Reset + base
--------------------------------------------------------------------------- */
/* The app ships a single dark palette — tell the browser so its NATIVE UI
   (date-picker popup, scrollbars, number spinners, autofill) renders dark
   too instead of clashing white. Popup internals aren't author-styleable;
   color-scheme is the only real lever. */
:root { color-scheme: dark; }

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #0b1120;
    color: #e0e0e0;
    min-height: 100vh;
}

/* Page-specific body padding (single shared stylesheet, scoped by body class) */
body.page-sites { padding: 20px; }
body.page-admin { padding: 20px; }

a { color: inherit; }

/* ---------------------------------------------------------------------------
   2. Buttons (shared)
--------------------------------------------------------------------------- */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    font-weight: 500;
    transition: all 0.2s;
}
.btn-primary { background: #3b82f6; color: white; }
.btn-primary:hover { background: #2563eb; }
/* "Create" actions (Users / Short-Lived Users headers + their modal submits).
   Teal-blue #2996b8d6 on purpose: row-level Edit uses .btn-primary's plain
   blue, and the two must not read as the same control from across the table. */
.btn-create { background: #2996b8d6; color: white; }
.btn-create:hover { background: #1f7a97; }
.btn-danger { background: #dc3545; color: white; }
.btn-danger:hover { background: #c82333; }
.btn-secondary { background: #1e2130; color: #9ca3af; border: 1px solid #2d3148; }
.btn-secondary:hover { background: #2d3148; color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ---------------------------------------------------------------------------
   3. Language switcher (shared) — used by <dc-lang-switcher> and pages
--------------------------------------------------------------------------- */
.lang-switcher {
    display: flex;
    gap: 2px;
    background: #1e2130;
    border-radius: 6px;
    padding: 2px;
}
.lang-btn {
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #9ca3af;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.lang-btn:hover { color: white; }
.lang-btn.active { background: #3b82f6; color: white; }

/* ---------------------------------------------------------------------------
   4. Layout container
--------------------------------------------------------------------------- */
.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ---------------------------------------------------------------------------
   5. Home marketing site-nav (<dc-site-nav>)
--------------------------------------------------------------------------- */
nav.site-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: rgba(22, 24, 34, 0.95);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 3px solid #3b82f6;
    /* biome-ignore lint/suspicious/noDuplicateProperties: pre-existing — intentionally NOT sticky (relative wins); leave as-is, flagged for future review */
    position: relative;
    overflow: hidden;
}
nav.site-nav::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 3px;
    background: repeating-linear-gradient(
        90deg,
        #3b82f6 0px,
        #3b82f6 12px,
        #1e40af 12px,
        #1e40af 24px
    );
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: white;
}
.nav-brand span {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.nav-links {
    display: flex;
    gap: 16px;
    align-items: center;
}
.nav-links a {
    color: #9ca3af;
    text-decoration: none;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s;
}
.nav-links a:hover { color: white; background: #1e2130; }
.btn-login {
    background: #3b82f6 !important;
    color: white !important;
    font-weight: 500;
}
.btn-login:hover { background: #2563eb !important; }
.site-nav .lang-switcher { background: #1e2130; margin-left: 8px; }

/* ---------------------------------------------------------------------------
   6. App header (<dc-app-header>) — iframe wrapper top bar (index.html)
--------------------------------------------------------------------------- */
header.app-header {
    background: #161822;
    color: white;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid #1e2130;
    min-height: 56px;
}
header.app-header a {
    color: #9ca3af;
    text-decoration: none;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s;
}
header.app-header a:hover { color: white; background: #1e2130; }
header.app-header .brand {
    color: white;
    font-weight: 600;
    font-size: 15px;
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}
/* App wrapper layout: top bar takes its natural height (~5-8% of viewport),
   the proxied site gets every remaining pixel. Without the fixed-height flex
   column, the stage gets no height and the iframe collapses to its
   browser-default ~150px. */
body.page-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    /* biome-ignore lint/suspicious/noDuplicateProperties: intentional dvh progressive-enhancement fallback */
    height: 100dvh; /* mobile: exclude dynamic browser chrome */
    overflow: hidden; /* the iframe scrolls internally */
}

/* Waiting area (index.html): the iframe sits in a position:relative stage so
   the overlay can cover exactly the proxied region (the top bar stays usable
   — the user can still hit "Back to Sites" while the login chain runs). The
   overlay is opaque so the blank iframe behind it never flashes white. */
.app-stage {
    position: relative;
    display: flex;
    flex-grow: 1;
    min-height: 0;
}
.app-frame { flex-grow: 1; height: 100%; border: none; width: 100%; background: white; }

/* The car does its donut: a top-view car + dashed skid ring spin about the
   center. .hidden (shared) lifts the whole overlay on the iframe's `load`. */
.waiting-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: #0b1120;
}
.waiting-car {
    width: 96px;
    height: 96px;
    animation: waiting-donut 1.6s linear infinite;
}
.waiting-skid {
    fill: none;
    stroke: #2996b8;
    stroke-opacity: 0.35;
    stroke-width: 3;
    stroke-dasharray: 10 12;
    stroke-linecap: round;
}
.waiting-wheel { fill: #1f2937; }
.waiting-chassis { fill: #2996b8; }
.waiting-glass { fill: #0b1120; fill-opacity: 0.55; }
.waiting-label {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.waiting-hint { font-size: 14px; color: #6b7280; text-align: center; }
@keyframes waiting-donut {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .waiting-car { animation-duration: 4s; }
}

/* ---------------------------------------------------------------------------
   7. Page header (<dc-page-header>) — sites/admin card header
--------------------------------------------------------------------------- */
header.page-header {
    background: #161822;
    color: white;
    padding: 20px 24px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #1e2130;
    border-bottom: none;
    position: relative;
    overflow: hidden;
}
header.page-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: repeating-linear-gradient(
        90deg,
        #3b82f6 0px,
        #3b82f6 12px,
        #1e40af 12px,
        #1e40af 24px
    );
}
header.page-header h1 { font-size: 20px; font-weight: 600; }
.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}
.page-header .lang-switcher { background: #0f1117; }

/* ---------------------------------------------------------------------------
   8. Main content card (<dc-main>)
--------------------------------------------------------------------------- */
main.main-content {
    background: #161822;
    padding: 30px;
    border-radius: 0 0 12px 12px;
    border: 1px solid #1e2130;
    border-top: none;
}
main.main-content.admin-main { padding: 0; }
/* Content is SLOTTED light-DOM inside <dc-main>; root the selector at the
   light-DOM host (not the shadow <main>) so the descendant combinator matches. */
dc-main:not([admin]) h2 {
    color: #e0e0e0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #1e2130;
    font-size: 18px;
}

/* ---------------------------------------------------------------------------
   9. Footer (<dc-footer>)
--------------------------------------------------------------------------- */
footer.page-footer {
    text-align: center;
    padding: 24px;
    color: #4b5563;
    font-size: 13px;
    border-top: 1px solid #1e2130;
}

/* ---------------------------------------------------------------------------
   10. Home hero
--------------------------------------------------------------------------- */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 100px 20px 80px;
    max-width: 800px;
    margin: 0 auto;
}
.hero-logo { margin-bottom: 32px; }
.hero h1 {
    font-size: 48px;
    font-weight: 800;
    color: white;
    margin-bottom: 16px;
    letter-spacing: -1px;
    line-height: 1.1;
}
.hero h1 em { font-style: normal; color: #3b82f6; }
.hero p {
    font-size: 18px;
    color: #9ca3af;
    max-width: 560px;
    line-height: 1.6;
    margin-bottom: 40px;
}
.hero-cta { display: flex; gap: 16px; }
.hero-cta a {
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}
.cta-primary { background: #3b82f6; color: white; }
.cta-primary:hover { background: #2563eb; transform: translateY(-1px); }
.cta-secondary { background: #1e2130; color: #e0e0e0; border: 1px solid #2d3148; }
.cta-secondary:hover { background: #2d3148; }

/* ---------------------------------------------------------------------------
   11. Home features
--------------------------------------------------------------------------- */
.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 1000px;
    margin: 0 auto;
    padding: 60px 40px 100px;
}
.feature-card {
    background: #161822;
    border: 1px solid #1e2130;
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
    transition: border-color 0.2s;
}
.feature-card:hover { border-color: #3b82f6; }
.feature-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    background: #1e2130;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.feature-card h3 { font-size: 18px; color: white; margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: #9ca3af; line-height: 1.5; }

/* ---------------------------------------------------------------------------
   12. Sites grid + cards (sites.html)
--------------------------------------------------------------------------- */
.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.site-card {
    border: 1px solid #1e2130;
    border-radius: 10px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
    background: #0f1117;
}
.site-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}
.site-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 14px;
    background: #1e2130;
    color: #3b82f6;
}
.site-card-name { font-size: 17px; font-weight: 600; color: #e0e0e0; margin-bottom: 6px; }
.site-card-desc { font-size: 14px; color: #6b7280; line-height: 1.4; }

/* ---------------------------------------------------------------------------
   13. Auth cards (login.html / change-password.html)
--------------------------------------------------------------------------- */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}
.auth-card {
    background: #161822;
    padding: 40px;
    border-radius: 12px;
    border: 1px solid #1e2130;
    width: 100%;
    max-width: 400px;
    position: relative;
}
.auth-header { text-align: center; margin-bottom: 32px; }
.auth-header svg { margin-bottom: 16px; }
.auth-card h1 {
    color: #e0e0e0;
    margin-bottom: 6px;
    font-size: 22px;
    font-weight: 600;
}
.auth-subtitle { color: #6b7280; font-size: 14px; }
.auth-card .lang-switcher { position: absolute; top: 16px; right: 16px; }
.auth-card .page-footer { padding: 0; margin-top: 24px; border-top: none; }

/* ---------------------------------------------------------------------------
   14. Forms (shared)
--------------------------------------------------------------------------- */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #9ca3af;
    font-weight: 500;
    font-size: 14px;
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select {
    width: 100%;
    padding: 12px 14px;
    background: #0f1117;
    border: 1px solid #1e2130;
    border-radius: 6px;
    font-size: 15px;
    color: #e0e0e0;
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus { outline: none; border-color: #3b82f6; }
.form-group input::placeholder { color: #4b5563; }
/* Native calendar trigger icon: dim until hovered so it reads as chrome, not content. */
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.55; transition: opacity 0.15s; }
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
button[type="submit"].btn-block {
    width: 100%;
    padding: 12px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
button[type="submit"].btn-block:hover { background: #2563eb; }

/* error / success messages (login, change-password) */
.alert { padding: 12px; border-radius: 6px; margin-bottom: 15px; font-size: 14px; }
.alert-success { background: rgba(52, 211, 153, 0.1); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.3); }
.alert-error { background: rgba(248, 113, 113, 0.1); color: #f87171; border: 1px solid rgba(248, 113, 113, 0.3); }
.error-message { background: rgba(220, 53, 69, 0.1); color: #f87171; padding: 12px; border-radius: 6px; margin-bottom: 20px; display: none; border: 1px solid rgba(220, 53, 69, 0.3); font-size: 14px; }
.success-message { background: rgba(52, 211, 153, 0.1); color: #34d399; padding: 12px; border-radius: 6px; margin-bottom: 20px; display: none; border: 1px solid rgba(52, 211, 153, 0.3); font-size: 14px; }
.auth-footer { text-align: center; margin-top: 24px; color: #4b5563; font-size: 13px; }

.password-requirements { margin-top: 8px; font-size: 12px; color: #6b7280; line-height: 1.6; }
.password-requirements .met { color: #34d399; }
.password-requirements .unmet { color: #f87171; }

/* ---------------------------------------------------------------------------
   15. Admin dashboard (admin.html)
--------------------------------------------------------------------------- */
dc-main[admin] .tab-bar {
    display: flex;
    border-bottom: 1px solid #1e2130;
    background: #0f1117;
}
dc-main[admin] .tab-btn {
    padding: 14px 24px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    white-space: nowrap;
}
dc-main[admin] .tab-btn:hover { color: #e0e0e0; background: rgba(59, 130, 246, 0.05); }
dc-main[admin] .tab-btn.active { color: #3b82f6; background: rgba(59, 130, 246, 0.1); }
dc-main[admin] .tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #3b82f6;
}
dc-main[admin] .tab-content { display: none; padding: 24px; }
dc-main[admin] .tab-content.active { display: block; }

dc-main[admin] .section { margin-bottom: 30px; }
dc-main[admin] .section h2 {
    color: #e0e0e0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #1e2130;
    font-size: 18px;
}

dc-main[admin] .form-group { flex: 1; min-width: 150px; }
/* :not(checkbox): the width:100% + field chrome is for TEXT fields — it was
   stretching the "Force change on login" CHECKBOX to full group width and
   pushing the label outside the card. */
dc-main[admin] .form-group input:not([type='checkbox']),
dc-main[admin] .form-group select {
    width: 100%;
    padding: 10px 12px;
    background: #161822;
    border: 1px solid #1e2130;
    border-radius: 6px;
    font-size: 14px;
    color: #e0e0e0;
}
dc-main[admin] .form-group input:focus,
dc-main[admin] .form-group select:focus { outline: none; border-color: #3b82f6; }
dc-main[admin] .form-group select option { background: #161822; }

dc-main[admin] .users-table { width: 100%; border-collapse: collapse; }
/* The Site Credentials table pins its column geometry with a <colgroup>
   (admin.html). table-layout:fixed makes the browser honor those % widths
   exactly, so the Actions column sits at the same x-position for flat rows,
   the pool header, AND the inner account rows — this is what fixed the
   #149e expanded misalignment (inner-row buttons no longer drift left). */
dc-main[admin] #siteCredentialsTable { table-layout: fixed; }
/* Site Credentials column geometry (admin.html <colgroup>). table-layout:fixed
   makes the browser honor these % widths exactly, so the Actions column sits
   at the same x-position for flat rows, the pool header, AND the inner
   account rows — this is what fixed the #149e expanded misalignment (inner-row
   buttons no longer drift left). Site gets a capped, ellipsized column; the
   data columns are sized to fit their content (compact date, 1-line status);
   Actions gets 25% to hold the 4 per-account buttons. */
dc-main[admin] #siteCredentialsTable .col-site { width: 22%; }
dc-main[admin] #siteCredentialsTable .col-username { width: 14%; }
dc-main[admin] #siteCredentialsTable .col-status { width: 12%; }
dc-main[admin] #siteCredentialsTable .col-lastsuccess { width: 18%; }
dc-main[admin] #siteCredentialsTable .col-failures { width: 9%; }
dc-main[admin] #siteCredentialsTable .col-actions { width: 25%; }
dc-main[admin] .users-table th,
dc-main[admin] .users-table td { padding: 12px; text-align: left; border-bottom: 1px solid #1e2130; }
dc-main[admin] .users-table th {
    background: #0f1117;
    font-weight: 600;
    color: #9ca3af;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
dc-main[admin] .users-table tr:hover { background: rgba(59, 130, 246, 0.05); }
.status-active { color: #34d399; }
.status-expired { color: #f87171; }
.status-inactive { color: #6b7280; }
.status-locked { color: #f59e0b; }

/* ============ Inline-style migration vocabulary (SESSION_NOTES #73) ======
   All styling for dynamically rendered (template-literal) markup lives
   HERE, not in style="" attributes — ui-css-contract.test.js bans style=" under public/.
   .style.x = assignments in JS remain allowed: those are show/hide BEHAVIOR. */

/* Small chips next to usernames (Short-Lived badge, Locked flag) */
.chip-locked, .chip-ephemeral {
    color: #f59e0b;
    border: 1px solid #f59e0b;
    border-radius: 4px;
    padding: 0 4px;
    font-size: 0.75rem;
}

/* Table cell helpers */
.cell-sm { font-size: 12px; }
.cell-muted { color: #6b7280; }
.cell-warn { color: #f59e0b; }
.cell-error { color: #f87171; }
.cell-nowrap { white-space: nowrap; }
/* Per-account action set (Edit/Test/Disable/Delete [+ Add account]). Explicitly
   non-wrapping: with the compact Last-Success date the Actions column has
   enough room for all four on one line, and we WANT them on one line rather
   than silently dropping off the edge. (.cell-actions wraps only if a site
   ever exceeds the column; the header + flat rows keep it nowrap via cell-nowrap.) */
/* Per-account action set (Edit/Test/Disable/Delete [+ Add account]). Plain
   inline buttons (default td inline layout) so each <td> stretches to fill
   its grid column and the buttons sit in the right-aligned Actions column.
   Do NOT use display:flex here — a flex/inline-flex box inside a <td> does
   not stretch to the cell width, which left the buttons piling up at the
   row's left edge (the #149e expanded misalignment). The wrapping we saw
   earlier was a column-WIDTH problem (the wide toLocaleString date), already
   fixed by the compact fmtCompactDate + constrained Site column. */
.cell-actions { display: inline; }
/* Buttons are plain inline (not flex) so the parent <td> stretches to its
   grid column and they sit in the right-aligned Actions column (#149e). The
   6px between-button gap is set here via margin (inline layout can't use
   flex gap). */
.cell-actions .btn { margin-left: 6px; }
.cell-actions .btn:first-child { margin-left: 0; }
/* Pool inner rows: a compact button so all 4 (Edit/Test/Disable/Delete) fit
   on ONE line inside the fixed 25% Actions column instead of wrapping. The
   header's Add account + chevron already fits easily; the 4-button set is the
   tight case this solves. */
tr.pool-child .cell-actions .btn { padding: 3px 8px; font-size: 11px; }
.cell-mono { font-family: monospace; }
.cell-ellipsis {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cell-sub { color: #6b7280; font-size: 11px; }   /* secondary id line under a label */
.pool-marker { color: #2996b8; font-weight: 600; } /* teal "Pool" mode badge (credentialPool sites) */
.btn-teal { background: rgba(41, 150, 184, 0.15); border-color: #2996b8; color: #2996b8; }
.btn-teal:hover { background: rgba(41, 150, 184, 0.28); }
.dot-status { color: #34d399; font-size: 11px; } /* credential health dot in rows */
.dot-status.dot-warn { color: #f59e0b; } /* amber: some account needs attention */
.dot-status.dot-err { color: #f87171; } /* red: site unservable */

/* ADR-025 + pool UI polish (#149): pooled credential sites render as a
   collapsible GROUP. The .pool-group header row (site name + health dot +
   "N accounts" + chevron + Add account / Edit) toggles the hidden
   .pool-child rows that follow it (one per account, with the full
   per-account action set). The header carries NO generic action button —
   the whole row is the toggle; buttons keep their data-action dispatch. */
tr.pool-group { cursor: pointer; }
/* #149d: NO heavy top divider on the pool header — the user wants the pool
   group NOT visually emphasized; it reads as a normal row. Only the subtle
   inherited 1px row border separates it. */
tr.pool-group .pool-chevron {
    display: inline-block; color: #9ca3af; font-size: 12px;
    margin-left: 4px; transition: transform 0.15s ease;
}
tr.pool-group.open .pool-chevron { transform: rotate(90deg); }
/* Inner account rows are collapsed by default and shown only when their
   header group is .open. Class-driven (not the `hidden` attribute) so the
   state is set purely by CSS and survives the full re-render load() does
   after every account action — this is what fixed the #149c bug where
   re-rendering left the inner rows visible while the header stayed
   collapsed, so only the per-account buttons showed. */
tr.pool-child { display: none; }
tr.pool-group.open + tr.pool-child, tr.pool-group.open ~ tr.pool-child { display: table-row; }
tr.pool-child td { color: #6b7280; font-size: 0.92em; }
/* Collapsed pool group: the header's bottom border is the only stray line
   visible when its inner rows are hidden — remove it so a collapsed group
   reads as a single clean row (the user's "nothing should be seen"). When
   expanded (.open) the inherited 1px border returns as the normal row
   separator. */
tr.pool-group td { border-bottom: 1px solid #1e2130; }
tr.pool-group:not(.open) td { border-bottom: none; }
/* Site cell: long names ellipsize (the column width is pinned by the
   #siteCredentialsTable <colgroup>, see above) so the Site column never
   stretches past its 22% and shoves the Actions column off-position. */
dc-main[admin] #siteCredentialsTableBody td:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Audit-feed event-type colors (JS maps event -> one of these classes) */
.evt-success, .evt-error, .evt-warn, .evt-muted, .evt-info, .evt-default {
    font-weight: 500;
}
.evt-success { color: #34d399; }
.evt-error { color: #f87171; }
.evt-warn { color: #f59e0b; }
.evt-muted { color: #6b7280; }
.evt-info { color: #3b82f6; }
.evt-default { color: #9ca3af; }

/* Layout/text helpers replacing inline styles in static HTML */
.form-inline { display: inline; }
.hidden { display: none; }
.scroll-x { overflow-x: auto; }
.btn-link {
    background: none;
    border: none;
    color: #6b7280;
    text-decoration: none;
    cursor: pointer;
    padding: 0;
    font: inherit;
}
.alert-container { padding: 12px 24px 0; }
.row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.row-gap {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
.filter-label { margin: 0; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.mb-15 { margin-bottom: 15px; }
.help-top { color: #94a3b8; font-size: 0.8rem; margin-top: 10px; }
.help-block { color: #9ca3af; font-size: 0.8rem; margin: 10px 0 15px; }
.help-13 { color: #9ca3af; font-size: 13px; margin-bottom: 15px; }
.help-sm { color: #9ca3af; font-size: 12px; }
.modal-danger { color: #f87171; margin-top: 10px; }
.stats-line { font-size: 13px; color: #6b7280; margin-bottom: 10px; }
.pager-row { display: flex; justify-content: center; gap: 10px; margin-top: 15px; }
.pager-info { font-size: 13px; color: #9ca3af; padding: 5px 10px; }
.plain-link { text-decoration: none; color: inherit; }

/* Standalone (non-app-shell) pages: farewell + proxy error */
.farewell-body { background: #0b1120; }
.farewell-hero { text-align: center; padding: 96px 24px; }
.farewell-title { color: #e0e0e0; }
.farewell-message { color: #9ca3af; margin-top: 12px; }
.farewell-redirect { color: #6b7280; margin-top: 28px; font-size: 14px; }
.error-body { font-family: sans-serif; padding: 40px; background: #0b1120; color: #e5e7eb; }
.error-title { font-size: 18px; color: #f87171; }
.error-message { font-size: 14px; color: #9ca3af; }
/* ======================================================================== */

/* Small status chip for table cells (e.g. Locked next to an ephemeral
   username). Class-based on purpose — no inline styles in JS templates. */
.chip-locked {
    color: #f59e0b;
    border: 1px solid #f59e0b;
    border-radius: 4px;
    padding: 0 4px;
    font-size: 0.75rem;
}
dc-main[admin] .actions { display: flex; gap: 5px; }

dc-main[admin] #usernameFilter {
    padding: 10px 12px;
    width: 100%;
    max-width: 300px;
    background: #0f1117;
    border: 1px solid #1e2130;
    border-radius: 6px;
    font-size: 14px;
    color: #e0e0e0;
}
dc-main[admin] #usernameFilter:focus { outline: none; border-color: #3b82f6; }
dc-main[admin] #usernameFilter::placeholder { color: #4b5563; }

dc-main[admin] .filter-input {
    padding: 8px 12px;
    background: #0f1117;
    border: 1px solid #1e2130;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 13px;
    max-width: 200px;
}
dc-main[admin] .filter-input:focus { outline: none; border-color: #3b82f6; }
dc-main[admin] .filter-input::placeholder { color: #4b5563; }
dc-main[admin] .filter-select {
    padding: 8px 12px;
    background: #0f1117;
    border: 1px solid #1e2130;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 13px;
    max-width: 180px;
}

/* modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    /* All open() paths set display:flex — centering lives HERE, not in the
       per-modal margin. Tall content is capped + scrolled by .modal-content. */
    align-items: center;
    justify-content: center;
}
.modal-content {
    background: #161822;
    border: 1px solid #1e2130;
    margin: auto;
    padding: 24px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    /* Viewport-relative cap: on short screens the dialog never grows past the
       visible area (the old unbounded box overflowed its panel). vh fallback
       for browsers without dvh. Internal scroll keeps header/footer usable. */
    max-height: 85vh;
    /* biome-ignore lint/suspicious/noDuplicateProperties: intentional dvh progressive-enhancement fallback */
    max-height: 85dvh;
    overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.modal-header h3 { color: #e0e0e0; font-size: 18px; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #6b7280; transition: color 0.2s; }
.modal-close:hover { color: #e0e0e0; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal-content .form-group label { color: #9ca3af; }

/* ---------------------------------------------------------------------------
   16. Logo host
--------------------------------------------------------------------------- */
dc-logo { display: inline-flex; align-items: center; }
