/* ==========================================================================
   Kairalmas AI — Design System
   Mobile-first, responsive, modern SaaS theme
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
    /* Brand */
    --brand-50:  #f5f3ff;
    --brand-100: #ede9fe;
    --brand-200: #ddd6fe;
    --brand-300: #c4b5fd;
    --brand-400: #a78bfa;
    --brand-500: #8b5cf6;
    --brand-600: #7c3aed;
    --brand-700: #6d28d9;
    --brand-800: #5b21b6;
    --brand-900: #4c1d95;

    --primary: var(--brand-700);
    --primary-dark: var(--brand-800);
    --primary-light: var(--brand-500);
    --secondary: #4f46e5;
    --accent: #06b6d4;
    --brand-gradient: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
    --brand-gradient-soft: linear-gradient(135deg, #f5f3ff 0%, #eef2ff 100%);

    /* Neutrals */
    --dark: #0f172a;
    --dark-text: #0f172a;
    --muted: #64748b;
    --light: #ffffff;

    --gray-50:  #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Status */
    --success: #10b981;
    --success-soft: #d1fae5;
    --success-text: #065f46;
    --warning: #f59e0b;
    --warning-soft: #fef3c7;
    --warning-text: #92400e;
    --danger: #ef4444;
    --danger-soft: #fee2e2;
    --danger-text: #991b1b;
    --info: #3b82f6;
    --info-soft: #dbeafe;
    --info-text: #1e40af;
    --whatsapp: #25d366;

    /* Shape & elevation */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-pill: 999px;

    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, .07);
    --shadow-lg: 0 12px 28px rgba(15, 23, 42, .10);
    --shadow-xl: 0 24px 48px rgba(15, 23, 42, .12);
    --shadow-brand: 0 10px 30px rgba(124, 58, 237, .25);

    --transition: all .22s cubic-bezier(.4, 0, .2, 1);
    --maxw: 1200px;
    --header-h: 72px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--dark-text);
    background-color: var(--light);
    line-height: 1.65;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { list-style: none; }
h1, h2, h3, h4, h5, h6 { line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }

/* Fluid type scale — scales down automatically on small screens */
h1, .h1 { font-size: clamp(1.9rem, 5.2vw, 3.4rem); }
h2, .h2 { font-size: clamp(1.5rem, 3.6vw, 2.35rem); }
h3, .h3 { font-size: clamp(1.15rem, 2.2vw, 1.4rem); }

/* ---------- Layout ---------- */
.container {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 1.25rem;
}

.section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
.section-sm { padding: clamp(2rem, 5vw, 3.5rem) 0; }
.section-tint { background: var(--brand-gradient-soft); }
.section-gray { background: var(--gray-50); }

.section-head { text-align: center; max-width: 720px; margin: 0 auto clamp(2rem, 4vw, 3rem); }
.section-head p { color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.15rem); margin-top: .75rem; }
.section-head .eyebrow { margin-bottom: 1rem; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .35rem .9rem;
    border-radius: var(--radius-pill);
    background: var(--brand-100);
    color: var(--brand-700);
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .01em;
}

