:root {
    --bg-color: #0d0f1a;
    --sidebar-bg: rgba(20, 24, 40, 0.6);
    --panel-bg: rgba(26, 30, 48, 0.4);
    --text-primary: #f0f2f5;
    --text-secondary: #a0a6b5;
    --accent: #6b4cff;
    --accent-hover: #8266ff;
    --border: rgba(255, 255, 255, 0.08);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --font: 'Inter', sans-serif;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font);
}

body {
    background: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 600;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Screens & Views */
.screen {
    display: none;
    width: 100%;
    height: 100%;
}

.screen.view-active {
    display: flex;
}

.view {
    display: none;
    opacity: 1;
    animation: fadeIn 0.3s ease-in-out forwards;
}

.view.view-active {
    display: block;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ════════════════════════════════════════════════════════════════════════════
   LOGIN SCREEN – Premium Split-Screen Enterprise Layout
   ════════════════════════════════════════════════════════════════════════════ */

#login-screen {
    /* Uses .screen + .screen.view-active for show/hide — NO !important */
    flex-direction: row;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(rgba(8, 11, 24, 0.90), rgba(8, 11, 24, 0.90)), url('assets/bg.png') no-repeat center center fixed;
    background-size: cover;
}

/* App screen: full viewport, no login styles bleed through */
#app-screen {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    flex-direction: row;
    background: var(--bg-color);
}

/* ── LEFT: Brand Panel ──────────────────────────────────────────────────── */
.login-brand-panel {
    position: relative;
    width: 42%;
    min-width: 340px;
    background: linear-gradient(145deg, #0e1230 0%, #12103a 40%, #1a0e3d 70%, #0c1028 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

/* Animated gradient orb */
.login-brand-glow {
    position: absolute;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(107, 76, 255, 0.28) 0%, rgba(107, 76, 255, 0.06) 50%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: loginGlowPulse 6s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes loginGlowPulse {
    0% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(0.92);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.08);
    }
}

/* Subtle noise texture */
.login-brand-noise {
    position: absolute;
    inset: 0;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-size: 180px;
    pointer-events: none;
}

/* Vertical separator line */
.login-brand-panel::after {
    content: '';
    position: absolute;
    right: 0;
    top: 10%;
    height: 80%;
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(107, 76, 255, 0.4), transparent);
}

.login-brand-content {
    position: relative;
    z-index: 2;
    padding: 56px 48px;
    display: flex;
    flex-direction: column;
    gap: 40px;
    max-width: 420px;
    width: 100%;
}

/* Logo area */
.login-brand-logo {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 4px;
}

/* Path-based logo — replace frontend/logo.png and refresh, no code change needed */
.login-logo-img {
    width: 260px;
    /* Controls display size — height auto keeps ratio */
    max-width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    margin-bottom: 6px;

    /* Subtle drop shadow — depth without glow */
    filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.45)) drop-shadow(0 1px 4px rgba(0, 0, 0, 0.30));
}

/* Tablet: scale back slightly */
@media (max-width: 1100px) {
    .login-logo-img {
        width: 210px;
    }
}

/* Mobile: centre + compact */
@media (max-width: 840px) {
    .login-logo-img {
        width: 180px;
        margin: 0 auto 6px;
    }
}


.login-brand-logo-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, #6b4cff, #9b6bff);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 28px rgba(107, 76, 255, 0.5);
    flex-shrink: 0;
}

/* ── Brand text block: LABEL / TITLE / SUBTITLE ─────────────── */
.login-brand-text-block {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.login-brand-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.32em;
    color: rgba(167, 139, 250, 0.75);
    text-transform: uppercase;
    margin-bottom: 10px;
    display: block;
}

.login-brand-title {
    font-size: 40px;
    font-weight: 700;
    line-height: 1.1;
    color: #ffffff;
    letter-spacing: -0.6px;
    margin: 0 0 14px;
}

.login-brand-sub {
    font-size: 13.5px;
    color: rgba(160, 166, 181, 0.75);
    font-weight: 400;
    line-height: 1.65;
    margin: 0;
}

/* ── Divider ─────────────────────────────────────────────────── */
.login-brand-divider {
    height: 1px;
    background: linear-gradient(90deg, rgba(107, 76, 255, 0.35), rgba(107, 76, 255, 0.08) 70%, transparent);
    margin: 0;
    /* gap comes from parent flex gap */
}

/* Feature list */
.login-brand-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.login-brand-features li {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14.5px;
    color: rgba(240, 242, 245, 0.82);
    font-weight: 450;
}

.login-brand-feat-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: rgba(107, 76, 255, 0.15);
    border: 1px solid rgba(107, 76, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a78bfa;
    flex-shrink: 0;
    transition: background 0.2s, box-shadow 0.2s;
}

.login-brand-features li:hover .login-brand-feat-icon {
    background: rgba(107, 76, 255, 0.28);
    box-shadow: 0 0 12px rgba(107, 76, 255, 0.35);
}

