:root {
    --bg: #0b1220;
    --bg-elevated: #0f172a;
    --bg-card: #111a2e;
    --bg-input: #0c1426;
    --border: rgba(148, 163, 184, 0.12);
    --border-strong: rgba(148, 163, 184, 0.22);
    --text: #e6ecf5;
    --text-muted: #8b97ad;
    --text-strong: #f8fafc;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-soft: rgba(59, 130, 246, 0.12);
    --success: #10b981;
    --success-soft: rgba(16, 185, 129, 0.14);
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.14);
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.15);
    --info: #38bdf8;
    --info-soft: rgba(56, 189, 248, 0.14);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow: 0 8px 30px rgba(2, 6, 23, 0.45);
    --shadow-soft: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 1px 2px rgba(0, 0, 0, 0.5);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--bg);
    min-height: 100vh;
    line-height: 1.5;
}

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

/* ----- buttons ----- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 40px;
    padding: 0 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-card);
    color: var(--text);
    font: 500 0.9rem var(--font);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.btn:hover { background: var(--bg-elevated); border-color: rgba(148, 163, 184, 0.32); }
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-sm { height: 32px; padding: 0 0.75rem; font-size: 0.825rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.ico { font-size: 1rem; line-height: 1; }

/* ----- auth ----- */
.auth-bg {
    background: radial-gradient(1200px 600px at 80% -10%, rgba(59, 130, 246, 0.18), transparent 60%),
                radial-gradient(900px 500px at -10% 110%, rgba(16, 185, 129, 0.12), transparent 60%),
                var(--bg);
}
.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    gap: 1rem;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow);
}
.auth-form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.5rem; }
.auth-form label { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.85rem; color: var(--text-muted); }
.auth-form input {
    height: 44px;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 0 0.85rem;
    color: var(--text-strong);
    font-size: 0.95rem;
    font-family: var(--font);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}
.auth-footer { font-size: 0.8rem; opacity: 0.6; }

/* ----- brand ----- */
.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}
.brand h1 { font-size: 1.4rem; margin: 0; letter-spacing: -0.01em; color: var(--text-strong); }
.brand p { margin: 0; font-size: 0.85rem; }
.brand-mark {
    width: 48px; height: 48px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid var(--border-strong);
    display: grid; place-items: center;
    box-shadow: var(--shadow-soft);
}
.brand-compact .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
.brand-compact strong { display: block; font-size: 0.95rem; color: var(--text-strong); }
.brand-compact .small { display: block; }

/* ----- topbar ----- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(11, 18, 32, 0.85);
    backdrop-filter: saturate(140%) blur(8px);
    -webkit-backdrop-filter: saturate(140%) blur(8px);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    height: 32px;
    padding: 0 0.75rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 999px;
    font-size: 0.825rem;
    color: var(--text-muted);
}
.user-chip .dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px var(--success-soft);
}

/* ----- shell ----- */
.app-bg { background: var(--bg); }
.app-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 2rem 1.25rem 4rem;
}
.page-header {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.page-header h1 {
    font-size: 1.75rem; margin: 0 0 0.35rem; letter-spacing: -0.01em; color: var(--text-strong); font-weight: 600;
}
.page-header p { margin: 0; }

/* ----- tabs ----- */
.tabs {
    display: flex; flex-wrap: wrap; gap: 0.4rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.4rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-soft);
}
.tab {
    flex: 1 1 auto;
    min-width: 140px;
    background: transparent;
    border: 0;
    color: var(--text-muted);
    font: 500 0.9rem var(--font);
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.tab:hover { color: var(--text); background: rgba(148, 163, 184, 0.06); }
.tab.active {
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.16), rgba(59, 130, 246, 0.08));
    color: var(--text-strong);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* ----- panel ----- */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 280px;
}
.panel-empty {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

/* ----- slot list ----- */
.slot-list { display: flex; flex-direction: column; }
.slot {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem 1rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    align-items: center;
    transition: background 0.12s ease;
}
.slot:first-child { border-top: 0; }
.slot:hover { background: rgba(148, 163, 184, 0.04); }

.slot-main { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.slot-title {
    font-weight: 600; color: var(--text-strong); font-size: 1rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.slot-meta {
    display: flex; flex-wrap: wrap; gap: 0.4rem 1rem;
    color: var(--text-muted); font-size: 0.85rem;
}
.slot-meta .pill {
    display: inline-flex; align-items: center; gap: 0.35rem;
}
.slot-actions { display: flex; align-items: center; gap: 0.75rem; }

/* status badges */
.badge {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid transparent;
    line-height: 1;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.badge-available { color: var(--text-muted); background: rgba(148, 163, 184, 0.1); border-color: var(--border); }
.badge-available .dot { background: #94a3b8; }
.badge-queued { color: var(--info); background: var(--info-soft); border-color: rgba(56, 189, 248, 0.3); }
.badge-queued .dot { background: var(--info); }
.badge-booking { color: var(--warning); background: var(--warning-soft); border-color: rgba(245, 158, 11, 0.3); }
.badge-booking .dot { background: var(--warning); animation: pulse 1.4s infinite; }
.badge-booked { color: var(--success); background: var(--success-soft); border-color: rgba(16, 185, 129, 0.32); }
.badge-booked .dot { background: var(--success); }
.badge-failed, .badge-fully_booked { color: var(--danger); background: var(--danger-soft); border-color: rgba(239, 68, 68, 0.32); }
.badge-failed .dot, .badge-fully_booked .dot { background: var(--danger); }

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.6; }
}

/* toggle switch */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    transition: 0.18s;
}
.switch .slider::before {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    top: 2px; left: 2px;
    background: var(--text-strong);
    border-radius: 50%;
    transition: 0.18s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.switch input:checked + .slider {
    background: var(--primary);
    border-color: var(--primary);
}
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:disabled + .slider { opacity: 0.55; cursor: not-allowed; }

/* alerts & toast */
.alert { padding: 0.7rem 0.9rem; border-radius: 8px; font-size: 0.85rem; }
.alert.error { background: var(--danger-soft); color: #fecaca; border: 1px solid rgba(239, 68, 68, 0.3); }

.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    color: var(--text-strong);
    padding: 0.65rem 1.1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    box-shadow: var(--shadow);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 100;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast.toast-error { border-color: rgba(239, 68, 68, 0.45); }
.toast.toast-success { border-color: rgba(16, 185, 129, 0.45); }

/* skeleton */
.loading-skeleton { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
.skeleton-row {
    height: 60px;
    border-radius: 8px;
    background: linear-gradient(90deg, rgba(148, 163, 184, 0.05), rgba(148, 163, 184, 0.12), rgba(148, 163, 184, 0.05));
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* responsive */
@media (max-width: 640px) {
    .topbar-inner { padding: 0.75rem 1rem; }
    .brand-compact .small { display: none; }
    .app-shell { padding: 1.25rem 1rem 3rem; }
    .page-header h1 { font-size: 1.4rem; }
    .slot { padding: 0.85rem 1rem; }
    .slot-title { white-space: normal; }
}
