@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg-deep: #0a0a14;
    --bg: #0f0f1e;
    --bg-card: rgba(22, 22, 42, 0.55);
    --sidebar: rgba(14, 14, 30, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-light: rgba(255, 255, 255, 0.14);
    --text: #ffffff;
    --muted: #9b9bb8;
    --gradient-purple: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);
    --gradient-orange: linear-gradient(135deg, #f97316 0%, #fbbf24 100%);
    --gradient-cyan: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --gradient-pink: linear-gradient(135deg, #db2777 0%, #f472b6 100%);
    --gradient-green: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --glow-purple: 0 8px 32px rgba(124, 58, 237, 0.25);
    --glow-orange: 0 8px 32px rgba(249, 115, 22, 0.3);
    --glow-cyan: 0 8px 32px rgba(6, 182, 212, 0.25);
    --danger: #ef4444;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-pill: 999px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-deep);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Ambient background */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
}
body::before {
    width: 480px; height: 480px;
    background: rgba(124, 58, 237, 0.18);
    top: -120px; right: 10%;
}
body::after {
    width: 400px; height: 400px;
    background: rgba(6, 182, 212, 0.12);
    bottom: -80px; left: 20%;
}

.app {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* ── Sidebar ── */
.sidebar {
    width: 260px;
    background: var(--sidebar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    padding: 1.75rem 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.logo {
    padding: 0 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
}
.logo-mark {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: var(--gradient-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    box-shadow: var(--glow-purple);
    flex-shrink: 0;
}
.logo-text h1 {
    font-size: 1.15rem;
    font-weight: 700;
    background: var(--gradient-purple);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.logo-text span {
    font-size: 0.72rem;
    color: var(--muted);
    letter-spacing: 0.03em;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0 0.75rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    color: var(--muted);
    text-decoration: none;
    transition: all 0.25s ease;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 500;
}
.nav-item:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--glass-border);
}
.nav-item.active {
    color: var(--text);
    background: rgba(124, 58, 237, 0.15);
    border-color: rgba(124, 58, 237, 0.35);
    box-shadow: inset 0 0 20px rgba(124, 58, 237, 0.08);
}
.nav-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
    transition: background 0.25s;
}
.nav-item.active .nav-icon {
    background: var(--gradient-purple);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}
.nav-emergency.active {
    background: rgba(239, 68, 68, 0.12) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
}
.nav-emergency.active .nav-icon {
    background: linear-gradient(135deg, #ef4444, #f97316) !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4) !important;
}
.nav-emergency:hover { color: #fca5a5 !important; }

.sidebar-footer {
    padding: 1rem 1.5rem 0;
    font-size: 0.72rem;
    color: var(--muted);
    border-top: 1px solid var(--glass-border);
    margin-top: 1rem;
}

/* ── Main content ── */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(10, 10, 20, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-left { display: flex; flex-direction: column; gap: 0.15rem; }
.topbar h2 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.topbar-subtitle {
    font-size: 0.78rem;
    color: var(--muted);
}

.sync-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sync-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.85rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    color: var(--muted);
}
.sync-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--gradient-green);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
    animation: blink 2s infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

#page-content {
    padding: 1.75rem 2rem 2.5rem;
    flex: 1;
}

/* ── Glass cards ── */
.glass-card,
.stat-card,
.panel-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.35rem;
    transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}
.glass-card:hover,
.stat-card:hover {
    border-color: var(--glass-border-light);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.panel-card { margin-bottom: 1.5rem; }
.panel-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}
.panel-card .panel-desc {
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 1.1rem;
    line-height: 1.5;
}

/* ── Stats grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 1.25rem;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
}
.stat-card--purple::before { background: var(--gradient-purple); }
.stat-card--cyan::before { background: var(--gradient-cyan); }
.stat-card--orange::before { background: var(--gradient-orange); }
.stat-card--pink::before { background: var(--gradient-pink); }
.stat-card--green::before { background: var(--gradient-green); }

.stat-card-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}
.stat-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.stat-card--purple .stat-icon { background: rgba(124, 58, 237, 0.2); }
.stat-card--cyan .stat-icon { background: rgba(6, 182, 212, 0.2); }
.stat-card--orange .stat-icon { background: rgba(249, 115, 22, 0.2); }
.stat-card--pink .stat-icon { background: rgba(219, 39, 119, 0.2); }
.stat-card--green .stat-icon { background: rgba(16, 185, 129, 0.2); }

.stat-card .value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
}
.stat-card--purple .value { background: var(--gradient-purple); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.stat-card--cyan .value { background: var(--gradient-cyan); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.stat-card--orange .value { background: var(--gradient-orange); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.stat-card--pink .value { background: var(--gradient-pink); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.stat-card--green .value { background: var(--gradient-green); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

.stat-card .label {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.3rem;
    font-weight: 500;
}

/* ── Hero / feature cards ── */
.dashboard-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 900px) {
    .dashboard-row { grid-template-columns: 1fr; }
}

.hero-card {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.25) 0%, rgba(236, 72, 153, 0.15) 100%);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: var(--radius);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}
.hero-card::after {
    content: '';
    position: absolute;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.2), transparent 70%);
    top: -60px; right: -40px;
    pointer-events: none;
}
.hero-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.hero-card p {
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.55;
    margin-bottom: 1.25rem;
    max-width: 90%;
}

