/* 
 * Data Vault - Nature-Centric Minimalist Design System
 * Emphasizing focus, wellbeing, and organic aesthetics
 */

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

:root {
    /* Earth Tone Color Palette */
    --earth-dark: #2A3A2E;           /* Primary background - deep forest green */
    --earth-medium: #3D5240;         /* Secondary background */
    --earth-light: #4F6B53;          /* Accents */
    --earth-moss: #6B8E6F;           /* Hover states */
    
    --beige-card: #E5E5E5;           /* Card backgrounds */
    --beige-light: #F5F5F0;          /* Lighter card elements */
    --beige-warm: #EAE7DC;           /* Warm beige for highlights */
    --cream: #FFFEF7;                /* Near-white cream */
    
    --text-white: #FFFFFF;           /* Large headings */
    --text-dark: #2A3A2E;            /* Text on light backgrounds */
    --text-muted: #6B7566;           /* Muted text */
    
    --accent-terracotta: #C97D60;    /* Warm accent */
    --accent-sage: #A4B494;          /* Sage green accent */
    
    /* Shadows - Soft and organic */
    --shadow-sm: 0 2px 8px rgba(42, 58, 46, 0.08);
    --shadow-md: 0 4px 16px rgba(42, 58, 46, 0.12);
    --shadow-lg: 0 8px 32px rgba(42, 58, 46, 0.16);
    --shadow-xl: 0 12px 48px rgba(42, 58, 46, 0.20);
    
    /* Typography */
    --font-primary: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Space Grotesk', 'SF Pro Display', sans-serif;
    
    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-2xl: 4rem;
    
    /* Border Radius - Organic curves */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-full: 9999px;

    /* ─── Unified UI system (2026 redesign) ─── */
    /* Surfaces — layered on the earth-dark page background */
    --surface-page: #2A3A2E;          /* page background (= earth-dark) */
    --surface-1: #33473B;             /* raised card / row */
    --surface-2: #3D5240;             /* nested / hover (= earth-medium) */
    --border-hair: rgba(255,255,255,0.08);
    --border-soft: rgba(255,255,255,0.12);

    /* Single CTA accent (terracotta) + functional colors */
    --c-primary: #C97D60;             /* the one primary CTA color */
    --c-primary-hover: #B36D50;
    --c-primary-tint: rgba(201,125,96,0.14);
    --c-credit: #74B58C;              /* positive / credit / success */
    --c-debit: #D58A86;              /* negative / debit (rose, distinct from CTA) */
    --c-pending: #D7B36B;             /* pending / budget-lock amber */
    --c-info: #8FAAC6;               /* neutral info */

    /* Text on dark surfaces */
    --text-strong: #F4F2EA;           /* primary text */
    --text-soft: #B6BEAC;            /* secondary text */
    --text-faint: #8A9384;           /* captions / table headers */
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background: var(--earth-dark);
    color: var(--text-white);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Add subtle texture to background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h60v60H0z' fill='%232A3A2E'/%3E%3Cpath d='M30 30m-2 0a2 2 0 1 0 4 0 2 2 0 1 0-4 0' fill='%233D5240' fill-opacity='0.3'/%3E%3C/svg%3E");
    opacity: 0.12;
    z-index: -1;
    pointer-events: none;
}

/* Typography System */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-white);
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    font-family: var(--font-display);
}

h2 {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    font-family: var(--font-display);
}

h3 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 600;
}

h4 {
    font-size: clamp(1.25rem, 2.5vw, 1.5rem);
    font-weight: 600;
}

p {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--beige-light);
}

/* Header Navigation */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--earth-dark);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.logo {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-white);
    font-family: var(--font-display);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.nav-link {
    color: var(--beige-light);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
    font-size: 0.95rem;
}

.nav-link:hover {
    color: var(--text-white);
}

