/* ============================================================
   HQ MISSION CONTROL — Bloomberg Terminal Theme
   ADHD-optimized: instant hierarchy, color-coded, chunked
   ============================================================ */

:root {
    --bg-void: #0a0e14;
    --bg-primary: #0d1117;
    --bg-panel: #131920;
    --bg-card: #171d26;
    --bg-hover: #1c2433;
    --bg-active: #1f2937;
    --border: #1e2a3a;
    --border-focus: #2d4a6f;
    --text: #c9d1d9;
    --text-dim: #7a8595;
    --text-muted: #4a5567;
    --amber: #f0b030;
    --amber-dim: #b8860b;
    --amber-glow: rgba(240, 176, 48, 0.12);
    --green: #00e676;
    --green-dim: #1b5e20;
    --green-bg: rgba(0, 230, 118, 0.08);
    --red: #ff4757;
    --red-dim: #b71c1c;
    --red-bg: rgba(255, 71, 87, 0.08);
    --blue: #4fc3f7;
    --blue-dim: #0277bd;
    --purple: #b388ff;
    --cyan: #00e5ff;
    --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    --sans: 'IBM Plex Sans', -apple-system, sans-serif;
    --radius: 3px;
    --transition: 150ms ease;
}

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

body {
    font-family: var(--mono);
    background: var(--bg-void);
    color: var(--text);
    line-height: 1.4;
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 12px;
    -webkit-font-smoothing: antialiased;
}

/* Scanline texture overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
}

a { color: var(--amber); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--amber-dim); }

::selection { background: var(--amber); color: var(--bg-void); }

/* ===== LAYOUT ===== */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== HEADER ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 40px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--amber-dim);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.logo {
    font-size: 15px;
    font-weight: 800;
    color: var(--amber);
    letter-spacing: 2px;
}

.logo-sub {
    font-size: 9px;
    font-weight: 500;
    color: var(--text-dim);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    overflow: hidden;
}

.header-ticker {
    display: flex;
    gap: 20px;
    font-size: 10px;
    color: var(--text-dim);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.header-ticker .tk-item { display: inline-flex; gap: 4px; align-items: center; }
.header-ticker .tk-sym { color: var(--text); font-weight: 600; }
.header-ticker .tk-up { color: var(--green); }
.header-ticker .tk-dn { color: var(--red); }

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hdr-clock {
    font-size: 10px;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

.hdr-user {
    font-size: 10px;
    color: var(--amber);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hdr-logout {
    font-size: 9px;
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-dim);
    letter-spacing: 1px;
    transition: all var(--transition);
}

.hdr-logout:hover {
    border-color: var(--red);
    color: var(--red);
}

/* ===== TAB NAV ===== */
.tab-nav {
    display: flex;
    gap: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 40px;
    z-index: 99;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tab-nav::-webkit-scrollbar { display: none; }

.tab-link {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    font-family: var(--mono);
}

.tab-link:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.tab-link.active {
    color: var(--amber);
    border-bottom-color: var(--amber);
    background: var(--amber-glow);
}

.tab-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 2px;
    line-height: 1;
}

.tab-link.active .tab-key {
    color: var(--amber-dim);
    border-color: var(--amber-dim);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    padding: 12px;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

/* ===== KEYBOARD HINT ===== */
.kbd-hint {
    position: fixed;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 9px;
    color: var(--text-muted);
    z-index: 90;
    opacity: 0.6;
    transition: opacity var(--transition);
}

.kbd-hint:hover { opacity: 1; }

.kbd {
    display: inline-block;
    padding: 1px 4px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 2px;
    font-family: var(--mono);
    font-size: 9px;
    color: var(--amber);
    font-weight: 600;
}

.kbd-sep {
    width: 1px;
    height: 10px;
    background: var(--border);
    margin: 0 2px;
}

/* ===== PANEL (reusable section) ===== */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 8px;
}

.panel-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    min-height: 30px;
}

.panel-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--amber);
}

