:root {
    --c-bg: #070a12;
    --c-bg-2: #0f172a;
    --c-surface: rgba(15, 23, 42, 0.72);
    --c-cyan: #22d3ee;
    --c-cyan-2: #67e8f9;
    --c-violet: #8b5cf6;
    --c-text: #e8eefc;
    --c-muted: #94a3b8;
    --c-border: rgba(255, 255, 255, 0.12);
    --c-accent: #f43f5e;
    --c-ok: #34d399;
    --font-heading: "Outfit", "Segoe UI", sans-serif;
    --font-body: "Work Sans", "Segoe UI", sans-serif;
    --font-size-base: 16px;
    --c-graphite: #0b1220;
    --c-graphite-2: #162033;
    --c-bronze: #22d3ee;
    --c-bronze-2: #67e8f9;
    --radius: 22px;
    --c-input-bg: rgba(2, 6, 23, 0.55);
    --c-input-bg-focus: rgba(2, 6, 23, 0.8);
    --c-sidebar: #080c16;
    --c-sidebar-text: #c7d2fe;
    --c-topbar: rgba(8, 12, 22, 0.92);
    --c-card-num: #fff;
    --c-shadow: rgba(0, 0, 0, 0.25);
    --c-btn-solid-from: #22d3ee;
    --c-btn-solid-to: #38bdf8;
    --c-btn-solid-fg: #042f2e;
    --c-btn-outline-bg: rgba(34, 211, 238, 0.14);
    --c-btn-outline-border: rgba(103, 232, 249, 0.65);
    --c-btn-outline-fg: #e8eefc;
}
html { overflow-x: clip; color-scheme: dark; }
body {
    background: var(--c-bg);
    color: var(--c-text);
    font-size: var(--font-size-base);
    font-family: var(--font-body);
    line-height: 1.65;
}
body.site-public {
    background:
        radial-gradient(1200px 600px at 8% -10%, rgba(139, 92, 246, 0.38), transparent 52%),
        radial-gradient(900px 480px at 100% 0%, rgba(34, 211, 238, 0.22), transparent 46%),
        var(--c-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
h1, h2, h3, h4, h5, h6, .navbar, .btn, .badge, .lead, .display-5, .navbar-brand {
    font-family: var(--font-heading);
}
a { color: var(--c-cyan); }
a:hover { color: var(--c-cyan-2); }
button, .btn, .nav-link, .navbar-toggler { cursor: pointer; }
.btn, .nav-link, .navbar-brand, .admin-nav-item, .admin-toggle {
    transition: color 200ms ease, background 200ms ease, border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible, .nav-link:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--c-cyan);
    outline-offset: 2px;
}

.text-bronze { color: var(--c-cyan) !important; }
.text-muted-2 { color: var(--c-muted) !important; }
.bg-graphite { background-color: var(--c-graphite) !important; }
.btn-bronze, .btn-ai {
    background: linear-gradient(135deg, var(--c-btn-solid-from), var(--c-btn-solid-to));
    color: var(--c-btn-solid-fg);
    border: 0;
    font-weight: 600;
    border-radius: 999px;
    padding: 0.65rem 1.2rem;
}
.btn-bronze:hover, .btn-ai:hover, .btn-bronze:focus, .btn-ai:focus {
    color: var(--c-btn-solid-fg);
    box-shadow: 0 0 24px rgba(34, 211, 238, 0.35);
}
.btn-outline-bronze, .btn-ghost {
    border: 1.5px solid var(--c-btn-outline-border);
    color: var(--c-btn-outline-fg);
    background: var(--c-btn-outline-bg);
    border-radius: 999px;
    padding: 0.65rem 1.15rem;
    font-weight: 600;
}
.btn-outline-bronze:hover, .btn-ghost:hover, .btn-ghost.is-active {
    border-color: var(--c-cyan-2);
    color: #fff;
    background: rgba(34, 211, 238, 0.28);
}
.btn.btn-sm {
    padding: 0.38rem 0.8rem;
    font-size: 0.82rem;
    line-height: 1.25;
}
.table .btn-sm {
    box-shadow: none;
}

.site-header { position: sticky; top: 0; z-index: 1040; }
.site-navbar {
    background: rgba(7, 10, 18, 0.72);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--c-border);
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}
.navbar-brand { display: flex; align-items: center; gap: 0.65rem; color: var(--c-text) !important; font-weight: 700; }
.brand-mark {
    width: 36px; height: 36px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--c-violet), var(--c-cyan));
    color: #fff; font-size: 0.95rem;
}
.site-navbar .nav-link { color: var(--c-muted); font-weight: 500; padding: 0.55rem 0.85rem; }
.site-navbar .nav-link:hover, .site-navbar .nav-link.active { color: #fff; }
.navbar-toggler { border-color: var(--c-border); }
.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(232, 238, 252, 0.9)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
.site-main { flex: 1 1 auto; }

.hero-ai { position: relative; padding: 1.5rem 0 2.5rem; }
.hero-orbs {
    position: absolute; inset: -40px 0 auto auto; width: min(420px, 70vw); height: 280px;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.22), transparent 65%);
    pointer-events: none;
}
.hero-kicker {
    display: inline-flex; align-items: center;
    letter-spacing: 0.12em; text-transform: uppercase;
    font-size: 0.78rem; color: var(--c-cyan); font-family: var(--font-heading); font-weight: 600;
}
.hero-ai h1 {
    font-size: clamp(2rem, 5vw, 3.4rem);
    font-weight: 700; line-height: 1.12; max-width: 16ch; margin: 0.8rem 0 1rem;
}
.hero-lead { max-width: 38rem; color: var(--c-muted); font-size: 1.12rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

.section-ai { padding: 1.25rem 0 2rem; }
.section-title { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 0.4rem; }
.section-sub { color: var(--c-muted); max-width: 40rem; margin-bottom: 1.5rem; }

.glass-card, .hero-block, .stat-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 1.35rem 1.4rem;
    backdrop-filter: blur(16px);
    box-shadow: 0 20px 50px var(--c-shadow);
}
.glass-card h3 { font-size: 1.15rem; margin-bottom: 0.4rem; }
.glass-card p { color: var(--c-muted); margin: 0; }
.agent-icon {
    width: 42px; height: 42px; border-radius: 12px; margin-bottom: 0.85rem;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(34, 211, 238, 0.12); color: var(--c-cyan);
}
.flow-rail {
    list-style: none; padding: 0; margin: 0;
    display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.6rem;
}
.flow-rail li {
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: 16px; padding: 0.9rem 0.7rem; text-align: center;
    font-family: var(--font-heading); font-weight: 600; font-size: 0.92rem;
}
.login-card { padding: 2rem; }
.form-control, .form-select {
    background: var(--c-input-bg); border-color: var(--c-border); color: var(--c-text);
    border-radius: 14px;
}
.form-control:focus, .form-select:focus {
    background: var(--c-input-bg-focus); color: var(--c-text);
    border-color: var(--c-cyan); box-shadow: 0 0 0 0.2rem rgba(34, 211, 238, 0.2);
}
.form-control::placeholder { color: var(--c-muted); }
.form-select option { background: var(--c-input-bg); color: var(--c-text); }
.form-label { color: var(--c-muted); font-weight: 600; }

