/* TechTools Agents: dark theme, mobile-first.
   Loaded AFTER /shared-topnav.css so :root below seeds --tt-topnav-h.
   Colour carries one meaning only (agent state): green = spending now, indigo = ready,
   grey = off or in transition, amber = needs you, red = something is wrong.
   Every overlay layer sits above the navbar stack: calc(var(--tt-z-modal,1000) + N). */

:root {
    --primary-bg: #0a0a0f;
    --secondary-bg: #141419;
    --card-bg: #1a1a24;
    --raised-bg: #20202c;
    --border-color: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.18);
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-soft: #a5b4fc;
    --accent-gradient: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    --green: #34d399;
    --red: #f87171;
    --amber: #fbbf24;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.72);
    --text-muted: rgba(255, 255, 255, 0.55);
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --transition-fast: 0.15s ease;
    --tt-topnav-h: 64px;   /* seed; tt-navbar.js publishes the exact value at runtime */
    --sheet-w: 560px;
    color-scheme: dark;
}

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

/* The HTML hidden attribute must always win over author display rules. */
[hidden] { display: none !important; }

html, body { overflow-x: clip; }   /* never overflow-x:hidden: it breaks the sticky navbar */

body {
    background: var(--primary-bg);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
}
body.no-scroll { overflow: hidden; }

.page { max-width: 1320px; margin: 0 auto; padding: var(--spacing-md); }

.sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

a { color: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }

.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--text-muted); }
.money-pos { color: var(--green); }

/* ==================== Buttons ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 44px;
    min-width: 44px;
    padding: 0.55rem 1rem;
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font: inherit;
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}
.btn:hover { background: var(--raised-bg); border-color: var(--border-strong); }
.btn-primary { background: var(--accent-gradient); border-color: transparent; color: #fff; }
.btn-primary:hover { filter: brightness(1.1); background: var(--accent-gradient); border-color: transparent; }
.btn-danger { background: rgba(248, 113, 113, 0.14); border-color: rgba(248, 113, 113, 0.45); color: #fecaca; }
.btn-danger:hover { background: rgba(248, 113, 113, 0.24); border-color: rgba(248, 113, 113, 0.6); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-primary); border-color: transparent; }
.btn-icon { padding: 0.55rem; }
.btn-lg { padding: 0.8rem 1.5rem; font-size: 1rem; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn:disabled:hover { background: var(--card-bg); border-color: var(--border-color); }
.btn-primary:disabled:hover { background: var(--accent-gradient); filter: none; }
.btn-link {
    background: none; border: 0;
    color: var(--accent-soft);
    font: inherit; font-size: 0.9rem; font-weight: 500;
    min-height: 44px; padding: 0 0.35rem;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.btn-link:hover { color: #c7d2fe; }
.btn .fa-circle-notch { font-size: 0.9em; }

.chip {
    display: inline-flex; align-items: center; gap: 0.45rem;
    min-height: 44px;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-secondary);
    font: inherit; font-size: 0.88rem; font-weight: 500;
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}
.chip:hover { border-color: var(--border-strong); color: var(--text-primary); }
.chip[aria-pressed="true"] { border-color: rgba(99, 102, 241, 0.7); background: rgba(99, 102, 241, 0.14); color: #e0e7ff; }
.chip i { color: var(--accent-soft); }

/* ==================== Gate ==================== */
.gate { display: flex; justify-content: center; padding: 6vh 0 3vh; }
.gate-card {
    width: 100%;
    max-width: 30rem;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem 1.4rem 1.6rem;
    text-align: center;
}
.gate-icon {
    width: 72px; height: 72px;
    margin: 0 auto 1.2rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.9rem;
    color: #fff;
    background: var(--accent-gradient);
    border-radius: 1.1rem;
}
.gate-card h1 { font-size: 1.5rem; line-height: 1.25; letter-spacing: -0.01em; margin-bottom: 0.6rem; }
.gate-text { color: var(--text-secondary); line-height: 1.6; margin: 0 auto 1.3rem; max-width: 26rem; }
.gate-points { list-style: none; text-align: left; display: grid; gap: 0.7rem; margin: 0 auto 1.6rem; max-width: 22rem; }
.gate-points li { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); gap: 0.4rem; align-items: start; color: var(--text-primary); font-size: 0.95rem; }
.gate-points i { color: var(--accent-soft); margin-top: 0.2rem; text-align: center; }
.gate-signin { width: 100%; max-width: 22rem; }
.gate-fine { margin-top: 1rem; font-size: 0.82rem; color: var(--text-muted); }
.gate-fine a { margin-left: 0.25rem; }

/* ==================== App header ==================== */
.app-head {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: nowrap;
    min-height: 56px;
    margin-bottom: var(--spacing-sm);
}
.app-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    flex: 0 0 auto;
    white-space: nowrap;
}
.head-spacer { flex: 1 1 auto; }

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex: 0 0 auto;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--green);
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(52, 211, 153, 0.1);
}
.live-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: currentColor; animation: agBlink 2.4s ease-in-out infinite; }
.live-badge[data-state="retry"] { color: var(--amber); background: rgba(251, 191, 36, 0.1); }
.live-badge[data-state="off"] { color: var(--text-muted); background: rgba(255, 255, 255, 0.06); }
.live-badge[data-state="off"] .live-dot { animation: none; }
.live-retry { min-height: 44px; padding: 0 0.6rem; font-size: 0.8rem; color: var(--text-primary); gap: 0.35rem; }

.balance-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.balance-chip:hover { border-color: var(--border-strong); background: var(--raised-bg); }
.balance-chip i { color: var(--text-muted); font-size: 0.85rem; }
.balance-chip[data-level="low"] { border-color: rgba(251, 191, 36, 0.5); color: var(--amber); }
.balance-chip[data-level="low"] i { color: var(--amber); }
.balance-chip[data-level="zero"] { border-color: rgba(248, 113, 113, 0.5); color: var(--red); }
.balance-chip[data-level="zero"] i { color: var(--red); }

.new-btn { flex: 0 0 auto; }
.new-short { display: none; }

/* ==================== Tabs ==================== */
.tabs {
    display: flex;
    gap: var(--spacing-xs);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 44px;
    padding: 0.55rem 0.95rem;
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.92rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    flex: 0 0 auto;
}
.tab:hover { color: var(--text-primary); }
.tab[aria-selected="true"] { color: var(--text-primary); border-bottom-color: var(--accent-primary); }
.top-tabs { margin-bottom: var(--spacing-md); }
.tab .count { color: var(--amber); font-variant-numeric: tabular-nums; }

/* ==================== Split (roster + docked sheet) ==================== */
.split { display: block; }
.main-col { min-width: 0; }

