* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --bg: #080808; --sidebar: #0e0e0e; --card: #141414;
    --border: #2a2a2a; --text: #f0f0f0; --muted: #666; --text-dim: #999; --text-muted: #555;
    --accent: #00d4ff; --green: #00ff88; --red: #ff4444; --orange: #ffaa00;
    --purple: #a78bfa; --teal: #2dd4bf; --pink: #f472b6; --yellow: #facc15;
    --card-hover: #222; --card-border-hover: #3a3a3a;
    --success: #00ff88; --warning: #ffaa00; --danger: #ff4444; --info: #00d4ff;
    --blue: #3b82f6;
}
body { background: var(--bg); color: var(--text); font-family: 'Inter', 'Segoe UI', system-ui, sans-serif; display: flex; height: 100vh; height: 100dvh; overflow: hidden; -webkit-font-smoothing: antialiased; }
/* TASK 23 tokens */
:root { --bg-base: #080808; --bg-elevated: #1a1a1a; --radius: 10px; --radius-sm: 6px; --shadow: 0 4px 24px rgba(0,0,0,0.45); }
.gauge text { font-family: 'Inter', sans-serif; font-weight: 600; }
.nav-mini-bar { height: 4px; background: #1e1e1e; border-radius: 2px; margin: 4px 16px 0 39px; overflow: hidden; }
.nav-mini-bar > div { height: 100%; background: var(--mc, var(--accent)); width: 0; transition: width 0.5s; border-radius: 2px; }
#sidebar-footer { margin-top: auto; padding: 10px 16px; font-size: 0.66em; color: var(--text-muted, #555); border-top: 1px solid var(--border); }

/* ───── Sidebar ───── */
#sidebar { width: 230px; min-width: 230px; background: var(--sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 14px 0; overflow-y: auto; }
#sidebar h1 { color: var(--accent); font-size: 1em; padding: 0 16px 12px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
#clock { padding: 4px 16px 8px; }
#clock-time { font-size: 1.3em; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: 1px; }
#clock-date { font-size: 0.72em; color: var(--muted); margin-top: 2px; }
#weather { display: flex; align-items: center; gap: 8px; padding: 8px 16px; margin: 4px 0 8px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
#weather-icon { font-size: 1.6em; }
#weather .weather-text { display: flex; flex-direction: column; line-height: 1.3; }
#weather-temp { font-size: 0.95em; font-weight: 600; color: var(--text); }
#weather-desc, #weather-wind { font-size: 0.7em; color: var(--muted); }

.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 16px; cursor: pointer; color: var(--muted); font-size: 0.9em; border-left: 3px solid transparent; transition: all 0.15s; text-decoration: none; }
.nav-item:hover { background: #1a1a1a; color: var(--text); }
.nav-item.active { color: var(--accent); border-left-color: var(--accent); background: #1a1a1a; }
.nav-section { padding: 8px 16px 4px; font-size: 0.7em; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.nav-divider { border: none; border-top: 1px solid var(--border); margin: 8px 0; }
.nav-ico { width: 18px; text-align: center; flex-shrink: 0; }

.nav-group { --mc: var(--accent); }
.nav-machine { display: flex; align-items: center; gap: 8px; padding: 9px 16px; cursor: pointer; color: var(--text); font-size: 0.9em; font-weight: 600; }
.nav-machine:hover { background: #1a1a1a; }
.nav-machine .caret { font-size: 0.7em; color: var(--muted); transition: transform 0.15s; width: 10px; }
.nav-group.collapsed .caret { transform: rotate(-90deg); }
.nav-group.collapsed .nav-sub-list { display: none; }
.nav-sub { padding: 7px 16px 7px 46px; cursor: pointer; color: var(--muted); font-size: 0.85em; border-left: 3px solid transparent; }
.nav-sub:hover { background: #1a1a1a; color: var(--text); }
.nav-sub.active { color: var(--mc); border-left-color: var(--mc); background: #1a1a1a; }
.sdot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex-shrink: 0; display: inline-block; }
.sdot.online { background: var(--green); }
.sdot.offline { background: var(--red); }

#hamburger { display: none; position: fixed; top: 10px; left: 10px; z-index: 1200; background: var(--card); color: var(--accent); border: 1px solid var(--border); border-radius: 6px; font-size: 1.2em; padding: 4px 12px; cursor: pointer; }

/* ───── Main / cards ───── */
#main { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 24px; }
.card { background: var(--card); border-radius: 10px; border: 1px solid var(--border); padding: 20px; margin-bottom: 16px; transition: border-color 0.2s, background 0.2s, box-shadow 0.2s; box-shadow: inset 0 1px 0 rgba(255,255,255,0.03); }
.card:hover { border-color: var(--card-border-hover); background: var(--card-hover); }
.card.error-state { border-color: var(--danger); box-shadow: 0 0 0 1px #ff444433; }

/* TASK 18: animated online pulse, temp colours, skeletons */
.sdot.online { animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 #00ff8866; } 70% { box-shadow: 0 0 0 5px #00ff8800; } 100% { box-shadow: 0 0 0 0 #00ff8800; } }
.temp-cold { color: var(--blue); } .temp-ok { color: var(--green); } .temp-warm { color: var(--orange); } .temp-hot { color: var(--red); }
.skeleton { background: linear-gradient(90deg, #1e1e1e 25%, #2a2a2a 50%, #1e1e1e 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 4px; height: 12px; margin: 6px 0; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 10px; }
.card-title { font-size: 1em; font-weight: 600; color: var(--accent); }
.status-badge { font-size: 0.75em; padding: 3px 10px; border-radius: 12px; background: #222; color: var(--muted); }
.status-badge.online { background: #00ff8822; color: var(--green); border: 1px solid #00ff8844; }
.status-badge.offline { background: #ff444422; color: var(--red); border: 1px solid #ff444444; }
.refreshing { font-size: 0.7em; color: var(--muted); font-style: italic; }
.link-pill { font-size: 0.75em; color: var(--accent); text-decoration: none; border: 1px solid #00d4ff44; padding: 3px 10px; border-radius: 12px; }
.link-pill:hover { background: #00d4ff15; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-box { background: #111; border-radius: 8px; padding: 12px; border: 1px solid var(--border); }
.stat-label { font-size: 0.7em; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.stat-value { font-size: 1.2em; font-weight: 600; color: var(--text); }
.stat-sub { font-size: 0.75em; color: var(--muted); margin-top: 2px; }
.net-down { color: var(--green); } .net-up { color: var(--orange); }

.progress-wrap { margin-bottom: 12px; }
.progress-label { display: flex; justify-content: space-between; font-size: 0.8em; margin-bottom: 4px; }
.progress-label span:first-child { color: var(--muted); }
.progress-bar { height: 6px; background: #222; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.5s; }
.progress-fill.low { background: var(--green); } .progress-fill.mid { background: var(--yellow); } .progress-fill.high { background: var(--red); }

.sparkline-wrap { margin-bottom: 16px; position: relative; }
.sparkline-title { font-size: 0.75em; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; }
canvas.sparkline { width: 100%; height: 80px; display: block; cursor: crosshair; }
.graph-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; margin-bottom: 16px; }
.graph-grid .sparkline-wrap { margin-bottom: 0; }
.sparkline-title { display: flex; justify-content: space-between; align-items: baseline; }
.spark-cur { color: var(--text); font-weight: 600; text-transform: none; font-size: 1.05em; }
@media (max-width: 768px) { .graph-grid { grid-template-columns: 1fr; } }
.spark-tooltip { position: absolute; background: #222; border: 1px solid var(--border); color: var(--text); font-size: 0.75em; padding: 4px 8px; border-radius: 4px; pointer-events: none; display: none; }

/* ───── Buttons ───── */
.terminal-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; background: var(--accent); color: #000; border: none; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 0.85em; }
.terminal-btn:hover { background: #00b8d9; }
.terminal-btn:disabled { opacity: 0.6; cursor: default; }
.danger-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; background: transparent; color: var(--red); border: 1px solid #ff444455; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 0.85em; }
.danger-btn:hover { background: #ff444415; } .danger-btn:disabled { opacity: 0.6; cursor: default; }
.mini-btn { padding: 3px 12px; border: none; border-radius: 5px; font-weight: 600; cursor: pointer; font-size: 0.78em; color: #000; background: #444; color: #ddd; margin-left: 4px; }
.mini-btn.start { background: var(--green); color: #000; } .mini-btn.stop { background: var(--red); color: #fff; }
.mini-btn:hover { opacity: 0.85; }
.toggle-btn { padding: 10px 22px; border: none; border-radius: 8px; font-weight: 700; cursor: pointer; font-size: 0.9em; background: #333; color: #fff; }
.toggle-btn.on { background: var(--green); color: #000; } .toggle-btn.off { background: var(--red); color: #fff; }
.toggle-btn:disabled { opacity: 0.6; }

/* ───── Docker table ───── */
.docker-table { width: 100%; border-collapse: collapse; font-size: 0.82em; }
.docker-table th { text-align: left; padding: 6px 8px; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--border); font-size: 0.75em; text-transform: uppercase; }
.docker-table td { padding: 8px; border-bottom: 1px solid #1e1e1e; vertical-align: middle; }
.docker-table tr:last-child td { border-bottom: none; }
.muted-cell { color: var(--muted); font-size: 0.9em; } .actions-cell { text-align: right; white-space: nowrap; }
.running { color: var(--green); } .stopped { color: var(--red); }

/* ───── extra grid / now playing ───── */
.extra-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.extra-box { background: #111; border-radius: 8px; padding: 10px; text-align: center; border: 1px solid var(--border); }
.extra-box .val { font-size: 1.4em; font-weight: 700; color: var(--accent); }
.extra-box .lbl { font-size: 0.7em; color: var(--muted); margin-top: 2px; }
.now-playing { display: flex; flex-direction: column; gap: 8px; }
.np-item { background: #111; border-radius: 8px; padding: 12px; border: 1px solid var(--border); }
.np-title { font-size: 0.9em; font-weight: 600; margin-bottom: 4px; }
.np-meta { font-size: 0.75em; color: var(--muted); margin-bottom: 6px; }
.np-info { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.np-tag { font-size: 0.7em; padding: 2px 6px; border-radius: 4px; background: #222; color: var(--muted); border: 1px solid var(--border); }
.np-tag.direct { color: var(--green); border-color: #00ff8844; background: #00ff8811; }
.np-tag.transcode { color: var(--orange); border-color: #ffaa0044; background: #ffaa0011; }
.np-tag.red { color: var(--red); border-color: #ff444455; background: #ff444411; }
.np-tag.cyan { color: var(--accent); border-color: #00d4ff44; background: #00d4ff11; }
.np-head { display: flex; gap: 12px; }
.np-poster { width: 46px; height: 69px; object-fit: cover; border-radius: 5px; flex-shrink: 0; background: #1a1a1a; }
.np-main { flex: 1; min-width: 0; }
.np-tech { display: flex; align-items: center; gap: 12px; margin-top: 10px; font-size: 0.78em; }
.np-tech-h { font-size: 0.8em; color: var(--text-dim); letter-spacing: 0.5px; }
.np-arrow { color: var(--accent); font-size: 1.2em; }
.np-dim { color: var(--muted); }
.np-foot { margin-top: 8px; font-size: 0.72em; color: var(--muted); }
.np-bar { height: 4px; background: #222; border-radius: 2px; overflow: hidden; }
.np-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.5s; }

/* ───── generic rows / tags ───── */
.row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid #1e1e1e; font-size: 0.82em; }
.row:last-child { border-bottom: none; }
.row-main { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main.blocked { color: var(--red); }
.row-meta { color: var(--muted); font-size: 0.92em; }
.mono { font-variant-numeric: tabular-nums; }
.tag { font-size: 0.7em; padding: 2px 7px; border-radius: 4px; background: #222; color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.tag.green { color: var(--green); border-color: #00ff8844; background: #00ff8811; }
.tag.red { color: var(--red); border-color: #ff444444; background: #ff444411; }
.tag.orange { color: var(--orange); border-color: #ffaa0044; background: #ffaa0011; }
.tag.cyan { color: var(--accent); border-color: #00d4ff44; background: #00d4ff11; }

/* ───── pihole bar chart ───── */
.bar-row { display: flex; align-items: center; gap: 10px; padding: 5px 4px; font-size: 0.82em; }
.bar-domain { width: 38%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 10px; background: #222; border-radius: 5px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--red); border-radius: 5px; }
.bar-count { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; min-width: 60px; text-align: right; }
.ph-strip { display: flex; gap: 18px; flex-wrap: wrap; font-size: 0.85em; color: var(--muted); }
.ph-strip b { color: var(--text); }
.ph-gravity-ts { font-size: 0.78em; color: var(--muted); margin-top: 12px; }

/* ───── downloads / queue ───── */
.downloads-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.downloads-grid .card { margin-bottom: 0; }
.queue-item { background: #111; border-radius: 8px; padding: 10px 12px; border: 1px solid var(--border); margin-bottom: 8px; }
.queue-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.queue-title { font-size: 0.85em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-eta { font-size: 0.75em; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.queue-meta { font-size: 0.72em; color: var(--muted); margin-top: 4px; }

/* ───── requests ───── */
.filter-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-btn { padding: 5px 12px; border-radius: 14px; border: 1px solid var(--border); background: #111; color: var(--muted); font-size: 0.78em; cursor: pointer; }
.filter-btn.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }
.req-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid #1e1e1e; }
.req-item:last-child { border-bottom: none; }
.req-poster { width: 46px; height: 69px; border-radius: 5px; object-fit: cover; flex-shrink: 0; background: #111; }
.req-poster.placeholder { display: flex; align-items: center; justify-content: center; font-size: 1.4em; border: 1px solid var(--border); }
.req-body { flex: 1; min-width: 0; }
.req-title { font-size: 0.9em; font-weight: 600; margin-bottom: 6px; }
.req-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.req-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.req-actions .mini-btn { margin-left: 0; }

/* ───── plex recently added ───── */
.recent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.recent-card { background: #111; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.recent-poster { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; background: #1a1a1a; }
.recent-poster.placeholder { display: flex; align-items: center; justify-content: center; font-size: 2em; }
.recent-title { font-size: 0.78em; padding: 6px 8px 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-sub { font-size: 0.7em; color: var(--muted); padding: 0 8px 4px; }
.recent-badges { display: flex; flex-wrap: wrap; gap: 3px; padding: 6px 8px 0; }
.recent-src { display: flex; flex-wrap: wrap; gap: 3px; padding: 2px 8px 4px; }
.tag.teal { color: var(--teal); border-color: #2dd4bf44; background: #2dd4bf11; }
.tag.yellow { color: var(--yellow); border-color: #facc1544; background: #facc1511; }

/* ───── storage ───── */
.storage-card { background: #111; border-radius: 8px; padding: 12px; border: 1px solid var(--border); margin-bottom: 10px; }
.storage-head { display: flex; justify-content: space-between; font-size: 0.85em; margin-bottom: 8px; }
.storage-head span:last-child { color: var(--muted); }

/* ───── home ───── */
.home-hero { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; align-items: stretch; }
.hero-clock { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px 22px; display: flex; flex-direction: column; justify-content: center; }
#home-clock-time { font-size: 3em; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1; font-family: 'Consolas', monospace; }
#home-clock-date { color: var(--muted); font-size: 1em; margin-top: 6px; }
.hero-weather { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px 22px; display: flex; align-items: center; gap: 14px; }
/* Quick links fill the rest of the hero row */
.hero-links { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; flex: 1; min-width: 240px; display: flex; flex-direction: column; }
.hero-links-title { font-size: 0.7em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; letter-spacing: .5px; }
.home-links { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.home-link-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 8px; padding: 6px 11px; font-size: 0.82em; color: var(--text); text-decoration: none; transition: border-color .12s, background .12s; }
.home-link-chip:hover { border-color: var(--accent); background: var(--accent-dim, #00d4ff22); }
.home-link-chip .hlc-ico { font-size: 1.05em; }
/* Dense card grid (kills full-width blank space) */
.home-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 14px; align-items: start; }
.home-cards .card { margin-bottom: 0; }
.row-more { font-size: 0.74em; color: var(--muted); padding-top: 6px; }
@media (max-width: 768px) { .home-cards { grid-template-columns: 1fr; } .hero-clock, .hero-weather { flex: 1; } }
.hero-weather > span { font-size: 3em; }
.hw-temp { font-size: 1.6em; font-weight: 700; } .hw-desc { color: var(--muted); } .hw-wind { color: var(--muted); font-size: 0.85em; margin-top: 4px; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 16px; }
.machine-card { background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--mc); border-radius: 10px; padding: 16px; cursor: pointer; transition: background 0.15s; }
.machine-card:hover { background: #1f1f1f; }
.mc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.mc-name { font-weight: 600; font-size: 0.95em; }
.mc-stats { display: flex; justify-content: space-between; gap: 8px; }
.mc-stats > div { display: flex; flex-direction: column; }
.mc-lbl { font-size: 0.65em; color: var(--muted); text-transform: uppercase; }
.mc-val { font-size: 1.1em; font-weight: 600; }
.mc-uptime { font-size: 0.72em; color: var(--muted); margin-top: 10px; }
.dl-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.dl-box { background: #111; border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.dl-name { font-size: 0.72em; color: var(--muted); text-transform: uppercase; margin-bottom: 4px; }
.dl-val { font-size: 0.95em; font-weight: 600; }

/* ───── links ───── */
.links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.link-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px; background: #111; border: 1px solid var(--border); border-radius: 10px; text-decoration: none; color: var(--text); font-size: 0.85em; transition: all 0.15s; }
.link-card:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.link-ico { font-size: 1.8em; }
/* Links 2.0 */
.link-cat { margin-bottom: 14px; }
.link-cat-head { font-size: 0.8em; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; padding: 6px 2px; cursor: pointer; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.link-cat-head::before { content: '▾ '; color: var(--muted); }
.link-cat.collapsed .link-cat-head::before { content: '▸ '; }
.link-cat.collapsed .links-grid { display: none; }
.link-card { position: relative; }
.link-status { position: absolute; top: 8px; right: 8px; }
.link-name { font-weight: 600; }
.link-desc { font-size: 0.72em; color: var(--muted); text-align: center; }

/* ───── terminals ───── */
.term-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; height: calc(100dvh - 48px); }
.term-panel { display: flex; flex-direction: column; background: #000; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.term-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; background: #1a1a1a; border-bottom: 1px solid var(--border); font-size: 0.85em; color: var(--accent); }
.term-actions { display: flex; gap: 4px; }
.term-panel.disconnected .term-frame { background: #000; }
.term-frame { flex: 1; border: none; width: 100%; }
.term-panel.fullscreen { position: fixed; inset: 0; z-index: 1100; border-radius: 0; }

/* ───── commands ───── */
.cmd-search { width: 100%; padding: 10px 14px; background: #111; border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 0.9em; margin-bottom: 14px; }
.cmd-section { margin-bottom: 10px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.cmd-sec-head { background: #161616; padding: 10px 14px; font-weight: 600; font-size: 0.88em; color: var(--accent); cursor: pointer; }
.cmd-sec-head::before { content: '▾ '; color: var(--muted); }
.cmd-section.collapsed .cmd-sec-head::before { content: '▸ '; }
.cmd-section.collapsed .cmd-sec-body { display: none; }
.cmd-row { display: flex; align-items: center; gap: 10px; padding: 7px 14px; border-top: 1px solid #1e1e1e; font-size: 0.82em; }
.cmd-text { color: var(--accent); font-family: 'Consolas', monospace; white-space: pre-wrap; word-break: break-all; }
.cmd-row.danger .cmd-text { color: var(--red); }
.cmd-desc { color: var(--muted); flex: 1; font-family: 'Consolas', monospace; }
.copy-btn { flex-shrink: 0; }
.cmd-badge { font-size: 0.62em; padding: 2px 6px; border-radius: 4px; font-weight: 700; white-space: nowrap; }
.cmd-badge.crit { color: var(--orange); border: 1px solid #ffaa0055; background: #ffaa0011; }
.cmd-badge.dang { color: var(--red); border: 1px solid #ff444455; background: #ff444411; }

/* ───── terminal slide panel ───── */
#terminal-panel { display: none; position: fixed; bottom: 0; left: 230px; right: 0; height: 55vh; min-height: 350px; background: #000; border-top: 2px solid var(--accent); z-index: 1000; flex-direction: column; }
#terminal-panel.open { display: flex; }
#terminal-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; background: #1a1a1a; border-bottom: 1px solid var(--border); }
#terminal-title { color: var(--accent); font-weight: 600; font-size: 0.9em; }
#terminal-close { background: var(--red); color: #fff; border: none; border-radius: 5px; padding: 4px 12px; cursor: pointer; font-weight: 600; }
#terminal-iframe { flex: 1; border: none; width: 100%; }

/* ───── command terminal panel (TASK 19) ───── */
#cmd-panel { display: none; position: fixed; bottom: 0; left: 230px; right: 0; height: 280px; background: #0a0a0a; border-top: 2px solid var(--accent); z-index: 1050; flex-direction: column; }
#cmd-panel.open { display: flex; }
#cmd-resize { height: 6px; cursor: ns-resize; background: #1a1a1a; }
#cmd-panel-head { display: flex; justify-content: space-between; align-items: center; background: #161616; border-bottom: 1px solid var(--border); padding: 2px 8px; }
#cmd-tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; }
.cmd-tab { padding: 5px 10px; font-size: 0.74em; background: #1a1a1a; color: var(--muted); border: 1px solid var(--border); border-bottom: none; border-radius: 5px 5px 0 0; cursor: pointer; white-space: nowrap; font-family: 'Consolas', monospace; }
.cmd-tab.active { color: var(--accent); background: #0a0a0a; border-color: var(--accent); }
.cmd-panel-actions { display: flex; gap: 4px; flex-shrink: 0; }
#cmd-output { flex: 1; margin: 0; padding: 10px 12px; overflow: auto; font-family: 'Consolas', monospace; font-size: 0.78em; color: var(--green); white-space: pre-wrap; }
@media (max-width: 768px) { #cmd-panel { left: 0; } }

/* ───── log drawer (TASK 23) ───── */
#log-drawer { position: fixed; top: 0; right: 0; width: min(620px, 92vw); height: 100vh; background: #0a0a0a; border-left: 2px solid var(--accent); z-index: 1200; transform: translateX(100%); transition: transform 0.2s ease; display: flex; flex-direction: column; box-shadow: var(--shadow); }
#log-drawer.open { transform: translateX(0); }
#log-drawer-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #161616; border-bottom: 1px solid var(--border); }
#log-drawer-title { color: var(--accent); font-weight: 600; font-size: 0.9em; flex-shrink: 0; }
#log-drawer-search { flex: 1; background: #111; border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 5px 10px; font-size: 0.8em; }
#log-drawer-body { flex: 1; margin: 0; padding: 12px 14px; overflow: auto; font-family: 'Ubuntu Mono', monospace; font-size: 0.78em; color: var(--green); white-space: pre-wrap; }

/* ───── disk rings (TASK 23) ───── */
.disk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.disk-card { display: flex; align-items: center; gap: 10px; background: #111; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.disk-info { min-width: 0; }
.disk-label { font-size: 0.82em; }
.disk-sub { font-size: 0.72em; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ───── sidebar machine tooltip (TASK 23) ───── */
#machine-tip { display: none; position: fixed; z-index: 1300; background: #1a1a1a; border: 1px solid var(--accent); border-radius: 8px; padding: 8px 12px; font-size: 0.78em; box-shadow: var(--shadow); pointer-events: none; white-space: nowrap; }

/* home CPU gauge sits inline in the machine card */
.mc-stats .mc-val .gauge { margin-top: 2px; }

/* ───── modal ───── */
#modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 1300; align-items: center; justify-content: center; }
#modal-overlay.open { display: flex; }
#modal-box { background: var(--card); border: 1px solid var(--border); border-radius: 10px; width: min(800px, 92vw); max-height: 80vh; display: flex; flex-direction: column; }
#modal-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--accent); font-weight: 600; }
#modal-header button { background: none; border: none; color: var(--muted); font-size: 1.1em; cursor: pointer; }
#modal-body { padding: 14px 16px; overflow: auto; font-family: 'Consolas', monospace; font-size: 0.78em; white-space: pre-wrap; color: var(--text); }

/* ───── toasts ───── */
#toast-container { position: fixed; top: 16px; right: 16px; z-index: 1400; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 10px 16px; border-radius: 8px; font-size: 0.85em; color: #fff; opacity: 0; transform: translateX(40px); transition: all 0.3s; box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
.toast.show { opacity: 1; transform: translateX(0); }
.toast.success { background: #1d7a4d; border: 1px solid var(--green); }
.toast.error { background: #7a1d1d; border: 1px solid var(--red); }
.toast.info { background: #1d4e7a; border: 1px solid var(--info); }
.nav-sub.active, .nav-item.active { box-shadow: inset 2px 0 0 var(--accent); }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.qa-btn { padding: 8px 14px; border: 1px solid var(--border); background: #111; color: var(--text); border-radius: 8px; cursor: pointer; font-size: 0.82em; }
.qa-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ───── iframe pages (Pi5 files/photos) ───── */
.iframe-page { position: relative; }
.iframe-page.active { display: block; }
.full-iframe { width: 100%; height: calc(100dvh - 48px); border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.iframe-open { position: absolute; top: 10px; right: 14px; z-index: 5; background: var(--accent); color: #000; padding: 6px 12px; border-radius: 6px; text-decoration: none; font-size: 0.78em; font-weight: 600; }

/* ───── minecraft ───── */
.mc-statusline { font-size: 0.9em; color: var(--muted); }
.sub-title { font-size: 0.75em; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.chip { display: inline-block; background: #1d3a2a; color: var(--green); border: 1px solid #00ff8844; border-radius: 12px; padding: 3px 12px; font-size: 0.8em; margin: 0 6px 6px 0; }
.rcon-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.rcon-input { display: flex; gap: 8px; margin-bottom: 12px; }
.rcon-input input { flex: 1; padding: 8px 12px; background: #111; border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-family: 'Consolas', monospace; }
.rcon-output { background: #000; border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-family: 'Consolas', monospace; font-size: 0.8em; color: var(--green); white-space: pre-wrap; max-height: 280px; overflow: auto; }
.rd-frame { width: 100%; height: 600px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }

/* ───── release calendar (TASK 28) ───── */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-day { background: #111; border: 1px solid var(--border); border-radius: 8px; padding: 6px; min-height: 70px; }
.cal-date { font-size: 0.72em; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.cal-empty { color: var(--text-muted, #555); font-size: 0.8em; }
.cal-item { font-size: 0.68em; padding: 3px 5px; border-radius: 4px; margin-bottom: 4px; background: #1a1a1a; border-left: 2px solid var(--muted); overflow: hidden; }
.cal-item.cyan { border-left-color: var(--accent); } .cal-item.orange { border-left-color: var(--orange); }
.cal-sub { color: var(--muted); }

/* ───── minecraft log box (TASK 28) ───── */
.log-box { background: #000; border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-family: 'Ubuntu Mono', monospace; font-size: 0.74em; color: #cfcfcf; white-space: pre-wrap; max-height: 320px; overflow: auto; }
.log-box .log-err { color: var(--red); } .log-box .log-warn { color: var(--orange); } .log-box .log-join { color: var(--green); }

@media (max-width: 768px) { .cal-grid { grid-template-columns: repeat(3, 1fr); } }

/* ═══════════════ THEMES (TASK 38) — override core vars by data-theme ═══════════════ */
:root[data-theme="oled"]      { --bg:#000000; --sidebar:#060606; --card:#0a0a0a; --bg-elevated:#141414; --border:#1a1a1a; --text:#ffffff; --muted:#777; }
:root[data-theme="dracula"]   { --bg:#282a36; --sidebar:#21222c; --card:#343746; --bg-elevated:#424450; --border:#44475a; --text:#f8f8f2; --muted:#6272a4; --text-dim:#bcc; --accent:#bd93f9; --info:#bd93f9; --green:#50fa7b; --red:#ff5555; --orange:#ffb86c; --purple:#bd93f9; }
:root[data-theme="nord"]      { --bg:#2e3440; --sidebar:#2b303b; --card:#3b4252; --bg-elevated:#434c5e; --border:#434c5e; --text:#eceff4; --muted:#7b88a1; --text-dim:#d8dee9; --accent:#88c0d0; --info:#88c0d0; --green:#a3be8c; --red:#bf616a; --orange:#d08770; --purple:#b48ead; }
:root[data-theme="catppuccin"]{ --bg:#1e1e2e; --sidebar:#181825; --card:#313244; --bg-elevated:#45475a; --border:#45475a; --text:#cdd6f4; --muted:#7f849c; --text-dim:#bac2de; --accent:#89b4fa; --info:#89b4fa; --green:#a6e3a1; --red:#f38ba8; --orange:#fab387; --purple:#cba6f7; }
:root[data-theme="gruvbox"]   { --bg:#282828; --sidebar:#1d2021; --card:#3c3836; --bg-elevated:#504945; --border:#504945; --text:#ebdbb2; --muted:#a89984; --text-dim:#d5c4a1; --accent:#83a598; --info:#83a598; --green:#b8bb26; --red:#fb4934; --orange:#fe8019; --purple:#d3869b; }
:root[data-theme="solarized"] { --bg:#002b36; --sidebar:#073642; --card:#073642; --bg-elevated:#0a4b5a; --border:#0a4b5a; --text:#93a1a1; --muted:#586e75; --text-dim:#839496; --accent:#268bd2; --info:#268bd2; --green:#859900; --red:#dc322f; --orange:#cb4b16; --purple:#6c71c4; }
:root[data-theme="light"]     { --bg:#f5f5f5; --sidebar:#ffffff; --card:#ffffff; --bg-elevated:#eef0f2; --border:#e0e0e0; --text:#1a1a1a; --muted:#888; --text-dim:#555; --text-muted:#888; --card-hover:#f0f0f0; --accent:#0066cc; --info:#0066cc; --green:#16a34a; --red:#dc2626; --orange:#ea580c; }

/* Appearance toggles */
:root[data-font="small"]  { font-size: 14px; }
:root[data-font="medium"] { font-size: 15.5px; }
:root[data-font="large"]  { font-size: 17.5px; }
:root[data-sidebar="compact"] #sidebar { width:185px; min-width:185px; }
:root[data-sidebar="wide"]    #sidebar { width:280px; min-width:280px; }
:root[data-card="minimal"] .card { border-color: transparent; box-shadow: none; }
:root[data-card="bordered"] .card { border-width: 1px; border-color: var(--accent); }
:root[data-card="glass"] .card { background: color-mix(in srgb, var(--card) 60%, transparent); backdrop-filter: blur(10px); }
:root[data-anim="none"] *, :root[data-anim="none"] *::before, :root[data-anim="none"] *::after { transition: none !important; animation: none !important; }
:root[data-bg="grid"] body  { background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 32px 32px; }
:root[data-bg="dots"] body  { background-image: radial-gradient(var(--border) 1px, transparent 1px); background-size: 22px 22px; }

/* Settings page */
.settings-section { margin-bottom: 22px; }
.settings-section h3 { font-size: 0.8em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; letter-spacing: 0.5px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.set-row:last-child { border-bottom: none; }
.set-label { font-size: 0.88em; }
.set-label small { display: block; color: var(--muted); font-size: 0.8em; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px,1fr)); gap: 10px; width: 100%; }
.theme-swatch { cursor: pointer; border: 2px solid var(--border); border-radius: 8px; overflow: hidden; transition: border-color .15s; }
.theme-swatch.active { border-color: var(--accent); }
.theme-swatch-prev { height: 46px; display: flex; }
.theme-swatch-prev span { flex: 1; }
.theme-swatch-name { font-size: 0.74em; padding: 5px 7px; text-align: center; }
.seg { display: inline-flex; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.seg button { background: transparent; border: none; color: var(--muted); font-size: 0.8em; padding: 6px 12px; cursor: pointer; }
.seg button.active { background: var(--accent); color: #000; font-weight: 600; }
.accent-swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.accent-dot { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.accent-dot.active { border-color: var(--text); }

/* ───── pages / misc ───── */
.page { display: none; }
.page.active { display: block; }
.loading { color: var(--muted); font-size: 0.85em; padding: 8px 0; display: block; }

/* ───── Gateway page (TASK 33/34) ───── */
.update-dot { display: none; width: 7px; height: 7px; border-radius: 50%; background: var(--orange); margin-left: auto; box-shadow: 0 0 6px var(--orange); }
.gw-toolbar { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; margin-bottom: 14px; }
.gw-tabs { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.gw-tab { background: transparent; border: none; color: var(--muted); font-size: 0.8em; padding: 5px 11px; border-radius: 6px; cursor: pointer; }
.gw-tab.active { background: var(--accent); color: #000; font-weight: 600; }
.gw-layout { display: grid; grid-template-columns: 40% 60%; gap: 16px; align-items: start; }
.gw-cat-filters { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.gw-chip { background: #181818; border: 1px solid var(--border); color: var(--muted); font-size: 0.72em; padding: 4px 9px; border-radius: 12px; cursor: pointer; }
.gw-chip.active { color: var(--text); border-color: var(--accent); background: #00d4ff15; }
#gw-events { max-height: 72vh; overflow-y: auto; }
.gw-ev { display: flex; gap: 10px; padding: 9px 6px; border-bottom: 1px solid #1c1c1c; border-left: 3px solid var(--border); padding-left: 9px; }
.gw-ev.sev-red { border-left-color: var(--red); }
.gw-ev.sev-orange { border-left-color: var(--orange); }
.gw-ev.sev-cyan { border-left-color: var(--accent); }
.gw-ev-ico { font-size: 1.1em; line-height: 1.4; }
.gw-ev-body { flex: 1; min-width: 0; }
.gw-ev-title { font-size: 0.84em; color: var(--text); }
.gw-ev-meta { font-size: 0.72em; color: var(--muted); margin-top: 2px; }
.gw-ev-detail { font-size: 0.74em; color: var(--purple); margin-top: 2px; }
a.link, .link { color: var(--accent); text-decoration: none; font-size: 0.78em; }
.np-row { padding: 8px 4px; border-bottom: 1px solid #1c1c1c; font-size: 0.9em; display: flex; align-items: center; gap: 8px; }
.np-row:last-child { border-bottom: none; }
a.link:hover { text-decoration: underline; }
.gw-ver-table { width: 100%; border-collapse: collapse; font-size: 0.84em; }
.gw-ver-table td { padding: 5px 4px; border-bottom: 1px solid #1c1c1c; }
.gw-analytics-col .card, .gw-feed-col .card { margin-bottom: 14px; }
.spark-wrap { position: relative; }
canvas.spark-lg { width: 100%; height: 90px; display: block; cursor: crosshair; }
.tooltip { position: absolute; background: #222; border: 1px solid var(--border); color: var(--text); font-size: 0.75em; padding: 4px 8px; border-radius: 4px; pointer-events: none; display: none; top: 0; }
.gw-bars { display: flex; flex-direction: column; gap: 4px; }
.gw-bar-row { display: flex; align-items: center; gap: 8px; font-size: 0.76em; }
.gw-bar-lbl { width: 42px; color: var(--muted); flex-shrink: 0; }
.gw-bar-track { flex: 1; height: 10px; background: #181818; border-radius: 5px; overflow: hidden; }
.gw-bar-fill { display: block; height: 100%; border-radius: 5px; transition: width 0.3s; }
.gw-bar-val { width: 90px; text-align: right; color: #999; flex-shrink: 0; }
@media (max-width: 900px) { .gw-layout { grid-template-columns: 1fr; } #gw-events { max-height: 50vh; } }
.queue-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.queue-fname { font-size: 0.7em; color: var(--muted); font-family: 'Ubuntu Mono', monospace; margin-top: 4px; word-break: break-all; }

/* ───── Full queue slide-up drawer (TASK 30) ───── */
#queue-drawer { position: fixed; left: 220px; right: 0; bottom: 0; height: 60vh; background: var(--card); border-top: 1px solid var(--border); box-shadow: 0 -8px 30px rgba(0,0,0,0.5); transform: translateY(100%); transition: transform 0.2s ease; z-index: 1400; display: flex; flex-direction: column; }
#queue-drawer.open { transform: translateY(0); }
#queue-drawer-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--border); }
#queue-drawer-title { font-weight: 600; }
.qd-tabs { display: flex; gap: 3px; }
#queue-drawer-body { flex: 1; overflow-y: auto; padding: 12px 14px; }
@media (max-width: 768px) { #queue-drawer { left: 0; height: 75vh; } }

/* ───── Jellyfin library browser (TASK 31) ───── */
.jf-card { cursor: pointer; transition: border-color 0.15s; }
.jf-card:hover { border-color: var(--accent); }
.jf-br-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.jf-br-search { flex: 1; min-width: 140px; margin: 0; }
.jf-br-sort { background: #181818; color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font-size: 0.82em; }
.jf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.jf-item { position: relative; cursor: pointer; background: #141414; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; transition: transform 0.12s, border-color 0.12s; }
.jf-item:hover { transform: translateY(-2px); border-color: var(--accent); }
.jf-poster { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; background: #0c0c0c; }
.jf-poster.placeholder { display: flex; align-items: center; justify-content: center; font-size: 2em; }
.jf-watched-tick { position: absolute; top: 6px; right: 6px; background: var(--green); color: #000; font-size: 0.7em; font-weight: 700; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.jf-item-title { font-size: 0.78em; padding: 6px 6px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jf-item-sub { font-size: 0.7em; color: var(--muted); padding: 0 6px; }
.jf-item-badges { display: flex; flex-wrap: wrap; gap: 3px; padding: 5px 6px 8px; }
.jf-detail { display: flex; gap: 12px; margin-bottom: 10px; }
.jf-detail-poster { width: 110px; border-radius: 8px; flex-shrink: 0; }
.jf-detail-title { font-weight: 600; font-size: 1em; margin-bottom: 6px; }
.jf-detail-sub { display: flex; flex-wrap: wrap; gap: 4px; }
.jf-kv { width: 100%; border-collapse: collapse; font-size: 0.8em; margin-top: 8px; }
.jf-kv td { padding: 5px 4px; border-bottom: 1px solid #1c1c1c; vertical-align: top; }
.jf-kv td:first-child { color: var(--muted); width: 90px; white-space: nowrap; }
.jf-season { font-size: 0.8em; color: var(--accent); margin: 10px 0 4px; font-weight: 600; }
@media (max-width: 600px) { .jf-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); } .jf-detail-poster { width: 80px; } }

/* ───── Stat deep-dive drawer (TASK 32) ───── */
.stat-box, .disk-card { cursor: pointer; }
.stat-box:hover, .disk-card:hover { border-color: var(--accent); }
#drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1500; opacity: 0; pointer-events: none; transition: opacity 0.15s; }
#drawer-overlay.open { opacity: 1; pointer-events: auto; }
#drawer { position: absolute; top: 0; right: 0; bottom: 0; width: 480px; max-width: 92vw; background: var(--card); border-left: 1px solid var(--border); box-shadow: -8px 0 30px rgba(0,0,0,0.5); transform: translateX(100%); transition: transform 0.2s ease; overflow-y: auto; padding: 16px; }
#drawer-overlay.open #drawer { transform: translateX(0); }
#drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
#drawer-title { font-weight: 600; font-size: 1.05em; }
.drawer-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 6px; }
.drawer-stats > div { background: #181818; border: 1px solid var(--border); border-radius: 8px; padding: 8px; text-align: center; }
.ds-lbl { display: block; font-size: 0.68em; color: var(--muted); text-transform: uppercase; }
.ds-val { display: block; font-size: 1em; color: var(--text); margin-top: 3px; }
.drawer-h { font-size: 0.8em; color: var(--muted); text-transform: uppercase; margin: 14px 0 6px; }
.drawer-note { font-size: 0.85em; color: var(--text-dim, #999); margin: 8px 0; }
@media (max-width: 768px) { #drawer { width: 100%; max-width: 100vw; } }

/* ───── minimal scrollbars ───── */
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
#sidebar::-webkit-scrollbar { width: 3px; }

/* ───── responsive ───── */
@media (max-width: 768px) {
    .downloads-grid { grid-template-columns: 1fr; }
}

/* ═══════════════ NAV REDESIGN — home sidebar vs full-screen + drawer ═══════════════ */
#sidebar { width: 240px; min-width: 240px; padding: 10px 0; display: flex; flex-direction: column; overflow-x: hidden; }
#sidebar h1 { font-size: 1em; padding: 6px 16px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; white-space: nowrap; }
.nav-spacer { flex: 1; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 16px; cursor: pointer; color: var(--text-dim); border-left: 3px solid transparent; white-space: nowrap; overflow: hidden; transition: background .12s, color .12s; }
.nav-item:hover { background: var(--card); color: var(--text); }
.nav-item.active { color: var(--text); background: var(--card); border-left-color: var(--mc, var(--accent)); }
.nav-item .nav-ico { font-size: 1.05em; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item .sdot { flex-shrink: 0; }
.nav-item .update-dot { margin-left: auto; }
#sidebar-footer { padding: 8px 16px; }

#app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
#main { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; }

/* Tab bar (full-screen pages) — 40px, hamburger embedded at left */
#tabbar { display: flex; align-items: stretch; height: 40px; min-height: 40px; background: var(--sidebar); border-bottom: 1px solid var(--border); overflow-x: auto; overflow-y: hidden; }
.tab-ham { flex-shrink: 0; width: 44px; background: transparent; border: none; border-right: 1px solid var(--border); color: var(--text); font-size: 1.1em; cursor: pointer; }
.tab-ham:hover { background: var(--card); }
.tab { display: flex; align-items: center; padding: 0 16px; font-size: .85em; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; user-select: none; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-title { display: flex; align-items: center; padding: 0 14px; font-size: .9em; font-weight: 600; color: var(--text); }

/* ⋯ More overflow dropdown (NUC direct-app iframes) */
.tab-more { position: relative; }
/* position:fixed so it escapes #tabbar's overflow clipping; coords set in JS */
.more-menu { display: none; position: fixed; min-width: 160px; background: var(--card); border: 1px solid var(--border); border-radius: 0 0 8px 8px; box-shadow: 0 8px 24px rgba(0,0,0,.5); z-index: 200; overflow: hidden; }
.more-menu.open { display: block; }
.more-item { padding: 9px 16px; font-size: .85em; color: var(--muted); white-space: nowrap; cursor: pointer; border-left: 2px solid transparent; }
.more-item:hover { background: var(--sidebar); color: var(--text); }
.more-item.active { color: var(--text); border-left-color: var(--accent); }

/* Gateway tab-sections */
.gw-section { display: none; }
.gw-section.active { display: block; }
.gw-analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }

/* ── Layout HOME: persistent sidebar, no tab bar ── */
body.layout-home #tabbar { display: none; }
body.layout-home #sidebar { position: relative; transform: none; transition: margin-left .25s ease-in-out; }
body.layout-home.leaving #sidebar { margin-left: -240px; }   /* slide away on navigate */

/* ── Layout FULL: full-screen content, sidebar becomes a left drawer ── */
body.layout-full #sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 260px; min-width: 260px; z-index: 1100;
    transform: translateX(-100%); transition: transform .25s ease; box-shadow: 4px 0 24px rgba(0,0,0,.5);
}
body.layout-full.drawer-open #sidebar { transform: translateX(0); }
body.layout-full #app-main { width: 100%; }
#navdrawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 1090; opacity: 0; pointer-events: none; transition: opacity .25s ease; }
body.layout-full.drawer-open #navdrawer-overlay { opacity: 1; pointer-events: auto; }

/* mobile top bar (home page only, mobile only) */
#mtop { display: none; align-items: center; gap: 8px; height: 48px; min-height: 48px; padding: 0 6px; background: var(--sidebar); border-bottom: 1px solid var(--border); }
#mtop .mtop-title { font-weight: 600; font-size: .95em; }

@media (max-width: 768px) {
    /* On phones EVERY layout uses the off-canvas drawer — no sidebar stealing width.
       Scoped to body.layout-* so it beats the desktop `body.layout-home #sidebar`
       (relative/visible) rule by equal-specificity-but-later source order. */
    body.layout-home #sidebar, body.layout-full #sidebar {
        position: fixed !important; top: 0; left: 0; bottom: 0; width: 84%; min-width: 84%; max-width: 320px;
        z-index: 1100; transform: translateX(-100%) !important; transition: transform .25s ease;
        box-shadow: 4px 0 24px rgba(0,0,0,.55); overflow-y: auto; margin-left: 0 !important; }
    body.layout-home.drawer-open #sidebar, body.layout-full.drawer-open #sidebar { transform: translateX(0) !important; }
    body.drawer-open #navdrawer-overlay { opacity: 1; pointer-events: auto; }
    body.layout-home #app-main, body.layout-full #app-main { width: 100%; }
    body.layout-home #mtop { display: flex; }      /* hamburger for the home page */
    #main { padding: 12px; }
    /* bigger touch targets */
    .nav-item { padding: 13px 16px; }
    .tab { padding: 0 15px; }
    .tab-ham { width: 48px; font-size: 1.25em; }
    .mini-btn, .terminal-btn { min-height: 36px; }
    /* let wide content (tables, etc.) scroll inside its card instead of breaking the page */
    .card { overflow-x: auto; }
    /* hero stacks cleanly */
    .home-hero { gap: 10px; }
    .hero-clock, .hero-weather, .hero-links { flex: 1 1 100%; min-width: 0; }
    #home-clock-time { font-size: 2.6em; }
    /* drawer & overlay sizes */
    #drawer { width: 100%; max-width: 100vw; }
    #queue-drawer { left: 0; }
}

/* Terminals: full-bleed under the 40px tab bar, one terminal visible at a time */
#term-grid { grid-template-columns: 1fr; height: calc(100vh - 40px); gap: 0; }
#term-grid .term-panel { height: 100%; display: flex; flex-direction: column; }
#term-grid .term-frame { flex: 1; width: 100%; height: 100%; border: 0; }

/* ═══════════════ Links: resizable + editable bento (TASK 41) ═══════════════ */
.links-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.links-bento { display: grid; grid-template-columns: repeat(auto-fill, 150px); grid-auto-rows: 120px; gap: 12px; justify-content: start; }
.link-tile { position: relative; background: #111; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; transition: border-color .15s; }
.link-tile:hover { border-color: var(--accent); }
.link-tile-body { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; height: 100%; padding: 12px; text-decoration: none; color: var(--text); text-align: center; }
.link-tile .link-ico { font-size: 1.9em; line-height: 1; }
.link-tile .link-name { font-size: .85em; font-weight: 600; }
.link-tile .link-desc { font-size: .7em; color: var(--muted); overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.link-tile .link-status { position: absolute; top: 8px; right: 8px; }
.links-bento.editing .link-tile { cursor: grab; border-style: dashed; }
.link-tile.dragging { opacity: .4; }
.tile-edit { position: absolute; top: 6px; left: 6px; display: flex; gap: 4px; z-index: 2; }
.tile-btn { background: var(--card); border: 1px solid var(--border); border-radius: 4px; color: var(--text); font-size: .72em; cursor: pointer; padding: 1px 5px; line-height: 1.4; }
.tile-btn.stop { color: var(--red); }
.tile-resize { position: absolute; bottom: 0; right: 0; width: 18px; height: 18px; cursor: nwse-resize; background: linear-gradient(135deg, transparent 45%, var(--accent) 45%, var(--accent) 100%); z-index: 2; }
.link-form-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 14px; }
.link-form-box input, .link-form-box select { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 7px 9px; font-size: .85em; }
@media (max-width: 768px) { .links-bento { grid-template-columns: repeat(auto-fill, 130px); grid-auto-rows: 110px; } }

/* ntfy notification settings */
.ntf-cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.ntf-cat { display: flex; align-items: center; gap: 8px; font-size: 0.85em; color: var(--text); cursor: pointer; padding: 6px 0; }
.ntf-cat input { width: 16px; height: 16px; }

/* Jellyfin stream controls + media-request results */
.np-ctrls { display: flex; gap: 6px; margin-top: 8px; }
.np-ctrls .mini-btn { padding: 3px 10px; }
#js-search-results:empty { display: none; }
#js-search-results { margin-top: 12px; }

/* Links live-stat widget tiles */
.widget-tile { background: #111; }
.widget-tile .wid-head { font-size: .72em; color: var(--muted); text-transform: uppercase; padding: 8px 10px 4px; }
.widget-tile .wid-body { padding: 4px 10px 10px; }
.widget-tile .wid-big { font-size: 1.6em; font-weight: 700; color: var(--text); line-height: 1.1; }
.widget-tile .wid-sub { font-size: .72em; color: var(--muted); margin-top: 2px; }
.widget-tile .np-bar { margin-top: 6px; }

/* Content pipeline stepper */
.pipe-row { padding: 12px 0; border-bottom: 1px solid #1c1c1c; }
.pipe-row:last-child { border-bottom: none; }
.pipe-title { font-size: 0.88em; margin-bottom: 10px; }
.pipe-track { display: flex; align-items: center; }
.pipe-step { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.pipe-dot { width: 14px; height: 14px; border-radius: 50%; background: #2a2a2a; border: 2px solid #2a2a2a; }
.pipe-lbl { font-size: 0.68em; color: var(--muted); white-space: nowrap; }
.pipe-line { flex: 1; height: 2px; background: #2a2a2a; margin: 0 6px; align-self: flex-start; margin-top: 6px; }
.pipe-step.done .pipe-dot { background: var(--green); border-color: var(--green); }
.pipe-step.done .pipe-lbl { color: var(--text-dim, #999); }
.pipe-step.now .pipe-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-dim, #00d4ff33); animation: pulse 2s infinite; }
.pipe-step.now .pipe-lbl { color: var(--accent); font-weight: 600; }

/* ═══════════════ Burn to Disc ═══════════════ */
.burn-wrap { max-width: 880px; margin: 0 auto; padding: 14px; }
.burn-steps { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.burn-step { font-size: .8rem; color: var(--muted); padding: 4px 10px; border: 1px solid var(--border); border-radius: 20px; }
.burn-step.active { color: var(--accent); border-color: var(--accent); }
.burn-disc { padding: 8px 12px; border-radius: var(--radius-sm, 6px); margin-bottom: 12px; font-size: .85rem; border: 1px solid var(--border); background: var(--card); }
.burn-disc.ok { border-color: var(--green); color: var(--green); }
.burn-disc.warn { border-color: var(--orange); color: var(--orange); }
.burn-disc.err { border-color: var(--red); color: var(--red); }
.burn-pane { display: none; }
.burn-pane.active { display: block; }
.burn-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin: 12px 0; max-height: 46vh; overflow-y: auto; }
.burn-card { display: flex; align-items: center; gap: 8px; padding: 8px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm, 6px); cursor: pointer; transition: border-color .15s; }
.burn-card:hover { border-color: var(--accent); }
.burn-card.sel { border-color: var(--green); background: var(--accent-dim, #00d4ff14); }
.burn-card-ico { font-size: 1.3rem; }
.burn-card-body { flex: 1; min-width: 0; }
.burn-card-title { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.burn-card-sub { font-size: .72rem; color: var(--muted); }
.burn-card-add { font-weight: 700; color: var(--accent); width: 18px; text-align: center; }
.burn-tray { min-height: 36px; padding: 8px; border: 1px dashed var(--border); border-radius: var(--radius-sm, 6px); margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.burn-chip { background: var(--bg-elevated, #1a1a1a); border: 1px solid var(--border); border-radius: 14px; padding: 3px 10px; font-size: .78rem; }
.burn-chip b { color: var(--red); cursor: pointer; margin-left: 4px; }
.burn-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.burn-go { background: var(--orange); color: #000; font-weight: 600; }
.burn-go:disabled { opacity: .4; cursor: not-allowed; }
.burn-chk { display: block; font-size: .85rem; padding: 4px 0; cursor: pointer; }
#page-burn .card { margin-bottom: 10px; }
#page-burn select, #page-burn input[type=text] { background: var(--bg-elevated, #1a1a1a); color: var(--text, #f0f0f0); border: 1px solid var(--border); border-radius: var(--radius-sm, 6px); padding: 6px 8px; }
.burn-est-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: .85rem; border-bottom: 1px solid var(--border-subtle, #1f1f1f); }
.burn-est-row b.ok { color: var(--green); } .burn-est-row b.err { color: var(--red); }
.burn-cap { height: 10px; background: var(--border); border-radius: 5px; overflow: hidden; margin: 8px 0; }
.burn-cap-fill { height: 100%; background: var(--green); transition: width .3s; }
.burn-cap-fill.err { background: var(--red); }
.burn-progress { height: 16px; background: var(--border); border-radius: 8px; overflow: hidden; margin: 10px 0; }
.burn-progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.burn-progress-fill.burning { background: var(--orange); }
.burn-progress-fill.done { background: var(--green); }
.burn-prog-meta { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin: 4px 0; }
.burn-log { background: #000; color: #9fe; font-family: 'Ubuntu Mono', monospace; font-size: .72rem; padding: 8px; border-radius: var(--radius-sm, 6px); max-height: 200px; overflow-y: auto; white-space: pre-wrap; margin: 8px 0; }
.burn-disc-list { margin: 8px 0; border-top: 1px solid var(--border-subtle, #1f1f1f); padding-top: 6px; }
.burn-disc-line { font-size: .78rem; color: var(--muted); padding: 2px 0; }
