@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Brand palette */
    --primary:       #1e40af;
    --primary-mid:   #2563eb;
    --primary-light: #3b82f6;
    --accent:        #7c3aed;
    --accent-light:  #8b5cf6;

    /* Semantic */
    --success:  #10b981;
    --warning:  #f59e0b;
    --danger:   #ef4444;
    --danger-dark: #dc2626;

    /* Neutrals */
    --n-950: #0f172a;
    --n-900: #1e293b;
    --n-800: #334155;
    --n-600: #64748b;
    --n-400: #94a3b8;
    --n-200: #e2e8f0;
    --n-50:  #f8fafc;
    --white: #ffffff;

    /* Gradients */
    --grad-primary: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    --grad-accent:  linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
    --grad-danger:  linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --grad-success: linear-gradient(135deg, #10b981 0%, #059669 100%);

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.10), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.10), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.12), 0 10px 10px -5px rgba(0,0,0,0.05);
    --shadow-2xl: 0 25px 50px -12px rgba(0,0,0,0.25);
    --shadow-glow: 0 0 20px rgba(59,130,246,0.35);

    /* Border radius */
    --r-sm:   6px;
    --r-md:   10px;
    --r-lg:   16px;
    --r-xl:   24px;
    --r-full: 9999px;

    /* Transitions */
    --t-fast:   all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --t-normal: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    /* Legacy aliases used by existing JS-dependent classes */
    --primary-color:   #1e40af;
    --secondary-color: #3b82f6;
    --success-color:   #10b981;
    --warning-color:   #f59e0b;
    --danger-color:    #ef4444;
    --gray-50:  #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --shadow-md-old: 0 4px 6px -1px rgba(0,0,0,0.10), 0 2px 4px -1px rgba(0,0,0,0.06);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--n-800);
    background: #f0f4ff;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   DARK MODE
   ============================================================ */
body.dark {
    color: #e2e8f0;
    background: linear-gradient(135deg, #060d1a 0%, #0f172a 100%);
}

body.dark .card {
    background: rgba(15, 23, 42, 0.75);
    border-color: rgba(148, 163, 184, 0.12);
    box-shadow: 0 10px 30px rgba(0,0,0,0.45), 0 1px 0 rgba(255,255,255,0.04) inset;
}

body.dark input,
body.dark select,
body.dark textarea {
    background: rgba(15, 23, 42, 0.80);
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.20);
}

body.dark input::placeholder,
body.dark textarea::placeholder { color: var(--n-600); }

body.dark thead th {
    background: rgba(30, 41, 59, 0.80);
    color: #cbd5e1;
    border-color: rgba(148,163,184,0.12);
}

body.dark table {
    background: rgba(15, 23, 42, 0.70);
    border-color: rgba(148, 163, 184, 0.12);
}

body.dark tbody tr:hover { background: rgba(30, 41, 59, 0.70); }
body.dark tbody td { border-color: rgba(148, 163, 184, 0.10); }

body.dark .modal-content {
    background: rgba(15, 23, 42, 0.97);
    border-color: rgba(148, 163, 184, 0.15);
}

body.dark .modal-header,
body.dark .modal-footer {
    border-color: rgba(148, 163, 184, 0.12);
}

body.dark .summary-card {
    background: rgba(15, 23, 42, 0.65);
    border-color: rgba(255, 255, 255, 0.07);
}

body.dark header.card nav button {
    background: rgba(30, 41, 59, 0.85);
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.20);
}

body.dark header.card nav button:hover {
    background: rgba(51, 65, 85, 0.95);
}

body.dark .section {
    background: rgba(15, 23, 42, 0.50);
    border-color: rgba(148, 163, 184, 0.12);
}

body.dark .sidebar {
    background: linear-gradient(180deg, #060d1a 0%, #0d1a2e 100%);
    border-color: rgba(148, 163, 184, 0.08);
}

body.dark a { color: #93c5fd; }
body.dark a:hover { color: #bfdbfe; text-decoration: underline; }

body.dark .form-control {
    background: rgba(15, 23, 42, 0.80);
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.20);
}

body.dark .btn-secondary {
    background: rgba(30, 41, 59, 0.90);
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.25);
}

body.dark .btn-secondary:hover {
    background: rgba(51, 65, 85, 1);
}

body.dark .loading-overlay {
    background: rgba(9, 14, 29, 0.92);
}

/* ============================================================
   UTILITY
   ============================================================ */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }

.row {
    display: flex;
    gap: 16px;
}

.col { flex: 1; }

/* ============================================================
   CONTAINER
   ============================================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================================
   CARD  — glassmorphism
   ============================================================ */
.card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.60);
    border-radius: var(--r-lg);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.8) inset,
        var(--shadow-md);
    padding: 20px;
    transition: var(--t-normal);
}

.card:hover {
    box-shadow:
        0 1px 0 rgba(255,255,255,0.8) inset,
        var(--shadow-lg);
}

/* ============================================================
   BUTTONS
   ============================================================ */
input, select, textarea, button {
    font-family: inherit;
}

button {
    background: var(--grad-primary);
    color: var(--white);
    border: none;
    border-radius: var(--r-md);
    padding: 10px 18px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--t-fast);
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

button:active { transform: translateY(0); box-shadow: var(--shadow-xs); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--r-md);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--t-fast);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active { transform: translateY(0); }

.btn-primary {
    background: var(--grad-primary);
    color: var(--white);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    box-shadow: var(--shadow-md), 0 0 16px rgba(59,130,246,0.40);
}

.btn-secondary {
    background: var(--white);
    color: var(--n-800);
    border: 1px solid var(--n-200);
}

.btn-secondary:hover {
    background: var(--n-50);
    border-color: var(--n-400);
}

.btn-success {
    background: var(--grad-success);
    color: var(--white);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: var(--shadow-md), 0 0 16px rgba(16,185,129,0.35);
}

.btn-danger {
    background: var(--grad-danger);
    color: var(--white);
}

.btn-danger:hover {
    box-shadow: var(--shadow-md), 0 0 16px rgba(239,68,68,0.40);
}

.btn-remove {
    background: var(--danger);
    color: var(--white);
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: var(--r-sm);
}

.btn-remove:hover {
    background: var(--danger-dark);
    transform: translateY(-1px);
}

/* ============================================================
   INPUTS
   ============================================================ */
input, select, textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--n-200);
    border-radius: var(--r-md);
    background: var(--white);
    color: var(--n-800);
    font-size: 0.875rem;
    transition: var(--t-fast);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.18);
    background: var(--white);
}

input::placeholder, textarea::placeholder { color: var(--n-400); }

textarea { resize: vertical; min-height: 90px; }

/* ============================================================
   TABLE
   ============================================================ */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border: 1px solid var(--n-200);
    border-radius: var(--r-md);
    overflow: hidden;
    font-size: 0.875rem;
}

th, td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--n-200);
}

thead th {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: var(--n-600);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    border-bottom: 2px solid var(--n-200);
}

tbody td { vertical-align: middle; color: var(--n-800); }

tbody tr:hover {
    background: linear-gradient(90deg, rgba(59,130,246,0.04) 0%, rgba(139,92,246,0.03) 100%);
    transition: background 0.15s;
}

tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   MODAL
   ============================================================ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(9, 14, 29, 0.60);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    animation: fadeIn 0.18s ease;
}

.modal-content {
    background: var(--white);
    border-radius: 20px;
    box-shadow:
        var(--shadow-2xl),
        0 0 0 1px rgba(255,255,255,0.08) inset;
    width: 90%;
    max-width: 600px;
    max-height: 88vh;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(16px) scale(0.97);
    transition: opacity 0.22s cubic-bezier(0.4,0,0.2,1),
                transform 0.22s cubic-bezier(0.4,0,0.2,1);
    border: 1px solid rgba(226,232,240,0.6);
}

.modal.show .modal-content {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--n-200);
    background: linear-gradient(135deg, #f8fafc 0%, #fff 100%);
    border-radius: 20px 20px 0 0;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--n-900);
    letter-spacing: -0.01em;
}