/* ---------- Gradient text ---------- */
.grad-text {
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ---------- Grid system (responsive) ---------- */
.grid { display: grid; gap: 1.5rem; }

.grid-2, .grid-3, .grid-4, .grid-auto { display: grid; gap: 1.5rem; }

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

@media (min-width: 700px) {
    .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1000px) {
    .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Safety net: any leftover inline fixed-column grid collapses on small screens */
@media (max-width: 820px) {
    .grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
    [style*="grid-template-columns: repeat(4"],
    [style*="grid-template-columns: repeat(3"],
    [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .72rem 1.35rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: .94rem;
    line-height: 1.2;
    cursor: pointer;
    transition: var(--transition);
    border: 1.5px solid transparent;
    text-decoration: none;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn i { font-size: .9em; }

.btn-primary {
    background: var(--brand-gradient);
    color: #fff;
    box-shadow: 0 4px 14px rgba(124, 58, 237, .22);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-brand);
    color: #fff;
}

.btn-outline {
    background: #fff;
    border-color: var(--gray-300);
    color: var(--gray-800);
}
.btn-outline:hover { border-color: var(--brand-400); color: var(--brand-700); background: var(--brand-50); }

.btn-ghost {
    background: transparent;
    color: var(--gray-700);
}
.btn-ghost:hover { background: var(--gray-100); color: var(--brand-700); }

.btn-light { background: #fff; color: var(--brand-700); }
.btn-light:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.btn-glass {
    background: rgba(255, 255, 255, .14);
    color: #fff;
    border-color: rgba(255, 255, 255, .35);
    backdrop-filter: blur(6px);
}
.btn-glass:hover { background: rgba(255, 255, 255, .24); color: #fff; }

.btn-whatsapp { background: var(--whatsapp); color: #fff; }
.btn-whatsapp:hover { background: #1eb955; color: #fff; transform: translateY(-2px); }

.btn-lg { padding: .9rem 1.9rem; font-size: 1.02rem; }
.btn-sm { padding: .5rem 1rem; font-size: .85rem; }
.btn-block { width: 100%; }

.btn-icon {
    padding: 0;
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    background: var(--gray-100);
    color: var(--gray-700);
    border-color: transparent;
}
.btn-icon:hover { background: var(--brand-100); color: var(--brand-700); }

/* ---------- Header / Nav ---------- */
.header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--gray-200);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: var(--header-h);
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -.03em;
    color: var(--dark);
    text-decoration: none;
    flex-shrink: 0;
}
.logo-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--brand-gradient);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: .95rem;
    box-shadow: 0 4px 12px rgba(124, 58, 237, .3);
}
.logo i { color: #fff; }

.nav {
    display: none;
    align-items: center;
    gap: .25rem;
}

.nav a.nav-link {
    color: var(--gray-600);
    text-decoration: none;
    font-weight: 500;
    font-size: .93rem;
    padding: .5rem .8rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.nav a.nav-link:hover { color: var(--brand-700); background: var(--brand-50); }
.nav a.nav-link.active { color: var(--brand-700); background: var(--brand-50); font-weight: 600; }

.nav-actions { display: flex; align-items: center; gap: .5rem; margin-left: .5rem; }

/* Hamburger */
.nav-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    padding: 0 10px;
    border-radius: var(--radius);
    background: var(--gray-100);
    border: none;
    cursor: pointer;
}
.nav-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--gray-800);
    border-radius: 2px;
    transition: var(--transition);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile drawer */
.nav-drawer {
    display: none;
    border-top: 1px solid var(--gray-200);
    background: #fff;
    padding: 1rem 0 1.5rem;
}
.nav-drawer.open { display: block; }
.nav-drawer a {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .85rem 1.25rem;
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 500;
    border-radius: var(--radius);
}
.nav-drawer a:hover, .nav-drawer a.active { background: var(--brand-50); color: var(--brand-700); }
.nav-drawer .drawer-actions {
    display: grid;
    gap: .6rem;
    padding: 1rem 1.25rem 0;
    margin-top: .5rem;
    border-top: 1px solid var(--gray-200);
}

@media (min-width: 1024px) {
    .nav { display: flex; }
    .nav-toggle { display: none; }
    .nav-drawer { display: none !important; }
}

/* Dropdown (desktop) */
.dropdown { position: relative; }
.dropdown > .avatar { cursor: pointer; }
.dropdown-menu {
    position: absolute;
    top: calc(100% + .5rem);
    right: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: .4rem;
    display: none;
    z-index: 300;
}
.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu { display: block; }
.dropdown-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem .8rem;
    border-radius: var(--radius-sm);
    color: var(--gray-700);
    text-decoration: none;
    font-size: .9rem;
    transition: var(--transition);
}
.dropdown-item:hover { background: var(--brand-50); color: var(--brand-700); }

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--brand-gradient);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .85rem;
    flex-shrink: 0;
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    overflow: hidden;
    background: var(--brand-gradient);
    color: #fff;
    padding: clamp(3.5rem, 9vw, 6.5rem) 0 clamp(4rem, 10vw, 7rem);
}
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(60% 55% at 15% 12%, rgba(255, 255, 255, .18), transparent 60%),
        radial-gradient(50% 50% at 88% 85%, rgba(6, 182, 212, .28), transparent 65%);
    pointer-events: none;
}
.hero > .container { position: relative; z-index: 1; }

