:root {
    --ea-primary: oklch(0.45 0.115 258);
    --ea-shell: oklch(0.28 0.035 262);
    --ea-accent: oklch(0.45 0.115 195);
    --ea-canvas: oklch(0.955 0.005 255);
    --ea-success: oklch(0.55 0.12 150);
    --ea-warning: oklch(0.72 0.13 75);
    --ea-danger: oklch(0.52 0.15 25);
    --ea-line: oklch(0.90 0.008 260);
    --ea-text: oklch(0.26 0.02 260);
    --ea-muted: oklch(0.52 0.015 260);
    --bs-primary: #355ea6;
    --bs-body-font-family: "Sarabun", "Noto Sans Thai", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--ea-canvas);
    color: var(--ea-text);
    font-family: var(--bs-body-font-family);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--ea-primary); }
a:hover { color: oklch(0.38 0.12 258); }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
    outline: 3px solid var(--ea-accent);
    outline-offset: 3px;
}

.skip-link {
    position: fixed;
    z-index: 1100;
    top: 8px;
    left: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: white;
    transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex: 0 0 236px;
    flex-direction: column;
    height: 100vh;
    background: var(--ea-shell);
    color: white;
}
.app-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 12px 16px;
    border-bottom: 1px solid rgb(255 255 255 / 12%);
    font-size: 14px;
    font-weight: 600;
}
.app-brand-mark {
    display: grid;
    width: 34px;
    height: 34px;
    flex: none;
    place-items: center;
    border-radius: 8px;
    background: rgb(255 255 255 / 14%);
    font-family: "IBM Plex Mono", ui-monospace, monospace;
}
.app-brand > span:last-child { min-width: 0; }
.app-nav { display: flex; flex-direction: column; gap: 4px; padding: 16px 10px; }
.app-nav-link, .app-nav-disabled {
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgb(255 255 255 / 82%);
    text-decoration: none;
}
.app-nav-link.active { background: rgb(255 255 255 / 14%); color: white; font-weight: 600; }
.app-nav-section {
    margin-top: 12px;
    padding: 8px 12px 4px;
    color: rgb(255 255 255 / 48%);
    font: 500 11px/1 "IBM Plex Mono", ui-monospace, monospace;
    letter-spacing: 0.12em;
}
.app-nav-disabled { color: rgb(255 255 255 / 48%); }
.app-environment {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding: 14px 16px;
    border-top: 1px solid rgb(255 255 255 / 12%);
    font: 500 11px/1 "IBM Plex Mono", ui-monospace, monospace;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ea-success); }
.app-workspace { min-width: 0; flex: 1; }
.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    padding: 0 24px;
    border-bottom: 1px solid var(--ea-line);
    background: white;
    font-size: 13px;
}
.version-badge, code { font-family: "IBM Plex Mono", ui-monospace, monospace; }
.version-badge { padding: 5px 9px; border-radius: 6px; background: oklch(0.96 0.02 258); }
.app-main { width: min(1120px, 100%); margin: 0 auto; padding: 40px 28px 64px; }
.eyebrow { color: var(--ea-primary); font: 600 12px/1 "IBM Plex Mono", ui-monospace, monospace; letter-spacing: 0.14em; }
h1 { max-width: 780px; margin: 12px 0; font-size: clamp(28px, 4vw, 40px); font-weight: 600; letter-spacing: -0.01em; }
.lead { max-width: 760px; color: var(--ea-muted); font-size: 16px; }
.foundation-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 32px; }
.foundation-card { padding: 20px; border: 1px solid var(--ea-line); border-radius: 12px; background: white; }
.foundation-card h2 { margin: 14px 0 8px; font-size: 17px; font-weight: 600; }
.foundation-card p { margin: 0; color: var(--ea-muted); font-size: 14px; }
.foundation-status { display: inline-flex; padding: 5px 9px; border-radius: 6px; font: 500 11px/1 "IBM Plex Mono", ui-monospace, monospace; }
.status-success { background: oklch(0.94 0.05 150); color: oklch(0.34 0.09 150); }
.status-neutral { background: oklch(0.96 0.02 258); color: oklch(0.38 0.11 258); }
.status-warning { background: oklch(0.97 0.03 75); color: oklch(0.42 0.11 60); }
.feedback-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    margin-top: 20px;
    padding: 14px 16px;
    border: 1px solid oklch(0.9 0.03 258);
    border-radius: 10px;
    background: oklch(0.96 0.02 258);
    font-size: 13px;
}
.feedback-panel code { margin-left: auto; color: var(--ea-muted); font-size: 12px; }

