/* ================================================================
   XRewards.Space — Design System v2.0
   Dark-first, premium SaaS design with full backward compatibility
   ================================================================ */

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

/* === CSS VARIABLES — Dark Mode (Default) === */
:root {
    /* Brand / Accent */
    --brand-50:  #eef2ff;
    --brand-100: #dce6ff;
    --brand-200: #bfcfff;
    --brand-400: #7b93f7;
    --brand-500: #6366f1;
    --brand-600: #4f46e5;
    --brand-700: #4338ca;
    --brand-900: #1a2d8f;

    /* Accent colors */
    --accent:       #6366f1;
    --accent-hover:  #818cf8;
    --accent-green:  #22c55e;
    --accent-amber:  #f59e0b;
    --accent-red:    #ef4444;

    /* Surfaces */
    --app-bg:           #0b0d13;
    --surface:          #12141c;
    --surface-raised:   #181a24;
    --surface-overlay:  #1e2130;
    --surface-muted:    #12141c;
    --surface-border:   rgba(255, 255, 255, 0.08);
    --surface-border-strong: rgba(255, 255, 255, 0.14);

    /* Text */
    --text-primary:   #f0f0f3;
    --text-secondary: #9395a5;
    --text-muted:     #5c5f73;
    --text-inverse:   #0b0d13;

    /* Sidebar (always dark) */
    --sidebar-bg:          #0a0c12;
    --sidebar-border:      rgba(255, 255, 255, 0.06);
    --sidebar-text:        #9395a5;
    --sidebar-text-hover:  #e0e0e6;
    --sidebar-text-active: #ffffff;
    --sidebar-active-bg:   rgba(99, 102, 241, 0.12);
    --sidebar-active-bar:  #6366f1;

    /* Topbar */
    --topbar-bg:       rgba(11, 13, 19, 0.8);
    --topbar-border:   rgba(255, 255, 255, 0.06);

    /* Inputs */
    --input-bg:          #12141c;
    --input-border:      rgba(255, 255, 255, 0.1);
    --input-border-focus: #6366f1;
    --input-text:        #f0f0f3;
    --input-placeholder: #5c5f73;

    /* Radii */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;

    /* Shadows */
    --shadow-sm:  0 1px 2px rgba(0,0,0,0.3);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg:  0 10px 30px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 20px rgba(99,102,241,0.15);

    /* Toast colors */
    --toast-success-bg:     rgba(34,197,94,0.12);
    --toast-success-border: rgba(34,197,94,0.25);
    --toast-success-text:   #4ade80;
    --toast-error-bg:       rgba(239,68,68,0.12);
    --toast-error-border:   rgba(239,68,68,0.25);
    --toast-error-text:     #f87171;
    --toast-warning-bg:     rgba(245,158,11,0.12);
    --toast-warning-border: rgba(245,158,11,0.25);
    --toast-warning-text:   #fbbf24;
    --toast-info-bg:        rgba(99,102,241,0.12);
    --toast-info-border:    rgba(99,102,241,0.25);
    --toast-info-text:      #818cf8;
}

/* === CSS VARIABLES — Light Mode Override === */
html:not(.dark) {
    --brand-50:  #f0f4ff;
    --brand-100: #dce6ff;
    --brand-200: #bfcfff;
    --brand-400: #7b93f7;
    --brand-500: #6366f1;
    --brand-600: #4f46e5;
    --brand-700: #4338ca;
    --brand-900: #1a2d8f;

    --accent:        #4f46e5;
    --accent-hover:  #6366f1;

    --app-bg:           #f0f2f7;
    --surface:          #ffffff;
    --surface-raised:   #f8f9fc;
    --surface-overlay:  #ffffff;
    --surface-muted:    #f4f5f9;
    --surface-border:   #d5dae3;
    --surface-border-strong: #bfc5d1;

    --text-primary:   #111827;
    --text-secondary: #6b7280;
    --text-muted:     #9ca3af;
    --text-inverse:   #ffffff;

    --topbar-bg:       rgba(255,255,255,0.92);
    --topbar-border:   #d5dae3;

    --input-bg:          #ffffff;
    --input-border:      #d5dae3;
    --input-border-focus: #4f46e5;
    --input-text:        #111827;
    --input-placeholder: #9ca3af;

    --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg:  0 10px 30px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.08);
    --shadow-glow: 0 0 20px rgba(79,70,229,0.1);

    --toast-success-bg:     #f0fdf4;
    --toast-success-border: #bbf7d0;
    --toast-success-text:   #166534;
    --toast-error-bg:       #fef2f2;
    --toast-error-border:   #fecaca;
    --toast-error-text:     #991b1b;
    --toast-warning-bg:     #fffbeb;
    --toast-warning-border: #fde68a;
    --toast-warning-text:   #92400e;
    --toast-info-bg:        #eff6ff;
    --toast-info-border:    #bfdbfe;
    --toast-info-text:      #1e40af;
}


