/* ==========================================================================
   SAHKARI — Community Lending Platform
   Editorial-premium design with app-like mobile experience.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

html, body {
    overflow-x: hidden;
}

body {
    font-family: var(--font-family);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 15px;
    transition: background .25s ease, color .25s ease;
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}

/* When installed as PWA */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
    }
}

a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; -webkit-tap-highlight-color: transparent; }
input, select, textarea { font-family: inherit; font-size: 16px; color: inherit; /* 16px prevents iOS zoom */ }

/* -------- Theme Variables -------- */
:root {
    --bg:          var(--color-bg-light);
    --surface:     var(--color-surface-light);
    --surface-alt: #F5F0E8;
    --text:        var(--color-text-light);
    --muted:       var(--color-muted-light);
    --border:      var(--color-border-light);
    --shadow-sm:   0 1px 2px rgba(0,0,0,.04);
    --shadow-md:   0 4px 12px rgba(0,0,0,.06);
    --shadow-lg:   0 12px 32px rgba(0,0,0,.08);
    --radius-sm:   8px;
    --radius-md:   14px;
    --radius-lg:   20px;
    --radius-xl:   28px;
    --space-xs: 6px; --space-sm: 10px; --space-md: 16px; --space-lg: 24px; --space-xl: 40px;
    --nav-width: 260px;
    --header-height: 68px;
    --bottom-nav-height: 64px;
}
[data-theme="dark"] {
    --bg:          var(--color-bg-dark);
    --surface:     var(--color-surface-dark);
    --surface-alt: #232327;
    --text:        var(--color-text-dark);
    --muted:       var(--color-muted-dark);
    --border:      var(--color-border-dark);
    --shadow-sm:   0 1px 2px rgba(0,0,0,.3);
    --shadow-md:   0 4px 12px rgba(0,0,0,.4);
    --shadow-lg:   0 12px 32px rgba(0,0,0,.5);
}

/* -------- Typography -------- */
h1, h2, h3, h4 { font-weight: 500; letter-spacing: -0.02em; line-height: 1.25; }
h1 { font-size: clamp(24px, 4vw, 44px); font-weight: 300; }
h1 em { font-style: normal; font-weight: 500; color: var(--color-primary); }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
.lead { font-size: 17px; color: var(--muted); }
.mono { font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 13px; }
.upper { text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 500; color: var(--muted); }