.cart-badge {
    position: relative;
    width: 40px;
    height: 40px;
    background: var(--beige-card);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.cart-badge:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.cart-badge i {
    color: var(--text-dark);
    font-size: 1.1rem;
}

.cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent-terracotta);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.menu-icon {
    width: 40px;
    height: 40px;
    background: var(--beige-card);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.menu-icon:hover {
    background: var(--beige-warm);
}

.menu-icon i {
    color: var(--text-dark);
}

/* Hero Section */
.hero {
    width: 100%;
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, rgba(107, 142, 111, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.hero h1 {
    margin-bottom: var(--space-md);
    animation: fadeInUp 0.8s ease-out;
}

.hero .subtitle {
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: var(--beige-light);
    margin-bottom: var(--space-xl);
    line-height: 1.6;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.hero-cta {
    display: inline-flex;
    gap: var(--space-md);
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

/* Buttons */
.btn {
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: var(--beige-card);
    color: var(--text-dark);
}

.btn-primary:hover {
    background: var(--beige-warm);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: transparent;
    color: var(--text-white) !important;
    border: 2px solid var(--beige-card);
}

.btn-secondary:hover {
    background: var(--beige-card);
    color: var(--text-white) !important;
    transform: translateY(-2px);
}

.btn-accent {
    background: var(--accent-terracotta);
    color: white;
}

.btn-accent:hover {
    background: #B36D50;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ══════════════════════════════════════════════════════════════════
   Unified component system (.v-*)  — used by desktop AND mobile
   so both surfaces share one coherent look on the earth palette.
══════════════════════════════════════════════════════════════════ */

/* ── Page chrome ── */
.v-container { max-width: 1120px; margin: 0 auto; padding: 2.5rem 2rem; }
.v-page-head { display: flex; align-items: flex-end; justify-content: space-between;
    flex-wrap: wrap; gap: 1rem; margin-bottom: 2rem; }
.v-page-title { font-size: 1.6rem; font-weight: 700; color: var(--text-strong);
    line-height: 1.2; letter-spacing: -0.01em; display: flex; align-items: center; gap: 0.6rem; }
.v-page-sub { color: var(--text-soft); font-size: 0.9rem; line-height: 1.6; max-width: 620px; margin-top: 0.35rem; }
.v-section-title { font-size: 1.05rem; font-weight: 700; color: var(--text-strong); letter-spacing: -0.005em; }
.v-eyebrow { font-size: 0.7rem; font-weight: 700; color: var(--text-faint);
    text-transform: uppercase; letter-spacing: 0.07em; }
.v-caption { font-size: 0.78rem; color: var(--text-faint); }

/* ── Cards ── */
.v-card { background: var(--surface-1); border: 1px solid var(--border-hair);
    border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.v-card--pad { padding: var(--space-lg); }
.v-card--flush { overflow: hidden; }

/* ── Buttons (one coherent family) ── */
.v-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    min-height: 44px; padding: 0.6rem 1.2rem; border-radius: 12px;
    font-family: inherit; font-size: 0.9rem; font-weight: 600; line-height: 1;
    border: 1px solid transparent; cursor: pointer; text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent; white-space: nowrap; }
.v-btn:active { transform: scale(0.98); }
.v-btn--primary   { background: var(--c-primary); color: #fff; }
.v-btn--primary:hover { background: var(--c-primary-hover); color: #fff; }
.v-btn--secondary { background: transparent; color: var(--text-strong); border-color: var(--border-soft); }
.v-btn--secondary:hover { border-color: rgba(255,255,255,0.28); background: rgba(255,255,255,0.04); }
.v-btn--ghost     { background: rgba(255,255,255,0.05); color: var(--text-soft); border-color: var(--border-hair); }
.v-btn--ghost:hover { background: rgba(255,255,255,0.09); color: var(--text-strong); }
.v-btn--block { width: 100%; }
.v-btn--sm { min-height: 36px; padding: 0.4rem 0.85rem; font-size: 0.82rem; border-radius: 10px; }
.v-btn:disabled { opacity: 0.4; cursor: default; transform: none; }

/* ── Inputs ── */
.v-input, .v-select, .v-textarea {
    width: 100%; box-sizing: border-box;
    background: rgba(255,255,255,0.05); border: 1px solid var(--border-soft);
    border-radius: 10px; color: var(--text-strong);
    font-family: inherit; font-size: 0.9rem; padding: 0.6rem 0.85rem;
    outline: none; transition: border-color 0.15s ease, background 0.15s ease; }
.v-input::placeholder, .v-textarea::placeholder { color: var(--text-faint); }
.v-input:focus, .v-select:focus, .v-textarea:focus {
    border-color: var(--c-primary); background: rgba(255,255,255,0.07); }
.v-select { appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238A9384' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.85rem center; padding-right: 2rem; }
.v-textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.v-input--sm { padding: 0.45rem 0.8rem; font-size: 0.84rem; border-radius: 9px; }
.v-input--sm.v-select { padding-right: 1.9rem; }
.v-field-label { display: block; font-size: 0.78rem; font-weight: 600;
    color: var(--text-soft); margin-bottom: 0.4rem; }

/* ── Table ── */
.v-table { width: 100%; border-collapse: collapse; }
.v-table th { text-align: left; padding: 0.7rem 1rem; font-size: 0.72rem; font-weight: 700;
    color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border-hair); background: rgba(255,255,255,0.02); }
.v-table td { padding: 0.75rem 1rem; font-size: 0.84rem; color: var(--text-strong);
    border-bottom: 1px solid var(--border-hair); }
.v-table tbody tr:last-child td { border-bottom: none; }
.v-table tbody tr { transition: background 0.1s ease; }
.v-table tbody tr:hover { background: rgba(255,255,255,0.03); }

/* ── Badges & chips ── */
.v-badge { display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.2rem 0.6rem; border-radius: 7px; font-size: 0.7rem; font-weight: 600; white-space: nowrap; }
.v-chip { display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.4rem 0.85rem; border-radius: 999px; border: 1px solid var(--border-soft);
    background: rgba(255,255,255,0.04); color: var(--text-soft);
    font-family: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer;
    transition: all 0.15s ease; -webkit-tap-highlight-color: transparent; }
.v-chip:hover { color: var(--text-strong); }
.v-chip.active { background: var(--c-primary-tint); border-color: rgba(201,125,96,0.45); color: #E0A98F; }

/* ── List row (mobile/compact lists) ── */
.v-row { display: flex; align-items: flex-start; gap: 0.7rem;
    background: var(--surface-1); border: 1px solid var(--border-hair);
    border-radius: 12px; padding: 0.8rem 0.95rem; }

/* ── Status dot ── */
.v-status { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.76rem; }
.v-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Money ── */
.v-amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.v-amt--credit { color: var(--c-credit); }
.v-amt--debit  { color: var(--c-debit); }
.v-amt--locked { color: var(--c-pending); }

/* Cards - Beige with Sketch Aesthetic */
.card {
    background: var(--beige-card);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--earth-moss), var(--accent-sage));
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.card:hover::before {
    opacity: 1;
}

.card-content {
    color: var(--text-dark);
}

.card h3 {
    color: var(--text-dark);
    margin-bottom: var(--space-md);
}

.card p {
    color: var(--text-muted);
    line-height: 1.7;
}

/* Sketch Illustration Style */
.sketch-icon {
    width: 64px;
    height: 64px;
    margin-bottom: var(--space-md);
    filter: grayscale(20%) contrast(1.1);
    opacity: 0.9;
}

/* Grid Layouts */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-lg);
}

.grid {
    display: grid;
    gap: var(--space-lg);
    margin: var(--space-xl) 0;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* Forms */
.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    color: var(--beige-light);
    font-weight: 600;
    margin-bottom: var(--space-xs);
    font-size: 0.95rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-md);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    color: var(--text-white);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-sage);
    box-shadow: 0 0 0 3px rgba(164, 180, 148, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* Tables */
.table-container {
    background: var(--beige-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

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

.table th {
    background: var(--earth-medium);
    color: var(--text-white);
    padding: var(--space-md);
    text-align: left;
    font-weight: 600;
}

.table td {
    padding: var(--space-md);
    border-bottom: 1px solid rgba(42, 58, 46, 0.1);
    color: var(--text-dark);
}

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

.table tr:hover {
    background: rgba(42, 58, 46, 0.03);
}

/* Status Messages */
.status-message {
    padding: var(--space-md);
    margin: var(--space-md) 0;
    border-radius: var(--radius-md);
    font-weight: 500;
    display: none;
}

.status-message.info {
    background: rgba(143, 170, 198, 0.15);
    color: var(--c-info);
    border: 1px solid rgba(143, 170, 198, 0.3);
}

.status-message.success {
    background: rgba(116, 181, 140, 0.15);
    color: var(--c-credit);
    border: 1px solid rgba(116, 181, 140, 0.3);
}

.status-message.error {
    background: rgba(213, 138, 134, 0.15);
    color: var(--c-debit);
    border: 1px solid rgba(213, 138, 134, 0.3);
}

.status-message.warning {
    background: rgba(215, 179, 107, 0.15);
    color: var(--c-pending);
    border: 1px solid rgba(215, 179, 107, 0.3);
}

/* Animations */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    gap: 0.5rem;
}

.badge-success {
    background: rgba(107, 142, 111, 0.2);
    color: var(--earth-moss);
}

.badge-warning {
    background: rgba(201, 125, 96, 0.2);
    color: var(--accent-terracotta);
}

.badge-info {
    background: rgba(164, 180, 148, 0.2);
    color: var(--accent-sage);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

/* Focus & Wellbeing Aesthetic */
.focus-section {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
}

.focus-section h2 {
    margin-bottom: var(--space-md);
}

.focus-section .tagline {
    font-size: 1.25rem;
    color: var(--beige-light);
    font-style: italic;
    font-family: var(--font-display);
    margin-bottom: var(--space-xl);
}

/* Responsive Design */
@media (max-width: 900px) {
    .header-container {
        padding: var(--space-sm) var(--space-md);
    }
    .header-nav {
        gap: var(--space-sm);
        position: relative;
    }
    .nav-link {
        display: none;
    }
    .menu-icon {
        display: flex;
    }
    #dropdown-menu {
        right: 0.5rem;
        left: auto;
        min-width: 180px;
    }
}

/* Desktop — show desktop title, hide mobile title */
.logo-text-mobile { display: none; }
.logo-text-desktop { display: inline; }

/* On mobile — show a thin header: brand on the left, compact logout on the right */
@media (max-width: 768px) {
    #mkt-balance-chip          { display: none !important; }
    .header-nav .nav-link      { display: none !important; }
    .logo-container            { display: flex !important; gap: 0.5rem !important; }
    .logo                      { width: 28px !important; height: 28px !important; box-shadow: none !important; }
    .logo-text-desktop         { display: inline !important; font-size: 0.95rem !important; }
    .logo-text-mobile          { display: none !important; }
    .header-container {
        padding: 0.45rem 0.9rem !important;
        min-height: 48px;
        justify-content: space-between !important;
    }
    .header { border-bottom: 1px solid rgba(255,255,255,0.08); }
    /* compact logout shown on mobile */
    .header-nav .btn-secondary {
        display: inline-flex !important;
        padding: 0.32rem 0.7rem !important;
        font-size: 0.78rem !important;
        margin-left: 0 !important;
        border-width: 1px !important;
        box-shadow: none !important;
    }
    /* full-screen mobile views start below the 48px header */
    .mobile-wizard { height: calc(100dvh - 48px) !important; }
}

@media (min-width: 901px) {
    .menu-icon {
        display: none !important;
    }
    #dropdown-menu {
        display: none !important;
    }
    .nav-link {
        display: flex !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ══════════════════════════════════════════════════════════════════
   Mobile wizard primitives  (≤ 768px)
   Applied to query_builder.html, private_data_source_builder.html,
   and organization.html via .mobile-wizard wrappers.
   Desktop layout (.desktop-only) is hidden at this breakpoint.
══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── Dual-mode layout toggle ── */
    .desktop-only  { display: none !important; }
    .mobile-wizard { display: flex !important; flex-direction: column;
        height: 100dvh; /* header hidden on mobile */
        overflow: hidden; }
    /* Campaigns page is a scrollable list, not a step wizard */
    #mob-campaigns-root { overflow-y: auto !important; overflow-x: hidden; }

    /* ── Progress bar ── */
    .wiz-progress { height: 3px; background: rgba(255,255,255,0.07); flex-shrink: 0; }
    .wiz-fill     { height: 100%; background: var(--c-primary);
        transition: width 0.4s cubic-bezier(.4,0,.2,1); border-radius: 0 2px 2px 0; }

    /* ── Top chrome (step label + close) ── */
    .wiz-chrome { flex-shrink: 0; display: flex; align-items: center;
        justify-content: space-between; padding: 0.9rem 1.25rem 0.5rem; }
    .wiz-step-label { font-size: 0.7rem; font-weight: 600; color: var(--text-faint);
        letter-spacing: 0.07em; text-transform: uppercase; }
    .wiz-close-btn { width: 30px; height: 30px; border-radius: 50%;
        background: rgba(255,255,255,0.06); border: none; color: var(--text-faint);
        font-size: 0.9rem; cursor: pointer; display: flex;
        align-items: center; justify-content: center; }

    /* ── Steps track ── */
    .wiz-track { flex: 1; position: relative; overflow: hidden; }
    .wiz-step  {
        position: absolute; inset: 0; overflow-y: auto;
        padding: 1.4rem 1.4rem 0;
        transform: translateX(100%); opacity: 0;
        transition: transform 0.38s cubic-bezier(.4,0,.2,1), opacity 0.28s;
        pointer-events: none;
    }
    .wiz-step.active { transform: translateX(0);     opacity: 1; pointer-events: all; z-index: 2; }
    .wiz-step.past   { transform: translateX(-100%); opacity: 0; z-index: 1; }

    /* ── Step typography ── */
    .wiz-q    { font-size: 1.0rem; font-weight: 700; line-height: 1.25; margin-bottom: 0.4rem; }
    .wiz-hint { font-size: 0.82rem; color: var(--text-faint); line-height: 1.5; margin-bottom: 1.5rem; }

    /* ── Option cards (tap-to-select) ── */
    .wiz-opt-card {
        padding: 0.95rem 1.1rem; border-radius: 14px;
        border: 2px solid rgba(255,255,255,0.08);
        background: var(--surface-1); cursor: pointer;
        display: flex; align-items: center; gap: 0.9rem;
        margin-bottom: 0.7rem;
        transition: border-color 0.15s, background 0.15s, transform 0.1s;
        -webkit-tap-highlight-color: transparent;
    }
    .wiz-opt-card:active   { transform: scale(0.98); }
    .wiz-opt-card.selected { border-color: var(--c-primary); background: rgba(201,125,96,0.12); }
    .wiz-opt-icon  { font-size: 1.5rem; flex-shrink: 0; }
    .wiz-opt-title { font-size: 0.92rem; font-weight: 600; margin-bottom: 0.12rem; }
    .wiz-opt-desc  { font-size: 0.74rem; color: var(--text-faint); line-height: 1.4; }
    .wiz-opt-check { margin-left: auto; width: 20px; height: 20px; border-radius: 50%;
        border: 2px solid rgba(255,255,255,0.15); flex-shrink: 0;
        display: flex; align-items: center; justify-content: center;
        font-size: 0.7rem; transition: all 0.15s; }
    .wiz-opt-card.selected .wiz-opt-check { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }

    /* ── Chip grid ── */
    .wiz-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
    .wiz-chip  { padding: 0.5rem 0.9rem; border-radius: 999px;
        border: 1.5px solid rgba(255,255,255,0.08);
        font-size: 0.8rem; font-weight: 500; cursor: pointer;
        background: var(--surface-1); color: var(--text-soft);
        transition: all 0.12s; -webkit-tap-highlight-color: transparent; }
    .wiz-chip:active   { transform: scale(0.96); }
    .wiz-chip.selected { background: rgba(201,125,96,0.14);
        border-color: rgba(201,125,96,0.5); color: #E0A98F; }

    /* ── Large text inputs ── */
    .wiz-input, .wiz-textarea, .wiz-select {
        width: 100%; background: var(--surface-1);
        border: 2px solid rgba(255,255,255,0.08);
        border-radius: 14px; color: var(--text-strong);
        font-size: 1rem; padding: 0.9rem 1rem;
        outline: none; font-family: inherit;
        transition: border-color 0.15s;
    }
    .wiz-input:focus, .wiz-textarea:focus, .wiz-select:focus { border-color: var(--c-primary); }
    .wiz-textarea { min-height: 130px; resize: none; line-height: 1.6; }
    .wiz-select   { appearance: none; cursor: pointer; }
    .wiz-label    { display: block; font-size: 0.78rem; font-weight: 600;
        color: var(--text-soft); margin-bottom: 0.4rem; margin-top: 0.9rem; }
    .wiz-label:first-child { margin-top: 0; }
    .wiz-char-count { text-align: right; font-size: 0.7rem; color: var(--text-faint); margin-top: 0.3rem; }

    /* ── Amount stepper ── */
    .wiz-amount-display { text-align: center; padding: 1.5rem 0 1rem; }
    .wiz-amount-val { font-size: 3.2rem; font-weight: 800; color: var(--c-credit);
        font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
    .wiz-amount-cur { font-size: 1.3rem; font-weight: 600; color: var(--text-faint); vertical-align: super; }
    .wiz-amount-sub { font-size: 0.78rem; color: var(--text-faint); margin-top: 0.2rem; }
    .wiz-stepper    { display: flex; align-items: center; justify-content: center; gap: 1rem; }
    .wiz-step-btn   { width: 52px; height: 52px; border-radius: 50%;
        border: 2px solid rgba(255,255,255,0.08);
        background: var(--surface-1); color: var(--text-strong);
        font-size: 1.4rem; cursor: pointer;
        transition: background 0.12s, border-color 0.12s; }
    .wiz-step-btn:active { background: rgba(201,125,96,0.15); border-color: var(--c-primary); }
    .wiz-presets { display: flex; gap: 0.45rem; justify-content: center;
        flex-wrap: wrap; margin-top: 1.1rem; }
    .wiz-preset { padding: 0.4rem 0.85rem; border-radius: 999px;
        border: 1.5px solid rgba(255,255,255,0.08);
        font-size: 0.8rem; font-weight: 600; cursor: pointer;
        background: var(--surface-1); color: var(--text-soft);
        transition: all 0.12s; }
    .wiz-preset:active { background: rgba(201,125,96,0.14); border-color: var(--c-primary); color: #E0A98F; }

    /* ── Toggle row ── */
    .wiz-toggle-row { display: flex; align-items: center; justify-content: space-between;
        padding: 0.9rem 1.1rem; background: var(--surface-1);
        border-radius: 14px; border: 1.5px solid rgba(255,255,255,0.08);
        margin-bottom: 0.65rem; }
    .wiz-toggle-label { font-size: 0.88rem; font-weight: 600; }
    .wiz-toggle-sub   { font-size: 0.73rem; color: var(--text-faint); margin-top: 0.1rem; }
    .wiz-toggle { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
    .wiz-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
    .wiz-toggle-track { position: absolute; inset: 0; border-radius: 999px;
        background: rgba(255,255,255,0.1); cursor: pointer; transition: background 0.2s; }
    .wiz-toggle input:checked ~ .wiz-toggle-track { background: var(--c-primary); }
    .wiz-toggle-thumb { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
        background: #fff; border-radius: 50%; transition: transform 0.2s; pointer-events: none; }
    .wiz-toggle input:checked ~ .wiz-toggle-track .wiz-toggle-thumb { transform: translateX(18px); }

    /* ── Tag builder (data fields) ── */
    .wiz-tag-row  { display: flex; gap: 0.5rem; margin-bottom: 0.65rem; }
    .wiz-tag-input { flex: 1; background: var(--surface-1);
        border: 2px solid rgba(255,255,255,0.08); border-radius: 12px;
        color: var(--text-strong); font-size: 0.95rem; padding: 0.75rem 0.9rem;
        outline: none; font-family: inherit; transition: border-color 0.15s; }
    .wiz-tag-input:focus { border-color: var(--c-primary); }
    .wiz-tag-add  { width: 46px; height: 46px; border-radius: 12px;
        background: var(--c-primary); border: none; color: #fff;
        font-size: 1.2rem; cursor: pointer; flex-shrink: 0;
        display: flex; align-items: center; justify-content: center; }
    .wiz-tags     { display: flex; flex-wrap: wrap; gap: 0.45rem; }
    .wiz-tag      { display: inline-flex; align-items: center; gap: 0.35rem;
        padding: 0.35rem 0.7rem; border-radius: 999px;
        background: rgba(201,125,96,0.12);
        border: 1px solid rgba(201,125,96,0.3);
        font-size: 0.78rem; font-weight: 500; color: #E0A98F; }
    .wiz-tag-x    { cursor: pointer; color: var(--text-faint); font-size: 0.72rem; }

    /* ── Review summary card ── */
    .wiz-review-card { background: var(--surface-1);
        border: 1.5px solid rgba(255,255,255,0.08); border-radius: 14px;
        overflow: hidden; margin-bottom: 0.75rem; }
    .wiz-review-row  { display: flex; align-items: flex-start; justify-content: space-between;
        padding: 0.8rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.06); gap: 0.75rem; }
    .wiz-review-row:last-child { border-bottom: none; }
    .wiz-review-key  { font-size: 0.7rem; color: var(--text-faint); font-weight: 600;
        text-transform: uppercase; letter-spacing: 0.05em; flex-shrink: 0; padding-top: 0.05rem; }
    .wiz-review-val  { font-size: 0.86rem; font-weight: 500; text-align: right; flex: 1; }
    .wiz-review-edit { font-size: 0.72rem; color: var(--c-primary); cursor: pointer; flex-shrink: 0; }
    .wiz-review-green { color: var(--c-credit); font-weight: 800; font-size: 1rem; }

    /* ── Bottom action area ── */
    .wiz-actions { flex-shrink: 0;
        padding: 0.85rem 1.4rem calc(0.85rem + 64px + env(safe-area-inset-bottom));
        background: linear-gradient(to top, var(--earth-dark) 78%, transparent); }
    .wiz-btn  { width: 100%; min-height: 50px; border: none; border-radius: 14px;
        font-size: 0.95rem; font-weight: 700; cursor: pointer;
        background: var(--c-primary); color: #fff;
        display: flex; align-items: center; justify-content: center; gap: 0.4rem;
        transition: opacity 0.15s, transform 0.1s; }
    .wiz-btn:active  { opacity: 0.82; transform: scale(0.98); }
    .wiz-btn.success { background: var(--c-credit); }
    .wiz-back { text-align: center; font-size: 0.8rem; color: var(--text-faint);
        cursor: pointer; margin-top: 0.55rem; padding: 0.3rem; }

    /* ── Bottom sheet ── */
    .wiz-sheet { position: fixed; bottom: 0; left: 0; right: 0; z-index: 300;
        background: var(--surface-1); border-radius: 20px 20px 0 0;
        border-top: 1px solid rgba(255,255,255,0.08);
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(.34,1.2,.64,1);
        max-height: 87vh; display: flex; flex-direction: column;
        padding-bottom: env(safe-area-inset-bottom); }
    .wiz-sheet.open { transform: translateY(0); }
    .wiz-sheet-handle { width: 34px; height: 4px; border-radius: 2px;
        background: rgba(255,255,255,0.12); margin: 0.7rem auto 0; flex-shrink: 0; }
    .wiz-sheet-header { padding: 0.85rem 1.25rem 0.75rem;
        border-bottom: 1px solid rgba(255,255,255,0.07); flex-shrink: 0; }
    .wiz-sheet-title { font-size: 1rem; font-weight: 700; }
    .wiz-sheet-body  { flex: 1; overflow-y: auto; padding: 1.1rem 1.25rem; }
    .wiz-sheet-actions { padding: 0.85rem 1.25rem; border-top: 1px solid rgba(255,255,255,0.07);
        display: flex; flex-direction: column; gap: 0.5rem; flex-shrink: 0; }

    /* ── Backdrop ── */
    .wiz-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.55);
        z-index: 299; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
    .wiz-backdrop.open { opacity: 1; pointer-events: all; }

    /* ── Success screen ── */
    .wiz-success { display: none; flex-direction: column; align-items: center;
        justify-content: center; flex: 1; padding: 2rem; text-align: center; }
    .wiz-success.visible { display: flex; }
    .wiz-success-icon  { font-size: 3.5rem; margin-bottom: 1rem;
        animation: wizPop 0.4s cubic-bezier(.34,1.56,.64,1); }
    @keyframes wizPop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
    .wiz-success-title { font-size: 1.4rem; font-weight: 800; margin-bottom: 0.4rem; }
    .wiz-success-sub   { font-size: 0.85rem; color: var(--text-faint); line-height: 1.5; max-width: 260px; }

    /* ── Info box ── */
    .wiz-info { padding: 0.8rem 1rem; background: rgba(201,125,96,0.06);
        border: 1px solid rgba(201,125,96,0.15); border-radius: 10px;
        font-size: 0.78rem; color: var(--text-soft); line-height: 1.5; margin-top: 1rem; }

    /* ── Question list rows (pds builder step 5) ── */
    .wiz-q-row { display: flex; align-items: center; gap: 0.75rem;
        padding: 0.8rem 0.9rem; background: var(--surface-1);
        border-radius: 12px; border: 1.5px solid rgba(255,255,255,0.07);
        margin-bottom: 0.55rem; }
    .wiz-q-badge { padding: 0.2rem 0.55rem; border-radius: 6px;
        font-size: 0.66rem; font-weight: 700; background: rgba(201,125,96,0.15);
        color: #E0A98F; flex-shrink: 0; }
    .wiz-q-label { flex: 1; font-size: 0.88rem; font-weight: 500;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .wiz-q-del   { color: var(--text-faint); cursor: pointer; font-size: 0.9rem; flex-shrink: 0; }

    /* ── Bottom tab bar ── */
    .mob-tabs { display: grid !important; }
    body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
}

/* Desktop — hide mobile-only elements */
@media (min-width: 769px) {
    .mob-tabs      { display: none !important; }
    .mobile-wizard { display: none !important; }
    .desktop-only  { display: block; }
}

/* ── Bottom-sheet / backdrop: hidden by default on ALL viewports ── */
/* The mobile media query above positions them; .open makes them visible. */
.wiz-sheet   { display: none; }
.wiz-backdrop { display: none; }
.wiz-sheet.open    { display: flex; }
.wiz-backdrop.open { display: block; }

/* On desktop the sheet becomes a centred modal instead of a bottom sheet */
@media (min-width: 769px) {
    .wiz-sheet.open {
        position: fixed;
        top: 50%; left: 50%;
        transform: translate(-50%, -50%) !important;
        bottom: auto; right: auto;
        width: 480px;
        max-width: calc(100vw - 2rem);
        max-height: 85vh;
        border-radius: 16px;
        z-index: 400;
    }
}

/* ── Bottom tab bar base styles (shown only on mobile via above rules) ── */
.mob-tabs {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 998;
    grid-template-columns: repeat(5, 1fr);
    background: #1c2a1e;
    border-top: 1px solid rgba(107,142,111,0.25);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.35);
}
.mob-tab {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 0.18rem;
    padding: 0.5rem 0; text-decoration: none;
    color: #6B8E6F; font-size: 0.58rem; font-weight: 600;
    letter-spacing: 0.02em; text-transform: uppercase;
    transition: color 0.15s; -webkit-tap-highlight-color: transparent;
}
.mob-tab.active {
    color: #A4B494;
}
.mob-tab.active .mob-tab-icon {
    filter: drop-shadow(0 0 6px rgba(164,180,148,0.5));
}
.mob-tab-icon { font-size: 1.1rem; }
