:root {
    --bg: #050505;
    --panel: #0c0c10;
    --panel-2: #14141a;
    --ink: #f4fbff;
    --muted: #8ea0ad;
    --line: rgba(95, 233, 255, 0.22);
    --accent: #5fe9ff;
    --accent-2: #ff4fd8;
    --bad: #ff5d7a;
    --warn: #ffd166;
    --ok: #3dffb0;
    --sidebar: #000000;
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
    --radius: 14px;
    --font: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(ellipse 55% 40% at 0% 0%, rgba(95, 233, 255, .08), transparent 55%),
        radial-gradient(ellipse 40% 35% at 100% 100%, rgba(255, 79, 216, .07), transparent 50%),
        var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre.code { font-family: Consolas, monospace; }

.guest-body, .login-shell {
    min-height: 100vh;
    background:
        radial-gradient(ellipse 70% 50% at 15% 0%, rgba(95, 233, 255, .16) 0%, transparent 55%),
        radial-gradient(ellipse 50% 40% at 90% 90%, rgba(255, 79, 216, .12) 0%, transparent 50%),
        var(--bg);
}
.login-shell { display: grid; place-items: center; padding: 2rem; }
.login-card, .shell {
    width: min(420px, 100%);
    padding: 2rem;
    background: rgba(8, 8, 12, 0.94);
    border: 1px solid var(--line);
    border-radius: calc(var(--radius) + 4px);
    box-shadow: var(--shadow), 0 0 24px rgba(95, 233, 255, .12);
}
.brand { margin: 0 0 .6rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-size: .82rem; font-weight: 700; }
.login-card .brand, .shell .brand {
    display: flex; align-items: center; gap: .65rem; letter-spacing: .08em; text-transform: none; font-size: 1.05rem;
}
.login-card .brand img, .shell .brand img { border-radius: 10px; }
h1 { margin: 0 0 .6rem; font-size: clamp(1.6rem, 3vw, 2.1rem); line-height: 1.15; }
.lede, .muted, .hint { color: var(--muted); line-height: 1.5; }
.hint { font-size: .9rem; }
.error, .flash.bad { color: var(--bad); }
.flash.ok { color: var(--ok); }

.app-body { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; transition: grid-template-columns .35s ease; }
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: linear-gradient(180deg, #07070b, var(--sidebar));
    border-right: 1px solid var(--line);
    padding: .7rem .7rem .65rem;
    display: flex; flex-direction: column; gap: .45rem;
    overflow: hidden;
}
.sidebar-brand { display: flex; gap: .65rem; align-items: center; padding: .15rem .4rem .2rem; min-width: 0; }
.sidebar-brand > div { min-width: 0; }
.brand-mark-img {
    width: 2.5rem; height: 2.5rem; border-radius: 9px; object-fit: cover;
    box-shadow: 0 0 14px rgba(95, 233, 255, .35);
    flex-shrink: 0;
}
.brand-mark {
    width: 2rem; height: 2rem; border-radius: 9px; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--accent), #7a5cff); color: #041016; font-weight: 800;
    box-shadow: 0 0 14px rgba(95, 233, 255, .45);
    flex: 0 0 auto;
}
.sidebar-brand strong { display: block; font-size: .95rem; letter-spacing: .01em; }
.sidebar-brand small { color: var(--muted); display: block; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-nav { display: grid; align-content: start; gap: .15rem; overflow: auto; flex: 1; min-height: 0; padding-right: .1rem; }
.nav-group { display: grid; gap: .05rem; margin-bottom: .35rem; }
.nav-label {
    margin: .28rem .65rem .1rem;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #5fe9ff;
}
.sidebar-nav a, .nav-settings {
    color: var(--muted); padding: .32rem .65rem; border-radius: 8px; text-decoration: none;
    font-size: .92rem;
}
.sidebar-nav a:hover, .nav-settings:hover { background: rgba(255,255,255,.04); color: var(--ink); text-decoration: none; }
.sidebar-nav a.active, .nav-settings.active {
    background: rgba(95, 233, 255, .12);
    color: var(--ink);
    box-shadow: inset 2px 0 0 var(--accent), 0 0 12px rgba(95, 233, 255, .08);
}
.sidebar-foot { border-top: 1px solid var(--line); padding-top: .7rem; display: grid; gap: .55rem; }
.user-chip { display: grid; padding: 0 .2rem; }
.user-chip small { color: var(--muted); text-transform: capitalize; }
.linkish { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 .2rem; font: inherit; text-align: left; }
.linkish:hover { color: var(--ink); }
.menu-btn, .nav-backdrop { display: none; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .8rem 1.25rem;
    background: rgba(0, 0, 0, .88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 1.25rem; letter-spacing: -.01em; }
.page-lede { margin: .15rem 0 0; color: var(--muted); font-size: .88rem; }
.content { padding: 1rem 1.25rem 2rem; }
.jump {
    display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .9rem;
}
.jump a {
    text-decoration: none; color: var(--ink); background: var(--panel);
    border: 1px solid var(--line); border-radius: 999px; padding: .28rem .7rem; font-size: .82rem;
}
.jump a:hover { border-color: var(--accent); text-decoration: none; }
.panel, .split { scroll-margin-top: 4.5rem; }

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.1rem 1.15rem;
    margin-bottom: 1rem;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .75rem; }
.panel-head h2, .panel h3 { margin: 0; font-size: 1rem; }
.stat-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .8rem; margin-bottom: 1rem;
}
.stat {
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem;
}
.stat span { display: block; color: var(--muted); font-size: .85rem; margin-bottom: .35rem; }
.stat strong { font-size: 1.5rem; color: var(--accent); text-shadow: 0 0 12px rgba(95, 233, 255, .35); }
.panel { box-shadow: 0 0 0 1px rgba(95, 233, 255, .04); }

.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; }
.split.tight { grid-template-columns: 1fr 1fr; margin-top: 1rem; }
@media (max-width: 960px) {
    .app-body { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(280px, 88vw);
        z-index: 80;
        transform: translateX(-105%);
        transition: transform .25s ease;
        box-shadow: var(--shadow);
    }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.45); border: 0; }
    .nav-backdrop[hidden] { display: none !important; }
    .menu-btn {
        display: inline-flex; align-items: center; flex: 0 0 auto;
        border: 1px solid var(--line); background: var(--panel); color: var(--ink);
        border-radius: 999px; padding: .4rem .75rem; font: inherit; cursor: pointer;
    }
    .split, .split.tight { grid-template-columns: 1fr; }
}

