/* ==========================================================================
   LITHIUM CHATBOT — OPERATOR DESIGN SYSTEM
   Light-mode, orange-branded interface for configuring production chatbots.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&display=swap");
@import url("https://cdn.jsdelivr.net/npm/geist@1.3.1/dist/fonts/geist-sans/style.min.css");
@import url("https://cdn.jsdelivr.net/npm/geist@1.3.1/dist/fonts/geist-mono/style.min.css");

/* -------- TOKENS -------- */
:root {
    color-scheme: light;

    /* Background layers */
    --bg-0: #f8fafc;
    --bg-1: #ffffff;
    --bg-2: #f1f5f9;
    --bg-3: #e2e8f0;
    --bg-4: #cbd5e1;

    /* Ink / text */
    --ink: #0f172a;
    --ink-soft: #334155;
    --muted: #64748b;
    --faint: #94a3b8;

    /* Borders */
    --line: rgba(15, 23, 42, 0.08);
    --line-strong: rgba(15, 23, 42, 0.14);
    --line-bright: rgba(15, 23, 42, 0.2);

    /* Brand orange — keeping --lime variable name for backward compatibility */
    --lime: #FF6600;
    --lime-soft: rgba(255, 102, 0, 0.12);
    --lime-deep: #E65C00;
    --ember: #ef4444;
    --ember-soft: rgba(239, 68, 68, 0.12);
    --gold: #f59e0b;

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

    /* Radius */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 20px;
    --r-2xl: 28px;

    /* Shadows — light-mode friendly */
    --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.04), 0 2px 8px rgba(15, 23, 42, 0.04);
    --shadow-pop: 0 10px 30px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.05);
    --ring-lime: 0 0 0 3px rgba(255, 102, 0, 0.22);
    --ring-ember: 0 0 0 3px rgba(239, 68, 68, 0.2);

    /* Typography */
    --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
    --sans: "Geist", "SF Pro Display", "Segoe UI", system-ui, sans-serif;
    --mono: "Geist Mono", "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

    /* Sidebar width */
    --sidebar-w: 260px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: var(--bg-0);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-feature-settings: "ss01", "cv11";
}

body {
    background:
        radial-gradient(1200px 600px at 0% -10%, rgba(255, 102, 0, 0.03), transparent 55%),
        radial-gradient(900px 500px at 100% 110%, rgba(255, 102, 0, 0.02), transparent 50%),
        var(--bg-0);
    background-attachment: fixed;
}

/* Subtle grid texture — pure CSS, no images */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
    background-image:
        repeating-linear-gradient(0deg, rgba(15, 23, 42, 0.03) 0 1px, transparent 1px 40px),
        repeating-linear-gradient(90deg, rgba(15, 23, 42, 0.03) 0 1px, transparent 1px 40px);
    mix-blend-mode: multiply;
}

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }

input[type="checkbox"] { accent-color: var(--lime); }

::selection { background: var(--lime); color: #0a0a08; }

/* -------- LAYOUT SHELL -------- */

/* Auth / public pages use a simpler centered layout */
.shell--auth {
    min-height: 100vh;
    display: grid;
    place-items: stretch;
    position: relative;
    z-index: 1;
}

/* Admin layout with sidebar */
.shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 16px;
    border-right: 1px solid var(--line);
    background: linear-gradient(180deg, #0f172a 0%, #020617 100%);
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 18px;
    z-index: 5;
}

/* Sidebar dark-surface overrides — sidebar stays slate-950 regardless of global light mode */
.sidebar,
.sidebar .sidenav__label,
.sidebar .sidenav__item,
.sidebar .sidenav__icon,
.sidebar .brand-lockup__text strong,
.sidebar .brand-lockup__text small,
.sidebar .user-chip,
.sidebar .user-chip__meta strong,
.sidebar .user-chip__meta span,
.sidebar .sidebar__signout {
    --ink: rgba(255, 255, 255, 0.9);
    --ink-soft: rgba(255, 255, 255, 0.65);
    --muted: rgba(255, 255, 255, 0.4);
    --faint: rgba(255, 255, 255, 0.22);
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.14);
    --bg-2: rgba(255, 255, 255, 0.05);
    --bg-3: rgba(255, 255, 255, 0.08);
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 4px 6px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
    position: relative;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--lime) 0%, var(--lime-deep) 100%);
    color: #ffffff;
    font-family: var(--serif);
    font-style: italic;
    font-size: 22px;
    line-height: 1;
    box-shadow: 0 4px 20px -4px rgba(255, 102, 0, 0.5);
    flex: 0 0 auto;
}

.brand-mark::after {
    content: "";
    position: absolute;
    inset: 2px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 11px;
}

.brand-lockup__text {
    display: flex;
    flex-direction: column;
    gap: 0;
    line-height: 1.1;
    min-width: 0;
}

.brand-lockup__text strong {
    font-size: 18px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.brand-lockup__text small {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin-top: 2px;
}

.sidenav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    min-height: 0;
}

.sidenav__group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 0 8px;
}

.sidenav__label {
    padding: 6px 12px 8px;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.sidenav__item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 450;
    transition: background 140ms ease, color 140ms ease;
    position: relative;
}

