:root {
    --bg-app: #2B303B;
    --bg-grad-1: #2B303B;
    --bg-grad-2: #2B303B;
    --card-bg: #2B303B;
    --card-border: transparent;
    --card-hover-border: transparent;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --accent: #6366f1;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --nav-bg: #2B303B;
    
    /* Neumorphism Shadows (Dark) */
    --shadow-dark: #1b1e26;
    --shadow-light: #3b4250;
    --neu-out: 8px 8px 16px var(--shadow-dark), -8px -8px 16px var(--shadow-light);
    --neu-in: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
    --neu-btn: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
    --neu-btn-active: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light);
}

html.light-theme body {
    --bg-app: #EAECEF;
    --bg-grad-1: #EAECEF;
    --bg-grad-2: #EAECEF;
    --card-bg: #EAECEF;
    --card-border: transparent;
    --card-hover-border: transparent;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --nav-bg: #EAECEF;

    /* Neumorphism Shadows (Light) */
    --shadow-dark: #b0b5ba;
    --shadow-light: #ffffff;
    --neu-out: 8px 8px 16px var(--shadow-dark), -8px -8px 16px var(--shadow-light);
    --neu-in: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
    --neu-btn: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
    --neu-btn-active: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    outline: none;tap-highlight-color: transparent;
}

body {
    background: linear-gradient(135deg, var(--bg-grad-1) 0%, var(--bg-grad-2) 100%);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.4s ease, color 0.3s ease;
}

/* Background static gradient (optimized for TV/low-end devices) */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 10% 10%, var(--orb-1), transparent 40%),
                radial-gradient(circle at 90% 90%, var(--orb-2), transparent 40%);
    z-index: -1;
    pointer-events: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.spin-anim {
    animation: spin 1s linear infinite;
}
@keyframes pulse {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* ─── App Layout ────────────────────────────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Navigation */
.app-nav {
    width: 260px;
    background: var(--nav-bg);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 100;
    transition: background 0.3s, border-color 0.3s;
  border: none !important;}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.brand-name {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #60a5fa, #818cf8);background-clip: text;text-fill-color: transparent;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
    border-radius: 14px;
    cursor: pointer;
    text-align: left;
    transition: all 0.25s ease;
}

.nav-link svg {
    transition: transform 0.2s;
}

.nav-link:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.nav-link.active {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.08);
}

.nav-link.active svg {
    transform: scale(1.05);
}

.nav-footer {
    padding-top: 1.5rem;
    border-top: 1px solid var(--card-border);
}

.uptime-badge {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Main Area */
.app-main {
    flex: 1;
    margin-left: 260px;
    padding: 3rem 4rem;
    max-width: 1200px;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.2rem;
    gap: 1rem;
    flex-wrap: nowrap;
    min-width: 0;
}

.title-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex: 1 1 auto;
}

.main-header h1 {
    font-size: clamp(1.25rem, 2.5vw, 1.85rem);
    font-weight: 700;
    letter-spacing: -0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    color: var(--text-main);
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.status-indicator::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    
}

/* ─── Tab Content Panes ──────────────────────────────────────────────────────── */
.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Cards System */
.card {
    background: var(--card-bg);
    border: none !important;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--neu-out);
    transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.card:hover {
    border: none !important;
    transform: translateY(-2px);
    box-shadow: var(--neu-out);
}

/* Overview - Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.metric-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.metric-info {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1rem;
}

.metric-title {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.metric-subtext {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: -0.5rem;
    margin-bottom: 0.75rem;
}

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 10px;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.temp-bar {
    background: linear-gradient(90deg, var(--warning), var(--danger));
}

.grad-green {
    background: linear-gradient(90deg, #10b981, #059669), var(--card-bg) !important;
}

.grad-yellow {
    background: linear-gradient(90deg, #f59e0b, #d97706), var(--card-bg) !important;
}

.grad-red {
    background: linear-gradient(90deg, #ef4444, #dc2626), var(--card-bg) !important;
}

/* Subtle background card gradients for severity indicators */
.bg-grad-green {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.02)), var(--card-bg) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}

.bg-grad-yellow {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.02)), var(--card-bg) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
}