.stack { display: grid; gap: .75rem; }
label { display: grid; gap: .35rem; color: var(--muted); font-size: .9rem; }
input, textarea, select {
    width: 100%; border: 1px solid var(--line); background: #070709; color: var(--ink);
    border-radius: 10px; padding: .6rem .7rem; font: inherit;
}
input:focus, textarea:focus, select:focus {
    outline: 2px solid rgba(95, 233, 255, .45);
    border-color: rgba(95, 233, 255, .85);
    box-shadow: 0 0 12px rgba(95, 233, 255, .2);
}
.btn {
    border: 0; border-radius: 999px; padding: .55rem .95rem; background: var(--accent); color: #041016;
    box-shadow: 0 0 16px rgba(95, 233, 255, .28);
    font-weight: 700; cursor: pointer; font: inherit;
}
.btn:hover { filter: brightness(1.06); }
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid rgba(255, 93, 122, .45); box-shadow: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .5rem .35rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-size: .75rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.pill {
    display: inline-block; padding: .15rem .5rem; border-radius: 999px; background: rgba(95, 233, 255, .12);
    color: var(--accent); font-size: .75rem; text-transform: lowercase;
}
.pill.warn { color: var(--warn); background: rgba(255, 209, 102, .12); }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.list li { border-bottom: 1px solid var(--line); padding-bottom: .65rem; }
.list.compact li { font-size: .9rem; }
.card-lite { border-bottom: 1px solid var(--line); padding: .75rem 0; }
.meta { display: grid; gap: .5rem; }
.meta div { display: grid; grid-template-columns: 7rem 1fr; gap: .5rem; }
.meta dt { color: var(--muted); margin: 0; }
.meta dd { margin: 0; }
pre.code {
    background: #070709; border: 1px solid var(--line); border-radius: 10px; padding: .75rem;
    overflow: auto; white-space: pre-wrap;
}
.thread { display: grid; gap: .7rem; margin: 1rem 0; }
.bubble { max-width: 85%; padding: .7rem .85rem; border-radius: 12px; background: #12141a; border: 1px solid rgba(95, 233, 255, .12); }
.bubble.inbound { justify-self: start; }
.bubble.outbound, .bubble.agent { justify-self: end; background: #101820; border-color: rgba(95, 233, 255, .28); }
.bubble small { color: var(--muted); }
.inline-form { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.inline-form select, .inline-form input { width: auto; min-width: 7rem; }

.office-canvas {
    position: relative; height: 420px; border-radius: 16px; overflow: hidden;
    background:
        linear-gradient(180deg, rgba(0,0,0,.2), rgba(0,0,0,.55)),
        repeating-linear-gradient(90deg, transparent, transparent 39px, rgba(95,233,255,.05) 40px),
        repeating-linear-gradient(0deg, transparent, transparent 39px, rgba(95,233,255,.05) 40px),
        linear-gradient(135deg, #07070c, #101018 40%, #050508);
    border: 1px solid var(--line);
}
.agent-avatar {
    position: absolute; width: 78px; transform: translate(-50%, -50%);
    transition: left .8s ease, top .8s ease;
    text-align: center;
}
.agent-avatar .sprite {
    width: 46px; height: 46px; margin: 0 auto .3rem; border-radius: 14px;
    display: grid; place-items: center; font-weight: 800; color: #041016;
    background: var(--accent); box-shadow: 0 8px 18px rgba(0,0,0,.25);
    animation: none;
}
.agent-avatar.working .sprite { background: var(--accent-2); animation: pulse 1.4s ease-in-out infinite; }
.agent-avatar.waiting .sprite { background: var(--warn); }
.agent-avatar.error .sprite, .agent-avatar.offline .sprite { background: var(--bad); }
.agent-avatar.talking .sprite { outline: 2px solid var(--accent); box-shadow: 0 0 12px rgba(95, 233, 255, .45); }
.agent-avatar .label { font-size: .72rem; color: var(--ink); line-height: 1.2; }
.agent-avatar .task { font-size: .65rem; color: var(--muted); max-width: 110px; margin: .15rem auto 0; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }

.agent-create-loading { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; background: rgba(5, 5, 5, .72); backdrop-filter: blur(3px); }
.agent-create-loading[hidden] { display: none; }
.agent-create-loading-card { display: grid; justify-items: center; gap: .5rem; padding: 1.4rem 1.8rem; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); text-align: center; }
.agent-create-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: agent-create-spin .8s linear infinite; }
@keyframes agent-create-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .agent-create-spinner { animation-duration: 2.4s; } }




.flow-wrap { overflow: auto; }
.flow-svg { width: 100%; min-width: 720px; height: auto; display: block; }
.flow-svg .flow-line {
    stroke: #5fe9ff;
    stroke-width: 2.5;
    fill: none;
    opacity: .85;
}
.flow-svg .flow-node rect {
    fill: #101018;
    stroke: rgba(95, 233, 255, .35);
    stroke-width: 1.5;
}
.flow-svg .flow-node.accent rect {
    fill: #102028;
    stroke: #5fe9ff;
}
.flow-svg .flow-node.gemini rect {
    fill: #1a1020;
    stroke: #ff4fd8;
}
.flow-svg text {
    fill: #f4fbff;
    font-size: 15px;
    font-family: "Segoe UI", sans-serif;
    font-weight: 600;
}
.flow-svg text.sub {
    fill: #8ea0ad;
    font-size: 12px;
    font-weight: 400;
}
.flow-steps {
    margin: 0;
    padding-left: 1.2rem;
    display: grid;
    gap: .55rem;
    color: var(--muted);
    line-height: 1.45;
}
.flow-steps li { padding-left: .2rem; }

.brand-switch { padding: 0 .35rem .15rem; }
.brand-switch label { gap: .2rem; }
.brand-switch select { width: 100%; }

.server-hero { display: flex; gap: 1.25rem; align-items: flex-start; }
.server-hero h2 { margin: 0 0 .35rem; }
.server-hero-rack {
    flex: 0 0 64px;
    display: grid;
    gap: 5px;
    padding: 6px;
    border-radius: 8px;
    background: #0a0d14;
    border: 1px solid rgba(95, 233, 255, .35);
    box-shadow: 0 0 18px rgba(95, 233, 255, .15);
}
.server-hero-rack i {
    display: block;
    height: 14px;
    border-radius: 3px;
    background: linear-gradient(90deg, #121a26 70%, #3dffb0 70%, #3dffb0 76%, #121a26 76%, #121a26 82%, #5fe9ff 82%, #5fe9ff 88%, #121a26 88%);
    animation: rack-blink 1.6s steps(2) infinite;
}
.server-hero-rack i:nth-child(2) { animation-delay: .4s; }
.server-hero-rack i:nth-child(3) { animation-delay: .8s; }
.server-hero-rack i:nth-child(4) { animation-delay: 1.2s; }
.setup-steps { margin: .75rem 0 0; padding-left: 1.25rem; display: grid; gap: .65rem; max-width: 52rem; }
.setup-steps li { line-height: 1.45; }
.setup-steps li.done { color: var(--ok); }
.setup-steps li.done strong { color: var(--ink); }
.setup-steps .pill { margin-left: .35rem; }
@keyframes rack-blink { 50% { filter: brightness(.55); } }
.server-stats { display: flex; flex-wrap: wrap; gap: 1.25rem; font-size: .9rem; color: var(--muted); }
.server-stats strong { color: var(--ink); font-size: 1.05rem; }

.role-card .panel-head h2 code { font-size: .8rem; margin-left: .35rem; }
.role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-top: .75rem; }
.role-grid h4 { margin: 0 0 .4rem; font-size: .85rem; color: var(--muted); }
.role-checks { display: grid; gap: .3rem; }
.role-checks .check { font-size: .88rem; }

.wf-tabs { display: flex; gap: .6rem; margin-bottom: .9rem; flex-wrap: wrap; }
.wf-tab {
    flex: 1 1 240px;
    padding: .7rem .9rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
}
.wf-tab:hover { text-decoration: none; border-color: rgba(95, 233, 255, .5); }
.wf-tab strong { display: block; }
.wf-tab small { color: var(--muted); }
.wf-tab.active { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(95, 233, 255, .35), 0 0 18px rgba(95, 233, 255, .12); }
.wf-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; }
.wf-pick select { min-width: 260px; }
.wf-mode { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 0; }
.wf-pill-custom { background: rgba(255, 79, 216, .14); color: #ff9be9; border-color: rgba(255, 79, 216, .4); }
.wf-pill-role { background: rgba(95, 233, 255, .1); color: var(--accent); }
.wf-toolbar-panel { padding-top: .75rem; padding-bottom: .75rem; }
.wf-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: end;
}
.wf-spacer { flex: 1; }
.wf-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: .6rem; font-size: .82rem; color: var(--muted); }
.wf-legend-item { display: inline-flex; align-items: center; gap: .4rem; }
.wf-swatch { width: 28px; height: 0; border-top: 3px solid var(--c); display: inline-block; }
.wf-swatch-done, .wf-swatch-approved { border-top-style: dashed; }
.wf-swatch-rejected { border-top-style: dotted; }