/* -------- Utility -------- */
.container { max-width: 1400px; margin: 0 auto; padding: 0 24px; }
.row { display: flex; gap: var(--space-md); }
.col { flex: 1; }
.center { display: grid; place-items: center; }
.gap-xs { gap: var(--space-xs); } .gap-sm { gap: var(--space-sm); } .gap-md { gap: var(--space-md); } .gap-lg { gap: var(--space-lg); }
.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); }
.hide { display: none !important; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grow { flex: 1; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-primary { color: var(--color-primary); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.w-full { width: 100%; }

/* -------- Buttons with touch feedback -------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-weight: 500; font-size: 14px;
    transition: transform .15s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease, opacity .15s ease;
    border: 1px solid transparent;
    cursor: pointer; white-space: nowrap;
    min-height: 44px;
    -webkit-user-select: none; user-select: none;
    touch-action: manipulation;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.97); opacity: .9; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); box-shadow: 0 8px 24px -8px var(--color-primary); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--surface-alt); }
.btn-success { background: var(--color-success); color: #fff; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; min-height: 36px; }
.btn-lg { padding: 16px 28px; font-size: 16px; min-height: 52px; }
.btn-icon { padding: 10px; min-height: 42px; min-width: 42px; border-radius: 12px; }

/* -------- Forms -------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 500; color: var(--muted); }
.field label .req { color: var(--color-danger); margin-left: 2px; }
.input, .select, .textarea {
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 100%;
    transition: border-color .2s ease, box-shadow .2s ease;
    color: var(--text);
    font-size: 15px;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 15%, transparent);
}
.textarea { min-height: 90px; resize: vertical; }
.field-error { color: var(--color-danger); font-size: 12px; margin-top: 4px; }

/* -------- Card -------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-title { font-size: 16px; font-weight: 500; }
.card-compact { padding: 16px; }

/* -------- Alerts -------- */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    margin-bottom: 16px;
    border: 1px solid;
    display: flex; align-items: flex-start; gap: 12px;
}
.alert-success { background: color-mix(in srgb, var(--color-success) 10%, transparent); border-color: color-mix(in srgb, var(--color-success) 30%, transparent); color: var(--color-success); }
.alert-danger  { background: color-mix(in srgb, var(--color-danger) 10%, transparent);  border-color: color-mix(in srgb, var(--color-danger) 30%, transparent);  color: var(--color-danger); }
.alert-warning { background: color-mix(in srgb, var(--color-warning) 10%, transparent); border-color: color-mix(in srgb, var(--color-warning) 30%, transparent); color: var(--color-warning); }
.alert-info    { background: color-mix(in srgb, var(--color-info) 10%, transparent);    border-color: color-mix(in srgb, var(--color-info) 30%, transparent);    color: var(--color-info); }

/* -------- Badges -------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 12px; font-weight: 500;
    border: 1px solid var(--border);
    background: var(--surface-alt);
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.badge-success { color: var(--color-success); background: color-mix(in srgb, var(--color-success) 12%, transparent); border-color: transparent; }
.badge-warning { color: var(--color-warning); background: color-mix(in srgb, var(--color-warning) 12%, transparent); border-color: transparent; }
.badge-danger  { color: var(--color-danger);  background: color-mix(in srgb, var(--color-danger) 12%, transparent);  border-color: transparent; }
.badge-primary { color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 12%, transparent); border-color: transparent; }

/* -------- Shell / Layout -------- */
.shell { display: grid; grid-template-columns: var(--nav-width) 1fr; min-height: 100vh; min-height: 100dvh; }
.shell-nav {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    position: sticky; top: 0;
    height: 100vh; height: 100dvh; overflow-y: auto;
    display: flex; flex-direction: column;
}
.shell-main { display: flex; flex-direction: column; min-width: 0; }

.shell-header {
    height: var(--header-height);
    padding: 0 24px;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px;
    position: sticky; top: 0; z-index: 40;
}
.shell-content { padding: 32px; flex: 1; }

/* Brand */
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; margin-bottom: 28px; text-decoration: none; }
.brand-mark {
    width: 40px; height: 40px; border-radius: 12px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    display: grid; place-items: center;
    color: #fff; font-weight: 700; font-size: 18px;
    box-shadow: 0 4px 12px -4px var(--color-primary);
    flex-shrink: 0;
}
.brand-name { font-weight: 500; font-size: 15px; letter-spacing: -.02em; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }

/* Navigation */
.nav-group { margin-bottom: 20px; }
.nav-group-title { font-size: 10px; text-transform: uppercase; letter-spacing: .15em; color: var(--muted); padding: 0 14px; margin-bottom: 8px; font-weight: 500; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    color: var(--text);
    transition: background .15s ease, color .15s ease;
    margin-bottom: 2px;
    position: relative;
}
.nav-item:hover { background: var(--surface-alt); }
.nav-item.active {
    background: color-mix(in srgb, var(--color-primary) 10%, transparent);
    color: var(--color-primary);
    font-weight: 500;
}
.nav-item.active::before {
    content: '';
    position: absolute; left: 0; top: 25%; height: 50%;
    width: 3px; background: var(--color-primary);
    border-radius: 0 3px 3px 0;
}
.nav-item svg { width: 18px; height: 18px; opacity: .8; flex-shrink: 0; }
.nav-item.active svg { opacity: 1; }
.nav-badge {
    margin-left: auto;
    background: var(--color-primary);
    color: #fff;
    font-size: 10px;
    padding: 1px 8px;
    border-radius: 99px;
    font-weight: 600;
}

/* Header elements */
.search-box {
    flex: 1; max-width: 420px;
    position: relative;
}
.search-box input {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 10px 14px 10px 40px;
    border-radius: 10px; width: 100%;
    font-size: 14px;
}
.search-box .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); opacity: .5; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
    width: 40px; height: 40px;
    border-radius: 12px;
    display: grid; place-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
    position: relative;
}
.icon-btn:hover { background: var(--surface-alt); border-color: var(--color-primary); color: var(--color-primary); }
.icon-btn:active { transform: scale(.95); }
.icon-btn .notif-dot {
    position: absolute; top: 8px; right: 8px;
    width: 8px; height: 8px;
    background: var(--color-primary);
    border-radius: 50%;
    border: 2px solid var(--surface);
}

