:root {
  --canvas: #f4f7f4;
  --surface: #fff;
  --surface-soft: #f8faf8;
  --ink: #121713;
  --muted: #68716a;
  --faint: #647067;
  --line: #dfe6e1;
  --line-strong: #cbd5ce;
  --shell: #07110d;
  --shell-soft: #12211a;
  --green: #00a875;
  --green-bright: #00e6a0;
  --green-soft: #e4f7ef;
  --amber: #884a0c;
  --amber-soft: #fff4e5;
  --red: #c6404d;
  --red-soft: #fff0f1;
  --shadow: 0 18px 50px rgb(14 30 22 / 8%);
  --sidebar: 246px;
}

* { box-sizing: border-box; }

html { min-width: 320px; min-height: 100%; background: var(--canvas); }

body {
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 400 15px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgb(0 168 117 / 35%);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  white-space: nowrap;
  clip-path: inset(50%);
}

.portal { min-height: 100vh; }

.sidebar {
  position: fixed;
  z-index: 20;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar);
  flex-direction: column;
  padding: 26px 18px 20px;
  background: var(--shell);
  color: #eefaf4;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand__mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 11px;
  background: var(--green-bright);
  color: #042019;
  font-size: 20px;
  font-weight: 800;
}

.brand strong,
.brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: .08em; }
.brand small { margin-top: 1px; color: #8ba096; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }

.nav { display: grid; gap: 6px; margin-top: 54px; }

.nav a {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 9px;
  color: #9aada4;
  font-size: 14px;
  text-decoration: none;
  transition: 150ms ease;
  transition-property: background, color;
}

.nav a:hover { background: rgb(255 255 255 / 5%); color: #fff; }
.nav a.is-active { background: var(--shell-soft); color: #fff; }
.nav a.is-active .nav__icon { color: var(--green-bright); }
.nav__icon { color: #668078; font-size: 18px; }

.sidebar__foot { display: grid; gap: 12px; margin-top: auto; }

.source-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #92a69c;
  font-size: 12px;
}

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-bright); box-shadow: 0 0 0 4px rgb(0 230 160 / 10%); }

.quiet-button {
  min-height: 38px;
  border: 1px solid rgb(255 255 255 / 11%);
  border-radius: 8px;
  background: transparent;
  color: #a9bab2;
  cursor: pointer;
}

.quiet-button:hover { color: #fff; border-color: rgb(255 255 255 / 24%); }

.workspace { min-height: 100vh; margin-left: var(--sidebar); }

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(24px, 4vw, 56px);
  border-bottom: 1px solid rgb(203 213 206 / 70%);
  background: rgb(244 247 244 / 92%);
  backdrop-filter: blur(16px);
}

.topbar__context p,
.topbar__context h1 { margin: 0; }
.topbar__context p { color: var(--faint); font-size: 11px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; }
.topbar__context h1 { margin-top: 2px; font-size: clamp(25px, 2.2vw, 32px); line-height: 1.15; letter-spacing: -.035em; }
.topbar__right { display: flex; align-items: center; gap: 18px; }

.freshness { color: var(--muted); font-size: 12px; }

.avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: #315247;
  font-size: 12px;
  font-weight: 750;
}

.mobile-brand,
.mobile-nav { display: none; }

.notice {
  margin: 22px clamp(24px, 4vw, 56px) 0;
  padding: 12px 16px;
  border: 1px solid #efd4a9;
  border-radius: 8px;
  background: var(--amber-soft);
  color: #76501e;
  font-size: 13px;
}

.content {
  width: min(100%, 1460px);
  margin: 0 auto;
  padding: 36px clamp(24px, 4vw, 56px) 72px;
}

.page-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 28px;
}

.page-intro h2,
.page-intro p { margin: 0; }
.page-intro h2 { max-width: 700px; font-size: clamp(27px, 3vw, 42px); line-height: 1.08; letter-spacing: -.045em; }
.page-intro p { max-width: 510px; color: var(--muted); line-height: 1.6; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi { min-width: 0; padding: 22px; }
.kpi + .kpi { border-left: 1px solid var(--line); }
.kpi__label { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; }
.kpi__value { margin-top: 9px; font-size: clamp(26px, 2.5vw, 38px); font-weight: 680; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.kpi__meta { margin-top: 5px; color: var(--faint); font-size: 11px; }
.kpi__value.is-positive { color: #087954; }

.info-dot {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--faint);
  font-size: 10px;
}

.section-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .7fr); align-items: start; gap: 22px; margin-top: 22px; }