.sidenav__item:hover {
    background: var(--bg-2);
    color: var(--ink);
}

.sidenav__item.is-active {
    background: var(--bg-3);
    color: var(--ink);
}

.sidenav__item.is-active::before {
    content: "";
    position: absolute;
    left: -16px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    border-radius: 2px;
    background: var(--lime);
    box-shadow: 0 0 10px var(--lime);
}

.sidenav__icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    color: var(--muted);
    opacity: 0.9;
}

.sidenav__item.is-active .sidenav__icon,
.sidenav__item:hover .sidenav__icon {
    color: var(--ink);
}

.sidebar__user {
    padding: 14px;
    border-top: 1px solid var(--line);
    display: grid;
    gap: 10px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg-2);
}

.user-chip__avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
    border: 1px solid rgba(255,255,255,0.15);
    display: grid;
    place-items: center;
    font-family: var(--mono);
    font-size: 11px;
    color: rgba(255,255,255,0.9);
    flex: 0 0 auto;
}

.user-chip__meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.user-chip__meta strong {
    font-size: 13px;
    color: var(--ink);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chip__meta span {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar__signout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.sidebar__signout:hover {
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
    background: rgba(239, 68, 68, 0.08);
}

/* Main content area */
.main {
    padding: 0;
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 36px;
    border-bottom: 1px solid var(--line);
    background: rgba(248, 250, 252, 0.9);
    backdrop-filter: blur(12px);
}

.topbar__crumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.topbar__crumbs a:hover { color: var(--ink); }

.topbar__crumbs span.sep { color: var(--faint); }

.topbar__crumbs strong {
    color: var(--ink);
    font-family: var(--mono);
    font-weight: 500;
}

.topbar__actions { display: flex; gap: 10px; align-items: center; }

.main__content {
    padding: 36px;
    max-width: 1360px;
    margin: 0 auto;
}

/* -------- TYPOGRAPHY -------- */

h1, h2, h3, h4 {
    margin: 0;
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 600;
    letter-spacing: -0.015em;
}

.display {
    font-family: var(--serif);
    font-size: clamp(40px, 6vw, 76px);
    line-height: 0.96;
    letter-spacing: -0.02em;
    font-weight: 400;
}

.display em {
    color: var(--lime);
    font-style: italic;
    font-weight: 400;
}

h1 {
    font-size: clamp(28px, 4vw, 40px);
    line-height: 1.08;
    letter-spacing: -0.02em;
    font-weight: 700;
}

h1 em { color: var(--lime); font-style: italic; }

h2 {
    font-size: 22px;
    line-height: 1.2;
    font-weight: 600;
}

h3 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
}

p { margin: 0; color: var(--ink-soft); }

.lede {
    max-width: 62ch;
    font-size: 15px;
    line-height: 1.6;
    color: var(--ink-soft);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.eyebrow::before {
    content: "";
    width: 8px;
    height: 1px;
    background: var(--muted);
    display: inline-block;
}

.eyebrow--muted { color: var(--muted); }
.eyebrow--muted::before { background: var(--muted); }

.mono { font-family: var(--mono); }

.ink-muted { color: var(--muted); }

/* -------- PAGE HEADING -------- */

.page-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 32px;
    align-items: flex-end;
    padding-bottom: 28px;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--line);
}

.page-head__copy { display: grid; gap: 8px; }

.page-head__copy h1 { margin-top: 4px; }

.page-head__actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* -------- BUTTONS -------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-family: var(--sans);
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: 0;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
    white-space: nowrap;
    text-decoration: none;
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--ring-lime);
}

.btn--primary {
    background: var(--lime);
    color: #ffffff;
    border-color: var(--lime);
    font-weight: 550;
}

.btn--primary:hover {
    background: var(--lime-deep);
    border-color: var(--lime-deep);
}

.btn--ghost {
    background: transparent;
    color: var(--ink-soft);
    border-color: var(--line-strong);
}

.btn--ghost:hover {
    background: var(--bg-2);
    border-color: var(--line-bright);
    color: var(--ink);
}

.btn--ember {
    background: var(--ember);
    color: #ffffff;
    border-color: var(--ember);
    font-weight: 550;
}

.btn--ember:hover { background: #dc2626; border-color: #dc2626; }

.btn--subtle {
    background: var(--bg-2);
    color: var(--ink-soft);
    border-color: var(--line);
}

.btn--subtle:hover { background: var(--bg-3); color: var(--ink); }

.btn--icon {
    width: 38px;
    padding: 0;
    justify-content: center;
}

.btn--sm { min-height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 7px; }

.btn--lg {
    min-height: 48px;
    padding: 0 22px;
    font-size: 14.5px;
    border-radius: 10px;
}

.btn[disabled], .btn.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.text-link {
    color: var(--lime);
    font-weight: 500;
    transition: color 140ms ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.text-link:hover { color: var(--lime-deep); }

.text-link::after { content: "→"; transition: transform 140ms ease; }
.text-link:hover::after { transform: translateX(3px); }

/* -------- CARDS / SURFACES -------- */

.card {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    background: var(--bg-1);
    padding: 24px;
}

.card--dense { padding: 18px; }
.card--roomy { padding: 32px; }

.card--bordered-accent {
    border-color: var(--line);
    border-left: 4px solid rgba(255, 102, 0, 0.5);
}

.panel {
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--bg-2);
    padding: 20px;
}

.panel--subtle {
    background: transparent;
    border-color: var(--line);
}

/* Stacked list */
.stack { display: grid; gap: 14px; }
.stack--tight { gap: 8px; }
.stack--loose { gap: 20px; }
.stack--roomy { gap: 28px; }

.row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.spacer { flex: 1; }

/* Grid helpers */
.grid { display: grid; gap: 20px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--sidebar { grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); }
.grid--sidebar-reverse { grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.4fr); }