.bg-grad-red {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.02)), var(--card-bg) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

/* Quick Actions Section */
.section-title-wrapper {
    margin-bottom: 1.25rem;
}

.section-title-wrapper h2 {
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.btn-action {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    text-align: left;
    background: var(--card-bg);
    cursor: pointer;
    width: 100%;
}

.btn-action:hover {
    transform: translateY(-2px);
}

.btn-action .action-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.btn-reboot .action-icon {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent);
}

.btn-shutdown .action-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.action-label {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.action-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ─── Containers View ────────────────────────────────────────────────────────── */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.service-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5rem;
  border: none !important;}

.service-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.service-name {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.service-status {
    padding: 0.25rem 0.65rem;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-running {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.status-stopped {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.service-image {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.35rem;
    opacity: 0.75;
}

.service-status-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}
.service-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-main);
    background: var(--bg-app);
    padding: 0.65rem 0.9rem;
    border-radius: 10px;
    margin-top: 0.75rem;
    box-shadow: var(--neu-in);
}
.service-stats span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: 'Outfit', monospace, sans-serif;
}
.service-stats i {
    font-size: 1.15rem;
}

.service-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

/* ─── Services Action Bar ───────────────────────────────────────────── */
.services-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.services-action-bar-left {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.services-action-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}
.services-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.services-action-bar-right {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ─── Watchtower section inside service cards ───────────────────────── */
.service-card-wt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--card-border);
}
.service-wt-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.service-update-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 0 0 auto;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

@media (max-width: 640px) {
    .services-action-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .services-action-bar-right {
        width: 100%;
    }
    .services-action-bar-right .btn {
    flex: 1;
    padding: 0.6rem;
    border: none !important;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-app);
    color: var(--text-main);
    box-shadow: var(--neu-btn);
}
}

.btn {
    flex: 1;
    padding: 0.6rem;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    border: 1px solid var(--card-border);
 box-shadow: var(--neu-btn); border: none !important;}

.btn:hover {
    background: var(--bg-app);
    box-shadow: var(--neu-btn-active);
    transform: translateY(1px);
}

.btn-start {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--success);
}
.btn-start:hover { background: rgba(16, 185, 129, 0.18); }

.btn-stop {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}
.btn-stop:hover { background: rgba(239, 68, 68, 0.18); }

.btn-restart {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: var(--primary);
}
.btn-restart:hover { background: rgba(59, 130, 246, 0.18); }

/* ─── Updates / Terminal View ────────────────────────────────────────────────── */
.update-control-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.update-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.update-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-width: 600px;
    line-height: 1.5;
}

.update-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    max-width: 100%;
}

.btn-jellyfin, .btn-subtitles {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}
.btn-jellyfin {
    background: rgba(170, 92, 195, 0.15);
    color: #aa5cc3;
    border: 1px solid rgba(170, 92, 195, 0.3);
}
.btn-jellyfin:hover {
    background: rgba(170, 92, 195, 0.25);
    transform: translateY(-2px);
}
.btn-subtitles {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-subtitles:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.btn-update-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.25rem;
    border-radius: 12px;
    border: none !important;
    background: var(--bg-app);
    box-shadow: var(--neu-btn);
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-update-action:hover:not(:disabled) {
    box-shadow: var(--neu-btn-active);
    color: var(--primary);
    transform: translateY(1px);
}

.btn-update-action:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-upgrade-action {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.25);
    color: var(--success);
}
.btn-upgrade-action:hover:not(:disabled) {
    background: rgba(16, 185, 129, 0.18);
}

.btn-outline {
    background: var(--bg-app);
    border: none !important;
    box-shadow: var(--neu-btn);
    color: var(--text-main);
}
.btn-outline:hover:not(:disabled) {
    background: var(--bg-app);
    box-shadow: var(--neu-btn-active);
    color: var(--primary);
    transform: translateY(1px);
}

.terminal-wrapper {
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--card-border);
    background: #04060d;
}

.terminal-topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--card-border);
}