/* Brand footer */
.login-brand-footer {
    font-size: 11px;
    color: rgba(160, 166, 181, 0.38);
    letter-spacing: 0.06em;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ── RIGHT: Form Panel ──────────────────────────────────────────────────── */
.login-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0d1c;
    padding: 40px 24px;
}

/* Card */
.login-card {
    width: 100%;
    max-width: 460px;
    background: rgba(20, 24, 44, 0.72);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(107, 76, 255, 0.18);
    border-radius: 22px;
    padding: 48px 44px 40px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    animation: loginCardIn 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.1) both;
}

@keyframes loginCardIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Card header */
.login-card-header {
    margin-bottom: 36px;
    text-align: left;
}

.login-card-logo-badge {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6b4cff, #9b6bff);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 22px;
    box-shadow: 0 0 20px rgba(107, 76, 255, 0.45);
}

.login-card-header h2 {
    font-size: 26px;
    font-weight: 700;
    color: #f0f2f5;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.login-card-header p {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Error box */
.login-error-box {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-left: 3px solid #ef4444;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 13.5px;
    color: #fca5a5;
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: loginErrorIn 0.25s ease both;
}

@keyframes loginErrorIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Field groups */
.login-field-group {
    margin-bottom: 22px;
}

.login-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 9px;
}

.login-input-wrap {
    position: relative;
}

.login-input {
    width: 100%;
    height: 52px;
    padding: 0 48px 0 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #f0f2f5;
    font-size: 15px;
    font-family: var(--font);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    outline: none;
}

.login-input::placeholder {
    color: rgba(160, 166, 181, 0.45);
}

.login-input:hover {
    border-color: rgba(107, 76, 255, 0.35);
    background: rgba(255, 255, 255, 0.06);
}

.login-input:focus {
    border-color: rgba(107, 76, 255, 0.7);
    background: rgba(107, 76, 255, 0.06);
    box-shadow: 0 0 0 4px rgba(107, 76, 255, 0.15);
}

/* Password eye toggle */
.login-eye-btn {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(160, 166, 181, 0.55);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.login-eye-btn:hover {
    color: var(--accent);
    background: rgba(107, 76, 255, 0.12);
}

/* Submit button */
.login-submit-btn {
    width: 100%;
    height: 52px;
    margin-top: 8px;
    background: linear-gradient(135deg, #6b4cff, #8b5cf6);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 15.5px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    letter-spacing: 0.02em;
    box-shadow: 0 4px 24px rgba(107, 76, 255, 0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s;
    position: relative;
    overflow: hidden;
}

.login-submit-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.2s;
}

.login-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(107, 76, 255, 0.55);
}

.login-submit-btn:hover::before {
    opacity: 1;
}

.login-submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 12px rgba(107, 76, 255, 0.4);
}

.login-submit-btn:disabled {
    opacity: 0.72;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 4px 24px rgba(107, 76, 255, 0.25);
}

/* Spinner rotation */
.login-btn-spinner {
    animation: loginSpinnerRotate 0.85s linear infinite;
    flex-shrink: 0;
}

@keyframes loginSpinnerRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Footer note */
.login-card-footer-note {
    margin-top: 28px;
    text-align: center;
    font-size: 12px;
    color: rgba(160, 166, 181, 0.38);
    letter-spacing: 0.03em;
}

/* ── Responsive – mobile/tablet stacking ──────────────────────────────── */
@media (max-width: 840px) {
    #login-screen {
        flex-direction: column;
    }

    .login-brand-panel {
        width: 100%;
        min-width: unset;
        min-height: 260px;
        flex-shrink: 0;
    }

    .login-brand-panel::after {
        display: none;
    }

    .login-brand-content {
        padding: 32px 28px;
        gap: 20px;
    }

    .login-brand-heading h1 {
        font-size: 26px;
    }

    .login-brand-features {
        gap: 12px;
    }

    .login-form-panel {
        flex: 1;
        align-items: flex-start;
        padding: 28px 20px;
        overflow-y: auto;
    }

    .login-card {
        padding: 32px 28px;
    }
}


/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    padding: 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent), #b04cff);
    border-radius: 8px;
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    transition: all 0.2s;
    font-size: 15px;
}

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

.nav-item.active {
    background: rgba(107, 76, 255, 0.15);
    color: var(--accent);
    position: relative;
}

.nav-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: var(--accent);
    border-radius: 0 4px 4px 0;
}

.admin-only {
    display: none;
}

body[data-role="admin"] .admin-only {
    display: flex;
}

/* User Profile */
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2d3350;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.user-info span {
    font-size: 14px;
    font-weight: 500;
}

#user-role {
    font-size: 11px;
    color: var(--accent);
    margin-top: 2px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: linear-gradient(rgba(11, 15, 25, 0.90), rgba(11, 15, 25, 0.90)), url('assets/bg.png') no-repeat center center fixed;
    background-size: cover;
}

.top-header {
    height: 72px;
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    width: 300px;
    border: 1px solid var(--border);
    transition: border 0.2s;
}

.search-bar:focus-within {
    border-color: var(--accent);
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    width: 100%;
    font-size: 14px;
}