/* Bot edit page override — that page's main column hosts a tall,
   structured editing form and the sidebar is reference material
   (install snippet + live preview), not primary interaction. Give
   the form more width and let the sidebar shrink to ~320px so form
   fields stop wrapping their labels. :has() scopes this to the one
   section without changing .grid--sidebar elsewhere. */
.grid--sidebar:has(.bot-edit-form) {
    grid-template-columns: minmax(0, 2.2fr) minmax(320px, 1fr);
}

/* -------- SECTION HEADINGS -------- */

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.section-head__copy { display: grid; gap: 6px; }

/* -------- STATS / METRICS -------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.stat {
    display: grid;
    gap: 4px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--bg-1);
    position: relative;
    overflow: hidden;
}

.stat__label {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stat__value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    color: var(--ink);
    margin-top: 4px;
    letter-spacing: -0.02em;
}

.stat__meta {
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
}

.stat--accent {
    border-color: rgba(255, 102, 0, 0.3);
}

.stat--accent::before { display: none; }

/* -------- ENTITY LIST / CARDS -------- */

.list-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 16px 20px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--bg-1);
    color: inherit;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

a.list-item:hover {
    border-color: var(--line-bright);
    background: var(--bg-2);
    transform: translateY(-1px);
}

.list-item__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted);
    flex: 0 0 auto;
}

.list-item__dot--active { background: #10b981; box-shadow: 0 0 6px rgba(16, 185, 129, 0.5); }
.list-item__dot--draft  { background: var(--gold); }
.list-item__dot--paused { background: var(--muted); }

.list-item__body { min-width: 0; }
.list-item__body strong {
    display: block;
    font-size: 15px;
    font-weight: 500;
    color: var(--ink);
    margin-bottom: 4px;
    letter-spacing: -0.005em;
}
.list-item__body p {
    color: var(--muted);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-item__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex: 0 0 auto;
    text-align: right;
}

.list-item__meta small {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.06em;
}

/* -------- STATUS CHIP -------- */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    border: none;
    background: #f1f5f9;
    color: #475569;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none;
}

.chip::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.7;
}

