/* ============================================
   Pause Group Automation — Dark Theme
   ============================================ */

:root {
    --bg-primary: #0b0e14;
    --bg-secondary: #111520;
    --bg-tertiary: #1a1f2e;
    --bg-card: #151a28;
    --bg-card-hover: #1c2236;
    --bg-input: #0e1219;
    --bg-sidebar: #0d1018;

    --border: #1e2638;
    --border-hover: #2a3550;
    --border-focus: #5b8def;

    --text-primary: #e1e4ed;
    --text-secondary: #8891a8;
    --text-muted: #4e5672;
    --text-inverse: #0b0e14;

    --accent: #5b8def;
    --accent-hover: #4a7de0;
    --accent-subtle: rgba(91, 141, 239, 0.1);
    --accent-glow: rgba(91, 141, 239, 0.2);

    --success: #3dd68c;
    --success-subtle: rgba(61, 214, 140, 0.1);
    --warning: #f0a944;
    --warning-subtle: rgba(240, 169, 68, 0.1);
    --danger: #e5534b;
    --danger-subtle: rgba(229, 83, 75, 0.1);

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);

    --transition-fast: 120ms ease;
    --transition-base: 200ms ease;

    --sidebar-width: 240px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'Consolas', 'Monaco', monospace;
}

[data-theme="light"] {
    --bg-primary: #f3f6fb;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8edf6;
    --bg-card: #ffffff;
    --bg-card-hover: #f4f7fc;
    --bg-input: #f8faff;
    --bg-sidebar: #eef3fb;

    --border: #d9e1ef;
    --border-hover: #bdcae0;
    --border-focus: #3f72d6;

    --text-primary: #1c2433;
    --text-secondary: #55617a;
    --text-muted: #8390a8;
    --text-inverse: #f3f6fb;

    --accent: #3567cc;
    --accent-hover: #2759be;
    --accent-subtle: rgba(53, 103, 204, 0.12);
    --accent-glow: rgba(53, 103, 204, 0.22);

    --success-subtle: rgba(52, 168, 122, 0.16);
    --warning-subtle: rgba(237, 152, 52, 0.17);
    --danger-subtle: rgba(217, 72, 72, 0.14);

    --shadow-sm: 0 1px 3px rgba(20,35,66,0.08);
    --shadow-md: 0 10px 24px rgba(20,35,66,0.1);
    --shadow-lg: 0 18px 45px rgba(20,35,66,0.14);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
    font-family: var(--font-sans);
    background: radial-gradient(circle at 10% -20%, rgba(91, 141, 239, 0.22), transparent 38%),
                radial-gradient(circle at 90% 0%, rgba(61, 214, 140, 0.15), transparent 35%),
                linear-gradient(180deg, color-mix(in srgb, var(--bg-primary) 88%, #000 12%), var(--bg-primary));
    color: var(--text-primary);
    line-height: 1.55;
    min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(120deg, rgba(255,255,255,0.04), transparent 25%, transparent 75%, rgba(255,255,255,0.03));
    z-index: -1;
}


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

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(10px);
    box-shadow: inset -1px 0 0 rgba(255,255,255,0.02);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 1.4rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
    position: relative;
}
.sidebar-brand::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    position: absolute;
    right: 1.1rem;
    top: 1.2rem;
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--success) 20%, transparent);
}
.sidebar-brand h1 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.sidebar-brand p {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.nav-section {
    padding: 0 0.5rem;
    margin-bottom: 0.25rem;
}
.nav-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.75rem 0.75rem 0.35rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.85rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    margin: 1px 0;
    user-select: none;
}
.nav-item:hover { background: color-mix(in srgb, var(--bg-tertiary) 90%, transparent); color: var(--text-primary); transform: translateX(2px); }
.nav-item.active { background: linear-gradient(90deg, var(--accent-subtle), transparent); color: var(--accent); border-left-color: var(--accent); }
.nav-icon { width: 18px; height: 18px; opacity: 0.7; flex-shrink: 0; }
.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
    margin-top: auto;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar-user { font-size: 0.8rem; color: var(--text-secondary); }

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem 2.25rem;
    min-height: 100vh;
    max-width: 1280px;
}

.theme-toggle {
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-card) 92%, transparent);
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 0.74rem;
    padding: 0.32rem 0.65rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}
