/* ═══════════════════════════════════════════════════════════════════════════
   TrackerX Dashboard — alltracker.org inspired UI
   ═══════════════════════════════════════════════════════════════════════════ */

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

:root {
    --bg: #1a1d2e;
    --bg2: #141625;
    --bg3: #0f1020;
    --sidebar-bg: #141625;
    --sidebar-w: 190px;
    --card: #1e2235;
    --card2: #252840;
    --border: #2a2d45;
    --text: #c8ccd8;
    --text2: #7c82a0;
    --text3: #4a5070;
    --accent: #f97316;
    --accent2: #a855f7;
    --green: #22c55e;
    --red: #ef4444;
    --blue: #3b82f6;
    --yellow: #eab308;
    --topbar-h: 44px;
    --footer-h: 32px;
}

html,
body {
    height: 100%;
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    overflow: hidden;
}

/* ── APP SHELL ─────────────────────────────────────────────────────────────── */
.app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── SIDEBAR ───────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 50;
    transition:
        width 0.25s ease,
        min-width 0.25s ease;
}

.sidebar.collapsed {
    width: 0;
    min-width: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 14px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.logo-icon {
    font-size: 18px;
    color: var(--accent);
    line-height: 1;
}

.logo-text {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Device list in sidebar */
.sidebar-device {
    padding: 10px 10px 6px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    max-height: 160px;
    overflow-y: auto;
}

.sidebar-device::-webkit-scrollbar {
    width: 3px;
}
.sidebar-device::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.no-device-sidebar {
    font-size: 11px;
    color: var(--text3);
    padding: 4px 4px 6px;
    text-align: center;
}

.dev-entry {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 2px;
    border: 1px solid transparent;
}

.dev-entry:hover {
    background: var(--card2);
}

.dev-entry.active {
    background: var(--card2);
    border-color: var(--border);
}

.dev-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dev-dot.online {
    background: var(--green);
    box-shadow: 0 0 5px var(--green);
}
.dev-dot.offline {
    background: var(--text3);
}

.dev-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.dev-batt {
    font-size: 10px;
    color: var(--text2);
    flex-shrink: 0;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 8px;
}

.sidebar-nav::-webkit-scrollbar {
    width: 3px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--text2);
    text-decoration: none;
    font-size: 12.5px;
    cursor: pointer;
    transition:
        background 0.15s,
        color 0.15s;
    margin-bottom: 1px;
    white-space: nowrap;
    user-select: none;
}

.nav-item:hover {
    background: var(--card2);
    color: var(--text);
}

.nav-item.active {
    background: var(--card2);
    color: #fff;
    border-left: 2px solid var(--accent);
    padding-left: 8px;
}

.nav-icon {
    font-size: 13px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
    color: var(--accent);
    font-style: normal;
}

.nav-item.active .nav-icon {
    color: var(--accent);
}

/* Sidebar bottom */
.sidebar-bottom {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0 10px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.sidebar-user-icon {
    font-size: 14px;
    opacity: 0.7;
    flex-shrink: 0;
}

.sidebar-user-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-logout-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 14px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        background 0.15s,
        color 0.15s,
        border-color 0.15s;
    flex-shrink: 0;
    padding: 0;
}

.sidebar-logout-btn:hover {
    background: rgba(218, 54, 51, 0.12);
    border-color: #da3633;
    color: #f85149;
}

.conn-status {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    white-space: nowrap;
}

.conn-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.conn-status.connected .conn-dot {
    background: var(--green);
    animation: pulse 2s infinite;
}
.conn-status.disconnected .conn-dot {
    background: var(--red);
}
.conn-status.connected .conn-label {
    color: var(--green);
}
.conn-status.disconnected .conn-label {
    color: var(--red);
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

/* ── MAIN ──────────────────────────────────────────────────────────────────── */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ── STATUS BAR ────────────────────────────────────────────────────────────── */
.statusbar {
    height: var(--topbar-h);
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    flex-shrink: 0;
}

.statusbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.hamburger {
    background: none;
    border: none;
    color: var(--text2);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s;
    line-height: 1;
}
.hamburger:hover {
    background: var(--card2);
    color: var(--text);
}

.page-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.statusbar-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
}

.pill {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 99px;
    padding: 3px 10px;
    font-size: 11.5px;
    color: var(--text2);
    white-space: nowrap;
}

.pill-icon {
    font-size: 10px;
}

.pill-battery {
    border-color: #166534;
}
.pill-battery .pill-icon {
    color: var(--green);
}

.pill-network {
    border-color: #1e3a5f;
}
.pill-network .pill-icon {
    color: var(--blue);
}

.pill-signal {
    border-color: #3b2b5c;
}
.pill-signal .pill-icon {
    color: #a78bfa;
}

.pill-ip .pill-icon {
    color: var(--text3);
}

.statusbar-right {
    flex-shrink: 0;
}

.lastseen-text {
    font-size: 11px;
    color: var(--text3);
    white-space: nowrap;
}

/* ── PAGES ─────────────────────────────────────────────────────────────────── */
.pages {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.page {
    display: none;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.page.active {
    display: flex;
    flex-direction: column;
}

.page::-webkit-scrollbar {
    width: 5px;
}
.page::-webkit-scrollbar-track {
    background: transparent;
}
.page::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* ── EMPTY STATE ───────────────────────────────────────────────────────────── */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    text-align: center;
}

.empty-icon {
    font-size: 56px;
    opacity: 0.25;
    margin-bottom: 8px;
}

.empty-state h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text2);
}

