/* ============================================================
   Adempitalia · Report Processi · Design System
   ============================================================ */

:root {
  /* Surfaces */
  --bg:           oklch(0.985 0.005 80);
  --bg-elev:     #ffffff;
  --bg-sunken:   oklch(0.97 0.006 80);
  --bg-band:     oklch(0.955 0.008 80);

  /* Ink */
  --ink:          oklch(0.22 0.012 250);
  --ink-soft:     oklch(0.42 0.012 250);
  --ink-mute:     oklch(0.58 0.010 250);
  --ink-faint:    oklch(0.72 0.008 250);

  /* Lines */
  --line:         oklch(0.90 0.008 80);
  --line-strong:  oklch(0.82 0.010 80);

  /* Accents — same chroma family */
  --primary:      oklch(0.48 0.085 235);
  --primary-soft: oklch(0.92 0.025 235);
  --primary-ink:  oklch(0.32 0.075 235);

  --waste:        oklch(0.56 0.135 40);
  --waste-soft:   oklch(0.94 0.028 40);
  --waste-ink:    oklch(0.40 0.115 40);

  --save:         oklch(0.52 0.085 160);
  --save-soft:    oklch(0.93 0.030 160);
  --save-ink:     oklch(0.38 0.075 160);

  --warn:         oklch(0.70 0.13 75);
  --warn-soft:    oklch(0.95 0.045 75);
  --warn-ink:     oklch(0.40 0.10 75);

  /* Type */
  --font-display: "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-body:    "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-serif:   "Instrument Serif", ui-serif, Georgia, serif;
  --font-numeric: "DM Serif Display", "Instrument Serif", ui-serif, Georgia, serif;
  --font-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  /* Geometry */
  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 14px;

  --pad-x: clamp(20px, 4vw, 64px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: "ss01", "ss02", "cv11", "tnum";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ----- Typography ----- */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.012em;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(40px, 5vw, 64px); line-height: 1.02; letter-spacing: -0.025em; font-weight: 500; }
h2 { font-size: clamp(26px, 3vw, 36px); line-height: 1.1; letter-spacing: -0.02em; }
h3 { font-size: clamp(20px, 2.2vw, 24px); line-height: 1.2; }
h4 { font-size: 16px; line-height: 1.3; }
h5 { font-size: 13px; line-height: 1.3; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-mute); font-weight: 500; }

p { margin: 0 0 0.8em 0; max-width: 68ch; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a { color: var(--primary-ink); text-decoration: none; border-bottom: 1px solid color-mix(in oklch, var(--primary), transparent 70%); }
a:hover { border-bottom-color: var(--primary); }

strong { font-weight: 600; }
em { font-style: italic; }

.serif { font-family: var(--font-serif); font-weight: 400; font-style: italic; letter-spacing: -0.01em; }
.mono  { font-family: var(--font-mono); font-feature-settings: "tnum"; }
.label { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-mute); font-weight: 500; }
.eyebrow { font-family: var(--font-display); font-size: 12px; text-transform: uppercase; letter-spacing: 0.18em; color: var(--ink-mute); font-weight: 500; }

/* ----- Layout ----- */
.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 var(--pad-x);
}

.page--narrow {
  max-width: 920px;
}

section {
  padding: clamp(40px, 6vw, 88px) 0;
  border-top: 1px solid var(--line);
}
section:first-of-type { border-top: none; }

section.band {
  background: var(--bg-band);
}
section.dark {
  background: oklch(0.18 0.012 250);
  color: oklch(0.94 0.008 80);
}
section.dark h1, section.dark h2, section.dark h3, section.dark h4 { color: oklch(0.98 0.006 80); }
section.dark .eyebrow, section.dark .label { color: oklch(0.72 0.012 80); }