.chip--active, .chip--live, .chip--success { background: #dcfce7; color: #166534; }
.chip--paused, .chip--neutral { background: #f1f5f9; color: #475569; }
.chip--draft, .chip--pending, .chip--warning { background: #fef3c7; color: #92400e; }
.chip--error, .chip--danger, .chip--urgent { background: #fee2e2; color: #991b1b; }

/* -------- FLASH -------- */

.flash {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
}

.flash::before {
    content: "";
    width: 8px; height: 8px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.flash--success, .flash--ok {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.flash--success::before, .flash--ok::before { background: #166534; }

.flash--error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.flash--error::before { background: #991b1b; }

/* -------- FORMS -------- */

.form { display: grid; gap: 28px; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-grid--single { grid-template-columns: 1fr; }

.field { display: grid; gap: 6px; position: relative; }

.field--full { grid-column: 1 / -1; }

.field__label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 6px;
}

.field__label strong { color: var(--ink); font-weight: 600; }
.field__label span, .field__label small { font-weight: 400; color: var(--muted); font-size: 12px; }

.field__help {
    margin-top: 4px;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
    letter-spacing: 0;
    text-transform: none;
    font-family: var(--sans);
    font-weight: 400;
}

.field__error {
    margin-top: 4px;
    font-size: 12px;
    color: var(--ember);
    font-family: var(--mono);
    letter-spacing: 0;
    text-transform: none;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="url"],
.field input[type="tel"],
.field input[type="search"],
.field select,
.field textarea,
.input {
    width: 100%;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-radius: 8px;
    color: var(--ink);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 140ms ease, box-shadow 140ms ease;
    outline: none;
}

.field textarea { min-height: 110px; resize: vertical; line-height: 1.55; }

.field input:focus,
.field select:focus,
.field textarea:focus,
.input:focus {
    border-color: #FF6600;
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.12);
}

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

/* Mono inputs for technical fields (hex, ids, models) */
.field--mono input,
.field--mono textarea { font-family: var(--mono); font-size: 13px; letter-spacing: 0.02em; }

.field--check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg-2);
    cursor: pointer;
    transition: border-color 140ms ease, background 140ms ease;
}

.field--check:hover { border-color: var(--line-strong); }

.field--check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex: 0 0 auto;
    cursor: pointer;
}

.field--check__text {
    display: grid;
    gap: 3px;
}

.field--check__text strong {
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 500;
}

.field--check__text small {
    color: var(--muted);
    font-size: 12px;
}

/* Color picker field */
.field--color { position: relative; }
.field--color input[type="text"] {
    padding-left: 38px;
    font-family: var(--mono);
}
.field--color .swatch {
    position: absolute;
    top: 30px; left: 10px;
    width: 20px; height: 20px;
    border-radius: 5px;
    border: 1px solid var(--line-strong);
    pointer-events: none;
}

/* AI Assist button inside field */
.field__ai {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border: 1px solid var(--lime-soft);
    border-radius: 999px;
    background: transparent;
    color: var(--lime);
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease;
}

.field__ai:hover {
    background: var(--lime-soft);
    border-color: var(--lime);
}

.field__ai.is-loading::after {
    content: "•••";
    animation: dots 1.2s infinite;
}

@keyframes dots {
    0%, 20% { opacity: 0.4; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}

/* Form subsection */
.fieldset {
    display: grid;
    gap: 18px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    background: var(--bg-1);
    position: relative;
}

.fieldset__head {
    display: grid;
    gap: 4px;
    padding-bottom: 16px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
}

.fieldset__head h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.fieldset__head p {
    color: var(--muted);
    font-size: 13px;
    margin: 0;
}

/* -------- EMPTY STATE -------- */

.empty {
    display: grid;
    gap: 14px;
    padding: 44px 28px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-xl);
    background: transparent;
    text-align: left;
    justify-items: start;
}

.empty h3 { font-size: 16px; font-weight: 600; color: var(--ink); }
.empty p { color: var(--muted); max-width: 48ch; }

/* -------- CODE BLOCK -------- */

.code {
    margin: 0;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #0f172a;
    color: #c8d8f0;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.65;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.code-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    background: var(--bg-2);
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.code-toolbar + .code {
    border-radius: 0 0 10px 10px;
    border-top: none;
}

.copy-btn {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: var(--mono);
    font-size: 10.5px;
    cursor: pointer;
    transition: color 140ms ease, border-color 140ms ease;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.copy-btn:hover { color: var(--lime); border-color: var(--lime-soft); }

.copy-btn.is-copied { color: var(--lime); border-color: var(--lime); }

/* -------- TOGGLE / DETAILS ACCORDION -------- */

.toggle {
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    background: var(--bg-1);
    overflow: hidden;
}

.toggle[open] { border-color: var(--line-strong); }

.toggle > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    cursor: pointer;
    list-style: none;
    transition: background 140ms ease;
}

.toggle > summary::-webkit-details-marker { display: none; }

.toggle > summary:hover { background: var(--bg-2); }

.toggle__head {
    display: grid;
    gap: 3px;
}

.toggle__head strong {
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.toggle__head span {
    font-size: 13px;
    color: var(--muted);
}

.toggle__icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    border: 1px solid var(--line);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 14px;
    transition: transform 180ms ease;
}

.toggle[open] > summary .toggle__icon {
    transform: rotate(45deg);
    color: var(--lime);
    border-color: var(--lime-soft);
}

.toggle__body {
    padding: 4px 24px 28px;
    border-top: 1px solid var(--line);
}

/* -------- CHECKLIST PILLS -------- */

.pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pill-list li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg-2);
    color: var(--ink-soft);
    font-size: 12px;
}

.pill-list li::before {
    content: "";
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--lime);
}

/* -------- STEPS -------- */

.step-list {
    counter-reset: step;
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
}

.step-list li {
    counter-increment: step;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 4px 0;
}

.step-list li::before {
    content: counter(step, decimal-leading-zero);
    font-family: var(--mono);
    font-size: 12px;
    color: var(--lime);
    padding-top: 1px;
    letter-spacing: 0.04em;
}

.step-list li strong { color: var(--ink); font-weight: 500; font-size: 14px; display: block; margin-bottom: 2px; }
.step-list li p { color: var(--muted); font-size: 13px; line-height: 1.55; }

/* -------- WIDGET PREVIEW -------- */

.preview-frame {
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    background:
        radial-gradient(600px 300px at 100% 100%, rgba(255, 102, 0, 0.05), transparent),
        repeating-linear-gradient(45deg, transparent 0 12px, rgba(15,23,42,0.015) 12px 24px),
        var(--bg-2);
    padding: 28px;
    position: relative;
    overflow: hidden;
    min-height: 360px;
}

.preview-frame__label {
    position: absolute;
    top: 14px; left: 18px;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.widget-preview {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: grid;
    gap: 14px;
    justify-items: end;
}

.widget-preview--left { left: 24px; right: auto; justify-items: start; }

.widget-panel {
    width: 340px;
    overflow: hidden;
    border-radius: 20px;
    background: #0f0f10;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 40px 80px -20px rgba(0, 0, 0, 0.6),
        0 20px 40px -10px rgba(0, 0, 0, 0.4);
    color: var(--preview-text, #fff);
}

.widget-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--preview-surface, #0f0f10);
    color: var(--preview-text, #fff);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.widget-panel__identity { display: flex; align-items: center; gap: 12px; min-width: 0; }

.widget-panel__avatar {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--preview-accent, #c6f96c);
    color: #0a0a08;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    flex: 0 0 auto;
}

.widget-panel__identity strong {
    display: block;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.1;
    color: var(--preview-text, #fff);
}

.widget-panel__identity span {
    display: block;
    font-size: 11px;
    opacity: 0.7;
    margin-top: 2px;
}

.widget-panel__close {
    width: 28px; height: 28px;
    border-radius: 7px;
    background: rgba(255,255,255,0.06);
    display: grid;
    place-items: center;
    font-size: 16px;
    opacity: 0.6;
}

.widget-panel__body {
    padding: 16px;
    display: grid;
    gap: 10px;
    background: #0f0f10;
}

.bubble {
    max-width: 86%;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
}

.bubble--bot {
    border-top-left-radius: 4px;
    background: rgba(255,255,255,0.06);
    color: rgba(255, 255, 255, 0.9);
}

.bubble--bot strong {
    display: block;
    font-size: 14.5px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.bubble--user {
    border-top-right-radius: 4px;
    justify-self: end;
    background: var(--preview-accent, #c6f96c);
    color: #0a0a08;
    font-weight: 500;
}

.quick-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.quick-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--preview-accent, #c6f96c);
    font-size: 11.5px;
    font-weight: 500;
    border: 1px solid rgba(255,255,255,0.08);
}

.widget-panel__composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: #0f0f10;
}

.widget-panel__input {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 9px 12px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12.5px;
    border: 1px solid rgba(255,255,255,0.05);
}

.widget-panel__send {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--preview-accent, #c6f96c);
    color: #0a0a08;
    display: grid;
    place-items: center;
    font-weight: 700;
}

.widget-launcher {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--preview-surface, #0f0f10);
    color: var(--preview-text, #fff);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.5);
    font-size: 13.5px;
    font-weight: 500;
}

.widget-launcher__badge {
    width: 28px; height: 28px;
    border-radius: 8px;
    background: var(--preview-accent, #c6f96c);
    color: #0a0a08;
    display: grid;
    place-items: center;
    font-family: var(--mono);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.06em;
}

/* -------- CALLOUT -------- */

.callout {
    padding: 14px 16px;
    border-left: 2px solid var(--lime);
    background: var(--lime-soft);
    border-radius: 0 10px 10px 0;
    color: var(--ink);
    font-size: 13px;
}

.callout strong { color: var(--lime); font-weight: 550; display: block; margin-bottom: 4px; }

.callout--ember { border-color: var(--ember); background: var(--ember-soft); }
.callout--ember strong { color: var(--ember); }

/* -------- AUTH HERO -------- */

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

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

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1fr);
    min-height: 100vh;
    overflow: hidden;
    background: #f8fafc;
}

.auth-aside {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    padding: 0;
    background: #020617;
    color: #ffffff;
}

.auth-aside__pattern {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.055) 1px, transparent 0);
    background-size: 24px 24px;
}

.auth-orb {
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
}

.auth-orb--one {
    top: 24%;
    left: -90px;
    width: 280px;
    height: 280px;
    background: rgba(255, 102, 0, 0.2);
    filter: blur(100px);
}

.auth-orb--two {
    right: -80px;
    bottom: 22%;
    width: 260px;
    height: 260px;
    background: rgba(249, 115, 22, 0.15);
    filter: blur(80px);
}

.auth-aside__inner {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px 64px;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
    width: fit-content;
    animation: authFadeInUp 0.5s ease-out both;
}

.auth-logo__mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 2px solid #FF6600;
    color: #FF6600;
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 0 0 1px rgba(255,102,0,.18), 0 18px 45px rgba(255,102,0,.22);
}

.auth-logo__text {
    display: grid;
    gap: 0;
    line-height: 1;
}

.auth-logo__text strong {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.045em;
    color: #ffffff;
}

.auth-logo__text small {
    margin-top: 4px;
    color: #64748b;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.42em;
    text-transform: uppercase;
}

.auth-logo--dark .auth-logo__text strong { color: #0f172a; }

.auth-hero-copy {
    margin-top: 66px;
    max-width: 520px;
    animation: authFadeInUp 0.5s ease-out 100ms both;
}

.auth-hero-copy h1 {
    color: #ffffff;
    font-size: clamp(32px, 3.4vw, 38px);
    line-height: 1.12;
    letter-spacing: -0.035em;
    font-weight: 800;
}

.auth-hero-copy h1 span {
    background: linear-gradient(90deg, #FF6600, #fb923c);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.auth-hero-copy p {
    margin-top: 26px;
    max-width: 460px;
    color: #94a3b8;
    font-size: 17px;
    line-height: 1.65;
}

.auth-feature-list {
    margin-top: 56px;
    display: grid;
    gap: 17px;
    animation: authFadeInUp 0.5s ease-out 200ms both;
}

.auth-feature {
    display: flex;
    align-items: flex-start;
    gap: 13px;
}

.auth-feature__icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    margin-top: 2px;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    color: #FF6600;
}

.auth-feature__icon svg {
    width: 17px;
    height: 17px;
}

.auth-feature strong {
    display: block;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
}

.auth-feature small {
    display: block;
    margin-top: 2px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.35;
}

.auth-copyright {
    margin-top: auto;
    padding-top: 64px;
    color: #475569;
    font-size: 12px;
}

.auth-main {
    display: grid;
    place-items: center;
    padding: 48px 64px;
    background: #f8fafc;
}

.auth-panel {
    width: min(384px, 100%);
    animation: authFadeInUp 0.5s ease-out 200ms both;
}

.auth-mobile-logo {
    display: none;
    justify-content: center;
    margin-bottom: 32px;
    animation: authFadeIn 0.6s ease-out both;
}

.auth-panel__head h2 {
    margin: 0;
    color: #0f172a;
    font-size: 24px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.auth-panel__head p {
    margin-top: 6px;
    margin-bottom: 32px;
    color: #64748b;
    font-size: 14px;
}

.auth-form {
    display: grid;
    gap: 20px;
}

.auth-field {
    display: grid;
    gap: 7px;
}

.auth-field > span:first-child {
    color: #334155;
    font-size: 14px;
    font-weight: 650;
}

.auth-field input {
    width: 100%;
    height: 44px;
    padding: 0 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    outline: none;
    background: #f8fafc;
    color: #0f172a;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.15s ease;
}

.auth-field input::placeholder { color: #94a3b8; }

.auth-field input:focus {
    border-color: #FF6600;
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.1);
    background: #ffffff;
}

.auth-password {
    position: relative;
    display: block;
}

.auth-password input { padding-right: 46px; }

.auth-password__toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transform: translateY(-50%);
    transition: color 0.15s ease;
}

.auth-password__toggle:hover { color: #475569; }
.auth-password__toggle svg { width: 20px; height: 20px; }

.auth-submit {
    width: 100%;
    height: 44px;
    margin-top: 1px;
    border: 0;
    border-radius: 12px;
    background: #FF6600;
    color: #ffffff;
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(255, 102, 0, 0.25);
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.auth-submit:hover {
    background: #E65C00;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.3);
}

.auth-submit:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 4px rgba(255, 102, 0, 0.2);
}

.auth-back-link {
    display: block;
    margin-top: 22px;
    color: #64748b;
    font-size: 13px;
    text-align: center;
    transition: color 0.15s ease;
}

.auth-back-link:hover { color: #FF6600; }

.auth-error {
    margin: 0 0 22px;
}

/* Home hero */
.home-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 1fr);
    gap: 48px;
    padding: 72px 0;
    border-bottom: 1px solid var(--line);
    align-items: center;
}

.home-hero__visual {
    position: relative;
    height: 480px;
    border: 1px solid var(--line);
    border-radius: var(--r-2xl);
    background:
        radial-gradient(500px 300px at 90% 10%, rgba(255, 102, 0, 0.08), transparent 55%),
        radial-gradient(400px 250px at 10% 80%, rgba(255, 102, 0, 0.05), transparent 60%),
        var(--bg-2);
    overflow: hidden;
    display: grid;
    place-items: center;
}

.home-hero__visual::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(90deg, rgba(15,23,42,0.04) 1px, transparent 1px),
        linear-gradient(0deg, rgba(15,23,42,0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(circle at center, black 40%, transparent 85%);
}

.home-hero__stats {
    position: absolute;
    top: 24px;
    left: 24px;
    display: grid;
    gap: 6px;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    z-index: 2;
}

.home-hero__stats em {
    font-style: normal;
    font-size: 28px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
    letter-spacing: -0.02em;
    display: block;
    text-transform: none;
    margin-bottom: 2px;
}

/* -------- DATA TABLE -------- */

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 10px 16px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
.data-table td {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--ink);
    border-bottom: 1px solid rgba(15, 23, 42, 0.04);
}
.data-table tr:hover td { background: rgba(15, 23, 42, 0.02); }

/* -------- UTILITIES -------- */

.hidden { display: none !important; }
.block { display: block; }
.text-center { text-align: center; }
.gap-xs { gap: 6px; }
.gap-sm { gap: 10px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.mt-0 { margin-top: 0; }
.mt-sm { margin-top: 10px; }
.mt-md { margin-top: 20px; }
.mt-lg { margin-top: 32px; }
.mb-md { margin-bottom: 20px; }

.divider {
    height: 1px;
    background: var(--line);
    width: 100%;
    margin: 8px 0;
}

/* -------- BOT WIZARD -------- */

.wizard-shell {
    max-width: 960px;
    margin: 0 auto;
    display: grid;
    gap: 28px;
}

.wizard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
}

.wizard-steps {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.wizard-steps li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--bg-2);
}

.wizard-steps li.is-active { color: var(--lime); border-color: var(--lime-soft); background: var(--lime-soft); }
.wizard-steps li.is-done { color: var(--ink); border-color: var(--line-strong); }

.wizard-steps li::before {
    content: counter(li);
    counter-increment: li;
    font-family: var(--mono);
    opacity: 0.7;
}

.wizard-steps { counter-reset: li; }

.ai-discover {
    display: grid;
    gap: 20px;
    padding: 32px;
    border: 1px solid var(--lime-soft);
    border-radius: var(--r-2xl);
    background:
        radial-gradient(500px 240px at 100% 0%, rgba(255, 102, 0, 0.06), transparent 70%),
        linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
    position: relative;
}

.ai-discover::before {
    content: "";
    position: absolute;
    top: -1px; left: 24px; right: 24px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--lime), transparent);
}

.ai-mark {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--lime-soft);
    border: 1px solid var(--lime-soft);
    color: var(--lime);
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    width: fit-content;
}