/* Profile chip */
.profile-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: 99px;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: border-color .15s ease;
}
.profile-chip:hover { border-color: var(--color-primary); }
.profile-chip .avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600;
}
.profile-chip .name { font-size: 13px; font-weight: 500; }

/* -------- Bento Grid -------- */
.bento {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
}
.bento > * { border-radius: var(--radius-lg); }
.b-1  { grid-column: span 3; }
.b-2  { grid-column: span 4; }
.b-3  { grid-column: span 5; }
.b-4  { grid-column: span 6; }
.b-5  { grid-column: span 7; }
.b-6  { grid-column: span 8; }
.b-full { grid-column: span 12; }

/* -------- Stat card -------- */
.stat {
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    position: relative; overflow: hidden;
}
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 32px; font-weight: 300; letter-spacing: -.02em; margin: 8px 0 12px; color: var(--text); }
.stat-value .unit { font-size: 14px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.stat-trend { font-size: 12px; color: var(--color-success); display: inline-flex; align-items: center; gap: 4px; }
.stat-trend.down { color: var(--color-danger); }
.stat-accent::before {
    content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%;
    background: var(--color-primary);
}

/* -------- Hero -------- */
.hero {
    background: var(--surface);
    padding: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    position: relative; overflow: hidden;
}
.hero::after {
    content: '';
    position: absolute; top: -50%; right: -20%; width: 400px; height: 400px;
    background: radial-gradient(circle, color-mix(in srgb, var(--color-primary) 12%, transparent) 0%, transparent 70%);
    pointer-events: none;
}

/* -------- Tables -------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border); -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; background: var(--surface); }
.tbl th, .tbl td { padding: 14px 16px; text-align: left; font-size: 14px; }
.tbl thead th { background: var(--surface-alt); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 500; border-bottom: 1px solid var(--border); }
.tbl tbody tr { border-bottom: 1px solid var(--border); transition: background .15s ease; }
.tbl tbody tr:last-child { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-alt); }

/* -------- Modals -------- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px;
    animation: fadeIn .2s ease;
}
.modal-backdrop.open { display: flex; }
.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    max-width: 560px; width: 100%; max-height: 90vh; max-height: 90dvh;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    animation: slideUp .3s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* -------- Bottom Nav (mobile) -------- */
.bottom-nav {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: color-mix(in srgb, var(--surface) 95%, transparent);
    backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-top: 1px solid var(--border);
    z-index: 50;
    padding: 8px 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0));
}
.bottom-nav-inner {
    display: grid; grid-template-columns: repeat(5, 1fr);
    max-width: 600px; margin: 0 auto;
    padding: 0 4px;
}
.bottom-nav a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 8px 4px; font-size: 10px; color: var(--muted);
    position: relative;
    transition: color .15s ease;
    border-radius: 8px;
}
.bottom-nav a:active { background: var(--surface-alt); }
.bottom-nav a svg { width: 22px; height: 22px; transition: transform .15s; }
.bottom-nav a.active { color: var(--color-primary); }
.bottom-nav a.active svg { transform: scale(1.1); }
.bottom-nav a.active::before {
    content: ''; position: absolute; top: 0;
    width: 26px; height: 3px; border-radius: 0 0 3px 3px;
    background: var(--color-primary);
}

/* -------- MOBILE RESPONSIVE -------- */
.menu-toggle { display: none; }