/* ================================================================
   BASE / RESET
   ================================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--app-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
* { scrollbar-width: thin; scrollbar-color: var(--surface-border-strong) transparent; }


/* ================================================================
   TYPOGRAPHY
   ================================================================ */

h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; color: var(--text-primary); }

.font-display { font-family: 'Outfit', 'Inter', system-ui, sans-serif; }
.font-mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }
.font-sans { font-family: 'Inter', system-ui, sans-serif; }

.text-brand-600 { color: var(--brand-600); }
.text-brand-800 { color: var(--brand-700); }
.text-brand-400 { color: var(--brand-400); }
.text-brand-500 { color: var(--brand-500); }


/* ================================================================
   LAYOUT — App Grid, Sidebar, Topbar, Page Content
   ================================================================ */

.app-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-rows: 100vh;
    overflow: hidden;
}

/* --- Sidebar (always dark, ignores light mode) --- */
.sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Sidebar overlay (for mobile close) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 39;
}
.sidebar-overlay.active { display: block; }

/* Mobile hamburger button in topbar */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.375rem;
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
}
.sidebar-toggle:hover {
    color: var(--text-primary);
    background: var(--surface-raised);
}

/* Mobile: sidebar becomes an overlay drawer */
@media (max-width: 768px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        z-index: 40;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }
    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: flex;
        align-items: center;
    }
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-nav {
    padding: 1rem 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sidebar-nav-item,
.sidebar-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.5rem;
    color: var(--sidebar-text);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
    text-decoration: none;
    border-left: 3px solid transparent;
}

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

.sidebar-nav-item.active,
.sidebar-nav .nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-active);
    border-left-color: var(--sidebar-active-bar);
}

.sidebar-nav-item .nav-icon {
    width: 1.25rem;
    height: 1.25rem;
    opacity: 0.7;
    flex-shrink: 0;
}

.sidebar-nav-item.active .nav-icon { opacity: 1; }

.sidebar-section-label {
    padding: 1.25rem 1.5rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.sidebar-divider {
    height: 1px;
    background: var(--sidebar-border);
    margin: 0.75rem 0;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--sidebar-border);
}

.sidebar-muted-text {
    color: var(--sidebar-text);
}

.sidebar-logout-btn {
    padding: 0.375rem;
    border-radius: var(--radius-md);
    color: var(--sidebar-text);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    background: transparent;
    border: none;
    cursor: pointer;
}
.sidebar-logout-btn:hover {
    color: rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.1);
}

/* --- Main wrapper --- */
.main-wrapper {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- Topbar --- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--topbar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--topbar-border);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* --- Page content --- */
.page-content {
    padding: 2rem 2rem 4rem;
    flex: 1;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .topbar {
        padding: 0.625rem 1rem;
    }
    .page-content {
        padding: 1.25rem 1rem 3rem;
    }
}

/* --- Editor grid (2-column content+preview) --- */
.editor-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
    align-items: start;
}

.form-column {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}

.preview-column {
    min-width: 0;
}

.preview-sticky {
    position: sticky;
    top: 1.5rem;
}

@media (max-width: 1024px) {
    .editor-grid {
        grid-template-columns: 1fr;
    }
    .preview-sticky {
        position: static;
    }
}

/* --- Mobile responsive utilities --- */
@media (max-width: 768px) {
    .grid-cols-2 { grid-template-columns: 1fr; }
    .md\:grid-cols-3 { grid-template-columns: 1fr; }
    .md\:grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .hidden-mobile { display: none !important; }
}

@media (max-width: 480px) {
    .md\:grid-cols-4 { grid-template-columns: 1fr; }
    .text-5xl { font-size: 2.25rem; }
    .text-6xl { font-size: 2.75rem; }
    .py-24 { padding-top: 3rem; padding-bottom: 3rem; }
    .py-20 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
    .card { border-radius: var(--radius-lg); }
    .btn-lg { padding: 0.75rem 1.25rem; font-size: 0.875rem; }
}

/* Data table mobile scroll */
@media (max-width: 768px) {
    .data-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .data-table { min-width: 600px; }
}


