/* Economico — Design System
   See DESIGN.md for tokens, rules, and rationale.
   Editorial financial: Plex Serif / Plex Sans / Plex Mono on white,
   with Ledger Red reserved for action, alert, and negative numbers. */

:root {
    /* color */
    --bg: #FFFFFF;
    --ink: #000000;
    --ink-muted: #4A4A4A;
    --ink-subtle: #8A8A8A;
    --rule-soft: #E5E5E5;
    --surface-code: #F7F7F7;
    --ledger-red: #D32F2F;
    --ledger-red-press: #B71C1C;

    /* type */
    --font-serif: 'IBM Plex Serif', Georgia, serif;
    --font-sans:  'IBM Plex Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-mono:  'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;

    /* scale */
    --text-hero:  clamp(36px, 5vw, 56px);
    --text-h2:    32px;
    --text-h3:    24px;
    --text-h4:    18px;
    --text-body:  16px;
    --text-small: 14px;
    --text-micro: 12px;

    /* spacing */
    --s-2xs: 2px; --s-xs: 4px; --s-sm: 8px; --s-md: 16px;
    --s-lg: 24px; --s-xl: 40px; --s-2xl: 64px; --s-3xl: 96px;

    /* motion */
    --ease-out: cubic-bezier(0.2, 0, 0, 1);
    --dur-micro: 80ms;
    --dur-short: 160ms;
    --dur-medium: 240ms;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: var(--text-body);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ----------------------- Typography ----------------------- */

h1, h2 {
    font-family: var(--font-serif);
    font-weight: 600;
    line-height: 1.15;
    color: var(--ink);
    margin: 0 0 var(--s-md) 0;
}

h3, h4 {
    font-family: var(--font-sans);
    font-weight: 600;
    line-height: 1.25;
    color: var(--ink);
    margin: 0 0 var(--s-sm) 0;
}

h1 { font-size: var(--text-hero); letter-spacing: -0.01em; }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); }
h4 { font-size: var(--text-h4); }

p { margin: 0 0 var(--s-md) 0; }
p:last-child { margin-bottom: 0; }

a {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: color var(--dur-short) var(--ease-out);
}

a:hover { color: var(--ledger-red); }
a:focus-visible { outline: 2px solid var(--ledger-red); outline-offset: 2px; }

.skip-link {
    position: fixed;
    top: var(--s-md);
    left: var(--s-md);
    z-index: 1000;
    background: var(--ink);
    color: var(--bg);
    padding: var(--s-sm) var(--s-md);
    transform: translateY(calc(-100% - var(--s-md)));
}

.skip-link:focus {
    transform: translateY(0);
    color: var(--bg);
}

.subtitle {
    font-family: var(--font-mono);
    font-size: var(--text-micro);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink);
    margin: 0 0 var(--s-lg) 0;
}

.eyebrow {
    font-family: var(--font-mono);
    font-size: var(--text-micro);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink);
    margin: 0 0 var(--s-sm) 0;
}

.lede {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: var(--text-h4);
    line-height: 1.5;
    color: var(--ink-muted);
}

.num, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ----------------------- Layout ----------------------- */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--s-2xl) var(--s-xl) var(--s-3xl);
    position: relative;
}

@media (max-width: 768px) {
    .container { padding: var(--s-xl) var(--s-md) var(--s-2xl); }
}

main > section { margin-bottom: var(--s-3xl); }
main > section:last-child { margin-bottom: 0; }

/* ----------------------- Masthead / Header ----------------------- */

.masthead {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s-lg);
    padding-bottom: var(--s-md);
    border-bottom: 1px solid var(--ink);
    margin-bottom: var(--s-2xl);
}