.panel-badge {
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 2px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.panel-badge.ok { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-dim); }
.panel-badge.warn { background: var(--amber-glow); color: var(--amber); border: 1px solid var(--amber-dim); }
.panel-badge.crit { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-dim); }

.panel-body {
    padding: 8px 10px;
}

/* ===== METRIC STRIP ===== */
.metric-strip {
    display: flex;
    gap: 1px;
    background: var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 8px;
}

.metric-cell {
    flex: 1;
    background: var(--bg-panel);
    padding: 8px 10px;
    text-align: center;
    min-width: 0;
    transition: background var(--transition);
}

.metric-cell:hover { background: var(--bg-card); }
.metric-cell.highlight { background: var(--amber-glow); }

.metric-label {
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.metric-val {
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    color: var(--text);
}

.metric-val.lg { font-size: 24px; }
.metric-val.sm { font-size: 14px; }
.metric-sub {
    font-size: 9px;
    color: var(--text-dim);
    margin-top: 1px;
    font-variant-numeric: tabular-nums;
}

/* ===== STATUS LED ===== */
.led {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.led.on { background: var(--green); box-shadow: 0 0 4px var(--green); }
.led.warn { background: var(--amber); box-shadow: 0 0 4px var(--amber); }
.led.off { background: var(--text-muted); }
.led.crit { background: var(--red); box-shadow: 0 0 4px var(--red); animation: led-pulse 1.5s ease infinite; }

@keyframes led-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ===== DATA TABLE ===== */
.dtable {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.dtable th {
    padding: 4px 8px;
    text-align: left;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 2;
    white-space: nowrap;
}

.dtable th.r, .dtable td.r { text-align: right; }
.dtable th.c, .dtable td.c { text-align: center; }

.dtable td {
    padding: 5px 8px;
    border-bottom: 1px solid rgba(30, 42, 58, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dtable tr { transition: background var(--transition); }
.dtable tbody tr:hover { background: var(--bg-hover); }

.dtable tr.selected { background: var(--amber-glow); outline: 1px solid var(--amber-dim); }

.dtable tr.expandable { cursor: pointer; }
.dtable tr.expandable td:first-child::before {
    content: '\25B6';
    display: inline-block;
    margin-right: 6px;
    font-size: 8px;
    color: var(--text-muted);
    transition: transform var(--transition);
}

.dtable tr.expandable.open td:first-child::before {
    transform: rotate(90deg);
    color: var(--amber);
}

.dtable tr.detail-row { display: none; }
.dtable tr.detail-row.open { display: table-row; }
.dtable tr.detail-row td {
    padding: 10px 8px 10px 28px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

/* ===== PROGRESS BAR ===== */
.bar-track {
    height: 4px;
    background: var(--bg-active);
    border-radius: 2px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s ease;
}

.bar-fill.green { background: var(--green); }
.bar-fill.amber { background: var(--amber); }
.bar-fill.red { background: var(--red); }
.bar-fill.blue { background: var(--blue); }

/* ===== SPARKLINE ===== */
.sparkline {
    display: inline-block;
    vertical-align: middle;
}

.sparkline svg {
    display: block;
}

/* ===== COLORS (utility) ===== */
.c-green { color: var(--green) !important; }
.c-red { color: var(--red) !important; }
.c-amber { color: var(--amber) !important; }
.c-blue { color: var(--blue) !important; }
.c-purple { color: var(--purple) !important; }
.c-cyan { color: var(--cyan) !important; }
.c-dim { color: var(--text-dim) !important; }
.c-muted { color: var(--text-muted) !important; }

.bg-green { background: var(--green-bg) !important; }
.bg-red { background: var(--red-bg) !important; }
.bg-amber { background: var(--amber-glow) !important; }

/* ===== ATTENTION PULSE (ADHD) ===== */
.attn-block {
    border-left: 3px solid var(--red);
    background: var(--red-bg);
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 0 var(--radius) var(--radius) 0;
    animation: attn-fade 3s ease infinite;
}

@keyframes attn-fade {
    0%, 100% { border-left-color: var(--red); }
    50% { border-left-color: var(--amber); }
}

.attn-block .attn-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--red);
    margin-bottom: 4px;
}

.attn-block .attn-msg {
    font-size: 11px;
    color: var(--text);
}

/* ===== REGIME BADGE ===== */
.regime-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.regime-badge.bull { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-dim); }
.regime-badge.bear { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-dim); }
.regime-badge.chop { background: var(--amber-glow); color: var(--amber); border: 1px solid var(--amber-dim); }
.regime-badge.none { background: var(--bg-active); color: var(--text-muted); border: 1px solid var(--border); }

/* ===== GRID LAYOUTS ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; }
.grid-23 { display: grid; grid-template-columns: 2fr 3fr; gap: 8px; }
.grid-32 { display: grid; grid-template-columns: 3fr 2fr; gap: 8px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    font-size: 10px;
    font-weight: 600;
    font-family: var(--mono);
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all var(--transition);
}

.btn:hover { border-color: var(--amber); color: var(--amber); }
.btn-primary { background: var(--amber); color: var(--bg-void); border-color: var(--amber); }
.btn-primary:hover { background: var(--amber-dim); border-color: var(--amber-dim); color: var(--bg-void); }
.btn-danger { background: var(--red-bg); color: var(--red); border-color: var(--red-dim); }
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn-sm { padding: 2px 8px; font-size: 9px; }
.btn-icon { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 14px; padding: 2px; }
.btn-icon:hover { color: var(--text); }

/* ===== FORMS ===== */
.form-control {
    width: 100%;
    padding: 8px 10px;
    font-size: 12px;
    font-family: var(--mono);
    background: var(--bg-void);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color var(--transition);
}

.form-control:focus { border-color: var(--amber); }

.form-group { margin-bottom: 12px; }
.form-group label {
    display: block;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 4px;
}

/* ===== LOGIN ===== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-void);
}

.login-box {
    width: 340px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 28px;
}

.login-box h1 {
    font-size: 16px;
    font-weight: 800;
    color: var(--amber);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.login-box .subtitle {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 24px;
}

.login-box .btn-primary {
    width: 100%;
    padding: 10px;
    font-size: 12px;
    letter-spacing: 2px;
    margin-top: 8px;
}

.error {
    padding: 6px 10px;
    background: var(--red-bg);
    border: 1px solid var(--red-dim);
    border-radius: var(--radius);
    color: var(--red);
    font-size: 11px;
    margin-bottom: 12px;
}

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show { display: flex; }

.modal {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 400px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--amber);
}

.modal-body { padding: 14px; }

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    top: 48px;
    right: 12px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ===== UTILS ===== */
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-sm { font-size: 10px; }
.text-xs { font-size: 9px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mono { font-family: var(--mono); }
.tabnum { font-variant-numeric: tabular-nums; }

/* ===== LAB SUB-NAV ===== */
.lab-subnav {
    display: flex;
    gap: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 12px;
}

.lab-subnav a {
    padding: 6px 14px;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: var(--mono);
    transition: all var(--transition);
}

.lab-subnav a:hover { color: var(--text); background: var(--bg-hover); }
.lab-subnav a.active { color: var(--amber); background: var(--amber-glow); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .grid-4 { grid-template-columns: 1fr 1fr; }
    .grid-23, .grid-32 { grid-template-columns: 1fr; }
    .header-center { display: none; }
}

@media (max-width: 768px) {
    .main-content { padding: 8px; }
    .metric-strip { flex-wrap: wrap; }
    .metric-cell { min-width: calc(50% - 1px); }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .kbd-hint { display: none; }

    .header { padding: 0 10px; }
    .logo-sub { display: none; }

    .tab-link { padding: 6px 10px; font-size: 9px; }
    .tab-key { display: none; }
}

@media (max-width: 480px) {
    .metric-cell { min-width: 100%; }
    .metric-val { font-size: 14px; }
    .metric-val.lg { font-size: 18px; }
}

/* ===== TERMINAL PAGE ===== */
.terminal-layout {
    display: flex;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
}

.agent-sidebar {
    width: 160px;
    min-width: 140px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.agent-sidebar .sidebar-header {
    padding: 10px 12px 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--amber);
    font-weight: 600;
}

.agent-sidebar .sidebar-footer {
    margin-top: auto;
    padding: 8px;
    border-top: 1px solid var(--border);
}

.agent-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.agent-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-dim);
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    border-left: 2px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}
.agent-item:hover {
    background: var(--bg-hover);
}
.agent-item.active {
    background: var(--bg-active);
    color: var(--text);
    border-left-color: var(--amber);
}

.agent-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}
.agent-dot.online {
    background: #3fb950;
    box-shadow: 0 0 6px rgba(63, 185, 80, 0.4);
}