.theme-toggle-inline {
    margin-left: auto;
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
}
.theme-toggle:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--bg-card) 88%, transparent);
}
.page-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.page-subtitle { font-size: 0.85rem; color: var(--text-secondary); margin-top: 0.2rem; }

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}
.card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.card-title { font-size: 0.95rem; font-weight: 600; }

/* Stat cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.25rem;
    transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--success));
    opacity: 0.8;
}
.stat-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-label { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500; }
.stat-value { font-size: 1.75rem; font-weight: 700; margin-top: 0.3rem; letter-spacing: -0.03em; }
.stat-value.text-success { color: var(--success); }
.stat-value.text-warning { color: var(--warning); }
.stat-value.text-danger { color: var(--danger); }

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    line-height: 1.4;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 8px 22px var(--accent-glow); }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #d04040; }

.btn-success { background: var(--success); color: var(--text-inverse); border-color: var(--success); }
.btn-success:hover:not(:disabled) { background: #2ec07a; }

.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-card-hover); border-color: var(--border-hover); }

.btn-warning { background: var(--warning); color: var(--text-inverse); border-color: var(--warning); }
.btn-warning:hover:not(:disabled) { background: #d9952e; }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-tertiary); color: var(--text-primary); }

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.78rem; }
.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.72rem; }
.btn-icon { padding: 0.4rem; }

/* ============================================
   Forms
   ============================================ */
.form-group { margin-bottom: 1rem; }
.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}
.form-input:hover, .form-select:hover, .form-textarea:hover { border-color: var(--border-hover); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input::placeholder { color: var(--text-muted); }
.form-textarea { min-height: 80px; resize: vertical; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238891a8' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2rem; }
.form-help { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 0.25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: 0.5rem; margin-top: 1.25rem; }

/* Checkbox / Toggle */
.toggle-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.85rem; }
.toggle-input { display: none; }
.toggle-switch {
    width: 36px; height: 20px;
    background: var(--border);
    border-radius: var(--radius-full);
    position: relative;
    transition: background var(--transition-fast);
}
.toggle-switch::after {
    content: '';
    width: 16px; height: 16px;
    background: var(--text-primary);
    border-radius: 50%;
    position: absolute; top: 2px; left: 2px;
    transition: transform var(--transition-fast);
}
.toggle-input:checked + .toggle-switch { background: var(--accent); }
.toggle-input:checked + .toggle-switch::after { transform: translateX(16px); }

.checkbox-label {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.85rem; cursor: pointer; padding: 0.25rem 0;
}
.checkbox-label input[type="checkbox"] {
    width: 16px; height: 16px; accent-color: var(--accent);
}

/* ============================================
   Tables
   ============================================ */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th {
    text-align: left;
    padding: 0.7rem 1rem;
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tbody tr { transition: background var(--transition-fast); }
.data-table tbody tr:hover { background: var(--bg-card-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ============================================
   Badges
   ============================================ */
.badge {
    display: inline-flex; align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-enabled { background: var(--success-subtle); color: var(--success); }
.badge-paused { background: var(--warning-subtle); color: var(--warning); }
.badge-outOfService, .badge-out-of-service { background: var(--danger-subtle); color: var(--danger); }
.badge-active { background: var(--success-subtle); color: var(--success); }
.badge-inactive { background: var(--bg-tertiary); color: var(--text-muted); }
.badge-override { background: var(--accent-subtle); color: var(--accent); }
.badge-info { background: var(--accent-subtle); color: var(--accent); }

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
    position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 9999;
    display: flex; flex-direction: column-reverse; gap: 0.5rem;
    pointer-events: none;
}
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.25s ease;
    max-width: 380px;
    font-size: 0.85rem;
    pointer-events: auto;
    display: flex; align-items: center; gap: 0.5rem;
}
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--accent); }
.toast-exit { animation: toastOut 0.2s ease forwards; }

@keyframes toastIn { from { opacity: 0; transform: translateY(8px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(4px); } }

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.15s ease;
}
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    min-width: 400px; max-width: 560px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
    backdrop-filter: blur(10px);
    max-height: 85vh;
    overflow-y: auto;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.modal-title { font-size: 1.1rem; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.25rem; padding: 0.25rem; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { margin-bottom: 1rem; }
.modal-footer { display: flex; gap: 0.5rem; justify-content: flex-end; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* ============================================
   Game Grid (Dashboard)
   ============================================ */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 0.75rem;
}
.game-tile {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.85rem;
    transition: border-color var(--transition-fast), transform var(--transition-fast);
    border-left: 3px solid var(--border);
}
.game-tile:hover { border-color: var(--border-hover); transform: translateY(-1px); }
.game-tile[data-status="enabled"] { border-left-color: var(--success); }
.game-tile[data-status="paused"] { border-left-color: var(--warning); }
.game-tile[data-status="outOfService"] { border-left-color: var(--danger); }
.game-tile-name { font-size: 0.82rem; font-weight: 500; margin-bottom: 0.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-tile-status { font-size: 0.72rem; color: var(--text-secondary); }

/* ============================================
   Group Controls — Command Center Cards
   ============================================ */
.group-controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
}
.group-control-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    border-top: 2px solid var(--border);
    position: relative;
}
.group-control-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-md); }
.group-control-card[data-state="enabled"] { border-top-color: var(--success); }
.group-control-card[data-state="paused"] { border-top-color: var(--warning); }
.group-control-card[data-state="mixed"] { border-top-color: var(--accent); }
.group-control-card[data-state="enabled"]:hover { box-shadow: 0 4px 20px rgba(61,214,140,0.08); }
.group-control-card[data-state="paused"]:hover { box-shadow: 0 4px 20px rgba(240,169,68,0.08); }
.group-control-card[data-state="mixed"]:hover { box-shadow: 0 4px 20px rgba(91,141,239,0.08); }

