/* ============================================================
   550A Dashboard
   Panel-based monitoring dashboard with CRT effects
   ============================================================ */

/* --- Reset & Foundation --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    height: 100%;
    font-family: 'SF Mono', 'Cascadia Code', 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace;
    font-size: 13px;
}
body {
    display: flex;
    flex-direction: column;
    background: #0c0c0c;
    color: #999;
    animation: fadein 0.4s ease;
    overflow: hidden;
}
[x-cloak] { display: none !important; }

@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

:root {
    --accent: #e55;
    --accent-dim: #b44;
    --accent-glow: rgba(238, 85, 85, 0.3);
    --green: #5a5;
    --yellow: #aa3;
    --fail: #86e;
    --border: #1e1e1e;
    --border-panel: #252525;
    --text: #999;
    --text-dim: #555;
    --text-bright: #ccc;
    --bg: #0c0c0c;
    --bg-panel: #111;
    --bg-input: #0a0a0a;
    --bg-hover: #181818;
    --panel-radius: 3px;
}

/* --- CRT Scanline (dark mode only) --- */
body::after { content: none; }
body.dark-mode::after {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.06) 2px,
        rgba(0,0,0,0.06) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

/* --- Scrollbar --- */
body { scrollbar-color: #2a2a2a #0c0c0c; }
body::-webkit-scrollbar { width: 8px; }
body::-webkit-scrollbar-track { background: #0c0c0c; }
body::-webkit-scrollbar-thumb { background: #2a2a2a; }
body::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }

/* === TOPBAR === */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    height: 40px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-panel);
    flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 0; }
.topbar-brand {
    font-size: 15px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: 0;
    text-shadow: 0 0 12px var(--accent-glow);
}
.topbar-sep { color: var(--text-dim); margin: 0 8px; font-weight: 300; }
.topbar-user { color: var(--text-bright); font-weight: 600; font-size: 13px; }
.topbar-runcat {
    display: inline-block;
    width: 36px;
    height: 22px;
    margin-left: 6px;
    vertical-align: middle;
    position: relative;
    overflow: hidden;
}
.topbar-runcat .runcat-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}
.topbar-runcat .runcat-frame.active { opacity: 1; }
.topbar-runcat img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.dark-mode .topbar-runcat img { filter: invert(1); }
.topbar-right { display: flex; gap: 3px; }

/* === BUTTONS === */
.btn {
    padding: 5px 14px;
    font-size: 11px;
    font-family: inherit;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: transparent;
    border: 1px solid var(--border-panel);
    border-radius: var(--panel-radius);
    cursor: pointer;
    color: var(--text-dim);
    transition: all 0.15s ease;
}
.btn:hover {
    background: var(--bg-hover);
    border-color: #444;
    color: var(--text);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.btn:active { transform: translateY(0); box-shadow: none; }
.btn-accent {
    border-color: var(--accent-dim);
    color: var(--accent);
}
.btn-accent:hover { border-color: var(--accent); background: rgba(204,68,68,0.08); }
.btn-subtle { color: var(--text-dim); border-color: transparent; }
.btn-subtle:hover { border-color: var(--border-panel); }
.btn-save { background: var(--accent-dim); color: #fff; border-color: var(--accent-dim); }
.btn-save:hover { background: var(--accent); border-color: var(--accent); }
.btn-save:disabled { background: #222; border-color: #222; color: #555; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-close { color: var(--text-dim); }
.btn-close:hover { color: var(--text); background: var(--bg-hover); }

/* === DASHBOARD GRID === */
.dashboard {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto auto;
    gap: 1px;
    background: var(--border);
    flex-shrink: 0;
}

/* === PANELS === */
.panel {
    background: var(--bg-panel);
    overflow: hidden;
}
.panel-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-dim);
    padding: 8px 12px 0;
    user-select: none;
}
.panel-body { padding: 6px 12px 10px; }

/* Grid placement */
.panel-channels { grid-column: 1 / -1; overflow: hidden; }
.panel-usage-activity { grid-column: 1; overflow: visible; z-index: 1; }
.panel-system { grid-column: 2; display: flex; flex-direction: column; }
.panel-requests { grid-column: 2; }
.panel-usage { grid-column: 1; }
.panel-activity { grid-column: 2; }
.panel-info { grid-column: 1 / -1; }

/* === CHANNELS === */
.moss-link {
    position: absolute;
    top: 8px;
    bottom: 8px;
    right: 12px;
    aspect-ratio: 1;
    display: block;
    max-height: calc(100% - 16px);
}
.moss-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
    transition: transform 0.4s ease;
    cursor: pointer;
}
.moss-img:hover {
    transform: scale(1.05);
}
.channel-group { margin-bottom: 4px; }
.channel-group:last-child { margin-bottom: 0; }
.channel-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-bottom: 4px;
}
.channel-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.channel-btn {
    padding: 4px 12px;
    font-size: 12px;
    font-family: inherit;
    background: var(--bg);
    border: 1px solid var(--border-panel);
    border-radius: var(--panel-radius);
    cursor: pointer;
    position: relative;
    color: var(--text-dim);
    transition: all 0.15s ease;
}
.channel-btn:hover { background: var(--bg-hover); color: var(--text); border-color: #444; }

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
    50% { box-shadow: 0 0 8px 2px var(--accent-glow); }
}
.channel-btn.current {
    background: var(--accent-dim);
    color: #fff;
    border-color: var(--accent);
    font-weight: 700;
    animation: pulse-glow 3s ease-in-out infinite;
}

