:root {
    --bg: #EEF5FC;
    --surface: #FFFFFF;
    --ink: #0F2236;
    --ink-2: #33465A;
    --muted: #5A6B7E;
    --line: #DCE7F2;
    --line-strong: #C9D8E8;
    --nav-active: #DCEBFA;
    --accent: #F26B2A;
    --accent-ink: #C2410C;
    --accent-soft: #FFF4EC;
    --font: 'Geist', system-ui, sans-serif;
    --mono: 'Geist Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
}

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

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; }
.mono { font-family: var(--mono); }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 44px; padding: 0 18px; border-radius: 10px;
    border: 1px solid var(--line-strong); background: transparent; color: var(--ink);
    font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer;
}
.btn--sm { height: 40px; padding: 0 14px; border-radius: 9px; font-weight: 400; }
.btn--primary { border: none; background: var(--accent); font-weight: 600; }
.btn--primary:hover { color: var(--ink); }
.btn--ghost { border: none; color: var(--muted); font-weight: 400; }

/* App shell */
.topbar { border-bottom: 1px solid var(--line); }
.topbar__inner {
    max-width: 1040px; margin: 0 auto; padding: 0 24px; height: 64px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.topbar__left { display: flex; align-items: center; gap: 32px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; text-decoration: none; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 8px 12px; border-radius: 8px; font-size: 14px; text-decoration: none; color: var(--muted); }
.nav a[aria-current="page"] { background: var(--nav-active); color: var(--ink); font-weight: 500; }
.topbar__right { display: flex; align-items: center; gap: 12px; }
.topbar__right a { font-size: 14px; color: var(--muted); text-decoration: none; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%; background: var(--line);
    display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
}

.page { max-width: 1040px; margin: 0 auto; padding: 40px 24px 80px; }
.page h1 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }

.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px;
    display: flex; flex-direction: column; gap: 20px;
}
.card h2 { margin: 0; font-size: 16px; font-weight: 600; }
.card p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); }

/* Sign in */
.landing { min-height: 100vh; display: flex; flex-direction: column; }
.landing__header { display: flex; align-items: center; justify-content: space-between; padding: 24px 32px; gap: 16px; flex-wrap: wrap; }
.landing__header .brand { font-size: 18px; letter-spacing: -0.01em; }
.landing__header a.how { font-size: 14px; color: var(--muted); text-decoration: none; }
.landing__main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 48px 20px 80px; }
.landing__col { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 40px; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-ink); }
.landing h1 { margin: 0; font-size: 44px; line-height: 1.08; font-weight: 600; letter-spacing: -0.03em; }
.lede { margin: 0; font-size: 16px; line-height: 1.6; color: var(--muted); }
.example { padding: 20px; gap: 10px; border-radius: 14px; }
.example__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.example__title { font-size: 15px; font-weight: 500; }
.example__when { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.example__desc { font-family: var(--mono); font-size: 13px !important; line-height: 1.6 !important; color: var(--ink-2) !important; }
.example__note { font-size: 12px; color: var(--muted); }
.connect { display: flex; flex-direction: column; gap: 14px; }
.connect .btn { height: 52px; font-size: 16px; gap: 10px; border-radius: 10px; }
.connect p { font-size: 13px; line-height: 1.5; color: var(--muted); text-align: center; margin: 0; }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; border-top: 1px solid var(--line); padding-top: 24px; }
.steps__item { display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.steps__num { font-family: var(--mono); font-size: 12px; color: var(--accent-ink); }
.landing__footer {
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
    padding: 20px 32px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line);
}
.landing__footer nav { display: flex; gap: 20px; }
.landing__footer a { color: var(--muted); text-decoration: none; }