.group-control-header {
    display: flex; align-items: center; justify-content: space-between;
}
.group-control-title {
    display: flex; align-items: center; gap: 0.5rem; min-width: 0;
}
.group-control-name {
    font-size: 0.95rem; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.group-control-state {
    font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    padding: 0.15rem 0.5rem; border-radius: var(--radius-full);
    flex-shrink: 0;
}
.group-control-state-enabled { background: var(--success-subtle); color: var(--success); }
.group-control-state-paused { background: var(--warning-subtle); color: var(--warning); }
.group-control-state-mixed { background: var(--accent-subtle); color: var(--accent); }
.group-control-state-empty { background: var(--bg-tertiary); color: var(--text-muted); }

.group-control-stats {
    display: flex; align-items: center; gap: 0.75rem; font-size: 0.78rem;
}
.group-control-context {
    font-size: 0.75rem; color: var(--text-secondary);
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.4rem 0.6rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}
.group-control-context-override {
    background: var(--accent-subtle);
    color: var(--accent);
}
.group-control-context-manual {
    background: rgba(168, 85, 247, 0.12);
    color: #c084fc;
}
.group-control-actions {
    display: flex; gap: 0.5rem; margin-top: 0.1rem;
}
.group-control-actions .btn { flex: 1; justify-content: center; }

/* Status Indicator Dot */
.status-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.status-dot-enabled { background: var(--success); animation: pulse-success 2s ease-in-out infinite; }
.status-dot-paused { background: var(--warning); animation: pulse-warning 2s ease-in-out infinite; }
.status-dot-mixed { background: var(--accent); animation: pulse-accent 2s ease-in-out infinite; }
.status-dot-empty { background: var(--text-muted); }

@keyframes pulse-success {
    0%, 100% { box-shadow: 0 0 0 0 rgba(61,214,140,0.45); }
    50% { box-shadow: 0 0 0 5px rgba(61,214,140,0); }
}
@keyframes pulse-warning {
    0%, 100% { box-shadow: 0 0 0 0 rgba(240,169,68,0.45); }
    50% { box-shadow: 0 0 0 5px rgba(240,169,68,0); }
}
@keyframes pulse-accent {
    0%, 100% { box-shadow: 0 0 0 0 rgba(91,141,239,0.45); }
    50% { box-shadow: 0 0 0 5px rgba(91,141,239,0); }
}

/* Progress Bar */
.progress-bar {
    flex: 1; height: 6px;
    background: var(--bg-tertiary); border-radius: var(--radius-full);
    overflow: hidden; display: flex;
}
.progress-fill-enabled { background: var(--success); transition: width 0.6s ease; }
.progress-fill-paused { background: var(--warning); transition: width 0.6s ease; }
.progress-fill-oos { background: var(--danger); transition: width 0.6s ease; }

/* ============================================
   Schedule Grid
   ============================================ */
.schedule-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}
.schedule-day {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    min-height: 120px;
    padding: 0.5rem;
}
.schedule-day-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.35rem;
}
.schedule-day-header.today { color: var(--accent); }
.schedule-block {
    background: var(--accent-subtle);
    border: 1px solid rgba(91, 141, 239, 0.25);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.4rem;
    font-size: 0.7rem;
    margin-bottom: 0.25rem;
    cursor: pointer;
    transition: background var(--transition-fast);
    line-height: 1.3;
}
.schedule-block:hover { background: var(--accent-glow); }
.schedule-block-time { font-weight: 600; }
.schedule-block-group { color: var(--text-secondary); font-size: 0.65rem; }