.hero-inner {
    display: grid;
    gap: clamp(2rem, 5vw, 3.5rem);
    align-items: center;
}
@media (min-width: 980px) {
    .hero-inner { grid-template-columns: 1.05fr .95fr; }
}

.hero h1 { color: #fff; margin-bottom: 1.1rem; letter-spacing: -.03em; }
.hero p.lead {
    font-size: clamp(1.02rem, 2vw, 1.22rem);
    color: rgba(255, 255, 255, .9);
    max-width: 54ch;
    margin-bottom: 1.9rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.75rem; }

.hero-badges { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; font-size: .85rem; color: rgba(255,255,255,.85); }
.hero-badges span { display: inline-flex; align-items: center; gap: .4rem; }
.hero-badges i { color: #a7f3d0; }

.pill-float {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .8rem;
    border-radius: var(--radius-pill);
    font-size: .78rem;
    font-weight: 600;
    background: rgba(255, 255, 255, .2);
    border: 1px solid rgba(255, 255, 255, .3);
    color: #fff;
    margin-bottom: 1.2rem;
}

/* Hero chat mockup */
.hero-visual { position: relative; }
.chat-mock {
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: 0 30px 60px rgba(15, 23, 42, .3);
    overflow: hidden;
    max-width: 400px;
    margin: 0 auto;
    color: var(--dark-text);
}
.chat-mock-head {
    background: var(--brand-gradient);
    color: #fff;
    padding: 1rem 1.15rem;
    display: flex;
    align-items: center;
    gap: .7rem;
    font-weight: 600;
    font-size: .95rem;
}
.chat-mock-head .dot {
    width: 30px; height: 30px; border-radius: 9px;
    background: rgba(255,255,255,.22);
    display: grid; place-items: center; font-size: .8rem;
}
.chat-mock-head small { display: block; font-weight: 400; font-size: .72rem; opacity: .85; }
.chat-mock-body {
    padding: 1.15rem;
    display: grid;
    gap: .7rem;
    background: var(--gray-50);
}
.chat-mock-body .bubble {
    padding: .65rem .95rem;
    border-radius: 16px;
    font-size: .86rem;
    line-height: 1.5;
    max-width: 88%;
    background: #fff;
    border: 1px solid var(--gray-200);
    color: var(--gray-700);
    border-bottom-left-radius: 5px;
}
.chat-mock-body .bubble.me {
    background: var(--brand-gradient);
    color: #fff;
    border: none;
    margin-left: auto;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 5px;
}
.chat-mock-foot {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .8rem 1rem;
    border-top: 1px solid var(--gray-200);
    color: var(--gray-400);
    font-size: .85rem;
    background: #fff;
}
.chat-mock-foot .send {
    margin-left: auto;
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--brand-gradient);
    color: #fff;
    display: grid; place-items: center;
    font-size: .75rem;
}

/* ---------- Cards ---------- */
.card {
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}
.card-pad { padding: clamp(1.25rem, 3vw, 2rem); }
.card-hover { transition: var(--transition); }
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--brand-200); }