.empty-state p {
    font-size: 13px;
    color: var(--text3);
    line-height: 1.7;
}

.server-url-hint {
    font-size: 12px;
    color: var(--text3);
    background: var(--bg2);
    border: 1px solid var(--border);
    padding: 6px 16px;
    border-radius: 6px;
    margin-top: 8px;
}

.server-url-hint code {
    font-family: monospace;
    color: var(--accent);
}

/* ── OVERVIEW ──────────────────────────────────────────────────────────────── */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    padding: 16px;
    align-content: start;
}

.ov-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.ov-card-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--text3);
    margin-bottom: 14px;
}

/* Battery in overview */
.ov-battery-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ov-battery-shell {
    position: relative;
    width: 100px;
    height: 22px;
    border: 2px solid var(--text3);
    border-radius: 4px;
    overflow: visible;
    flex-shrink: 0;
}

.ov-battery-shell::after {
    content: "";
    position: absolute;
    right: -7px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 10px;
    background: var(--text3);
    border-radius: 0 2px 2px 0;
}

.ov-battery-fill {
    height: 100%;
    border-radius: 2px;
    transition:
        width 0.5s,
        background 0.5s;
    background: var(--green);
}

.ov-battery-pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    mix-blend-mode: plus-lighter;
}

.ov-battery-meta {
    flex: 1;
}

.ov-meta-row {
    font-size: 12px;
    color: var(--text2);
    margin-bottom: 4px;
    line-height: 1.4;
}

/* Table in overview */
.ov-table {
    width: 100%;
    border-collapse: collapse;
}

.ov-table td {
    padding: 5px 0;
    font-size: 12px;
    border-bottom: 1px solid var(--border);
    line-height: 1.4;
    vertical-align: top;
}

.ov-table td:first-child {
    color: var(--text3);
    width: 40%;
    padding-right: 8px;
}

.ov-table td:last-child {
    color: var(--text);
    font-family: monospace;
    font-size: 11.5px;
    word-break: break-all;
}

.ov-table tr:last-child td {
    border-bottom: none;
}

/* ── BUTTONS ───────────────────────────────────────────────────────────────── */
.btn-small {
    font-size: 11px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: opacity 0.15s;
}

.btn-small:hover {
    opacity: 0.85;
}

.btn-accent {
    background: var(--accent);
    color: #fff;
}

.btn-google {
    background: #1a73e8;
    color: #fff;
}

/* ── MAP PAGE ──────────────────────────────────────────────────────────────── */
.page-map {
    position: relative;
}

.map-info-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 10px 16px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    color: var(--text2);
    flex-shrink: 0;
}

.map-info-bar #mapTimestamp {
    font-weight: 600;
    color: var(--text);
}

.map-wrap {
    flex: 1;
    position: relative;
    min-height: 300px;
}

#map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.map-coord-bar {
    display: flex;
    gap: 16px;
    padding: 7px 16px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    font-size: 11px;
    font-family: monospace;
    color: var(--text2);
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* Leaflet dark override */
.leaflet-container {
    background: #1a1d2e !important;
}
.leaflet-tile {
    filter: brightness(0.85) saturate(0.85);
}

.leaflet-control-zoom a {
    background: var(--card) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

/* ── STREAM PAGES ──────────────────────────────────────────────────────────── */
.page-stream {
    overflow: hidden !important;
}

.stream-page-wrap {
    flex: 1;
    display: flex;
    overflow: hidden;
    height: 100%;
}

.stream-main {
    flex: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-width: 0;
    overflow: hidden;
}

.stream-video-box {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stream-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.stream-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text3);
    padding: 40px;
}

.stream-placeholder span {
    font-size: 44px;
    opacity: 0.3;
}
.stream-placeholder p {
    font-size: 13px;
}

.live-pill {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 99px;
    animation: blink 1.2s step-start infinite;
    letter-spacing: 0.5px;
}