/* ============================================
   Override Sections
   ============================================ */
.override-section { margin-bottom: 1.5rem; }
.override-section-title {
    font-size: 0.8rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--text-secondary);
    margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem;
}
.override-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    margin-bottom: 0.5rem;
    display: flex; align-items: center; justify-content: space-between;
}
.override-info { flex: 1; }
.override-name { font-weight: 500; font-size: 0.88rem; }
.override-meta { font-size: 0.78rem; color: var(--text-secondary); margin-top: 0.15rem; }
.override-countdown { font-size: 0.78rem; color: var(--accent); font-weight: 500; }

/* ============================================
   Login Page
   ============================================ */
.login-container {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: transparent;
    padding: 1rem;
}
.login-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    width: 100%; max-width: 380px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}
.login-title {
    font-size: 1.35rem; font-weight: 700; text-align: center;
    margin-bottom: 0.35rem; letter-spacing: -0.02em;
}
.login-subtitle {
    font-size: 0.8rem; color: var(--text-muted); text-align: center;
    margin-bottom: 1.5rem;
}
.login-subtitle::before {
    content: 'Secure access';
    display: inline-block;
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    background: var(--accent-subtle);
    border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
    border-radius: var(--radius-full);
    padding: 0.18rem 0.5rem;
    margin-bottom: 0.45rem;
}
.login-error {
    background: var(--danger-subtle);
    border: 1px solid rgba(229, 83, 75, 0.3);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.75rem;
    font-size: 0.8rem;
    color: var(--danger);
    margin-bottom: 1rem;
}

/* ============================================
   Filters Bar
   ============================================ */