.sync-hero-card {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2) 0%, rgba(251, 191, 36, 0.1) 100%);
    border: 1px solid rgba(249, 115, 22, 0.3);
}

/* ── Gauge ring ── */
.gauge-wrap {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.gauge-ring {
    position: relative;
    width: 80px; height: 80px;
    flex-shrink: 0;
}
.gauge-ring svg { transform: rotate(-90deg); }
.gauge-ring circle.track { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 6; }
.gauge-ring circle.fill { fill: none; stroke-width: 6; stroke-linecap: round; }
.gauge-ring .gauge-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 800;
}

/* ── Mini chart decoration ── */
.mini-chart {
    height: 48px;
    margin-top: 0.75rem;
    opacity: 0.7;
}
.mini-chart svg { width: 100%; height: 100%; }

/* ── Buttons ── */
.btn {
    padding: 0.55rem 1.15rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
    background: var(--gradient-purple);
    color: #fff;
    box-shadow: var(--glow-purple);
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 36px rgba(124, 58, 237, 0.45);
}

.btn-sync {
    background: var(--gradient-orange);
    color: #fff;
    box-shadow: var(--glow-orange);
}
.btn-sync:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 36px rgba(249, 115, 22, 0.45);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid var(--glass-border);
}
.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--glass-border-light);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: #fff;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.35);
}
.btn-danger:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(239, 68, 68, 0.45);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--glass-border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--glass-border-light); }

.btn-sm { padding: 0.38rem 0.8rem; font-size: 0.8rem; border-radius: 8px; }

/* ── Toolbar & filters ── */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.toolbar-left { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.filter-pills { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.filter-pill {
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.filter-pill:hover {
    color: var(--text);
    border-color: var(--glass-border-light);
    background: rgba(255, 255, 255, 0.08);
}
.filter-pill.active {
    color: #fff;
    background: var(--gradient-purple);
    border-color: transparent;
    box-shadow: var(--glow-purple);
}

.filter-select {
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}
.filter-select:focus { border-color: rgba(124, 58, 237, 0.5); }

/* ── Tables ── */
.table-wrap {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 0.85rem 1.15rem;
    text-align: left;
}
th {
    background: rgba(0, 0, 0, 0.25);
    font-weight: 600;
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--glass-border);
}
td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.9rem;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(124, 58, 237, 0.06); }
td strong, td:first-child { font-weight: 500; }

/* ── Shared data tables & paging ── */
.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.page-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 200px;
}
.page-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.page-search {
    min-width: 220px;
    flex: 1;
    max-width: 360px;
    padding: 0.55rem 0.85rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.88rem;
}
.page-search:focus {
    outline: none;
    border-color: rgba(124, 58, 237, 0.5);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.data-table th,
.data-table td { padding: 0.65rem 0.9rem; vertical-align: middle; }
.data-table .col-num {
    width: 48px;
    text-align: center;
    color: var(--muted);
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}
.data-table .col-count { width: 72px; text-align: center; }
.data-table .col-duration,
.data-table .col-updated { width: 100px; white-space: nowrap; font-size: 0.85rem; color: var(--muted); }
.data-table .col-status { width: 100px; }
.data-table .col-layout { max-width: 180px; }
.data-table .col-dl { width: 110px; }
.data-table .col-actions,
.data-table .actions { width: 1%; white-space: nowrap; }
.data-table .empty-row {
    text-align: center;
    color: var(--muted);
    padding: 2rem !important;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    flex-wrap: wrap;
}
.pagination-info {
    font-size: 0.85rem;
    color: var(--muted);
}
.pagination-info strong { color: var(--text); font-weight: 600; }
.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}
.pagination-size {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    color: var(--muted);
    margin-right: 0.35rem;
}
.pagination-size select {
    padding: 0.35rem 0.5rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.82rem;
    cursor: pointer;
}