.logo {
    font-family: var(--font-serif);
    font-size: var(--text-h3);
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.logo .logo-mark {
    display: block;
    width: 28px;
    height: auto;
}

.masthead nav {
    display: flex;
    align-items: baseline;
    gap: var(--s-lg);
    font-family: var(--font-sans);
    font-size: var(--text-small);
}

.masthead nav a { text-decoration: none; }
.masthead nav a:hover { text-decoration: underline; }

.masthead a.logo { text-decoration: none; }

@media (max-width: 768px) {
    .masthead {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* ----------------------- Editorial pages ----------------------- */

.page-main {
    max-width: 820px;
}

.page-article h1 {
    max-width: 18ch;
    margin-bottom: var(--s-lg);
}

.page-article .lede {
    margin-bottom: var(--s-2xl);
}

.page-article section {
    border-top: 1px solid var(--ink);
    padding-top: var(--s-lg);
    margin-top: var(--s-xl);
}

.page-article section h2 {
    font-size: var(--text-h3);
    margin-bottom: var(--s-md);
}

/* ----------------------- Buttons ----------------------- */

.btn,
a.btn {
    display: inline-block;
    font-family: var(--font-sans);
    font-size: var(--text-small);
    font-weight: 500;
    line-height: 1;
    padding: 12px 20px;
    border: 1px solid currentColor;
    border-radius: 0;
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--dur-short) var(--ease-out),
                color var(--dur-short) var(--ease-out);
}

.btn-primary,
a.btn-primary {
    background: var(--ledger-red);
    color: #FFFFFF;
    border-color: var(--ledger-red);
}
.btn-primary:hover,
a.btn-primary:hover {
    background: var(--ledger-red-press);
    border-color: var(--ledger-red-press);
    color: #FFFFFF;
}

.btn-secondary,
a.btn-secondary {
    background: #FFFFFF;
    color: var(--ink);
    border-color: var(--ink);
}
.btn-secondary:hover,
a.btn-secondary:hover {
    background: var(--ink);
    color: #FFFFFF;
}

.btn:focus-visible { outline: 2px solid var(--ledger-red); outline-offset: 2px; }

/* ----------------------- Hero ----------------------- */

.hero {
    padding: var(--s-xl) 0 var(--s-2xl);
    border-bottom: 1px solid var(--ink);
    margin-bottom: var(--s-2xl);
}

.hero h1 {
    max-width: 16ch;
    margin-bottom: var(--s-lg);
}

.hero .lede { max-width: 60ch; margin-bottom: var(--s-xl); }

.hero-actions {
    display: flex;
    gap: var(--s-md);
    flex-wrap: wrap;
}

/* ----------------------- Features grid ----------------------- */

.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border-top: 1px solid var(--ink);
}

@media (max-width: 900px) {
    .features { grid-template-columns: 1fr; }
}

.feature {
    padding: var(--s-xl) var(--s-lg);
    border-bottom: 1px solid var(--ink);
}

.feature + .feature {
    border-left: 1px solid var(--ink);
}

@media (max-width: 900px) {
    .feature + .feature { border-left: none; }
}

.feature h3 {
    font-family: var(--font-serif);
    font-size: var(--text-h3);
    margin-bottom: var(--s-sm);
}

.feature .feature-label {
    display: block;
    font-family: var(--font-mono);
    font-size: var(--text-micro);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ledger-red);
    margin-bottom: var(--s-md);
}

.feature p { font-size: var(--text-small); color: var(--ink); }

/* ----------------------- Connect / Code section ----------------------- */

.connect h2 { margin-bottom: var(--s-lg); }
.connect .lede { margin-bottom: var(--s-xl); max-width: 60ch; }

.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s-lg);
}

@media (max-width: 900px) {
    .steps { grid-template-columns: 1fr; }
}

.step {
    border-top: 2px solid var(--ink);
    padding-top: var(--s-md);
}

.step .step-number {
    font-family: var(--font-mono);
    font-size: var(--text-micro);
    letter-spacing: 0.12em;
    color: var(--ledger-red);
    margin-bottom: var(--s-xs);
}

.step h4 {
    font-family: var(--font-sans);
    font-size: var(--text-h4);
    margin-bottom: var(--s-md);
}