.wf-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .wf-layout { grid-template-columns: 1fr; } }
.wf-board-wrap { padding: 0; overflow: hidden; }
.wf-board {
    position: relative;
    height: 640px;
    background:
        radial-gradient(circle at 1px 1px, rgba(255,255,255,.08) 1px, transparent 0) 0 0 / 20px 20px,
        #050508;
    overflow: auto;
}
.wf-stage { position: relative; min-width: 100%; min-height: 100%; }
.wf-lines { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.wf-line { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.wf-line.flow { stroke-dasharray: 9 6; animation: wf-dash 1.1s linear infinite; }
.wf-line.cond-rejected { stroke-dasharray: 3 6; }
.wf-edge.inherited .wf-line { opacity: .75; }
.wf-edge.implied .wf-line { opacity: .55; stroke-dasharray: 2 7; }
.wf-edge.selected .wf-line { stroke-width: 4; filter: drop-shadow(0 0 5px currentColor); }
.wf-hit { fill: none; stroke: transparent; stroke-width: 16; pointer-events: stroke; cursor: pointer; }
.wf-edge.selected .wf-hit { cursor: copy; }
@keyframes wf-dash { to { stroke-dashoffset: -30; } }
.wf-edge-label {
    font-size: 11px;
    font-weight: 600;
    pointer-events: none;
    paint-order: stroke;
    stroke: #050508;
    stroke-width: 4px;
    stroke-linejoin: round;
}
.wf-edge-label.selected { font-size: 12px; }
.wf-handle { fill: #050508; stroke: #ff4fd8; stroke-width: 2.5; pointer-events: all; cursor: move; }
.wf-handle.add { stroke: rgba(255, 255, 255, .55); stroke-width: 1.5; cursor: copy; }
.wf-handle:hover { fill: #ff4fd8; }
.wf-entry { fill: rgba(255, 209, 102, .08); stroke: rgba(255, 209, 102, .6); stroke-dasharray: 4 4; }
.wf-entry-text { fill: #ffd166; font-size: 12px; }
.wf-node {
    position: absolute;
    width: 160px;
    padding: .6rem .7rem;
    border-radius: 12px;
    background: #101018;
    border: 1px solid rgba(95, 233, 255, .35);
    color: #f4fbff;
    cursor: grab;
    user-select: none;
    z-index: 2;
    box-shadow: 0 8px 18px rgba(0,0,0,.25);
}
.wf-node:active { cursor: grabbing; }
.wf-node.focus { border-color: #ffd166; box-shadow: 0 0 0 1px rgba(255, 209, 102, .5), 0 0 22px rgba(255, 209, 102, .18); }
.wf-node.selected {
    border-color: #5fe9ff;
    outline: 2px solid rgba(95, 233, 255, .5);
    box-shadow: 0 0 16px rgba(95, 233, 255, .35);
}
.wf-node.off { opacity: .55; }
.wf-node strong { display: block; font-size: .9rem; }
.wf-node small { color: #8ea0ad; display: block; }
.wf-badge {
    display: inline-block;
    margin-top: .3rem;
    padding: .05rem .4rem;
    border-radius: 999px;
    font-size: .68rem;
    font-style: normal;
    color: var(--accent);
    border: 1px solid rgba(95, 233, 255, .3);
}
.wf-badge.custom { color: #ff9be9; border-color: rgba(255, 79, 216, .4); }
.wf-side h3 { margin: 0 0 .5rem; font-size: .95rem; }
.wf-side h3 + * { margin-bottom: 1rem; }
.wf-steps { margin: 0 0 1rem; padding-left: 1.2rem; font-size: .88rem; line-height: 1.45; }
.wf-steps li { margin-bottom: .35rem; }
.wf-edge-form { display: grid; gap: .55rem; font-size: .88rem; }
.wf-edge-form p { margin: 0; }
.wf-edge-form textarea { width: 100%; resize: vertical; font: inherit; line-height: 1.4; }
.wf-help { font-size: .85rem; color: var(--muted); }
.wf-help ul { padding-left: 1.1rem; }
.wf-dialog {
    background: var(--panel);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    max-width: 460px;
    width: 92vw;
}
.wf-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.wf-dialog h3 { margin: 0; }

/* ---------- Settings: tabbed API manager ---------- */
.st-layout { display: grid; grid-template-columns: 250px 1fr; gap: 1.25rem; align-items: start; }
.st-nav { display: grid; gap: .4rem; position: sticky; top: 1rem; }
.st-nav-label { margin: .8rem 0 .15rem; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.st-tab { display: grid; gap: .2rem; text-align: left; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; }
.st-tab:hover { border-color: rgba(95, 233, 255, .5); }
.st-tab.active { border-color: var(--accent); background: var(--panel-2); box-shadow: 0 0 0 1px rgba(95, 233, 255, .25), 0 0 18px rgba(95, 233, 255, .08); }
.st-tab-name { display: flex; align-items: center; gap: .45rem; font-weight: 650; }
.st-tab small { display: flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .78rem; }
.st-add { padding: .6rem .8rem; border: 1px dashed rgba(95, 233, 255, .5); border-radius: 12px; background: transparent; color: var(--accent); font: inherit; font-weight: 650; cursor: pointer; }
.st-add:hover { background: rgba(95, 233, 255, .08); }
.st-dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.st-dot.ok { background: var(--ok); }
.st-dot.bad { background: var(--bad); }
.st-dot.idle { background: var(--warn); }
.st-dot.off { background: transparent; border: 1px solid var(--muted); }
.st-role { text-transform: capitalize; }
.st-role-primary { color: var(--accent); background: rgba(95, 233, 255, .12); }
.st-role-fallback { color: var(--accent-2); background: rgba(255, 79, 216, .12); }
.st-panels { display: grid; gap: 1rem; min-width: 0; }
.st-panel { display: grid; gap: 1rem; min-width: 0; }
.st-panel[hidden] { display: none; }
.st-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.st-head h2 { margin: 0; }
.st-head p { margin: .2rem 0 0; }
.st-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; }
.st-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .8rem .9rem; display: grid; gap: .15rem; }
.st-stat span { color: var(--muted); font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; }
.st-stat strong { font-size: 1.5rem; line-height: 1.1; }
.st-stat small { color: var(--muted); font-size: .78rem; }
.st-table-wrap { overflow-x: auto; }
.st-remain { min-width: 150px; }
.st-big { font-size: 1.8rem; font-weight: 700; margin: 0 0 .5rem; }
.st-big small { font-size: .85rem; font-weight: 400; color: var(--muted); }
.st-sub { margin: 1rem 0 .4rem; font-size: .85rem; color: var(--muted); }
.st-meta div { grid-template-columns: 5.5rem 1fr; }
.st-meter { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; margin: .3rem 0; }
.st-meter i { display: block; height: 100%; border-radius: 99px; background: var(--ok); }
.st-meter.st-warn i { background: var(--warn); }
.st-meter.st-bad i { background: var(--bad); }
.st-chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.st-bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; min-width: 0; }
.st-bar i { display: block; width: 100%; background: linear-gradient(180deg, var(--accent), rgba(95, 233, 255, .25)); border-radius: 3px 3px 0 0; min-height: 0; }
.st-bar span { font-size: .62rem; color: var(--muted); }
.st-dialog { max-width: 520px; max-height: 90vh; overflow-y: auto; }
.fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; margin: 0; }
.fieldset legend { padding: 0 .4rem; color: var(--accent); font-weight: 650; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem; }
.check { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .9rem; }
.check input { width: auto; }
@media (max-width: 860px) {
    .st-layout { grid-template-columns: 1fr; }
    .st-nav { position: static; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
    .st-nav-label { grid-column: 1 / -1; }
}
/* ---- Content Studio + Scheduled: status tabs, pop-ups, post calendar ---- */
.pill.ok { color: var(--ok); background: rgba(61, 255, 176, .12); }
.pill.bad { color: var(--bad); background: rgba(255, 93, 122, .14); }
.btn.small { padding: .3rem .7rem; font-size: .85rem; }
form.inline { display: inline; }
.studio-bar, .cal-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; }
.tab { padding: .45rem .95rem; border-radius: 999px; text-decoration: none; color: inherit; background: rgba(255, 255, 255, .05); border: 1px solid transparent; }
.tab:hover { background: rgba(255, 255, 255, .1); }
.tab.active { background: rgba(95, 233, 255, .15); border-color: rgba(95, 233, 255, .5); font-weight: 600; }
.tab .count { display: inline-block; margin-left: .3rem; padding: 0 .45rem; border-radius: 999px; background: rgba(255, 255, 255, .12); font-size: .75rem; }
.content-card details.post-now { display: inline-block; vertical-align: top; margin-left: .4rem; }
.content-card details.post-now > summary { list-style: none; cursor: pointer; display: inline-block; }
.content-card details.post-now > summary::-webkit-details-marker { display: none; }
.content-card details.post-now[open] { display: block; margin: .6rem 0 0; }
.content-card details.hint > summary { cursor: pointer; }

dialog.modal { width: min(560px, calc(100vw - 2rem)); max-height: calc(100vh - 3rem); overflow: auto; padding: 1.2rem; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
dialog.modal::backdrop { background: rgba(0, 0, 0, .65); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; }
.pd-caption { white-space: pre-wrap; margin: 0; max-height: 14rem; overflow: auto; }
.pd-row { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem; }
.pd-row label { flex: 1 1 14rem; }

.cal-nav { display: flex; align-items: center; gap: .4rem; }
.cal-title { margin: 0 0 0 .6rem; font-size: 1.15rem; }
.cal-panel { padding: .75rem; }
.cal-empty { text-align: center; margin: .75rem 0 0; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-dow { padding: .4rem; text-align: center; font-size: .75rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal-cell { min-height: 7.5rem; padding: .3rem; display: flex; flex-direction: column; gap: .2rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.cal-cell.other { opacity: .45; }
.cal-cell.today { background: rgba(95, 233, 255, .07); }
.cal-date { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; }
.cal-date a { color: inherit; text-decoration: none; padding: 0 .3rem; border-radius: 6px; }
.cal-date a:hover { background: rgba(255, 255, 255, .1); }
.cal-cell.today .cal-date a { background: var(--accent); color: #041016; font-weight: 700; }
.cal-add { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; opacity: 0; }
.cal-cell:hover .cal-add, .cal-add:focus { opacity: 1; }
.cal-more { font-size: .75rem; color: var(--muted); text-decoration: none; padding: 0 .3rem; }
.chip { display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--accent); border-radius: 6px; padding: .2rem .4rem; font: inherit; font-size: .75rem; line-height: 1.3; color: var(--ink); background: rgba(95, 233, 255, .14); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip:hover { filter: brightness(1.25); }
.chip-time { font-weight: 700; }
.chip-channel { opacity: .7; font-size: .65rem; }
.chip-published { border-left-color: var(--ok); background: rgba(61, 255, 176, .14); }
.chip-failed { border-left-color: var(--bad); background: rgba(255, 93, 122, .16); }
.chip-publishing { border-left-color: var(--warn); background: rgba(255, 209, 102, .16); }

.cal-grid-head, .cal-grid { display: grid; }
.cal-grid-head { border-bottom: 1px solid var(--line); padding-right: 8px; }
.cal-colhead { padding: .5rem; text-align: center; color: inherit; text-decoration: none; font-size: .85rem; }
.cal-colhead.today strong { background: var(--accent); color: #041016; border-radius: 999px; padding: .05rem .5rem; }
.cal-scroll { max-height: 34rem; overflow-y: scroll; overflow-x: hidden; scrollbar-width: thin; }
.cal-hour { height: 44px; padding: .15rem .4rem 0 0; text-align: right; font-size: .7rem; color: var(--muted); border-right: 1px solid var(--line); }
.cal-slot { min-height: 44px; padding: 2px; border-bottom: 1px solid rgba(95, 233, 255, .1); border-right: 1px solid rgba(95, 233, 255, .1); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-slot[data-schedule-open] { cursor: copy; }
.cal-slot[data-schedule-open]:hover { background: rgba(95, 233, 255, .06); }
.cal-slot.today { background: rgba(95, 233, 255, .04); }
.cal-slot.now { box-shadow: inset 0 2px 0 var(--accent); }
@media (max-width: 760px) {
    .cal-cell { min-height: 5rem; }
    .chip-channel { display: none; }
}

/* Dashboard agent roster */
.dash-agents-panel { margin-top: .25rem; }
.dash-agents-grid {
    display: grid;
    gap: 1.25rem;
}
.dash-team { display: grid; gap: .55rem; }
.dash-team + .dash-team { padding-top: 1.1rem; border-top: 1px solid var(--line); }
.dash-team-title {
    margin: 0;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}
.dash-team-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
    gap: .85rem;
}
.dash-agent-card {
    display: grid;
    gap: .35rem;
    justify-items: center;
    text-align: center;
    padding: .85rem .65rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: border-color .2s ease, box-shadow .2s ease, transform .15s ease;
}
.dash-agent-card:hover {
    border-color: rgba(95, 233, 255, .55);
    box-shadow: 0 0 18px rgba(95, 233, 255, .12);
    transform: translateY(-2px);
}
.dash-agent-card-off { opacity: .55; }
.dash-agent-head { width: 100%; max-width: 96px; margin: 0 auto; pointer-events: none; }
.dash-agent-name { font-size: .82rem; line-height: 1.2; }
.dash-agent-role { font-size: .68rem; line-height: 1.25; }
.dash-health {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .35rem;
    align-items: center;
}
.dash-health-track {
    height: 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    overflow: hidden;
    border: 1px solid rgba(95, 233, 255, .15);
}
.dash-health-fill {
    height: 100%;
    border-radius: inherit;
    transition: width .35s ease;
}
.dash-health-fill.health-ok { background: linear-gradient(90deg, #1fa86a, #3dff9a); }
.dash-health-fill.health-mid { background: linear-gradient(90deg, #c98512, #ffd166); }
.dash-health-fill.health-low { background: linear-gradient(90deg, #b8354f, #ff5d7a); }
.dash-health-pct { font-size: .72rem; font-weight: 700; color: var(--accent); min-width: 2.2rem; text-align: right; }

body.dash-sheet-open { overflow: hidden; }
.dash-agent-sheet {
    position: fixed;
    inset: 0;
    z-index: 120;
    pointer-events: none;
}
.dash-agent-sheet[hidden] {
    display: none !important;
}
.dash-agent-sheet:not([hidden]) {
    display: block;
    pointer-events: auto;
}
.dash-agent-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 12, .62);
    backdrop-filter: blur(3px);
}
.dash-agent-sheet-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    animation: dash-desktop-in .32s ease-out;
    pointer-events: auto;
}
@keyframes dash-desktop-in {
    from { opacity: 0; transform: scale(.98); }
    to { opacity: 1; transform: scale(1); }
}
.pill.done { background: rgba(61, 255, 176, .14); color: var(--ok); }
.pill.bad { background: rgba(255, 93, 122, .16); color: var(--bad); }
.pill.active { background: rgba(95, 233, 255, .16); color: var(--accent); }
.pill.pending { background: rgba(154, 164, 184, .18); color: var(--muted); }

/* Agent workspace (Overview side panel) */
.dash-agent-sheet, .bot-page, .computer-view {
    --ad-panel: #101820;
    --ad-line: #1e303c;
    --ad-muted: #8da1b1;
    --ad-text: #eaf2f8;
    --ad-green: #2de0a0;
    --ad-amber: #ffc857;
    --ad-red: #ff7081;
    --ad-cyan: #43d8f2;
    --accent: var(--ad-cyan);
}
.dash-agent-sheet-inner.ad-app {
    display: grid;
    grid-template-columns: 212px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
    min-height: 0;
    background: radial-gradient(ellipse at 80% -20%, #12303b 0, transparent 35%), #080d12;
    color: var(--ad-text);
    font-size: 12px;
    line-height: 1.38;
}
.ad-side {
    background: #0a1118;
    border-right: 1px solid var(--ad-line);
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}
.ad-brand { display: flex; align-items: center; gap: 8px; padding: 2px 4px 8px 6px; font-weight: 700; font-size: 13px; }
.ad-brand i {
    width: 26px; height: 26px; flex: none; border-radius: 8px; display: grid; place-items: center;
    background: linear-gradient(140deg, #1a5263, #18334a); color: var(--ad-cyan); font-style: normal; font-size: 12px;
}
.ad-close {
    margin-left: auto; width: 28px; height: 28px; border-radius: 8px; cursor: pointer;
    border: 1px solid #294452; background: #13232d; color: var(--ad-muted); font-size: 16px; line-height: 1;
}
.ad-close:hover, .ad-close:focus-visible { color: #fff; border-color: var(--accent); }
.ad-side-label { color: #627888; text-transform: uppercase; letter-spacing: .12em; font-size: 9px; padding: 0 8px; }
.ad-agent-list { display: grid; gap: 3px; overflow-y: auto; overflow-x: hidden; min-height: 0; padding-right: 2px; }
.ad-agent-list, .ad-main, .ad-rows { scrollbar-width: thin; scrollbar-color: #234656 transparent; }
.ad-agent {
    border: 1px solid transparent; background: transparent; text-align: left; border-radius: 8px;
    padding: 6px 8px; display: flex; align-items: center; gap: 8px; cursor: pointer; color: #b7c8d3; font: inherit;
    transition: background .15s, border-color .15s;
}
.ad-agent:hover, .ad-agent:focus-visible, .ad-agent.active { background: #14232d; border-color: #234656; color: #fff; }
.ad-agent:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ad-team-label { color: #627888; text-transform: uppercase; letter-spacing: .1em; font-size: 8.5px; padding: 6px 8px 2px; }
.ad-team-label:first-child { padding-top: 0; }
.ad-agent small { display: block; color: #758c9c; font-size: 9px; line-height: 1.25; }
.ad-agent-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-avatar {
    width: 28px; height: 28px; flex: none; display: grid; place-items: center; overflow: hidden; border-radius: 8px;
    background: color-mix(in srgb, var(--accent), transparent 86%);
    transition: width .2s ease, height .2s ease;
}
.ad-agent.active .ad-avatar {
    width: 44px; height: 44px; border-radius: 11px;
    border: 1px solid color-mix(in srgb, var(--accent), transparent 60%);
    box-shadow: 0 0 14px color-mix(in srgb, var(--accent), transparent 78%);
}
.ad-agent.active .ad-agent-text { font-weight: 700; font-size: 12px; }
.ad-avatar, .ad-big-avatar, .ad-taskicon { margin: 0; max-width: none; }
.ad-avatar .robot-head-portrait, .ad-big-avatar .robot-head-portrait, .ad-taskicon .robot-head-portrait { width: 100%; }
.ad-dot { margin-left: auto; width: 7px; height: 7px; flex: none; border-radius: 50%; background: #4a5d6a; }
.ad-dot.busy { background: var(--ad-green); box-shadow: 0 0 8px var(--ad-green); }
.ad-dot.off { background: var(--ad-red); }
.ad-side-foot { margin-top: auto; border: 1px solid var(--ad-line); border-radius: 10px; padding: 9px 10px; color: var(--ad-muted); font-size: 10px; line-height: 1.35; }
.ad-foot-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ad-green); margin-right: 6px; }
.ad-foot-sub { margin-left: 17px; }

.ad-main { min-width: 0; min-height: 0; overflow-y: auto; padding: 16px 20px 24px; }
.ad-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.ad-agent-title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.ad-big-avatar {
    width: 58px; height: 58px; flex: none; border-radius: 14px; display: grid; place-items: center; overflow: hidden;
    background: color-mix(in srgb, var(--accent), transparent 87%);
    border: 1px solid color-mix(in srgb, var(--accent), transparent 68%);
}
.ad-heading h2 { font-size: 16px; margin: 0 0 2px; font-weight: 700; letter-spacing: -.02em; }
.ad-heading h2 span { color: #8396a3; font-weight: 500; font-size: 0.92em; }
.ad-subtitle { color: var(--ad-muted); font-size: 11px; line-height: 1.35; max-width: 52ch; }
.ad-connector {
    display: inline-flex; align-items: center; gap: 5px; margin-top: 5px; border: 1px solid #284552; background: #10212a;
    color: #91d8e5; border-radius: 99px; padding: 3px 7px; font-size: 9px; font-weight: 700;
}
.ad-connector::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ad-green); }
.ad-connector.off { color: var(--ad-amber); border-color: #745b31; background: #241d10; }
.ad-connector.off::before { background: var(--ad-amber); }
.ad-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ad-btn {
    display: inline-flex; align-items: center; background: #13232d; border: 1px solid #294452; border-radius: 8px;
    padding: 6px 10px; cursor: pointer; color: var(--ad-text); font: inherit; font-size: 11px; text-decoration: none;
}
.ad-btn:hover, .ad-btn:focus-visible { border-color: var(--accent); }
.ad-btn.primary { background: var(--accent); border-color: var(--accent); color: #061016; font-weight: 750; }
.ad-btn:disabled { opacity: .5; cursor: not-allowed; }
.ad-status {
    border: 1px solid #1f5a48; color: var(--ad-green); background: #0d2924; border-radius: 99px;
    padding: 4px 8px; font-size: 9px; font-weight: 700; text-transform: capitalize;
}
.ad-status.off { border-color: #6b2b37; color: var(--ad-red); background: #301b22; }
.ad-alert { margin: 0 0 10px; padding: 8px 10px; border-radius: 9px; border: 1px solid #6b2b37; background: #301b22; color: #ffc2cb; font-size: 11px; line-height: 1.35; }
.ad-loading { color: var(--ad-muted); padding: 30px 0; }

.ad-metrics { display: grid; grid-template-columns: repeat(4, minmax(96px, 1fr)); gap: 8px; margin-bottom: 11px; }
.ad-metric, .ad-box { background: linear-gradient(145deg, #101a23, #0c131a); border: 1px solid var(--ad-line); border-radius: 10px; }
.ad-metric { padding: 10px 11px; }
.ad-label { font-size: 10px; color: var(--ad-muted); line-height: 1.3; }
.ad-metric strong { display: block; font-size: 18px; margin-top: 3px; overflow-wrap: anywhere; font-weight: 750; letter-spacing: -.02em; }
.ad-metric small { display: block; font-size: 9px; color: #69dbaa; margin-top: 3px; line-height: 1.25; }
.ad-preview-pill {
    font-size: 8px; color: #8b9da9; border: 1px solid #283944; background: #101920;
    border-radius: 99px; padding: 3px 6px; margin-left: 5px; vertical-align: middle; font-weight: 600; letter-spacing: .03em;
}
.ad-workflow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 9px; }
.ad-stage { border: 1px solid #233640; border-radius: 8px; padding: 7px; background: #0a1319; }
.ad-stage b { display: block; font-size: 10px; margin-bottom: 3px; line-height: 1.25; }
.ad-stage small { font-size: 9px; color: var(--ad-muted); line-height: 1.25; }
.ad-stage.active { border-color: var(--accent); box-shadow: 0 0 14px color-mix(in srgb, var(--accent), transparent 90%); }
.ad-decision { font-size: 10px; color: #bdccd5; background: #0a1319; border-left: 2px solid var(--accent); padding: 6px 8px; margin: 6px 0; line-height: 1.35; }
.ad-mini { padding: 8px; border: 1px solid #1c2e39; border-radius: 8px; background: #0b1319; }
.ad-mini h4 { font-size: 10px; margin: 0 0 5px; color: #c5d1d9; }
.ad-mini p { font-size: 10px; line-height: 1.35; }
.ad-section-title { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 11px; }
.ad-folder-layout { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 8px; }
.ad-folder-nav { display: grid; align-content: start; gap: 5px; }
.ad-folder-item { display: flex; justify-content: space-between; align-items: center; text-align: left; background: #0b141b; border: 1px solid #1e303a; border-radius: 8px; padding: 8px; font-size: 11px; color: #bfcbd3; cursor: pointer; font: inherit; width: 100%; }
.ad-folder-item.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent), #0b141b 92%); color: #fff; }
.ad-folder-item small { color: var(--ad-muted); }
.ad-drive-crumb { font-size: 11px; color: var(--ad-muted); padding: 6px 0; }
.ad-file-list { display: grid; gap: 6px; }
.ad-file { display: flex; align-items: center; gap: 8px; background: #0a1319; border: 1px solid #1c2d37; border-radius: 8px; padding: 8px; }
.ad-file-ico { width: 29px; height: 29px; border-radius: 7px; display: grid; place-items: center; background: #15242d; color: var(--accent); font-size: 13px; flex: none; }
.ad-file-name { font-size: 11px; font-weight: 650; }
.ad-file-meta { font-size: 10px; color: var(--ad-muted); margin-top: 2px; }
.ad-campaign-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ad-campaign { background: #0a131a; border: 1px solid #20313c; border-radius: 9px; padding: 8px; }
.ad-campaign h4 { font-size: 11px; margin: 6px 0 2px; line-height: 1.25; }
.ad-thumb { height: 72px; border: 1px solid #2b414b; border-radius: 8px; overflow: hidden; position: relative; display: flex; align-items: center; justify-content: center; }
.ad-thumb:before { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(4, 9, 13, .75), transparent 70%); }
.ad-thumb-emoji { font-size: 28px; z-index: 1; }
.ad-thumb-label { position: absolute; z-index: 2; left: 9px; bottom: 7px; font-size: 9px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.ad-campaign-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; margin-top: 8px; }
.ad-campaign-stats div { background: #101b23; border-radius: 6px; padding: 5px; }
.ad-campaign-stats b { display: block; font-size: 11px; }
.ad-campaign-stats small { font-size: 9px; color: var(--ad-muted); }
.ad-spark { width: 100%; height: 22px; display: block; margin-top: 4px; }
.ad-tablewrap { overflow: auto; border: 1px solid #1c2d37; border-radius: 9px; }
.ad-product-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.ad-product-table th { text-align: left; padding: 8px; font-size: 10px; color: #8095a3; text-transform: uppercase; letter-spacing: .08em; background: #0a1319; border-bottom: 1px solid #243540; }
.ad-product-table td { padding: 6px 7px; border-bottom: 1px solid #1a2932; font-size: 11px; vertical-align: middle; }
.ad-product-table tbody tr { cursor: pointer; transition: background .15s; }
.ad-product-table tbody tr:hover { background: #13212a; }
.ad-product-image { width: 43px; height: 35px; border-radius: 7px; background: linear-gradient(145deg, #203743, #8d6b50); display: grid; place-items: center; font-size: 18px; }
.ad-product-name { font-size: 11px; font-weight: 700; }
.ad-product-sku { font-size: 10px; color: var(--ad-muted); margin-top: 2px; }
.ad-stockchip { display: inline-block; border-radius: 99px; padding: 3px 7px; font-size: 10px; background: #102720; color: #70e0ae; }
.ad-stockchip.low { background: #302713; color: var(--ad-amber); }
.ad-stockchip.zero { background: #301b22; color: var(--ad-red); }
.ad-product-modal { position: fixed; inset: 0; z-index: 40; background: rgba(2, 7, 11, .85); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; }
.ad-product-modal[hidden] { display: none; }
.ad-detail-card { width: min(820px, 100%); background: #0e171f; border: 1px solid #30434f; border-radius: 15px; padding: 16px; box-shadow: 0 18px 70px #000a; }
.ad-detail-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.ad-detail-layout { display: grid; grid-template-columns: 220px 1fr; gap: 15px; }
.ad-detail-picture { height: 165px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(145deg, #1a2d37, #806348); font-size: 64px; }
.ad-detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 10px 0; }
.ad-detail-kv { background: #0a1218; border: 1px solid #20313c; border-radius: 8px; padding: 8px; }
.ad-detail-kv small { display: block; color: var(--ad-muted); font-size: 10px; }
.ad-branch { display: flex; justify-content: space-between; border-bottom: 1px solid #1f303a; padding: 7px 0; font-size: 12px; }
.ad-modal-close { border: 1px solid #354957; background: #14222b; border-radius: 7px; padding: 5px 8px; cursor: pointer; color: inherit; font: inherit; }
.ad-chartbox { padding: 10px; border-radius: 9px; background: #0a1319; border: 1px solid #20313c; margin-bottom: 12px; }
.ad-chartbox svg { width: 100%; height: 95px; display: block; }
.ad-calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-bottom: 12px; }
.ad-day { min-height: 42px; background: #0a1319; border: 1px solid #1b2a34; border-radius: 6px; padding: 4px; font-size: 9px; color: var(--ad-muted); line-height: 1.25; }
.ad-day b { display: block; color: #dce8ef; }
.ad-day.event { border-color: #3a5968; background: #10212a; }
.ad-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(220px, .85fr); gap: 10px; align-items: start; }
.ad-box { padding: 12px; min-width: 0; }
.ad-boxhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.ad-boxhead h3 { font-size: 12px; margin: 0; font-weight: 700; }
.ad-muted { color: var(--ad-muted); font-size: 10px; line-height: 1.35; }
a.ad-muted, .ad-rowend a { color: var(--ad-muted); text-decoration: none; }
a.ad-muted:hover, .ad-rowend a:hover { color: var(--accent); }
.ad-search {
    display: flex; align-items: center; gap: 7px; background: #091117; border: 1px solid #253844; border-radius: 8px;
    padding: 5px 8px; width: min(240px, 52%); color: var(--ad-muted); font-size: 10px;
}
.ad-search:focus-within { border-color: var(--accent); }
.ad-search input { border: 0; background: none; outline: none; width: 100%; font-size: 10px; color: var(--ad-text); padding: 0; }
.ad-filter { display: flex; gap: 5px; flex-wrap: wrap; margin: 6px 0 9px; }
.ad-chip {
    background: #121e27; color: #9cb1bf; border: 1px solid #243742; border-radius: 99px; padding: 3px 8px;
    font-size: 9px; cursor: pointer; font: inherit;
}
.ad-chip.sel { color: var(--accent); border-color: color-mix(in srgb, var(--accent), transparent 50%); background: #10252e; }
.ad-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ad-rows { max-height: min(56vh, 560px); overflow-y: auto; }
.ad-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 8px 0; border-top: 1px solid #1c2a34; align-items: center; }
.ad-row:first-child { border-top: 0; }
.ad-row[hidden] { display: none; }
.ad-rowtitle { font-weight: 650; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-rowtitle a { color: inherit; text-decoration: none; }
.ad-rowtitle a:hover { color: var(--accent); }
.ad-folder { color: var(--accent); }
.ad-rowmeta { font-size: 10px; color: var(--ad-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.ad-brief { white-space: normal; }
.ad-rowend { text-align: right; }
.ad-rowend .ad-muted { margin-top: 5px; }
.ad-tag { display: inline-block; font-size: 8px; font-weight: 700; border-radius: 99px; padding: 3px 6px; color: var(--ad-green); background: #0d2924; text-transform: capitalize; white-space: nowrap; letter-spacing: .02em; }
.ad-tag.warn { color: var(--ad-amber); background: #302713; }
.ad-tag.blue { color: var(--ad-cyan); background: #102932; }
.ad-tag.red { color: var(--ad-red); background: #301b22; }
.ad-progress { height: 5px; background: #1d2d37; border-radius: 9px; margin-top: 10px; overflow: hidden; }
.ad-progress span { height: 100%; display: block; border-radius: 9px; background: linear-gradient(90deg, var(--accent), #45e4b4); }
.ad-empty { display: none; color: var(--ad-muted); padding: 22px; text-align: center; margin: 0; }
.ad-empty.show { display: block; }
.ad-footer-note { margin-top: 10px; color: #6e8290; font-size: 9px; line-height: 1.35; }
.ad-sidebox { display: grid; align-content: start; gap: 10px; min-width: 0; }
.ad-taskcard { display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px solid #20313b; border-radius: 8px; margin-top: 5px; }
.ad-taskcard-text { min-width: 0; }
.ad-taskicon { width: 26px; height: 26px; flex: none; display: grid; place-items: center; overflow: hidden; background: #14232c; border-radius: 7px; }
.ad-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.ad-quick { background: #0a141b; border: 1px solid #1c303b; border-radius: 8px; padding: 9px; }
.ad-quick b { display: block; font-size: 13px; font-weight: 700; }
.ad-quick small { color: var(--ad-muted); font-size: 9px; }
.ad-activity { display: flex; gap: 7px; margin: 6px 0; color: #b8c8d2; font-size: 10px; line-height: 1.35; }
.ad-activity i { width: 5px; height: 5px; flex: none; margin-top: 4px; border-radius: 50%; background: var(--accent); }
.ad-tool-run[data-status="completed"] i { background: #3dd68c; }
.ad-tool-run[data-status="failed"] i { background: #ff6b6b; }
.ad-tool-run[data-status="api_failed"] i { background: #ff9f43; }
.ad-tool-run[data-status="skipped"] i { background: #7aa2ff; }
.ad-tool-session { margin: 0 0 8px; padding: 6px 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.04); font-size: 10px; }
.ad-links { display: grid; gap: 5px; margin-top: 9px; padding-top: 8px; border-top: 1px solid #1c2a34; }
.ad-link { color: var(--accent); font-size: 10px; font-weight: 650; text-decoration: none; }
.ad-link:hover { text-decoration: underline; }
.ad-newtask { margin-bottom: 11px; display: grid; gap: 8px; }
.ad-newtask[hidden] { display: none; }
.ad-field { display: grid; gap: 4px; font-size: 10px; color: var(--ad-muted); }
.ad-field input, .ad-field textarea {
    background: #091117; border: 1px solid #253844; border-radius: 8px; padding: 7px 9px; color: var(--ad-text); font: inherit; font-size: 11px;
}
.ad-field input:focus, .ad-field textarea:focus { outline: none; border-color: var(--accent); }
.ad-newtask-actions { display: flex; justify-content: flex-end; gap: 8px; }

.ad-alert-info { border-color: #284552; background: #10212a; color: #91d8e5; }
.ad-inbox-toolbar {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; flex-wrap: wrap;
    margin-bottom: 10px; padding: 9px 11px; border: 1px solid var(--ad-line); border-radius: 10px;
    background: linear-gradient(145deg, #101a23, #0c131a);
}
.ad-inbox-title { margin: 0 0 3px; font-size: 12px; }
.ad-inbox-toolbar-pills { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ad-inbox-shell {
    display: grid; grid-template-columns: minmax(220px, .95fr) minmax(0, 1.55fr); gap: 10px; align-items: stretch;
}
.ad-inbox-list .ad-boxhead { flex-wrap: wrap; }
.ad-inbox-filters { margin-top: 0; }
.ad-inbox-threads {
    display: grid; gap: 6px; max-height: min(58vh, 520px); overflow-y: auto; margin-top: 4px;
}
.ad-inbox-thread {
    display: grid; gap: 3px; width: 100%; text-align: left; padding: 8px 9px; border-radius: 8px;
    border: 1px solid #20313b; background: #0a141b; color: inherit; cursor: pointer; font: inherit; font-size: 11px;
}
.ad-inbox-thread:hover, .ad-inbox-thread:focus-visible { border-color: color-mix(in srgb, var(--accent), transparent 55%); outline: none; }
.ad-inbox-thread.active { border-color: var(--accent); background: #10252e; }
.ad-inbox-thread[hidden] { display: none; }
.ad-inbox-thread-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ad-inbox-thread-top time { font-size: 9px; color: var(--ad-muted); flex: none; }
.ad-inbox-preview { font-size: 10px; color: var(--ad-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.ad-inbox-thread-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ad-inbox-detail { min-width: 0; }
.ad-inbox-detail-grid {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 230px); gap: 0;
    border: 1px solid var(--ad-line); border-radius: 10px; overflow: hidden;
    background: linear-gradient(145deg, #101a23, #0c131a); min-height: min(52vh, 480px);
}
.ad-inbox-chatcol { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; border-right: 1px solid #1c2a34; min-width: 0; }
.ad-inbox-chat-head {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 12px;
    border-bottom: 1px solid #1c2a34; font-size: 12px;
}
.ad-inbox-chatlog {
    padding: 11px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 160px;
}
.ad-inbox-bubble { max-width: 88%; padding: 8px 10px; border-radius: 10px; font-size: 11px; line-height: 1.38; }
.ad-inbox-bubble p { margin: 0; }
.ad-inbox-bubble time { display: block; margin-top: 4px; font-size: 9px; color: var(--ad-muted); }
.ad-inbox-bubble.them { align-self: flex-start; background: #15232c; border: 1px solid #243742; }
.ad-inbox-bubble.us { align-self: flex-end; background: color-mix(in srgb, var(--accent), #0c131a 72%); border: 1px solid color-mix(in srgb, var(--accent), transparent 40%); }
.ad-inbox-bubble.sys { align-self: center; max-width: 100%; background: transparent; border: 0; color: var(--ad-muted); font-size: 11px; text-align: center; padding: 4px 8px; }
.ad-inbox-compose {
    padding: 9px 12px; border-top: 1px solid #1c2a34; font-size: 10px;
    background: #091117;
}
.ad-inbox-meta { padding: 10px 11px 12px; display: grid; align-content: start; gap: 10px; font-size: 10px; }
.ad-inbox-sideblock h4 { margin: 0 0 7px; font-size: 10px; font-weight: 700; color: var(--ad-text); }
.ad-inbox-tl { display: flex; gap: 7px; margin-bottom: 6px; color: var(--ad-muted); font-size: 9px; }
.ad-inbox-tl i { width: 5px; height: 5px; flex: none; margin-top: 3px; border-radius: 50%; background: var(--accent); }
.ad-inbox-next { margin: 0; font-size: 10px; line-height: 1.35; }
.ad-inbox-takeover { margin-top: auto; padding-top: 8px; }
.ad-inbox-takeover .ad-btn { width: 100%; justify-content: center; }

@media (max-width: 900px) {
    .dash-agent-sheet-inner.ad-app { grid-template-columns: 190px minmax(0, 1fr); }
    .ad-main { padding: 20px; }
    .ad-metrics { grid-template-columns: repeat(2, 1fr); }
    .ad-layout { grid-template-columns: 1fr; }
    .ad-campaign-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ad-folder-layout { grid-template-columns: 1fr; }
    .ad-workflow { grid-template-columns: repeat(2, 1fr); }
    .ad-inbox-shell { grid-template-columns: 1fr; }
    .ad-inbox-detail-grid { grid-template-columns: 1fr; }
    .ad-inbox-chatcol { border-right: 0; border-bottom: 1px solid #1c2a34; }
}
.platform-agents-layout { align-items: start; }
.platform-agent-list a { display: grid; gap: 2px; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: inherit; }
.platform-agent-list a.active { background: #0f1a22; border: 1px solid #253844; }
.pa-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.platform-agent-chat .chat-log {
    min-height: 220px; max-height: 420px; overflow-y: auto; margin: 12px 0;
    padding: 10px; background: #091117; border: 1px solid #1c2a34; border-radius: 10px;
}
.platform-agent-chat .chat-line { margin-bottom: 10px; font-size: 14px; }
.platform-agent-chat .chat-who { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #7a8f9c; margin-bottom: 3px; }
.platform-agent-chat .chat-user .chat-body { color: #c8e6ff; }
.platform-agent-chat .chat-agent .chat-body { color: #e8f0f4; }
.platform-agent-chat .chat-line.is-error .chat-body { color: #ff8a80; }

@media (max-width: 650px) {
    .dash-agent-sheet-inner.ad-app { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
    .ad-side { border-right: 0; border-bottom: 1px solid var(--ad-line); padding: 10px; gap: 8px; }
    .ad-brand { padding-bottom: 2px; }
    .ad-side-label, .ad-side-foot, .ad-team-label { display: none; }
    .ad-agent-list { display: flex; overflow-x: auto; overflow-y: hidden; }
    .ad-agent { min-width: 140px; }
    .ad-main { padding: 17px 13px; }
    .ad-big-avatar { width: 52px; height: 52px; }
    .ad-btn-log { display: none; }
    .ad-metrics { gap: 6px; }
    .ad-metric { padding: 9px; }
    .ad-metric strong { font-size: 16px; }
    .ad-search { width: 100%; max-width: 180px; }
}