/* Dashboard */
.stack { display: flex; flex-direction: column; gap: 32px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head__text { display: flex; flex-direction: column; gap: 6px; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #22A05B; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.stat__label { font-size: 13px; color: var(--muted); }
.stat__value { font-family: var(--mono); font-size: 26px; font-weight: 500; }
.stat__value small { font-size: 14px; color: var(--muted); }
.stat__value--text { font-family: var(--font); font-size: 20px; line-height: 1.5; }
.banner {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    padding: 14px 18px; border-radius: 12px; border: 1px solid #F8C9A8; background: var(--accent-soft);
}
.banner span { font-size: 14px; color: #7A2E0A; }
.banner a { font-size: 14px; font-weight: 600; color: var(--accent-ink); text-decoration: none; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.segmented { display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.segmented a { height: 32px; padding: 0 12px; display: flex; align-items: center; border-radius: 7px; font-size: 13px; color: var(--muted); text-decoration: none; }
.segmented a[aria-current="true"] { background: var(--line); color: var(--ink); }
.table-wrap { border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; background: var(--surface); }
.table { min-width: 880px; }
.table__row {
    display: grid; grid-template-columns: minmax(200px, 2fr) 120px minmax(170px, 1.7fr) 96px 110px 96px 44px;
    gap: 16px; align-items: center; padding: 12px 20px; background: var(--surface);
}
.table__row + .table__row { border-top: 1px solid #E8EFF7; }
.table__row:nth-child(even) { background: #FAFCFE; }
.table__head {
    background: #F2F7FC !important; border-bottom: 1px solid var(--line);
    font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.cell-activity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-icon { width: 34px; height: 34px; flex: none; border-radius: 9px; background: #FFF1E8; color: var(--accent-ink); display: flex; align-items: center; justify-content: center; }
.cell-stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cell-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-sub { font-size: 12px; color: var(--muted); }
.cell-mono { font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
.cell-cond { font-size: 14px; }
.cell-cond--note { font-size: 13px; color: var(--muted); font-style: italic; }
.cell-temp { align-items: flex-end; }
.cell-temp strong { font-family: var(--mono); font-size: 15px; font-weight: 500; }
.pill { font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 999px; }
.pill--synced { color: #1E7A46; background: #E3F6EA; }
.pill--skipped { color: var(--ink-2); background: #EEF3F8; }
.pill--failed { color: #B4321F; background: #FDE8E4; }
.ext-link { color: var(--muted); display: flex; width: 32px; height: 32px; border-radius: 8px; align-items: center; justify-content: center; }
.empty { padding: 32px 20px; text-align: center; font-size: 14px; color: var(--muted); }
.more { display: flex; justify-content: center; padding-top: 8px; }

/* Settings */
.settings { display: flex; flex-wrap: wrap; gap: 40px; align-items: flex-start; }
.settings__nav { flex: 1 1 180px; max-width: 200px; display: flex; flex-direction: column; gap: 2px; }
.settings__nav button {
    text-align: left; min-height: 40px; padding: 9px 12px; border: none; border-radius: 8px;
    background: transparent; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer;
}
.settings__nav button[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: 0 1px 2px rgba(15, 34, 54, .08); }
.settings__body { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.settings__body h1 { margin-bottom: 4px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.row__text { display: flex; flex-direction: column; gap: 4px; }
.label { font-size: 14px; color: var(--muted); }
.value { font-size: 15px; }
.value strong { font-weight: 600; }
.divider { height: 1px; background: var(--line); }
.badge { font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: #EEF3F8; color: var(--ink-2); }
.badge--premium { padding: 3px 8px; background: #FFF1E8; color: var(--accent-ink); }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 14px; color: var(--muted); }
.field .hint { font-size: 13px; color: var(--muted); }
.input, .select, .textarea {
    padding: 0 14px; border-radius: 9px; border: 1px solid var(--line-strong);
    background: var(--bg); color: var(--ink); font: inherit; font-size: 15px;
}
.input, .select { height: 44px; }
.input { max-width: 420px; }
.textarea { width: 100%; padding: 12px 14px; font-family: var(--mono); font-size: 14px; line-height: 1.6; resize: vertical; }
.card--toggles { padding-bottom: 8px; gap: 0; }
.card--toggles h2 { margin-bottom: 4px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; }
.toggle-row + .toggle-row { border-top: 1px solid var(--line); }
.toggle-row__text { display: flex; flex-direction: column; gap: 4px; flex: 1 1 260px; min-width: 0; }
.toggle-row__title { font-size: 15px; font-weight: 500; }
.toggle-row__desc { font-size: 14px; color: var(--muted); line-height: 1.45; }
.switch {
    flex: none; width: 46px; height: 28px; border-radius: 999px; border: none; padding: 3px; cursor: pointer;
    display: flex; align-items: center; justify-content: flex-start; background: var(--line-strong);
}
.switch[aria-pressed="true"] { background: var(--accent); justify-content: flex-end; }
.switch__knob { width: 22px; height: 22px; border-radius: 50%; background: #fff; display: block; box-shadow: 0 1px 2px rgba(15, 34, 54, .2); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
fieldset { border: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.provider {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-height: 56px; padding: 12px 16px;
    border-radius: 10px; border: 1px solid var(--line); background: var(--bg); cursor: pointer;
}
.provider:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.provider--locked { cursor: not-allowed; opacity: .7; }
.provider input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent-ink); }
.provider__name { flex: 1; font-size: 15px; font-weight: 500; }
.provider__window { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.tokens { display: flex; flex-wrap: wrap; gap: 6px; }
.token {
    height: 32px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line-strong);
    background: var(--bg); color: var(--ink-2); font-family: var(--mono); font-size: 12px; cursor: pointer;
}
.preview { border-radius: 10px; border: 1px dashed var(--line-strong); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.preview__label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.preview__text { font-size: 15px; line-height: 1.55; }
.actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 8px; }
[hidden] { display: none !important; }

@media (max-width: 640px) {
    .stats { grid-template-columns: 1fr; }
    .landing h1 { font-size: 34px; }
    .grid-2 { grid-template-columns: 1fr; }
}

/* Auth forms */
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form .input { width: 100%; max-width: none; }
.auth-form ul { margin: 0; padding: 0; list-style: none; font-size: 13px; color: #B4321F; }
.auth-form .btn { height: 52px; font-size: 16px; border-radius: 10px; }
.alert { padding: 12px 16px; border-radius: 10px; border: 1px solid #F3B7AD; background: #FDE8E4; color: #B4321F; font-size: 14px; }
.alert--success { border-color: #B7E4C7; background: #E3F6EA; color: #1E7A46; }