.codeblock {
    background: var(--surface-code);
    border: 1px solid var(--ink);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
    padding: var(--s-md);
    overflow-x: auto;
    white-space: pre;
    margin: 0;
}

.codeblock-wrap {
    position: relative;
}

.codeblock-wrap .codeblock {
    padding-right: calc(var(--s-md) + 64px);
}

.copy-btn {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    background: var(--ink);
    color: var(--surface-code);
    border: 1px solid var(--ink);
    font-family: var(--font-mono);
    font-size: var(--text-micro);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 4px 10px;
    cursor: pointer;
    line-height: 1.2;
}

.copy-btn:hover {
    background: var(--ledger-red);
    border-color: var(--ledger-red);
}

.copy-btn.copy-btn-done {
    background: var(--ledger-red);
    border-color: var(--ledger-red);
}

p code,
:not(pre) > code {
    font-family: var(--font-mono);
    font-size: 0.92em;
    background: var(--surface-code);
    padding: 1px 4px;
    border: 1px solid var(--rule-soft);
}

/* ----------------------- Dual onboarding paths ----------------------- */

.paths {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: var(--s-xl);
    row-gap: var(--s-2xl);
    margin-bottom: var(--s-xl);
}

@media (max-width: 900px) {
    .paths { grid-template-columns: 1fr; }
}

.path {
    display: flex;
    flex-direction: column;
    border-top: 2px solid var(--ink);
    padding-top: var(--s-lg);
}

.path-tag {
    display: block;
    font-family: var(--font-mono);
    font-size: var(--text-micro);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ledger-red);
    margin-bottom: var(--s-sm);
}

.path-header h3 {
    font-family: var(--font-serif);
    font-size: var(--text-h3);
    font-weight: 600;
    margin: 0 0 var(--s-md) 0;
}

.path-best-for {
    font-size: var(--text-small);
    color: var(--ink-muted);
    margin: 0 0 var(--s-lg) 0;
    min-height: 4.5em;
}

@media (max-width: 900px) {
    .path-best-for { min-height: 0; }
}

/* ----------------------- Example prompts ----------------------- */

.prompts {
    margin-top: var(--s-2xl);
}

.prompts h2 { margin-bottom: var(--s-md); }
.prompts .lede { max-width: 60ch; margin-bottom: var(--s-xl); }

.prompt-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s-lg);
}

@media (max-width: 900px) {
    .prompt-grid { grid-template-columns: 1fr; }
}

.prompt {
    margin: 0;
    border: 1px solid var(--ink);
    padding: var(--s-md) var(--s-md) var(--s-md) var(--s-lg);
    background: var(--bg);
    position: relative;
}

.prompt::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--ledger-red);
}

.prompt-label {
    font-family: var(--font-mono);
    font-size: var(--text-micro);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ledger-red);
    margin-bottom: var(--s-sm);
}

.prompt-body {
    margin: 0;
    font-family: var(--font-serif);
    font-size: var(--text-body);
    line-height: 1.5;
    color: var(--ink);
}

/* ----------------------- Live ledger preview ----------------------- */

.demo-reports h2 {
    text-align: left;
    margin-bottom: var(--s-md);
    padding-bottom: var(--s-sm);
    border-bottom: 1px solid var(--ink);
}

.reports-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-xl);
    width: 100%;
}

@media (max-width: 900px) {
    .reports-grid { grid-template-columns: 1fr; }
}

.report-wrapper {
    background: transparent;
    border: none;
    height: 720px;
    overflow: hidden;
}

.demo-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
}

body.transparent-bg { background: transparent !important; }

/* ----------------------- Agent / Self-register callout ----------------------- */

.callout {
    border-top: 2px solid var(--ink);
    border-bottom: 2px solid var(--ink);
    padding: var(--s-xl) 0;
}

.callout .eyebrow { color: var(--ledger-red); }
.callout h3 {
    font-family: var(--font-serif);
    font-size: var(--text-h2);
    margin-bottom: var(--s-md);
}