@keyframes blink {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

/* Stream controls panel */
.stream-controls-panel {
    width: 280px;
    flex-shrink: 0;
    background: var(--bg2);
    border-left: 1px solid var(--border);
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
}

.scp-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.scp-desc {
    font-size: 12px;
    color: var(--text2);
    line-height: 1.6;
}

.scp-actions {
    display: flex;
    gap: 8px;
}

.btn-stream-start,
.btn-stream-stop {
    flex: 1;
    padding: 9px 0;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
    letter-spacing: 0.3px;
}

.btn-stream-start:hover,
.btn-stream-stop:hover {
    opacity: 0.85;
}

.btn-stream-start {
    background: #166534;
    color: #4ade80;
}
.btn-stream-stop {
    background: #7f1d1d;
    color: #fca5a5;
}

.scp-status {
    font-size: 11px;
    color: var(--text3);
    background: var(--bg3);
    padding: 6px 10px;
    border-radius: 5px;
    border: 1px solid var(--border);
}

.scp-note {
    font-size: 11px;
    color: var(--yellow);
    line-height: 1.5;
    padding: 8px 10px;
    background: rgba(234, 179, 8, 0.07);
    border-radius: 5px;
    border: 1px solid rgba(234, 179, 8, 0.2);
}

/* ── AUDIO PAGE ────────────────────────────────────────────────────────────── */
.page-audio {
    overflow: hidden !important;
}

.audio-page-wrap {
    flex: 1;
    display: flex;
    overflow: hidden;
    height: 100%;
}

.audio-visualizer-wrap {
    flex: 1;
    background: var(--bg3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    min-width: 0;
}

.audio-visualizer {
    width: 100%;
    max-width: 700px;
    height: 180px;
    background: var(--bg2);
    border-radius: 8px;
    border: 1px solid var(--border);
    display: block;
}

.audio-status-label {
    font-size: 12px;
    color: var(--text3);
}

/* ── FOOTER ────────────────────────────────────────────────────────────────── */
.footer {
    height: var(--footer-h);
    background: var(--bg3);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text3);
    flex-shrink: 0;
    letter-spacing: 0.3px;
}

/* ── TOAST ─────────────────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--card2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 9px 16px;
    border-radius: 7px;
    font-size: 12.5px;
    opacity: 0;
    transform: translateY(8px);
    transition:
        opacity 0.2s,
        transform 0.2s;
    pointer-events: none;
    z-index: 9999;
    max-width: 300px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}
.toast.success {
    border-left: 3px solid var(--green);
}
.toast.error {
    border-left: 3px solid var(--red);
}
.toast.info {
    border-left: 3px solid var(--blue);
}

/* ── SCROLLBARS ────────────────────────────────────────────────────────────── */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* ── RECORDING UI ──────────────────────────────────────────────────────────── */
.rec-pill {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(239, 68, 68, 0.92);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 99px;
    animation: blink 1s step-start infinite;
    letter-spacing: 0.5px;
}

.scp-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--text3);
    margin-top: 10px;
    margin-bottom: 5px;
}

.scp-facing {
    display: flex;
    gap: 6px;
    margin-bottom: 2px;
}