/* ==================== Top slot, banners ==================== */
.top-slot { margin: var(--spacing-xs) 0 var(--spacing-md); }
.banner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.4rem 0.75rem;
    align-items: start;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid;
    font-size: 0.92rem;
    line-height: 1.5;
}
.banner > i { margin-top: 0.2rem; }
.banner-text { min-width: 0; color: var(--text-primary); overflow-wrap: anywhere; }
.banner-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--spacing-sm); }
.banner-actions .btn { width: 100%; }
.banner-note { color: var(--text-secondary); font-size: 0.88rem; }
.banner[data-tone="info"] { background: rgba(99, 102, 241, 0.1); border-color: rgba(99, 102, 241, 0.35); }
.banner[data-tone="info"] > i { color: var(--accent-soft); }
.banner[data-tone="warn"] { background: rgba(251, 191, 36, 0.08); border-color: rgba(251, 191, 36, 0.4); }
.banner[data-tone="warn"] > i { color: var(--amber); }
.banner[data-tone="danger"] { background: rgba(248, 113, 113, 0.08); border-color: rgba(248, 113, 113, 0.4); }
.banner[data-tone="danger"] > i { color: var(--red); }
.banner[data-tone="ok"] { background: rgba(52, 211, 153, 0.08); border-color: rgba(52, 211, 153, 0.4); }
.banner[data-tone="ok"] > i { color: var(--green); }
.banner.slim { padding: 0.35rem 0.4rem 0.35rem 1rem; align-items: center; }
.banner.slim > i { margin-top: 0; align-self: center; }
/* phones: the slim banner's action and its close button share one row (the close button is 44 px, not a row) */
.banner.slim .banner-actions { flex-wrap: nowrap; }
.banner.slim .banner-actions .btn { flex: 1 1 auto; width: auto; }
.banner.slim .banner-actions .btn-icon { flex: 0 0 44px; width: 44px; }

/* ==================== Setup card ==================== */
.setup-card {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    transition: border-color 0.3s ease, background 0.3s ease;
}
.setup-card.is-success { border-color: rgba(52, 211, 153, 0.5); background: rgba(52, 211, 153, 0.08); }
.setup-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--spacing-sm); margin-bottom: 0.8rem; }
.setup-top h2 { font-size: 1.05rem; font-weight: 600; }
.setup-count { color: var(--text-muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.setup-step { display: grid; grid-template-columns: 1.9rem minmax(0, 1fr); gap: 0.2rem 0.7rem; padding: 0.35rem 0; }
.step-num {
    width: 1.6rem; height: 1.6rem;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 700;
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    margin-top: 0.1rem;
}
.setup-step[data-state="active"] .step-num { border-color: var(--accent-primary); color: #fff; background: rgba(99, 102, 241, 0.25); }
.setup-step[data-state="done"] .step-num { border-color: transparent; color: var(--green); font-size: 1.1rem; }
.setup-step[data-state="locked"] { opacity: 0.55; }
.step-title { font-weight: 600; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.step-title .btn-link { margin-left: -0.35rem; }
.step-title .fa-lock { color: var(--text-muted); font-size: 0.85rem; }
.step-body { grid-column: 2; display: grid; gap: 0.6rem; padding-top: 0.4rem; min-width: 0; }
.step-row { display: flex; flex-wrap: wrap; gap: var(--spacing-sm); align-items: flex-end; }
.step-row .field { flex: 1 1 16rem; margin: 0; }
.step-row .helper { flex: 1 1 14rem; align-self: center; }
.step-body > .field { max-width: 28rem; }
.helper { font-size: 0.84rem; color: var(--text-muted); line-height: 1.5; }
.inline-err { display: flex; gap: 0.5rem; align-items: flex-start; color: #fecaca; font-size: 0.88rem; line-height: 1.45; }
.inline-err i { color: var(--red); margin-top: 0.2rem; }
.inline-info { display: flex; gap: 0.5rem; align-items: flex-start; color: var(--text-primary); font-size: 0.88rem; line-height: 1.45; }
.inline-info i { color: var(--accent-soft); margin-top: 0.2rem; }
.setup-skip { justify-self: start; }
.setup-via { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.9rem; line-height: 1.45; color: var(--text-secondary); overflow-wrap: anywhere; }
.setup-via i { color: var(--accent-soft); margin-top: 0.2rem; }
.other-ways { display: flex; flex-wrap: wrap; align-items: center; gap: var(--spacing-sm); font-size: 0.88rem; color: var(--text-secondary); }
.code-input {
    font: 600 1.6rem/1 ui-monospace, 'SFMono-Regular', Menlo, monospace;
    letter-spacing: 0.5em;
    text-align: center;
    min-height: 56px;
    width: 100%;
    max-width: 16rem;
    padding: 0.5rem 0 0.5rem 0.5em;
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}
.code-input:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25); }
.code-input[aria-invalid="true"] { border-color: rgba(248, 113, 113, 0.6); }

/* ==================== Status strip ==================== */
.status-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    align-items: center;
    min-height: 28px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 var(--spacing-sm);
    font-variant-numeric: tabular-nums;
}
.status-strip > span { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.status-strip i { font-size: 0.8rem; }
.status-strip .st-working { color: var(--green); }
.status-strip .st-idle { color: var(--accent-soft); }
.status-strip .st-paused { color: var(--amber); }
.status-strip .st-error { color: var(--red); }

/* ==================== Roster ==================== */
.roster {
    list-style: none;
    margin: 0;
    padding: 0;
    container-type: inline-size;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: clip;
    background: var(--secondary-bg);
}
.roster:empty { display: none; }
.agent-row {
    --state-color: rgba(255, 255, 255, 0.22);
    position: relative;
    display: grid;
    grid-template-columns: 4px minmax(0, 1fr) auto;
    grid-template-areas:
        "accent badge money"
        "accent name  act"
        "accent line  act";
    align-items: center;
    column-gap: 0.75rem;
    height: 104px;
    padding: 0.55rem 0.5rem 0.45rem 0;
    border-top: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}
.agent-row:first-child { border-top: 0; }
.agent-row:hover { background: rgba(255, 255, 255, 0.025); }
.agent-row::before { content: ""; grid-area: accent; align-self: stretch; margin: -0.55rem 0 -0.45rem; background: var(--state-color); }
.agent-row[data-state="working"] { --state-color: var(--green); }
.agent-row[data-state="idle"] { --state-color: var(--accent-primary); }
.agent-row[data-state="paused"] { --state-color: var(--amber); }
.agent-row[data-state="error"] { --state-color: var(--red); }
.agent-row[aria-current="true"] { outline: 2px solid var(--accent-primary); outline-offset: -2px; background: rgba(99, 102, 241, 0.06); }
.agent-row .row-badge { grid-area: badge; min-width: 0; }
.agent-row .row-model { grid-area: model; display: none; color: var(--text-secondary); font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-row .row-money { grid-area: money; text-align: right; font-size: 0.9rem; font-weight: 600; line-height: 1.3; }
.agent-row .row-money .run { display: block; font-weight: 400; font-size: 0.78rem; color: var(--green); }
.agent-line {
    grid-area: line;
    min-width: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.agent-line .fa-circle-info { color: var(--accent-soft); margin-right: 0.3rem; }
.agent-line .when { color: var(--text-muted); }
/* scheduled runs: "Every 30 min · next in 12 min" leads the line (neutral colour: colour means state) */
.agent-line .sched { color: var(--text-primary); }
.agent-line .sched .fa-repeat, .sheet-meta .sched .fa-repeat, td .sched .fa-repeat { color: var(--text-muted); margin-right: 0.35rem; font-size: 0.8em; }
.sheet-meta .sched.is-paused, td .sched.is-paused { color: var(--text-muted); }
/* the row's open button covers the whole row (one big target); the texts above it let
   clicks fall through to it, and only the action button sits on top */
.agent-open {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
    align-self: stretch;
    margin: -0.55rem -0.5rem -0.45rem 0;
    background: none; border: 0; padding: 0;
    color: inherit; font: inherit;
    cursor: pointer;
    z-index: 0;
}
.agent-open:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: -3px; border-radius: 2px; }
.agent-row > :not(.agent-open):not(.agent-act) { pointer-events: none; position: relative; z-index: 1; }
.row-name {
    grid-area: name;
    min-width: 0;
    font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.agent-act { grid-area: act; position: relative; z-index: 2; justify-self: end; white-space: nowrap; }
.agent-act .act-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.agent-act.is-reason .act-text { position: static; width: auto; height: auto; clip: auto; }
.agent-act-slot { grid-area: act; width: 44px; height: 44px; }

@container (min-width: 520px) {
    .agent-row {
        grid-template-columns: 4px 7rem minmax(0, 1fr) 6.5rem 8.5rem;
        grid-template-areas:
            "accent badge name money act"
            "accent badge line money act";
        height: 64px;
        padding: 0 0.5rem 0 0;
        row-gap: 0.1rem;
    }
    .agent-row::before { margin: 0; }
    .row-name { align-self: end; font-size: 0.95rem; }
    .agent-open { margin: 0 -0.5rem 0 0; }
    .agent-line { align-self: start; }
    .agent-row .row-money { min-width: 0; }
}
@container (min-width: 820px) {
    .agent-row {
        /* fixed tracks: model | money | action line up on every row, whatever the button says (or none) */
        grid-template-columns: 4px 8rem minmax(0, 1fr) 10rem 7rem 10rem;
        grid-template-areas:
            "accent badge name model money act"
            "accent badge line model money act";
    }
    .agent-row .row-model { display: block; }
}

.skeleton-row {
    height: 64px;
    border-top: 1px solid var(--border-color);
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
    background-size: 200% 100%;
    animation: agShimmer 1.4s linear infinite;
}
.skeleton-row:first-child { border-top: 0; }

/* ==================== State badges ==================== */
.state-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.06);
}
.state-badge i { font-size: 0.8rem; }
.state-badge[data-state="working"] { color: var(--green); background: rgba(52, 211, 153, 0.12); }
.state-badge[data-state="idle"] { color: var(--accent-soft); background: rgba(99, 102, 241, 0.14); }
.state-badge[data-state="paused"] { color: var(--amber); background: rgba(251, 191, 36, 0.12); }
.state-badge[data-state="error"] { color: var(--red); background: rgba(248, 113, 113, 0.12); }
.state-dot {
    width: 0.55rem; height: 0.55rem;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5);
    animation: agPulse 1.8s ease-in-out infinite;
    flex: 0 0 auto;
}

/* ==================== Empty state ==================== */
.agents-empty {
    text-align: center;
    padding: 2.2rem 1rem 2rem;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--secondary-bg);
}
.agents-empty .empty-icon { font-size: 1.9rem; color: var(--accent-soft); margin-bottom: 0.7rem; }
.agents-empty h2 { font-size: 1.15rem; margin-bottom: 0.4rem; }
.agents-empty p { color: var(--text-secondary); max-width: 34rem; margin: 0 auto 0.5rem; line-height: 1.55; }
.agents-empty .empty-runs { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.agents-empty .empty-create { margin: 0.9rem 0 1.3rem; width: 100%; max-width: 22rem; }
.idea-label { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.idea-chips { display: flex; flex-direction: column; gap: 0.5rem; justify-content: center; }
.idea-chips .chip { width: 100%; justify-content: center; }

.ad-slot:empty { display: none; }

/* ==================== Sheet ==================== */
.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: calc(var(--tt-z-modal, 1000) + 10);
}
.sheet {
    position: fixed;
    top: 0; right: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--secondary-bg);
    border: 0;
    z-index: calc(var(--tt-z-modal, 1000) + 11);
    animation: agSlideIn 0.16s ease-out;
    /* --ad-lift (set by fitSheetToAds): the height of a third-party bar pinned to the bottom of the
       viewport over the sheet (AdSense Auto ads anchor / shopping chip, z-index at the int maximum, so no
       z-index of ours can win). The sheet keeps its footer above it; the ad itself stays on the page. */
    padding-bottom: var(--ad-lift, 0px);
}
.sheet-head {
    flex: 0 0 auto;
    padding: 0.6rem 0.75rem 0;
    background: var(--secondary-bg);
    border-bottom: 1px solid var(--border-color);
}
.sheet-row1 { display: flex; align-items: center; gap: 0.4rem; min-height: 48px; }
.sheet-row1 h2 {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sheet-row1 h2:focus { outline: none; }
/* focus moves to the title when a sheet opens (screen readers start there); the ring shows only when
   the sheet was opened from the keyboard, never after a tap or a click */
.sheet-row1 h2:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; border-radius: 4px; }
.sheet-head-actions { display: flex; gap: 0.35rem; flex: 0 0 auto; }
.sheet-close-lead { order: -1; }
.sheet-close-trail { display: none; }
.sheet-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    padding: 0 0 0.5rem;
}
.sheet-meta .sep { color: var(--text-muted); margin-right: 0.5rem; }
.sheet-meta .left { color: var(--text-primary); font-weight: 600; }
.sheet-head .tabs { border-bottom: 0; margin: 0 -0.25rem; }
.sheet-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}
/* The body scrolls; its children never shrink. A flex item's automatic minimum height is 0 when its own
   overflow is not visible, so the wallet's History / Prices strip (.tabs: overflow-x auto) collapsed to
   1 px under a long ledger. */
