:root {
    --bg-dark: #0B0D17;
    --bg-header: rgba(11, 13, 23, 0.95);
    --bg-sidebar: rgba(19, 21, 31, 0.85);
    --bg-card: rgba(25, 28, 41, 0.75);
    --bg-item: rgba(35, 38, 54, 0.5);
    --accent-amber: #FFC107;
    --accent-cyan: #00E5FF;
    --border-color: rgba(0, 229, 255, 0.15);
    --text-primary: #F0F2F5;
    --text-slate: #C9D1D9;
    --text-muted: #8B949E;
    --text-dim: #7D8590;
    --success: #00E676;
    --bg-gradient-1: rgba(0, 229, 255, 0.05);
    --bg-gradient-2: rgba(255, 193, 7, 0.03);
    --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

/* 2. Generic Light Mode */
html[data-theme="light"] {
    --bg-dark: #F8F9FA;
    --bg-header: rgba(255, 255, 255, 0.95);
    --bg-sidebar: rgba(248, 249, 250, 0.85);
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-item: rgba(0, 0, 0, 0.03);
    --accent-amber: #2B3A42;
    --accent-cyan: #0056B3;
    --border-color: rgba(0, 0, 0, 0.08);
    --text-primary: #1A1A1A;
    --text-slate: #2B3A42;
    --text-muted: #4A5568;
    --text-dim: #718096;
    --bg-gradient-1: rgba(0, 86, 179, 0.02);
    --bg-gradient-2: rgba(43, 58, 66, 0.02);
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* 3. Generic Dark Mode */
html[data-theme="dark"] {
    --bg-dark: #121212;
    --bg-header: rgba(18, 18, 18, 0.95);
    --bg-sidebar: rgba(24, 24, 24, 0.85);
    --bg-card: rgba(30, 30, 30, 0.75);
    --bg-item: rgba(255, 255, 255, 0.05);
    --accent-amber: #90A4AE;
    --accent-cyan: #FF1744;
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #FFFFFF;
    --text-slate: #E2E8F0;
    --text-muted: #94A3B8;
    --text-dim: #64748B;
    --bg-gradient-1: rgba(255, 23, 68, 0.03);
    --bg-gradient-2: rgba(144, 164, 174, 0.03);
    --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* 4. Pastel Light */
html[data-theme="pastel-light"] {
    --bg-dark: #F4F1EA;
    --bg-header: rgba(244, 241, 234, 0.95);
    --bg-sidebar: rgba(255, 255, 255, 0.5);
    --bg-card: rgba(255, 255, 255, 0.65);
    --bg-item: rgba(0, 0, 0, 0.02);
    --accent-amber: #B39DDB;
    --accent-cyan: #A5D6A7;
    --border-color: rgba(179, 157, 219, 0.2);
    --text-primary: #3E2723;
    --text-slate: #5D4037;
    --text-muted: #8D6E63;
    --text-dim: #A1887F;
    --bg-gradient-1: rgba(179, 157, 219, 0.05);
    --bg-gradient-2: rgba(165, 214, 167, 0.05);
    --card-shadow: 0 8px 30px rgba(0, 0, 0, 0.03);
}

/* 5. Pastel Dark */
html[data-theme="pastel-dark"] {
    --bg-dark: #1E1E24;
    --bg-header: rgba(30, 30, 36, 0.95);
    --bg-sidebar: rgba(45, 42, 54, 0.5);
    --bg-card: rgba(45, 42, 54, 0.70);
    --bg-item: rgba(255, 255, 255, 0.04);
    --accent-amber: #F48FB1;
    --accent-cyan: #9FA8DA;
    --border-color: rgba(244, 143, 177, 0.15);
    --text-primary: #E0E0E0;
    --text-slate: #BDBDBD;
    --text-muted: #9E9E9E;
    --text-dim: #757575;
    --bg-gradient-1: rgba(244, 143, 177, 0.04);
    --bg-gradient-2: rgba(159, 168, 218, 0.04);
    --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

/* 6. 80s Electric (Synthwave) */
html[data-theme="synthwave"] {
    --bg-dark: #1A0B2E;
    --bg-header: rgba(26, 11, 46, 0.95);
    --bg-sidebar: rgba(37, 16, 56, 0.65);
    --bg-card: rgba(37, 16, 56, 0.75);
    --bg-item: rgba(255, 0, 127, 0.05);
    --accent-amber: #FF007F;
    --accent-cyan: #00F0FF;
    --border-color: rgba(255, 0, 127, 0.25);
    --text-primary: #FFF500;
    --text-slate: #FF00FF;
    --text-muted: #B100FF;
    --text-dim: #7000FF;
    --bg-gradient-1: rgba(0, 240, 255, 0.08);
    --bg-gradient-2: rgba(255, 0, 127, 0.08);
    --card-shadow: 0 0 30px rgba(255, 0, 127, 0.15);
}

/* Authentication Overlay */
#auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1a1c2c 0%, #0b0d17 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

.login-card {
    background: rgba(25, 28, 41, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 48px;
    width: 100%;
    max-width: 440px;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.login-logo {
    font-size: 3rem;
    color: var(--accent-amber);
    margin-bottom: 16px;
}

.login-card h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.login-card p {
    color: var(--text-muted);
    margin-bottom: 32px;
}

.auth-btn {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.plex-btn {
    background: #e5a00d;
    color: white;
    margin-bottom: 16px;
}

.plex-btn:hover {
    background: #cc8f0b;
    transform: translateY(-2px);
}

.local-login-toggle {
    display: block;
    margin-top: 24px;
    color: var(--text-dim);
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.2s;
}

.local-login-toggle:hover {
    color: var(--text-primary);
}

.login-form-container {
    margin-top: 24px;
    text-align: left;
}

.login-form-container input {
    width: 100%;
    padding: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    margin-bottom: 12px;
    outline: none;
}

.login-form-container input:focus {
    border-color: var(--accent-cyan);
    background: rgba(255, 255, 255, 0.08);
}

.invite-prompt-card {
    margin-top: 20px;
    background: rgba(255, 193, 7, 0.05);
    border: 1px solid rgba(255, 193, 7, 0.2);
    border-radius: 12px;
    padding: 20px;
    text-align: left;
}

.invite-prompt-card h4 {
    color: var(--accent-amber);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Logout Item */
.logout-item {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding-top: 16px !important;
}

.logout-link {
    color: #ff5252 !important;
}

.logout-link:hover {
    background: rgba(255, 82, 82, 0.1) !important;
}

/* Access Control View Styles */
.badge {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-admin {
    background: rgba(0, 229, 255, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 229, 255, 0.2);
}

.badge-user {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-slate);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.05);
}

.text-error { color: #ff5252; }
.text-success { color: #00e676; }
.text-amber { color: var(--accent-amber); }

.bg-white-5 { background: rgba(255, 255, 255, 0.05); }
.bg-white-3 { background: rgba(255, 255, 255, 0.03); }
.border-white-10 { border-color: rgba(255, 255, 255, 0.1); }
.border-white-5 { border-color: rgba(255, 255, 255, 0.05); }

.font-mono { font-family: 'JetBrains Mono', monospace; }

.table-container {
    overflow-x: auto;
}

#access-control-view .card-body {
    min-height: 200px;
}

.w-full { width: 100%; }
.mt-4 { margin-top: 16px; }
.space-y-2 > * + * { margin-top: 8px; }
.p-4 { padding: 16px; }
.p-3 { padding: 12px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.font-bold { font-weight: 700; }
.text-xs { font-size: 0.75rem; }
.rounded-lg { border-radius: 12px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* Utility classes used by the Access Control view (Tailwind-style, hand-rolled) */
.space-y-1 > * + * { margin-top: 4px; }
.space-y-4 > * + * { margin-top: 16px; }
.gap-1 { gap: 4px; }
.gap-1\.5 { gap: 6px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.p-0 { padding: 0; }
.p-1\.5 { padding: 6px; }
.p-2 { padding: 8px; }
.p-6 { padding: 24px; }
.px-2 { padding-left: 8px; padding-right: 8px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.px-6 { padding-left: 24px; padding-right: 24px; }
.py-1 { padding-top: 4px; padding-bottom: 4px; }
.py-1\.5 { padding-top: 6px; padding-bottom: 6px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.py-12 { padding-top: 48px; padding-bottom: 48px; }
.m-4 { margin: 16px; }
.mb-2 { margin-bottom: 8px; }
.w-3 { width: 12px; }
.h-3 { height: 12px; }
.w-3\.5 { width: 14px; }
.h-3\.5 { height: 14px; }
.w-4 { width: 16px; }
.h-4 { height: 16px; }
.max-w-md { max-width: 28rem; }
.min-w-0 { min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.flex-1 { flex: 1 1 0%; min-width: 0; }
.flex-col { flex-direction: column; }
.justify-end { justify-content: flex-end; }

.text-sm { font-size: 0.875rem; }
.text-xl { font-size: 1.25rem; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-\[9px\] { font-size: 9px; }
.text-\[10px\] { font-size: 10px; }
.text-\[11px\] { font-size: 11px; }
.uppercase { text-transform: uppercase; }
.italic { font-style: italic; }
.font-medium { font-weight: 500; }
.tracking-tight { letter-spacing: -0.02em; }
.tracking-wider { letter-spacing: 0.08em; }
.tracking-\[2px\] { letter-spacing: 2px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-dim { color: var(--text-dim); }
.text-primary { color: var(--text-primary); }
.text-cyan { color: var(--accent-cyan); }

.border { border-width: 1px; border-style: solid; border-color: rgba(255, 255, 255, 0.1); }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgba(255, 255, 255, 0.1); }
.border-none { border: none; }
.rounded { border-radius: 6px; }
.rounded-md { border-radius: 8px; }
.bg-transparent { background: transparent; }
.bg-success\/10 { background: rgba(0, 230, 118, 0.1); }
.border-success\/20 { border-color: rgba(0, 230, 118, 0.2); }

.cursor-pointer { cursor: pointer; }
.outline-none { outline: none; }
.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-60 { opacity: 0.6; }
.opacity-70 { opacity: 0.7; }
.transition-all { transition: all 0.2s ease; }
.transition-colors { transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease; }
.transition-opacity { transition: opacity 0.2s ease; }
.shadow-sm { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
.hover\:text-cyan:hover { color: var(--accent-cyan); }
.hover\:text-amber:hover { color: var(--accent-amber); }
.hover\:text-error:hover { color: #ff5252; }
.hover\:bg-white-5:hover { background: rgba(255, 255, 255, 0.05); }
.hover\:bg-error\/10:hover { background: rgba(255, 82, 82, 0.1); }
.hover\:bg-success\/20:hover { background: rgba(0, 230, 118, 0.2); }
.hover\:border-white-20:hover { border-color: rgba(255, 255, 255, 0.2); }
.hover\:bg-white-\[0\.02\]:hover { background: rgba(255, 255, 255, 0.02); }
.focus\:border-cyan\/30:focus { border-color: rgba(0, 229, 255, 0.3); }
.focus\:ring-0:focus { outline: none; box-shadow: none; }
.active\:scale-95:active { transform: scale(0.95); }
.group:hover .group-hover\:opacity-100 { opacity: 1; }

@keyframes util-pulse { 50% { opacity: 0.6; } }
.animate-pulse { animation: util-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
@keyframes util-spin { to { transform: rotate(360deg); } }
.animate-spin { animation: util-spin 1s linear infinite; }
.save-glow { box-shadow: 0 0 15px rgba(0, 230, 118, 0.2); }

#access-control-view input[type="checkbox"] { accent-color: var(--accent-cyan); }
/* :where() keeps specificity at zero so utility classes like .text-dim still win */
:where(#access-control-view input, #access-control-view select) { color: var(--text-primary); }
#access-control-view select option { background-color: var(--bg-dark); color: var(--text-primary); }

/* 7. Matrix (Digital Rain) */
html[data-theme="matrix"] {
    --bg-dark: #000000;
    --bg-header: rgba(0, 0, 0, 0.95);
    --bg-sidebar: rgba(10, 15, 10, 0.75);
    --bg-card: rgba(10, 15, 10, 0.85);
    --bg-item: rgba(0, 255, 65, 0.05);
    --accent-amber: #00FF41;
    --accent-cyan: #39FF14;
    --border-color: rgba(0, 255, 65, 0.3);
    --text-primary: #80FF80;
    --text-slate: #00FF41;
    --text-muted: #008F11;
    --text-dim: #003B00;
    --bg-gradient-1: rgba(0, 255, 65, 0.03);
    --bg-gradient-2: rgba(0, 255, 65, 0.02);
    --card-shadow: 0 0 20px rgba(0, 255, 65, 0.1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, var(--bg-gradient-1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, var(--bg-gradient-2) 0px, transparent 50%);
    color: var(--text-slate);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
}

/* Header */
#app > header {
    height: 80px;
    background: var(--bg-header);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 32px;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon-svg {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.logo-icon-svg:hover {
    transform: rotate(15deg) scale(1.1);
}

.logo-text {
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: -1.5px;
    text-transform: uppercase;
    font-style: italic;
    color: var(--text-primary);
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 32px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.25rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-weight: 500;
}

.stat-value.amber, .status-text.amber { color: var(--accent-amber); }
.amber { color: var(--accent-amber) !important; }

.v-divider {
    height: 40px;
    width: 1px;
    background: var(--border-color);
}

/* Main Layout */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
aside.sidebar {
    width: 256px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    will-change: transform;
    transform: translateZ(0);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--text-muted);
    margin: 16px 0 12px 0;
}

.nav-group {
    display: flex;
    flex-direction: column;
}

.nav-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 10px;
    user-select: none;
    white-space: nowrap;
}

.nav-group-header:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

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

.nav-group-header:active {
    transform: scale(0.98);
}

.nav-group.active:not(.collapsed) .nav-group-header {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
}

.nav-chevron {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0.6;
}

.nav-group:not(.collapsed) .nav-chevron {
    transform: rotate(180deg);
    opacity: 1;
}

.sub-nav-menu {
    max-height: 400px;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.3s;
    display: flex;
    flex-direction: column;
    padding-left: 32px;
    margin-bottom: 4px;
    opacity: 1;
}

.nav-group.collapsed .sub-nav-menu {
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    pointer-events: none;
}

.sub-link {
    padding: 8px 12px;
    font-size: 0.825rem;
    color: var(--text-muted);
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
    border-left: 3px solid transparent;
    margin: 1px 0;
    white-space: nowrap;
}

.sub-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.sub-link.active {
    color: var(--accent-cyan);
    background: rgba(0, 229, 255, 0.05);
    border-left-color: var(--accent-cyan);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.sidebar-link i { width: 18px; height: 18px; }

.sidebar-link.active {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-amber);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.sidebar-link:not(.active):hover {
    background: var(--bg-item);
}

.dot-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot-indicator.active { background: var(--accent-amber); }
.dot-indicator.empty { border: 1px solid var(--text-muted); }

.uptime-card {
    background: var(--bg-item);
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.uptime-card p:first-child {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.uptime-card p:last-child {
    font-size: 0.75rem;
    font-family: monospace;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.status-active {
    background: rgba(0, 255, 157, 0.1);
    color: #00ff9d;
    border: 1px solid rgba(0, 255, 157, 0.2);
    animation: pulse-green 2s infinite;
}

.status-badge.status-idle {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(0, 255, 157, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(0, 255, 157, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 255, 157, 0); }
}

/* Dashboard Content */
.content-area {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

.view-container {
    padding: 32px;
    height: 100%;
}

.view-content-full {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Cards */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    will-change: transform, box-shadow;
    transform: translateZ(0);
    box-shadow: var(--card-shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.125rem;
    font-weight: 700;
}

.slash { color: var(--accent-amber); }

.card-meta {
    font-size: 0.75rem;
    font-family: monospace;
    color: var(--text-muted);
}

/* Content Items */
.item-row {
    background: var(--bg-item);
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.item-row:last-child { margin-bottom: 0; }

.item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.item-title {
    font-size: 0.875rem;
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
}

.item-status {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-amber);
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-dark);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-amber);
}

.queue-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* History & Calendar specific */
.history-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge-status {
    font-size: 10px;
    font-family: monospace;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-amber);
    text-transform: uppercase;
    font-weight: 800;
}

.badge-status.status-ended {
    background: rgba(244, 67, 54, 0.2) !important;
    color: #f44336 !important;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #10B981;
}

.badge-failed {
    background: rgba(225, 29, 72, 0.2);
    color: #FB7185;
}

.calendar-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.cal-item {
    display: flex;
    gap: 16px;
    align-items: center;
}

.cal-thumb {
    width: 40px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: #000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.cal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cal-date {
    width: 48px;
    text-align: center;
}

.cal-month {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
}

.cal-day {
    font-size: 1.5rem;
    font-weight: 900;
    font-style: italic;
    line-height: 1;
}

.cal-info p:first-child { font-weight: 700; }
.cal-info p:last-child { font-size: 0.75rem; color: var(--text-dim); }

/* Placement */
.col-span-12 { grid-column: span 12; }
.col-span-6 { grid-column: span 6; }

#sabnzbd-card { grid-column: span 12; }
#sonarr-upcoming-card, #radarr-upcoming-card, #sonarr-history-card, #radarr-history-card { grid-column: span 6; }

/* Dashboard Collapsibility */
.card.collapsible .card-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card.collapsible .toggle-icon {
    transition: transform 0.3s ease;
}

.card.collapsible .toggle-icon::before {
    content: '▼';
    font-size: 0.7rem;
    color: var(--text-dim);
}

.card.collapsible.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.card.collapsible.collapsed .collapsible-content {
    display: none;
}

.collapsible-content {
    padding: 0 24px 24px;
}

/* Mobile */
@media (max-width: 1024px) {
    aside.sidebar { display: none; }
    .content-area {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        padding: 16px;
    }
    #sabnzbd-card, #sonarr-upcoming-card, #radarr-upcoming-card, #sonarr-history-card, #radarr-history-card { 
        grid-column: span 1; 
        grid-row: auto; 
    }
    .history-grid { grid-template-columns: 1fr; }
}

.view-container.hidden { display: none; }

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    line-height: normal;
}

.view-header h2 {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: -1.5px;
    text-transform: uppercase;
    font-style: italic;
    color: var(--text-primary);
    margin: 0;
}

.view-header p {
    margin: 0;
    font-family: monospace;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--accent-amber) !important;
}

/* Date with the version number stacked underneath it */
.overview-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.overview-meta #overview-version {
    font-size: 0.65rem;
    opacity: 0.7;
}

/* Config View Styles */
.config-grid {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.config-section {
    padding: 24px;
}

.config-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
}

.form-group input {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    color: white;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--accent-amber);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    border: none;
    transition: opacity 0.2s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--accent-amber);
    color: var(--bg-dark);
}

.btn-error {
    background: #ff5252;
    color: white;
}

.btn-error:hover {
    background: #ff1744;
}

.btn-warning {
    background: #ffb300;
    color: #000;
}

.btn-warning:hover {
    background: #ffa000;
}

.btn-secondary {
    background: var(--bg-item);
    color: var(--text-slate);
    border: 1px solid var(--border-color);
}

.global-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
}

.status-msg {
    font-size: 0.875rem;
}

/* Success/Error message colors */
.msg-success { color: var(--success); }
.msg-error { color: #fb7185; }

/* Dashboard Grid Fix */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: min-content;
    gap: 24px;
    height: 100%;
}

/* Library Views */
.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.search-box {
    display: flex;
    gap: 8px;
    background: var(--bg-item);
    padding: 8px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: white;
    padding: 8px 12px;
    width: 280px;
    font-family: inherit;
}

.search-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
    margin: 24px 0 48px 0;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border-color);
}

.search-card {
    background: var(--bg-item);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    will-change: transform;
    transform: translateZ(0);
}

.search-card:hover {
    border-color: var(--accent-cyan);
    transform: scale(1.03) translateZ(0);
    box-shadow: 0 8px 24px rgba(0, 229, 255, 0.25);
    background: rgba(35, 38, 54, 0.8);
}

.poster-wrapper {
    aspect-ratio: 2/3;
    background: #111;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.poster-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lib-overview {
    font-size: 0.725rem;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 16px;
}

.search-card .add-btn-wrapper {
    margin-top: auto;
}

/* Sub-navigation Tabs */
.sub-nav {
    display: flex;
    gap: 4px;
    background: #0d0d0d;
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.sub-nav-tab {
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sub-nav-tab:hover {
    color: white;
}

.sub-nav-tab.active {
    background: var(--bg-item);
    color: var(--accent-amber);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Embedded Form (Replacement for Drawer) */
.embedded-form-container {
    background: var(--bg-item);
    border: 1px solid var(--accent-amber);
    border-radius: 16px;
    padding: 24px;
    animation: fadeIn 0.3s ease-out;
}

.embedded-form-container .drawer-header {
    margin-bottom: 24px;
}

.library-filter-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
    margin-bottom: 24px;
}

/* Sortable List Styles */
.sortable-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sortable-item {
    background: var(--bg-item);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    cursor: grab;
    transition: all 0.2s ease;
}

.sortable-item:active {
    cursor: grabbing;
}

.sortable-item:hover {
    border-color: var(--accent-amber);
    background: rgba(255, 191, 0, 0.05);
}

.sortable-item.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.sortable-item .drag-handle {
    margin-right: 12px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
}

.sortable-item .item-label {
    flex: 1;
    font-weight: 500;
}

.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.mr-2 { margin-right: 0.5rem; }

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

.drawer-header {
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: -24px -24px 24px -24px;
    padding: 16px 24px;
}

.drawer-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-amber);
}

.drawer-form {
    padding: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.btn-icon:hover {
    color: #fb7185;
}

.mb-8 { margin-bottom: 32px; }
.mt-4 { margin-top: 16px; }
.mr-2 { margin-right: 8px; }
.text-right { text-align: right; }

.library-card {
    background: var(--bg-item);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: center;
    position: relative;
    will-change: transform, box-shadow;
    transform: translateZ(0);
}

.lib-thumbnail {
    width: 48px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #111;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.lib-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lib-thumbnail .no-thumbnail {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: var(--text-dim);
    text-transform: uppercase;
    font-weight: 700;
}

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

.download-indicator {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    z-index: 10;
}

.download-indicator.downloaded {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.library-card:hover {
    border-color: var(--accent-cyan);
    transform: scale(1.03) translateZ(0);
    z-index: 50;
    background: rgba(35, 38, 54, 0.8);
    box-shadow: 0 8px 24px rgba(0, 229, 255, 0.25);
}

.library-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lib-meta {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--accent-amber);
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}

.lib-seasons, .lib-size {
    font-size: 0.8rem;
    color: var(--text-slate);
    font-weight: 500;
}

/* Status Banner */
.status-banner {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    flex: 1;
    margin: 0 24px;
}

.mobile-status-banner {
    display: none !important;
}

.status-indicator {
    background: rgba(0, 229, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.status-indicator:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.2);
}

.status-indicator:hover .status-popup {
    display: block;
}

.status-popup {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    background: #1a1a1a;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    z-index: 1000;
    margin-top: 12px;
}

.status-popup::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-bottom-color: var(--border-color);
}

.popup-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.8rem;
}

.popup-row:last-child { margin-bottom: 0; }

.popup-label { color: var(--text-dim); }
.popup-value { font-weight: 700; color: white; }
.popup-error { color: var(--accent-amber); font-weight: 700; }

/* Integrated Search Workspace */
.search-workspace {
    margin-top: 32px;
}

.big-search-box {
    position: relative;
    margin-bottom: 48px;
}

.big-search-box input {
    width: 100%;
    background: var(--bg-item);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px 32px;
    font-size: 1.5rem;
    color: white;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.big-search-box input:focus {
    border-color: var(--accent-amber);
    box-shadow: 0 15px 40px rgba(245, 158, 11, 0.1);
    transform: translateY(-2px);
}

.search-shortcut {
    position: absolute;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    pointer-events: none;
}

@media (max-width: 768px) {
    .search-shortcut {
        display: none;
    }
}

/* Detailed Search Results */
.detailed-results-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.detailed-result-tile {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    gap: 32px;
    padding: 24px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    animation: slideIn 0.4s ease-out backwards;
    will-change: transform;
    transform: translateZ(0);
}

.detailed-result-tile:hover {
    border-color: var(--accent-cyan);
    background: rgba(35, 38, 54, 0.8);
    box-shadow: 0 8px 24px rgba(0, 229, 255, 0.25);
    transform: scale(1.01) translateZ(0);
}

.tile-poster {
    width: 180px;
    aspect-ratio: 2/3;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.tile-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tile-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tile-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 24px;
}

.tile-title-row h3 {
    font-size: 1.75rem;
    font-weight: 800;
    color: white;
    margin: 0;
}

.tile-year {
    font-size: 1.25rem;
    color: var(--text-dim);
    font-weight: 300;
}

.tile-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
    min-width: 320px;
}

.tile-select-row {
    display: flex;
    gap: 16px;
    width: 100%;
}

.tile-select-row .tile-form-group {
    flex: 1;
    min-width: 0;
}

.tile-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tile-form-group label {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 800;
    color: var(--text-muted);
}

.tile-form-group select {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    color: white;
    font-size: 0.8rem;
    outline: none;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.tile-overview {
    font-size: 0.95rem;
    color: var(--text-dim);
    line-height: 1.6;
    margin: 12px 0 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Calendar Workspace */
.calendar-workspace {
    margin-top: 32px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    height: calc(100vh - 250px);
}

.calendar-column {
    background: rgba(35, 38, 54, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.column-header {
    padding: 12px;
    background: rgba(0, 229, 255, 0.05);
    text-align: center;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--accent-cyan);
    border-bottom: 1px solid var(--border-color);
}

.column-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.calendar-tile {
    background: var(--bg-item);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    transition: all 0.2s ease;
}

.calendar-tile:hover {
    border-color: var(--accent-amber);
    transform: translateY(-2px);
}

.tile-main {
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    margin-bottom: 4px;
}

.tile-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: monospace;
}

.column-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-style: italic;
    margin-top: 20px;
}

/* Modal / Overlay Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.detail-panel-container {
    background: #0d1117;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    width: 95%;
    max-width: 1000px;
    max-height: 90vh;
    position: relative;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
}

.close-panel-btn {
    position: absolute;
    top: 24px;
    right: 24px;
    background: rgba(255,255,255,0.05);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-panel-btn:hover {
    background: var(--accent-amber);
    color: var(--bg-dark);
    transform: rotate(90deg);
}

/* Detail Hydrator Interior */
#detail-content-hydrator {
    padding: 40px;
    overflow-y: auto;
    flex: 1;
}

.detail-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 48px;
}

.detail-poster {
    width: 100%;
    aspect-ratio: 2/3;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.detail-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-meta-block h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.detail-sub-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.badge {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
}

.badge-network { background: rgba(255,255,255,0.1); color: var(--text-dim); }

/* Progress Bar */
.progress-section {
    margin: 32px 0;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 8px;
}

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

.progress-fill {
    height: 100%;
    background: var(--accent-amber);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.5);
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.detail-overview-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-dim);
    margin-bottom: 40px;
}

/* Season List */
.season-breakdown {
    border-top: 1px solid var(--border-color);
    padding-top: 32px;
}

.season-breakdown h3 {
    margin-bottom: 24px;
    font-size: 1.25rem;
    font-weight: 800;
}

.season-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.season-row {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.season-number {
    font-weight: 700;
    font-size: 1rem;
}

.season-stats {
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--accent-amber);
}

@media (max-width: 768px) {
    .detail-layout {
        grid-template-columns: 1fr;
    }
    .detail-poster {
        max-width: 250px;
        margin: 0 auto;
    }
    #detail-content-hydrator {
        padding: 24px;
    }
    .detail-layout {
        gap: 24px;
    }
}
/* Calendar View Enhancements */
.calendar-controls {
    display: flex;
    justify-content: center;
    align-items: center;
}

.segmented-control {
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 12px;
    display: flex;
    gap: 4px;
    border: 1px solid var(--border-color);
}

.segment-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 8px 24px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.segment-btn:hover {
    color: white;
    background: rgba(255,255,255,0.05);
}

.segment-btn.active {
    background: var(--accent-amber);
    color: var(--bg-dark);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* Rich Calendar Tile */
.rich-cal-tile {
    background: var(--bg-item);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    gap: 12px;
    align-items: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
    will-change: transform;
    transform: translateZ(0);
}

.rich-cal-tile:hover {
    border-color: var(--accent-cyan);
    background: rgba(35, 38, 54, 0.8);
    transform: scale(1.03) translateZ(0);
    box-shadow: 0 8px 24px rgba(0, 229, 255, 0.25);
}

.rich-cal-thumb {
    width: 80px;
    height: 45px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    background: #000;
}

.rich-cal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rich-cal-info {
    flex: 1;
    min-width: 0;
}

.rich-cal-episode {
    font-weight: 800;
    font-size: 0.8rem;
    color: white;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rich-cal-series {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Specific Grid Adjustments for Month View */
.calendar-grid.month-view {
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: minmax(120px, auto);
    height: auto;
}

.calendar-view-title {
    font-size: 1.35rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-main);
    margin-bottom: 20px;
    background: linear-gradient(90deg, var(--text-main), var(--text-dim));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.calendar-action-bar {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.calendar-action-label {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.select-month-filter {
    background: rgba(30, 32, 48, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.select-month-filter:hover {
    border-color: rgba(0, 229, 255, 0.6);
}

.select-month-filter:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.2);
}

.month-headers-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    margin-top: 24px;
    margin-bottom: 16px;
}

.month-header-cell {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: var(--accent-cyan);
    text-transform: uppercase;
    padding: 12px 6px;
    background: rgba(0, 229, 255, 0.04);
    border: 1px solid rgba(0, 229, 255, 0.15);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.month-header-cell .day-full {
    display: inline;
}

.month-header-cell .day-short {
    display: none;
}

@media (max-width: 768px) {
    .month-headers-grid {
        gap: 6px;
        margin-top: 16px;
        margin-bottom: 10px;
    }
    .month-header-cell {
        font-size: 0.65rem;
        padding: 8px 2px;
        letter-spacing: 0.05em;
    }
    .month-header-cell .day-full {
        display: none;
    }
    .month-header-cell .day-short {
        display: inline;
    }
}

.month-day-cell {
    border: 1px solid var(--border-color);
    padding: 8px;
    min-height: 120px;
    transition: all 0.2s ease;
}

.month-day-cell.adjacent-month {
    opacity: 0.35;
}

.month-day-cell.adjacent-month .mini-event {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 255, 255, 0.04) !important;
    color: var(--text-muted) !important;
    box-shadow: none !important;
}

.month-day-cell.is-today {
    border: 1px solid var(--accent-cyan);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.25), inset 0 0 8px rgba(0, 229, 255, 0.1);
}

.day-number {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-align: right;
}

.mini-event {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    background: rgba(0, 229, 255, 0.05);
    border: 1px solid rgba(0, 229, 255, 0.1);
    border-radius: 4px;
    margin-bottom: 4px;
    color: var(--text-dim);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s ease;
}

.mini-event:hover {
    background: rgba(0, 229, 255, 0.15);
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

/* Unified Calendar Row */
.unified-calendar-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    width: 100%;
    padding-bottom: 12px;
    min-height: 280px; /* CLS Protection */
}

.unified-day-group {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.unified-empty-placeholder {
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 20px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    text-align: center;
}

.unified-empty-placeholder p {
    font-size: 0.7rem;
    color: var(--text-dim);
    font-style: italic;
    margin: 0;
}

.unified-day-header {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}

.unified-day-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.unified-tile {
    /* Previous styles preserved, flex reset for column stacking in day content */
    background: var(--bg-item);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    gap: 12px;
    align-items: center;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
    will-change: transform;
    transform: translateZ(0);
}

.unified-tile:hover {
    border-color: var(--accent-cyan);
    background: rgba(35, 38, 54, 0.8);
    transform: scale(1.03) translateZ(0);
    box-shadow: 0 8px 24px rgba(0, 229, 255, 0.25);
}

.unified-tile.type-series {
    border-left: 3px solid #6366f1; /* Neon Indigo for Series */
}

.unified-tile.type-movie {
    border-left: 3px solid #f43f5e; /* Neon Rose for Movies */
}

.unified-thumb {
    width: 60px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #000;
}

.unified-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.unified-type-badge {
    font-size: 0.6rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    display: block;
}

.type-series .unified-type-badge { color: #818cf8; }
.type-movie .unified-type-badge { color: #fb7185; }

.unified-title {
    font-weight: 800;
    font-size: 0.875rem;
    color: white;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unified-subtitle {
    font-size: 0.75rem;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 8px;
}

.unified-date {
    font-size: 0.7rem;
    font-weight: 700;
    font-family: monospace;
    color: var(--accent-amber);
}

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

@media (max-width: 1400px) {
    .calendar-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        height: auto;
    }
}

@media (max-width: 768px) {
    .detailed-result-tile {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .tile-header {
        flex-direction: column;
        align-items: center;
    }
    .tile-actions {
        flex-direction: column;
        width: 100%;
        min-width: 0;
    }
    .tile-select-row {
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }
    .tile-form-group { width: 100%; }
}
.status-indicator .label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.1em;
}

.status-indicator .value {
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-dot.online { 
    background: var(--success); 
    box-shadow: 0 0 12px var(--success);
    animation: pulse-green 2s infinite;
}

.status-dot.offline { 
    background: #fb7185; 
    box-shadow: 0 0 12px #fb7185; 
}

@keyframes pulse-green {
    0% { transform: scale(1); box-shadow: 0 0 8px var(--success); }
    50% { transform: scale(1.2); box-shadow: 0 0 16px var(--success); }
    100% { transform: scale(1); box-shadow: 0 0 8px var(--success); }
}

/* Switch Toggle */
.inline-group {
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-top: 1px solid var(--border-color);
}

.switch-label {
    margin-bottom: 0 !important;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-slate);
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-amber);
    border-color: var(--accent-amber);
}

input:checked + .slider:before {
    transform: translateX(20px);
    background-color: var(--bg-dark);
}

/* --- Responsive Overhaul (Final Appends) --- */

.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    margin-right: 12px;
}

/* Tablet Overrides */
@media (max-width: 1024px) {
    aside.sidebar {
        width: 80px;
        padding: 16px 8px;
        align-items: center;
    }
    
    .sidebar-link span, 
    .nav-label,
    .nav-group-header span:last-child,
    .sub-nav-menu,
    .uptime-card {
        display: none !important;
    }
    
    .sidebar-link {
        justify-content: center;
        padding: 12px;
    }
    
    .sidebar-link i {
        margin: 0;
        width: 24px;
        height: 24px;
    }

    .main-layout {
        flex-direction: row;
    }
    
    .view-header h2 {
        font-size: 1.5rem;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .col-span-12, #sabnzbd-card, #unified-weekly-card {
        grid-column: span 2;
    }

    /* Refine the layout header and status banner spacing for tablets */
    .view-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 16px !important;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 16px !important;
    }
    
    .status-banner {
        margin: 0 !important;
        justify-content: flex-start !important;
        width: 100% !important;
        gap: 10px !important;
        position: relative;
    }

    /* Keep the weekly scheduler from squishing into 7 tight columns */
    .unified-calendar-row {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        scroll-snap-type: x mandatory !important;
        gap: 16px !important;
        width: 100% !important;
        padding: 4px 4px 16px 4px !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* Elegant Custom Scrollbar for horizontal sliders on tablet and mobile */
    .unified-calendar-row::-webkit-scrollbar {
        height: 6px !important;
    }
    
    .unified-calendar-row::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.02) !important;
        border-radius: 8px !important;
    }
    
    .unified-calendar-row::-webkit-scrollbar-thumb {
        background: rgba(0, 229, 255, 0.15) !important;
        border-radius: 8px !important;
    }
    
    .unified-calendar-row::-webkit-scrollbar-thumb:hover {
        background: var(--accent-cyan) !important;
    }
    
    .unified-day-group {
        flex: 0 0 calc(33.333% - 12px) !important; /* Show 3 columns neatly on tablet */
        min-width: 220px !important;
        scroll-snap-align: start !important;
        width: auto !important;
    }
}

/* Smartphone Overrides */
@media (max-width: 768px) {
    body {
        overflow: auto;
    }

    #app > header {
        height: 64px;
        padding: 0 16px;
        position: sticky;
        top: 0;
    }

    .mobile-menu-btn {
        display: block;
    }

    .logo-text {
        font-size: 1.5rem;
    }

    .header-stats {
        display: none;
    }

    .main-layout {
        flex-direction: column;
    }

    aside.sidebar {
        position: fixed;
        top: 64px;
        left: -100%;
        width: fit-content;
        min-width: 180px;
        max-width: 85vw;
        height: calc(100vh - 64px);
        z-index: 1000;
        background: var(--bg-sidebar);
        transition: left 0.3s ease;
        display: flex !important; /* Override tablet hidden */
        flex-direction: column;
        padding: 24px;
        align-items: flex-start;
        overflow-y: auto;
        overflow-x: hidden;
    }

    aside.sidebar.active {
        left: 0;
    }

    aside.sidebar.active .sidebar-link span, 
    aside.sidebar.active .nav-label,
    aside.sidebar.active .nav-group-header span:last-child,
    aside.sidebar.active .sub-nav-menu,
    aside.sidebar.active .uptime-card {
        display: block !important;
    }

    .view-container {
        padding: 20px 16px;
        height: auto !important;
        min-height: 100% !important;
    }

    /* Mobile Status Banner Optimizations */
    .desktop-status-banner {
        display: none !important;
    }

    .mobile-status-banner {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        width: 100% !important;
        margin: 0 0 16px 0 !important;
    }

    .mobile-status-banner .status-indicator {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 8px 12px !important;
        gap: 8px !important;
        border-radius: 8px !important;
        background: rgba(0, 229, 255, 0.05) !important;
        border: 1px solid var(--border-color) !important;
        width: 100% !important;
        box-sizing: border-box !important;
        margin: 0 !important;
    }

    .mobile-status-banner .status-indicator .label {
        font-size: 0.7rem !important;
        font-weight: 600 !important;
        text-transform: uppercase !important;
    }

    .mobile-status-banner .status-indicator .value {
        font-size: 0.7rem !important;
        font-family: monospace !important;
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
    }

    .mobile-status-banner .status-indicator .status-dot {
        width: 6px !important;
        height: 6px !important;
    }

    /* Mobile Downloads Stats Tile Optimizations */
    #sabnzbd-view .view-header {
        border-bottom: none !important;
        padding-bottom: 0 !important;
        margin-bottom: 8px !important;
    }

    #sabnzbd-view .header-stats-row {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        width: 100% !important;
        margin-top: 12px !important;
        margin-bottom: 16px !important;
    }

    #sabnzbd-view .stat-tile {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        min-width: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 8px 12px !important;
        border-radius: 8px !important;
        background: rgba(0, 229, 255, 0.05) !important;
        border: 1px solid var(--border-color) !important;
    }

    #sabnzbd-view .stat-tile .stat-label {
        font-size: 0.7rem !important;
        font-weight: 600 !important;
        text-transform: uppercase !important;
        color: inherit !important;
    }

    #sabnzbd-view .stat-tile .stat-value {
        font-size: 0.7rem !important;
        font-family: var(--font-mono) !important;
        color: var(--accent-cyan) !important;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .col-span-12, .col-span-6, 
    #sabnzbd-card, #sonarr-upcoming-card, #radarr-upcoming-card, 
    #sonarr-history-card, #radarr-history-card, #unified-weekly-card {
        grid-column: span 1;
    }

    /* Vertical Day-Grouped Layout for Coming Soon on Mobile */
    .unified-calendar-row {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
        max-height: 600px; 
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 4px 0 !important;
        width: 100% !important;
        scroll-behavior: smooth;
    }

    .unified-day-group {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        width: 100% !important;
    }

    .unified-day-header {
        display: block !important;
        font-size: 0.7rem !important;
        border-bottom: 1px solid rgba(255,255,255,0.05) !important;
        padding-bottom: 4px !important;
        margin-bottom: 4px !important;
    }

    .unified-day-content {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
    }

    .unified-tile {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        padding: 10px !important;
        gap: 12px !important;
        text-align: left !important;
        background: rgba(255, 255, 255, 0.03) !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 8px !important;
        min-width: 0 !important;
        width: 100% !important;
        flex: none !important;
        transition: transform 0.2s ease;
    }

    .collapsed-season {
        background: rgba(99, 102, 241, 0.05) !important;
        border-color: rgba(99, 102, 241, 0.2) !important;
    }

    .unified-tile:hover {
        transform: translateX(4px);
        background: rgba(255, 255, 255, 0.06) !important;
    }

    .unified-tile.type-series {
        border-left: 3px solid #6366f1 !important;
        border-top: none !important;
    }

    .unified-tile.type-movie {
        border-left: 3px solid #f43f5e !important;
        border-top: none !important;
    }

    .unified-thumb {
        width: 44px !important;
        height: 66px !important;
        border-radius: 4px !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
    }

    .unified-info {
        width: auto !important;
        flex: 1 !important;
        padding: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 2px !important;
        align-items: flex-start !important;
        min-width: 0 !important;
    }

    .unified-title {
        font-size: 0.8rem !important;
        white-space: nowrap !important;
        display: block !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        line-height: 1.2 !important;
        height: auto !important;
        margin-bottom: 0 !important;
        font-weight: 700 !important;
        color: white !important;
    }

    .unified-subtitle {
        display: block !important;
        font-size: 0.7rem !important;
        color: var(--text-dim) !important;
        margin: 0 !important;
    }

    .unified-type-badge {
        display: block !important;
        font-size: 0.55rem !important;
        margin: 0 0 2px 0 !important;
    }

    .unified-date {
        display: none !important;
    }

    /* Keep rich cal tiles (upcoming) as nice horizontal feed rows to maximize vertical content space */
    .rich-cal-tile {
        flex-direction: row !important;
        text-align: left !important;
        padding: 10px !important;
        align-items: center !important;
        gap: 12px !important;
    }

    /* Restore matching aspect ratios for non-fused rich cards */
    .rich-cal-thumb {
        width: 80px !important;
        height: 45px !important;
        aspect-ratio: 16/9 !important;
        margin-bottom: 0 !important;
        border-radius: 4px !important;
        overflow: hidden !important;
        flex-shrink: 0 !important;
    }

    .rich-cal-info {
        text-align: left !important;
        width: auto !important;
        flex: 1 !important;
        min-width: 0 !important;
    }
    
    /* Native-feeling Full Width Dropdown Popups for status indicators */
    .status-indicator {
        position: static !important;
    }
    
    .status-popup {
        position: absolute !important;
        width: calc(100% - 32px) !important;
        left: 16px !important;
        transform: none !important;
        box-sizing: border-box !important;
        margin-top: 8px !important;
        box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6) !important;
    }

    /* Increase tap targets */
    .btn, .sidebar-link, .sub-link, .segment-btn {
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .segmented-control {
        width: 100%;
        overflow-x: auto;
    }

    .segment-btn {
        flex: 1;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .calendar-grid {
        grid-template-columns: 1fr;
        height: auto;
    }

    .detail-panel-container {
        margin: 10px;
        width: auto;
    }

    .detail-layout {
        grid-template-columns: 1fr;
        gap: 24px;
        text-align: center;
    }

    .detail-poster {
        max-width: 200px;
        margin: 0 auto;
    }

    .detail-sub-header {
        justify-content: center;
    }

    .form-actions {
        flex-direction: column;
        gap: 12px;
    }

    .form-actions .btn {
        width: 100%;
    }
}

/* Downloads Page Extended */
.header-stats-row {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.stat-tile {
    flex: 1;
    min-width: 120px;
    background: rgba(255, 255, 255, 0.03);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-tile .stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.stat-tile .stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
}

.secondary-card {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.history-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px 0;
}

.history-item:last-child {
    border-bottom: none;
}

.history-status {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 100px;
    text-transform: uppercase;
    font-weight: 700;
}

.history-status.completed {
    background: rgba(0, 230, 118, 0.1);
    color: #00e676;
}

.history-status.failed {
    background: rgba(255, 82, 82, 0.1);
    color: #ff5252;
}

.expanded-card {
    border-left: 4px solid var(--accent-cyan) !important;
}

.expanded-item {
    background: rgba(255,255,255,0.03);
    padding: 16px !important;
    border-radius: 12px;
    margin-bottom: 12px;
}

.expanded-item .item-title {
    font-size: 1rem !important;
}

.expanded-item .item-meta {
    display: flex;
    gap: 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 10px;
}

.expanded-queue {
    padding: 20px 0;
}

.dot-indicator.pulsate-downloads {
    background-color: var(--accent-cyan) !important;
    box-shadow: 0 0 8px var(--accent-cyan);
    animation: pulsate 1.5s ease-in-out infinite;
    border: none !important;
}

@keyframes pulsate {
    0% { transform: scale(0.95); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.7; }
}

/* Season Breakdown Enhancements */
.season-row {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
    transition: background 0.2s;
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
}

.season-row.expanded {
    flex-direction: column;
    align-items: stretch;
}

.season-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.season-main {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    justify-content: space-between;
    flex: 1;
    min-width: 300px;
}

@media (max-width: 480px) {
    .season-main {
        min-width: auto;
        padding: 10px 12px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .season-info {
        width: 100%;
        justify-content: space-between;
    }
    
    .season-actions {
        width: 100%;
        justify-content: space-between;
        padding-top: 8px;
        border-top: 1px solid rgba(255, 255, 255, 0.03);
    }
}

.season-row.expanded .season-main {
    flex: none;
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.03);
}

.season-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.season-number {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-color);
}

.season-stats {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.season-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-monitor-search {
    padding: 6px 12px;
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: 4px;
    background: rgba(234, 179, 8, 0.1);
    color: #EAB308;
    border: 1px solid rgba(234, 179, 8, 0.2);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-monitor-search:hover {
    background: #EAB308;
    color: var(--bg-dark);
}

.btn-monitor-search.searching {
    pointer-events: none;
    opacity: 0.7;
    animation: pulsate 1.5s infinite;
}

.season-expand-icon {
    transition: transform 0.3s;
    color: var(--text-muted);
}

.season-row.expanded .season-expand-icon {
    transform: rotate(180deg);
}

.episode-list {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 8px 16px 16px;
    display: none;
}

.season-row.expanded .episode-list {
    display: block;
}

.episode-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    gap: 12px;
}

@media (max-width: 480px) {
    .episode-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 12px 0;
    }
    
    .episode-date {
        width: 100%;
        justify-content: flex-start;
    }
}

.episode-title {
    font-size: 0.8rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.ep-num {
    color: var(--accent-cyan);
    font-weight: 700;
    font-family: var(--font-mono);
    min-width: 30px;
}

.episode-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 12px;
}

.missing-badge, .queued-badge, .downloading-badge {
    font-size: 0.6rem;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 700;
}

/* Theme Selector UI Component */
.theme-selector-container {
    padding-top: 8px;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

.theme-option {
    background: var(--bg-item);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.theme-option:hover {
    border-color: var(--accent-cyan);
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

.theme-option.active {
    border-color: var(--accent-amber);
    background: rgba(245, 158, 11, 0.1);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.1);
}

.theme-preview {
    width: 100%;
    height: 64px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    background-size: cover;
}

.theme-preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.theme-preview.original { background: #0B0D17; }
.theme-preview.original::before { background: linear-gradient(135deg, #FFC107 0%, #00E5FF 100%); opacity: 0.15; }

.theme-preview.light { background: #F8F9FA; }
.theme-preview.light::before { background: linear-gradient(135deg, #2B3A42 0%, #0056B3 100%); opacity: 0.1; }

.theme-preview.dark { background: #121212; }
.theme-preview.dark::before { background: linear-gradient(135deg, #90A4AE 0%, #FF1744 100%); opacity: 0.2; }

.theme-preview.pastel-light { background: #F4F1EA; }
.theme-preview.pastel-light::before { background: linear-gradient(135deg, #B39DDB 0%, #A5D6A7 100%); opacity: 0.3; }

.theme-preview.pastel-dark { background: #1E1E24; }
.theme-preview.pastel-dark::before { background: linear-gradient(135deg, #F48FB1 0%, #9FA8DA 100%); opacity: 0.2; }

.theme-preview.synthwave { background: #1A0B2E; }
.theme-preview.synthwave::before { background: linear-gradient(135deg, #FF007F 0%, #00F0FF 100%); opacity: 0.3; }

.theme-preview.matrix { background: #000000; }
.theme-preview.matrix::before { background: linear-gradient(135deg, #00FF41 0%, #39FF14 100%); opacity: 0.2; }

.theme-option span {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-slate);
}

.theme-option.active span {
    color: var(--accent-amber);
}

.missing-badge {
    background: rgba(244, 67, 54, 0.1);
    color: #f44336;
}

.queued-badge {
    background: rgba(255, 152, 0, 0.1);
    color: #ff9800;
}

.downloading-badge {
    background: rgba(255, 235, 59, 0.1);
    color: #fdd835;
    animation: pulsate 1.5s infinite;
}

.btn-ep-search {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-ep-search:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    background: rgba(0, 188, 212, 0.05);
}

.btn-ep-search.searching {
    animation: pulsate 1.5s infinite;
    pointer-events: none;
}

/* Quality Toggle Switch */
.quality-toggle-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.quality-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.3s;
}

.quality-label.active {
    color: var(--accent-cyan);
}

.quality-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

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

.quality-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.05);
    transition: .3s;
    border-radius: 22px;
    border: 1px solid var(--border-color);
}

.quality-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-slate);
    transition: .3s;
    border-radius: 50%;
}

.quality-switch input:checked + .quality-slider {
    background-color: rgba(0, 229, 255, 0.15);
    border-color: var(--accent-cyan);
}

.quality-switch input:checked + .quality-slider:before {
    transform: translateX(22px);
    background-color: var(--accent-cyan);
}

/* ============================================================
   Sync Section (modals, dual file-tree, progress)
   ============================================================ */

.col-span-4 { grid-column: span 4; }
.col-span-8 { grid-column: span 8; }

.sync-profile-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sync-profile-item {
    background: var(--bg-item);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 0.15s, background 0.15s;
}

.sync-profile-item:hover {
    border-color: var(--accent-cyan);
}

.sync-profile-item.active {
    border-color: var(--accent-amber);
    background: rgba(255, 193, 7, 0.08);
}

.sync-profile-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.sync-profile-name {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sync-profile-meta {
    display: flex;
    gap: 8px;
    font-size: 0.65rem;
    color: var(--text-dim);
    font-family: monospace;
}

.sync-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-dim);
    flex-shrink: 0;
}

.sync-status-dot.syncing {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.sync-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
    gap: 8px;
}

.sync-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}

.sync-top-bar h3 {
    font-size: 1.1rem;
    font-weight: 800;
}

.sync-workstation-row {
    display: flex;
    gap: 20px;
    align-items: stretch;
    flex-wrap: wrap;
}

.sync-workstation-row > .sync-workspace-card {
    flex: 1 1 320px;
    min-width: 280px;
}

.sync-center-col {
    width: 240px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sync-center-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sync-center-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-align: center;
}

.sync-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.sync-footer-stats {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.sync-status-readout {
    font-size: 0.8rem;
    font-weight: 700;
}

.sync-progress-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.sync-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-dim);
    font-family: monospace;
}

.modal-card {
    background: #0d1117;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sync-mirror-warning {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(255, 179, 0, 0.1);
    border: 1px solid rgba(255, 179, 0, 0.25);
    border-radius: 8px;
    color: var(--accent-amber, #ffb300);
    font-size: 0.75rem;
    font-weight: 600;
}

.sync-workspace-card {
    background: var(--bg-item);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sync-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.sync-path-bar {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.sync-path-bar input {
    flex: 1;
    min-width: 0;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.75rem;
}

.sync-filter-bar {
    display: flex;
    gap: 16px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.65rem;
    color: var(--text-muted);
}

.sync-filter-bar label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sync-tree-area {
    flex: 1;
    min-height: 280px;
    max-height: 420px;
    overflow-y: auto;
    padding: 10px;
}

.sync-tree-node-row {
    display: flex;
    align-items: center;
    padding: 3px 4px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-slate);
}

.sync-tree-node-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.sync-tree-node.is-target .sync-tree-node-row {
    color: var(--text-dim);
    opacity: 0.75;
}

.sync-tree-children {
    padding-left: 18px;
    border-left: 1px solid var(--border-color);
    margin-left: 8px;
}

.sync-tree-toggle {
    width: 16px;
    flex-shrink: 0;
    cursor: pointer;
    font-family: monospace;
    font-size: 0.65rem;
    color: var(--text-dim);
    text-align: center;
}

.sync-tree-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 260px;
    text-align: center;
    color: var(--text-dim);
    gap: 8px;
    padding: 24px;
}

.sync-mode-toggle,
.sync-direction-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px;
}

.sync-toggle-btn {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 8px 10px;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background 0.15s, color 0.15s;
}

.sync-toggle-btn:hover {
    color: var(--text-primary);
}

.sync-toggle-btn.active {
    background: var(--accent-amber);
    color: var(--bg-dark);
}

.sync-exclusion-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.7rem;
    font-family: monospace;
}

.sync-exclusion-chip button {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 0;
    display: flex;
}

.sync-exclusion-chip button:hover {
    color: #ff5252;
}

.sync-exclusion-chip.inactive {
    opacity: 0.4;
    text-decoration: line-through;
}

.sync-progress-track {
    width: 100%;
    height: 8px;
    background: var(--bg-dark);
    border-radius: 4px;
    overflow: hidden;
}

.sync-progress-fill {
    height: 100%;
    background: var(--accent-amber);
    transition: width 0.3s ease;
}

.sync-ops-list {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-dark);
}

.sync-op-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    font-size: 0.7rem;
    font-family: monospace;
    border-bottom: 1px solid var(--border-color);
}

.sync-op-row:last-child { border-bottom: none; }

.sync-op-action {
    font-weight: 800;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.6rem;
    flex-shrink: 0;
}

.sync-op-action.copy, .sync-op-action.update {
    background: rgba(0, 229, 255, 0.15);
    color: var(--accent-cyan);
}

.sync-op-action.delete {
    background: rgba(255, 82, 82, 0.15);
    color: #ff5252;
}

.sync-op-path {
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.monitored-badge {
    background: rgba(0, 230, 118, 0.1);
    color: #00e676;
    border: 1px solid rgba(0, 230, 118, 0.2);
    padding: 6px 12px;
    font-size: 0.65rem;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

/* Responsive grid spans — must come after the .col-span-* definitions above
   so the md: variants win the cascade at desktop widths */
@media (min-width: 768px) {
    .md\:col-span-4 { grid-column: span 4; }
    .md\:col-span-8 { grid-column: span 8; }
}