.card-head {
    padding: 1.15rem 1.35rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.card-head h2, .card-head h3 { font-size: 1.08rem; }

/* Icon tile */
.icon-tile {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    background: var(--brand-100);
    color: var(--brand-700);
    flex-shrink: 0;
}
.icon-tile.lg { width: 60px; height: 60px; border-radius: 18px; font-size: 1.4rem; }
.icon-tile.round { border-radius: 50%; }
.icon-tile.success { background: var(--success-soft); color: var(--success-text); }
.icon-tile.warning { background: var(--warning-soft); color: var(--warning-text); }
.icon-tile.info { background: var(--info-soft); color: var(--info-text); }

/* Feature card */
.feature-card {
    padding: clamp(1.35rem, 3vw, 1.85rem);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    background: #fff;
    transition: var(--transition);
}
.feature-card:hover {
    border-color: var(--brand-200);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}
.feature-card h3 { margin: 1.1rem 0 .5rem; font-size: 1.12rem; }
.feature-card p { color: var(--muted); font-size: .94rem; }

/* Numbered step */
.step-card { position: relative; padding: clamp(1.35rem, 3vw, 1.85rem); text-align: center; }
.step-num {
    width: 46px; height: 46px;
    border-radius: 50%;
    background: var(--brand-gradient);
    color: #fff;
    font-weight: 800;
    display: grid; place-items: center;
    margin: 0 auto 1.1rem;
    box-shadow: 0 6px 16px rgba(124, 58, 237, .28);
}

/* ---------- Pricing ---------- */
.pricing-grid { display: grid; gap: 1.5rem; }
@media (min-width: 800px) { .pricing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .pricing-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.pricing-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: clamp(1.5rem, 3vw, 2rem);
    border-radius: var(--radius-xl);
    border: 1.5px solid var(--gray-200);
    background: #fff;
    transition: var(--transition);
}
.pricing-card:hover { border-color: var(--brand-300); box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.pricing-card.popular {
    border-color: var(--brand-500);
    box-shadow: var(--shadow-brand);
    background: linear-gradient(180deg, #fff 0%, var(--brand-50) 100%);
}
.pricing-card .plan-name { font-size: 1.15rem; font-weight: 700; }
.pricing-card .plan-desc { color: var(--muted); font-size: .88rem; margin: .4rem 0 1.25rem; min-height: 2.6em; }
.pricing-card .plan-price {
    font-size: clamp(1.9rem, 4vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.1;
}
.pricing-card .plan-price small { font-size: .8rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.pricing-card .plan-cycle { color: var(--muted); font-size: .82rem; margin-top: .2rem; }
.plan-features { margin: 1.4rem 0; display: grid; gap: .6rem; flex: 1; }
.plan-features li { display: flex; align-items: flex-start; gap: .6rem; font-size: .9rem; color: var(--gray-700); }
.plan-features i { color: var(--brand-600); margin-top: .3rem; font-size: .78rem; }

.popular-tag {
    position: absolute;
    top: -.8rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--brand-gradient);
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: .32rem .85rem;
    border-radius: var(--radius-pill);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(124, 58, 237, .3);
}
.value-tag {
    position: absolute;
    top: -.7rem;
    right: 1rem;
    background: var(--success-soft);
    color: var(--success-text);
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding: .28rem .7rem;
    border-radius: var(--radius-pill);
}

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .28rem .7rem;
    border-radius: var(--radius-pill);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .02em;
    white-space: nowrap;
}
.badge-active  { background: var(--success-soft); color: var(--success-text); }
.badge-pending { background: var(--warning-soft); color: var(--warning-text); }
.badge-expired { background: var(--danger-soft); color: var(--danger-text); }
.badge-free    { background: var(--brand-100); color: var(--brand-800); }
.badge-info    { background: var(--info-soft); color: var(--info-text); }
.badge-muted   { background: var(--gray-100); color: var(--gray-600); }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1.15rem; }
.form-label {
    display: block;
    margin-bottom: .45rem;
    font-weight: 600;
    font-size: .88rem;
    color: var(--gray-800);
}
.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: .78rem 1rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: .95rem;
    background: #fff;
    transition: var(--transition);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--gray-400); }
.form-input:focus, .form-textarea:focus, .form-select:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, .12);
}
.form-textarea { min-height: 130px; resize: vertical; font-family: inherit; }
.form-hint { display: block; margin-top: .35rem; font-size: .8rem; color: var(--muted); }

.alert {
    padding: .85rem 1rem;
    border-radius: var(--radius);
    font-size: .9rem;
    margin-bottom: 1.25rem;
    border: 1px solid transparent;
}
.alert-error { background: var(--danger-soft); border-color: #fecaca; color: var(--danger-text); }
.alert-success { background: var(--success-soft); border-color: #a7f3d0; color: var(--success-text); }
.alert-info { background: var(--info-soft); border-color: #bfdbfe; color: var(--info-text); }

/* ---------- Auth pages ---------- */
.auth-wrap {
    min-height: calc(100vh - var(--header-h));
    display: grid;
    place-items: center;
    padding: clamp(2rem, 6vw, 4rem) 1.25rem;
    background: var(--brand-gradient-soft);
}
.auth-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: var(--radius-xl);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-lg);
    padding: clamp(1.6rem, 5vw, 2.5rem);
}
.auth-card.wide { max-width: 520px; }
.auth-head { text-align: center; margin-bottom: 1.75rem; }
.auth-head h1 { font-size: clamp(1.4rem, 4vw, 1.75rem); margin-bottom: .4rem; }
.auth-head p { color: var(--muted); font-size: .92rem; }
.auth-foot {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--gray-200);
    font-size: .9rem;
    color: var(--muted);
}
.auth-foot a { color: var(--brand-700); font-weight: 600; text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }
.form-row { display: grid; gap: 1rem; }
@media (min-width: 560px) {
    .form-row.cols-2 { grid-template-columns: 1fr 1fr; }
}