/* ----------------------- Footer ----------------------- */

footer {
    margin-top: var(--s-3xl);
    padding-top: var(--s-lg);
    border-top: 1px solid var(--ink);
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s-md);
    font-family: var(--font-sans);
    font-size: var(--text-small);
}

footer .footer-nav {
    display: flex;
    gap: var(--s-md);
    flex-wrap: wrap;
}

footer .copyright {
    font-family: var(--font-mono);
    font-size: var(--text-micro);
    color: var(--ink-muted);
}

/* ----------------------- Tables (embedded reports & ledger data) ----------------------- */

table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    background: transparent;
    margin: 0 0 var(--s-md) 0;
    font-size: var(--text-small);
}

thead th {
    text-align: left;
    font-family: var(--font-mono);
    font-size: var(--text-micro);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink);
    padding: var(--s-sm) var(--s-md);
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--ink);
    background: transparent;
}

thead th.amount { text-align: right; }

tbody td {
    padding: 10px var(--s-md);
    border-bottom: 1px solid var(--rule-soft);
    vertical-align: top;
}

tbody tr:last-child td { border-bottom: 1px solid var(--ink); }

tbody td.amount {
    text-align: right;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

tbody td.code {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--ink-muted);
    white-space: nowrap;
}

.section-header td {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: var(--text-h4);
    padding: var(--s-lg) var(--s-md) var(--s-xs);
    color: var(--ink);
    border-top: 1px solid var(--ink);
    border-bottom: none;
    background: transparent;
}

.section-header:first-child td { border-top: none; }

.total-row td {
    font-family: var(--font-sans);
    font-weight: 600;
    border-top: 1px solid var(--ink);
    border-bottom: none !important;
    padding-top: var(--s-sm);
    padding-bottom: var(--s-sm);
}

.total-row td.amount {
    font-family: var(--font-mono);
}

.grand-total td {
    font-weight: 700;
    font-size: var(--text-body);
    border-top: 3px double var(--ink) !important;
    border-bottom: none !important;
    padding-top: 14px;
    padding-bottom: 14px;
}

.grand-total td.amount {
    font-family: var(--font-mono);
}

.negative { color: var(--ledger-red); }

/* Badges — monochrome by default. The signal is the label, not the colour. */
.badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 6px;
    border: 1px solid var(--ink);
    color: var(--ink);
    background: transparent;
    border-radius: 0;
    white-space: nowrap;
}

.badge-asset,
.badge-equity,
.badge-revenue,
.badge-memo {
    /* default monochrome */
}

.badge-liability,
.badge-expense {
    border-color: var(--ledger-red);
    color: var(--ledger-red);
}

.updated {
    font-family: var(--font-mono);
    font-size: var(--text-micro);
    color: var(--ink-muted);
    text-align: right;
    margin-top: var(--s-md);
}

/* Row update pulse — brief red wash, never green. */
.pulse {
    animation: pulse 480ms var(--ease-out);
}

@keyframes pulse {
    0%   { background-color: rgba(211, 47, 47, 0.12); }
    100% { background-color: transparent; }
}

/* ----------------------- KPI cards ----------------------- */

.kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s-xl);
    padding-top: var(--s-md);
    border-top: 1px solid var(--ink);
}

@media (max-width: 900px) {
    .kpis { grid-template-columns: 1fr; }
}

.kpi-label {
    font-family: var(--font-sans);
    font-size: var(--text-small);
    color: var(--ink);
    margin-bottom: var(--s-xs);
}