.terminal-dots {
    display: flex;
    gap: 6px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.dot-red    { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green  { background: #28c840; }

.terminal-title {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: monospace;
}

.terminal {
    padding: 1.25rem 1.5rem;
    min-height: 250px;
    max-height: 450px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    color: #94a3b8;
}

.terminal::scrollbar { width: 5px; }
.terminal::scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 10px; }

.terminal-placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.t-line {
    white-space: pre-wrap;
    word-break: break-all;
    margin-bottom: 0.25rem;
}
.t-info { color: var(--primary); }
.t-success { color: var(--success); font-weight: 600; }
.t-error { color: var(--danger); font-weight: 600; }
.t-output { color: #e2e8f0; }

/* ─── Modals System ──────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(2, 4, 10, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
}

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

.modal-content {
    max-width: 420px;
    width: 100%;
    text-align: center;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    transform: scale(0.95);
    animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    color: var(--text-main);
    border-radius: 12px;
}

@keyframes modalIn {
    to { transform: scale(1); }
}

.modal-content h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.modal-content p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 2rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.03);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
}
.btn-danger:hover {
    background: #dc2626;
}

/* ─── PWA Bottom Sheet ──────────────────────────────────────────────────────── */
.pwa-modal-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.pwa-modal-sheet {
    background: var(--nav-bg);
    border-top: 1px solid var(--card-border);
    border-radius: 24px 24px 0 0;
    padding: 1.5rem 2rem 2rem;
    max-width: 500px;
    margin: 0 auto;
    
}

.pwa-modal-top {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.pwa-modal-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    flex-shrink: 0;
}

.pwa-modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.pwa-modal-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.pwa-modal-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-primary-pwa {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}

.btn-primary-pwa:hover {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    opacity: 0.9;
    transform: scale(1.02);
}

.pwa-dismiss {
    flex: 0 0 auto;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
}

/* ─── Responsive Styles (Navigation transforms into bottom bar) ────────────── */
@media (max-width: 850px) {
    .app-layout {
        flex-direction: column;
    }

    .app-nav {
        width: 100%;
        height: 70px;
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        flex-direction: row;
        justify-content: space-around;
        padding: 0 1rem;
        
        border-top: 1px solid var(--card-border);
        border-radius: 0;
        
      border: none !important;}

    .nav-brand, .nav-footer {
        display: none;
    }

    .nav-links {
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
        gap: 0;
        align-items: center;
    }

    .nav-link {
        flex-direction: column;
        gap: 0.25rem;
        padding: 0.5rem 0.15rem;
        font-size: 0.65rem;
        font-weight: 500;
        border-radius: 10px;
        align-items: center;
        flex: 1 1 0%;
        min-width: 0;
        text-align: center;
        justify-content: center;
    }

    .nav-link span {
        display: block;
    }

    .app-main {
        margin-left: 0;
        padding: 2rem 1.5rem 6.5rem; /* bottom padding ensures content isn't covered by bottom nav */
    }

    .main-header {
        margin-bottom: 1.5rem;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        flex-wrap: nowrap;
    }

    .main-header h1 {
        font-size: clamp(1.15rem, 4vw, 1.5rem);
    }
    
    .header-actions {
        margin-left: auto;
        flex-wrap: nowrap !important;
        flex-shrink: 0 !important;
    }
}

/* ─── Speedtest Card ───────────────────────────────────────────────────────── */
.speedtest-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.speedtest-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    text-align: center;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 1.5rem;
}
.speed-metric {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.speed-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}
.speed-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}
.speedtest-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}
.speed-isp {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}
@media (max-width: 600px) {
    .speedtest-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .speed-value {
        font-size: 1.8rem;
    }
}

/* ─── Media Tab CSS ───────────────────────────────────────────────────────── */
.media-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.media-filter-bar {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
}
.media-filter-bar::scrollbar {
    display: none;
}
.media-filter-btn {
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 50px;
    background: var(--bg-app);
    color: var(--text-muted);
    border: none;
    box-shadow: var(--neu-btn);
    transition: all 0.2s ease;
    white-space: nowrap;
    cursor: pointer;
}
.media-filter-btn:hover {
    color: var(--primary);
    box-shadow: var(--neu-btn-active);
}
.media-filter-btn.active {
    background: var(--bg-app);
    color: var(--primary);
    box-shadow: var(--neu-btn-active);
}
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.25rem;
}
.loading-media {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-weight: 500;
}
.media-card {
    background: var(--bg-app);
    border: none;
    box-shadow: var(--neu-out);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}