.site-footer {
    margin-top: auto;
    background: rgba(7, 10, 18, 0.9);
    border-top: 1px solid var(--c-border);
    color: var(--c-muted);
}
.footer-brand { display: flex; align-items: center; gap: 0.6rem; color: var(--c-text); font-family: var(--font-heading); font-weight: 700; font-size: 1.15rem; }
.footer-title { font-size: 0.82rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--c-text); }
.footer-lead { color: var(--c-muted); }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links a { color: var(--c-muted); text-decoration: none; display: inline-block; padding: 0.2rem 0; }
.footer-links a:hover { color: var(--c-cyan); }
.footer-bottom {
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem;
    padding: 1rem 0 1.5rem; border-top: 1px solid var(--c-border); font-size: 0.88rem;
}

.admin-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 250px;
    background: var(--c-sidebar); color: var(--c-sidebar-text);
    z-index: 1030; display: flex; flex-direction: column;
    border-right: 1px solid var(--c-border);
}
.admin-brand { padding: 1rem 1.2rem; border-bottom: 1px solid var(--c-border); }
.admin-nav { flex: 1 1 auto; overflow-y: auto; padding: .5rem 0; }
.admin-nav-item {
    display: flex; align-items: center; gap: .75rem;
    color: var(--c-sidebar-text); background: none; border: 0; border-left: 3px solid transparent;
    width: 100%; text-align: left; text-decoration: none;
    padding: .75rem 1.1rem; font-size: .92rem;
}
.admin-nav-item i { width: 20px; text-align: center; }
.admin-nav-item:hover, .admin-nav-item.active { background: var(--c-graphite-2); color: var(--c-text); }
.admin-nav-item.active { border-left-color: var(--c-cyan); }
.admin-nav-chevron { font-size: .7rem; }
.admin-nav-group.open > .admin-nav-toggle .admin-nav-chevron { transform: rotate(180deg); }
.admin-nav-sub { max-height: 0; overflow: hidden; background: rgba(0,0,0,.2); }
.admin-nav-group.open > .admin-nav-sub { max-height: 500px; }
.admin-nav-child { padding-left: 2.6rem; }
.admin-sidebar-foot { border-top: 1px solid var(--c-border); }
.admin-content { margin-left: 250px; min-height: 100vh; display: flex; flex-direction: column; background: var(--c-bg); }
.admin-topbar {
    position: sticky; top: 0; z-index: 1020;
    background: var(--c-topbar);
    color: var(--c-sidebar-text);
    border-bottom: 1px solid var(--c-cyan);
    display: flex; align-items: center; gap: .5rem;
    padding: .5rem 1rem; min-height: 56px;
    backdrop-filter: blur(12px);
}
.admin-toggle { color: var(--c-sidebar-text); background: transparent; border: 1px solid transparent; }
.admin-toggle:hover { color: var(--c-text); background: var(--c-graphite-2); }
.admin-topbar-link { color: var(--c-sidebar-text); text-decoration: none; padding: .5rem .7rem; }
.admin-topbar-link:hover { color: var(--c-text); }
.admin-main { flex: 1 1 auto; }
.admin-content--tg { height: 100vh; overflow: hidden; }
.admin-main--tg { min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.tg-flush { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.tg-flush .alert { margin: .5rem .75rem 0; flex: 0 0 auto; }
.tg-app { flex: 1 1 auto; min-height: 0; display: flex; background: #0e1621; color: #e4edf4; }
.tg-dialogs { width: 340px; max-width: 42vw; flex: 0 0 340px; display: flex; flex-direction: column; background: #17212b; border-right: 1px solid #0e1621; min-width: 0; }
.tg-dialogs-head { padding: .75rem .9rem .5rem; border-bottom: 1px solid rgba(255,255,255,.06); }
.tg-dialogs-title { font-family: var(--font-heading); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: .82rem; margin-bottom: .5rem; color: #6ab3f3; }
.tg-search { background: #242f3d; border-color: transparent; color: #e4edf4; }
.tg-search:focus { background: #242f3d; color: #fff; border-color: #2b5278; box-shadow: none; }
.tg-dialogs-list { flex: 1 1 auto; overflow-y: auto; }
.tg-dialogs-empty { padding: 1.5rem 1rem; color: #8aa0b3; font-size: .9rem; }
.tg-dialog { display: flex; align-items: flex-start; gap: .7rem; padding: .7rem .9rem; text-decoration: none; color: inherit; border-bottom: 1px solid rgba(255,255,255,.04); position: relative; }
.tg-dialog:hover { background: rgba(255,255,255,.04); color: inherit; }
.tg-dialog.is-active { background: #2b5278; }
.tg-dialog-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .12rem; }
.tg-dialog-top { display: flex; justify-content: space-between; gap: .5rem; }
.tg-dialog-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-dialog-time { font-size: .72rem; color: #8aa0b3; flex: 0 0 auto; }
.tg-dialog.is-active .tg-dialog-time { color: #c5d4e0; }
.tg-dialog-meta { font-size: .72rem; color: #6ab3f3; }
.tg-dialog-preview { font-size: .8rem; color: #8aa0b3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-badge { position: absolute; right: .7rem; bottom: .7rem; min-width: 1.25rem; height: 1.25rem; padding: 0 .35rem; border-radius: 999px; background: #4fae4e; color: #fff; font-size: .7rem; display: flex; align-items: center; justify-content: center; }
.tg-ava { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; background: #2b5278; color: #fff; flex: 0 0 44px; position: relative; text-transform: uppercase; }
.tg-ava::after { content: ''; position: absolute; width: 10px; height: 10px; border-radius: 50%; right: 1px; bottom: 1px; background: #6c7a89; border: 2px solid #17212b; }
.tg-ava--online::after { background: #4fae4e; }
.tg-ava--recent::after { background: #f0b429; }
.tg-pane { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; background: #0e1621 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Ccircle cx='4' cy='4' r='1' fill='%23182533'/%3E%3C/svg%3E"); }
.tg-head { display: flex; align-items: center; gap: .75rem; padding: .55rem .9rem; background: #17212b; border-bottom: 1px solid #0e1621; flex: 0 0 auto; }
.tg-back { display: none; color: #6ab3f3; padding: .35rem; }
.tg-head-text { flex: 1 1 auto; min-width: 0; }
.tg-head-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-head-status { font-size: .78rem; color: #8aa0b3; }
.tg-hint { font-size: .75rem; color: #8aa0b3; padding: .35rem .9rem; background: rgba(23,33,43,.85); }
.tg-hint code { color: #6ab3f3; font-size: .72rem; }
.tg-thread { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 1rem .9rem 1.2rem; display: flex; flex-direction: column; }
.tg-day { text-align: center; margin: .6rem 0; }
.tg-day span { display: inline-block; background: rgba(24,37,51,.9); color: #c5d4e0; font-size: .75rem; padding: .2rem .7rem; border-radius: 999px; }
.tg-row { display: flex; margin-bottom: .35rem; }
.tg-row--out { justify-content: flex-end; }
.tg-row--in { justify-content: flex-start; }
.tg-bubble { max-width: min(72%, 520px); padding: .45rem .7rem .28rem; border-radius: 12px; box-shadow: 0 1px 1px rgba(0,0,0,.25); }
.tg-bubble--out { background: #2b5278; border-bottom-right-radius: 4px; }
.tg-bubble--in { background: #182533; border-bottom-left-radius: 4px; }
.tg-bubble-text { word-break: break-word; line-height: 1.35; }
.tg-bubble-foot { display: flex; justify-content: flex-end; align-items: center; gap: .35rem; font-size: .68rem; color: rgba(255,255,255,.55); margin-top: .15rem; }
.tg-tick--wait { color: #f0b429; }
.tg-tick--ok { color: #6ab3f3; }
.tg-empty, .tg-empty-pane { margin: auto; text-align: center; color: #8aa0b3; max-width: 28rem; padding: 2rem 1rem; }
.tg-empty i, .tg-empty-pane i { font-size: 2.4rem; color: #2b5278; display: block; margin-bottom: .75rem; }
.tg-compose { flex: 0 0 auto; background: #17212b; padding: .45rem .7rem .65rem; border-top: 1px solid #0e1621; }
.tg-compose-tools { display: flex; align-items: center; gap: .4rem; margin-bottom: .35rem; flex-wrap: wrap; }
.tg-tool { background: #242f3d; border: 0; color: #c5d4e0; border-radius: 999px; font-size: .75rem; padding: .15rem .65rem; }
.tg-tool:hover { background: #2b5278; color: #fff; }
.tg-compose-note { font-size: .7rem; color: #6c7a89; margin-left: auto; }
.tg-compose-row { display: flex; align-items: flex-end; gap: .5rem; }
.tg-input { background: #242f3d; border: 0; color: #e4edf4; border-radius: 18px; resize: none; min-height: 44px; max-height: 160px; }
.tg-input:focus { background: #242f3d; color: #fff; box-shadow: 0 0 0 1px #2b5278; }
.tg-send { width: 44px; height: 44px; border: 0; border-radius: 50%; background: #2b5278; color: #fff; flex: 0 0 44px; }
.tg-send:hover { background: #3a6ea5; }
@media (max-width: 768px) {
    .tg-dialogs { flex-basis: 100%; max-width: none; width: 100%; }
    .tg-app--chat .tg-dialogs { display: none; }
    .tg-app--list .tg-pane { display: none; }
    .tg-back { display: inline-flex; }
    .tg-bubble { max-width: 88%; }
}
.admin-footer {
    background: var(--c-sidebar); color: var(--c-muted);
    border-top: 1px solid var(--c-border);
}
.admin-footer a { color: var(--c-cyan); text-decoration: none; }
.stat-card .stat-num { font-size: 2rem; font-weight: 700; color: var(--c-card-num); font-family: var(--font-heading); }
.stat-card .stat-label { color: var(--c-muted); text-transform: uppercase; font-size: .8rem; letter-spacing: .5px; }
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--c-text);
    --bs-table-hover-bg: transparent;
    --bs-table-striped-bg: rgba(148, 163, 184, 0.08);
    color: var(--c-text);
}
.table > :not(caption) > * > * {
    background-color: transparent;
    color: inherit;
    box-shadow: none;
}
.table thead { background: rgba(255,255,255,0.04); }
.agent-log-step {
    border: 1px solid var(--c-border);
    border-left: 4px solid var(--c-cyan);
    padding: .9rem 1rem;
    margin-bottom: .75rem;
    background: rgba(2, 6, 23, 0.45);
    border-radius: 14px;
}
.agent-log-step.is-fail { border-left-color: var(--c-accent); }

@media (max-width: 991px) {
    .flow-rail { grid-template-columns: repeat(2, 1fr); }
    .hero-ai h1 { max-width: none; }
}
@media (max-width: 900px) {
    .admin-sidebar { width: 64px; }
    .admin-brand-text, .admin-nav-label, .admin-nav-chevron, .admin-sidebar-foot { display: none; }
    .admin-content { margin-left: 64px; }
    .admin-nav-item { justify-content: center; padding: .85rem 0; }
}
@media (prefers-reduced-motion: reduce) {
    .btn, .nav-link, .admin-nav-item { transition: none; }
    .btn:hover { transform: none; }
}

.ui-hint {
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; background: transparent; color: var(--c-muted);
    padding: 0 .2rem; line-height: 1; vertical-align: middle; cursor: help;
}
.ui-hint:hover, .ui-hint:focus { color: var(--c-cyan); outline: none; }
.ui-theme-toggle { border: 0; background: transparent; cursor: pointer; }
.site-navbar .ui-theme-toggle { color: var(--c-muted); }
.site-navbar .ui-theme-toggle:hover { color: var(--c-text); }
.admin-brand-link { color: var(--c-text); }
.admin-brand-link:hover { color: var(--c-cyan); }
.admin-tenant-select { max-width: 220px; }

html[data-theme="light"] {
    color-scheme: light;
    --c-bg: #f1f5f9;
    --c-bg-2: #ffffff;
    --c-surface: #ffffff;
    --c-text: #0f172a;
    --c-muted: #475569;
    --c-border: rgba(15, 23, 42, 0.14);
    --c-graphite: #e2e8f0;
    --c-graphite-2: #cbd5e1;
    --c-input-bg: #ffffff;
    --c-input-bg-focus: #ffffff;
    --c-sidebar: #ffffff;
    --c-sidebar-text: #334155;
    --c-topbar: rgba(255, 255, 255, 0.94);
    --c-card-num: #0f172a;
    --c-shadow: rgba(15, 23, 42, 0.08);
    --c-cyan: #0e7490;
    --c-cyan-2: #155e75;
    --c-btn-solid-from: #0e7490;
    --c-btn-solid-to: #155e75;
    --c-btn-solid-fg: #ffffff;
    --c-btn-outline-bg: #ecfeff;
    --c-btn-outline-border: #0e7490;
    --c-btn-outline-fg: #0e7490;
}
html[data-theme="light"] body.site-public {
    background:
        radial-gradient(1200px 600px at 8% -10%, rgba(139, 92, 246, 0.12), transparent 52%),
        radial-gradient(900px 480px at 100% 0%, rgba(14, 116, 144, 0.12), transparent 46%),
        var(--c-bg);
}
html[data-theme="light"] .site-navbar {
    background: rgba(255, 255, 255, 0.9);
}
html[data-theme="light"] .site-navbar .nav-link:hover,
html[data-theme="light"] .site-navbar .nav-link.active { color: #0f172a; }
html[data-theme="light"] .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(15, 23, 42, 0.85)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
html[data-theme="light"] .site-footer { background: #ffffff; }
html[data-theme="light"] .table thead { background: #e2e8f0; }
html[data-theme="light"] .table-striped > tbody > tr:nth-of-type(odd) > * { color: var(--c-text); }
html[data-theme="light"] .agent-log-step { background: #fff; }
html[data-theme="light"] code { color: #9f1239; }
html[data-theme="light"] .admin-nav-sub { background: #f8fafc; }
html[data-theme="light"] .tg-app { background: #e6ebf0; color: #0f172a; }
html[data-theme="light"] .tg-dialogs { background: #ffffff; border-right-color: #d0d7de; }
html[data-theme="light"] .tg-dialog { color: #0f172a; border-bottom-color: #eef2f6; }
html[data-theme="light"] .tg-dialog:hover { background: #f4f6f8; }
html[data-theme="light"] .tg-dialog.is-active { background: #dbeafe; color: #0f172a; }
html[data-theme="light"] .tg-dialog-preview,
html[data-theme="light"] .tg-dialog-time,
html[data-theme="light"] .tg-head-status,
html[data-theme="light"] .tg-compose-note { color: #64748b; }
html[data-theme="light"] .tg-dialog-meta { color: #0369a1; }
html[data-theme="light"] .tg-head,
html[data-theme="light"] .tg-compose { background: #ffffff; border-color: #d0d7de; }
html[data-theme="light"] .tg-hint { background: #f8fafc; color: #475569; }
html[data-theme="light"] .tg-hint code { color: #0369a1; }
html[data-theme="light"] .tg-pane { background: #e6ebf0; }
html[data-theme="light"] .tg-bubble--out { background: #dcf8c6; color: #0f172a; }
html[data-theme="light"] .tg-bubble--in { background: #ffffff; color: #0f172a; }
html[data-theme="light"] .tg-bubble-foot { color: #64748b; }
html[data-theme="light"] .tg-input,
html[data-theme="light"] .tg-search,
html[data-theme="light"] .tg-tool { background: #f1f5f9; color: #0f172a; }
html[data-theme="light"] .tg-input:focus { color: #0f172a; }
html[data-theme="light"] .tg-empty,
html[data-theme="light"] .tg-empty-pane,
html[data-theme="light"] .tg-dialogs-empty { color: #475569; }
html[data-theme="light"] .h3, html[data-theme="light"] h1 { color: var(--c-text); }
html[data-theme="light"] .btn-outline-bronze:hover, html[data-theme="light"] .btn-ghost:hover, html[data-theme="light"] .btn-ghost.is-active {
    background: #cffafe;
    color: #155e75;
    border-color: #155e75;
}
.orto-actbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.orto-act {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 12px; border-radius: 10px;
    font-family: var(--font-heading); font-weight: 650; font-size: 13px; line-height: 1.2;
    text-decoration: none !important; cursor: pointer;
    background: #1e293b !important; color: #f8fafc !important;
    border: 2px solid #94a3b8 !important;
    box-shadow: 0 1px 0 rgba(255,255,255,.08) inset;
}
button.orto-act {
    appearance: none; -webkit-appearance: none; margin: 0;
}
.orto-act i { font-size: 12px; }
.orto-act:hover, .orto-act:focus {
    background: #334155 !important; color: #ffffff !important;
    border-color: #22d3ee !important;
}
.orto-act--main {
    background: #0369a1 !important; color: #ffffff !important;
    border-color: #7dd3fc !important;
}
.orto-act--main:hover, .orto-act--main:focus {
    background: #0284c7 !important; color: #ffffff !important;
    border-color: #e0f2fe !important;
}
html[data-theme="light"] .orto-act {
    background: #0f172a !important; color: #ffffff !important;
    border-color: #0f172a !important;
}
html[data-theme="light"] .orto-act:hover,
html[data-theme="light"] .orto-act:focus {
    background: #1e293b !important; color: #ffffff !important;
    border-color: #0369a1 !important;
}
html[data-theme="light"] .orto-act--main {
    background: #0369a1 !important; color: #ffffff !important;
    border-color: #0369a1 !important;
}
html[data-theme="light"] .orto-act--main:hover,
html[data-theme="light"] .orto-act--main:focus {
    background: #075985 !important; color: #ffffff !important;
}

.crew-token-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 11rem; }
.crew-token-mark {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--font-heading); font-weight: 700; font-size: 13px; line-height: 1.2;
    padding: 6px 12px; border-radius: 999px; border: 0;
}
.crew-token-mark--on { background: #16a34a !important; color: #ffffff !important; }
.crew-token-mark--off { background: #ea580c !important; color: #ffffff !important; }
.crew-token-btn {
    font-weight: 700 !important;
    border-radius: 999px !important;
    border: 0 !important;
}
.crew-token-btn--issue { background: #c2410c !important; color: #ffffff !important; }
.crew-token-btn--reissue { background: #0f172a !important; color: #ffffff !important; }
.crew-token-btn--reissue:hover, .crew-token-btn--reissue:focus { color: #ffffff !important; background: #1e293b !important; }
.crew-token-btn--issue:hover, .crew-token-btn--issue:focus { color: #ffffff !important; background: #9a3412 !important; }
.table .crew-row--hastoken > * {
    background-color: #14532d !important;
    color: #dcfce7 !important;
    box-shadow: none !important;
}
.table .crew-row--hastoken > *:first-child {
    box-shadow: inset 10px 0 0 #4ade80 !important;
    padding-left: 1.1rem;
}
.table .crew-row--notoken > * {
    background-color: #7c2d12 !important;
    color: #ffedd5 !important;
    box-shadow: none !important;
}
.table .crew-row--notoken > *:first-child {
    box-shadow: inset 10px 0 0 #fb923c !important;
    padding-left: 1.1rem;
}
.crew-row--hastoken .text-muted-2,
.crew-row--notoken .text-muted-2 { color: inherit !important; opacity: .85; }
.crew-row--hastoken code,
.crew-row--notoken code { color: inherit; }
html[data-theme="light"] .table .crew-row--hastoken > * {
    background-color: #bbf7d0 !important;
    color: #14532d !important;
}
html[data-theme="light"] .table .crew-row--hastoken > *:first-child {
    box-shadow: inset 10px 0 0 #16a34a !important;
}
html[data-theme="light"] .table .crew-row--notoken > * {
    background-color: #fed7aa !important;
    color: #7c2d12 !important;
}
html[data-theme="light"] .table .crew-row--notoken > *:first-child {
    box-shadow: inset 10px 0 0 #c2410c !important;
}

.impersonate-bar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
    background: #c2410c; color: #fff; border-radius: 14px; padding: .7rem 1rem; margin-bottom: 1rem;
    font-weight: 600;
}
.impersonate-bar .btn-light { font-weight: 700; }

.dash-hero {
    display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap;
    margin-bottom: 1.1rem;
}
.dash-kicker { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--c-cyan); font-family: var(--font-heading); margin-bottom: .35rem; display: flex; align-items: center; gap: .45rem; }
.dash-live-dot { width: 9px; height: 9px; border-radius: 50%; background: #4fae4e; box-shadow: 0 0 0 0 rgba(79,174,78,.7); animation: dashPulse 1.8s ease-out infinite; }
.dash-live-dot.is-stale { background: #f0b429; animation: none; }
@keyframes dashPulse {
    0% { box-shadow: 0 0 0 0 rgba(79,174,78,.55); }
    70% { box-shadow: 0 0 0 10px rgba(79,174,78,0); }
    100% { box-shadow: 0 0 0 0 rgba(79,174,78,0); }
}
.dash-clock { font-family: var(--font-heading); font-size: 1.85rem; font-weight: 700; letter-spacing: .04em; color: var(--c-card-num); line-height: 1; }
.dash-hero-meta { text-align: right; }
.dash-alerts { display: flex; flex-direction: column; gap: .45rem; margin-bottom: 1rem; }
.dash-alert {
    display: flex; align-items: center; gap: .55rem; padding: .7rem .95rem; border-radius: 14px;
    text-decoration: none; border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text);
}
.dash-alert:hover { color: var(--c-text); border-color: var(--c-cyan); }
.dash-alert--ok { border-color: rgba(79,174,78,.45); }
.dash-alert--danger { border-color: rgba(239,68,68,.5); }
.dash-alert--warn { border-color: rgba(240,180,41,.5); }
.dash-alert--info { border-color: rgba(34,211,238,.35); }
.dash-kpis {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin-bottom: 1rem;
}
.dash-kpi {
    display: flex; flex-direction: column; gap: .15rem; text-decoration: none; color: inherit;
    background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
    padding: 1rem 1.05rem; min-height: 118px; transition: transform .15s ease, border-color .15s ease;
}
.dash-kpi:hover { transform: translateY(-2px); border-color: var(--c-cyan); color: inherit; }
.dash-kpi--hot { border-color: rgba(239,68,68,.55); }
.dash-kpi--live { border-color: rgba(79,174,78,.45); }
.dash-kpi-ico { color: var(--c-cyan); font-size: 1rem; }
.dash-kpi-num { font-family: var(--font-heading); font-size: 1.65rem; font-weight: 700; color: var(--c-card-num); line-height: 1.15; }
.dash-kpi-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--c-muted); }
.dash-kpi-hint { font-size: .75rem; color: var(--c-muted); }
.dash-row { display: grid; grid-template-columns: 1.2fr .8fr; gap: .75rem; margin-bottom: 1rem; }
.dash-row--3 { grid-template-columns: repeat(3, 1fr); }
.dash-panel {
    background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
    padding: 1rem 1.1rem; min-width: 0;
}
.dash-panel-h { font-family: var(--font-heading); font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: .75rem; }
.dash-spark { display: flex; align-items: flex-end; gap: .45rem; height: 120px; }
.dash-bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: .25rem; }
.dash-bar span { display: block; width: 100%; max-width: 28px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, var(--c-cyan), #38bdf8); min-height: 4px; }
.dash-bar small { color: var(--c-muted); font-size: .65rem; }
.dash-note { color: var(--c-muted); font-size: .85rem; }
.dash-flags { list-style: none; margin: 0; padding: 0; }
.dash-flags li { display: flex; justify-content: space-between; gap: .75rem; padding: .45rem 0; border-bottom: 1px solid var(--c-border); font-size: .9rem; }
.dash-flags li:last-child { border-bottom: 0; }
.dash-flags .is-ok strong { color: #4fae4e; }
.dash-flags .is-bad strong { color: #f87171; }
.dash-feed { list-style: none; margin: 0; padding: 0; }
.dash-feed li { padding: .5rem 0; border-bottom: 1px solid var(--c-border); font-size: .88rem; }
.dash-feed li:last-child { border-bottom: 0; }
.dash-feed-t { color: var(--c-muted); font-size: .78rem; margin-top: .15rem; }
.dash-pill { display: inline-block; font-size: .68rem; padding: .1rem .4rem; border-radius: 999px; background: rgba(34,211,238,.12); color: var(--c-cyan); }
.dash-pill--quarantine, .dash-pill--failed { background: rgba(239,68,68,.15); color: #fca5a5; }
.dash-pill--published { background: rgba(79,174,78,.15); color: #86efac; }
.dash-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .35rem; background: #6c7a89; }
.dash-dot--on { background: #4fae4e; }
.dash-dot--rec { background: #f0b429; }
.dash-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: .55rem; margin-bottom: .5rem; }
.dash-act {
    display: flex; align-items: center; justify-content: center; gap: .45rem;
    padding: .7rem .5rem; border-radius: 14px; border: 1px solid var(--c-border);
    background: var(--c-surface); color: var(--c-text); text-decoration: none; font-size: .88rem;
}
.dash-act:hover { border-color: var(--c-cyan); color: var(--c-cyan); }
.post-desk { display: grid; grid-template-columns: 1.4fr .75fr; gap: .85rem; align-items: start; }
.post-desk-text, .post-desk-text-ro { white-space: pre-wrap; font-size: .95rem; line-height: 1.45; }
.post-desk-text-ro { min-height: 8rem; }
.post-desk-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.post-desk-img { width: 100%; border-radius: 12px; border: 1px solid var(--c-border); display: block; }
.post-desk-why { background: rgba(240,180,41,.08); border-radius: 10px; padding: .75rem 1rem; }
.draft-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .85rem; }
.draft-card {
    display: flex; flex-direction: column; text-decoration: none; color: inherit;
    background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius);
    overflow: hidden; min-height: 220px; transition: border-color .15s ease, transform .15s ease;
}
.draft-card:hover { border-color: var(--c-cyan); color: inherit; transform: translateY(-2px); }
.draft-card img, .draft-card-ph { width: 100%; height: 140px; object-fit: cover; background: rgba(15,23,42,.35); }
.draft-card-ph { display: flex; align-items: center; justify-content: center; color: var(--c-muted); font-size: 1.6rem; }
.draft-card-body { padding: .85rem 1rem 1rem; }
.draft-card-text { font-size: .88rem; color: var(--c-text); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 900px) {
    .post-desk { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
    .dash-kpis { grid-template-columns: repeat(2, 1fr); }
    .dash-row, .dash-row--3 { grid-template-columns: 1fr; }
    .dash-actions { grid-template-columns: repeat(2, 1fr); }
    .dash-hero-meta { text-align: left; }
}
@media (max-width: 576px) {
    .dash-kpis { grid-template-columns: 1fr 1fr; }
    .dash-kpi { min-height: 0; padding: .85rem; }
    .dash-kpi-num { font-size: 1.35rem; }
}