.content-area {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Glass Elements */
.glass {
    background: rgba(20, 24, 40, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
}

.stat-details h3 {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.stat-details h2 {
    font-size: 24px;
}

.open-icon {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.progress-icon {
    color: var(--accent);
    background: rgba(107, 76, 255, 0.1);
}

.closed-icon {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.overdue-icon {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.upcoming-icon {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

/* Forms & Inputs */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.full-width {
    grid-column: 1 / -1;
}

label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
    color: white;
    outline: none;
    font-size: 14px;
    transition: border 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(107, 76, 255, 0.2);
}

textarea {
    resize: vertical;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    transition: all 0.2s;
}

.btn.primary {
    background: linear-gradient(135deg, var(--accent), #8266ff);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(107, 76, 255, 0.3);
}

.btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(107, 76, 255, 0.4);
}

.btn.outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

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

.btn.text {
    background: transparent;
    color: var(--accent);
    padding: 0;
}

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

.full-width {
    width: 100%;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.2s;
    display: flex;
}

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

/* Quick filter pill buttons */
.ticket-qf-btn {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
}

.ticket-qf-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.ticket-qf-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

/* Sortable column hover highlight */
.sortable-th:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.open,
.badge.medium {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.badge.in-progress {
    background: rgba(107, 76, 255, 0.15);
    color: #a78bfa;
}

.badge.on-hold {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.badge.escalated-to-oem {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.badge.closed,
.badge.low {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.badge.high {
    background: rgba(249, 115, 22, 0.15);
    color: #fb923c;
}

.badge.critical {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.badge.on-track {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.badge.near-breach {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.badge.breached {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.badge.paused {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th,
.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.data-table th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Modals */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
}

.modal-backdrop.active {
    display: block;
}

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    /* Make sure modal fits screen */
    z-index: 101;
    opacity: 0;
    transition: all 0.2s ease-out;
    flex-direction: column;
    /* Ready for active state */
}

.modal.active {
    display: flex;
    /* Flexbox containment */
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.modal form {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Contains scroll inside */
    flex: 1;
    /* Expand into available modal space */
}

.modal .form-grid {
    overflow-y: auto;
    /* Enable scroll if content is long */
    flex: 1;
    padding-right: 8px;
    /* Room for scrollbar visually */
    padding-bottom: 4px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-shrink: 0;
    /* Keep header strictly at top */
}

.modal-footer {
    margin-top: 24px;
    /* Reduced from 32 down for smaller bounds */
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
    /* Keep buttons visibly at bottom securely */
}

/* Filters Bar */
.filters-bar {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    padding: 16px 24px;
}

.filter-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.filter-group label {
    margin: 0;
}

.filter-group select {
    width: 150px;
    padding: 8px 12px;
}

.settings-grid {
    max-width: 600px;
}

.settings-card h2 {
    margin-bottom: 8px;
}

.settings-card p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 14px;
}

.settings-card form .input-group {
    margin-bottom: 16px;
}

.settings-card form button {
    margin-top: 8px;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    padding: 16px 24px;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    color: white;
    box-shadow: var(--shadow);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}


/* ════════════════════════════════════════════════════════════════════════════
   DATE PICKER — Calendar icon visibility on dark theme
   Targets: input[type="date"], input[type="datetime-local"],
            input[type="month"], input[type="time"]
   Uses CSS filter to recolour the browser's native monochrome SVG icon
   to the theme accent colour (#6b4cff / var(--accent)).
   ════════════════════════════════════════════════════════════════════════════ */

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    /* Recolour the monochrome icon to accent purple-white */
    filter: invert(1) brightness(1.8) sepia(1) hue-rotate(215deg) saturate(4);
    opacity: 0.85;
    cursor: pointer;
    border-radius: 4px;
    padding: 2px;
    transition: opacity 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    filter: invert(1) brightness(2.2) sepia(1) hue-rotate(215deg) saturate(6);
    box-shadow: 0 0 8px rgba(107, 76, 255, 0.6);
}

/* Ensure the input row itself shows a pointer when user hovers near the icon */
input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="time"] {
    cursor: text;
    /* Slightly brighter caret to match the icon */
    caret-color: var(--accent);
    color-scheme: dark;
    /* tells Chrome to render date-popup in dark mode */
}

/* ── Toggle Switch Styles ── */
.switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
}
.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    transition: .3s;
}
.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: .3s;
}
input:checked + .slider {
    background-color: var(--accent);
    border-color: var(--accent);
}
input:checked + .slider:before {
    background-color: #fff;
    transform: translateX(16px);
}
.slider.round {
    border-radius: 22px;
}
.slider.round:before {
    border-radius: 50%;
}
/* ── Disabled PMC controls (driven by PMC Count) ───────────────────────────── */
.input-group input:disabled,
.input-group select:disabled,
.input-group textarea:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: rgba(127, 127, 127, 0.12);
}

.pmc-row-disabled {
    opacity: 0.45;
    pointer-events: none;
}

.pmc-row-disabled label {
    text-decoration: line-through;
}