.filters-bar {
    display: flex; flex-wrap: wrap; gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.filters-bar .form-input,
.filters-bar .form-select {
    width: auto; min-width: 140px; padding: 0.4rem 0.6rem; font-size: 0.8rem;
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 1rem; padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}
.pagination-info { font-size: 0.8rem; color: var(--text-secondary); }
.pagination-buttons { display: flex; gap: 0.35rem; }

/* ============================================
   Empty States
   ============================================ */
.empty-state {
    text-align: center; padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: 0.4; }
.empty-state-text { font-size: 0.9rem; }
.empty-state-action { margin-top: 1rem; }

/* ============================================
   Loading
   ============================================ */
.spinner {
    width: 24px; height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    display: flex; align-items: center; justify-content: center;
    padding: 3rem; color: var(--text-muted);
    gap: 0.75rem; font-size: 0.85rem;
}

/* ============================================
   Dual-pane Picker
   ============================================ */
.dual-pane {
    display: grid; grid-template-columns: 1fr auto 1fr;
    gap: 0.5rem; align-items: start;
}
.dual-pane-list {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    max-height: 250px;
    overflow-y: auto;
    padding: 0.35rem;
}
.dual-pane-item {
    padding: 0.35rem 0.5rem;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}
.dual-pane-item:hover { background: var(--bg-tertiary); }
.dual-pane-item.selected { background: var(--accent-subtle); color: var(--accent); }
.dual-pane-actions {
    display: flex; flex-direction: column;
    gap: 0.25rem; padding-top: 2rem;
}

/* ============================================
   Scrollbar
   ============================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================
   Utility
   ============================================ */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm { gap: 0.35rem; }
.gap-md { gap: 0.75rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.72rem; }
.font-mono { font-family: var(--font-mono); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hidden { display: none !important; }

/* Search input */
.search-input {
    position: relative;
}
.search-input .form-input {
    padding-left: 2rem;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 900px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 1rem; }
    .theme-toggle-inline { top: 0.6rem; right: 0.6rem; }
    .page-header { padding: 0.7rem 0.8rem; }
    .schedule-week { grid-template-columns: repeat(3, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .dual-pane { grid-template-columns: 1fr; }
    .modal { min-width: auto; }
}

@media (max-width: 600px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .game-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .schedule-week { grid-template-columns: 1fr; }
}

/* ============================================
   Scalable Table View (Games, etc.)
   ============================================ */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.table th {
    text-align: left;
    padding: 0.6rem 0.85rem;
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    user-select: none;
    position: sticky;
    top: 0;
    z-index: 2;
}
.table th.sortable { cursor: pointer; }
.table th.sortable:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.table th .sort-icon { margin-left: 0.35rem; opacity: 0.3; font-size: 0.65rem; }
.table th.sorted .sort-icon { opacity: 1; color: var(--accent); }
.table td {
    padding: 0.5rem 0.85rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr { transition: background var(--transition-fast); }
.table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg-card) 93%, var(--bg-tertiary)); }
.table tbody tr:hover { background: var(--bg-card-hover); }
.table tbody tr:last-child td { border-bottom: none; }
.table .row-error { background: var(--danger-subtle); }

/* Scrollable table container for large datasets */
.table-scroll-container {
    max-height: 520px;
    overflow-y: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}
.table-scroll-container .table th {
    position: sticky;
    top: 0;
    z-index: 2;
}

/* ============================================
   View Toggle (Grid / Table)
   ============================================ */
.view-toggle {
    display: inline-flex;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.view-toggle-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.78rem;
    font-family: inherit;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 500;
}
.view-toggle-btn:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.view-toggle-btn.active { background: var(--accent); color: #fff; }

/* ============================================
   Status Filter Pills
   ============================================ */
.filter-pills {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}
.filter-pill {
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.filter-pill:hover { border-color: var(--border-hover); color: var(--text-primary); }
.filter-pill.active { background: var(--accent-subtle); border-color: var(--accent); color: var(--accent); }
.filter-pill.active-enabled { background: var(--success-subtle); border-color: var(--success); color: var(--success); }
.filter-pill.active-paused { background: var(--warning-subtle); border-color: var(--warning); color: var(--warning); }
.filter-pill.active-oos { background: var(--danger-subtle); border-color: var(--danger); color: var(--danger); }

.filter-pill .pill-count {
    font-size: 0.68rem;
    opacity: 0.8;
    margin-left: 0.25rem;
}

/* ============================================
   Pagination (Reusable)
   ============================================ */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    font-size: 0.78rem;
}
.pagination-bar .pagination-info {
    color: var(--text-secondary);
    font-size: 0.78rem;
}
.pagination-bar .pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.pagination-bar .pagination-controls .btn {
    min-width: 32px;
    justify-content: center;
}
.page-size-select {
    padding: 0.2rem 0.4rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-family: inherit;
    margin-left: 0.5rem;
}

/* ============================================
   Improved Game Picker (Group Form)
   ============================================ */
.game-picker-container {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.game-picker-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.game-picker-toolbar .form-input {
    flex: 1;
    min-width: 180px;
    padding: 0.35rem 0.6rem;
    font-size: 0.82rem;
}
.game-picker-stats {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    padding: 0.25rem 0.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
}
.game-picker-stats strong {
    color: var(--accent);
    font-weight: 600;
}
.game-picker-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 0.25rem;
}
.game-picker-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    font-size: 0.82rem;
}
.game-picker-item:hover { background: var(--bg-tertiary); }
.game-picker-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    flex-shrink: 0;
}
.game-picker-item .game-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-picker-item .game-status {
    font-size: 0.7rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
.game-picker-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0.65rem;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ============================================
   Toolbar Row (Search + Filters + Toggle)
   ============================================ */
.toolbar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.toolbar-row .form-input {
    max-width: 240px;
}

/* ============================================
   Group Controls Collapse
   ============================================ */
.section-collapse-btn {
    padding: 0.2rem 0.5rem;
    font-size: 0.72rem;
    font-family: inherit;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.section-collapse-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }

/* Quick summary row for collapsed groups */
.groups-summary-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.5rem 0;
}
.groups-summary-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.groups-summary-item:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