.media-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--neu-out);
}
.media-cover-wrapper {
    aspect-ratio: 2/3;
    width: 100%;
    position: relative;
    background: #111;
    overflow: hidden;
}
.media-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.media-type-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}
.media-info {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}
.media-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    display:box;line-clamp: 2;box-orient: vertical;
    overflow: hidden;
    line-height: 1.2;
}
.media-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Player Modal */
.player-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.player-modal.active {
    opacity: 1;
    pointer-events: auto;
}
.player-modal-content {
    width: 90%;
    max-width: 900px;
    background: #181818;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    
    display: flex;
    flex-direction: column;
}
.player-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: #aaa;
    font-size: 2rem;
    cursor: pointer;
    z-index: 1010;
    transition: color 0.2s;
}
.player-close:hover {
    color: white;
}
.player-container {
    width: 100%;
    background: black;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.player-container.video-mode {
    aspect-ratio: 16/9;
}
.player-container video {
    width: 100%;
    height: 100%;
    max-height: 70vh;
}

.audio-player-wrapper {
    position: relative;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    width: 100%;
    overflow: hidden;
    border-radius: 12px;
    background: rgba(10, 10, 15, 0.6);
    
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.audio-ambient-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    background-size: cover;
    background-position: center;
    filter: blur(40px);
    opacity: 0.15;
    transition: background-image 0.8s ease;
    pointer-events: none;
}
.audio-cover-container {
    position: relative;
    z-index: 2;
    width: 220px;
    height: 220px;
    border-radius: 16px;
    overflow: hidden;
    
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.audio-cover-container.playing {
    transform: scale(1.04);
}
.audio-cover-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.audio-meta-info {
    position: relative;
    z-index: 2;
    text-align: center;
    margin-top: 0.75rem;
    width: 100%;
    max-width: 320px;
}
.audio-track-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.35rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}
.audio-track-artist-album {
    font-size: 0.92rem;
    color: #b3b3b3;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}
.audio-seekbar-row {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 340px;
    margin-top: 0.75rem;
}
.audio-time-label {
    font-family: monospace;
    font-size: 0.8rem;
    color: #8e8e93;
    min-width: 35px;
}
.audio-seekbar {
    flex: 1;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.15);
    outline: none;
    cursor: pointer;appearance: none;
    appearance: none;
    transition: background 0.2s;
}
.audio-seekbar::slider-runnable-track {
    width: 100%;
    height: 5px;
    cursor: pointer;
}
.audio-seekbar::slider-thumb {appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    margin-top: -3.5px;
    opacity: 0;
    transition: opacity 0.15s, transform 0.15s;
    
}
.audio-seekbar:hover::slider-thumb,
.audio-seekbar:active::slider-thumb {
    opacity: 1;
    transform: scale(1.2);
}
.audio-seekbar::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border: none;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, transform 0.15s;
    
}
.audio-seekbar:hover::-moz-range-thumb,
.audio-seekbar:active::-moz-range-thumb {
    opacity: 1;
    transform: scale(1.2);
}
.audio-volume-row {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    max-width: 160px;
    margin-top: 0.5rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.audio-volume-row:hover {
    opacity: 1;
}
.volume-icon {
    color: #b3b3b3;
}
.audio-volume-slider {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    cursor: pointer;appearance: none;
    appearance: none;
}
.audio-volume-slider::slider-thumb {appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    margin-top: -3px;
}
.audio-volume-slider::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border: none;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
}
.player-details {
    padding: 1.25rem 1.5rem;
    color: white;
    border-top: 1px solid rgba(255,255,255,0.05);
}
.player-details h3 {
    margin: 0 0 0.4rem;
    font-size: 1.25rem;
}
.player-details p {
    margin: 0;
    color: #888;
    font-size: 0.88rem;
    line-height: 1.4;
}