/* ================================================================
   CARD COMPONENT
   ================================================================ */

.card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--surface-border);
}

.card-header-icon {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent);
    flex-shrink: 0;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.card-subtitle {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.125rem;
}

.card-body {
    padding: 1.5rem;
}

/* Collapsible card sections */
.collapsible-header {
    cursor: pointer;
    user-select: none;
}

.collapse-arrow {
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.collapsible-card.collapsed .collapse-arrow {
    transform: rotate(-90deg);
}

.collapsible-body {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
    max-height: 2000px;
    opacity: 1;
}

.collapsible-card.collapsed .collapsible-body {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.collapsible-card.collapsed .card-header {
    border-bottom: none;
}


/* ================================================================
   FORM COMPONENTS
   ================================================================ */

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.form-required {
    color: var(--accent-red);
    margin-left: 0.125rem;
}

.form-optional {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

.form-helper,
.form-help {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
}

.form-error {
    font-size: 0.75rem;
    color: var(--accent-red);
    margin-top: 0.25rem;
}

/* Input fields (shared styles) */
.input-field,
.form-input {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    font-family: inherit;
    line-height: 1.5;
    color: var(--input-text);
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-lg);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-field:focus,
.form-input:focus {
    outline: none;
    border-color: var(--input-border-focus);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.input-field::placeholder,
.form-input::placeholder {
    color: var(--input-placeholder);
}

.input-field:disabled,
.form-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Select */
.input-select,
select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3e%3cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
    padding-right: 2.5rem;
}

/* Select wrapper (for custom arrow) */
.select-wrapper {
    position: relative;
}

.select-arrow {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
}

/* Textarea */
.input-textarea,
textarea.form-input {
    resize: vertical;
    min-height: 5rem;
    line-height: 1.6;
}

/* Input with icon */
.input-icon-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    width: 1.125rem;
    height: 1.125rem;
}

.input-with-icon {
    padding-left: 2.5rem;
}


/* ================================================================
   BUTTONS
   ================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.4;
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Primary — gradient */
.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #fff;
    box-shadow: 0 1px 3px rgba(99,102,241,0.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
    box-shadow: 0 4px 14px rgba(99,102,241,0.4);
}

/* Ghost */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--surface-border);
}
.btn-ghost:hover {
    background: var(--surface-raised);
    color: var(--text-primary);
    border-color: var(--surface-border-strong);
}

/* Danger */
.btn-danger {
    background: var(--accent-red);
    color: #fff;
}
.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(239,68,68,0.3);
}

/* Warning */
.btn-warning {
    background: rgba(245,158,11,0.12);
    color: #f59e0b;
    border-color: rgba(245,158,11,0.2);
}
.btn-warning:hover {
    background: rgba(245,158,11,0.2);
    box-shadow: 0 2px 8px rgba(245,158,11,0.15);
}
html:not(.dark) .btn-warning {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}
html:not(.dark) .btn-warning:hover {
    background: #fde68a;
}

/* Success */
.btn-success {
    background: rgba(34,197,94,0.12);
    color: #4ade80;
    border-color: rgba(34,197,94,0.2);
}
.btn-success:hover {
    background: rgba(34,197,94,0.2);
    box-shadow: 0 2px 8px rgba(34,197,94,0.15);
}
html:not(.dark) .btn-success {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}
html:not(.dark) .btn-success:hover {
    background: #bbf7d0;
}

/* Info */
.btn-info {
    background: rgba(59,130,246,0.12);
    color: #60a5fa;
    border-color: rgba(59,130,246,0.2);
}
.btn-info:hover {
    background: rgba(59,130,246,0.2);
    box-shadow: 0 2px 8px rgba(59,130,246,0.15);
}
html:not(.dark) .btn-info {
    background: #dbeafe;
    color: #1e40af;
    border-color: #bfdbfe;
}
html:not(.dark) .btn-info:hover {
    background: #bfdbfe;
}

/* Danger — dark/light mode overrides */
html:not(.dark) .btn-danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}
html:not(.dark) .btn-danger:hover {
    background: #fecaca;
    box-shadow: 0 2px 8px rgba(239,68,68,0.15);
}

/* Sizes */
.btn-xs { padding: 0.25rem 0.625rem; font-size: 0.75rem; border-radius: var(--radius-md); }
.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.875rem 1.75rem; font-size: 1rem; }

/* Disabled state */
.btn-disabled {
    opacity: 0.4;
    pointer-events: none;
    cursor: not-allowed;
}