.panel {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.panel--soft { background: var(--surface-soft); box-shadow: none; }
.panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.panel__head h3,
.panel__head p { margin: 0; }
.panel__head h3 { font-size: 17px; letter-spacing: -.015em; }
.panel__head p { margin-top: 4px; color: var(--muted); font-size: 12px; }

.basis {
  flex: none;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.journey { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; }
.journey__group { position: relative; min-width: 0; padding: 22px; }
.journey__group + .journey__group { border-left: 1px solid var(--line); }
.journey__group:nth-child(2) { background: #f7fbf9; }
.journey__group:nth-child(3) { background: #f1f8f5; }
.journey__tag { display: block; color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.journey__value { display: block; margin-top: 16px; font-size: 29px; font-weight: 680; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.journey__label { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.journey__sub { display: block; margin-top: 14px; color: var(--faint); font-size: 11px; }

.insights { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.insight { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.insight:last-child { border-bottom: 0; }
.insight__number { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 7px; background: var(--green-soft); color: #087954; font-size: 11px; font-weight: 750; }
.insight strong,
.insight span { display: block; }
.insight strong { font-size: 13px; }
.insight span { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.5; }

.section-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 22px; }
.section-link { padding: 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: inherit; text-decoration: none; transition: 150ms ease; transition-property: border-color, transform, box-shadow; }
.section-link:hover { transform: translateY(-2px); border-color: #9fcbb9; box-shadow: var(--shadow); }
.section-link small { display: block; color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.section-link strong { display: block; margin-top: 12px; font-size: 16px; }
.section-link p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }

.funnel-list { display: grid; gap: 16px; }
.funnel-row { display: grid; grid-template-columns: minmax(130px, .8fr) minmax(220px, 2fr) 92px; align-items: center; gap: 16px; }
.funnel-row__label strong,
.funnel-row__label small { display: block; }
.funnel-row__label strong { font-size: 13px; }
.funnel-row__label small { margin-top: 2px; color: var(--faint); font-size: 10px; }
.funnel-track { height: 28px; overflow: hidden; border-radius: 6px; background: #edf1ee; }
.funnel-fill { display: flex; min-width: 28px; height: 100%; align-items: center; padding: 0 9px; border-radius: 6px; background: linear-gradient(90deg, #9ce4ca, var(--green)); color: #043b2a; font-size: 11px; font-weight: 750; transition: width 180ms ease; }
.funnel-row__stat { text-align: right; }
.funnel-row__stat strong,
.funnel-row__stat small { display: block; }
.funnel-row__stat strong { font-variant-numeric: tabular-nums; }
.funnel-row__stat small { color: var(--faint); font-size: 10px; }

.metric-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--line); }
.metric-list__item { padding: 18px; background: var(--surface); }
.metric-list__item span,
.metric-list__item strong,
.metric-list__item small { display: block; }
.metric-list__item span { color: var(--muted); font-size: 11px; }
.metric-list__item strong { margin-top: 7px; font-size: 23px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.metric-list__item small { margin-top: 3px; color: var(--faint); font-size: 10px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.search { position: relative; flex: 1 1 280px; }
.search input,
.toolbar select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}
.search input { padding: 0 14px 0 40px; }
.search::before { position: absolute; top: 10px; left: 14px; color: var(--faint); content: "⌕"; font-size: 18px; }
.toolbar select { width: auto; min-width: 150px; padding: 0 34px 0 12px; }
.result-count { margin-left: auto; color: var(--muted); font-size: 12px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { height: 42px; padding: 0 16px; background: var(--surface-soft); color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { height: 64px; padding: 10px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr { cursor: pointer; transition: background 120ms ease; }
.data-table tbody tr:hover { background: #f7fbf9; }
.identity { display: flex; min-width: 190px; align-items: center; gap: 11px; }
.identity__avatar { display: grid; width: 34px; height: 34px; flex: none; place-items: center; border-radius: 50%; background: #e5efe9; color: #315347; font-size: 11px; font-weight: 750; }
.identity strong,
.identity small { display: block; }
.identity strong { max-width: 190px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.identity small { margin-top: 2px; color: var(--faint); font-size: 11px; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }

.badge { display: inline-flex; min-height: 24px; align-items: center; padding: 0 8px; border-radius: 999px; background: #eef2ef; color: #536057; font-size: 10px; font-weight: 700; white-space: nowrap; }
.badge--ok { background: var(--green-soft); color: #087954; }
.badge--warn { background: var(--amber-soft); color: var(--amber); }
.badge--danger { background: var(--red-soft); color: var(--red); }

.detail-back { display: inline-flex; min-height: 40px; align-items: center; gap: 7px; margin-bottom: 18px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.inline-source-error { margin-bottom: 18px; padding: 12px 14px; border: 1px solid #efd4a9; border-radius: 8px; background: var(--amber-soft); color: #6e400d; font-size: 12px; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.detail-head__identity { display: flex; align-items: center; gap: 14px; }
.detail-head__identity .identity__avatar { width: 48px; height: 48px; font-size: 14px; }
.detail-head h2,
.detail-head p { margin: 0; }
.detail-head h2 { font-size: 26px; letter-spacing: -.035em; }
.detail-head p { margin-top: 3px; color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, .65fr); gap: 22px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 9px; }
.fact { padding: 16px; }
.fact:nth-child(2n) { border-left: 1px solid var(--line); }
.fact:nth-child(n + 3) { border-top: 1px solid var(--line); }
.fact span,
.fact strong { display: block; }
.fact span { color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.fact strong { margin-top: 7px; overflow-wrap: anywhere; font-size: 14px; }
.timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.timeline li { position: relative; min-height: 58px; padding: 0 0 18px 28px; }
.timeline li::before { position: absolute; top: 3px; left: 4px; width: 9px; height: 9px; border: 2px solid var(--surface); border-radius: 50%; background: var(--green); box-shadow: 0 0 0 1px var(--green); content: ""; }
.timeline li::after { position: absolute; top: 14px; bottom: -3px; left: 8px; width: 1px; background: var(--line); content: ""; }
.timeline li:last-child::after { display: none; }
.timeline strong,
.timeline span { display: block; }
.timeline strong { font-size: 13px; }
.timeline span { margin-top: 3px; color: var(--muted); font-size: 11px; }

.state { display: grid; min-height: 380px; place-items: center; text-align: center; }
.state__inner { max-width: 430px; }
.state__icon { display: grid; width: 46px; height: 46px; margin: 0 auto 14px; place-items: center; border-radius: 12px; background: var(--green-soft); color: #087954; font-size: 18px; }
.state h2,
.state p { margin: 0; }
.state h2 { font-size: 20px; }
.state p { margin-top: 7px; color: var(--muted); }
.state button { min-height: 40px; margin-top: 18px; padding: 0 18px; border: 0; border-radius: 8px; background: var(--ink); color: #fff; cursor: pointer; }

.skeleton { overflow: hidden; border-radius: 7px; background: #e8ede9; color: transparent; }

.login {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.15fr) minmax(400px, .85fr);
  background: var(--shell);
  color: #fff;
}

.login__story { display: flex; min-height: 100vh; flex-direction: column; justify-content: center; padding: clamp(40px, 8vw, 120px); background: radial-gradient(circle at 20% 20%, rgb(0 230 160 / 13%), transparent 34%), var(--shell); }
.login__brand { position: absolute; top: 34px; left: clamp(40px, 8vw, 120px); font-weight: 800; letter-spacing: .1em; }
.eyebrow { margin: 0; color: var(--green-bright); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.login__story h1 { max-width: 780px; margin: 20px 0 18px; font-size: clamp(42px, 5vw, 78px); line-height: .98; letter-spacing: -.055em; }
.login__story > p:not(.eyebrow) { max-width: 570px; margin: 0; color: #9bb0a6; font-size: 16px; }
.login__path { display: flex; max-width: 620px; align-items: center; gap: 14px; margin-top: 54px; color: #cbd8d2; font-size: 12px; }
.login__path i { height: 1px; flex: 1; background: linear-gradient(90deg, var(--green-bright), rgb(0 230 160 / 18%)); }

.login-card { align-self: center; width: min(420px, calc(100% - 48px)); margin: 0 auto; padding: 34px; border: 1px solid rgb(255 255 255 / 10%); border-radius: 14px; background: #0c1913; box-shadow: 0 28px 80px rgb(0 0 0 / 34%); }
.login-card h2 { margin: 8px 0 4px; font-size: 28px; letter-spacing: -.04em; }
.login-card > p:not(.eyebrow) { margin: 0 0 24px; color: #91a49a; font-size: 13px; }
.login-card label { display: grid; gap: 7px; margin-top: 15px; color: #bdcbc4; font-size: 12px; }
.login-card input { width: 100%; min-height: 46px; padding: 0 13px; border: 1px solid #2a3c33; border-radius: 8px; background: #07110d; color: #fff; }
.login-card input:focus { border-color: var(--green-bright); }
.login-card button { width: 100%; min-height: 46px; margin-top: 22px; border: 0; border-radius: 8px; background: var(--green-bright); color: #042019; font-weight: 750; cursor: pointer; }
.form-error { min-height: 18px; margin: 12px 0 -10px !important; color: #ff99a0 !important; }

@media (max-width: 1180px) {
  :root { --sidebar: 214px; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .kpi:nth-child(4) { border-left: 0; }
  .kpi:nth-child(n + 4) { border-top: 1px solid var(--line); }
  .section-grid { grid-template-columns: 1fr; }
  .insights { grid-template-columns: repeat(3, 1fr); }
  .insight { display: block; border-bottom: 0; }
  .insight__number { margin-bottom: 8px; }
}

@media (max-width: 820px) {
  .sidebar { display: none; }
  .workspace { margin-left: 0; padding-bottom: 74px; }
  .mobile-brand { display: grid; width: 38px; height: 38px; place-items: center; border: 0; border-radius: 9px; background: var(--shell); color: var(--green-bright); font-weight: 800; }
  .topbar { min-height: 78px; padding: 12px 18px; }
  .topbar__context { flex: 1; }
  .freshness { display: none; }
  .content { padding: 24px 18px 50px; }
  .notice { margin: 16px 18px 0; }
  .mobile-nav { position: fixed; z-index: 30; inset: auto 0 0; display: grid; height: 68px; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); background: rgb(255 255 255 / 96%); backdrop-filter: blur(16px); }
  .mobile-nav a { display: grid; place-content: center; gap: 2px; color: var(--faint); text-align: center; text-decoration: none; }
  .mobile-nav a span { font-size: 17px; }
  .mobile-nav a small { font-size: 9px; }
  .mobile-nav a.is-active { color: #087954; }
  .page-intro { display: block; }
  .page-intro p { margin-top: 12px; }
  .journey { grid-template-columns: 1fr; }
  .journey__group + .journey__group { border-top: 1px solid var(--line); border-left: 0; }
  .section-links { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login__story { display: none; }
  .login-card { align-self: center; }
}

@media (max-width: 560px) {
  .topbar__context p { display: none; }
  .topbar__context h1 { font-size: 21px; }
  .avatar { width: 34px; height: 34px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi { padding: 18px; }
  .kpi + .kpi { border-left: 0; }
  .kpi:nth-child(2n) { border-left: 1px solid var(--line); }
  .kpi:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .kpi:last-child { grid-column: 1 / -1; border-left: 0; }
  .panel { padding: 18px; }
  .insights { grid-template-columns: 1fr; }
  .insight { display: grid; border-bottom: 1px solid var(--line); }
  .funnel-row { grid-template-columns: 105px minmax(130px, 1fr) 60px; gap: 10px; }
  .metric-list { grid-template-columns: 1fr; }
  .toolbar select { flex: 1 1 140px; min-width: 0; }
  .result-count { width: 100%; margin-left: 0; }
  .facts { grid-template-columns: 1fr; }
  .fact:nth-child(2n) { border-left: 0; }
  .fact:nth-child(n + 2) { border-top: 1px solid var(--line); }
  .login-card { width: calc(100% - 28px); padding: 26px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after { scroll-behavior: auto !important; transition-duration: 0s !important; }
}