/* Jellyfin Button */
.btn-jellyfin {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: 50px;
    background: linear-gradient(135deg, #aa5cc3, #00a4dc);
    color: white !important;
    font-weight: 700;
    font-size: 0.88rem;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    
    text-decoration: none;
}
.btn-jellyfin:hover {
    transform: translateY(-2px);
    
    color: white !important;
}

/* Custom Audio Controls */
.audio-controls-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    width: 100%;
}
.audio-btn {
    background: none;
    border: none;
    color: #b3b3b3;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
}
.audio-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}
.audio-btn:active {
    transform: scale(0.95);
}
.audio-btn.active {
    color: var(--primary) !important;
}
.btn-play-pause {
    background: white;
    color: black;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    aspect-ratio: 1/1;
    
}
.btn-play-pause:hover {
    color: black;
    background: #f0f0f0;
    transform: scale(1.05);
}
.btn-play-pause:active {
    transform: scale(0.95);
}

/* ─── File Manager ──────────────────────────────────────────────────────────── */
.file-manager-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.fm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: none;
    background: transparent;
}

.fm-path-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: monospace;
    font-size: 0.95rem;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}
.fm-path-breadcrumbs::scrollbar { display: none; }

.fm-breadcrumb-item {
    color: var(--primary);
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
}
.fm-breadcrumb-item:hover {
    opacity: 0.8;
}
.fm-breadcrumb-sep {
    color: var(--text-muted);
}

.fm-actions {
    display: flex;
    gap: 10px;
}

.fm-body {
    display: flex;
    flex-direction: column;
}

.fm-list-header {
    display: grid;
    grid-template-columns: minmax(150px, 2fr) 100px 150px 80px;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fm-list {
    padding: 0.5rem 0 2rem 0;
}

.fm-item {
    display: grid;
    grid-template-columns: minmax(150px, 2fr) 100px 150px 80px;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    transition: background 0.2s;
}
.fm-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.fm-col-name {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}
.fm-name-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}
.fm-name-text.is-dir {
    color: var(--primary);
    font-weight: 500;
}
.fm-name-text.is-file {
    color: var(--text-main);
}
.fm-name-text:hover {
    text-decoration: underline;
}

.fm-col-size, .fm-col-date {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.fm-col-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.fm-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fm-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}
.fm-action-btn.delete:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

@media (max-width: 768px) {
    .fm-list-header {
        grid-template-columns: 1fr 80px;
    }
    .fm-item {
        grid-template-columns: 1fr 80px;
    }
}

/* Styled Switch toggle */
.switch-container {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}
.switch-container input {
    opacity: 0;
    width: 0;
    height: 0;
}
.switch-container .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: 0.3s;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.switch-container .slider::before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: #f1f5f9;
    transition: 0.3s;
    border-radius: 50%;
}
.switch-container input:checked + .slider {
    background-color: var(--primary);
    border-color: var(--primary);
}
.switch-container input:checked + .slider::before {
    transform: translateX(22px);
}

.wt-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr 1fr;
    padding: 0.75rem 1rem;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
    transition: background 0.25s ease;
}
.wt-row:hover {
    background: rgba(255, 255, 255, 0.02);
}
.wt-row:last-child {
    border-bottom: none;
}

/* ─── Cell classes (shared desktop + mobile base) ───────────────────── */
.wt-cell-name { }
.wt-cell-state {
    display: flex;
    justify-content: center;
}
.wt-cell-toggle {
    display: flex;
    justify-content: center;
}
.wt-cell-badge { }
.wt-cell-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.35rem;
}
.wt-btn-label {
    display: none; /* hidden on desktop, icons only */
}

/* ─── Watchtower Responsive ─────────────────────────────────────────── */
.wt-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

.wt-table-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr 1fr;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.02);
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.wt-container-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--card-border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    background: rgba(0,0,0,0.15);
}

.wt-scroll-wrapper {
    overflow-x: auto;
    margin-top: 1rem;
    border-top: 1px solid var(--card-border);
    padding-top: 1rem;
}