.sheet-body > * { flex-shrink: 0; }
.sheet-foot {
    flex: 0 0 auto;
    padding: 0.7rem 0.75rem calc(0.7rem + env(safe-area-inset-bottom));
    background: var(--secondary-bg);
    border-top: 1px solid var(--border-color);
    display: grid;
    gap: 0.55rem;
}
.foot-line { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.45; }
.foot-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--spacing-sm); }
.foot-actions .btn-primary, .foot-actions .btn-danger { flex: 1 1 100%; }
.foot-actions .btn:not(.btn-primary):not(.btn-danger) { flex: 1 1 auto; }
.foot-confirm { display: flex; flex-wrap: wrap; gap: var(--spacing-sm); align-items: center; }
.foot-confirm .q { flex: 1 1 100%; font-weight: 600; font-size: 0.92rem; }
.foot-confirm .btn { flex: 1 1 auto; }

.sheet-notice {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.4rem 0.6rem;
    align-items: start;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.88rem;
    line-height: 1.5;
}
.sheet-notice > i { margin-top: 0.2rem; color: var(--text-muted); }
.sheet-notice .notice-act { grid-column: 1 / -1; justify-self: start; }
.sheet-notice[data-tone="info"] { background: rgba(99, 102, 241, 0.08); border-color: rgba(99, 102, 241, 0.3); }
.sheet-notice[data-tone="info"] > i { color: var(--accent-soft); }
.sheet-notice[data-tone="warn"] { background: rgba(251, 191, 36, 0.07); border-color: rgba(251, 191, 36, 0.35); }
.sheet-notice[data-tone="warn"] > i { color: var(--amber); }
.sheet-notice[data-tone="danger"] { background: rgba(248, 113, 113, 0.07); border-color: rgba(248, 113, 113, 0.35); }
.sheet-notice[data-tone="danger"] > i { color: var(--red); }
.admin-view-note { margin: 0 0 0.5rem; }

