:root {
  --paper: #f1efe7;
  --paper-deep: #e8e5da;
  --card: #fbfaf6;
  --ink: #101812;
  --ink-soft: #1d2a21;
  --muted: #627064;
  --line: #d7d3c5;
  --line-strong: #bcb7a6;
  --lime: #d8f26b;
  --lime-soft: #eef8c9;
  --forest: #173d2b;
  --forest-deep: #0d1a12;
  --red: #bf4529;
  --amber: #b97c1f;
  --blue: #33679c;
  --green: #2e7d57;
  --shadow: 0 18px 40px -28px rgba(16, 24, 18, 0.45);
  --radius: 14px;
  --display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --body: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.5;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(216, 242, 107, 0.18), transparent 60%),
    repeating-linear-gradient(0deg, rgba(16, 24, 18, 0.022) 0, rgba(16, 24, 18, 0.022) 1px, transparent 1px, transparent 72px),
    var(--paper);
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

h1 { font-size: 30px; line-height: 1.1; }
h2 { font-size: 20px; line-height: 1.2; }
h3 { font-size: 16px; margin: 26px 0 10px; }
h3:first-child { margin-top: 0; }

p { margin: 0; }
a { color: var(--forest); }

.mono { font-family: var(--mono); }
.tiny { font-size: 10px; letter-spacing: 0.02em; }
.small { font-size: 11px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

.micro {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  font-weight: 600;
}

/* ------------------------------------------------------------------ shell */
.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px 18px 18px;
  color: #e8ede6;
  background:
    linear-gradient(180deg, rgba(216, 242, 107, 0.055), transparent 45%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0, rgba(255, 255, 255, 0.035) 1px, transparent 1px, transparent 44px),
    var(--forest-deep);
  border-right: 1px solid rgba(0, 0, 0, 0.35);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 6px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(216, 242, 107, 0.55);
  border-radius: 9px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 6px;
  background: rgba(216, 242, 107, 0.08);
}

.brand-mark span {
  display: block;
  background: var(--lime);
  border-radius: 1px;
}
.brand-mark span:nth-child(1) { height: 100%; }
.brand-mark span:nth-child(2) { height: 62%; align-self: end; }
.brand-mark span:nth-child(3) { height: 82%; align-self: end; }

.brand-mark.large {
  width: 46px;
  height: 46px;
  padding: 8px;
  border-radius: 12px;
}

.brand-copy { display: grid; line-height: 1; }
.brand-name {
  font-family: var(--display);
  font-size: 21px;
  letter-spacing: 0.08em;
}
.brand-sub {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #93a394;
  margin-top: 4px;
}

