:root {
    --bg: #f4f7f9;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-muted: #64748b;
    --primary: #0f766e;
    --primary-hover: #0d5f59;
    --primary-soft: #ccfbf1;
    --emerald: #059669;
    --emerald-soft: #d1fae5;
    --amber: #d97706;
    --amber-soft: #fef3c7;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --blue: #2563eb;
    --blue-soft: #dbeafe;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.07);
}

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

body {
    margin: 0;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.88em;
    background: #eef2f6;
    padding: 2px 6px;
    border-radius: 5px;
    color: #0f172a;
}

.hidden {
    display: none !important;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    background: linear-gradient(135deg, #0b4f4a 0%, #0f766e 65%, #115e59 100%);
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 20px rgba(11, 79, 74, 0.18);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-top: 18px;
    padding-bottom: 18px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: grid;
    place-items: center;
    color: #ffffff;
    flex-shrink: 0;
}

.brand-logo-wrap {
    width: 58px;
    height: 58px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 14px;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
    flex-shrink: 0;
}

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

.tv-logo-wrap {
    width: 68px;
    height: 68px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 16px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.24);
    flex-shrink: 0;
}

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

.login-logo-wrap {
    width: 54px;
    height: 64px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-logo-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 3px 6px rgba(15, 23, 42, 0.12));
}

.brand-eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.85);
}

.brand-text h1 {
    margin: 2px 0 0;
    font-size: 1.32rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.brand-sub {
    margin: 3px 0 0;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.85);
}

.badge-mode {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
}

.badge-prod {
    background: #10b981;
    color: #022c22;
}

.badge-dev {
    background: #fbbf24;
    color: #451a03;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.16s ease;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
    padding: 12px 18px;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.site-header .btn-primary {
    background: #ffffff;
    color: #0b4f4a;
}

.site-header .btn-primary:hover {
    background: #ecfdf5;
}

.btn-secondary {
    background: #ffffff;
    color: var(--text);
    border-color: var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
    background: #f1f5f9;
}

.btn-outline {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.28);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.22);
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
}

.btn-danger-outline {
    background: rgba(239, 68, 68, 0.15);
    color: #fecaca;
    border-color: rgba(254, 202, 202, 0.4);
}

.btn-danger-outline:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #ffffff;
}

/* Main Content */
.main-content {
    padding-top: 22px;
    padding-bottom: 48px;
}

/* Sync Bar */
.sync-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 11px 16px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.87rem;
    font-weight: 500;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #94a3b8;
    display: inline-block;
    flex-shrink: 0;
}

.pulse-dot.online {
    background: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.pulse-dot.warning {
    background: #f59e0b;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.22);
}

.pulse-dot.offline {
    background: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.22);
}

.sync-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

/* Alerts */
.alert-banner {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 18px;
    border: 1px solid transparent;
}

.alert-error {
    background: var(--danger-soft);
    color: #991b1b;
    border-color: #fecaca;
}

.alert-warning {
    background: var(--amber-soft);
    color: #92400e;
    border-color: #fde68a;
}

.alert-success {
    background: var(--emerald-soft);
    color: #065f46;
    border-color: #a7f3d0;
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-grid-compact {
    margin-bottom: 18px;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
}

.kpi-available::before { background: var(--emerald); }
.kpi-occupied::before  { background: var(--amber); }
.kpi-bor::before       { background: var(--blue); }

.kpi-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.kpi-value {
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 6px 0 4px;
    line-height: 1.1;
}

.kpi-available .kpi-value { color: var(--emerald); }
.kpi-occupied .kpi-value  { color: var(--amber); }
.kpi-bor .kpi-value       { color: var(--blue); }

.kpi-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.progress-track {
    height: 8px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0f766e, #2563eb);
    border-radius: 999px;
    transition: width 0.35s ease;
}

/* Sections & Class Summary */
.panel-section {
    margin-bottom: 26px;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.section-head h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.section-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.class-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    gap: 12px;
}

.class-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 13px 15px;
    cursor: pointer;
    transition: all 0.16s ease;
    text-align: left;
    font-family: inherit;
    width: 100%;
}