/* Balance badges */
.balance-badge {
    position: absolute;
    top: -7px; right: -3px;
    background: #1a3555;
    color: #7ab;
    font-size: 9px;
    font-weight: 700;
    padding: 0 4px;
    border-radius: 2px;
    min-width: 16px;
    text-align: center;
    white-space: nowrap;
    z-index: 2;
    line-height: 1.5;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.balance-badges {
    position: absolute;
    top: -7px; right: -3px;
    display: flex;
    gap: 2px;
    z-index: 2;
}
.balance-badges .balance-badge { position: static; }
.balance-badge.privacy-badge { background: #2e2545; color: #a8b; }
.balance-badge.rpm-badge { background: #1a3a28; color: #7b9; }

.panel-system .panel-body {
    display: flex;
    align-items: center;
    flex: 1;
    margin-right: 66px;
}
/* === SYSTEM INFO === */
.sys-info {
    font-family: inherit;
    font-size: 12px;
    width: 100%;
}
.sys-bar {
    color: var(--text-dim);
    line-height: 1.6;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sys-label {
    display: inline-block;
    width: 3ch;
    text-align: right;
    color: var(--accent);
    font-weight: 700;
    flex-shrink: 0;
}
/* Progress bar track & fill */
.bar-track-wrap {
    flex: 1;
    min-width: 0;
}
.bar-track {
    flex: 1;
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    min-width: 0;
}
.bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
    background: var(--accent);
}
.bar-fill.bar-green { background: var(--green); }
.bar-fill.bar-yellow { background: var(--yellow); }
.bar-fill.bar-red { background: var(--accent); }
.skeleton-track { animation: skeleton-pulse 2s ease-in-out infinite; }
/* Keep old bar-* classes for compat (renderReqBar still uses them) */
span.bar-green { color: var(--green); text-shadow: 0 0 4px rgba(85,170,85,0.3); }
span.bar-yellow { color: var(--yellow); text-shadow: 0 0 4px rgba(170,170,51,0.3); }
span.bar-red { color: var(--accent); text-shadow: 0 0 4px var(--accent-glow); }
.bar-empty { color: #1a1a1a; }
.sys-pct {
    display: inline-block;
    width: 10ch;
    text-align: right;
    color: var(--text);
    flex-shrink: 0;
}

/* === REQUEST STATS === */
.req-stats {
    font-family: inherit;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.req-stats-row {
    display: flex;
    align-items: center;
    gap: 0;
    color: var(--text-dim);
    line-height: 1.6;
}
.req-stats-label {
    display: inline-block;
    width: 6ch;
    text-align: right;
    color: var(--accent);
    font-weight: 700;
}
.req-stats-rate {
    display: inline-block;
    width: 4ch;
    text-align: left;
    color: var(--text);
}
.req-stats-bar { letter-spacing: -1px; }
.req-block { font-weight: 700; }
.req-block.success { color: var(--green); text-shadow: 0 0 3px rgba(85,170,85,0.25); }
.req-block.fail { color: var(--fail); text-shadow: 0 0 3px rgba(136,102,238,0.25); }
.req-block.empty { color: #1a1a1a; }

/* === USER COSTS === */
.user-costs-row {
    font-family: inherit;
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.5;
    padding-left: 6.5ch;
    text-indent: -6.5ch;
}
.user-costs-label { color: var(--accent); font-weight: 700; margin-right: 4px; text-transform: uppercase; font-size: 11px; letter-spacing: 0.05em; }
.user-cost-inline { margin-right: 10px; white-space: nowrap; }
.user-name-inline { color: var(--text-dim); }
.user-cost-value { color: var(--accent); font-weight: 700; }
.skeleton-user-costs-inline { width: 800px; height: 2em; }

/* === INFO DESC === */
.info-desc {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.6;
    position: relative;
}
.info-desc-content { display: block; }
.info-desc:not(.expanded) .info-desc-content {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.info-desc.expanded .info-desc-content { display: block; }
.info-desc-toggle {
    display: none;
    padding: 1px 6px;
    font-size: 10px;
    font-family: inherit;
    background: var(--bg);
    border: 1px solid var(--border-panel);
    border-radius: var(--panel-radius);
    cursor: pointer;
    color: var(--text-dim);
    transition: all 0.1s;
    position: absolute;
    bottom: 0; right: 5px;
    opacity: 0;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.info-desc:hover .info-desc-toggle { opacity: 1; pointer-events: auto; }
.info-desc-toggle:hover { background: var(--bg-hover); color: var(--text); }
.info-desc a {
    color: var(--text-dim);
    text-decoration: none;
    border-bottom: 1px dotted var(--border-panel);
    transition: all 0.1s;
    overflow-wrap: anywhere;
    word-break: break-all;
}
.info-desc a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* === LOG === */
.log-wrapper { flex: 1; position: relative; }
.log-container { width: 100%; height: 100%; border-top: 1px solid var(--border); }
.log-container iframe { width: 100%; height: 100%; border: none; }
.sakana-anchor { position: absolute; right: 0; bottom: 0; width: 100%; height: 100%; pointer-events: none; overflow: hidden; }
.sakana-anchor .sakana-box { pointer-events: auto; position: absolute !important; right: 0 !important; bottom: 0 !important; }

/* === MODALS === */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }

@keyframes modal-in {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal {
    background: var(--bg-panel);
    border-radius: var(--panel-radius);
    width: 90%;
    max-width: 900px;
    height: 85%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 0 1px var(--border-panel), 0 16px 48px rgba(0,0,0,0.6);
    animation: modal-in 0.2s ease;
}
.modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.modal-header h2 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-bright);
}
.modal-header-buttons { display: flex; gap: 3px; }
.modal-body {
    flex: 1;
    padding: 12px 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.config-editor {
    flex: 1;
    width: 100%;
    font-family: inherit;
    font-size: 12px;
    line-height: 1.6;
    padding: 12px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent-dim);
    border-radius: 0;
    resize: none;
    tab-size: 2;
    background: var(--bg-input);
    color: #bbb;
    transition: border-color 0.15s;
}
.config-editor:focus { outline: none; border-color: var(--accent-dim); border-left-color: var(--accent); }

.form-label { margin: 0 0 4px; font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.form-actions { margin-top: 8px; display: flex; gap: 3px; align-items: center; flex-wrap: wrap; }

.text-input {
    width: 100%;
    font-family: inherit;
    font-size: 12px;
    line-height: 1.5;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--panel-radius);
    background: var(--bg-input);
    color: #bbb;
    transition: border-color 0.15s;
}
.text-input:focus { outline: none; border-color: var(--accent-dim); }

.metrics { margin-top: 10px; }
.metric-row { font-family: inherit; font-size: 12px; color: var(--text-dim); line-height: 1.7; }
.metric-label { display: inline-block; width: 7.5ch; text-align: right; color: var(--accent); font-weight: 700; margin-right: 8px; }
.metric-value { color: var(--text); font-weight: 700; }

.modal-status { margin-top: 8px; padding: 6px 10px; border-radius: var(--panel-radius); font-size: 11px; display: none; font-weight: 600; }
.modal-status.success { display: block; background: #0a1f0a; color: #5a5; border: 1px solid #1a3a28; }
.modal-status.error { display: block; background: #1f0a0a; color: var(--accent); border: 1px solid #3a1a1a; }

/* === SKELETON === */
@keyframes skeleton-pulse {
    0% { opacity: 0.1; }
    50% { opacity: 0.25; }
    100% { opacity: 0.1; }
}
.skeleton { background: #2a2a2a; animation: skeleton-pulse 2s ease-in-out infinite; border-radius: 2px; display: inline-block; }
.skeleton-bar { width: 32ch; height: 1em; }
.skeleton-pct { width: 8ch; height: 1em; margin-left: 4px; }
.skeleton-req-bar { width: 77ch; height: 1em; }
.skeleton-rate { width: 3ch; height: 1em; }
.skeleton-user-cost { width: 100px; height: 3em; }
.skeleton-heatmap { width: 800px; height: 100px; }

/* === TOKEN STATS (compat) === */
.token-stats { font-family: inherit; font-size: 12px; display: flex; flex-direction: column; gap: 1px; min-width: 120px; }
.token-stats-title { color: var(--accent); font-weight: 700; margin-bottom: 2px; }
.user-cost-row { display: flex; justify-content: space-between; gap: 10px; padding: 1px 0; }
.user-name { color: var(--text-dim); }
.user-cost { color: var(--accent); font-weight: 700; }
.no-data { color: var(--text-dim); font-style: italic; }

/* === HEATMAP === */
.activity-heatmap-container { }
.activity-heatmap { font-family: inherit; font-size: 11px; display: inline-block; }
.heatmap-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.heatmap-title { color: var(--accent); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.heatmap-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 1px;
    padding: 1px 0;
    transition: background-color 0.1s;
}
.heatmap-row:hover { background: var(--bg-hover); }
.heatmap-user { width: 80px; text-align: right; color: var(--text-dim); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heatmap-cells { display: flex; gap: 1px; }
.heatmap-cell { width: 9px; height: 9px; border-radius: 1px; display: inline-block; position: relative; }
.heatmap-cell[data-tooltip] { cursor: pointer; }
.heatmap-cell[data-tooltip]:hover { transform: scale(1.2); z-index: 10; opacity: 1 !important; }

@keyframes tooltip-fadein { from { opacity: 0; } to { opacity: 1; } }
.heatmap-cell[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%; left: 50%;
    transform: translateX(-50%);
    margin-bottom: 4px;
    padding: 3px 8px;
    background: #1a1a1a;
    color: #bbb;
    font-size: 10px;
    white-space: nowrap;
    border-radius: 2px;
    border: 1px solid #333;
    pointer-events: none;
    z-index: 1000;
    animation: none;
}
.heatmap-cell[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%; left: 50%;
    transform: translateX(-50%);
    margin-bottom: -2px;
    border: 3px solid transparent;
    border-top-color: #1a1a1a;
    pointer-events: none;
    z-index: 1000;
    animation: none;
}

/* Heatmap levels */
.heatmap-cell.level-0 { background-color: #1a1a1a; }
.heatmap-cell.level-1 { background-color: var(--accent); opacity: 0.2; }
.heatmap-cell.level-2 { background-color: var(--accent); opacity: 0.4; }
.heatmap-cell.level-3 { background-color: var(--accent); opacity: 0.7; }
.heatmap-cell.level-4 { background-color: var(--accent); opacity: 1; box-shadow: 0 0 4px var(--accent-glow); }

.heatmap-legend { display: flex; align-items: center; gap: 1px; }
.heatmap-legend-label { color: var(--text-dim); font-size: 10px; margin: 0 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.heatmap-legend-label:last-child { margin-right: 0; }
.heatmap-no-data { color: var(--text-dim); font-style: italic; font-size: 11px; }

/* === GUIDE MODAL === */
.guide-modal { max-width: 1000px; height: auto; max-height: 85%; }
.right-modal { max-width: 450px; }
.guide-body { overflow: auto; }
.guide-columns { display: flex; gap: 20px; }
.guide-column { flex: 1; min-width: 0; }
.guide-column h3 {
    font-size: 10px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}
.guide-code {
    font-family: inherit;
    font-size: 11px;
    line-height: 1.6;
    background: var(--bg-input);
    color: #999;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent-dim);
    border-radius: 0;
    padding: 10px 12px;
    overflow-x: auto;
    white-space: pre;
    margin: 0;
}
.guide-code-block { position: relative; margin-bottom: 14px; }
.guide-code-block:last-child { margin-bottom: 0; }
.copy-btn {
    position: absolute;
    top: 6px; right: 6px;
    padding: 2px 10px;
    font-size: 10px;
    font-family: inherit;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.1s;
    z-index: 1;
    color: #666;
}
.copy-btn:hover { background: #252525; color: #999; border-color: #444; }
.copy-btn.copied { background: var(--accent-dim); color: #fff; border-color: var(--accent-dim); }

/* === LOG PAGE === */
.log-page {
    padding: 8px 12px 0;
    font-family: 'SF Mono', 'Cascadia Code', 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace;
    background: #0c0c0c;
    color: #999;
    scrollbar-color: #2a2a2a #0c0c0c;
}
.log-page::-webkit-scrollbar { width: 8px; }
.log-page::-webkit-scrollbar-track { background: #0c0c0c; }
.log-page::-webkit-scrollbar-thumb { background: #2a2a2a; }
.log-page::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }
.log-page.light-mode { background: #f4f3ef; color: #444; scrollbar-color: #c0c0b8 #f4f3ef; }
.log-page.light-mode::-webkit-scrollbar-track { background: #f4f3ef; }
.log-page.light-mode::-webkit-scrollbar-thumb { background: #c0c0b8; }
.log-page.light-mode::-webkit-scrollbar-thumb:hover { background: #a0a098; }
.log-page p { margin: 0; line-height: 1.4; word-break: break-all; font-size: 12px; }
.log-page p.log-line-user { color: var(--log-line-color); }
.log-page:not(.light-mode) p.log-line-user { color: color-mix(in srgb, var(--log-line-color), white 50%); }

/* === COMPAT: old class names that no longer appear in HTML but keep for safety === */
.header { display: none; }
.header-top, .header-buttons, .stats-row, .combined-stats, .dashboard-left, .dashboard-right { display: contents; }

/* === LIGHT MODE === */
/* Scope to exclude .log-page since the log iframe uses light-mode class instead of dark-mode */
body:not(.dark-mode):not(.log-page) {
    background: #f4f3ef;
    color: #444;
    --accent: #c33;
    --accent-dim: #a33;
    --accent-glow: rgba(204, 51, 51, 0.15);
    --green: #3a7a3a;
    --yellow: #8a7020;
    --fail: #6b4fa0;
    --border: #ddd;
    --border-panel: #ccc;
    --text: #444;
    --text-dim: #999;
    --text-bright: #222;
    --bg: #f4f3ef;
    --bg-panel: #fff;
    --bg-input: #fafaf8;
    --bg-hover: #eee;
}
body:not(.dark-mode) .topbar { background: #fff; border-bottom-color: #ddd; }
body:not(.dark-mode) .topbar-brand { text-shadow: none; }
body:not(.dark-mode) span.bar-green, body:not(.dark-mode) span.bar-yellow, body:not(.dark-mode) span.bar-red { text-shadow: none; }
body:not(.dark-mode) .bar-track { background: #ddd; }
body:not(.dark-mode) .req-block.success, body:not(.dark-mode) .req-block.fail { text-shadow: none; }
body:not(.dark-mode) .bar-empty { color: #ddd; }
body:not(.dark-mode) .req-block.empty { color: #e5e5e5; }
body:not(.dark-mode) .channel-btn.current { animation: none; }
body:not(.dark-mode) .heatmap-cell.level-4 { box-shadow: none; }
body:not(.dark-mode):not(.log-page) .skeleton { background: #ddd; }
body:not(.dark-mode):not(.log-page) .config-editor { background: #f0f0ec; color: #444; border-color: #ddd; border-left-color: var(--accent-dim); }
body:not(.dark-mode):not(.log-page) .guide-code { background: #f0f0ec; color: #444; border-color: #ddd; border-left-color: var(--accent-dim); }
body:not(.dark-mode):not(.log-page) .copy-btn { background: #e8e8e4; border-color: #ccc; color: #666; }
body:not(.dark-mode):not(.log-page) .copy-btn:hover { background: #ddd; color: #444; border-color: #bbb; }
body:not(.dark-mode) .text-input { background: #fff; color: #444; }
body:not(.dark-mode) .modal { box-shadow: 0 0 0 1px #ddd, 0 16px 48px rgba(0,0,0,0.1); }
body:not(.dark-mode) .modal-status.success { background: #f0f8f0; color: #2a6a2a; border-color: #c0e0c0; }
body:not(.dark-mode) .modal-status.error { background: #fdf0f0; color: #a02020; border-color: #e0c0c0; }
body:not(.dark-mode) .balance-badge { background: #3a6a9a; color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.15); }
body:not(.dark-mode) .balance-badge.privacy-badge { background: #5a4a80; }
body:not(.dark-mode) .balance-badge.rpm-badge { background: #2a6040; }
body:not(.dark-mode) .heatmap-cell.level-0 { background-color: #e5e5dd; }
body:not(.dark-mode) .heatmap-cell.level-4 { box-shadow: none; }
body:not(.dark-mode) .heatmap-cell[data-tooltip]:hover::after { background: #222; color: #ccc; border-color: #444; }
body:not(.dark-mode) .heatmap-cell[data-tooltip]:hover::before { border-top-color: #222; }

/* Light scrollbar */
body:not(.dark-mode):not(.log-page) { scrollbar-color: #ccc #f4f3ef; }
body:not(.dark-mode):not(.log-page)::-webkit-scrollbar-track { background: #f4f3ef; }
body:not(.dark-mode):not(.log-page)::-webkit-scrollbar-thumb { background: #ccc; }
body:not(.dark-mode):not(.log-page)::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* Dark mode scrollbar for config editor */
body.dark-mode .config-editor { scrollbar-color: #2a2a2a var(--bg-input); }
body.dark-mode .config-editor::-webkit-scrollbar { width: 8px; }
body.dark-mode .config-editor::-webkit-scrollbar-track { background: var(--bg-input); }
body.dark-mode .config-editor::-webkit-scrollbar-thumb { background: #2a2a2a; }
body.dark-mode .config-editor::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }
body.dark-mode { scrollbar-color: #2a2a2a #0c0c0c; }

/* === RESPONSIVE === */
@media (max-width: 1240px) {
    .dashboard {
        grid-template-columns: 1fr;
    }
    .panel-channels,
    .panel-system,
    .panel-usage-activity,
    .panel-info {
        grid-column: 1;
    }
    .moss-link { display: none; }
}

@media (max-width: 900px) {
    .sakana-anchor { display: none; }
    .topbar { padding: 0 10px; }
    .topbar-right { gap: 2px; }
    .btn { padding: 4px 8px; font-size: 10px; }
    .info-desc-toggle { display: inline-block; }
    .sys-label { width: 6ch; }
    .req-stats-rate { width: 0; overflow: hidden; }
    .skeleton-req-bar { width: 40ch; }
    .guide-columns { flex-direction: column; gap: 12px; }
}

@media (max-width: 420px) {
    .topbar { height: 36px; padding: 0 8px; }
    .topbar-brand { font-size: 13px; }
    .btn { padding: 3px 6px; font-size: 9px; letter-spacing: 0.04em; }
    .panel-body { padding: 4px 8px 8px; }
    .heatmap-row { gap: 4px; }
    .heatmap-user { width: 60px; }
    .heatmap-cell { width: 6px; height: 6px; }
    .channel-btn { padding: 3px 8px; font-size: 11px; }
}