.btn-facing {
    flex: 1;
    padding: 6px 0;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: var(--bg3);
    color: var(--text2);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-facing:hover {
    background: var(--card2);
    color: var(--text);
}

.btn-facing.active {
    background: #1e3a5f;
    border-color: var(--blue);
    color: #93c5fd;
}

.btn-rec-start,
.btn-rec-stop {
    flex: 1;
    padding: 8px 0;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn-rec-start {
    background: #7f1d1d;
    color: #fca5a5;
}

.btn-rec-stop {
    background: #ef4444;
    color: #fff;
    animation: pulse 1.5s infinite;
}

.btn-rec-start:hover,
.btn-rec-stop:hover {
    opacity: 0.85;
}

/* Recordings list */
.recordings-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 2px;
}

.recordings-list::-webkit-scrollbar {
    width: 3px;
}
.recordings-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.rec-empty {
    font-size: 11px;
    color: var(--text3);
    text-align: center;
    padding: 8px 0;
}

.rec-item {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 7px 9px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rec-item-name {
    font-size: 10px;
    color: var(--text2);
    font-family: monospace;
    word-break: break-all;
    line-height: 1.3;
}

.rec-item-meta {
    font-size: 10px;
    color: var(--text3);
}

.rec-item-actions {
    display: flex;
    gap: 5px;
    margin-top: 2px;
}

.rec-btn {
    flex: 1;
    padding: 4px 0;
    border-radius: 4px;
    border: none;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: opacity 0.15s;
    display: inline-block;
}

.rec-btn:hover {
    opacity: 0.82;
}

.rec-btn-play {
    background: #1e3a5f;
    color: #93c5fd;
}

.rec-btn-del {
    background: #7f1d1d;
    color: #fca5a5;
}

/* ── NAV SECTION LABEL ─────────────────────────────────────────────────────── */
.nav-section-label {
    padding: 14px 18px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: #e67e22;
    text-transform: uppercase;
    opacity: 0.9;
}

/* ══════════════════════════════════════════════════════════════════════════════
   KEYLOGGER PAGE
══════════════════════════════════════════════════════════════════════════════ */

.kl-wrap {
    display: flex;
    height: 100%;
    overflow: hidden;
}

/* ── Left sidebar ─────────────────────────────────────────────────────────── */
.kl-sidebar {
    width: 280px;
    min-width: 230px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.kl-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

.kl-total {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.kl-header-actions {
    display: flex;
    gap: 6px;
}

.kl-app-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.kl-app-list::-webkit-scrollbar {
    width: 4px;
}
.kl-app-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.kl-empty {
    padding: 24px 16px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

.kl-app-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.15s;
    position: relative;
}

.kl-app-item:hover {
    background: rgba(255, 255, 255, 0.05);
}
.kl-app-item.active {
    background: rgba(230, 126, 34, 0.12);
    border-left: 3px solid #e67e22;
}

.kl-app-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.kl-app-info {
    flex: 1;
    min-width: 0;
}

.kl-app-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kl-app-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.kl-badge {
    background: #27ae60;
    color: #fff;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.kl-count {
    color: var(--text-muted);
    font-size: 11px;
    flex-shrink: 0;
}

/* ── Right content ────────────────────────────────────────────────────────── */
.kl-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kl-content::-webkit-scrollbar {
    width: 4px;
}
.kl-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.kl-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 12px;
}

.kl-placeholder-icon {
    font-size: 48px;
    opacity: 0.4;
}

.kl-date-sep {
    text-align: center;
    position: relative;
    margin: 16px 0 8px;
    color: var(--text-muted);
    font-size: 12px;
}

.kl-date-sep::before,
.kl-date-sep::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 38%;
    height: 1px;
    background: var(--border);
}

.kl-date-sep::before {
    left: 0;
}
.kl-date-sep::after {
    right: 0;
}

.kl-date-sep span {
    background: var(--bg);
    padding: 0 10px;
}

.kl-entry {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 6px;
}

.kl-entry-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.kl-entry-text {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
}

/* ══════════════════════════════════════════════════════════════════════════════
   AUTO SCREENSHOT PAGE
══════════════════════════════════════════════════════════════════════════════ */

.ss-wrap {
    display: flex;
    height: 100%;
    overflow: hidden;
}

/* ── Left sidebar ─────────────────────────────────────────────────────────── */
.ss-sidebar {
    width: 280px;
    min-width: 230px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ss-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

.ss-total {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.ss-header-actions {
    display: flex;
    gap: 6px;
}

.ss-settings-panel {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.ss-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

.ss-input {
    width: 70px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 4px 8px;
    font-size: 13px;
    text-align: center;
}

.ss-setting-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.ss-app-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.ss-app-list::-webkit-scrollbar {
    width: 4px;
}
.ss-app-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.ss-empty {
    padding: 24px 16px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

.ss-app-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.15s;
}

.ss-app-item:hover {
    background: rgba(255, 255, 255, 0.05);
}
.ss-app-item.active {
    background: rgba(230, 126, 34, 0.12);
    border-left: 3px solid #e67e22;
}

.ss-app-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.ss-app-info {
    flex: 1;
    min-width: 0;
}

.ss-app-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ss-app-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.ss-badge {
    background: #27ae60;
    color: #fff;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.ss-count {
    color: var(--text-muted);
    font-size: 11px;
    flex-shrink: 0;
}

/* ── Right content ────────────────────────────────────────────────────────── */
.ss-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ss-content::-webkit-scrollbar {
    width: 4px;
}
.ss-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.ss-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 12px;
}

.ss-placeholder-icon {
    font-size: 48px;
    opacity: 0.4;
}

.ss-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.ss-img {
    width: 100%;
    display: block;
    max-height: 480px;
    object-fit: contain;
    background: #000;
    cursor: zoom-in;
    transition: opacity 0.2s;
}

.ss-img:hover {
    opacity: 0.92;
}

.ss-item-meta {
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ── RESPONSIVE ────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
    .sidebar {
        position: fixed;
        height: 100vh;
        z-index: 100;
    }
    .sidebar.collapsed {
        width: 0;
        min-width: 0;
    }
    .stream-controls-panel {
        width: 220px;
    }
    .statusbar-pills {
        display: none;
    }
    .kl-sidebar,
    .ss-sidebar {
        width: 200px;
        min-width: 160px;
    }
    .kl-wrap,
    .ss-wrap {
        flex-direction: column;
    }
    .kl-sidebar,
    .ss-sidebar {
        width: 100%;
        max-height: 220px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}