.ai-mark::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--lime);
    box-shadow: 0 0 8px var(--lime);
    animation: pulse 2.2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.big-input {
    width: 100%;
    padding: 22px 24px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-xl);
    background: var(--bg-0);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 22px;
    letter-spacing: -0.01em;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.big-input:focus {
    outline: none;
    border-color: var(--lime);
    box-shadow: var(--ring-lime);
}

.big-input::placeholder { color: var(--faint); }

.preview-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.preview-pill-row span {
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    background: var(--bg-2);
}

/* Analysis pending animation */
.scan-line {
    position: relative;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg-2);
    overflow: hidden;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--ink-soft);
    letter-spacing: 0.04em;
}

.scan-line::after {
    content: "";
    position: absolute;
    top: 0; left: -50%;
    width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 102, 0, 0.2), transparent);
    animation: scan 1.6s linear infinite;
}

@keyframes scan {
    0% { left: -50%; }
    100% { left: 100%; }
}

/* -------- RESPONSIVE -------- */

@media (max-width: 1080px) {
    .grid--sidebar, .grid--sidebar-reverse { grid-template-columns: 1fr; }
    .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .home-hero { grid-template-columns: 1fr; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-aside { min-height: auto; }
    .auth-aside__inner {
        min-height: auto;
        padding: 36px 28px;
    }
    .auth-hero-copy { margin-top: 34px; }
    .auth-hero-copy h1 { font-size: 32px; }
    .auth-hero-copy p { margin-top: 16px; }
    .auth-feature-list,
    .auth-copyright { display: none; }
    .auth-main { padding: 42px 24px; }
    .auth-mobile-logo { display: flex; }
}

@media (max-width: 880px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--line);
        grid-template-rows: auto;
    }
    .sidenav { flex-direction: row; overflow-x: auto; gap: 4px; padding: 8px; }
    .sidenav__group { flex-direction: row; padding: 0; gap: 4px; }
    .sidenav__label { display: none; }
    .sidenav__item { white-space: nowrap; }
    .sidenav__item.is-active::before { display: none; }
    .sidebar__user { display: none; }
    .main__content { padding: 20px; }
    .topbar { padding: 14px 20px; }

    .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: 1fr; }

    .page-head { grid-template-columns: 1fr; align-items: flex-start; }

    .home-hero { padding: 40px 20px; gap: 32px; }
    .display { font-size: 44px; }
}