/* ----- Top bar ----- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklch, var(--bg), transparent 8%);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px var(--pad-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.01em;
  font-size: 14px;
}
.topbar__brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  position: relative;
}
.topbar__brand-mark::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--bg);
}
.topbar__nav {
  display: flex;
  gap: 24px;
  font-size: 13px;
  color: var(--ink-soft);
}
.topbar__nav a {
  color: var(--ink-soft);
  border: none;
}
.topbar__nav a:hover { color: var(--ink); }

.topbar__meta { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.08em; }

/* ----- Hero ----- */
.hero {
  padding-top: clamp(56px, 8vw, 120px);
  padding-bottom: clamp(48px, 6vw, 96px);
  border-top: none;
}
.hero__crumb {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-mute);
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.hero__crumb span:not(:last-child)::after {
  content: "/";
  margin-left: 14px;
  color: var(--ink-faint);
}
.hero__title {
  max-width: 22ch;
  margin-bottom: 24px;
}
.hero__dek {
  font-size: clamp(17px, 1.5vw, 19px);
  max-width: 60ch;
  color: var(--ink-soft);
  line-height: 1.55;
}
.hero__meta {
  margin-top: 48px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 32px 48px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  max-width: 880px;
}
.hero__meta-item .label { display: block; margin-bottom: 6px; }
.hero__meta-item .value { font-size: 15px; color: var(--ink); }

/* ----- KPIs ----- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.kpi {
  padding: 24px 24px 22px;
  background: var(--bg-elev);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 158px;
}
.kpi__label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
  font-weight: 500;
}
.kpi__value {
  font-family: var(--font-numeric);
  font-weight: 400;
  font-size: clamp(40px, 5vw, 60px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-top: auto;
  overflow-wrap: anywhere;
  word-break: keep-all;
}
.kpi__value .unit {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  color: var(--ink-mute);
  letter-spacing: 0;
  margin-left: 6px;
  vertical-align: 0.55em;
  white-space: nowrap;
}
.kpi__value--text {
  font-size: clamp(22px, 2.4vw, 28px) !important;
  letter-spacing: -0.005em !important;
  line-height: 1.15;
}
.kpi__sub {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.4;
}
.kpi--accent .kpi__value { color: var(--primary-ink); }
.kpi--save  .kpi__value { color: var(--save-ink); }
.kpi--waste .kpi__value { color: var(--waste-ink); }

/* ----- Tags & Pills ----- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--bg-sunken);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  font-weight: 500;
  white-space: nowrap;
}
.tag--primary { background: var(--primary-soft); color: var(--primary-ink); border-color: color-mix(in oklch, var(--primary), transparent 70%); }
.tag--waste   { background: var(--waste-soft);   color: var(--waste-ink);   border-color: color-mix(in oklch, var(--waste), transparent 70%); }
.tag--save    { background: var(--save-soft);    color: var(--save-ink);    border-color: color-mix(in oklch, var(--save), transparent 70%); }
.tag--warn    { background: var(--warn-soft);    color: oklch(0.40 0.10 75); border-color: color-mix(in oklch, var(--warn), transparent 70%); }

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-mute);
  flex-shrink: 0;
}
.dot--primary { background: var(--primary); }
.dot--waste   { background: var(--waste); }
.dot--save    { background: var(--save); }
.dot--warn    { background: var(--warn); }

/* ----- Headings/section intro ----- */
.section-head {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 48px;
  margin-bottom: 48px;
  align-items: end;
}
@media (max-width: 800px) { .section-head { grid-template-columns: 1fr; gap: 16px; } }

.section-head__num {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-mute);
}
.section-head__title { max-width: 22ch; }
.section-head__dek { color: var(--ink-soft); max-width: 56ch; }