/* ── Playlist page ── */
.playlist-page { display: flex; flex-direction: column; }
.playlist-table-wrap { margin-bottom: 0; }
.playlist-name { display: block; font-size: 0.9rem; margin-bottom: 0.2rem; }
.playlist-type-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.type-tag {
    display: inline-block;
    padding: 0.12rem 0.45rem;
    border-radius: var(--radius-pill);
    font-size: 0.68rem;
    font-weight: 600;
    background: rgba(124, 58, 237, 0.12);
    color: #c4b5fd;
    border: 1px solid rgba(124, 58, 237, 0.2);
}
.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 0.4rem;
    border-radius: var(--radius-pill);
    background: rgba(6, 182, 212, 0.12);
    color: #22d3ee;
    font-weight: 700;
    font-size: 0.82rem;
    border: 1px solid rgba(6, 182, 212, 0.25);
}
.playlist-preview {
    display: block;
    font-size: 0.82rem;
    color: var(--muted);
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.playlist-row:hover td { background: rgba(124, 58, 237, 0.08); }

/* ── Content page ── */
.content-page { display: flex; flex-direction: column; gap: 0; }
.content-page .page-toolbar-left {
    flex-wrap: wrap;
    align-items: center;
}
.content-page .filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.content-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    padding: 0.7rem 1rem;
    margin-bottom: 1rem;
}
.summary-chip {
    font-size: 0.82rem;
    color: var(--muted);
}
.summary-chip strong {
    color: var(--text);
    font-weight: 700;
}
.summary-chip--accent {
    color: #c4b5fd;
}
.content-table-wrap { margin-bottom: 0; }
.content-name { display: block; font-size: 0.9rem; }
.content-file,
.content-text-preview {
    display: block;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.82rem;
    color: var(--muted);
}
.content-link {
    display: block;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.82rem;
    color: #22d3ee;
    text-decoration: none;
}
.content-link:hover { text-decoration: underline; }
.data-table .col-type { width: 110px; }
.data-table .col-size { width: 88px; white-space: nowrap; font-size: 0.85rem; color: var(--muted); }
.content-row:hover td { background: rgba(124, 58, 237, 0.08); }
.btn-upload { cursor: pointer; margin: 0; }
.btn-upload input { display: none; }

/* ── Library cleanup modal ── */
.cleanup-intro {
    margin: 0 0 0.85rem;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}
.cleanup-intro code {
    background: rgba(255, 255, 255, 0.06);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.85em;
}
.cleanup-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    padding: 0.75rem 0.9rem;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: #fecaca;
}
.cleanup-stats strong { color: #fff; }
.cleanup-table-wrap {
    max-height: 280px;
    overflow: auto;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
}
.cleanup-table { margin: 0; }
.cleanup-file {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: ui-monospace, monospace;
    font-size: 0.8rem;
}
.cleanup-more {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    color: var(--muted);
}
.cleanup-warning {
    margin: 0;
    font-size: 0.82rem;
    color: #fbbf24;
}

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 0.22rem 0.65rem;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.badge-image { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-video { background: rgba(124, 58, 237, 0.2); color: #a78bfa; border: 1px solid rgba(124, 58, 237, 0.3); }
.badge-website { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-text { background: rgba(249, 115, 22, 0.2); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.3); }
.badge-emergency {
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: #fff;
    animation: pulse-glow 1.5s infinite;
    border: none;
}
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 8px rgba(239, 68, 68, 0.5); }
    50% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.8); }
}

.muted-text { color: var(--muted); font-size: 0.88rem; }

/* ── Playback panel ── */
.playback-panel { display: flex; flex-direction: column; gap: 0.75rem; }
.playback-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    transition: border-color 0.2s;
}
.playback-card:hover { border-color: rgba(6, 182, 212, 0.3); }
.playback-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
    gap: 1rem;
}
.playback-zones { display: flex; flex-direction: column; gap: 0.4rem; }
.playback-zone {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.88rem;
    padding: 0.35rem 0;
}
.playback-zone-name { color: var(--muted); min-width: 80px; font-size: 0.8rem; }
.playback-content { font-weight: 600; }