@media (max-width: 560px) {
    .stat-grid { grid-template-columns: 1fr; }
    .widget-preview { width: calc(100% - 48px); }
    .widget-panel { width: 100%; }
}

/* ==========================================================================
   AI EDIT POPOVER + DIFF MODAL
   ========================================================================== */

.ai-popover {
    position: relative;
    margin-top: 10px;
    padding: 14px;
    border: 1px solid var(--lime-soft);
    border-radius: var(--r-lg);
    background: linear-gradient(180deg, rgba(255, 102, 0, 0.04) 0%, var(--bg-2) 100%);
    display: grid;
    gap: 10px;
    animation: aiPopIn 160ms ease both;
}
@keyframes aiPopIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ai-popover__head { display: grid; gap: 4px; }
.ai-popover textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-0);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    color: var(--ink);
    font-size: 13.5px;
    font-family: var(--sans);
    line-height: 1.5;
    outline: none;
    resize: vertical;
    min-height: 90px;
}
.ai-popover textarea:focus {
    border-color: var(--lime);
    box-shadow: var(--ring-lime);
}
.ai-popover__actions { display: flex; gap: 8px; justify-content: flex-end; }

.ai-diff-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display: grid;
    place-items: center;
    padding: 28px;
    animation: aiFade 180ms ease both;
}
@keyframes aiFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.ai-diff {
    width: min(980px, 100%);
    max-height: min(860px, calc(100vh - 60px));
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    background: var(--bg-1);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-2xl);
    box-shadow: var(--shadow-pop);
    overflow: hidden;
}
.ai-diff__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 22px 24px 16px;
    border-bottom: 1px solid var(--line);
}
.ai-diff__tabs {
    display: flex;
    gap: 4px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--bg-2);
}
.ai-diff__tab {
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
    font: inherit;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 7px;
    cursor: pointer;
    letter-spacing: 0.02em;
}
.ai-diff__tab:hover { color: var(--ink); }
.ai-diff__tab.is-active {
    background: var(--bg-3);
    border-color: var(--line-strong);
    color: var(--ink);
}
.ai-diff__body {
    overflow: auto;
    padding: 0;
    background: var(--bg-0);
}
.ai-diff__pane {
    margin: 0;
    padding: 20px 24px;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.75;
    color: var(--ink-soft);
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 300px;
    display: block;
}
.ai-diff__pane.hidden { display: none; }
.ai-diff__pane--editor {
    width: 100%;
    border: 0;
    outline: none;
    background: var(--bg-0);
    color: var(--ink);
    resize: none;
    font-family: var(--mono);
}
.ai-diff__pane .dl {
    display: block;
    padding: 1px 6px;
    margin: 0 -6px;
    border-radius: 3px;
}
.ai-diff__pane .dl--add {
    background: rgba(16, 185, 129, 0.1);
    color: #065f46;
    border-left: 2px solid var(--success);
    padding-left: 10px;
}
.ai-diff__pane .dl--rem {
    background: rgba(239, 68, 68, 0.08);
    color: #991b1b;
    border-left: 2px solid var(--ember);
    padding-left: 10px;
    text-decoration: line-through;
    text-decoration-thickness: 1px;
    text-decoration-color: rgba(239, 68, 68, 0.4);
}
.ai-diff__actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--line);
    background: var(--bg-2);
}