/* ----- Cards ----- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.card--sunken { background: var(--bg-sunken); }
.card--accent { border-color: color-mix(in oklch, var(--primary), transparent 70%); background: color-mix(in oklch, var(--primary-soft), var(--bg-elev) 50%); }
.card--waste  { border-color: color-mix(in oklch, var(--waste), transparent 70%); background: color-mix(in oklch, var(--waste-soft), var(--bg-elev) 50%); }
.card--save   { border-color: color-mix(in oklch, var(--save), transparent 70%); background: color-mix(in oklch, var(--save-soft), var(--bg-elev) 50%); }

/* ----- Tables ----- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-elev); }
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.tbl th, .tbl td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.tbl th {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--line-strong);
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: var(--bg-sunken); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td .code { font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); background: var(--bg-sunken); padding: 1px 6px; border-radius: 3px; }
.tbl tr.is-new td { background: color-mix(in oklch, var(--primary-soft), var(--bg-elev) 50%); }
.tbl tr.is-gap td { background: color-mix(in oklch, var(--waste-soft), var(--bg-elev) 60%); }
.tbl tr.is-total td { font-weight: 600; background: var(--bg-sunken); border-top: 1px solid var(--line-strong); }

/* ----- BPMN ----- */
.bpmn {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  overflow-x: auto;
}
.bpmn svg { display: block; max-width: 100%; height: auto; }
.bpmn__legend {
  display: flex;
  gap: 20px 28px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-soft);
}
.bpmn__legend-item { display: flex; align-items: center; gap: 8px; }
.bpmn__legend-swatch { width: 18px; height: 12px; border-radius: 3px; border: 1.5px solid currentColor; background: var(--bg-sunken); }

/* ----- Lists ----- */
.list-bare { list-style: none; padding: 0; margin: 0; }
.list-bare > li { padding: 14px 0; border-top: 1px solid var(--line); }
.list-bare > li:first-child { border-top: none; padding-top: 0; }

.list-num { list-style: none; padding: 0; margin: 0; counter-reset: ln; }
.list-num > li {
  counter-increment: ln;
  padding: 16px 0 16px 56px;
  border-top: 1px solid var(--line);
  position: relative;
}
.list-num > li::before {
  content: counter(ln, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 18px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
}
.list-num > li:first-child { border-top: none; padding-top: 0; }
.list-num > li:first-child::before { top: 2px; }

/* ----- Stat row ----- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 32px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat__label { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-mute); }
.stat__value { font-family: var(--font-numeric); font-weight: 400; font-size: 32px; line-height: 1.1; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.stat__value .unit { font-family: var(--font-display); font-weight: 500; font-size: 13px; color: var(--ink-mute); margin-left: 4px; vertical-align: 0.55em; }

/* ----- Two-col content ----- */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}
.split--1-2 { grid-template-columns: 1fr 2fr; }
.split--2-1 { grid-template-columns: 2fr 1fr; }
@media (max-width: 800px) { .split, .split--1-2, .split--2-1 { grid-template-columns: 1fr; gap: 24px; } }