/* ── Emergency ── */
.emergency-card {
    border-color: rgba(239, 68, 68, 0.35) !important;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(249, 115, 22, 0.05)) !important;
    box-shadow: 0 0 40px rgba(239, 68, 68, 0.08);
}
.emergency-active {
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: var(--radius-sm);
}
.emergency-active-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}
.emergency-idle { font-size: 0.9rem; display: flex; align-items: center; gap: 0.5rem; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 500;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.65rem 0.9rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: rgba(124, 58, 237, 0.5);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}
.form-group textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.layout-check-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.65rem 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
}
.layout-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    cursor: pointer;
}

/* ── Modal ── */
.modal {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1300;
    padding: 1rem;
}
.modal.hidden { display: none; }
.hidden { display: none !important; }
.modal-content {
    background: rgba(18, 18, 38, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border-light);
    border-radius: var(--radius);
    width: 90%; max-width: 560px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}
.modal-content.modal-wide {
    max-width: 1060px;
}
.modal-header {
    padding: 1.15rem 1.35rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-body { padding: 1.35rem; }
.modal-footer {
    padding: 1rem 1.35rem;
    border-top: 1px solid var(--glass-border);
    display: flex; justify-content: flex-end; gap: 0.6rem;
}
.btn-close {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--muted);
    font-size: 1.2rem;
    cursor: pointer;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.btn-close:hover { color: var(--text); background: rgba(255,255,255,0.1); }

/* ── Layout editor ── */
.layout-form { display: flex; flex-direction: column; gap: 0.5rem; }

.layout-workspace {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1rem;
    margin-top: 0.5rem;
}

.layout-canvas-wrap { min-width: 0; }

.layout-toolbar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}
.layout-hint {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--muted);
}

.layout-editor {
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    user-select: none;
    touch-action: none;
}
.layout-editor.dragging .layout-zone { transition: none; }

.layout-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 5% 5%;
    pointer-events: none;
}

.layout-zone {
    position: absolute;
    border: 2px dashed;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    font-size: 0.72rem;
    cursor: grab;
    border-radius: 4px;
    transition: box-shadow 0.15s, background 0.15s;
    box-sizing: border-box;
    padding: 0.25rem;
    text-align: center;
    overflow: hidden;
}
.layout-zone:hover { filter: brightness(1.15); }
.layout-zone.selected {
    border-style: solid;
    border-width: 2px;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.15), 0 4px 20px rgba(0,0,0,0.35);
    cursor: grabbing;
    z-index: 50 !important;
}
.layout-zone .zone-label { font-weight: 600; pointer-events: none; }
.layout-zone .zone-coords { font-size: 0.62rem; opacity: 0.8; pointer-events: none; }

.zone-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #fff;
    border: 2px solid #7c3aed;
    border-radius: 2px;
    z-index: 10;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.zone-handle-nw { top: -5px; left: -5px; cursor: nwse-resize; }
.zone-handle-n  { top: -5px; left: 50%; margin-left: -5px; cursor: ns-resize; }
.zone-handle-ne { top: -5px; right: -5px; cursor: nesw-resize; }
.zone-handle-e  { top: 50%; right: -5px; margin-top: -5px; cursor: ew-resize; }
.zone-handle-se { bottom: -5px; right: -5px; cursor: nwse-resize; }
.zone-handle-s  { bottom: -5px; left: 50%; margin-left: -5px; cursor: ns-resize; }
.zone-handle-sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.zone-handle-w  { top: 50%; left: -5px; margin-top: -5px; cursor: ew-resize; }

.layout-sidebar {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    max-height: 420px;
    overflow-y: auto;
}
.layout-sidebar-title {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.zone-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.zone-tab {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--muted);
    font-size: 0.75rem;
    padding: 0.3rem 0.55rem;
    cursor: pointer;
    transition: all 0.15s;
}
.zone-tab:hover { color: var(--text); border-color: rgba(124,58,237,0.4); }
.zone-tab.active {
    background: rgba(124,58,237,0.2);
    border-color: rgba(124,58,237,0.5);
    color: #c4b5fd;
}