/* SU (Switch User) banner */
.su-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 500;
}
.su-banner strong { font-weight: 700; }
.su-banner-btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.375rem;
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    cursor: pointer;
    transition: background 0.15s ease;
}
.su-banner-btn:hover { background: rgba(255,255,255,0.35); }

/* Theme toggle button */
.theme-toggle {
    background: var(--surface-raised);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.theme-toggle:hover {
    color: var(--text-primary);
    border-color: var(--surface-border-strong);
}


/* ================================================================
   BADGE COMPONENT
   ================================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.1875rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    line-height: 1.4;
}

.badge-draft {
    background: rgba(99,102,241,0.12);
    color: #818cf8;
}

.badge-active {
    background: rgba(34,197,94,0.12);
    color: #4ade80;
}

.badge-pending {
    background: rgba(245,158,11,0.12);
    color: #fbbf24;
}

.badge-suspended {
    background: rgba(239,68,68,0.12);
    color: #f87171;
}

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

/* Light mode badge overrides */
html:not(.dark) .badge-draft { background: #dbeafe; color: #1e40af; }
html:not(.dark) .badge-active { background: #dcfce7; color: #166534; }
html:not(.dark) .badge-pending { background: #fef3c7; color: #92400e; }
html:not(.dark) .badge-suspended { background: #fee2e2; color: #991b1b; }
html:not(.dark) .badge-banned { background: #fef2f2; color: #991b1b; }


/* ================================================================
   STATUS BADGES (backward compat — updated for dark mode)
   ================================================================ */

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
}

.status-active   { background: rgba(34,197,94,0.12);  color: #4ade80; }
.status-paused   { background: rgba(245,158,11,0.12); color: #fbbf24; }
.status-ended,
.status-suspended { background: rgba(255,255,255,0.06); color: var(--text-secondary); }
.status-draft    { background: rgba(99,102,241,0.12);  color: #818cf8; }
.status-cancelled,
.status-banned   { background: rgba(239,68,68,0.12);   color: #f87171; }
.status-pending  { background: rgba(245,158,11,0.12);  color: #fbbf24; }

html:not(.dark) .status-active   { background: #dcfce7; color: #166534; }
html:not(.dark) .status-paused   { background: #fef3c7; color: #92400e; }
html:not(.dark) .status-ended,
html:not(.dark) .status-suspended { background: #f3f4f6; color: #4b5563; }
html:not(.dark) .status-draft    { background: #dbeafe; color: #1e40af; }
html:not(.dark) .status-cancelled,
html:not(.dark) .status-banned   { background: #fef2f2; color: #991b1b; }
html:not(.dark) .status-pending  { background: #fef3c7; color: #92400e; }


/* ================================================================
   DATA TABLE
   ================================================================ */

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

.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--surface-raised);
    border-bottom: 1px solid var(--surface-border);
}

.data-table td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--surface-border);
}

.data-table tr:hover td {
    background: var(--surface-raised);
}


/* ================================================================
   TOAST NOTIFICATIONS
   ================================================================ */

.toast-container {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
    width: auto;
    max-width: 90vw;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 99px;
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: auto;
    animation: toast-pop 0.3s cubic-bezier(0.16,1,0.3,1) both;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

.toast-icon { flex-shrink: 0; width: 1rem; height: 1rem; }
.toast-msg { margin: 0; }

.toast-close {
    background: none;
    border: none;
    font-size: 0.875rem;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    opacity: 0.4;
    padding: 0;
    flex-shrink: 0;
    margin-left: 0.125rem;
}
.toast-close:hover { opacity: 1; }

.toast-success { background: #065f46; color: #a7f3d0; }
.toast-error   { background: #7f1d1d; color: #fecaca; }
.toast-warning { background: #78350f; color: #fde68a; }
.toast-info    { background: #312e81; color: #c7d2fe; }

@keyframes toast-pop {
    from { opacity: 0; transform: translateY(1rem) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.toast-dismissing {
    opacity: 0;
    transform: translateY(1rem) scale(0.95);
    transition: all 0.2s ease;
}


/* ================================================================
   STEPS BAR
   ================================================================ */

.steps-bar {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 2rem;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.step-dot {
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--surface-raised);
    border: 2px solid var(--surface-border);
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.step-active .step-dot {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}

.step-active {
    color: var(--text-primary);
}

.step-upcoming {
    color: var(--text-muted);
}

.step-connector {
    flex: 1;
    height: 2px;
    background: var(--surface-border);
    margin: 0 0.75rem;
    min-width: 2rem;
}

.step-active + .step-connector {
    background: var(--accent);
}


/* ================================================================
   PREVIEW CARD
   ================================================================ */

.preview-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.preview-card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--surface-border);
    background: var(--surface-raised);
}

.preview-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.preview-reward {
    padding: 1.25rem 1.5rem;
    background: rgba(99,102,241,0.06);
    border-top: 1px solid var(--surface-border);
    border-bottom: 1px solid var(--surface-border);
}

.preview-footer {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}


/* ================================================================
   CHECKLIST
   ================================================================ */

.checklist {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding: 0.375rem 0;
}

.check-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.check-empty {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 9999px;
    border: 2px solid var(--surface-border-strong);
    flex-shrink: 0;
}

.check-done {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 9999px;
    flex-shrink: 0;
    background: var(--accent-green);
    border: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 6l2.5 2.5 4.5-5' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-size: 12px;
    background-repeat: no-repeat;
    background-position: center;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.checklist-done {
    color: var(--text-primary);
}


/* ================================================================
   ANIMATIONS
   ================================================================ */

@keyframes fade-up {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-12px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

/* Backward compat alias */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-fade-up {
    animation: fade-up 0.5s ease both;
}

.animate-fade-in {
    animation: fade-in 0.4s ease both;
}

.anim-delay-1 { animation-delay: 0.1s; }
.anim-delay-2 { animation-delay: 0.2s; }
.anim-delay-3 { animation-delay: 0.3s; }

/* Shimmer loading effect */
.shimmer {
    background: linear-gradient(90deg,
        var(--surface-raised) 25%,
        var(--surface-overlay) 50%,
        var(--surface-raised) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}


/* ================================================================
   MODAL
   ================================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fade-in 0.15s ease;
}

.modal-container {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 32rem;
    max-height: 90vh;
    overflow-y: auto;
    animation: fade-up 0.2s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--surface-border);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--surface-border);
}

/* Confirmation modal variant */
.confirmation-modal .modal-body {
    text-align: center;
    padding: 2rem 1.5rem;
}

.confirmation-modal .modal-footer {
    justify-content: center;
}


/* ================================================================
   SCREEN READER ONLY
   ================================================================ */
/* ================================================================
   REWARD CONFIG
   ================================================================ */

/* Rate cards */
.rw-rate-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    background: var(--surface-raised);
}
.rw-rate-label { font-size: 0.8125rem; color: var(--text-secondary); white-space: nowrap; }
.rw-rate-field {
    flex: 1;
    padding: 0.25rem 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    background: transparent;
    color: var(--text-primary);
    outline: none;
    min-width: 0;
}
.rw-rate-unit { font-size: 0.8125rem; font-weight: 600; color: #f59e0b; white-space: nowrap; }

/* Action cards — 2 col grid */
.rw-action-card {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.rw-action-card:hover { border-color: var(--surface-border-strong); background: rgba(255,255,255,0.015); }
html:not(.dark) .rw-action-card:hover { background: #f9fafb; }
.rw-action-card:has(input:checked) { border-color: rgba(245,158,11,0.3); background: rgba(245,158,11,0.03); }
.rw-action-card input[type="checkbox"] { width: 1.125rem; height: 1.125rem; flex-shrink: 0; cursor: pointer; accent-color: #f59e0b; }
.rw-action-info { flex: 1; min-width: 0; }
.rw-action-name { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.rw-action-per { display: block; font-size: 0.6875rem; color: var(--text-secondary); margin-top: 0.125rem; }
.rw-action-value { display: flex; align-items: center; gap: 0.375rem; flex-shrink: 0; }
.rw-action-input {
    width: 3rem;
    padding: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    text-align: center;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-primary);
    box-sizing: border-box;
}
.rw-action-input:focus { outline: none; border-color: var(--accent); }
.rw-action-usd { font-size: 0.75rem; color: var(--text-secondary); white-space: nowrap; }
.rw-override {
    padding: 0.125rem 0.25rem;
    font-size: 0.625rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--surface-border);
    background: var(--surface);
    color: var(--text-secondary);
    font-family: inherit;
    cursor: pointer;
    flex-shrink: 0;
}
.rw-override:focus { outline: none; border-color: var(--accent); }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}
/* Prevent scroll-to-input when clicking labels with sr-only inputs */
.theme-picker { position: relative; }
.theme-picker > .sr-only { position: absolute; top: 0; left: 0; }

/* ================================================================
   THEME PICKER
   ================================================================ */

.theme-picker {
    cursor: pointer;
    text-align: center;
    flex: 1;
    min-width: 0;
}
.theme-picker-swatch {
    position: relative;
    height: 3rem;
    border-radius: 0.5rem;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 0.375rem;
}
.theme-picker-dots {
    display: flex;
    gap: 0.2rem;
}
.theme-picker-dots span {
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 50%;
}
.theme-picker-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}
.theme-picker input:checked ~ .theme-picker-swatch {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99,102,241,0.3);
}
.theme-picker input:checked ~ .theme-picker-swatch::after {
    content: '';
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 0.875rem;
    height: 0.875rem;
    border-radius: 50%;
    background: var(--accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='white'%3E%3Cpath fill-rule='evenodd' d='M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-size: 0.5rem;
    background-repeat: no-repeat;
    background-position: center;
}
.theme-picker input:checked ~ .theme-picker-label {
    color: var(--accent);
    font-weight: 600;
}
.theme-picker:hover .theme-picker-swatch {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* ================================================================
   HERO SECTION
   ================================================================ */

.hero-section {
    background: linear-gradient(135deg, var(--brand-50) 0%, var(--surface) 50%, rgba(34,197,94,0.05) 100%);
}

html.dark .hero-section,
:root .hero-section {
    background: linear-gradient(135deg, rgba(99,102,241,0.08) 0%, var(--app-bg) 50%, rgba(34,197,94,0.04) 100%);
}

html:not(.dark) .hero-section {
    background: linear-gradient(135deg, var(--brand-50) 0%, #fff 50%, #f0fdf4 100%);
}


/* ================================================================
   BACKWARD-COMPATIBLE UTILITY CLASSES
   All existing Tailwind-like utilities kept and updated for dark mode
   ================================================================ */

/* --- Layout --- */
.max-w-7xl { max-width: 80rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-lg { max-width: 32rem; }
.max-w-md { max-width: 28rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.min-h-screen { min-height: 100vh; }
.flex { display: flex; }
.grid { display: grid; }
.hidden { display: none; }
.inline { display: inline; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.w-full { width: 100%; }
.overflow-x-auto { overflow-x: auto; }
.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.absolute { position: absolute; }

/* --- Responsive grid --- */
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }

@media (min-width: 640px) {
    .sm\:flex-row { flex-direction: row; }
    .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
}

@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
    .md\:flex { display: flex; }
    .md\:hidden { display: none; }
    .hidden.md\:flex { display: flex; }
    .md\:text-6xl { font-size: 3.75rem; }
}

@media (min-width: 1024px) {
    .lg\:px-8 { padding-left: 2rem; padding-right: 2rem; }
}

/* --- Spacing --- */
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.p-12 { padding: 3rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.py-20 { padding-top: 5rem; padding-bottom: 5rem; }
.py-24 { padding-top: 6rem; padding-bottom: 6rem; }
.pt-4 { padding-top: 1rem; }
.pt-6 { padding-top: 1.5rem; }
.pb-4 { padding-bottom: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-10 { margin-bottom: 2.5rem; }
.mb-12 { margin-bottom: 3rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-auto { margin-top: auto; }
.ml-2 { margin-left: 0.5rem; }
.ml-4 { margin-left: 1rem; }
.mr-2 { margin-right: 0.5rem; }

/* --- Colors & Backgrounds (dark-mode aware) --- */
.bg-white { background: var(--surface); }
.bg-gray-50 { background: var(--surface-muted); }
.bg-gray-100 { background: var(--surface-raised); }
.bg-brand-50 { background: rgba(99,102,241,0.08); }
.bg-green-50 { background: rgba(34,197,94,0.08); }
.bg-red-50 { background: rgba(239,68,68,0.08); }
.bg-amber-50 { background: rgba(245,158,11,0.08); }
.bg-blue-50 { background: rgba(99,102,241,0.06); }
.bg-green-100 { background: rgba(34,197,94,0.15); }
.bg-amber-100 { background: rgba(245,158,11,0.15); }

html:not(.dark) .bg-white { background: #fff; }
html:not(.dark) .bg-gray-50 { background: #f9fafb; }
html:not(.dark) .bg-gray-100 { background: #f3f4f6; }
html:not(.dark) .bg-brand-50 { background: #f0f4ff; }
html:not(.dark) .bg-green-50 { background: #f0fdf4; }
html:not(.dark) .bg-red-50 { background: #fef2f2; }
html:not(.dark) .bg-amber-50 { background: #fffbeb; }
html:not(.dark) .bg-blue-50 { background: #eff6ff; }
html:not(.dark) .bg-green-100 { background: #dcfce7; }
html:not(.dark) .bg-amber-100 { background: #fef3c7; }

/* --- Text colors (dark-mode aware) --- */
.text-gray-200 { color: rgba(255,255,255,0.15); }
.text-gray-400 { color: var(--text-muted); }
.text-gray-500 { color: var(--text-secondary); }
.text-gray-600 { color: var(--text-secondary); }
.text-gray-700 { color: var(--text-primary); }
.text-gray-900 { color: var(--text-primary); }
.text-green-500 { color: #4ade80; }
.text-green-600 { color: #22c55e; }
.text-green-800 { color: #4ade80; }
.text-red-500 { color: #f87171; }
.text-red-600 { color: #ef4444; }
.text-red-800 { color: #f87171; }
.text-amber-600 { color: #fbbf24; }
.text-amber-800 { color: #fbbf24; }
.text-blue-800 { color: #818cf8; }
.text-white { color: #fff; }

html:not(.dark) .text-gray-200 { color: #e5e7eb; }
html:not(.dark) .text-gray-400 { color: #9ca3af; }
html:not(.dark) .text-gray-500 { color: #6b7280; }
html:not(.dark) .text-gray-600 { color: #4b5563; }
html:not(.dark) .text-gray-700 { color: #374151; }
html:not(.dark) .text-gray-900 { color: #111827; }
html:not(.dark) .text-green-500 { color: #22c55e; }
html:not(.dark) .text-green-600 { color: #16a34a; }
html:not(.dark) .text-green-800 { color: #166534; }
html:not(.dark) .text-red-500 { color: #ef4444; }
html:not(.dark) .text-red-600 { color: #dc2626; }
html:not(.dark) .text-red-800 { color: #991b1b; }
html:not(.dark) .text-amber-600 { color: #d97706; }
html:not(.dark) .text-amber-800 { color: #92400e; }
html:not(.dark) .text-blue-800 { color: #1e40af; }

/* --- New semantic color utilities --- */
.text-app-text { color: var(--text-primary); }
.text-app-muted { color: var(--text-secondary); }
.text-app-secondary { color: var(--text-muted); }
.bg-app { background: var(--app-bg); }
.bg-app-surface { background: var(--surface); }
.text-accent { color: var(--accent); }
.border-app-border { border-color: var(--surface-border); }

/* Theme toggle icon visibility */
.dark-icon { display: none; }
.light-icon { display: block; }
html.dark .dark-icon { display: block; }
html.dark .light-icon { display: none; }

/* Gradient utilities */
.from-indigo-500 { --tw-gradient-from: #6366f1; }
.to-purple-600 { --tw-gradient-to: #9333ea; }
.bg-gradient-to-br {
  background-image: linear-gradient(to bottom right, var(--tw-gradient-from, #6366f1), var(--tw-gradient-to, #9333ea));
}

/* Accent opacity utilities */
.bg-accent\/5 { background: rgba(79, 110, 247, 0.05); }
.bg-accent\/10 { background: rgba(79, 110, 247, 0.1); }
.border-accent\/30 { border-color: rgba(79, 110, 247, 0.3); }
.ring-accent { --tw-ring-color: var(--accent); }
.text-app-muted\/30 { color: rgba(90, 111, 140, 0.3); }
.border-current\/10 { border-color: var(--surface-border); }

/* --- Sizing --- */
.w-5 { width: 1.25rem; } .h-5 { height: 1.25rem; }
.w-6 { width: 1.5rem; } .h-6 { height: 1.5rem; }
.w-8 { width: 2rem; } .h-8 { height: 2rem; }
.w-10 { width: 2.5rem; } .h-10 { height: 2.5rem; }
.w-12 { width: 3rem; } .h-12 { height: 3rem; }
.w-16 { width: 4rem; } .h-16 { height: 4rem; }
.w-32 { width: 8rem; }
.max-h-96 { max-height: 24rem; }

/* --- Text --- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }
.text-5xl { font-size: 3rem; }
.text-6xl { font-size: 3.75rem; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.antialiased { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }
.tracking-wide { letter-spacing: 0.025em; }
.leading-tight { line-height: 1.25; }
.leading-relaxed { line-height: 1.75; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-nowrap { white-space: nowrap; }
pre { white-space: pre-wrap; word-break: break-all; }

/* --- Borders (dark-mode aware) --- */
.border { border: 1px solid var(--surface-border); }
.border-b { border-bottom: 1px solid var(--surface-border); }
.border-t { border-top: 1px solid var(--surface-border); }
.border-l { border-left: 1px solid var(--surface-border); }
.border-r { border-right: 1px solid var(--surface-border); }
.border-gray-100 { border-color: var(--surface-border); }
.border-gray-200 { border-color: var(--surface-border); }
.border-gray-300 { border-color: var(--surface-border-strong); }
.border-green-200 { border-color: rgba(34,197,94,0.25); }
.border-red-200 { border-color: rgba(239,68,68,0.25); }
.border-amber-200 { border-color: rgba(245,158,11,0.25); }
.border-blue-200 { border-color: rgba(99,102,241,0.25); }
.border-brand-200 { border-color: rgba(99,102,241,0.2); }

html:not(.dark) .border-gray-100 { border-color: #e5e7eb; }
html:not(.dark) .border-gray-200 { border-color: #d5dae3; }
html:not(.dark) .border-gray-300 { border-color: #bfc5d1; }
html:not(.dark) .border-green-200 { border-color: #bbf7d0; }
html:not(.dark) .border-red-200 { border-color: #fecaca; }
html:not(.dark) .border-amber-200 { border-color: #fde68a; }
html:not(.dark) .border-blue-200 { border-color: #bfdbfe; }
html:not(.dark) .border-brand-200 { border-color: var(--brand-100); }

.rounded { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: 9999px; }
.rounded-l-none { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.rounded-r-none { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.border-r-0 { border-right: 0; }
.divide-y > * + * { border-top: 1px solid var(--surface-border); }
.divide-gray-50 > * + * { border-color: var(--surface-border); }

/* --- Effects --- */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.transition { transition: all 0.15s ease; }
.transition-colors { transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }
.sticky { position: sticky; }
.top-0 { top: 0; }
.inset-0 { inset: 0; }
.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-60 { opacity: 0.6; }
.opacity-75 { opacity: 0.75; }
.cursor-pointer { cursor: pointer; }
.pointer-events-none { pointer-events: none; }
.select-none { user-select: none; }

/* --- Hover utilities --- */
.hover\:underline:hover { text-decoration: underline; }
.hover\:text-gray-600:hover { color: var(--text-primary); }
.hover\:text-brand-600:hover { color: var(--brand-600); }
.hover\:text-amber-700:hover { color: var(--accent-amber); }
.hover\:text-red-500:hover { color: var(--accent-red); }
.hover\:opacity-100:hover { opacity: 1; }
.hover\:bg-gray-50:hover { background: var(--surface-raised); }
.hover\:text-app-text:hover { color: var(--text-primary); }
.hover\:bg-white\/10:hover { background: rgba(255,255,255,0.1); }

/* --- Missing utilities --- */
.shrink-0 { flex-shrink: 0; }
.grow { flex-grow: 1; }
.ring-2 { box-shadow: 0 0 0 2px var(--tw-ring-color, var(--accent)); }
.ring-accent { --tw-ring-color: var(--accent); }
.w-7 { width: 1.75rem; } .h-7 { height: 1.75rem; }
.w-9 { width: 2.25rem; } .h-9 { height: 2.25rem; }
.w-4 { width: 1rem; } .h-4 { height: 1rem; }
.w-3\.5 { width: 0.875rem; } .h-3\.5 { height: 0.875rem; }
.p-1\.5 { padding: 0.375rem; }
.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-3 { gap: 0.75rem; }
.gap-10 { gap: 2.5rem; }
.min-w-0 { min-width: 0; }
.max-w-sm { max-width: 24rem; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.tracking-tight { letter-spacing: -0.025em; }
.leading-snug { line-height: 1.375; }
.text-green-700 { color: #15803d; }
html.dark .text-green-700 { color: #4ade80; }
.text-blue-600 { color: #2563eb; }
html.dark .text-blue-600 { color: #818cf8; }
.border-gray-300 { border-color: var(--surface-border-strong); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }

@media (min-width: 640px) {
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .sm\:flex-row { flex-direction: row; }
    .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
}
@media (min-width: 1024px) {
    .lg\:px-8 { padding-left: 2rem; padding-right: 2rem; }
}

/* --- Focus utilities --- */
.focus\:ring-accent:focus { box-shadow: 0 0 0 3px rgba(99,102,241,0.3); }