/* ============================================================
   CONFIRM MODAL — destructive-action confirmation dialog
   Uses <dialog>.showModal() for native focus-trap + Escape
   dismissal. Backdrop styled via ::backdrop.
   ============================================================ */

.confirm-modal {
    padding: 0;
    width: min(480px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-xl, 14px);
    background: var(--bg-1);
    box-shadow: var(--shadow-pop, 0 24px 48px -12px rgba(15, 23, 42, 0.28));
    color: var(--ink);
    overflow: hidden;
}

.confirm-modal::backdrop {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.confirm-modal__form {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 0;
}

.confirm-modal__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px 14px;
    border-bottom: 1px solid var(--line);
}

.confirm-modal__icon {
    flex-shrink: 0;
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: var(--ember-soft);
    color: var(--ember);
    font-weight: 700;
    font-size: 18px;
}

.confirm-modal__title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.confirm-modal__body {
    padding: 18px 24px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--ink);
    overflow-y: auto;
}

.confirm-modal__body p { margin: 0 0 10px; }
.confirm-modal__body p:last-child { margin-bottom: 0; }
.confirm-modal__body ul { margin: 6px 0 10px; padding-left: 20px; color: var(--muted); }
.confirm-modal__body ul li { margin-bottom: 4px; }

.confirm-modal__type-input {
    font-family: var(--mono, 'SF Mono', Menlo, monospace);
    font-size: 14px;
}