.terminal-viewport {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    position: relative;
    background: #0d1117;
}

.terminal-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
}

/* xterm.js must fill its container */
.terminal-container .xterm,
.terminal-container .xterm-screen {
    height: 100% !important;
}

.terminal-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 12px;
}
.placeholder-icon { font-size: 32px; opacity: 0.4; }
.placeholder-text { font-size: 13px; }

.type-indicator {
    position: fixed;
    top: 48px;
    right: 12px;
    background: rgba(255, 75, 75, 0.15);
    color: #ff7b72;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 1px;
    z-index: 10;
}

.scroll-indicator {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--amber);
    color: var(--bg-void);
    padding: 4px 16px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    z-index: 20;
    animation: pulse-glow 1.5s ease-in-out infinite;
}

.btn-refresh-agents {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    width: 100%;
}
.btn-refresh-agents:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* Remote control (mobile) */
.remote-control {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    padding: 6px 8px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.rc-row {
    display: flex;
    justify-content: center;
    gap: 6px;
}
.rc-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    min-width: 42px;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
}
.rc-btn:active {
    background: var(--amber);
    color: var(--bg-void);
}
.rc-danger { color: #ff7b72; border-color: #ff7b72; }
.rc-follow { color: var(--amber); border-color: var(--amber); }
.rc-follow.active { background: var(--amber); color: var(--bg-void); }

/* Desktop floating remote */
.cursor-remote {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 30;
}
.remote-pad {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    display: none;
}
.cursor-remote.open .remote-pad { display: block; }
.remote-row {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: 2px 0;
}
.remote-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
}
.remote-btn:active {
    background: var(--amber);
    color: var(--bg-void);
}
.remote-toggle {
    background: var(--bg-panel);
    border: 1px solid var(--amber-dim);
    color: var(--amber);
    padding: 8px 12px;
    border-radius: 50%;
    font-size: 16px;
    margin-bottom: 8px;
    display: block;
    margin-left: auto;
}
.remote-danger { color: #ff7b72; }

@keyframes pulse-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Mobile: sidebar becomes horizontal strip */
@media (max-width: 768px) {
    .terminal-layout {
        flex-direction: column;
        height: calc(100vh - 90px);
    }
    .agent-sidebar {
        width: 100%;
        min-width: unset;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 44px;
        overflow-x: auto;
        overflow-y: hidden;
    }
    .agent-sidebar .sidebar-header { display: none; }
    .agent-sidebar .sidebar-footer { display: none; }
    .agent-list {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        padding: 6px;
        gap: 6px;
    }
    .agent-item {
        white-space: nowrap;
        padding: 4px 10px;
        border-left: none;
        border-bottom: 2px solid transparent;
        border-radius: 4px;
    }
    .agent-item.active {
        border-bottom-color: var(--amber);
        border-left: none;
    }
    .terminal-viewport {
        flex: 1;
        min-height: 0;
    }
    /* Reserve space for mobile remote */
    .remote-control ~ .terminal-viewport,
    .terminal-layout { padding-bottom: 120px; }
    .cursor-remote { display: none !important; }
}
