:root {
  --ink: #0b0d1a;
  --ink-2: #141833;
  --paper: #ffffff;
  --bg: #f6f8fb;
  --line: #e3e7f0;
  --text: #2a3142;
  --text-soft: #5b6478;
  --text-faint: #8a93a6;
  --teal: #0fb3a3;
  --teal-deep: #0b8a7e;
  --amber: #ef9d18;
  --radius: 10px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }
.page { flex: 1 0 auto; padding-top: 2.25rem; padding-bottom: 3rem; }
a { color: var(--teal-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 62px; }
.brand { display: inline-flex; align-items: center; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 34px; width: auto; display: block; }
.nav { display: flex; align-items: center; gap: 1.25rem; }
.navlink { color: var(--text-soft); font-weight: 500; font-size: .95rem; }
.navlink:hover { color: var(--ink); text-decoration: none; }
.logout-form { margin: 0; }
.btn-link { background: none; border: 0; color: var(--text-soft); font: inherit; font-weight: 500; cursor: pointer; padding: 0; }
.btn-link:hover { color: var(--ink); }

/* Mobile nav toggle */
.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: .5rem; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 720px) {
  .header-inner { position: relative; }
  .nav-toggle { display: flex; }
  .nav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--line);
    box-shadow: 0 14px 30px -18px rgba(11,13,26,.28); padding: .25rem 1.25rem 1rem;
  }
  .nav.open { display: flex; }
  .navlink { padding: .8rem 0; border-bottom: 1px solid var(--line); }
  .logout-form { padding: .8rem 0; }
  .nav .btn { margin-top: .75rem; text-align: center; justify-content: center; }
}

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font-weight: 600; border-radius: var(--radius); border: 1.5px solid transparent;
  padding: .7rem 1.3rem; cursor: pointer; transition: all .15s ease; font-size: 1rem; }
.btn-sm { padding: .45rem .9rem; font-size: .9rem; }
.btn-lg { padding: .9rem 1.7rem; font-size: 1.05rem; }
.btn-accent { background: var(--teal); color: #04201d; border-color: var(--teal); }
.btn-accent:hover { background: var(--teal-deep); color: #fff; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--teal); color: var(--teal-deep); text-decoration: none; }

/* Cards & forms */
.card-panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 2rem; box-shadow: 0 1px 2px rgba(11,13,26,.04), 0 12px 30px -18px rgba(11,13,26,.18); }
.auth-wrap { max-width: 460px; margin: 1.5rem auto; }
.form-field { margin-bottom: 1rem; }
.form-field label { display: block; font-weight: 500; font-size: .92rem; margin-bottom: .35rem; color: var(--ink); }
.form-control { width: 100%; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 1rem; font-family: inherit; color: var(--text); background: #fff; }
.form-control:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15,179,163,.15); }
.field-row { display: flex; gap: 1rem; }
.field-row > .form-field { flex: 1; }
.text-danger { color: #c0392b; font-size: .88rem; }
.validation-summary-errors ul { margin: 0 0 1rem; padding-left: 1.1rem; color: #c0392b; font-size: .9rem; }
.checkbox-row { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.checkbox-row label { margin: 0; font-weight: 400; color: var(--text-soft); }

/* Typography helpers */
h1 { font-size: 2rem; letter-spacing: -.02em; color: var(--ink); margin: 0 0 .5rem; }
h2 { font-size: 1.4rem; color: var(--ink); margin: 0 0 .75rem; }
.lead { font-size: 1.15rem; color: var(--text-soft); line-height: 1.6; }
.muted { color: var(--text-faint); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 700; color: var(--teal-deep); }

/* Hero */
.hero { padding: 2.5rem 0 1.5rem; }
.hero h1 { font-size: 2.6rem; max-width: 18ch; }
.hero .lead { max-width: 56ch; margin-top: .75rem; }
.cta-row { display: flex; gap: .8rem; margin-top: 1.6rem; flex-wrap: wrap; }

/* Dashboard tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin: 1.25rem 0; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.25rem; }
.tile .tile-label { font-size: .8rem; color: var(--text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.tile .tile-value { font-size: 1.7rem; font-weight: 700; color: var(--ink); margin-top: .35rem; letter-spacing: -.02em; }
.tile.accent .tile-value { color: var(--teal-deep); }

/* Checklist */
.checklist { list-style: none; padding: 0; margin: 1rem 0 0; }
.checklist li { padding: .65rem 0; border-bottom: 1px solid var(--line); display: flex; gap: .6rem; align-items: baseline; }
.checklist li:last-child { border-bottom: 0; }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem;
  border-radius: 50%; background: var(--teal); color: #04201d; font-weight: 700; font-size: .82rem; flex: 0 0 auto; }

.site-footer { flex-shrink: 0; border-top: 1px solid var(--line); background: var(--paper); padding: 1.5rem 0; font-size: .9rem; color: var(--text-faint); }
.site-footer .container { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-family { color: var(--text-faint); }
.mt-3 { margin-top: 1rem; } .mt-4 { margin-top: 1.5rem; }

/* Page head with action */
.page-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* Status banners */
.banner-running { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; border-color: var(--teal); color: var(--ink); }
.banner-historical { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; background: var(--bg); border-color: var(--line); color: var(--text-soft); }
.spinner { width: 1.05rem; height: 1.05rem; border: 2.5px solid var(--line); border-top-color: var(--teal); border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; flex: 0 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Public live-demo chrome */
.demo-badge { background: var(--amber); color: #3a2600; font-weight: 600; font-size: .8rem; padding: .15rem .55rem; border-radius: 999px; }
.demo-bar { background: var(--ink); color: #eef1f7; }
.demo-bar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .6rem 0; font-size: .92rem; }
.demo-bar-cta { color: var(--teal); font-weight: 600; white-space: nowrap; }
.demo-bar-cta:hover { color: #fff; text-decoration: none; }

/* CSS bar charts (dependency-free) */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.bars { display: flex; flex-direction: column; gap: .55rem; margin-top: 1rem; }
.bar-row { display: grid; grid-template-columns: 11rem 1fr auto; align-items: center; gap: .75rem; }
.bar-label { font-size: .9rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--bg); border-radius: 6px; height: 1.4rem; overflow: hidden; }
.bar-fill { height: 100%; background: var(--teal); border-radius: 6px; min-width: 2px; transition: width .4s var(--ease, ease); }
.bar-fill.hot { background: var(--amber); }
.bar-value { font-size: .88rem; font-weight: 600; color: var(--ink); white-space: nowrap; }

/* Findings table */
.filter-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
.chip { font-size: .85rem; padding: .35rem .75rem; border: 1px solid var(--line); border-radius: 999px; color: var(--text-soft); background: var(--paper); }
.chip:hover { border-color: var(--teal); text-decoration: none; }
.chip.on { background: var(--teal); color: #04201d; border-color: var(--teal); font-weight: 600; }
.table-panel { padding: 0; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.data-table th, .data-table td { padding: .7rem .85rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); background: var(--bg); position: sticky; top: 0; }
.data-table th a { color: var(--text-faint); }
.data-table th a:hover { color: var(--teal-deep); }
.data-table td.num, .data-table th.num { text-align: right; white-space: nowrap; }
.data-table td.strong { font-weight: 700; color: var(--teal-deep); }
.data-table td.rec { color: var(--text-soft); max-width: 22rem; }
.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: .2rem .5rem; border-radius: 6px; background: var(--teal-soft, rgba(15,179,163,.12)); color: var(--teal-deep); white-space: nowrap; }
.badge.badge-warn { background: rgba(239,157,24,.16); color: #a86a06; }