.confirm-modal__foot {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 14px 24px;
    border-top: 1px solid var(--line);
    background: var(--bg-2);
}

/* Danger button — red fill, red hover, readable white text.
   Used only for irreversible actions. */
.btn--danger {
    background: var(--ember);
    color: #ffffff;
    border-color: var(--ember);
}
.btn--danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
}
.btn--danger:disabled {
    background: rgba(239, 68, 68, 0.45);
    border-color: rgba(239, 68, 68, 0.45);
    cursor: not-allowed;
}

/* ============================================================
   BOT EDIT PAGE — section-aware 2-col grid + jump nav +
   always-visible save bar. Scoped to .bot-edit-form so it
   doesn't leak into other forms using the same partial.
   ============================================================ */

/* Anchor padding so in-page jump links don't hide the section
   heading under whatever is sticky above (breadcrumb header, etc.) */
.bot-edit-form [id^="section-"] {
    scroll-margin-top: 86px;
}

/* Jump strip — one row of anchor links for quick navigation. */
.bot-edit-jump {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    margin-bottom: 20px;
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    position: sticky;
    top: 0;
    z-index: 40;
}
.bot-edit-jump a {
    padding: 6px 12px;
    border-radius: var(--r-md, 6px);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    transition: background 120ms, color 120ms;
}
.bot-edit-jump a:hover {
    background: var(--bg-2);
    color: var(--ink);
}

/* Vertical stack — each form section takes the full width of the
   main editing column. A previous iteration used a nested 2-col
   grid here but combined with .grid--sidebar above it, every form
   field ended up crushed into ~185px columns with wrapping labels
   and awkward inputs. The internal .form-grid inside each section
   still goes 2-col where the content supports it, so "compact"
   sections (Bot basics, Lead handoff) still show name+slug side
   by side — just at a readable width, not the previous pinched
   quarter-width. Wide sections (Answer rules, Lead capture form)
   retain their full-column layout as before.
   Cap the stack width on ultra-wide screens so single-line text
   inputs don't stretch to 1400px and feel ludicrous. */
.bot-edit-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 900px;
}
.bot-edit-layout > [data-col] {
    width: 100%;
}

/* Sticky save bar — pinned to the bottom of the viewport so the
   operator can save from anywhere in the form. Backdrop blur keeps
   form content legible as it scrolls underneath. */
.bot-edit-savebar {
    position: sticky;
    bottom: 0;
    z-index: 50;
    margin: 0 -4px;
    padding: 8px 4px;
    background: linear-gradient(to bottom, transparent 0%, rgba(248, 250, 252, 0.92) 40%, rgba(248, 250, 252, 0.98) 100%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.bot-edit-savebar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: var(--r-xl);
    box-shadow: 0 12px 28px -14px rgba(15, 23, 42, 0.22);
}
.bot-edit-savebar__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.bot-edit-savebar__meta strong {
    font-size: 14px;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bot-edit-savebar__actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}
@media (max-width: 640px) {
    .bot-edit-savebar__inner {
        flex-direction: column;
        align-items: stretch;
        padding: 12px 14px;
    }
    .bot-edit-savebar__meta {
        text-align: center;
    }
    .bot-edit-savebar__actions {
        justify-content: stretch;
    }
    .bot-edit-savebar__actions .btn {
        flex: 1;
    }
}