.zone-panel { display: flex; flex-direction: column; gap: 0.65rem; }
.zone-panel-empty {
    font-size: 0.8rem;
    color: var(--muted);
    text-align: center;
    padding: 1rem 0.5rem;
    line-height: 1.5;
}
.zone-prop label {
    display: block;
    font-size: 0.72rem;
    color: var(--muted);
    margin-bottom: 0.25rem;
}
.zone-prop input,
.zone-prop select {
    width: 100%;
    padding: 0.45rem 0.55rem;
    background: rgba(0,0,0,0.35);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.82rem;
}

.zone-sliders { display: flex; flex-direction: column; gap: 0.55rem; }
.zone-slider-row label {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--muted);
    margin-bottom: 0.2rem;
}
.zone-slider-row label span { color: #a78bfa; font-weight: 600; }
.zone-slider-row input[type="range"] {
    width: 100%;
    accent-color: #7c3aed;
    margin-bottom: 0.2rem;
}
.zone-slider-row .zone-num {
    width: 100%;
    padding: 0.35rem 0.5rem;
    background: rgba(0,0,0,0.35);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.8rem;
}

body.layout-dragging { cursor: grabbing !important; }
body.layout-dragging * { cursor: grabbing !important; }

.zone-list { margin-top: 1rem; }
.zone-item {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

@media (max-width: 900px) {
    .layout-workspace { grid-template-columns: 1fr; }
    .layout-sidebar { max-height: none; }
}

.playlist-items { margin-top: 0.5rem; }
.playlist-items-header {
    display: grid;
    grid-template-columns: 1fr 60px 80px 72px 36px;
    gap: 0.5rem;
    font-size: 0.68rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0 0 0.35rem;
}
.playlist-item-row {
    display: grid;
    grid-template-columns: 1fr 60px 80px 36px 36px;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}
.playlist-item-row select { flex: 1; min-width: 0; }
.playlist-item-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.65rem;
}
.playlist-upload-panel {
    margin-top: 0.75rem;
    padding: 0.85rem;
    background: rgba(124, 58, 237, 0.08);
    border: 1px dashed rgba(124, 58, 237, 0.35);
    border-radius: var(--radius-sm);
}
.playlist-upload-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #c4b5fd;
    margin-bottom: 0.65rem;
}
.playlist-upload-fields { margin-bottom: 0.65rem; }
.pi-upload { padding: 0.25rem 0.4rem !important; min-width: 36px; }

.actions { display: flex; gap: 0.45rem; flex-wrap: wrap; }

