:root {
  --primary: #ff4b4b;
  --text: #31333f;
  --muted: #6b6f7b;
  --border: #e6e9ef;
  --sidebar: #f0f2f6;
  --font: "Source Sans Pro", "Source Sans 3", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 1rem; }
body { margin: 0; font-family: var(--font); color: var(--text); font-size: 16px; line-height: 1.6; display: flex; min-height: 100vh; }
a { color: #0068c9; }

/* sidebar */
#sidebar { width: 260px; flex-shrink: 0; background: var(--sidebar); padding: 2rem 1.25rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
#sidebar h2 { margin: 0 0 .75rem; font-size: 1.5rem; }
#nav a { display: flex; align-items: center; gap: .55rem; padding: .3rem .25rem; color: var(--text); text-decoration: none; border-radius: .4rem; }
#nav a:hover { background: rgba(0,0,0,.04); }
#nav .dot { width: 1rem; height: 1rem; border-radius: 50%; border: 1px solid #b0b3bb; background: white; flex-shrink: 0; }
#nav a.active .dot { border: 5px solid var(--primary); }
#sidebar-toggle { display: none; }

/* main */
#main { flex: 1; min-width: 0; padding: 3rem 4rem 2rem; max-width: 1600px; }
h1 { font-size: 2.6rem; font-weight: 700; margin: 0 0 1rem; line-height: 1.2; }
h2 { font-size: 1.9rem; font-weight: 600; margin: 1.4rem 0 .6rem; line-height: 1.25; }
h3 { font-size: 1.45rem; font-weight: 600; margin: 1.2rem 0 .5rem; }
h3.divider { border-bottom: 2px solid #d5d7dc; padding-bottom: .3rem; }
.md p, .md li { margin: .3rem 0; }
.md code, .caption code { background: #f0f2f6; padding: .05rem .3rem; border-radius: .25rem; font-size: .88em; color: #09ab3b; }
.md pre code, pre.code code { color: inherit; background: none; padding: 0; }
.md pre, pre.code { background: #f8f9fb; border: 1px solid var(--border); border-radius: .5rem; padding: .9rem 1rem; overflow-x: auto; font-size: .85rem; line-height: 1.45; }
.md table { border-collapse: collapse; margin: .6rem 0; }
.md th, .md td { border: 1px solid var(--border); padding: .3rem .7rem; }
.caption { color: var(--muted); font-size: .88rem; }
.loading { color: var(--muted); }
footer { margin-top: 3rem; color: var(--text); }
footer hr, hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

.callout { border-radius: .5rem; padding: .9rem 1.1rem; margin: 1rem 0; }
.callout .md p:first-child { margin-top: 0; } .callout .md p:last-child { margin-bottom: 0; }
.callout.success { background: rgba(33,195,84,.1); color: #177233; }
.callout.info { background: rgba(28,131,225,.1); color: #004280; }
.callout.warning { background: rgba(255,189,69,.2); color: #926c05; }
.callout.error { background: rgba(255,43,43,.09); color: #7d353b; }

.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
.col { min-width: 0; }

/* widgets */
.widget { display: block; margin: .6rem 0 1rem; }
.widget-label { display: block; font-size: .88rem; margin-bottom: .3rem; }
select, input[type=number], input[type=text] { font: inherit; font-size: .95rem; padding: .45rem .6rem; border: 1px solid #d5d7dc; border-radius: .45rem; background: #f0f2f6; color: var(--text); min-width: 14rem; max-width: 100%; }
input[type=number] { width: 100%; }
.radio-row { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.radio { display: inline-flex; align-items: center; gap: .25rem; cursor: pointer; }
input[type=radio] { accent-color: var(--primary); }
.slider-row { display: flex; align-items: center; gap: .75rem; max-width: 36rem; }
.slider-row input { flex: 1; accent-color: var(--primary); }
.slider-value { color: var(--primary); font-weight: 600; min-width: 2rem; }

.multiselect { position: relative; }
.ms-box { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; padding: .3rem .4rem; border: 1px solid #d5d7dc; border-radius: .45rem; background: #f0f2f6; cursor: text; }
.ms-box input { border: none; background: transparent; flex: 1; min-width: 10rem; padding: .25rem; outline: none; }
.chips { display: contents; }
.chip { display: inline-flex; align-items: center; gap: .2rem; background: var(--primary); color: white; border-radius: .3rem; padding: .05rem .2rem .05rem .5rem; font-size: .9rem; }
.chip-x { background: none; border: none; color: white; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 .2rem; }
.chip-clear { background: none; border: none; color: var(--muted); cursor: pointer; font-size: .8rem; }
.ms-list { display: none; position: absolute; z-index: 20; left: 0; right: 0; max-height: 300px; overflow-y: auto; background: white; border: 1px solid var(--border); border-radius: .45rem; box-shadow: 0 4px 16px rgba(0,0,0,.12); margin-top: .2rem; }
.multiselect.open .ms-list { display: block; }
.ms-item { padding: .35rem .75rem; cursor: pointer; }
.ms-item:hover { background: #f0f2f6; }
.ms-empty { padding: .35rem .75rem; color: var(--muted); }

/* tabs */
.tab-bar { display: flex; flex-wrap: wrap; gap: 1.4rem; border-bottom: 1px solid var(--border); margin: 1rem 0; }
.tab { background: none; border: none; font: inherit; font-size: .95rem; padding: .6rem 0; cursor: pointer; color: var(--text); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* tables */
.table-wrap { overflow: auto; margin: .6rem 0 1rem; border: 1px solid var(--border); border-radius: .45rem; max-width: 100%; width: fit-content; }
table.data { border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: .25rem .7rem; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); white-space: nowrap; }
table.data td { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.txt { text-align: left; }
table.data thead th { position: sticky; top: 0; background: #fafafa; color: var(--muted); font-weight: 500; text-align: right; z-index: 1; }
table.data tbody th { text-align: left; font-weight: 400; color: var(--muted); background: #fafafa; }
table.data tr.highlight td, table.data tr.highlight th { background: rgba(255,196,0,.30); font-weight: 700; color: var(--text); }

table.alpha-table { border-collapse: collapse; min-width: 60%; font-size: .95rem; }
table.alpha-table th, table.alpha-table td { padding: 1px .8rem; text-align: center; border: none; }
table.alpha-table thead th, table.alpha-table th.lvl0 { background: #f2f2f2; }
table.alpha-table td, table.alpha-table th.lvl1 { background: #f9f9f9; }
table.alpha-table th.lvl1 { font-weight: 400; }
table.alpha-table tr.tstat td, table.alpha-table tr.tstat th { border-bottom: 8px solid white; }
table.alpha-table td.sig { font-weight: 700; }
.alpha-table + * { margin-top: .5rem; }

table.model-guide { width: 100%; border-collapse: collapse; margin: .6rem 0 1rem; }
table.model-guide th { text-align: left; }
table.model-guide th, table.model-guide td { border-bottom: 1px solid var(--border); padding: .4rem .6rem; vertical-align: top; }

iframe.pipeline { width: 1000px; max-width: 100%; height: 400px; border: 1px solid var(--border); border-radius: .45rem; }
.plot { width: 100%; }

@media (max-width: 900px) {
  body { display: block; }
  #sidebar { position: fixed; z-index: 30; height: auto; width: 100%; padding: .5rem 1rem; }
  #sidebar-toggle { display: inline-block; font-size: 1.4rem; background: none; border: none; cursor: pointer; }
  #sidebar-body { display: none; }
  body.nav-open #sidebar-body { display: block; }
  #main { padding: 4rem 1rem 2rem; }
  .columns { grid-template-columns: 1fr; }
  h1 { font-size: 2rem; }
}