.modal-body { padding: 20px 24px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--n-200);
    background: #f8fafc;
    border-radius: 0 0 20px 20px;
}

.modal-close {
    background: none;
    border: none;
    box-shadow: none;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--n-400);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--r-sm);
    transition: var(--t-fast);
}

.modal-close:hover {
    background: var(--n-200);
    color: var(--n-800);
    transform: none;
    box-shadow: none;
}

/* ============================================================
   STATUS BADGES
   ============================================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--r-full);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: capitalize;
    border: 1px solid transparent;
}

.status-badge[data-status="pending"] {
    background: #fff7ed;
    color: #c2410c;
    border-color: #fed7aa;
}

.status-badge[data-status="approved"] {
    background: #ecfdf5;
    color: #047857;
    border-color: #bbf7d0;
}

.status-badge[data-status="rejected"] {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

.status-badge[data-status="in_progress"] {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}

.status-badge[data-status="closed"] {
    background: #eef2ff;
    color: #4f46e5;
    border-color: #c7d2fe;
}

body.dark .status-badge[data-status="pending"]     { background: rgba(124,45,18,.18);  color: #fdba74; border-color: rgba(251,146,60,.30); }
body.dark .status-badge[data-status="approved"]    { background: rgba(6,95,70,.18);    color: #6ee7b7; border-color: rgba(16,185,129,.35); }
body.dark .status-badge[data-status="rejected"]    { background: rgba(153,27,27,.18);  color: #fca5a5; border-color: rgba(248,113,113,.35); }
body.dark .status-badge[data-status="in_progress"] { background: rgba(29,78,216,.18);  color: #93c5fd; border-color: rgba(96,165,250,.35); }
body.dark .status-badge[data-status="closed"]      { background: rgba(79,70,229,.18);  color: #c7d2fe; border-color: rgba(165,180,252,.35); }

/* ============================================================
   SUMMARY CARDS
   ============================================================ */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.summary-card {
    position: relative;
    flex: 1;
    min-width: 130px;
    background: var(--white);
    border: 1px solid var(--n-200);
    border-radius: var(--r-lg);
    padding: 14px 16px 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--t-normal);
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.summary-card:nth-child(1)::before { background: linear-gradient(90deg, #f59e0b, #d97706); }
.summary-card:nth-child(2)::before { background: linear-gradient(90deg, #3b82f6, #1d4ed8); }
.summary-card:nth-child(3)::before { background: linear-gradient(90deg, #10b981, #059669); }
.summary-card:nth-child(4)::before { background: linear-gradient(90deg, #ef4444, #dc2626); }
.summary-card:nth-child(5)::before { background: linear-gradient(90deg, #8b5cf6, #7c3aed); }
.summary-card:nth-child(6)::before { background: linear-gradient(90deg, #06b6d4, #0284c7); }

.summary-card:nth-child(1) .value { color: #d97706; }
.summary-card:nth-child(2) .value { color: #1d4ed8; }
.summary-card:nth-child(3) .value { color: #059669; }
.summary-card:nth-child(4) .value { color: #dc2626; }
.summary-card:nth-child(5) .value { color: #7c3aed; }
.summary-card:nth-child(6) .value { color: #0284c7; }

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

.summary-card h4 {
    font-size: 11px;
    color: var(--n-600);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 8px;
}

.summary-card .value {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    border-color: rgba(148, 163, 184, 0.08);
    color: #e2e8f0;
    width: 260px;
    min-height: 100vh;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.sidebar .brand strong { font-size: 15px; font-weight: 700; color: #f1f5f9; }

.sidebar .side-nav button {
    width: 100%;
    text-align: left;
    background: transparent;
    color: #94a3b8;
    border: none;
    border-radius: var(--r-md);
    padding: 10px 14px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--t-fast);
    box-shadow: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar .side-nav button:hover {
    background: rgba(59, 130, 246, 0.12);
    color: #e2e8f0;
    transform: none;
    box-shadow: none;
}

.sidebar .side-nav button.active {
    background: linear-gradient(135deg, rgba(59,130,246,0.20), rgba(139,92,246,0.12));
    color: #93c5fd;
    font-weight: 600;
}

/* ============================================================
   HEADER
   ============================================================ */
header.card {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
}

header.card nav button {
    background: var(--white);
    color: var(--n-700, #334155);
    border: 1px solid var(--n-200);
    margin-left: 8px;
    padding: 8px 14px;
    border-radius: var(--r-md);
    font-size: 0.8rem;
    transition: var(--t-fast);
}

header.card nav button:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

header.card nav button#logoutBtn {
    background: var(--grad-danger);
    border: none;
    color: var(--white);
}

header.card nav button#logoutBtn:hover {
    box-shadow: var(--shadow-md), 0 0 12px rgba(239,68,68,0.40);
}

/* ============================================================
   LOADING OVERLAY & SPINNER
   ============================================================ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(248, 250, 252, 0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.15s ease;
}

.loading-content {
    text-align: center;
    padding: 2.5rem 3rem;
    background: var(--white);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--n-200);
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--n-200);
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-container {
    margin-bottom: 2rem;
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--n-200);
    border-radius: var(--r-full);
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--grad-primary);
    border-radius: var(--r-full);
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 20px;
    background: rgba(255,255,255,0.35);
    border-radius: var(--r-full);
    animation: shimmer 1.5s ease infinite;
}

.progress-text {
    display: block;
    text-align: center;
    font-weight: 500;
    color: var(--n-600);
    font-size: 0.85rem;
}

/* ============================================================
   SECTION
   ============================================================ */
.section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border: 1px solid var(--n-200);
    border-radius: var(--r-lg);
    background: rgba(248, 250, 252, 0.80);
    position: relative;
    animation: slideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transition: var(--t-normal);
}

.section.removable {
    border-left: 4px solid var(--primary-light);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 12px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--n-900);
    flex: 1;
    letter-spacing: -0.01em;
}

.section-toggle {
    background: none;
    border: none;
    color: var(--n-400);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--r-sm);
    transition: var(--t-fast);
    box-shadow: none;
}

.section-toggle:hover {
    background: var(--n-200);
    color: var(--n-700);
    transform: none;
    box-shadow: none;
}

.section-remove {
    background: var(--danger);
    color: var(--white);
    border: none;
    padding: 4px 10px;
    border-radius: var(--r-sm);
    font-size: 0.75rem;
    cursor: pointer;
    margin-left: 6px;
    transition: var(--t-fast);
    box-shadow: none;
}

.section-remove:hover {
    background: var(--danger-dark);
    transform: none;
}

/* ============================================================
   FORM GROUP / CONTROL
   ============================================================ */
.form-group {
    margin-bottom: 1.4rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--n-700);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--n-200);
    border-radius: var(--r-md);
    font-size: 0.875rem;
    transition: var(--t-fast);
    background: var(--white);
    color: var(--n-800);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.18);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* ============================================================
   QUESTION GROUP
   ============================================================ */
.question-group {
    position: relative;
    padding: 1rem;
    border: 1px solid var(--n-200);
    border-radius: var(--r-md);
    background: var(--white);
    margin-bottom: 1rem;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.question-remove {
    background: var(--danger);
    color: var(--white);
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--t-fast);
    box-shadow: none;
    flex-shrink: 0;
}

.question-remove:hover {
    background: var(--danger-dark);
    transform: scale(1.1);
    box-shadow: none;
}

.question-item {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid var(--n-200);
    border-radius: var(--r-md);
    background: var(--n-50);
}

.question-input, .question-type {
    padding: 8px 12px;
    border: 1.5px solid var(--n-200);
    border-radius: var(--r-sm);
    background: var(--white);
    font-size: 0.875rem;
    transition: var(--t-fast);
}

.question-input:focus, .question-type:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.18);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    color: var(--n-400);
    padding: 32px 16px;
    font-size: 0.9rem;
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: block;
    opacity: 0.5;
}

/* ============================================================
   TITLE BADGE
   ============================================================ */
.title-badge {
    transition: var(--t-fast);
    border-radius: var(--r-sm);
    cursor: default;
}

.title-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.12);
}

body.dark .title-badge { box-shadow: 0 1px 3px rgba(0,0,0,0.4); }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    background: var(--white);
    color: var(--n-800);
    padding: 12px 20px;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--n-200);
    border-left: 4px solid var(--primary-light);
    font-size: 0.875rem;
    font-weight: 500;
    max-width: 360px;
    animation: slideInRight 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
}

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

/* ============================================================
   FORM CONTAINER (proposal builder)
   ============================================================ */
.form-container {
    background: var(--white);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.form-header {
    background: linear-gradient(135deg, #f8fafc 0%, #fff 100%);
    padding: 2rem;
    border-bottom: 1px solid var(--n-200);
}

.form-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--n-900);
    margin-bottom: 0.4rem;
    letter-spacing: -0.02em;
}

.form-header p { color: var(--n-600); margin-bottom: 1.5rem; }

.form-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

.proposal-form { padding: 2rem; }

/* ============================================================
   PREVIEW
   ============================================================ */
.preview-container {
    background: var(--white);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.preview-header {
    background: linear-gradient(135deg, #f8fafc 0%, #fff 100%);
    padding: 2rem;
    border-bottom: 1px solid var(--n-200);
}

.preview-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--n-900);
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.preview-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

.editor-container { padding: 2rem; }

.quill-editor {
    min-height: 400px;
    background: var(--white);
    border-radius: var(--r-md);
    border: 1px solid var(--n-200);
}

.html-textarea {
    width: 100%;
    min-height: 400px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    border: 1px solid var(--n-200);
    border-radius: var(--r-md);
    padding: 1rem;
    background: var(--n-50);
    resize: vertical;
}

/* ============================================================
   QUILL
   ============================================================ */
.ql-toolbar {
    border-top: 1px solid var(--n-200) !important;
    border-left: 1px solid var(--n-200) !important;
    border-right: 1px solid var(--n-200) !important;
    border-bottom: none !important;
    border-radius: var(--r-md) var(--r-md) 0 0 !important;
    background: #f8fafc !important;
}

.ql-container {
    border-bottom: 1px solid var(--n-200) !important;
    border-left: 1px solid var(--n-200) !important;
    border-right: 1px solid var(--n-200) !important;
    border-top: none !important;
    border-radius: 0 0 var(--r-md) var(--r-md) !important;
    font-family: 'Inter', sans-serif !important;
}

/* ============================================================
   HEADER / NAV (legacy)
   ============================================================ */
.header {
    background: var(--grad-primary);
    color: var(--white);
    padding: 2rem 0;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.logo {
    height: 60px;
    width: auto;
    margin-bottom: 1rem;
    border-radius: var(--r-md);
    box-shadow: var(--shadow-md);
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
}

.subtitle { font-size: 1rem; opacity: 0.85; font-weight: 400; }

.main { padding: 2rem 0; }

/* ============================================================
   ICON
   ============================================================ */
.icon { font-size: 1rem; }

/* ============================================================
   LOADING TEXT
   ============================================================ */
#loadingText { font-weight: 500; color: var(--n-700); margin: 0; }

/* ============================================================
   KEYFRAMES
   ============================================================ */
@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
    0%   { opacity: 0.35; }
    50%  { opacity: 0.70; }
    100% { opacity: 0.35; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-12px); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .container { padding: 0 15px; }

    .header h1 { font-size: 2rem; }

    .form-actions,
    .preview-actions { flex-direction: column; }

    .btn { width: 100%; justify-content: center; }

    .question-item { grid-template-columns: 1fr; gap: 0.5rem; }

    .modal-content { width: 95%; margin: 10px; }

    .row { flex-direction: column; }

    .summary-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .header { padding: 1.5rem 0; }
    .header h1 { font-size: 1.75rem; }
    .form-header, .preview-header { padding: 1.5rem; }
    .proposal-form, .editor-container { padding: 1.5rem; }
    .section { padding: 1rem; }
    .summary-cards { grid-template-columns: 1fr 1fr; }
}