/* Watchtower action buttons on mobile */
.wt-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 640px) {

    /* Header: stack vertically, buttons fill row */
    .wt-header {
        flex-direction: column;
        align-items: stretch;
    }
    .wt-controls {
        width: 100%;
    }
    .wt-controls .btn-update-action {
        flex: 1;
        justify-content: center;
        font-size: 0.8rem;
        padding: 0.6rem 0.5rem;
    }

    /* Hide table header; remove horizontal scroll */
    .wt-table-header { display: none; }
    .wt-scroll-wrapper { overflow-x: visible; }

    /* Container list: vertical stack of cards */
    .wt-container-list {
        border: none;
        border-radius: 0;
        background: transparent;
        gap: 0.75rem;
    }

    /* Each row = 2-column mini-grid card */
    .wt-row {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto auto;
        column-gap: 0.75rem;
        row-gap: 0.55rem;
        padding: 0.9rem 1rem;
        border: 1px solid var(--card-border);
        border-radius: 12px;
        background: rgba(255,255,255,0.025);
        align-items: center;
    }
    .wt-row:last-child { border-bottom: 1px solid var(--card-border); }
    .wt-row:hover { background: rgba(255,255,255,0.045); }

    /* col1 row1 = name & image */
    .wt-cell-name { grid-column: 1; grid-row: 1; }

    /* col2 row1 = state badge, right-aligned */
    .wt-cell-state {
        grid-column: 2;
        grid-row: 1;
        justify-content: flex-end;
    }

    /* col1 row2 = toggle */
    .wt-cell-toggle {
        grid-column: 1;
        grid-row: 2;
        justify-content: flex-start;
        gap: 0.5rem;
    }

    /* col2 row2 = update badge, right-aligned */
    .wt-cell-badge {
        grid-column: 2;
        grid-row: 2;
        text-align: right;
    }
    .wt-last-checked { display: none; }

    /* row3 full width = action buttons */
    .wt-cell-actions {
        grid-column: 1 / -1;
        grid-row: 3;
        justify-content: stretch;
        gap: 0.5rem;
    }
    .wt-cell-actions .btn {
        flex: 1;
        justify-content: center;
        gap: 0.4rem;
        font-size: 0.82rem;
        padding: 0.5rem 0.75rem;
     box-shadow: var(--neu-btn); border: none !important;}
    .wt-btn-label { display: inline; }

    /* Settings: single column */
    #watchtower-settings-form { grid-template-columns: 1fr !important; }
    .wt-save-btn { width: 100%; }
}

.update-badge {
    padding: 0.25rem 0.65rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}
.badge-up-to-date {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.15);
}
.badge-update-available {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.15);
}
.badge-checking {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    border: 1px solid rgba(59, 130, 246, 0.15);
    animation: pulse 1.5s infinite alternate;
}
.badge-unknown {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-muted);
    border: 1px solid rgba(100, 116, 139, 0.15);
}

/* Sleek Toggle Switch for Player */
.switch-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-round {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 20px;
}

.slider-round:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: #fff;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    
}

.switch-toggle input:checked + .slider-round {
    background-color: #2ecc71;
    border-color: rgba(46, 204, 113, 0.4);
}

.switch-toggle input:checked + .slider-round:before {
    transform: translateX(20px);
}

/* Subtitle dropdown selector */
.subtitle-select-dropdown {
    background: var(--bg-app);
    border: none;
    box-shadow: var(--neu-in);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 0.9rem;
    padding: 0.7rem 1rem;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    max-width: 170px;
    height: 44px;
}

.subtitle-select-dropdown:hover,
.subtitle-select-dropdown:focus {
    box-shadow: var(--neu-out);
}

.subtitle-select-dropdown option {
    background: var(--bg-app);
    color: var(--text-main);
}

/* Player actions bar alignment */
#player-actions-bar {
    display: none;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Compact Jellyfin button */
.btn-jellyfin {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    font-size: 0.78rem;
    white-space: nowrap;
}

/* Logs Button */
.btn-logs {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

.btn-logs:hover {
    background: rgba(139, 92, 246, 0.18);
}

/* Theme light adjustments for logs modal */
.light-theme #logs-container {
    background: #0d1117 !important;
    border-color: rgba(0,0,0,0.15) !important;
    color: #00ff66 !important;
    
}

.light-theme #logs-title {
    color: #1f2937 !important;
}

/* Warning styling for Throttling Diagnostic */
.throttled-warning {
    color: #ef4444 !important;
    animation: pulse-red 2s infinite alternate;
}