/* ----- Index cards ----- */
.report-card {
  display: grid;
  grid-template-columns: 220px 1fr auto;
  gap: 32px;
  padding: 32px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  align-items: center;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--line);
  transition: border-color 0.2s, transform 0.2s;
}
.report-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.report-card__num { font-family: var(--font-numeric); font-weight: 400; font-size: 96px; line-height: 1; color: var(--primary); letter-spacing: -0.03em; }
.report-card__title { font-family: var(--font-display); font-size: 24px; line-height: 1.15; margin-bottom: 8px; letter-spacing: -0.015em; }
.report-card__dek { color: var(--ink-soft); font-size: 14.5px; }
.report-card__arrow { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.report-card:hover .report-card__arrow { background: var(--ink); color: var(--bg); border-color: var(--ink); }
@media (max-width: 700px) { .report-card { grid-template-columns: 1fr; padding: 24px; } .report-card__num { font-size: 56px; } }

/* ----- Footer ----- */
.foot {
  padding: 48px var(--pad-x) 56px;
  border-top: 1px solid var(--line);
  background: var(--bg-sunken);
  font-size: 12px;
  color: var(--ink-mute);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.foot__inner { max-width: 1240px; margin: 0 auto; display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }

/* ----- Misc ----- */
.divider { height: 1px; background: var(--line); margin: 32px 0; border: none; }
hr { all: unset; display: block; height: 1px; background: var(--line); margin: 32px 0; }

.callout {
  border-left: 3px solid var(--primary);
  background: color-mix(in oklch, var(--primary-soft), var(--bg-elev) 60%);
  padding: 16px 18px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 14px;
  color: var(--ink-soft);
}
.callout--waste { border-color: var(--waste); background: color-mix(in oklch, var(--waste-soft), var(--bg-elev) 60%); color: var(--waste-ink); }
.callout--save  { border-color: var(--save);  background: color-mix(in oklch, var(--save-soft), var(--bg-elev) 60%); color: var(--save-ink); }

/* ----- Index hero ----- */
.index-hero {
  padding: clamp(72px, 10vw, 120px) 0 clamp(40px, 5vw, 64px);
}
.index-hero__title { font-size: clamp(44px, 6vw, 84px); line-height: 0.98; letter-spacing: -0.03em; max-width: 18ch; margin-bottom: 28px; font-weight: 500; }
.index-hero__title .serif { color: var(--primary); }

/* ----- Hero numero (centerpiece) ----- */
.hero-number {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(48px, 6vw, 88px) clamp(32px, 5vw, 64px);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero-number--save {
  background: linear-gradient(180deg, oklch(0.98 0.018 160) 0%, oklch(0.96 0.025 160) 100%);
  border-color: color-mix(in oklch, var(--save), transparent 60%);
}
.hero-number__eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--save-ink);
  margin-bottom: 28px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.hero-number__eyebrow::before, .hero-number__eyebrow::after {
  content: "";
  display: inline-block;
  width: 28px; height: 1px;
  background: var(--save);
  opacity: 0.5;
}
.hero-number__value {
  font-family: var(--font-numeric);
  font-weight: 400;
  font-size: clamp(56px, 8vw, 104px);
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--save);
  margin-bottom: 14px;
}
.hero-number__value .unit {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.22em;
  color: var(--ink-soft);
  letter-spacing: -0.005em;
  margin-left: 10px;
  vertical-align: 0.8em;
}
.hero-number__sub {
  font-family: var(--font-display);
  font-size: clamp(18px, 1.8vw, 22px);
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}
.hero-number__caption {
  font-size: 15px;
  color: var(--ink-soft);
  max-width: 56ch;
  margin: 0 auto;
}
.hero-number__chips {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid color-mix(in oklch, var(--save), transparent 70%);
  width: 100%;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}
.hero-number__chip {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--ink-soft);
}
.hero-number__chip b { font-weight: 600; color: var(--save-ink); font-family: var(--font-numeric); font-size: 15px; }

/* ----- Hero number breakdown (FER / Sopralluogo) ----- */
.hero-number__breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: color-mix(in oklch, var(--save), transparent 75%);
  border: 1px solid color-mix(in oklch, var(--save), transparent 70%);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 36px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}
.hero-number__bd-cell {
  background: var(--bg-elev);
  padding: 24px 28px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hero-number__bd-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.hero-number__bd-value {
  font-family: var(--font-numeric);
  font-weight: 400;
  font-size: clamp(48px, 6vw, 72px);
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--save-ink);
}
.hero-number__bd-value .unit {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.22em;
  color: var(--ink-mute);
  margin-left: 6px;
  vertical-align: 0.7em;
  letter-spacing: 0;
}
.hero-number__bd-sub {
  font-size: 12.5px;
  color: var(--ink-soft);
}
@media (max-width: 640px) { .hero-number__breakdown { grid-template-columns: 1fr; } }

