:root {
    --ink: #172017;
    --paper: #f3efe4;
    --paper-2: #e7e0d0;
    --navy: #13261c;
    --navy-2: #1d3a2c;
    --gold: #c4a35a;
    --gold-2: #e0c37a;
    --moss: #3f6b4e;
    --ok: #2f7d4a;
    --err: #a33b32;
    --info: #2c5c6e;
    --line: rgba(23, 32, 23, .12);
    --shadow: 0 18px 40px rgba(19, 38, 28, .12);
    --sidebar: 272px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: Manrope, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--paper);
    min-height: 100vh;
}
h1, h2, h3, .brand-lockup h1, .page-title {
    font-family: Fraunces, Georgia, serif;
    font-weight: 700;
    letter-spacing: -.02em;
}
a { color: var(--moss); }
code, pre, .mono, textarea.sql {
    font-family: "IBM Plex Mono", Consolas, monospace;
}

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(1200px 500px at 10% -10%, rgba(196,163,90,.25), transparent 50%),
        linear-gradient(160deg, #101c15 0%, #1d3326 42%, #c4a35a 160%);
    padding: 32px 16px;
}
.login-card, .install-wrap {
    width: min(920px, 100%);
    background: var(--paper);
    border: 1px solid rgba(255,255,255,.4);
    border-radius: 28px;
    padding: 36px;
    box-shadow: var(--shadow);
}
.login-card { width: min(460px, 100%); }
.brand-lockup { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.mark {
    width: 56px; height: 56px; border-radius: 16px;
    display: grid; place-items: center;
    background: var(--navy); color: var(--gold-2);
    font-family: Fraunces, serif; font-size: 22px;
}
.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: 11px; color: var(--moss); font-weight: 700; }
.lead { color: #4d584d; line-height: 1.6; }
.login-card label, .install-form label, .form-grid label, .stack label {
    display: flex; flex-direction: column; gap: 6px;
    font-size: 13px; font-weight: 600; margin-bottom: 14px;
}
input, select, textarea {
    font: inherit; padding: 11px 12px; border-radius: 12px;
    border: 1px solid var(--line); background: #fffdf8; color: var(--ink);
}
textarea.sql { min-height: 280px; font-size: 13px; line-height: 1.5; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 0; border-radius: 999px; padding: 11px 18px; font-weight: 700;
    cursor: pointer; text-decoration: none; color: #fff;
}
.btn-gold { background: var(--navy); color: var(--gold-2); width: 100%; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.btn-ok { background: var(--ok); }
.btn-err { background: var(--err); }
.btn-sm { padding: 7px 12px; font-size: 12px; width: auto; }
.hint { font-size: 13px; color: #667066; }
.alert { padding: 12px 14px; border-radius: 14px; margin: 12px 0; }
.alert-ok { background: #e5f4ea; color: #215c34; }
.alert-err { background: #f8e4e2; color: #7a2b26; }
.alert-info { background: #e4eef2; color: #1e4452; }

.app-shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
    background: linear-gradient(180deg, var(--navy) 0%, #0c1812 100%);
    color: #e7e0d0; padding: 22px 16px; position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column; overflow: auto;
}
.nav-brand { display: flex; gap: 12px; align-items: center; padding: 8px 10px 22px; }
.nav-brand strong { display: block; font-family: Fraunces, serif; font-size: 18px; color: #fff; }
.nav-brand span { font-size: 12px; color: var(--gold); }
.side-nav a {
    display: flex; align-items: center; gap: 10px;
    color: #d7d0c2; text-decoration: none; padding: 10px 12px; border-radius: 12px;
    margin-bottom: 4px; font-weight: 600; font-size: 14px;
}
.side-nav a:hover, .side-nav a.active { background: rgba(196,163,90,.16); color: var(--gold-2); }
.nav-group { margin: 8px 0 12px; }
.nav-group-title {
    padding: 8px 12px 6px; color: var(--gold); font-size: 11px;
    letter-spacing: .16em; text-transform: uppercase; font-weight: 800;
}
.side-nav a.nav-sub { padding: 7px 12px 7px 20px; font-size: 13px; margin-bottom: 2px; }
.side-foot { margin-top: auto; padding: 12px; font-size: 12px; color: #9aa89e; }
.content { padding: 28px; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 22px; }
.page-title { margin: 4px 0 0; font-size: 32px; }
.user-chip { background: #fff; border-radius: 999px; padding: 8px 12px 8px 8px; display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: var(--gold-2); display: grid; place-items: center; font-weight: 700; }

.grid-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 20px; }
.conn-bar { margin-bottom: 16px; }
.conn-select { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; }
.conn-select label { margin-bottom: 0; min-width: min(100%, 340px); }
.conn-select select { min-width: min(100%, 340px); }
.conn-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-bottom: 6px; }
.stat, .card {
    background: #fffdf8; border: 1px solid var(--line); border-radius: 20px; padding: 18px;
    box-shadow: 0 8px 20px rgba(19,38,28,.04);
}
.stat .k { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: #6b756b; }
.stat .v { font-family: Fraunces, serif; font-size: 28px; margin-top: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1.4fr .8fr; gap: 16px; }
.span-2 { grid-column: span 2; }
.table-wrap { overflow: auto; max-height: 640px; border-radius: 16px; border: 1px solid var(--line); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
table.data th { position: sticky; top: 0; background: var(--navy); color: var(--gold-2); text-align: left; padding: 10px; }
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data tr:hover td { background: #f7f1e3; }
.badge { display: inline-flex; border-radius: 999px; padding: 3px 8px; font-size: 11px; font-weight: 700; }
.badge-on { background: #e5f4ea; color: #215c34; }
.badge-off { background: #f3eee4; color: #6b756b; }
.badge-err { background: #f8e4e2; color: #7a2b26; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.help-box { background: #edf3ee; border-left: 4px solid var(--gold); padding: 14px 16px; border-radius: 12px; margin-bottom: 16px; }
.help-box h3 { margin: 0 0 6px; font-size: 16px; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a, .tabs button {
    background: transparent; border: 1px solid var(--line); border-radius: 999px;
    padding: 8px 12px; cursor: pointer; font-weight: 700; color: var(--ink); text-decoration: none;
}
.tabs .on { background: var(--navy); color: var(--gold-2); border-color: var(--navy); }
.json-view {
    background: #101c15; color: #e7e0d0; border-radius: 16px; padding: 16px;
    overflow: auto; max-height: 520px; font-size: 12.5px; line-height: 1.55;
}
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.ok { background: var(--ok); }
.bad { background: var(--err); }
.check { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 600; }
.install-form section { margin: 18px 0 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.muted { color: #667066; font-size: 13px; }
.guide details { background: #fffdf8; border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; margin-bottom: 10px; }
.guide summary { cursor: pointer; font-weight: 700; }
.guide .body { padding-top: 8px; line-height: 1.7; color: #334033; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 6px 12px; font-size: 13px; }
.split { display: grid; grid-template-columns: 340px 1fr; gap: 16px; }
.fixgl-table { font-size: 12px; }
.fixgl-table th.num, .fixgl-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.fixgl-table tr.row-header td { background: var(--navy); color: var(--gold-2); font-weight: 800; }
.fixgl-table tr.row-header code { color: var(--gold-2); }
.fixgl-table tr.row-section td { background: #e7efe8; font-weight: 800; }
.fixgl-table tr.row-total td { background: #f4ead0; font-weight: 800; border-top: 2px solid var(--gold); }
.fixgl-table tr.row-percent td { font-weight: 700; }
.pl-summary-table td.indent-1 { padding-left: 28px; }
.pl-summary-table .var-pos { color: #1b7a3a; font-weight: 700; }
.pl-summary-table .var-neg { color: #a33; font-weight: 700; }
.analytics-kpis { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); }
.analytics-kpis .stat .v { font-size: 22px; }
.analytics-filters .conn-select label,
.analytics-filters .conn-select select { min-width: 140px; }
.analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.analytics-card h2 { margin: 0 0 4px; font-size: 20px; }
.analytics-card .muted { margin: 0 0 12px; }
.chart-box { position: relative; height: 280px; }
.chart-box-lg { height: 360px; }
.insight { margin-top: 12px; padding: 12px 14px; border-radius: 12px; }
.insight strong { display: block; font-size: 13px; }
.insight p { margin: 6px 0 0; line-height: 1.55; font-size: 13px; }
.insight-ok { background: #e5f4ea; color: #215c34; }
.insight-warn { background: #f8e4e2; color: #7a2b26; }
.insight-info { background: #e4eef2; color: #1e4452; }
.rank-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 10px; }
.rank-table th, .rank-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.rank-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.rank-table th { color: #6b756b; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.topbar-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.sync-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.choice { display: flex; gap: 18px; flex-wrap: wrap; }
.choice label { flex-direction: row; align-items: center; gap: 8px; margin: 0; }
.matrix-table th, .matrix-table td { font-size: 12px; white-space: nowrap; }
.matrix-table td.mod { white-space: normal; min-width: 180px; }
.brief-card { max-width: 760px; }
.brief-card .toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.brief-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.brief-table th { background: #0b1f4d; color: #fff; font-weight: 700; padding: 12px 16px; text-align: left; }
.brief-table th:last-child, .brief-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.brief-table td { padding: 7px 16px; background: #fff; }
.brief-table tr.strong td { font-weight: 800; }
.brief-table tr.gap td { height: 12px; padding: 0; background: transparent; }
.deck { display: grid; gap: 18px; }
.slide {
    position: relative;
    background: #fff;
    border-radius: 8px;
    padding: 42px 48px 56px;
    box-shadow: var(--shadow);
    font-family: Calibri, "Segoe UI", Arial, sans-serif;
    color: #111;
}
.slide-title {
    margin: 0 0 34px;
    text-align: center;
    font-family: Calibri, "Segoe UI", Arial, sans-serif;
    font-size: 42px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #111;
}
.slide-title span {
    text-decoration: underline;
    text-decoration-color: #2f6db5;
    text-decoration-thickness: 2px;
    text-underline-offset: 5px;
}
.nft {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    font-size: 16px;
}
.nft th {
    background: #0b1f4d;
    color: #fff;
    font-weight: 700;
    text-align: center;
    padding: 12px 18px;
}
.nft th.nft-gap,
.nft td.nft-side {
    background: transparent;
    width: 34px;
    padding: 0 8px 0 0;
}
.nft td.nft-side {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.46em;
    text-align: center;
    color: #222;
    vertical-align: middle;
}
.nft td {
    background: #e5efd4;
    padding: 9px 16px;
}
.nft td.num { text-align: right; width: 34%; padding-right: 9%; }
.slide-no {
    position: absolute;
    right: 18px;
    bottom: 12px;
    color: #8a8a8a;
    font-size: 12px;
}
@media (max-width: 1100px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { height: auto; position: relative; }
    .grid-stats, .grid-2, .grid-3, .split, .conn-select, .analytics-grid, .form-grid, .sync-cards { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
}