.org-block {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
}
.org-block .micro { color: #8fa092; }
.org-name { font-size: 13px; font-weight: 600; margin-top: 5px; color: #f1f5ee; }
.org-block .tiny { color: #7f9182; margin-top: 2px; display: block; }

.nav { display: grid; gap: 4px; }

.nav-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: #b9c6ba;
  font: inherit;
  font-size: 13px;
  text-align: left;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.active {
  background: var(--lime);
  color: var(--forest-deep);
  font-weight: 700;
}
.nav-item.active .nav-code { color: rgba(13, 26, 18, 0.55); }
.nav-code {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: #718475;
}
.nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0;
}
.nav-item.active .nav-dot { opacity: 1; }

.side-spacer { flex: 1; }

.side-session {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.side-session .micro { color: #8fa092; }
.side-email {
  color: #f1f5ee;
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
  word-break: break-all;
}
.side-meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.role-chip {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  background: rgba(216, 242, 107, 0.16);
  color: var(--lime);
  border: 1px solid rgba(216, 242, 107, 0.28);
  border-radius: 999px;
  padding: 2px 7px;
}
.side-session .tiny { color: #7f9182; }

.side-logout {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: #b9c6ba;
  font: inherit;
  font-size: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.side-logout:hover { border-color: var(--lime); color: var(--lime); }

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  width: max-content;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-deep);
}
.lang-switch button {
  appearance: none;
  border: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
}
.lang-switch button.active {
  background: var(--forest);
  color: var(--lime);
}
.sidebar .lang-switch {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  margin-bottom: 10px;
}
.sidebar .lang-switch button { color: #9fb0a1; }
.sidebar .lang-switch button.active { background: var(--lime); color: var(--forest-deep); }
.auth-lang {
  position: fixed;
  top: 22px;
  right: 24px;
  z-index: 30;
  background: rgba(13, 26, 18, 0.65);
  border-color: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
}
.auth-lang button { color: #b9c6ba; }
.auth-lang button.active { background: var(--lime); color: var(--forest-deep); }

/* ------------------------------------------------------------------- main */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 32px 16px;
  background: rgba(241, 239, 231, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.eyebrow {
  font-family: var(--mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 5px;
}
.topbar h1 { font-size: 27px; }
.topbar-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 0;
}

.status {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  max-width: 520px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status.ok { color: var(--green); }
.status.error { color: var(--red); }

.badge {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.badge.online {
  background: var(--lime-soft);
  border-color: #c4d98b;
  color: var(--forest);
}

.page-wrap {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 26px 32px 56px;
}
.page { animation: page-rise 0.32s cubic-bezier(0.22, 0.75, 0.25, 1) both; }

@keyframes page-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.dashboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.dashboard-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.dashboard-actions .tiny { color: var(--muted); }
.lede {
  font-size: 15px;
  color: var(--muted);
  max-width: 760px;
}

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.card-head h2 { font-size: 18px; margin-top: 4px; }
.card-title { font-family: var(--display); font-size: 16px; font-weight: 600; }
.card-sub { color: var(--muted); font-size: 11px; margin-top: 3px; }
.count-pill {
  font-family: var(--mono);
  font-size: 10px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  white-space: nowrap;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}
.grid-2.wide-left { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

/* ------------------------------------------------------------------- hero */
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr);
  gap: 18px;
}

.hero-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  color: #f2f5ee;
  background:
    radial-gradient(520px 260px at 92% 10%, rgba(216, 242, 107, 0.22), transparent 65%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0, rgba(255, 255, 255, 0.035) 1px, transparent 1px, transparent 46px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0, rgba(255, 255, 255, 0.03) 1px, transparent 1px, transparent 46px),
    var(--forest);
  box-shadow: var(--shadow);
}
.hero-card .micro { color: #a8b9aa; }
.hero-copy { min-width: 0; }
.hero-score {
  display: flex;
  align-items: baseline;
  gap: 2px;
  margin: 6px 0 2px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 68px;
  line-height: 1;
  letter-spacing: -0.06em;
  color: var(--lime);
}
.hero-unit { font-size: 24px; letter-spacing: 0; color: #dbe6c1; }
.hero-label {
  font-family: var(--display);
  font-size: 20px;
  margin-top: 4px;
}
.hero-meta { color: #a8b9aa; font-size: 12px; margin-top: 10px; max-width: 380px; }

.score-ring {
  --score: 0;
  flex: 0 0 auto;
  width: 144px;
  height: 144px;
  border-radius: 50%;
  padding: 10px;
  background:
    conic-gradient(var(--lime) calc(var(--score) * 1%), rgba(255, 255, 255, 0.12) 0);
  display: grid;
  place-items: center;
  transition: background 0.6s ease;
}
.score-ring-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--forest-deep);
  display: grid;
  place-content: center;
  text-align: center;
}
.score-ring-inner span {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 700;
  color: #f2f5ee;
  line-height: 1;
}
.score-ring-inner small {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8fa092;
  margin-top: 5px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: page-rise 0.4s both;
}
.stat::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: var(--line);
}
.stat.stat-alert::before { background: var(--red); }
.stat.stat-warn::before { background: var(--amber); }
.stat.stat-good::before { background: var(--green); }
.stat.stat-accent::before { background: var(--lime); }
.stat .label {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 600;
}
.stat .value {
  font-family: var(--mono);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-top: 6px;
}
.stat .sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.4;
}

/* ------------------------------------------------------------------- bars */
.bars { display: grid; gap: 12px; }
.bar-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
}
.bar-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--paper-deep);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: inherit;
  min-width: 2px;
  transition: width 0.6s ease;
}
.bar-row .bar-count {
  font-family: var(--mono);
  font-size: 11px;
  text-align: right;
  color: var(--ink);
}
.band-CRITICAL .bar-fill { background: var(--red); }
.band-HIGH .bar-fill { background: var(--amber); }
.band-MEDIUM .bar-fill { background: var(--blue); }
.band-LOW .bar-fill { background: var(--green); }
.band-NOT_ASSESSED .bar-fill { background: var(--line-strong); }

/* -------------------------------------------------------------- eval feed */
.eval-list { display: grid; gap: 10px; }
.eval-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.eval-item:last-child { border-bottom: 0; padding-bottom: 0; }
.eval-name { font-size: 12px; font-weight: 600; }
.eval-meta { font-family: var(--mono); font-size: 9.5px; color: var(--muted); margin-top: 3px; }
.eval-rate { text-align: right; font-family: var(--mono); font-size: 12px; font-weight: 700; }
.eval-rate small { display: block; font-weight: 400; color: var(--muted); font-size: 9px; margin-top: 2px; }
.mini-bar {
  height: 4px;
  border-radius: 999px;
  background: var(--paper-deep);
  margin-top: 6px;
  overflow: hidden;
}
.mini-bar span { display: block; height: 100%; background: var(--green); }

/* ------------------------------------------------------------------ table */
.table-wrap { overflow: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; }
th {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-align: left;
  font-weight: 600;
  padding: 0 8px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  vertical-align: middle;
}
tbody tr { cursor: pointer; transition: background 0.12s ease; }
tbody tr:hover { background: rgba(216, 242, 107, 0.14); }
tbody tr:last-child td { border-bottom: 0; }
.td-code { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.td-name { font-weight: 600; }
.td-sub { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* ------------------------------------------------------------------ chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  border-radius: 999px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  white-space: nowrap;
}
.chip::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.chip-CRITICAL { color: var(--red); border-color: #e7b4a7; background: #fdf1ee; }
.chip-HIGH { color: var(--amber); border-color: #e6cca0; background: #fdf7ea; }
.chip-MEDIUM { color: var(--blue); border-color: #b9cbe0; background: #eff5fb; }
.chip-LOW { color: var(--green); border-color: #b5d6c5; background: #eef8f2; }
.chip-NOT_ASSESSED { color: var(--muted); }
.chip-OPEN { color: var(--red); border-color: #e7b4a7; background: #fdf1ee; }
.chip-COMPLETED, .chip-APPROVED { color: var(--green); border-color: #b5d6c5; background: #eef8f2; }
.chip-RUNNING, .chip-PENDING_REVIEW { color: var(--amber); border-color: #e6cca0; background: #fdf7ea; }

/* ------------------------------------------------------------------ queue */
.queue { display: grid; gap: 9px; }
.queue-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.queue-item:last-child { border-bottom: 0; }
.queue-title { font-size: 12px; font-weight: 600; }
.queue-sub { font-size: 10px; color: var(--muted); margin-top: 2px; }
.queue-empty { color: var(--muted); font-size: 12px; padding: 12px 0; }

/* ------------------------------------------------------------------- mini */
.card.mini { box-shadow: none; background: transparent; border-style: dashed; }
.mini-value {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 8px;
}
.mini-sub { color: var(--muted); font-size: 11px; margin-top: 4px; }

.signal-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 28px 0 12px;
}
.signal-head h2 { margin-top: 4px; }
.signal-head p { max-width: 420px; text-align: right; }
.signal-grid { margin-top: 0; }

.card.signal {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-style: solid;
  box-shadow: var(--shadow);
  padding: 18px;
}
.card.signal::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--line);
}
.signal-evidence::before { background: var(--lime); }
.signal-findings::before { background: var(--amber); }
.signal-incidents::before { background: var(--red); }

.signal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.signal-tag {
  font-family: var(--mono);
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  white-space: nowrap;
}
.card.signal .mini-value {
  font-size: 40px;
  margin-top: 12px;
  line-height: 1;
}
.card.signal .mini-sub { margin-top: 6px; font-size: 12px; }
.signal-help {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

/* ---------------------------------------------------------------- systems */
.system-list { display: grid; gap: 8px; max-height: 420px; overflow: auto; }
.system-list.wide { max-height: none; }

.system-thead {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 96px 62px 62px 18px;
  gap: 10px;
  padding: 0 12px 8px;
  border-bottom: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.system-row {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  text-align: left;
  border-radius: 10px;
  padding: 11px 12px;
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 96px 62px 62px 18px;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.system-row:hover {
  border-color: var(--forest);
  background: #f7f8ee;
  transform: translateX(2px);
}
.system-code { font-family: var(--mono); font-size: 9.5px; color: var(--muted); }
.system-name { font-size: 12px; font-weight: 600; }
.system-name .sub { display: block; font-weight: 400; color: var(--muted); font-size: 10px; margin-top: 2px; }
.system-count { font-family: var(--mono); font-size: 10px; color: var(--muted); white-space: nowrap; }
.system-tier { display: flex; }
.system-arrow { font-family: var(--mono); color: var(--muted); }

.system-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.pager-info { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.pager-actions { display: flex; gap: 8px; }

.system-detail {
  margin: 16px 0 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8f6ef;
  padding: 16px;
}
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}
.detail-head h3 { font-size: 20px; margin-top: 4px; }
.detail-table-wrap { overflow: auto; }
.detail-table { width: 100%; border-collapse: collapse; }
.detail-table th {
  width: 108px;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  background: transparent;
}
.detail-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-soft);
}
.detail-table tr:last-child th,
.detail-table tr:last-child td { border-bottom: 0; }
.workspace-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------------------------------------------------------------- buttons */
.btn {
  appearance: none;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--forest); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #f6f4ec;
}
.btn.primary:hover { background: var(--forest); border-color: var(--forest); color: var(--lime); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: rgba(216, 242, 107, 0.2); border-color: var(--forest); }
.btn.small { font-size: 10.5px; padding: 5px 9px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* compatibility for dynamically rendered buttons */
button.ghost,
button.primary {
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 8px;
  padding: 7px 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
button.ghost {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
}
button.ghost:hover { background: rgba(216, 242, 107, 0.2); border-color: var(--forest); }
button.primary {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #f6f4ec;
}
button.primary:hover { background: var(--forest); border-color: var(--forest); color: var(--lime); }

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin: 12px 0;
}

/* ----------------------------------------------------------------- forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.form-grid .span-2 { grid-column: span 2; }
.form-stack { display: grid; gap: 13px; }

label {
  display: grid;
  gap: 6px;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  font-family: var(--body);
  font-size: 13px;
  color: var(--ink);
  background: #fffef9;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(216, 242, 107, 0.45);
}
input[readonly] { background: var(--paper-deep); color: var(--muted); }

textarea {
  min-height: 300px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  margin: 10px 0;
}

/* --------------------------------------------------------------- workspace */
.workspace {
  margin-top: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.workspace-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.workspace-head h2 { margin-top: 4px; }
.workspace-head .muted { margin-top: 4px; font-size: 12px; }

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  scrollbar-width: thin;
}
.tabs button {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.tabs button:hover { background: var(--paper-deep); color: var(--ink); }
.tabs button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--lime);
}
.tab-panel { margin-top: 6px; }

/* ------------------------------------------------------------------ lists */
.list { display: grid; gap: 10px; margin-top: 12px; }
.list .card { box-shadow: none; background: #f8f6ef; }
.list .card-title { font-size: 14px; }
.list .card-head { margin-bottom: 0; }

.report {
  background: var(--forest-deep);
  color: #dbe6c1;
  padding: 14px;
  border-radius: 10px;
  overflow: auto;
  max-height: 460px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
  margin: 10px 0 0;
}

.hint {
  background: var(--forest-deep);
  color: #dbe6c1;
  padding: 10px 12px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 11px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 10px 0 0;
}

.notes { margin: 0; padding-left: 18px; display: grid; gap: 9px; color: var(--muted); font-size: 12px; }
.notes b { color: var(--ink); }

/* ----------------------------------------------------------------- docs */
.docs-layout {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.docs-toc {
  position: sticky;
  top: 94px;
  display: grid;
  gap: 2px;
  padding: 16px;
}
.docs-toc button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  text-align: left;
  padding: 7px 8px;
  border-radius: 7px;
  cursor: pointer;
}
.docs-toc button:hover {
  background: var(--paper-deep);
  color: var(--ink);
}
.docs-content { display: grid; gap: 16px; min-width: 0; }
html[data-lang="vi"] [data-lang-content="en"],
html[data-lang="en"] [data-lang-content="vi"] { display: none !important; }
.doc-section { scroll-margin-top: 108px; }
.doc-section h2 { margin: 6px 0 14px; }
.doc-lead { font-size: 15px; line-height: 1.65; color: var(--ink-soft); margin-bottom: 14px; }
.doc-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #f8f6ef;
}
.doc-panel p { margin-top: 6px; font-size: 12.5px; line-height: 1.6; color: var(--ink-soft); }
.doc-steps {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 9px;
  font-size: 13px;
  color: var(--ink-soft);
}
.doc-list {
  margin: 10px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-soft);
}
.doc-note,
.doc-warn {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.55;
}
.doc-note { background: var(--lime-soft); border-left: 3px solid var(--lime); }
.doc-warn { background: #fdf1ee; border-left: 3px solid var(--red); color: #792d1d; }
.doc-code {
  background: var(--forest-deep);
  color: #dbe6c1;
  padding: 14px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
  overflow: auto;
  margin: 14px 0;
}
.doc-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 12px 0 16px;
}
.doc-flow span {
  border: 1px solid var(--line);
  background: #f8f6ef;
  padding: 6px 9px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
}
.doc-flow i { color: var(--muted); font-style: normal; }
.doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 14px 0;
}
.doc-table-wrap { overflow: auto; }
.doc-table th,
.doc-table td { font-size: 12px; }
.doc-faq details {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #f8f6ef;
}
.doc-faq summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
}
.doc-faq p { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.55; }

/* --------------------------------------------------------------- roadmap */
.phase-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.phase-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  background: var(--card);
  position: relative;
  overflow: hidden;
}
.phase-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--line-strong);
}
.phase-card.now { background: linear-gradient(180deg, var(--lime-soft), var(--card)); border-color: #b9cd7a; }
.phase-card.now::before { background: var(--lime); }
.phase-card.vision::before { background: var(--forest); }
.phase-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.phase-num { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; color: var(--muted); }
.phase-status {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
}
.phase-status.now { background: var(--forest); border-color: var(--forest); color: var(--lime); }
.phase-card h3 { font-size: 21px; margin: 12px 0 5px; }
.phase-sub { font-size: 11.5px; color: var(--muted); min-height: 32px; }
.phase-list { list-style: none; margin-top: 14px; display: grid; gap: 6px; }
.phase-list li { font-size: 11.5px; color: var(--ink-soft); }
.phase-list li::before { content: "→ "; color: var(--forest); font-family: var(--mono); }

.roadmap-section { margin-top: 30px; }
.roadmap-section h2 { margin: 5px 0 14px; }
.roadmap-detail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.roadmap-detail .card { box-shadow: none; }
.roadmap-detail h3 { font-size: 19px; margin: 6px 0 10px; }
.roadmap-detail p { font-size: 12px; line-height: 1.55; margin-bottom: 7px; }
.roadmap-detail .doc-list { margin-top: 8px; }
.roadmap-detail .doc-note { margin-top: 12px; font-size: 11.5px; }

.synergy-panel {
  position: relative;
  overflow: hidden;
  margin-top: 30px;
  border-radius: 16px;
  padding: 26px;
  color: #eef3ea;
  background:
    radial-gradient(560px 260px at 90% 0%, rgba(216, 242, 107, 0.22), transparent 65%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0, rgba(255, 255, 255, 0.035) 1px, transparent 1px, transparent 54px),
    var(--forest-deep);
}
.synergy-panel .micro { color: #93a394; }
.synergy-panel h2 { color: #fff; font-size: 30px; margin: 6px 0 18px; max-width: 760px; }
.flow-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.flow-node {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 11px;
  color: #dfe8d9;
}
.flow-node.accent { background: var(--lime); border-color: var(--lime); color: var(--forest-deep); font-weight: 700; }
.flow-arrow { color: #7f9182; font-family: var(--mono); font-size: 12px; }
.pdca { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 20px; }
.pdca > div {
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: 10px;
  display: grid;
  gap: 5px;
}
.pdca b { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; color: var(--lime); text-transform: uppercase; }
.pdca span { font-size: 11px; line-height: 1.45; color: #a9b8ab; }

.stack-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stack-grid .card { box-shadow: none; }
.stack-grid h3 { font-size: 17px; margin: 6px 0; }
.stack-grid p { font-size: 11.5px; line-height: 1.5; }

.hybrid-flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 10px;
  align-items: stretch;
  margin-top: 16px;
}
.hybrid-col {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: var(--card);
}
.hybrid-col.accent { background: var(--lime-soft); border-color: #b9cd7a; }
.hybrid-col p { font-size: 11.5px; line-height: 1.5; margin-top: 6px; }
.hybrid-arrow { display: grid; place-items: center; color: var(--muted); font-family: var(--mono); }

.roadmap-checks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.roadmap-checks span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: var(--card);
  font-size: 11.5px;
  color: var(--ink-soft);
}
.roadmap-checks span::first-letter { color: var(--green); }

/* --------------------------------------------------------------- gap/risk */
.score-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 86px minmax(180px, 0.8fr);
  gap: 10px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding: 11px 0;
}
.score-row:last-child { border-bottom: 0; }
.score-row .q { font-weight: 600; font-size: 12px; }
.score-row .code { font-family: var(--mono); color: var(--muted); font-size: 9.5px; margin-top: 3px; }
.severity-CRITICAL { color: var(--red); font-weight: 700; }
.severity-MAJOR { color: var(--amber); font-weight: 700; }
.severity-MINOR { color: var(--blue); font-weight: 700; }
.severity-LOW { color: var(--green); font-weight: 700; }

/* --------------------------------------------------------------- sessions */
.session {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--card);
}
.session.active { border-color: #b6c97c; background: var(--lime-soft); }
.session .row { margin: 0; }

/* ------------------------------------------------------------- auth gate */
.auth-gate {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
  background: var(--paper);
}

.auth-visual {
  position: relative;
  overflow: hidden;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #f2f5ee;
  background:
    radial-gradient(720px 420px at 80% 0%, rgba(216, 242, 107, 0.25), transparent 65%),
    var(--forest);
}
.auth-grid-overlay {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0, rgba(255, 255, 255, 0.05) 1px, transparent 1px, transparent 64px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.04) 0, rgba(255, 255, 255, 0.04) 1px, transparent 1px, transparent 64px);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent 85%);
  pointer-events: none;
}
.auth-brandline {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: #a8b9aa;
}
.auth-visual h1 {
  position: relative;
  font-size: clamp(42px, 5vw, 68px);
  line-height: 0.98;
  margin: 42px 0 22px;
  letter-spacing: -0.035em;
}
.auth-visual h1::after {
  content: "";
  display: block;
  width: 92px;
  height: 5px;
  margin-top: 24px;
  background: var(--lime);
}
.auth-visual > p {
  position: relative;
  max-width: 520px;
  color: #b7c5b8;
  font-size: 15px;
  line-height: 1.6;
}
.auth-signals {
  position: relative;
  display: flex;
  gap: 36px;
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  max-width: 560px;
}
.auth-signals > div { display: grid; gap: 3px; }
.signal-value { font-family: var(--mono); font-size: 24px; font-weight: 700; color: var(--lime); }
.signal-label {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #8fa092;
}

.auth-panel {
  display: grid;
  place-items: center;
  padding: 40px;
  background:
    radial-gradient(600px 300px at 100% 100%, rgba(216, 242, 107, 0.2), transparent 60%),
    var(--paper);
}
.auth-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px;
  box-shadow: 0 30px 60px -40px rgba(16, 24, 18, 0.55);
}
.auth-card-head h2 { font-size: 27px; margin: 5px 0 5px; }
.auth-state { margin-top: 14px; min-height: 16px; }
.auth-state.error { color: var(--red); }
.auth-state.ok { color: var(--green); }
.auth-demo {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 7px;
}
.demo-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 10px;
  color: var(--muted);
}