.throttled-normal {
    color: #10b981 !important;
}

@keyframes pulse-red {
    0% { opacity: 0.8; }
    100% { opacity: 1; text-shadow: 0 0 8px rgba(239, 68, 68, 0.5); }
}





.btn:active, .btn-primary:active, .action-btn:active { box-shadow: var(--neu-btn-active) !important; transform: translateY(1px); }

.btn-primary {
    background: var(--bg-app);
    border: none !important;
    box-shadow: var(--neu-btn);
    color: var(--primary);
}
.btn-primary:hover:not(:disabled) {
    box-shadow: var(--neu-btn-active);
    transform: translateY(1px);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0 !important;
    margin-left: auto;
    background: var(--bg-app);
    box-shadow: var(--neu-in);
    padding: 5px 8px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}
html.light-theme .header-actions {
    border-color: rgba(0, 0, 0, 0.05);
}

.header-btn {
    padding: 0;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-app);
    box-shadow: var(--neu-out);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
    color: var(--text-main);
    position: relative;
}
html.light-theme .header-btn {
    box-shadow: var(--neu-out);
}
.header-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--neu-btn-active);
    filter: brightness(1.15);
}
html.light-theme .header-btn:hover {
    box-shadow: var(--neu-btn-active);
}
.header-btn:active {
    transform: scale(0.93);
    box-shadow: var(--neu-in) !important;
}
.header-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.header-btn i {
    font-size: 20px;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.header-btn:hover i {
    transform: scale(1.12);
}

/* Button-specific accent styling */
.header-btn-backup { color: var(--primary) !important; }
.header-btn-backup:hover { box-shadow: 0 4px 14px rgba(59, 130, 246, 0.28), var(--neu-out); }

.header-btn-theme { color: var(--text-main) !important; }

.header-btn-reboot { color: var(--warning) !important; }
.header-btn-reboot:hover i { transform: rotate(180deg) scale(1.12); }

.header-btn-shutdown { color: var(--danger) !important; }
.header-btn-shutdown:hover { box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3), var(--neu-out); }

.header-btn-logout { color: var(--text-muted) !important; }
.header-btn-logout:hover { color: var(--text-main) !important; }

/* Responsive Header Buttons Breakpoints */
@media (max-width: 640px) {
    .header-actions {
        padding: 4px 6px;
        gap: 5px;
        border-radius: 12px;
    }
    .header-btn {
        width: 34px;
        height: 34px;
        border-radius: 8px;
    }
    .header-btn i {
        font-size: 17px;
    }
    .status-indicator {
        display: none !important; /* Hide 'Online' status badge on small phone screens to preserve title space */
    }
}

@media (max-width: 380px) {
    .header-actions {
        padding: 3px 4px;
        gap: 3px;
    }
    .header-btn {
        width: 30px;
        height: 30px;
        border-radius: 7px;
    }
    .header-btn i {
        font-size: 15px;
    }
}

/* Custom PWA Install Popup Banner */
.pwa-install-banner {
    position: fixed;
    bottom: 24px;
    right: 24px;
    left: 24px;
    max-width: 460px;
    margin: 0 auto;
    background: rgba(9, 13, 22, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 1.1rem 1.2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    animation: pwaBannerSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pwaBannerSlideUp {
    from { transform: translateY(120px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pwa-banner-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
    object-fit: contain;
    background: rgba(255,255,255,0.03);
    padding: 4px;
}

.pwa-banner-text strong {
    display: block;
    font-size: 1.05rem;
    color: #f8fafc;
    margin-bottom: 3px;
    font-weight: 700;
}

.pwa-banner-text span {
    font-size: 0.85rem;
    color: #94a3b8;
    line-height: 1.4;
}

.pwa-banner-actions {
    display: flex;
    gap: 0.7rem;
    justify-content: flex-end;
}

.pwa-btn-primary {
    background: linear-gradient(135deg, #a855f7, #7c3aed);
    color: #ffffff;
    border: none;
    padding: 0.6rem 1.3rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(168, 85, 247, 0.35);
    transition: all 0.2s ease;
}

.pwa-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(168, 85, 247, 0.45);
}

.pwa-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.6rem 1.1rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.pwa-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
}