.kpi-value {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 48px;
    font-weight: 500;
    line-height: 1.1;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.kpi-value.negative { color: var(--ledger-red); }

.kpi-spark {
    margin-top: var(--s-sm);
    height: 24px;
    width: 100%;
    display: block;
}

/* ----------------------- Single balance card ----------------------- */

.balance-card {
    border: 1px solid var(--ink);
    background: var(--bg);
    padding: var(--s-lg);
    max-width: 420px;
    display: block;
}

.balance-card .account-name {
    font-family: var(--font-serif);
    font-size: var(--text-h3);
    font-weight: 600;
    color: var(--ink);
    margin-bottom: var(--s-xs);
}

.balance-card .account-code {
    font-family: var(--font-mono);
    font-size: var(--text-micro);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
    margin-bottom: var(--s-md);
    display: flex;
    align-items: center;
    gap: var(--s-sm);
}

.balance-card .balance-amount {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 40px;
    font-weight: 600;
    line-height: 1.1;
    color: var(--ink);
    margin: var(--s-md) 0;
}

.balance-card .balance-amount.negative { color: var(--ledger-red); }

.balance-card .detail-row {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: var(--text-small);
    color: var(--ink-muted);
    padding: var(--s-sm) 0;
    border-top: 1px solid var(--rule-soft);
}

.balance-card .detail-row:first-of-type { border-top: 1px solid var(--ink); }

/* ----------------------- Embed layout (iframe-safe) ----------------------- */

body.embed-body {
    background: transparent;
    padding: var(--s-md) var(--s-lg);
}

body.embed-body .container { padding: 0; }

body.embed-body h1 {
    font-family: var(--font-serif);
    font-size: var(--text-h3);
    margin-bottom: var(--s-xs);
}

body.embed-body table { background: transparent; }

body.embed-body thead th,
body.embed-body tbody td { background: transparent; }

/* ----------------------- OAuth browser flow (auth pages) ----------------------- */

.auth-shell {
    max-width: 28rem;
    margin: var(--s-xl) auto;
    padding: var(--s-lg);
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 0.5rem;
}

.auth-header {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    margin-bottom: var(--s-md);
    flex-wrap: wrap;
}

.auth-header h1 {
    font-family: var(--font-serif);
    font-size: var(--text-h3);
    margin: 0;
}

.auth-sub {
    flex-basis: 100%;
    color: var(--muted, #6b7280);
    font-size: var(--text-small);
    margin: 0;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--s-sm);
}

.auth-form label {
    font-weight: 600;
    font-size: var(--text-small);
}

.auth-form input[type="email"],
.auth-form input[type="text"] {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 0.375rem;
    font: inherit;
}

.auth-form .btn {
    align-self: flex-start;
}

.auth-error {
    color: #b91c1c;
    font-size: var(--text-small);
    margin: 0;
}

.auth-help {
    color: var(--muted, #6b7280);
    font-size: var(--text-small);
    margin: 0;
}

.auth-consent ul.auth-scopes {
    margin: var(--s-sm) 0;
    padding-left: 1.25rem;
}

.auth-consent ul.auth-scopes li {
    margin-bottom: 0.25rem;
}

.auth-consent-form .auth-buttons {
    display: flex;
    gap: var(--s-sm);
    justify-content: flex-end;
}

/* ----------------------- WebMCP & Prompt API Playground ----------------------- */

.playground-section {
    margin-bottom: var(--s-3xl);
}

.playground {
    border: 2px solid var(--ink);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    margin-top: var(--s-lg);
    font-family: var(--font-sans);
}

.playground-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--ink);
    padding: var(--s-md) var(--s-lg);
    background: var(--surface-code);
    flex-wrap: wrap;
    gap: var(--s-sm);
}

.playground-title {
    font-family: var(--font-serif);
    font-size: var(--text-h4);
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--s-sm);
}

.playground-statuses {
    display: flex;
    gap: var(--s-md);
    flex-wrap: wrap;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: var(--s-xs);
    font-family: var(--font-mono);
    font-size: var(--text-micro);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--ink-subtle);
    border-radius: 50%;
}

.status-dot.active {
    background: var(--ledger-red);
    box-shadow: 0 0 4px var(--ledger-red);
}

.playground-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 520px;
}

@media (max-width: 900px) {
    .playground-panels {
        grid-template-columns: 1fr;
    }
}

.playground-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.playground-panel.left-panel {
    border-right: 1px solid var(--ink);
}