/* ----- Gap process-total annotation ----- */
.gap__total {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 4px;
}
.gap__total b {
  font-family: var(--font-numeric);
  font-weight: 400;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--ink-soft);
  text-transform: none;
}
.gap__scope {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--waste-ink);
  margin-bottom: -4px;
}
.gap__col--before .gap__scope { color: var(--waste-ink); }
.gap__col--after  .gap__scope { color: var(--save-ink); }
.gap {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(28px, 4vw, 48px);
  display: grid;
  grid-template-columns: 1fr 80px 1fr 1fr;
  gap: clamp(20px, 3vw, 40px);
  align-items: stretch;
}
.gap__col { display: flex; flex-direction: column; gap: 10px; }
.gap__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.gap__value {
  font-family: var(--font-numeric);
  font-weight: 400;
  font-size: clamp(48px, 7vw, 84px);
  line-height: 0.95;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.gap__value .unit {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.22em;
  color: var(--ink-mute);
  margin-left: 6px;
  vertical-align: 0.75em;
  letter-spacing: 0;
}
.gap__col--before .gap__value { color: var(--waste-ink); }
.gap__col--after  .gap__value { color: var(--save-ink); }
.gap__col--save   .gap__value { color: var(--save); }
.gap__col--save {
  background: oklch(0.97 0.025 160);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: -20px -24px;
}
.gap__sub { font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.gap__arrow {
  align-self: center;
  justify-self: center;
  color: var(--ink-mute);
  display: flex;
  align-items: center;
}
.gap__sublabel {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 4px;
}
@media (max-width: 800px) {
  .gap { grid-template-columns: 1fr; }
  .gap__arrow { transform: rotate(90deg); padding: 8px 0; }
  .gap__col--save { margin: 0; }
}

/* ----- Swimlane ----- */
.swim {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
}
.swim__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--bg-sunken);
}
.swim__legend-item { display: flex; align-items: center; gap: 8px; }
.swim__legend-swatch { width: 16px; height: 12px; border-radius: 3px; border: 1.5px solid currentColor; background: var(--bg-elev); }