/* ----------------------------------------------------------------- modal */
body.modal-open { overflow: hidden; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 18, 12, 0.58);
  backdrop-filter: blur(7px);
}
.modal-panel {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 30px 90px -30px rgba(0, 0, 0, 0.75);
  animation: modal-in 0.22s cubic-bezier(0.22, 0.75, 0.25, 1) both;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}
.modal-head h2 { font-size: 25px; margin-top: 4px; }
.modal-close {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { background: var(--paper-deep); color: var(--ink); }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}
@media (max-width: 1180px) {
  .hero-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .phase-grid,
  .roadmap-detail,
  .stack-grid { grid-template-columns: 1fr; }
  .hybrid-flow { grid-template-columns: 1fr; }
  .hybrid-arrow { display: none; }
  .pdca { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .docs-layout { grid-template-columns: 1fr; }
  .docs-toc { position: static; }
  .doc-grid { grid-template-columns: 1fr; }
  .phase-grid,
  .roadmap-detail,
  .stack-grid { grid-template-columns: 1fr; }
  .pdca { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hybrid-flow { grid-template-columns: 1fr; }
  .hybrid-arrow { display: none; }
  .roadmap-checks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar {
    position: relative;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
  }
  .org-block { display: none; }
  .nav { display: flex; flex-wrap: wrap; width: 100%; order: 3; }
  .nav-item { grid-template-columns: auto auto; padding: 8px 10px; }
  .nav-code, .nav-dot { display: none; }
  .side-spacer { display: none; }
  .side-session { border-top: 0; padding: 0; margin-left: auto; text-align: right; }
  .side-email { max-width: 180px; }
  .side-logout { padding: 8px 10px; }
  .topbar { padding: 16px 20px; }
  .page-wrap { padding: 20px 20px 40px; }
  .grid-2, .grid-2.wide-left, .grid-3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-gate { grid-template-columns: 1fr; }
  .auth-visual { min-height: 300px; padding: 32px 28px; }
  .auth-visual h1 { font-size: 38px; margin: 24px 0 14px; }
  .auth-signals { display: none; }
  .auth-panel { padding: 28px 20px 48px; }
}

@media (max-width: 700px) {
  .system-thead { display: none; }
  .system-row { grid-template-columns: 68px minmax(0, 1fr) 18px; }
  .system-row .system-tier,
  .system-row .system-count { display: none; }
}

@media (max-width: 620px) {
  .topbar { align-items: flex-start; flex-direction: column; gap: 8px; }
  .topbar-right { align-items: flex-start; }
  .signal-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .signal-head p { text-align: left; }
  .stat-grid { grid-template-columns: 1fr; }
  .hero-card { flex-direction: column; align-items: flex-start; }
  .score-ring { width: 112px; height: 112px; }
  .hero-score { font-size: 54px; }
  .bar-row { grid-template-columns: 66px minmax(0, 1fr) 30px; }
  .score-row { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .roadmap-checks { grid-template-columns: 1fr; }
  .auth-card { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

:focus-visible {
  outline: 2px solid var(--forest);
  outline-offset: 2px;
}