/* ==================== Forms ==================== */
.field { display: grid; gap: 0.35rem; min-width: 0; }
.field > .label, .field legend { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
.field .hint { font-size: 0.82rem; color: var(--text-muted); line-height: 1.45; }
.field-err { color: #fecaca; font-size: 0.84rem; display: flex; gap: 0.4rem; align-items: flex-start; }
.field-err i { color: var(--red); margin-top: 0.2rem; }
input[type="text"], input[type="email"], input[type="number"], input[type="search"], select, textarea {
    width: 100%;
    min-height: 44px;
    padding: 0.55rem 0.75rem;
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font: inherit;
    font-size: 0.95rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
textarea { resize: vertical; line-height: 1.5; min-height: 5.5rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: rgba(248, 113, 113, 0.6); }
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input[readonly], textarea[readonly] { opacity: 0.75; }
select { appearance: auto; }
/* native <option> does not inherit the dark theme; literal hex is required */
select option { background-color: #1a1a24; color: #fff; }
fieldset { border: 0; min-width: 0; }
.check { display: flex; align-items: flex-start; gap: 0.6rem; min-height: 44px; padding: 0.55rem 0; cursor: pointer; font-size: 0.9rem; color: var(--text-primary); line-height: 1.45; }
.check input { width: 20px; height: 20px; flex: 0 0 auto; margin-top: 0.05rem; accent-color: var(--accent-primary); }
.radio-row { display: flex; flex-wrap: wrap; gap: 0.25rem 1.2rem; }
.radio { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px; cursor: pointer; font-size: 0.92rem; }
.radio input { width: 18px; height: 18px; accent-color: var(--accent-primary); }

/* model cards */
.model-list { display: grid; gap: 0.5rem; }
.model-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.15rem 0.65rem;
    align-items: start;
    padding: 0.75rem;
    min-height: 44px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--card-bg);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.model-card:hover { border-color: var(--border-strong); }
.model-card:has(input:checked) { border-color: var(--accent-primary); background: rgba(99, 102, 241, 0.09); }
.model-card:has(input:focus-visible) { outline: 2px solid var(--accent-primary); outline-offset: 2px; }
.model-card[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.model-card input { width: 18px; height: 18px; margin-top: 0.15rem; accent-color: var(--accent-primary); }
.model-name { font-weight: 600; }
.model-tag { font-size: 0.72rem; font-weight: 600; color: var(--text-secondary); background: rgba(255, 255, 255, 0.06); border-radius: 999px; padding: 0.15rem 0.55rem; white-space: nowrap; }
.model-tagline { grid-column: 2 / -1; font-size: 0.84rem; color: var(--text-primary); opacity: 0.85; overflow-wrap: anywhere; }
.model-sub { grid-column: 2 / -1; font-size: 0.84rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; line-height: 1.45; }
.model-sub .need { color: var(--amber); }
.model-warn { font-size: 0.84rem; color: var(--amber); }
.model-other { font-size: 0.84rem; color: var(--text-muted); }
/* the Runs select (New agent, Setup) */
.runs-field select { max-width: 22rem; }
.runs-hint { display: grid; gap: 0.25rem; }
.runs-cost { display: flex; gap: 0.45rem; align-items: baseline; font-size: 0.88rem; color: var(--text-secondary); white-space: normal; }
.runs-cost i { color: var(--text-muted); font-size: 0.8rem; }
select[aria-invalid="true"] { border-color: rgba(248, 113, 113, 0.6); }

/* soul */
.soul-summary { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-size: 0.9rem; color: var(--text-secondary); }
.soul-summary i { color: var(--accent-soft); }
.soul-summary .grow { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.soul-panel { display: grid; gap: 0.6rem; }
.soul-tpls { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.soul-tpls .lbl { font-size: 0.84rem; color: var(--text-muted); margin-right: 0.2rem; }
.soul-q { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.88rem; padding: 0.5rem 0.65rem; border-radius: var(--radius-md); background: rgba(251, 191, 36, 0.07); border: 1px solid rgba(251, 191, 36, 0.3); }
.soul-q .q { flex: 1 1 100%; }
.seg { display: inline-flex; border: 1px solid var(--border-color); border-radius: var(--radius-md); overflow: hidden; }
.seg button { min-height: 44px; padding: 0 0.95rem; background: none; border: 0; color: var(--text-secondary); font: inherit; font-size: 0.88rem; cursor: pointer; }
.seg button[aria-selected="true"] { background: rgba(99, 102, 241, 0.18); color: #fff; }
.soul-editor { font: 0.88rem/1.5 ui-monospace, 'SFMono-Regular', Menlo, monospace; min-height: 14rem; width: 100%; resize: vertical; }
.md-preview {
    max-height: 24rem; overflow: auto;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--primary-bg);
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}
.md-preview h1, .md-preview h2, .md-preview h3 { color: var(--text-primary); font-size: 1rem; margin: 0.6rem 0 0.3rem; }
.md-preview h1:first-child, .md-preview h2:first-child, .md-preview h3:first-child { margin-top: 0; }
.md-preview p, .md-preview ul, .md-preview ol, .md-preview pre { margin-bottom: 0.55rem; }
.md-preview ul, .md-preview ol { padding-left: 1.3rem; }
.md-preview code { background: rgba(255, 255, 255, 0.08); padding: 0.05em 0.35em; border-radius: 4px; font-size: 0.88em; }
.md-preview pre { background: var(--card-bg); padding: 0.6rem; border-radius: var(--radius-sm); overflow-x: auto; }
.md-preview pre code { background: none; padding: 0; }
.count-line { font-size: 0.82rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* disclosure */
.more-details { border-top: 1px solid var(--border-color); }
.more-details > summary, .disclosure > summary {
    display: flex; align-items: center; gap: 0.55rem;
    min-height: 44px;
    cursor: pointer;
    list-style: none;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.more-details > summary::-webkit-details-marker, .disclosure > summary::-webkit-details-marker { display: none; }
.more-details > summary .fa-chevron-right, .disclosure > summary .fa-chevron-right { transition: transform var(--transition-fast); font-size: 0.75rem; }
.more-details[open] > summary .fa-chevron-right, .disclosure[open] > summary .fa-chevron-right { transform: rotate(90deg); }
.more-body { display: grid; gap: 0.9rem; padding: 0.2rem 0 0.5rem; font-size: 0.88rem; color: var(--text-secondary); line-height: 1.55; }
.more-body h3 { font-size: 0.88rem; color: var(--text-primary); font-weight: 600; margin-bottom: 0.25rem; }
.comp-line { display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; }
.comp-line i { color: var(--text-muted); margin-right: 0.3rem; }

/* price table */
.price-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; font-variant-numeric: tabular-nums; }
.price-table th, .price-table td { padding: 0.4rem 0.45rem; text-align: right; border-bottom: 1px solid var(--border-color); white-space: nowrap; }
.price-table th:first-child, .price-table td:first-child { text-align: left; white-space: normal; }
.price-table th { color: var(--text-muted); font-weight: 600; font-size: 0.78rem; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ==================== Feed ==================== */
.feed { display: flex; flex-direction: column; gap: 0.7rem; min-width: 0; }
.feed-earlier { align-self: center; }
.feed-goal {
    border: 1px solid rgba(99, 102, 241, 0.35);
    background: rgba(99, 102, 241, 0.06);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.85rem;
}
.feed-goal .goal-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.78rem; font-weight: 600; color: var(--accent-soft); margin-bottom: 0.35rem; }
.feed-goal .goal-head .when { color: var(--text-muted); font-weight: 400; }
.goal-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; font-size: 0.92rem; }
.clamp { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { -webkit-line-clamp: 2; }
.clamp-4 { -webkit-line-clamp: 4; }
.clamp-12 { -webkit-line-clamp: 12; }
.show-more { margin-top: 0.1rem; padding-left: 0; }
.feed-run {
    display: flex; align-items: center; gap: 0.6rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}
.feed-run::before, .feed-run::after { content: ""; flex: 1 1 1rem; border-top: 1px solid var(--border-color); }
.feed-run > span { min-width: 0; text-align: center; }
.feed-run .run-tag {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0 0.45rem;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.5;
    vertical-align: 1px;
}
.feed-run .run-tag i { font-size: 0.7rem; color: var(--text-muted); }
details.feed-run { display: block; }
details.feed-run::before, details.feed-run::after { display: none; }
details.feed-run > summary {
    display: flex; align-items: center; gap: 0.6rem;
    min-height: 44px;
    list-style: none;
    cursor: pointer;
}
details.feed-run > summary::-webkit-details-marker { display: none; }
details.feed-run > summary::before, details.feed-run > summary::after { content: ""; flex: 1 1 1rem; border-top: 1px solid var(--border-color); }
details.feed-run > summary .sum { display: inline-flex; align-items: center; gap: 0.45rem; min-width: 0; color: var(--text-secondary); }
details.feed-run > summary .fa-receipt { color: var(--text-muted); }
details.feed-run > summary:hover .sum { color: var(--text-primary); }
details.feed-run[open] > summary .fa-chevron-right { transform: rotate(90deg); }
.receipt {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.25rem 1rem;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    padding: 0.65rem 0.8rem;
    margin-top: 0.2rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
}
.receipt .r-head { grid-column: 1 / -1; color: var(--text-primary); font-weight: 600; }
.receipt .r-note { grid-column: 1 / -1; color: var(--text-muted); font-size: 0.82rem; }
.receipt .r-amt { text-align: right; color: var(--text-primary); }
.receipt .r-total { border-top: 1px solid var(--border-color); padding-top: 0.35rem; font-weight: 600; color: var(--text-primary); }
.receipt .r-est { color: var(--amber); font-size: 0.75rem; font-weight: 600; margin-left: 0.35rem; }
.feed-msg { min-width: 0; }
.feed-msg .msg-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.2rem; display: flex; gap: 0.4rem; align-items: center; }
.feed-msg .msg-body { overflow-wrap: anywhere; line-height: 1.55; font-size: 0.93rem; }
.feed-you { border-left: 3px solid var(--accent-primary); padding-left: 0.65rem; }
.feed-you .msg-body { white-space: pre-wrap; }
.feed-you.is-queued { border-left-style: dashed; }
.feed-you.is-cancelled .msg-body { text-decoration: line-through; color: var(--text-muted); }
.feed-agent .msg-body p, .feed-agent .msg-body ul, .feed-agent .msg-body ol, .feed-agent .msg-body pre { margin-bottom: 0.45rem; }
.feed-agent .msg-body ul, .feed-agent .msg-body ol { padding-left: 1.3rem; }
.feed-agent .msg-body h1, .feed-agent .msg-body h2, .feed-agent .msg-body h3 { font-size: 0.98rem; margin: 0.4rem 0 0.25rem; }
.feed-agent .msg-body code { background: rgba(255, 255, 255, 0.08); padding: 0.05em 0.35em; border-radius: 4px; font-size: 0.88em; overflow-wrap: anywhere; }
.feed-agent .msg-body pre { background: var(--primary-bg); padding: 0.6rem; border-radius: var(--radius-sm); overflow-x: auto; }
.feed-agent .msg-body pre code { background: none; padding: 0; }
.queued-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: flex-end; align-items: center; font-size: 0.84rem; color: var(--text-muted); margin-top: 0.3rem; }
.queued-actions .q-state { display: inline-flex; gap: 0.35rem; align-items: center; margin-right: auto; }
.queued-actions .not-sent { color: var(--red); }
.feed-fold, .feed-step { border-radius: var(--radius-md); }
.feed-fold > summary, .feed-step > summary {
    display: flex; align-items: center; gap: 0.55rem;
    min-height: 44px;
    list-style: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.88rem;
    min-width: 0;
}
.feed-fold > summary::-webkit-details-marker, .feed-step > summary::-webkit-details-marker { display: none; }
.feed-fold > summary .fa-chevron-right, .feed-step > summary .fa-chevron-right { font-size: 0.7rem; color: var(--text-muted); transition: transform var(--transition-fast); flex: 0 0 auto; }
.feed-fold[open] > summary > .fa-chevron-right, .feed-step[open] > summary > .fa-chevron-right { transform: rotate(90deg); }
.feed-fold > summary:hover, .feed-step > summary:hover { color: var(--text-primary); }
.fold-failed { color: var(--amber); }
.fold-body { padding: 0 0 0.25rem 0.9rem; border-left: 1px solid var(--border-color); margin-left: 0.3rem; display: grid; gap: 0.1rem; }
.feed-step > summary .step-title { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-step > summary .step-title.mono { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 0.82rem; }
.feed-step > summary .step-meta { flex: 0 0 auto; color: var(--text-muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.feed-step > summary .fa-check { color: var(--green); }
.feed-step[data-status="fail"] { border-left: 3px solid var(--red); padding-left: 0.5rem; }
.feed-step[data-status="fail"] > summary .step-meta { color: var(--red); }
.feed-step > summary .fa-triangle-exclamation { color: var(--red); }
.feed-out {
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 20rem;
    overflow: auto;
    font: 0.8rem/1.45 ui-monospace, 'SFMono-Regular', Menlo, monospace;
    background: var(--primary-bg);
    border: 1px solid var(--border-color);
    padding: 0.6rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}
.out-actions { display: flex; gap: 0.4rem; justify-content: flex-end; margin: 0.3rem 0 0.4rem; }
.feed-err { border-left: 3px solid var(--red); background: rgba(248, 113, 113, 0.06); padding: 0.6rem 0.75rem; border-radius: 0 var(--radius-md) var(--radius-md) 0; font-size: 0.9rem; overflow-wrap: anywhere; }
.feed-err .err-head { display: flex; gap: 0.5rem; align-items: flex-start; }
.feed-err .err-head i { color: var(--red); margin-top: 0.2rem; }
.feed-err details > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-size: 0.84rem; color: var(--text-muted); }
.feed-sys { color: var(--text-muted); font-size: 0.82rem; text-align: center; overflow-wrap: anywhere; }
.feed-plan { font-size: 0.88rem; }
.feed-plan ul { list-style: none; display: grid; gap: 0.2rem; margin-top: 0.3rem; }
.feed-plan li { display: flex; gap: 0.5rem; color: var(--text-secondary); overflow-wrap: anywhere; }
.feed-plan li.done { color: var(--text-muted); text-decoration: line-through; }
.feed-plan li i { margin-top: 0.25rem; font-size: 0.75rem; }
.feed-plan li.done i { color: var(--green); }
.feed-live {
    display: grid;
    gap: 0.15rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius-md);
    background: rgba(52, 211, 153, 0.06);
    border: 1px solid rgba(52, 211, 153, 0.25);
}
.feed-live .live-main { display: flex; gap: 0.5rem; align-items: center; color: var(--green); font-weight: 600; }
.feed-live .live-step { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-empty { color: var(--text-muted); font-size: 0.88rem; text-align: center; padding: 1rem 0; }
.new-pill {
    position: sticky;
    bottom: 0.5rem;
    align-self: center;
    border-radius: 999px;
    min-height: 44px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    background: var(--accent-primary);
    border-color: transparent;
    z-index: 2;
}
.new-pill:hover { background: #7577f5; }

/* composer */
.composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.5rem; align-items: end; }
.composer textarea { min-height: 44px; max-height: 7.5rem; resize: none; overflow-y: auto; }
.composer .send { align-self: end; }
.composer-hint { grid-column: 1 / -1; font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; }
.composer-hint .btn-link { font-size: 0.8rem; min-height: 32px; }

/* setup view */
.setup-form { display: grid; gap: 1rem; }
.kv-line { font-size: 0.88rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.danger-zone { border: 1px solid rgba(248, 113, 113, 0.35); border-radius: var(--radius-md); padding: var(--spacing-md); display: grid; gap: 0.5rem; }
.danger-zone h3 { font-size: 0.95rem; }
.danger-zone p { font-size: 0.86rem; color: var(--text-secondary); }
.danger-zone .btn { justify-self: end; }

/* wallet */
.wallet-balance { display: grid; gap: 0.35rem; }
.wallet-balance .big { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.wallet-balance .line { font-size: 0.88rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.wallet-balance .how { font-size: 0.84rem; color: var(--text-muted); }
.ledger { list-style: none; display: grid; }
.ledger > li { border-top: 1px solid var(--border-color); }
.ledger > li:first-child { border-top: 0; }
.ledger-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.1rem 0.8rem;
    align-items: center;
    padding: 0.45rem 0;
    min-height: 44px;
    font-size: 0.9rem;
}
.ledger-row .l-label { min-width: 0; overflow-wrap: anywhere; }
.ledger-row .l-sub { grid-column: 1; font-size: 0.8rem; color: var(--text-muted); overflow-wrap: anywhere; }
.ledger-row .l-amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger-row .l-after { grid-column: 2; text-align: right; font-size: 0.78rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ledger-live { font-style: italic; }
details.ledger-run > summary { list-style: none; cursor: pointer; }
details.ledger-run > summary::-webkit-details-marker { display: none; }
details.ledger-run > summary .l-amt i { font-size: 0.7rem; color: var(--text-muted); margin-left: 0.35rem; transition: transform var(--transition-fast); }
details.ledger-run[open] > summary .l-amt i { transform: rotate(90deg); }
details.ledger-run .receipt { margin-bottom: 0.6rem; }
.load-more { justify-self: center; margin-top: 0.4rem; }
.wallet-empty { color: var(--text-muted); font-size: 0.9rem; padding: 0.8rem 0; text-align: center; }

/* ==================== Modals ==================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    z-index: calc(var(--tt-z-modal, 1000) + 20);
    overflow-y: auto;
}
.modal {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    max-width: none;
    max-height: 92dvh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--spacing-sm); padding: 0.6rem 0.6rem 0.6rem 1rem; border-bottom: 1px solid var(--border-color); }
.modal-head h3 { font-size: 1.05rem; overflow-wrap: anywhere; min-width: 0; }
.modal-body { padding: 1rem; overflow-y: auto; display: grid; gap: 0.85rem; font-size: 0.92rem; line-height: 1.55; }
.modal-body p { color: var(--text-secondary); }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--spacing-sm); padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--border-color); }
.modal-foot .btn { flex: 1 1 100%; }
.modal-hint { color: var(--text-muted); font-size: 0.84rem; line-height: 1.5; }
.modal-error { display: flex; gap: 0.45rem; color: #fecaca; font-size: 0.88rem; }
.modal-error i { color: var(--red); margin-top: 0.2rem; }
.modal-warning { display: flex; gap: 0.5rem; color: var(--amber); font-size: 0.9rem; }
.modal-warning i { margin-top: 0.2rem; }
.quick-amounts { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.preview-line { font-variant-numeric: tabular-nums; color: var(--text-primary); }
.review-list { display: grid; gap: 0.55rem; }
.review-list > div { display: grid; gap: 0.1rem; }
.review-list dt { font-size: 0.84rem; color: var(--text-muted); }
.review-list dd { font-variant-numeric: tabular-nums; }
.review-list .old { text-decoration: line-through; color: var(--text-muted); margin-right: 0.35rem; }
.review-list .delta { color: var(--text-muted); margin-left: 0.35rem; font-size: 0.85rem; }

/* ==================== Admin ==================== */
#adminTabs .sub-tabs { margin-bottom: var(--spacing-md); }
.admin-body { display: grid; gap: var(--spacing-md); min-width: 0; }
.card { background: var(--secondary-bg); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: var(--spacing-md); min-width: 0; }
.card > h2, .card-head h2 { font-size: 1rem; font-weight: 600; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.card-head .muted { font-size: 0.82rem; }
.svc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.svc-row .svc-title { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 1rem; }
.svc-row .svc-state { flex: 1 1 14rem; color: var(--text-secondary); font-size: 0.9rem; }
.svc-audit { color: var(--text-muted); font-size: 0.82rem; margin-top: 0.3rem; }
.switch {
    display: inline-flex; align-items: center; gap: 0.6rem;
    min-height: 44px;
    padding: 0 0.3rem;
    background: none; border: 0;
    color: var(--text-primary);
    font: inherit; font-weight: 700; font-size: 0.85rem;
    cursor: pointer;
}
.switch .track { position: relative; width: 52px; height: 28px; border-radius: 999px; background: rgba(255, 255, 255, 0.16); transition: background var(--transition-fast); }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform var(--transition-fast); }
.switch[aria-checked="true"] .track { background: var(--green); }
.switch[aria-checked="true"] .track::after { transform: translateX(24px); }
.switch:disabled { opacity: 0.5; cursor: wait; }
.attention-list { list-style: none; display: grid; }
.attention-list > li { display: flex; flex-wrap: wrap; gap: 0.3rem 0.6rem; align-items: center; padding: 0.35rem 0; border-top: 1px solid var(--border-color); font-size: 0.9rem; }
.attention-list > li > i { flex: 0 0 1.1rem; text-align: center; }
.attention-list > li:first-child { border-top: 0; }
.attention-list > li > i { color: var(--amber); }
.attention-list > li > i.fa-circle-info { color: var(--accent-soft); }
.attention-list > li > i.fa-hand-holding-dollar { color: var(--accent-soft); }
/* text and buttons share one line when they fit (a short item on a phone, every item on desktop);
   a long text pushes its buttons to their own line, right-aligned */
.attention-list .att-text { flex: 1 1 11rem; min-width: 0; overflow-wrap: anywhere; }
.attention-list .att-acts { flex: 0 0 auto; margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.4rem; }
.attention-none { color: var(--text-muted); font-size: 0.9rem; }
/* with a mouse, the list's buttons are compact so each item stays one short line (touch keeps 44px) */
@media (min-width: 640px) and (not (pointer: coarse)) {
    .attention-list .att-acts .btn { min-height: 34px; padding: 0.3rem 0.85rem; }
}
.req-more { margin: -0.2rem 0 0.6rem; }
.stats-strip { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--spacing-sm); }
.stat-card { background: var(--secondary-bg); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 0.85rem 1rem; min-width: 0; }
.stat-label { color: var(--text-muted); font-size: 0.8rem; font-weight: 600; margin-bottom: 0.35rem; }
.stat-rows { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.15rem 0.6rem; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.stat-rows .k { color: var(--text-secondary); }
.stat-rows .v { text-align: right; font-weight: 600; }
.stat-rows .p { text-align: right; color: var(--text-muted); }
.stat-rows .sub { color: var(--text-muted); font-size: 0.84rem; }
.stat-value { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--text-muted); font-size: 0.82rem; margin-top: 0.15rem; }
.meter-row { display: grid; grid-template-columns: 6rem minmax(0, 1fr) 6.5rem; gap: 0.75rem; align-items: center; font-size: 0.88rem; padding: 0.25rem 0; }
.meter-row .val { text-align: right; font-variant-numeric: tabular-nums; }
.progress-bar { height: 8px; background: rgba(255, 255, 255, 0.07); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent-primary); border-radius: 999px; }
.progress-fill[data-level="amber"] { background: var(--amber); }
.progress-fill[data-level="red"] { background: var(--red); }
.cap-foot { font-size: 0.85rem; color: var(--text-secondary); margin-top: 0.4rem; }
.two-col { display: grid; gap: var(--spacing-md); }
.spender-list, .plain-list { list-style: none; display: grid; }
.spender-list button {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.6rem; align-items: center;
    width: 100%; min-height: 44px;
    background: none; border: 0; border-top: 1px solid var(--border-color);
    color: var(--text-primary); font: inherit; font-size: 0.88rem; text-align: left; cursor: pointer;
    font-variant-numeric: tabular-nums;
}
.spender-list li:first-child button { border-top: 0; }
.spender-list button:hover { color: #fff; background: rgba(255, 255, 255, 0.03); }
.spender-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spender-list .bal { color: var(--text-muted); }
.prov-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.2rem 0.6rem; align-items: start; font-size: 0.9rem; padding: 0.3rem 0; }
.prov-row i.ok { color: var(--green); }
.prov-row i.warn { color: var(--amber); }
.prov-row i.bad { color: var(--red); }
.prov-row .amber { color: var(--amber); }
.prov-row .red { color: var(--red); }

.toolbar-row { display: flex; flex-wrap: wrap; gap: var(--spacing-sm); align-items: center; }
.toolbar-row .search { position: relative; flex: 1 1 16rem; min-width: 0; }
.toolbar-row .search i { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; font-size: 0.85rem; }
.toolbar-row .search input { padding-left: 2.3rem; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th, .data-table td { padding: 0.5rem 0.55rem; text-align: left; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.data-table th { color: var(--text-muted); font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table th:last-child { text-align: right; }
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table td.name { font-weight: 600; overflow-wrap: anywhere; }
.data-table .acts { display: flex; gap: 0.3rem; justify-content: flex-end; flex-wrap: wrap; }
.data-table .mono { font-variant-numeric: tabular-nums; white-space: nowrap; }
.margin-ok { color: var(--green); }
.margin-low { color: var(--amber); }
.margin-bad { color: var(--red); }
.req-list, .user-list { list-style: none; display: grid; gap: 0.5rem; }
.req-item { display: grid; gap: 0.35rem; padding: 0.6rem 0.75rem; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--card-bg); font-size: 0.9rem; }
.req-item .meta { color: var(--text-secondary); font-size: 0.85rem; overflow-wrap: anywhere; }
.req-item .note { overflow-wrap: anywhere; }
.req-item .acts { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.user-list button {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.1rem 0.6rem; align-items: center;
    width: 100%; min-height: 44px; padding: 0.45rem 0.7rem;
    background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-md);
    color: var(--text-primary); font: inherit; font-size: 0.88rem; text-align: left; cursor: pointer;
}
.user-list button[aria-current="true"] { border-color: var(--accent-primary); }
.user-list .u-sub { grid-column: 1; color: var(--text-muted); font-size: 0.82rem; overflow-wrap: anywhere; }
.user-list .fa-chevron-right { grid-row: 1 / span 2; grid-column: 2; color: var(--text-muted); font-size: 0.75rem; }
.user-card .uc-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; justify-content: space-between; margin-bottom: 0.4rem; }
.user-card .uc-head h3 { font-size: 1.05rem; overflow-wrap: anywhere; min-width: 0; }
.user-card .uc-acts { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.user-card .uc-line { font-size: 0.88rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; margin-bottom: 0.6rem; overflow-wrap: anywhere; }
.user-card .uc-susp { color: var(--red); font-size: 0.88rem; margin-bottom: 0.5rem; overflow-wrap: anywhere; }
.settings-grid { display: grid; gap: 0.9rem; }
.set-row { display: grid; gap: 0.3rem; }
.set-row .label { font-size: 0.88rem; font-weight: 600; color: var(--text-primary); }
.set-row .hint { font-size: 0.82rem; color: var(--text-muted); }
.set-row .inp { display: flex; align-items: center; gap: 0.5rem; }
.set-row .inp input { max-width: 8rem; }
.set-row .unit { color: var(--text-muted); font-size: 0.86rem; }
.plan-grid { display: grid; gap: 0.9rem; }
.plan-group h3 { font-size: 0.92rem; margin-bottom: 0.5rem; }
.plan-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.plan-table th, .plan-table td { padding: 0.35rem 0.4rem; text-align: left; }
.plan-table th { color: var(--text-muted); font-weight: 600; font-size: 0.8rem; }
.plan-table input { max-width: 6rem; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--spacing-sm); }
.price-form { display: grid; gap: 0.8rem; }
.price-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.6rem; }
.price-grid .pg-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 3.5rem; gap: 0.2rem 0.5rem; align-items: center; }
.price-grid .pg-label { grid-column: 1 / -1; font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
.price-grid .pg-head { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }
.price-grid .pg-margin { text-align: right; font-variant-numeric: tabular-nums; font-size: 0.88rem; }
.field-row { display: grid; gap: 0.6rem; grid-template-columns: minmax(0, 1fr); }
.readonly-line { font-size: 0.88rem; color: var(--text-secondary); overflow-wrap: anywhere; }
.loading-line { color: var(--text-muted); font-size: 0.9rem; display: flex; gap: 0.5rem; align-items: center; padding: 0.6rem 0; }

/* ==================== Footer ==================== */
.foot { text-align: center; color: var(--text-muted); font-size: 0.8rem; padding: var(--spacing-xl) 0 var(--spacing-md); line-height: 1.7; }
.foot a { color: var(--accent-soft); display: inline-block; min-height: 24px; }
.foot span { margin: 0 0.4rem; }


/* ==================== Script-built helpers ==================== */
.only-phone { display: none; }
.phone-sr { display: none; }
.modal { position: relative; }
.modal-head { padding-right: 3.4rem; }
.modal-x { position: absolute; top: 0.35rem; right: 0.35rem; }
.head-act { padding: 0.55rem 0.7rem; }
.head-act .act-label { display: none; }
.head-act.is-reason .act-label { display: inline; }
.sheet-bal-phone { display: none; }
.agent-row .row-money .run { display: none; }
.seg-tabs { border-bottom: 1px solid var(--border-color); }
.notice-slot:empty { display: none; }
.feed-plan .msg-label { color: var(--text-secondary); }
.table-card { padding: 0.25rem 0.5rem; }
.card-head h2 label { cursor: default; }
@container (min-width: 520px) {
    .agent-row .row-money .run { display: block; }
}
@container (min-width: 700px) and (max-width: 819.98px) {
    .agent-row { grid-template-columns: 4px 8rem minmax(0, 1fr) 7rem 10rem; }
}
@container (min-width: 520px) {
    .agent-act.has-label .act-text { position: static; width: auto; height: auto; clip: auto; }
    /* every action button fills the fixed action track, so the buttons form one even column;
       a long label ("Požádat o kredit") wraps inside the button instead of covering the money */
    .agent-act { justify-self: stretch; width: 100%; padding: 0.4rem 0.55rem; white-space: normal; text-align: center; line-height: 1.15; }
    .agent-act .act-text { white-space: normal; }
}
@container (min-width: 700px) {
    .agent-act { padding: 0.55rem 0.6rem; }
}
@media (min-width: 761px) {
    .head-act .act-label { display: inline; }
}
@media (max-width: 639px) {
    .only-phone { display: inline; }
    .phone-sr { display: inline; }
    .price-grid .pg-row.not-phone { display: none; }
    .not-phone { display: none; }
    .sheet-bal-phone { display: inline; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.9rem; }
    .modal-foot { flex-direction: column-reverse; }
}

/* ==================== Motion ==================== */
@keyframes agPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.45); opacity: 1; }
    50% { box-shadow: 0 0 0 5px rgba(52, 211, 153, 0); opacity: 0.8; }
}
@keyframes agBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes agShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes agSlideIn { from { transform: translateX(24px); opacity: 0.4; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ==================== >= 640px ==================== */
@media (min-width: 640px) {
    .banner { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
    .banner > i { align-self: start; }
    .banner-actions { grid-column: auto; justify-content: flex-end; }
    .banner-actions .btn { width: auto; }
    .idea-chips { flex-direction: row; flex-wrap: wrap; }
    .idea-chips .chip { width: auto; }
    .agents-empty .empty-create { width: auto; }
    .stats-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .foot-actions .btn-primary, .foot-actions .btn-danger { flex: 0 0 auto; }
    .foot-actions .btn:not(.btn-primary):not(.btn-danger) { flex: 0 0 auto; }
    .foot-confirm .q { flex: 1 1 auto; }
    .foot-confirm .btn { flex: 0 0 auto; }
    .modal-overlay { align-items: flex-start; padding: 8vh var(--spacing-md) var(--spacing-md); }
    .modal { border-radius: var(--radius-lg); max-width: 440px; max-height: 84dvh; }
    .modal.modal-md { max-width: 620px; }
    .modal-foot .btn { flex: 0 0 auto; }
    .attention-list > li { flex-wrap: nowrap; }
    .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .price-grid .pg-row { grid-template-columns: 9rem minmax(0, 1fr) minmax(0, 1fr) 3.5rem; }
    .price-grid .pg-label { grid-column: auto; }
    .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ==================== >= 761px: overlay sheet from the right ==================== */
@media (min-width: 761px) {
    .page { padding: var(--spacing-md) var(--spacing-lg); }
    .app-title { font-size: 1.5rem; }
    .sheet { width: min(640px, 100vw); border-left: 1px solid var(--border-color); box-shadow: -12px 0 40px rgba(0, 0, 0, 0.4); }
    .sheet-head { padding: 0.7rem 1rem 0; }
    .sheet-close-lead { display: none; }
    .sheet-close-trail { display: inline-flex; }
    .sheet-foot { padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom)); }
    .sheet-body { padding: var(--spacing-md) 1.1rem; }
    .two-col { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
    div.set-row { grid-template-columns: minmax(10rem, 17rem) auto minmax(0, 1fr); align-items: center; column-gap: 1rem; }
    .plan-group div.set-row { grid-template-columns: minmax(10rem, 15rem) auto; }
    .settings-grid { gap: 0.6rem; }
    .meter-row { grid-template-columns: 7rem minmax(0, 1fr) 6.5rem; }
}

@media (min-width: 1024px) {
    .stats-strip.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ==================== >= 1100px: docked sheet (two panes) ==================== */
@media (min-width: 1100px) {
    .split.has-sheet { display: grid; grid-template-columns: minmax(0, 1fr) var(--sheet-w); gap: var(--spacing-md); align-items: start; }
    .sheet-overlay { display: none !important; }
    .sheet {
        position: sticky;
        top: calc(var(--tt-topnav-h) + var(--spacing-sm));
        width: auto;
        height: calc(100vh - var(--tt-topnav-h) - 2 * var(--spacing-sm));
        height: calc(100dvh - var(--tt-topnav-h) - 2 * var(--spacing-sm));
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        box-shadow: none;
        z-index: auto;
        overflow: hidden;
        animation: none;
        /* docked: fitDockedSheet() ends the sheet above a bottom-pinned ad instead (max-height) */
        padding-bottom: 0;
    }
}

/* ==================== < 640px: phone ==================== */
@media (max-width: 639px) {
    .page { padding: var(--spacing-sm) var(--spacing-md); }
    .live-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .live-badge { padding: 0.35rem; }
    .live-retry-text { display: none; }
    .live-badge[data-state="off"] { padding: 0 0 0 0.35rem; }
    .new-long { display: none; }
    .new-short { display: inline; }
    .new-btn { padding: 0.55rem 0.8rem; }
    .balance-chip { padding: 0 0.7rem; }
    .code-input { max-width: none; }
    .step-row .btn { width: 100%; }
    .setup-step { grid-template-columns: 1.7rem minmax(0, 1fr); }
}
@media (max-width: 399px) {
    .app-head { gap: 0.4rem; }
    .balance-chip i { display: none; }
    .balance-chip { padding: 0 0.6rem; }
    .new-btn { padding: 0.55rem 0.65rem; }
}

/* Admin tables collapse into cards on phones (inventura pattern) */
@media (max-width: 760px) {
    .table-card { background: none; border: 0; padding: 0 !important; }
    .data-table.cards thead { display: none; }
    .data-table.cards, .data-table.cards tbody { display: block; width: 100%; }
    .data-table.cards tr {
        display: block;
        background: var(--card-bg);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 0.35rem 0.75rem;
        margin-bottom: var(--spacing-sm);
    }
    .data-table.cards td {
        display: flex; justify-content: space-between; align-items: center; gap: var(--spacing-sm);
        border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
        padding: 0.3rem 0;
        min-height: 2.4rem;
        text-align: right;
        min-width: 0;
    }
    .data-table.cards td:last-child { border-bottom: 0; }
    .data-table.cards td::before {
        content: attr(data-label);
        color: var(--text-muted);
        font-size: 0.78rem;
        font-weight: 600;
        text-align: left;
        flex: 0 0 auto;
    }
    .data-table.cards td > * { min-width: 0; }
    .data-table.cards td.name { overflow-wrap: anywhere; }
    .data-table.cards .acts { justify-content: flex-end; }
}