.empty {
    text-align: center;
    padding: 3.5rem 2rem;
    color: var(--muted);
    background: var(--bg-card);
    border: 1px dashed var(--glass-border);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.api-key {
    font-family: 'Consolas', 'Courier New', monospace;
    background: rgba(124, 58, 237, 0.12);
    border: 1px solid rgba(124, 58, 237, 0.25);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #c4b5fd;
}

.api-key-field {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
}
.api-key-field input {
    flex: 1;
    min-width: 200px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
}

/* ── Guide list ── */
.guide-list {
    color: var(--muted);
    line-height: 1.9;
    padding-left: 1.25rem;
    font-size: 0.88rem;
}
.guide-list li::marker { color: #7c3aed; }
.public-view-details { margin-top: 0.5rem; }
.public-view-details.hidden { display: none; }
.public-view-group .layout-check { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }

.display-page { display: flex; flex-direction: column; gap: 1.25rem; }

.display-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}
.display-summary-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.display-summary-item .num {
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
}
.display-summary-item .lbl {
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.display-summary-item.online .num { color: #34d399; }
.display-summary-item.offline .num { color: #94a3b8; }
.display-summary-item.warn .num { color: #fb923c; }

.display-toolbar-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    flex-wrap: wrap;
}
.display-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex: 1;
    min-width: 240px;
    flex-wrap: wrap;
}
.display-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.display-search {
    min-width: 220px;
    flex: 1;
    max-width: 320px;
    padding: 0.55rem 0.85rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.88rem;
}
.display-search:focus {
    outline: none;
    border-color: rgba(124, 58, 237, 0.5);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.display-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 1rem;
    align-items: start;
}
.display-table-area { min-width: 0; }
.display-empty { padding: 2rem; text-align: center; }

.display-table-wrap {
    overflow-x: auto;
    max-height: calc(100vh - 380px);
    overflow-y: auto;
}
.display-table { min-width: 640px; }
.display-table--compact th,
.display-table--compact td { padding: 0.55rem 0.75rem; }
.display-table--compact .col-name { min-width: 140px; }
.display-table th.col-actions,
.display-table td.col-actions { width: 1%; white-space: nowrap; }

.display-row--selected td { background: rgba(124, 58, 237, 0.12) !important; }
.display-row--online .display-name-btn { color: #6ee7b7; }

.display-name-btn {
    background: none;
    border: none;
    color: var(--text);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0;
    cursor: pointer;
    text-align: left;
}
.display-name-btn:hover { color: #c4b5fd; text-decoration: underline; }
.display-table-meta {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.25rem;
    flex-wrap: wrap;
}
.api-key-compact {
    font-size: 0.68rem;
    color: var(--muted);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}
.display-table-layout { font-weight: 500; font-size: 0.85rem; }
.display-dl-text { font-size: 0.82rem; font-weight: 600; }
.display-dl-text.ok { color: #34d399; }
.display-dl-text.warn { color: #fb923c; }
.display-dl-bar--sm { max-width: 90px; margin-top: 0.25rem; }

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.35rem;
    vertical-align: middle;
}
.status-dot--online { background: #34d399; box-shadow: 0 0 6px rgba(52, 211, 153, 0.6); }
.status-dot--offline { background: #64748b; }

.display-table-actions {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}
.btn-danger-text { color: #f87171 !important; }
.btn-danger-text:hover { background: rgba(248, 113, 113, 0.12) !important; }
.btn-block { width: 100%; justify-content: center; }

.display-expand-panel {
    padding: 1rem 1.15rem 1.1rem;
    border-top: 1px solid rgba(124, 58, 237, 0.15);
}
.display-expand-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
.display-expand-block h4,
.display-detail-section h4,
.display-drawer-section h4 {
    margin: 0 0 0.5rem;
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.display-expand-block--wide { grid-column: 1 / -1; }
.display-expand-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--glass-border);
}

.display-info-list {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.display-info-list > div {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 0.5rem;
    font-size: 0.82rem;
}
.display-info-list dt {
    margin: 0;
    color: var(--muted);
    font-weight: 500;
}
.display-info-list dd { margin: 0; word-break: break-word; }
.display-info-list--inline {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
}
.display-info-list--inline > div { grid-template-columns: 1fr; gap: 0.15rem; }

.display-detail-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    max-height: calc(100vh - 320px);
    overflow-y: auto;
    position: sticky;
    top: 1rem;
}
.display-detail-placeholder {
    padding: 2rem 1.25rem;
    text-align: center;
    color: var(--muted);
}
.display-detail-placeholder-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.75rem;
    opacity: 0.6;
}
.display-detail-placeholder p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.5;
}
.display-detail-inner { padding: 1rem; }
.display-detail-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--glass-border);
}
.display-detail-head h3 {
    margin: 0 0 0.35rem;
    font-size: 1rem;
}
.display-detail-section {
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.display-detail-section:last-child { border-bottom: none; margin-bottom: 0; }
.display-detail-screenshot-wrap img,
.display-detail-screenshot {
    width: 100%;
    max-height: 140px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: #000;
}
.display-detail-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.display-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    z-index: 1100;
}
.display-drawer.hidden,
.display-drawer-backdrop.hidden {
    display: none !important;
}
.display-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(480px, 100vw);
    height: 100vh;
    background: rgba(14, 14, 30, 0.98);
    border-left: 1px solid var(--glass-border);
    z-index: 1101;
    display: flex;
    flex-direction: column;
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.45);
}
.display-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}
.display-drawer-header h3 { margin: 0; font-size: 1rem; }
.display-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.15rem 1.5rem;
}
.display-drawer-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.display-drawer-screenshot-area {
    margin-bottom: 1rem;
    background: #000;
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
    padding: 0.5rem;
    min-height: 120px;
}
.display-drawer-screenshot {
    width: 100%;
    max-height: 280px;
    object-fit: contain;
    display: block;
    border-radius: 6px;
}
.display-drawer-section { margin-bottom: 1rem; }
.display-drawer-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

.display-api-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.display-api-row .api-key,
.display-drawer-meta .api-key {
    font-size: 0.72rem;
    padding: 0.15rem 0.4rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    word-break: break-all;
}
.btn-xs {
    padding: 0.15rem 0.45rem;
    font-size: 0.72rem;
    min-height: unset;
}