.class-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.class-card.active {
    border-color: var(--primary);
    background: #f0fdfa;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.class-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.class-code {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--primary);
    background: var(--primary-soft);
    padding: 2px 7px;
    border-radius: 6px;
}

.class-name {
    font-size: 0.9rem;
    font-weight: 700;
    margin: 7px 0 4px;
    color: var(--text);
}

.class-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.class-avail-num {
    font-weight: 800;
    color: var(--emerald);
}

.class-avail-num.zero {
    color: var(--danger);
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    min-width: 240px;
}

.search-box svg {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 9px 12px 9px 35px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.88rem;
    background: #ffffff;
}

select, input[type="text"], input[type="number"], input[type="password"], input[type="search"], textarea {
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.88rem;
    background: #ffffff;
    color: var(--text);
}

textarea {
    resize: vertical;
    line-height: 1.45;
}

select:focus, input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.view-toggle {
    display: inline-flex;
    background: #e2e8f0;
    padding: 3px;
    border-radius: 9px;
}

.toggle-btn {
    border: none;
    background: transparent;
    padding: 6px 13px;
    border-radius: 7px;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}

.toggle-btn.active {
    background: #ffffff;
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

/* Room Cards */
.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.room-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: box-shadow 0.16s ease, transform 0.16s ease;
}

.room-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.room-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.room-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

.room-code {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-tersedia { background: var(--emerald-soft); color: #065f46; }
.status-terbatas { background: var(--amber-soft); color: #92400e; }
.status-penuh    { background: var(--danger-soft); color: #991b1b; }

.room-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
}

.metric-val {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.1;
}

.metric-val.avail { color: var(--emerald); }
.metric-val.zero  { color: var(--danger); }
.metric-val.occ   { color: var(--amber); }

.metric-lbl {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 2px;
}

.gender-strip {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 6px 10px;
    background: #f8fafc;
    border-radius: 8px;
}

.room-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.76rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 10px;
}

/* Tables */
.panel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.panel-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.panel-card-head h2 {
    margin: 0 0 4px;
    font-size: 1.08rem;
}

.muted {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.panel-card .table-wrap {
    border-radius: 10px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.data-table th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table th.num, .data-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.data-table th.center, .data-table td.center {
    text-align: center;
}

.empty-cell, .empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 36px 20px;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
}

.empty-cell {
    border: none;
}

/* Footer */
.site-footer {
    background: #0f172a;
    color: #cbd5e1;
    padding: 26px 0;
    font-size: 0.85rem;
    margin-top: 24px;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.site-footer strong {
    color: #ffffff;
}

.site-footer p {
    margin: 4px 0;
}

.footer-right {
    text-align: right;
    max-width: 440px;
}

.footer-note {
    font-size: 0.78rem;
    color: #94a3b8;
}

/* Login Page */
.page-login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at top right, #ccfbf1 0%, #f4f7f9 45%, #e2e8f0 100%);
    padding: 20px;
}

.login-wrap {
    width: 100%;
    max-width: 440px;
}

.login-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.1);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.login-brand .brand-icon {
    background: linear-gradient(135deg, #0b4f4a, #0f766e);
    border: none;
}

.login-brand .brand-eyebrow {
    color: var(--primary);
}

.login-brand h1 {
    font-size: 1.15rem;
    margin: 3px 0 2px;
}

.login-brand p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.login-form, .stack-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

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

.form-group label {
    font-size: 0.83rem;
    font-weight: 600;
    color: #334155;
}

.req {
    color: var(--danger);
}

.login-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    font-size: 0.84rem;
    font-weight: 600;
}

.login-address {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 16px;
}

/* Admin Tabs & Stepper */
.admin-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: none;
    background: transparent;
    padding: 11px 16px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
}

.tab-btn-yt svg {
    color: #dc2626;
}

.btn-outline.active-nav {
    background: #ffffff;
    color: #0b4f4a;
    border-color: #ffffff;
}

.embed-info-box {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.embed-info-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
}

.embed-info-box code {
    word-break: break-all;
    display: block;
    padding: 7px 9px;
}

.embed-info-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-panel {
    display: none;
}

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

.stepper {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
}

.step-btn {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    border: 1px solid var(--border-strong);
    background: #ffffff;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    color: var(--text);
    display: grid;
    place-items: center;
}

.step-btn:hover:not(:disabled) {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

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

.step-val {
    min-width: 34px;
    text-align: center;
    font-weight: 800;
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

.role-notice {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 0.87rem;
    margin-bottom: 18px;
}

.user-bed-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    padding: 4px 6px;
    border-radius: 10px;
}

.bed-qty-input {
    width: 64px !important;
    padding: 5px 6px !important;
    text-align: center;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.action-group {
    display: inline-flex;
    gap: 6px;
}

/* Diagnostics & Config */
.diag-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.config-list {
    margin: 0;
    display: grid;
    gap: 10px;
}

.config-list > div {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.88rem;
}

.config-list dt {
    color: var(--text-muted);
    font-weight: 600;
    flex-shrink: 0;
}

.config-list dd {
    margin: 0;
    text-align: right;
    word-break: break-word;
}

.diag-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 13px 15px;
    margin-bottom: 12px;
    background: #f8fafc;
}

.diag-item-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 700;
}

.diag-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 12px;
    font-size: 0.82rem;
    color: #334155;
}