.sw-label { display: flex; align-items: center; }
.sw-label__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  letter-spacing: -0.005em;
  text-align: right;
}
.sw-label__sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--ink-mute);
  text-align: right;
  margin-top: 3px;
}
.sw-step {
  background: var(--bg-elev);
  border: 1.5px solid var(--ink-soft);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-sizing: border-box;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.sw-step:hover { transform: translateY(-1px); box-shadow: 0 4px 14px -4px color-mix(in oklch, var(--ink), transparent 80%); }
.sw-step:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.sw-step__code {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  font-weight: 500;
}
.sw-step__title {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sw-step__meta {
  margin-top: auto;
  display: flex;
  gap: 6px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.02em;
}
.sw-step__work { color: var(--primary-ink); font-weight: 500; }
.sw-step__wait { color: var(--waste-ink); font-weight: 500; }
.sw-step__save { color: var(--save-ink); font-weight: 600; font-size: 10.5px; }
.sw-step__badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}
.sw-step__badge--elim    { background: var(--bg-sunken); color: var(--ink-mute); border: 1px solid var(--line); }
.sw-step__badge--gap     { background: var(--save-soft); color: var(--save-ink); }
.sw-step__badge--auto    { background: var(--save-soft); color: var(--save-ink); }
.sw-step__badge--neutral { background: var(--bg-sunken); color: var(--ink-mute); }

.sw-step__meta--tobe { display: none; }

.sw-step--start, .sw-step--end {
  border-radius: 50px;
  background: var(--ink);
  border-color: var(--ink);
  text-align: center;
  align-items: center;
  justify-content: center;
}
.sw-step--start .sw-step__code, .sw-step--end .sw-step__code { color: oklch(0.85 0.005 80); }
.sw-step--start .sw-step__title, .sw-step--end .sw-step__title { color: var(--bg); }
.sw-step--gate { background: var(--warn-soft); border-color: var(--warn); }
.sw-step--gate .sw-step__code { color: oklch(0.40 0.10 75); }
.sw-step--gap { background: var(--waste-soft); border-color: var(--waste); border-style: dashed; }
.sw-step--gap .sw-step__code { color: var(--waste-ink); }
.sw-step--new { background: color-mix(in oklch, var(--primary-soft), var(--bg-elev) 30%); border-color: var(--primary); }
.sw-step--new .sw-step__code { color: var(--primary-ink); }
.sw-step--waste { background: var(--waste-soft); border-color: var(--waste); border-style: dashed; }
.sw-step--waste .sw-step__code { color: var(--waste-ink); }

/* ----- Swimlane TO-BE mode ----- */
.swim--tobe .sw-step__meta--asis { display: none; }
.swim--tobe .sw-step__meta--tobe { display: flex; }
.swim--tobe .sw-step[data-tobe="changed"] {
  border-color: var(--save);
  background: color-mix(in oklch, var(--save-soft), var(--bg-elev) 50%);
}
.swim--tobe .sw-step[data-tobe="automated"] {
  border-color: var(--save);
  background: var(--save-soft);
}
.swim--tobe .sw-step[data-tobe="gap-closed"] {
  border-color: var(--save);
  border-style: solid;
  background: var(--save-soft);
}
.swim--tobe .sw-step[data-tobe="eliminated"] {
  opacity: 0.45;
  border-style: dashed;
  background: var(--bg-sunken);
  border-color: var(--ink-mute);
}
.swim--tobe .sw-step[data-tobe="eliminated"] .sw-step__title { text-decoration: line-through; color: var(--ink-mute); }
.swim--tobe .sw-step[data-tobe="unchanged"] {
  border-style: dashed;
  opacity: 0.85;
}

/* Swimlane controls (toggle button) */
.swim-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.swim-toggle {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: var(--bg-elev);
  color: var(--ink);
  cursor: pointer;
  letter-spacing: -0.005em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s, color 0.15s;
}
.swim-toggle:hover { background: var(--ink); color: var(--bg); }
.swim-toggle.is-active {
  background: var(--save);
  border-color: var(--save);
  color: white;
}
.swim-toggle__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--save);
}
.swim-toggle.is-active .swim-toggle__dot { background: white; }
.swim-hint {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* ----- Step Detail Modal ----- */
.step-modal-overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in oklch, var(--ink), transparent 30%);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 24px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: modalFadeIn 0.18s ease-out;
}
.step-modal-overlay.is-open { display: flex; }
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.step-modal {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  max-width: 620px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 36px 36px 32px;
  position: relative;
  box-shadow: 0 24px 64px -8px color-mix(in oklch, var(--ink), transparent 60%);
  animation: modalSlideIn 0.22s ease-out;
}
@keyframes modalSlideIn {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.step-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  font-size: 18px;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.step-modal__close:hover { background: var(--bg-sunken); color: var(--ink); }
.step-modal__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.step-modal__code {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  background: var(--bg-sunken);
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 500;
}
.step-modal__title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin-bottom: 24px;
}
.step-modal__section {
  padding: 20px 0;
  border-top: 1px solid var(--line);
}
.step-modal__section:first-of-type { border-top: 1px solid var(--line); }
.step-modal__section--tobe {
  background: color-mix(in oklch, var(--save-soft), var(--bg-elev) 60%);
  margin: 20px -36px -32px;
  padding: 20px 36px 28px;
  border-top: 1px solid color-mix(in oklch, var(--save), transparent 70%);
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}
.step-modal__section-head {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 14px;
  font-weight: 500;
}
.step-modal__grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px 20px;
  margin: 0;
}
.step-modal__grid dt {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
  padding-top: 3px;
}
.step-modal__grid dd {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.5;
}
@media (max-width: 540px) {
  .step-modal { padding: 28px 24px; }
  .step-modal__title { font-size: 22px; }
  .step-modal__grid { grid-template-columns: 1fr; gap: 4px 0; }
  .step-modal__grid dd { margin-bottom: 8px; }
  .step-modal__section--tobe { margin: 20px -24px -28px; padding: 20px 24px 24px; }
}

/* ----- Print ----- */
@media print {
  .topbar { display: none; }
  section { padding: 24px 0; page-break-inside: avoid; }
  .hero { padding: 24px 0 16px; }
  body { font-size: 11pt; }
  .bpmn { page-break-inside: avoid; }
}