.status-pill {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.status-pill--online { background: rgba(52, 211, 153, 0.15); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.3); }
.status-pill--offline { background: rgba(148, 163, 184, 0.12); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.25); }
.status-pill--sync { background: rgba(6, 182, 212, 0.12); color: #22d3ee; border: 1px solid rgba(6, 182, 212, 0.25); }
.status-pill--muted { background: rgba(255, 255, 255, 0.04); color: var(--muted); border: 1px solid var(--glass-border); }

.display-layout-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.layout-chip {
    font-size: 0.75rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.15);
    color: #c4b5fd;
    border: 1px solid rgba(124, 58, 237, 0.25);
}
.layout-chip--muted {
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
    border-color: var(--glass-border);
}
.layout-chip--active {
    background: rgba(52, 211, 153, 0.15);
    color: #6ee7b7;
    border-color: rgba(52, 211, 153, 0.35);
}

.display-metric-value { font-size: 0.82rem; font-weight: 600; }
.display-metric-value.ok { color: #34d399; }
.display-metric-value.warn { color: #fb923c; }
.display-dl-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    margin-top: 0.35rem;
    overflow: hidden;
}
.display-dl-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}
.display-dl-fill.ok { background: #34d399; }
.display-dl-fill.warn { background: #fb923c; }

.display-zones {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.display-zone-row {
    display: grid;
    grid-template-columns: minmax(70px, 90px) 1fr auto;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.display-zone-row:last-child { border-bottom: none; }
.display-zone-row .zone-label { color: var(--muted); font-size: 0.78rem; }
.display-zone-row .zone-content { word-break: break-word; }
.display-zone-empty { margin: 0; font-size: 0.82rem; }

/* ── Display log modal ── */
.display-log-modal { display: flex; flex-direction: column; gap: 1rem; }
.display-log-status-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.display-log-updated { margin-left: auto; font-size: 0.78rem; }
.display-log-section h4 {
    margin: 0 0 0.6rem;
    font-size: 0.85rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.display-log-info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem 1rem;
}
.display-log-table-wrap {
    max-height: 280px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}
.display-log-table { font-size: 0.78rem; }
.display-log-table th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.display-log-mac { font-family: ui-monospace, monospace; font-size: 0.72rem; white-space: nowrap; }
.display-log-details { max-width: 180px; word-break: break-word; }
.display-log-event { font-weight: 600; }
.display-log-row--connected .display-log-event { color: #22c55e; }
.display-log-row--disconnected .display-log-event { color: #ef4444; }
.display-log-row--heartbeat .display-log-event { color: var(--muted); }

@media (max-width: 900px) {
    .display-log-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .display-log-info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1200px) {
    .display-main { grid-template-columns: 1fr; }
    .display-detail-panel {
        position: static;
        max-height: none;
    }
    .display-table-wrap { max-height: none; }
}
@media (max-width: 1100px) {
    .display-summary-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .display-summary-grid { grid-template-columns: 1fr 1fr; }
    .display-toolbar-bar { flex-direction: column; align-items: stretch; }
    .display-toolbar-left, .display-toolbar-right { width: 100%; }
    .display-search { max-width: none; }
    .display-info-list--inline { grid-template-columns: 1fr; }
    .display-table-actions .btn { padding: 0.25rem 0.45rem; font-size: 0.75rem; }
    .pagination-bar { flex-direction: column; align-items: stretch; }
    .pagination-controls { justify-content: center; }
}

.license-page { display: flex; flex-direction: column; gap: 1rem; }
.license-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    flex-wrap: wrap;
}
.license-generate-card { max-width: 720px; }
.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
@media (max-width: 640px) {
    .form-row-2 { grid-template-columns: 1fr; }
}

/* ── Settings page ── */
.settings-page { max-width: 640px; }
.settings-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}
.settings-card h3 { margin: 0 0 0.35rem; font-size: 1.1rem; }
.settings-desc { color: var(--text-muted); margin: 0 0 1.25rem; font-size: 0.9rem; }
.settings-form .form-hint {
    display: block;
    margin-top: 0.4rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.45;
}
.input-with-suffix {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.input-with-suffix input { max-width: 120px; }
.input-suffix { color: var(--text-muted); font-size: 0.9rem; }
.form-actions { margin-top: 1.25rem; }
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}
.checkbox-label input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--accent, #7c3aed);
}
.sync-play-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.65rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.82rem; }

.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    line-height: 1.45;
}
.alert-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fecaca;
}