@media (max-width: 900px) {
    .playground-panel.left-panel {
        border-right: none;
        border-bottom: 1px solid var(--ink);
    }
}

.panel-header {
    font-family: var(--font-mono);
    font-size: var(--text-micro);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-muted);
    border-bottom: 1px solid var(--rule-soft);
    padding: var(--s-sm) var(--s-lg);
    background: var(--bg);
}

.chat-container {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    height: 400px;
}

.chat-history {
    flex-grow: 1;
    overflow-y: auto;
    padding: var(--s-lg);
    display: flex;
    flex-direction: column;
    gap: var(--s-md);
    background: var(--bg);
}

.chat-message {
    max-width: 85%;
    padding: var(--s-md);
    border: 1px solid var(--rule-soft);
    font-size: var(--text-small);
    line-height: 1.5;
}

.chat-message.user {
    align-self: flex-end;
    background: var(--surface-code);
    border-color: var(--ink);
    font-family: var(--font-sans);
}

.chat-message.agent {
    align-self: flex-start;
    background: var(--bg);
    border-color: var(--rule-soft);
    border-left: 3px solid var(--ledger-red);
    font-family: var(--font-serif);
    font-style: italic;
}

.chat-message.system {
    align-self: center;
    max-width: 95%;
    background: var(--surface-code);
    border-color: var(--ledger-red);
    font-family: var(--font-mono);
    font-size: var(--text-micro);
    color: var(--ledger-red);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center;
    padding: var(--s-xs) var(--s-md);
}

.chat-input-area {
    border-top: 1px solid var(--ink);
    background: var(--surface-code);
    padding: var(--s-md);
}

.chat-form {
    display: flex;
    gap: var(--s-sm);
}

.chat-input {
    flex-grow: 1;
    border: 1px solid var(--ink);
    padding: 10px var(--s-md);
    font-family: var(--font-sans);
    font-size: var(--text-small);
    background: var(--bg);
    outline: none;
}

.chat-input:focus {
    border-color: var(--ledger-red);
}

.quick-prompts-row {
    display: flex;
    gap: var(--s-sm);
    flex-wrap: wrap;
    margin-top: var(--s-sm);
}

.quick-prompt-tag {
    font-family: var(--font-mono);
    font-size: var(--text-micro);
    background: var(--bg);
    border: 1px solid var(--ink-subtle);
    padding: 4px var(--s-sm);
    cursor: pointer;
    transition: all var(--dur-short) var(--ease-out);
}

.quick-prompt-tag:hover {
    border-color: var(--ledger-red);
    color: var(--ledger-red);
}

.mcp-console {
    background: var(--surface-code);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 13px;
    padding: var(--s-lg);
    flex-grow: 1;
    overflow-y: auto;
    height: 400px;
    display: flex;
    flex-direction: column;
    gap: var(--s-md);
}

.console-log-entry {
    border: 1px solid var(--rule-soft);
    background: var(--bg);
    padding: var(--s-md);
}

.console-log-header {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    font-size: var(--text-micro);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ledger-red);
    margin-bottom: var(--s-xs);
    border-bottom: 1px solid var(--rule-soft);
    padding-bottom: 2px;
}

.console-log-body {
    white-space: pre-wrap;
    word-break: break-all;
    font-size: var(--text-micro);
    color: var(--ink-muted);
}

.console-log-body span.success { color: #2e7d32; }
.console-log-body span.error { color: var(--ledger-red); }

.mcp-tools-list {
    display: flex;
    flex-direction: column;
    gap: var(--s-sm);
}

.mcp-tool-card {
    border: 1px solid var(--rule-soft);
    background: var(--bg);
    padding: var(--s-sm) var(--s-md);
}

.mcp-tool-name {
    font-weight: bold;
    color: var(--ink);
}

.mcp-tool-desc {
    font-size: var(--text-micro);
    color: var(--ink-muted);
}

[x-cloak] {
    display: none !important;
}