@media (max-width: 960px) {
    :root {
        --header-height: 56px;
    }
    .shell { grid-template-columns: 1fr; }
    .shell-nav {
        position: fixed; top: 0; left: 0;
        width: 280px; z-index: 60;
        transform: translateX(-100%);
        transition: transform .3s cubic-bezier(.4, 0, .2, 1);
        height: 100vh; height: 100dvh;
        padding-top: calc(24px + env(safe-area-inset-top, 0));
    }
    .shell-nav.open {
        transform: translateX(0);
        box-shadow: 8px 0 30px rgba(0,0,0,.2);
    }
    .nav-backdrop {
        position: fixed; inset: 0;
        background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
        z-index: 55; display: none;
        animation: fadeIn .2s ease;
    }
    .nav-backdrop.open { display: block; }
    .menu-toggle { display: grid; }

    .shell-header {
        padding: 0 16px;
        padding-top: env(safe-area-inset-top, 0);
        height: calc(var(--header-height) + env(safe-area-inset-top, 0));
    }

    .shell-content {
        padding: 16px 16px calc(var(--bottom-nav-height) + 32px + env(safe-area-inset-bottom, 0));
    }

    /* Bento grid simplification on mobile */
    .bento { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .b-1, .b-2, .b-3, .b-4, .b-5, .b-6 { grid-column: span 2; }
    .b-full { grid-column: span 2; }

    .bottom-nav { display: block; }

    /* Hide desktop-only elements */
    .search-box { display: none; }
    .profile-chip .name { display: none; }

    /* Compact hero on mobile */
    .hero { padding: 24px 20px; border-radius: var(--radius-lg); }
    .hero h1 { font-size: 28px !important; }

    /* Cards smaller padding */
    .card { padding: 16px; border-radius: var(--radius-md); }
    .stat { padding: 18px; }
    .stat-value { font-size: 24px; }

    h1 { font-size: 24px; }
    h2 { font-size: 20px; }

    /* Mobile modals — slide up from bottom */
    .modal-backdrop { padding: 0; align-items: flex-end; }
    .modal {
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        padding: 24px 20px;
        padding-bottom: calc(24px + env(safe-area-inset-bottom, 0));
        animation: slideUpMobile .3s cubic-bezier(.4, 0, .2, 1);
    }
    @keyframes slideUpMobile { from { transform: translateY(100%); } to { transform: translateY(0); } }

    /* Bigger tap targets */
    .btn { min-height: 48px; }
    .icon-btn { width: 44px; height: 44px; }

    /* Tables become horizontal scrollable */
    .tbl th, .tbl td { padding: 12px 14px; font-size: 13px; white-space: nowrap; }
}

@media (max-width: 480px) {
    .bento { grid-template-columns: 1fr; gap: 10px; }
    .b-1, .b-2, .b-3, .b-4, .b-5, .b-6 { grid-column: span 1; }
    .b-full { grid-column: span 1; }
    .hero h1 { font-size: 24px !important; }
    .stat-value { font-size: 22px; }
}

/* -------- Auth pages -------- */
.auth-wrap {
    min-height: 100vh; min-height: 100dvh;
    display: grid; grid-template-columns: 1fr 1fr;
    background: var(--bg);
}
.auth-visual {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: #fff; padding: 56px; position: relative; overflow: hidden;
    display: flex; flex-direction: column; justify-content: space-between;
}
.auth-visual::before {
    content: ''; position: absolute; inset: 0;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(255,255,255,.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,.1) 0%, transparent 50%);
    pointer-events: none;
}
.auth-visual > * { position: relative; z-index: 1; }
.auth-visual .quote { font-size: 26px; font-weight: 300; line-height: 1.4; letter-spacing: -.015em; }
.auth-visual .meta { font-size: 13px; opacity: .8; }
.auth-form-wrap {
    display: flex; align-items: center; justify-content: center;
    padding: 40px 24px;
}
.auth-form { width: 100%; max-width: 400px; }
.auth-form h1 { font-size: 32px; font-weight: 400; margin-bottom: 8px; }
.auth-form .muted { color: var(--muted); margin-bottom: 32px; }
.auth-form .divider {
    display: flex; align-items: center; gap: 14px;
    color: var(--muted); font-size: 12px;
    margin: 24px 0;
}
.auth-form .divider::before, .auth-form .divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}

@media (max-width: 820px) {
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-visual { padding: 28px; min-height: 180px; }
    .auth-visual .quote { font-size: 18px; }
    .auth-form h1 { font-size: 26px; }
    .auth-form { padding: 8px; }
}

