/* VIC AI Growth - deep navy + warm gold. No external resources (strict CSP). */
:root {
  --bg: #f4f5f8; --surface: #fff; --surface2: #eef0f6; --text: #14213d; --muted: #5b6579; --border: #d6dae6;
  --navy: #0e1f45; --navy2: #17306b; --gold: #b8860b; --gold-bg: #f6e7b8; --on-gold: #1b1405;
  --ok: #1b7a43; --ok-bg: #dcf3e5; --warn: #8a5a00; --warn-bg: #fdecc4; --bad: #b3261e; --bad-bg: #fbe0dd; --info: #1f5fbf; --info-bg: #dbe8fb;
  --focus: #0b57d0; --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1226; --surface: #111c38; --surface2: #17264a; --text: #e8ecf6; --muted: #9aa6c2; --border: #2a3a63;
    --navy: #070f23; --navy2: #17306b; --gold: #e6b84a; --gold-bg: #4a3a0f; --on-gold: #1b1405;
    --ok: #67d391; --ok-bg: #12351f; --warn: #f0c35c; --warn-bg: #3d2f08; --bad: #ff8d84; --bad-bg: #3f1613; --info: #8db8ff; --info-bg: #14305e; --focus: #8db8ff;
  }
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.45; }
[hidden] { display: none !important; }
a { color: var(--info); }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 0 0 .4rem; }
h4 { font-size: .9rem; margin: .8rem 0 .3rem; }
p { margin: 0 0 .6rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .errtxt { color: var(--bad); }
.note { background: var(--warn-bg); color: var(--warn); padding: .5rem .75rem; border-radius: var(--radius); border-left: 4px solid var(--gold); }
.boot { padding: 2rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* layout */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .5rem 1rem; background: var(--navy); color: #fff; border-bottom: 3px solid var(--gold); }
.top .sp { flex: 1; }
.top .user { font-size: .85rem; opacity: .85; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: .5rem; color: #fff; text-decoration: none; font-weight: 700; }
.logo { display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 6px; background: var(--gold); color: var(--on-gold); font-weight: 800; }
.top .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.top select { max-width: 14rem; }
.body { display: grid; grid-template-columns: 13.5rem minmax(0, 1fr); min-height: calc(100vh - 3.4rem); }
.body.nonav { grid-template-columns: minmax(0, 1fr); }
.side { background: var(--surface); border-right: 1px solid var(--border); padding: .75rem .5rem; display: flex; flex-direction: column; gap: 2px; }
.side a { display: block; padding: .5rem .75rem; border-radius: 6px; color: var(--text); text-decoration: none; }
.side a:hover { background: var(--surface2); }
.side a[aria-current="page"] { background: var(--navy2); color: #fff; box-shadow: inset 3px 0 0 var(--gold); font-weight: 600; }
.main { padding: 1rem 1.25rem 3rem; max-width: 1400px; width: 100%; outline: none; }
.phead { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: .8rem; }
.pact { display: flex; gap: .5rem; }
.split { display: grid; grid-template-columns: minmax(14rem, 1fr) minmax(0, 2fr); gap: 1rem; align-items: start; }
.split.wide { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.cols2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .6rem 1rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: 1rem; min-width: 0; }
.sub { border-top: 1px solid var(--border); padding-top: .6rem; }
.cols2 > .sub { border-top: 0; border-left: 3px solid var(--gold); padding: 0 0 0 .8rem; }

/* controls */
.btn { font: inherit; display: inline-block; padding: .4rem .8rem; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover:not(:disabled) { background: var(--surface2); }
.btn.primary { background: var(--gold); color: var(--on-gold); border-color: var(--gold); font-weight: 600; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--gold); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.small { padding: .25rem .55rem; font-size: .85rem; }
.btn.link { border: 0; background: none; color: var(--info); text-decoration: underline; padding: .25rem 0; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.act { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; margin: 0 .4rem .3rem 0; }
.why { color: var(--warn); font-size: .78rem; max-width: 22rem; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.row.between { justify-content: space-between; align-items: center; }
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: .8rem; }
.toolbar h2 { margin: 0; flex: 1; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: .4rem .55rem; max-width: 100%; }
textarea { width: 100%; resize: vertical; }
input[type="checkbox"] { width: 1.05rem; height: 1.05rem; padding: 0; vertical-align: middle; }
.top select { background: var(--navy2); color: #fff; border-color: rgba(255,255,255,.4); }
.form { display: flex; flex-direction: column; gap: .6rem; }
.form.grid2 { display: grid; }
.form.narrow { max-width: 32rem; }
.form.inlineform { flex-direction: row; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: .2rem; border: 0; padding: 0; margin: 0; min-width: 0; }
.field .lbl { font-weight: 600; font-size: .88rem; }
.field input, .field select, .field textarea { width: 100%; }
.hint { color: var(--muted); font-size: .8rem; }
.inline { display: inline-flex; align-items: center; gap: .35rem; margin-right: 1rem; }
.formmsg { color: var(--bad); min-height: 1.1em; font-size: .9rem; }
.code { font-family: var(--mono); font-size: .85rem; }

/* tables & badges */
.tw { overflow-x: auto; margin-bottom: .6rem; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
th { background: var(--surface2); font-weight: 600; white-space: nowrap; }
table.num td:not(:first-child), table.num th:not(:first-child) { text-align: right; white-space: nowrap; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface2); color: var(--muted); }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.info { background: var(--info-bg); color: var(--info); }
.state { padding: 1rem; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface); }
.state.error { border-color: var(--bad); color: var(--bad); }
.state.loading { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--gold); border-radius: var(--radius); padding: .6rem .8rem; text-decoration: none; color: var(--text); }
a.stat:hover { background: var(--surface2); }
.stat .sv { font-size: 1.5rem; font-weight: 700; } .stat .sl { color: var(--muted); font-size: .82rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .2rem .8rem; margin: 0 0 .6rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.kv.inline { grid-template-columns: repeat(4, max-content max-content); }
ul.plain { list-style: none; padding: 0; margin: 0 0 .6rem; } ul.plain li { padding: .25rem 0; }
ul.sel a[aria-current="true"] { font-weight: 700; }
ul.ev { padding-left: 1.1rem; margin: 0 0 .6rem; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: .6rem; }
.tab { font: inherit; background: none; border: 0; padding: .45rem .9rem; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--gold); font-weight: 600; }
.steps { display: flex; gap: 1rem; list-style: none; padding: 0; margin: 0 0 1rem; flex-wrap: wrap; counter-reset: s; }
.steps li { counter-increment: s; color: var(--muted); } .steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 1px solid var(--border); margin-right: .4rem; }
.steps li[aria-current="step"] { color: var(--text); font-weight: 700; } .steps li[aria-current="step"]::before { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.steps li.done::before { background: var(--ok-bg); color: var(--ok); }
pre.sug, pre.diff { background: var(--surface2); padding: .6rem; border-radius: 6px; overflow: auto; max-height: 16rem; white-space: pre-wrap; font-family: var(--mono); font-size: .8rem; }
.quote { margin: 0 0 .5rem; padding: .3rem .6rem; border-left: 3px solid var(--gold); background: var(--surface2); }
.quote p { margin: 0 0 .2rem; }
.preview { border: 1px solid var(--border); border-radius: 6px; padding: .8rem 1rem; max-height: 28rem; overflow: auto; background: var(--bg); }
.preview .ptitle { font-size: 1.25rem; }
.pager { align-items: center; }

/* auth */
.authwrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(160deg, var(--navy), var(--navy2)); }
.authbox { background: var(--surface); border-radius: 12px; padding: 1.5rem; width: min(24rem, 100%); border-top: 4px solid var(--gold); display: flex; flex-direction: column; gap: .6rem; }

/* toasts */
.toasts { position: fixed; right: .75rem; bottom: .75rem; display: flex; flex-direction: column; gap: .4rem; z-index: 50; max-width: min(26rem, calc(100vw - 1.5rem)); }
.toast { padding: .6rem .9rem; border-radius: var(--radius); box-shadow: 0 4px 14px rgba(0,0,0,.25); background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok); }
.toast.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }

/* responsive: sidebar collapses to a scrollable top menu */
@media (max-width: 760px) {
  .body { grid-template-columns: minmax(0, 1fr); }
  .side { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: .35rem .5rem; position: sticky; top: 0; z-index: 5; }
  .side a { white-space: nowrap; padding: .45rem .7rem; }
  .side a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--gold); }
  .main { padding: .8rem .75rem 3rem; }
  .split, .split.wide { grid-template-columns: minmax(0, 1fr); }
  .top { padding: .4rem .6rem; } .top .bname, .top .user { display: none; }
  .kv.inline { grid-template-columns: max-content 1fr; }
  .top { position: static; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