@media (max-width: 767.98px) {
    body { font-size: 15px; }
    .app-shell { display: block; }
    .app-sidebar { position: relative; width: 100%; height: auto; }
    .app-brand { padding-right: 104px; }
    .app-nav { display: none; }
    .app-environment { position: absolute; top: 22px; right: 16px; border: 0; padding: 0; }
    .app-topbar { padding: 0 16px; }
    .app-main { padding: 28px 18px 48px; }
    .foundation-grid { grid-template-columns: 1fr; }
    .feedback-panel code { width: 100%; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Setup wizard (S14) — no sidebar, chrome-bar-only shell */
.setup-chrome-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    padding: 0 20px;
    background: var(--ea-shell);
    color: white;
    font-size: 13px;
}
.setup-chrome-bar .version-tag { color: rgb(255 255 255 / 60%); font-family: "IBM Plex Mono", ui-monospace, monospace; }
.setup-main { width: min(1000px, 100%); margin: 0 auto; padding: 32px 20px 64px; }
.setup-stepper { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.setup-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--ea-line);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ea-muted);
}
.setup-pill.is-active { border-color: var(--ea-primary); background: oklch(0.96 0.02 258); color: var(--ea-primary); }
.setup-pill.is-done { border-color: var(--ea-success); background: oklch(0.94 0.05 150); color: oklch(0.34 0.09 150); }
.setup-card { padding: 24px; border: 1px solid var(--ea-line); border-radius: 12px; background: white; }
.setup-status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--ea-line);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13.5px;
}
.setup-status-icon { flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: white; }
.setup-status-row.is-pass .setup-status-icon { background: var(--ea-success); }
.setup-status-row.is-pass { border-color: oklch(0.85 0.06 150); }
.setup-status-row.is-warn .setup-status-icon { background: var(--ea-warning); }
.setup-status-row.is-warn { border-color: oklch(0.85 0.08 75); }
.setup-status-row.is-fail .setup-status-icon { background: var(--ea-danger); }
.setup-status-row.is-fail { border-color: oklch(0.85 0.1 25); }
.setup-status-message { margin-left: auto; color: var(--ea-muted); font-size: 12.5px; }
.setup-blocking-panel,
.setup-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    margin-top: 16px;
    margin-bottom: 4px;
    border: 1px solid oklch(0.85 0.1 25);
    border-left: 4px solid var(--ea-danger);
    border-radius: 10px;
    background: oklch(0.97 0.02 25);
    color: oklch(0.4 0.13 25);
    font-size: 13.5px;
    box-shadow: 0 1px 2px rgb(0 0 0 / 4%);
}
.setup-alert::before {
    content: "✕";
    flex: none;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    margin-top: 1px;
    border-radius: 50%;
    background: var(--ea-danger);
    color: white;
    font-size: 12px;
    font-weight: 700;
}
.setup-alert-title { display: block; margin-bottom: 2px; font-weight: 700; color: oklch(0.32 0.14 25); }
.setup-alert-body { display: block; color: oklch(0.4 0.1 25); }
.setup-alert-success { border-left-color: var(--ea-success); background: oklch(0.96 0.03 150); }
.setup-alert-success::before { content: "✓"; background: var(--ea-success); }
.setup-alert-success .setup-alert-title { color: oklch(0.3 0.09 150); }
.setup-alert-success .setup-alert-body { color: oklch(0.36 0.07 150); }
.setup-alert-info { border-left-color: var(--ea-primary); background: oklch(0.96 0.02 258); }
.setup-alert-info::before { content: "i"; background: var(--ea-primary); font-style: italic; font-family: Georgia, serif; }
.setup-alert-info .setup-alert-title { color: oklch(0.32 0.1 258); }
.setup-alert-info .setup-alert-body { color: oklch(0.4 0.08 258); }
.setup-field { display: block; margin-bottom: 16px; }
.setup-field label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.setup-field input, .setup-field select {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--ea-line);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}
.setup-review-panel { padding: 16px; border: 1px solid var(--ea-line); border-radius: 10px; background: oklch(0.98 0.005 255); }
.setup-review-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13.5px; border-bottom: 1px solid var(--ea-line); }
.setup-review-row:last-child { border-bottom: 0; }
.setup-review-row .masked { font-family: "IBM Plex Mono", ui-monospace, monospace; color: var(--ea-muted); }

@media (max-width: 767.98px) {
    .setup-main { padding: 24px 14px 48px; }
    .setup-review-row { flex-direction: column; gap: 2px; }
}