/* -------- OTP input -------- */
.otp-input { display: flex; gap: 8px; justify-content: center; }
.otp-input input {
    width: 48px; height: 56px;
    text-align: center; font-size: 22px; font-weight: 500;
    border: 1px solid var(--border); border-radius: 12px;
    background: var(--surface); color: var(--text);
}
.otp-input input:focus { border-color: var(--color-primary); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 15%, transparent); }

@media (max-width: 480px) {
    .otp-input input { width: 40px; height: 48px; font-size: 18px; }
}

/* -------- Landing -------- */
.landing-hero {
    padding: 120px 24px 80px;
    text-align: center;
    background:
        radial-gradient(1200px 500px at 50% 0%, color-mix(in srgb, var(--color-primary) 15%, transparent) 0%, transparent 60%),
        var(--bg);
}
.landing-hero h1 { max-width: 860px; margin: 0 auto 24px; font-size: clamp(32px, 6vw, 64px); font-weight: 300; line-height: 1.1; letter-spacing: -.03em; }
.landing-hero .lead { max-width: 620px; margin: 0 auto 36px; font-size: 18px; }

@media (max-width: 768px) {
    .landing-hero { padding: 60px 16px 40px; }
    .landing-hero h1 { font-size: 28px; }
}

/* -------- Misc -------- */
.divider-h { height: 1px; background: var(--border); margin: 24px 0; }
.kbd { padding: 2px 8px; border-radius: 4px; background: var(--surface-alt); border: 1px solid var(--border); font-size: 11px; font-family: monospace; }
.spinner {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid var(--border); border-top-color: var(--color-primary);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -------- Approval banner -------- */
.approval-banner {
    background: linear-gradient(135deg, color-mix(in srgb, var(--color-warning) 20%, var(--surface)) 0%, var(--surface) 100%);
    border: 1px solid color-mix(in srgb, var(--color-warning) 40%, transparent);
    padding: 20px 24px;
    border-radius: var(--radius-lg);
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 24px;
}
.approval-banner .icon { font-size: 24px; }
.approval-banner .text { flex: 1; }
.approval-banner .text strong { font-size: 15px; display: block; margin-bottom: 2px; }
.approval-banner .text p { color: var(--muted); font-size: 13px; }

/* -------- Step indicator -------- */
.steps { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; }
.step {
    flex: 1; padding: 12px 16px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    display: flex; align-items: center; gap: 10px;
}
.step .step-num {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--border); color: var(--muted);
    display: grid; place-items: center; font-size: 12px; font-weight: 600;
    flex-shrink: 0;
}
.step.active { border-color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 8%, var(--surface)); }
.step.active .step-num { background: var(--color-primary); color: #fff; }
.step.done .step-num { background: var(--color-success); color: #fff; }

.tag-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* -------- Chat -------- */
.chat-shell { display: grid; grid-template-columns: 280px 1fr; height: calc(100vh - var(--header-height) - 64px); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.chat-list { border-right: 1px solid var(--border); overflow-y: auto; }
.chat-item { padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .15s; }
.chat-item:hover, .chat-item.active { background: var(--surface-alt); }
.chat-thread { display: flex; flex-direction: column; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; -webkit-overflow-scrolling: touch; }
.chat-msg { max-width: 70%; padding: 10px 14px; border-radius: 16px; font-size: 14px; background: var(--surface-alt); }
.chat-msg.me { margin-left: auto; background: var(--color-primary); color: #fff; }
.chat-input { padding: 14px; border-top: 1px solid var(--border); display: flex; gap: 10px; }
.chat-input input { flex: 1; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }

@media (max-width: 720px) {
    .chat-shell { grid-template-columns: 1fr; height: calc(100dvh - var(--header-height) - var(--bottom-nav-height) - 100px); }
    .chat-list.hidden-on-mobile { display: none; }
}

/* -------- Print -------- */
@media print {
    .shell-nav, .shell-header, .bottom-nav, .no-print, #pwa-banner { display: none !important; }
    .shell { grid-template-columns: 1fr; }
    .shell-content { padding: 0; }
}