/* ---------- Tables (responsive → stacked) ---------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; min-width: 560px; }
.table th, .table td {
    padding: .85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    font-size: .9rem;
    vertical-align: middle;
}
.table th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--gray-500);
    white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--gray-50); }
.table .num { font-variant-numeric: tabular-nums; }

/* Stack tables into cards on phones */
@media (max-width: 720px) {
    .table-stack { min-width: 0; }
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr {
        border: 1px solid var(--gray-200);
        border-radius: var(--radius);
        margin-bottom: .85rem;
        padding: .35rem .25rem;
        background: #fff;
    }
    .table-stack td {
        border: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        padding: .55rem .85rem;
        text-align: right;
    }
    .table-stack td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: .78rem;
        text-transform: uppercase;
        letter-spacing: .04em;
        color: var(--gray-500);
        text-align: left;
        flex-shrink: 0;
    }
    .table-stack td[data-label=""]::before { display: none; }
}

/* ---------- Stats ---------- */
.stats-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.stat-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: .9rem;
}
.stat-card .stat-val { font-size: clamp(1.35rem, 3vw, 1.75rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.stat-card .stat-lbl { font-size: .8rem; color: var(--muted); margin-top: .15rem; }

/* ---------- Dashboard shell ---------- */
.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
}
.page-head h1 { font-size: clamp(1.4rem, 3.5vw, 1.85rem); }
.page-head p { color: var(--muted); font-size: .93rem; margin-top: .3rem; }
.page-head .actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* ---------- Chat assistant ---------- */
.chat-shell {
    display: flex;
    flex-direction: column;
    height: min(72vh, 680px);
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .8rem;
    background: var(--gray-50);
}
.chat-bubble {
    padding: .7rem 1rem;
    border-radius: 16px;
    max-width: min(78%, 520px);
    font-size: .9rem;
    line-height: 1.55;
    word-wrap: break-word;
}
.chat-assistant {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-bottom-left-radius: 5px;
    color: var(--gray-800);
    align-self: flex-start;
}
.chat-user {
    background: var(--brand-gradient);
    color: #fff;
    border-bottom-right-radius: 5px;
    align-self: flex-end;
}
.chat-input-row {
    display: flex;
    gap: .6rem;
    padding: .8rem;
    border-top: 1px solid var(--gray-200);
    background: #fff;
}
.chat-input-row textarea {
    flex: 1;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    padding: .7rem .9rem;
    resize: none;
    max-height: 120px;
    font-size: .92rem;
}
.chat-input-row textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(124,58,237,.12); }