.hash-output {
    margin-top: 16px;
}

.hash-output pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 14px;
    border-radius: 10px;
    overflow-x: auto;
    font-size: 0.82rem;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.56);
    backdrop-filter: blur(2px);
    display: grid;
    place-items: center;
    padding: 20px;
    z-index: 1000;
}

.modal-dialog {
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
    overflow: hidden;
}

.modal-sm {
    max-width: 430px;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-head h3 {
    margin: 0;
    font-size: 1.05rem;
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: #f8fafc;
}

.modal-body .modal-foot {
    margin: 8px -20px -20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.form-row-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-fieldset {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
}

.fieldset-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 10px;
}

.form-hint {
    margin: 8px 0 0;
    font-size: 0.77rem;
    color: var(--text-muted);
}

.delete-summary {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 0.9rem;
}

/* Toast */
.toast-container {
    position: fixed;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1200;
}

.toast {
    min-width: 280px;
    max-width: 400px;
    padding: 13px 16px;
    border-radius: 12px;
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 600;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.22);
    animation: slideUp 0.2s ease;
}

.toast-success { background: #065f46; }
.toast-error   { background: #991b1b; }
.toast-info    { background: #1e293b; }

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

.skeleton-card {
    height: 92px;
    border-radius: 12px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* =========================================================
   TV DISPLAY / MONITOR KIOSK MODE
   ========================================================= */
.page-tv {
    background: #07111f;
    color: #f8fafc;
    min-height: 100vh;
}

.tv-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 18px 26px;
    gap: 16px;
}

.tv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    background: linear-gradient(135deg, #0b3b3c 0%, #0f5f5a 100%);
    padding: 18px 24px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.tv-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tv-logo {
    width: 58px;
    height: 58px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.14);
    display: grid;
    place-items: center;
}

.tv-eyebrow {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #99f6e4;
}

.tv-brand h1 {
    margin: 3px 0 0;
    font-size: 1.75rem;
    font-weight: 800;
}

.tv-clock-wrap {
    text-align: right;
}

.tv-clock {
    font-size: 2.1rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.03em;
    line-height: 1.1;
}

.tv-date {
    font-size: 0.9rem;
    color: #ccfbf1;
    margin-top: 3px;
}

.tv-kpi-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.tv-kpi {
    background: #101c30;
    border: 1px solid #1e3150;
    border-radius: 14px;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tv-kpi-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.05em;
}

.tv-kpi-val {
    font-size: 2.3rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.tv-kpi-green .tv-kpi-val { color: #34d399; }
.tv-kpi-amber .tv-kpi-val { color: #fbbf24; }
.tv-kpi-blue  .tv-kpi-val { color: #60a5fa; }

.tv-class-strip {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tv-class-chip {
    background: #101c30;
    border: 1px solid #223556;
    border-radius: 10px;
    padding: 8px 14px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.tv-class-chip strong {
    color: #34d399;
    font-size: 1.05rem;
}

.tv-main-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    min-height: 0;
    align-items: stretch;
}

.tv-board {
    background: #0d182b;
    border: 1px solid #1e3150;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.tv-video-panel {
    background: #0d182b;
    border: 1px solid #1e3150;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.tv-video-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    background: #13223b;
    border-bottom: 1px solid #1e3150;
}

.tv-video-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.tv-video-title-wrap h2 {
    margin: 0;
    font-size: 0.96rem;
    font-weight: 700;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tv-yt-badge {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #dc2626;
    color: #ffffff;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.tv-live-tag {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.35);
    flex-shrink: 0;
}

.tv-video-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #050b14;
    border-bottom: 1px solid #1e3150;
    display: grid;
    place-items: center;
}

.tv-video-stage iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.tv-video-placeholder {
    padding: 24px 20px;
    text-align: center;
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.tv-video-placeholder strong {
    color: #e2e8f0;
    font-size: 0.98rem;
}

.tv-video-placeholder p {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.5;
    max-width: 320px;
}

.tv-video-placeholder code {
    background: rgba(255, 255, 255, 0.1);
    color: #99f6e4;
}

.tv-video-info {
    padding: 16px 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(180deg, #0d182b 0%, #102038 100%);
}

.tv-info-label {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #5eead4;
}

.tv-info-rs {
    font-size: 1.05rem;
    font-weight: 800;
    color: #ffffff;
}

.tv-video-info p {
    margin: 0;
    font-size: 0.85rem;
    color: #cbd5e1;
    line-height: 1.45;
}

.tv-info-phone {
    margin-top: 4px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #34d399;
}

.tv-preview-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: #0f172a;
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    color: #94a3b8;
    font-size: 0.88rem;
}

.tv-preview-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.checkbox-row {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
}

.tv-board-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #13223b;
    border-bottom: 1px solid #1e3150;
    flex-wrap: wrap;
    gap: 10px;
}

.tv-sync-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #cbd5e1;
}

.tv-board-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tv-page-indicator {
    font-size: 0.88rem;
    font-weight: 700;
    color: #99f6e4;
    margin-right: 6px;
}

.tv-ctrl-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 6px 12px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.tv-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

.tv-table-wrap {
    flex: 1;
    overflow-x: auto;
}

.tv-table {
    width: 100%;
    border-collapse: collapse;
}

.tv-table th {
    padding: 13px 12px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #94a3b8;
    border-bottom: 1px solid #1e3150;
    white-space: nowrap;
}

.tv-table td {
    padding: 14px 12px;
    font-size: 1.04rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tv-table th.num, .tv-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.tv-avail-big {
    font-size: 1.45rem;
    font-weight: 800;
    color: #34d399;
}

.tv-avail-zero {
    font-size: 1.45rem;
    font-weight: 800;
    color: #f87171;
}

.tv-empty {
    text-align: center;
    padding: 48px !important;
    color: #94a3b8;
}

.tv-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.88rem;
    color: #94a3b8;
    padding: 4px 6px;
}

/* Responsive */
@media (max-width: 1080px) {
    .tv-main-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 960px) {
    .kpi-grid, .tv-kpi-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .diag-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .kpi-grid, .tv-kpi-strip, .form-row, .form-row-3 {
        grid-template-columns: 1fr;
    }
    .footer-right {
        text-align: left;
    }
    .brand-text h1 {
        font-size: 1.1rem;
    }
    .brand-logo-wrap {
        width: 48px;
        height: 48px;
        padding: 4px;
    }
    .tv-brand h1 {
        font-size: 1.25rem;
    }
}