/* ── Schedule (Jadwal) ── */
.schedule-empty {
    text-align: center;
    padding: 3rem 2rem;
    margin-top: 0.5rem;
}
.schedule-empty-icon { font-size: 2.5rem; display: block; margin-bottom: 0.75rem; }
.schedule-empty h3 { font-size: 1.1rem; margin-bottom: 0.35rem; }

.schedule-table-wrap { margin-top: 0.5rem; }
.schedule-table td { vertical-align: middle; }
.schedule-name-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.schedule-priority-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-pill);
    background: rgba(124, 58, 237, 0.2);
    color: #c4b5fd;
    border: 1px solid rgba(124, 58, 237, 0.35);
}
.schedule-layout-chip,
.schedule-recur-chip {
    display: inline-block;
    max-width: 160px;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-pill);
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.25);
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.schedule-display-text {
    display: inline-block;
    max-width: 140px;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.schedule-date-cell { font-size: 0.85rem; white-space: nowrap; }
.schedule-time-range {
    font-family: ui-monospace, 'Cascadia Code', monospace;
    font-size: 0.82rem;
    color: #c4b5fd;
}
.schedule-status {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
}
.schedule-status--active {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.35);
}
.schedule-status--inactive {
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
    border: 1px solid var(--glass-border);
}

.schedule-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.schedule-form-hint {
    padding: 0.9rem 1rem;
    margin-bottom: 1.25rem;
    border-radius: var(--radius-sm);
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.25);
}
.schedule-form-hint strong {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
    color: #ddd6fe;
}
.schedule-form-hint p {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--muted);
}
.schedule-form-hint em { color: #c4b5fd; font-style: normal; font-weight: 500; }

.schedule-form-section {
    padding: 1.1rem 0 0.25rem;
    border-top: 1px solid var(--glass-border);
}
.schedule-form-section:first-of-type { border-top: none; padding-top: 0; }
.schedule-form-section--footer { padding-bottom: 0.25rem; }
.schedule-form-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #a78bfa;
    margin-bottom: 0.85rem;
}
.schedule-form-section-desc {
    font-size: 0.8rem;
    color: var(--muted);
    margin: -0.35rem 0 0.75rem;
}
.schedule-form-note {
    font-size: 0.78rem;
    color: var(--muted);
    margin: 0.25rem 0 0;
}
.schedule-form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem 1rem;
}
.schedule-form .form-group { margin-bottom: 0.85rem; }
.schedule-form-section .form-group:last-child { margin-bottom: 0; }
.field-hint {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.35;
}
.label-sub {
    font-weight: 400;
    color: var(--muted);
    text-transform: none;
    letter-spacing: 0;
}

.schedule-display-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
    max-height: 160px;
    overflow-y: auto;
    padding: 0.65rem;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--glass-border);
}
.schedule-display-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.55rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s;
}
.schedule-display-check:hover { background: rgba(255, 255, 255, 0.04); }
.schedule-display-check input { flex-shrink: 0; accent-color: #7c3aed; }

.schedule-day-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}
.schedule-day-pill {
    cursor: pointer;
}
.schedule-day-pill input { position: absolute; opacity: 0; pointer-events: none; }
.schedule-day-pill span {
    display: inline-block;
    min-width: 2.6rem;
    text-align: center;
    padding: 0.4rem 0.65rem;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.25);
    color: var(--muted);
    transition: all 0.15s;
}
.schedule-day-pill input:checked + span {
    background: var(--gradient-purple);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 12px rgba(124, 58, 237, 0.35);
}

.schedule-active-toggle { display: flex; flex-direction: column; justify-content: flex-start; }
.schedule-active-label {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    margin-top: 1.45rem;
}
.schedule-active-label input { accent-color: #7c3aed; width: 1rem; height: 1rem; }

.modal-body:has(.schedule-form) { padding: 1.25rem 1.5rem 1.5rem; }

@media (max-width: 640px) {
    .schedule-form-grid-2 { grid-template-columns: 1fr; }
    .schedule-active-label { margin-top: 0; }
    .schedule-display-grid { grid-template-columns: 1fr; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