/* ---------- Code block ---------- */
.code-block {
    background: var(--gray-900);
    color: #e2e8f0;
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: .82rem;
    line-height: 1.7;
    overflow-x: auto;
    white-space: pre;
    -webkit-overflow-scrolling: touch;
}
.code-block .tok-key { color: #c4b5fd; }
.code-block .tok-str { color: #86efac; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: clamp(2.5rem, 7vw, 4rem) 1.25rem; }
.empty-state .icon-tile { margin: 0 auto 1.25rem; width: 72px; height: 72px; border-radius: 50%; font-size: 1.6rem; background: var(--gray-100); color: var(--gray-400); }
.empty-state h3 { margin-bottom: .5rem; }
.empty-state p { color: var(--muted); margin-bottom: 1.5rem; max-width: 42ch; margin-inline: auto; }

/* ---------- CTA band ---------- */
.cta-band {
    background: var(--brand-gradient);
    color: #fff;
    border-radius: var(--radius-xl);
    padding: clamp(2rem, 5vw, 3.5rem);
    text-align: center;
    position: relative;
    overflow: hidden;
}
.cta-band::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(55% 65% at 80% 20%, rgba(255,255,255,.16), transparent 60%);
}
.cta-band > * { position: relative; }
.cta-band h2 { color: #fff; margin-bottom: .75rem; }
.cta-band p { color: rgba(255,255,255,.9); max-width: 56ch; margin: 0 auto 1.75rem; }

/* ---------- Footer ---------- */
.footer {
    background: var(--gray-900);
    color: var(--gray-400);
    padding: clamp(2.5rem, 6vw, 4rem) 0 1.5rem;
}
.footer-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: 1fr;
    margin-bottom: 2.5rem;
}
@media (min-width: 640px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .footer-grid { grid-template-columns: 1.6fr 1fr 1fr 1.2fr; } }

.footer h4 {
    color: #fff;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 1rem;
    font-weight: 700;
}
.footer-brand .logo { color: #fff; margin-bottom: 1rem; }
.footer p { font-size: .9rem; line-height: 1.7; }
.footer-links { display: grid; gap: .6rem; }
.footer a { color: var(--gray-400); text-decoration: none; font-size: .9rem; transition: var(--transition); }
.footer a:hover { color: #fff; }
.footer-bottom {
    border-top: 1px solid var(--gray-800);
    padding-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
    justify-content: space-between;
    font-size: .85rem;
}

/* ---------- Utility ---------- */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-1 { gap: .25rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: .75rem; } .gap-4 { gap: 1rem; } .gap-6 { gap: 1.5rem; }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-primary { color: var(--brand-700); }
.text-muted { color: var(--muted); }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .78rem; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-2 { margin-top: .5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mr-1 { margin-right: .25rem; }
.mr-2 { margin-right: .5rem; }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }
.max-w-prose { max-width: 68ch; margin-inline: auto; }
.hidden { display: none !important; }
.block { display: block; }
.relative { position: relative; }
.overflow-x { overflow-x: auto; }
.bg-white { background: #fff; }
.bg-gray { background: var(--gray-50); }
.bg-brand-soft { background: var(--brand-50); }
.bg-primary { background: var(--brand-700); }
.bg-primary-hover:hover { background: var(--brand-800); }
.text-black { color: var(--dark); }
.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.shadow { box-shadow: var(--shadow-sm); }
.divider { height: 1px; background: var(--gray-200); border: none; margin: 1.5rem 0; }

/* Document / prose pages (privacy, terms, etc.) */
.prose { max-width: 76ch; margin: 0 auto; }
.prose h2 { margin: 2.25rem 0 .75rem; font-size: clamp(1.2rem, 2.5vw, 1.45rem); }
.prose h3 { margin: 1.75rem 0 .5rem; font-size: 1.08rem; }
.prose p { margin-bottom: 1rem; color: var(--gray-700); }
.prose ul { margin: 0 0 1.25rem 1.25rem; list-style: disc; }
.prose li { margin-bottom: .5rem; color: var(--gray-700); }
.prose a { color: var(--brand-700); }

/* ---------- Motion ---------- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}
.animate-fade-in { animation: fadeUp .5s ease both; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* Focus visibility for a11y */
:focus-visible { outline: 3px solid rgba(124, 58, 237, .45); outline-offset: 2px; border-radius: var(--radius-sm); }

/* Product polish: consistent depth, interaction feedback, and readable controls. */
.card { box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 10px 30px rgba(15,23,42,.035); }
.card-hover { transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.card-hover:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(15,23,42,.10); }
.btn { transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { box-shadow: 0 8px 18px rgba(124,58,237,.18); }
.form-input, select, textarea { transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease; }
.form-input:focus, select:focus, textarea:focus { border-color: var(--primary-500, #7c3aed); box-shadow: 0 0 0 4px rgba(124,58,237,.10); outline: none; }
.table tbody tr { transition: background-color .15s ease; }
.table tbody tr:hover { background: rgba(124,58,237,.035); }
.badge { white-space: nowrap; }
