/* KFINFO — editorial data-journal look: warm paper, deep ink, petrol + saffron accents. */
:root {
  --paper: #f6f1e7;
  --paper-2: #efe8da;
  --card: #fbf8f1;
  --ink: #13212b;
  --ink-2: #3b4a54;
  --muted: #6c7a83;
  --rule: #d9cfbd;
  --rule-strong: #b9ab92;
  --petrol: #008c80;
  --petrol-deep: #00564f;
  --saffron: #b07210;
  --terracotta: #b4533a;
  --up: #1d6f42;
  --down: #a33a2a;
  --s1: #008c80; --s2: #b07210; --s3: #2563a8; --s4: #b4533a; --s5: #7e4fa6; --s6: #5f7a1e;
  --display: "Fraunces", Georgia, serif;
  --text: "IBM Plex Sans", "Helvetica Neue", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 4px;
  --maxw: 1240px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: "tnum" 1;
}
a { color: inherit; }
.muted { color: var(--muted); }
.mono, .figure { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Subtle paper grain */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.38 0 0 0 0 0.25 0 0 0 .18 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.masthead, .page, .footer { position: relative; z-index: 1; }

/* Masthead */
.masthead { border-bottom: 1px solid var(--ink); background: var(--paper); }
.masthead__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 18px 28px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 32px; align-items: center;
}
.wordmark { text-decoration: none; display: flex; flex-direction: column; gap: 2px; }
.wordmark__mark { font-family: var(--display); font-weight: 700; font-size: 30px; letter-spacing: -.02em; line-height: 1; }
.wordmark__mark em { font-style: italic; font-weight: 400; color: var(--petrol); }
.wordmark__tag { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav { display: flex; gap: 26px; justify-content: center; flex-wrap: wrap; }
.nav a { text-decoration: none; font-weight: 500; font-size: 15px; padding: 6px 0; border-bottom: 2px solid transparent; }
.nav a:hover { border-color: var(--rule-strong); }
.nav a[aria-current="page"] { border-color: var(--petrol); color: var(--petrol-deep); }
.masthead__tools { display: flex; gap: 14px; align-items: center; font-size: 13px; }
.lang { font-family: var(--mono); text-decoration: none; border: 1px solid var(--ink); padding: 2px 8px; border-radius: var(--radius); }
.lang:hover { background: var(--ink); color: var(--paper); }
.admin-link { color: var(--muted); text-decoration: none; }
.admin-link:hover { color: var(--ink); }

/* Page */
.page { max-width: var(--maxw); margin: 0 auto; padding: 0 28px 64px; }
.eyebrow { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--saffron); font-weight: 600; margin: 0 0 10px; }
.hero { padding: 56px 0 28px; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: 48px; align-items: end; }
.hero .eyebrow { grid-column: 1 / -1; }
.hero__title { font-family: var(--display); font-weight: 600; font-size: clamp(40px, 6vw, 76px); line-height: .98; letter-spacing: -.025em; margin: 0; font-variation-settings: "opsz" 144; }
.hero__lead { margin: 0; color: var(--ink-2); font-size: 17px; max-width: 46ch; }
.section { margin-top: 56px; }
.section__title { font-family: var(--display); font-weight: 600; font-size: 30px; letter-spacing: -.01em; margin: 0 0 6px; }
.section__lead { margin: 0 0 22px; color: var(--ink-2); max-width: 70ch; }

/* Mode toggle */
.modebar { display: flex; align-items: center; gap: 6px; margin: 26px 0 18px; flex-wrap: wrap; }
.modebar__label { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-right: 8px; }
.modebar__btn { text-decoration: none; font-size: 14px; font-weight: 500; padding: 7px 14px; border: 1px solid var(--rule-strong); border-radius: 999px; background: var(--card); transition: all .15s; }
.modebar__btn:hover { border-color: var(--ink); }
.modebar__btn.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.modebar__note { font-size: 13px; color: var(--muted); margin-left: 10px; }

/* KPI cards */
.cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); }
.card {
  text-decoration: none; padding: 22px 20px 22px; border-right: 1px solid var(--rule); position: relative;
  display: flex; flex-direction: column; gap: 6px; min-height: 196px;
  animation: rise .6s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i) * 70ms);
  transition: background .2s;
}
.card:last-child { border-right: 0; }
.card:hover { background: var(--card); }
.card::before { content: ""; position: absolute; left: 20px; top: -2px; width: 34px; height: 4px; background: var(--petrol); }
.card:nth-child(2)::before { background: var(--s2); } .card:nth-child(3)::before { background: var(--s3); }
.card:nth-child(4)::before { background: var(--s4); } .card:nth-child(5)::before { background: var(--s5); }
.card__title { margin: 6px 0 4px; font-weight: 600; font-size: 14.5px; line-height: 1.3; min-height: 2.6em; }
.card__value { margin: 0; font-size: 38px; line-height: 1.05; letter-spacing: -.02em; }
.card__value .figure { font-family: var(--display); font-weight: 600; font-variation-settings: "opsz" 144; font-feature-settings: "tnum" 1, "lnum" 1; }
.card__unit { font-size: 14px; color: var(--ink-2); letter-spacing: 0; }
.card__value--empty { font-size: 16px; color: var(--muted); font-style: italic; }
.card__meta { margin: auto 0 0; font-size: 12.5px; color: var(--muted); }
.chip { margin: 0; align-self: flex-start; font-family: var(--mono); font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; }
.chip--up { color: var(--up); } .chip--down { color: var(--down); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Single total box */
.total { margin-top: 40px; display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 40px; padding: 30px; background: var(--paper-2); border-radius: var(--radius); border-left: 4px solid var(--saffron); }
.total h2 { font-family: var(--display); font-size: 26px; line-height: 1.15; margin: 0 0 10px; }
.total p { margin: 0; color: var(--ink-2); font-size: 15px; }
.total__table { width: 100%; border-collapse: collapse; font-size: 14px; }
.total__table th { text-align: left; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 0 10px 8px 0; border-bottom: 1px solid var(--rule-strong); }
.total__table td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.total__table td.mono { white-space: nowrap; color: var(--saffron); font-weight: 500; }

/* Charts */
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.chart-card { margin: 0; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 18px 10px; }
.chart-card figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.chart-card__title { font-weight: 600; font-size: 15px; }
.chart-card__unit { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.chart-card__note { margin: 6px 0 6px; font-size: 13px; color: var(--ink-2); }
.chart-card--accent { border-top: 3px solid var(--saffron); }
.chart { height: 300px; width: 100%; }
.chart--tall { height: 380px; }
.chart-empty { display: grid; place-items: center; height: 100%; color: var(--muted); font-style: italic; font-size: 14px; }

/* Strip */
.strip { margin-top: 56px; display: grid; grid-template-columns: 1fr 1fr; border-top: 2px solid var(--ink); }
.strip__item { padding: 22px 24px 8px 0; }
.strip__item + .strip__item { padding-left: 24px; border-left: 1px solid var(--rule); }
.strip__figure { margin: 0; font-size: 18px; }
.strip__figure .figure { font-family: var(--display); font-size: 40px; font-weight: 600; }
.strip__meta { margin: 6px 0 0; font-size: 13px; color: var(--muted); }

/* Generic layout pieces used by catalogue / detail / sources */
.filters { display: flex; flex-wrap: wrap; gap: 16px 28px; padding: 18px 0; border-bottom: 1px solid var(--rule); align-items: end; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.filters select { font: 500 14px var(--text); color: var(--ink); background: var(--card); border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: 7px 10px; min-width: 180px; }
.count { font-family: var(--mono); font-size: 13px; color: var(--muted); margin-left: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: left; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 14px 12px 8px 0; border-bottom: 1px solid var(--rule-strong); }
.table td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.table tr:hover td { background: var(--card); }
.code { font-family: var(--mono); font-weight: 500; color: var(--petrol-deep); text-decoration: none; }
.badge { display: inline-block; font-family: var(--mono); font-size: 11.5px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--rule-strong); white-space: nowrap; }
.badge--auto { border-color: var(--petrol); color: var(--petrol-deep); }
.badge--curated { border-color: var(--saffron); color: var(--saffron); }
.badge--planned { border-style: dashed; color: var(--muted); }
.badge--L0 { background: #e3efe9; } .badge--L1 { background: #f3e8d2; } .badge--L2 { background: #f2dfd8; } .badge--L3 { background: #e7e2ea; }
.note { font-size: 13px; color: var(--muted); }
.detail { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: 40px; margin-top: 28px; }
.meta-list { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.meta-list dt { color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; padding-top: 2px; }
.meta-list dd { margin: 0; }
.panel { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 20px; }
.panel + .panel { margin-top: 18px; }
.panel h3 { font-family: var(--display); font-size: 19px; margin: 0 0 10px; }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--rule); margin: 22px 0 16px; }
.tabs a { text-decoration: none; padding: 8px 0; font-weight: 500; border-bottom: 2px solid transparent; }
.tabs a.is-active { border-color: var(--petrol); color: var(--petrol-deep); }
.series-switch { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.series-switch a { text-decoration: none; font-size: 13px; padding: 4px 10px; border: 1px solid var(--rule-strong); border-radius: 999px; background: var(--paper); }
.series-switch a.is-active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.lineage { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--petrol); }
.lineage li { position: relative; padding: 0 0 14px 18px; font-size: 14px; }
.lineage li::before { content: ""; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--paper); border: 2px solid var(--petrol); }
.lineage .step { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); display: block; }
.lineage code, .hash { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.sources-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.source-card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.source-card h3 { margin: 0; font-family: var(--display); font-size: 18px; line-height: 1.25; }
.source-card .code { font-size: 13px; }
.stage { display: flex; gap: 4px; }
.stage span { width: 22px; height: 6px; border-radius: 3px; background: var(--rule); }
.stage span.on { background: var(--saffron); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.status-dot--success { background: var(--up); } .status-dot--failed { background: var(--down); } .status-dot--partial { background: var(--saffron); }
.phases { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-top: 18px; border-top: 2px solid var(--ink); }
.phase { padding: 18px 18px 18px 0; border-right: 1px solid var(--rule); }
.phase + .phase { padding-left: 18px; }
.phase:last-child { border-right: 0; }
.phase__count { font-family: var(--display); font-size: 40px; font-weight: 600; line-height: 1; }
.phase__bar { height: 6px; background: var(--rule); border-radius: 3px; margin: 10px 0 8px; overflow: hidden; }
.phase__bar span { display: block; height: 100%; background: var(--petrol); }
.layers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.layer { padding: 16px; border-radius: var(--radius); }
.layer--L0 { background: #e3efe9; } .layer--L1 { background: #f3e8d2; } .layer--L2 { background: #f2dfd8; } .layer--L3 { background: #e7e2ea; }
.layer h3 { margin: 0 0 6px; font-family: var(--mono); font-size: 15px; }
pre.code-block { background: var(--ink); color: #e8e1d2; padding: 16px 18px; border-radius: var(--radius); overflow-x: auto; font: 13px/1.6 var(--mono); }
.button { display: inline-block; text-decoration: none; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--radius); font-weight: 500; font-size: 14px; }
.button--ghost { background: transparent; color: var(--ink); border: 1px solid var(--ink); }

/* Footer */
.footer { border-top: 1px solid var(--ink); background: var(--paper-2); }
.footer__inner { max-width: var(--maxw); margin: 0 auto; padding: 26px 28px 34px; }
.footer__disclaimer { margin: 0 0 12px; font-size: 14px; color: var(--ink-2); max-width: 90ch; }
.footer__meta { margin: 0; display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-family: var(--mono); }

/* Responsive */
@media (max-width: 1080px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card:nth-child(3) { border-right: 0; }
  .card:nth-child(n+4) { border-top: 1px solid var(--rule); }
  .total, .detail { grid-template-columns: minmax(0, 1fr); }
  .sources-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .masthead__inner { grid-template-columns: 1fr; gap: 12px; padding: 14px 16px; }
  .nav { justify-content: flex-start; gap: 16px; }
  .page { padding: 0 16px 48px; }
  .hero { grid-template-columns: minmax(0, 1fr); row-gap: 16px; padding-top: 36px; }
  .hero__title { overflow-wrap: anywhere; }
  .masthead__inner { grid-template-columns: minmax(0, 1fr); }
  .cards, .charts, .strip, .phases, .layers, .sources-grid { grid-template-columns: minmax(0, 1fr); }
  .total { padding: 20px 16px; }
  .filters select { min-width: 0; width: 100%; }
  .filters label { flex: 1 1 140px; }
  .card { border-right: 0; border-top: 1px solid var(--rule); }
  .strip__item + .strip__item { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
}
@media print {
  .grain, .masthead__tools, .modebar { display: none; }
  body { background: #fff; }
}

/* Bulletins */
.report-row { display: grid; grid-template-columns: 140px minmax(0, 4fr) minmax(0, 6fr) 110px; gap: 24px; align-items: baseline; padding: 20px 0; border-bottom: 1px solid var(--rule); text-decoration: none; }
.report-row:first-child { border-top: 2px solid var(--ink); }
.report-row:hover { background: var(--card); }
.report-row__period { color: var(--saffron); font-weight: 500; }
.report-row__title { font-family: var(--display); font-size: 22px; font-weight: 600; line-height: 1.2; }
.report-row__summary { color: var(--ink-2); font-size: 14.5px; }
.report-row__meta { color: var(--muted); font-size: 13px; text-align: right; }
.report-row--draft { opacity: .85; }
.report { max-width: 860px; margin: 0 auto; }
.report__head { padding: 48px 0 24px; border-bottom: 1px solid var(--rule); }
.report__title { font-size: clamp(36px, 5vw, 60px); }
.report__head .hero__lead { margin-top: 16px; max-width: none; }
.report__actions { display: flex; align-items: center; gap: 16px; margin-top: 20px; flex-wrap: wrap; }
.rblock { margin-top: 36px; }
.rblock__title { font-family: var(--display); font-size: 24px; margin: 0 0 12px; }
.rblock__kpi { margin: 0; font-size: 54px; line-height: 1; }
.rblock__kpi .figure { font-family: var(--display); font-weight: 600; }
.rblock__text { font-size: 17px; line-height: 1.7; color: var(--ink-2); }
.rblock__text p:first-child::first-letter { font-family: var(--display); font-size: 3.2em; float: left; line-height: .9; padding: 4px 8px 0 0; color: var(--petrol); }
.panel-bulletin { margin-top: 56px; display: grid; grid-template-columns: 180px minmax(0, 1fr) auto; gap: 24px; align-items: center; padding: 24px 28px; background: var(--ink); color: var(--paper); border-radius: var(--radius); text-decoration: none; }
.panel-bulletin .eyebrow { color: #e0b25c; margin: 0; }
.panel-bulletin__title { font-family: var(--display); font-size: 26px; font-weight: 600; line-height: 1.2; }
.panel-bulletin__summary { color: #c9c1b1; font-size: 14px; margin-top: 4px; }
@media (max-width: 760px) { .report-row, .panel-bulletin { grid-template-columns: minmax(0, 1fr); gap: 6px; } .report-row__meta { text-align: left; } }

/* Editor */
.editor { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 28px; margin-top: 28px; }
.editor-form p, .editor-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 0 0 12px; }
.editor-form input, .editor-form select, .editor-form textarea { font: 400 14px var(--text); color: var(--ink); background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: 7px 9px; text-transform: none; letter-spacing: 0; }
.editor-form select[multiple] { min-height: 150px; }
.editor-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
.editor-grid--two { grid-template-columns: 1fr 1fr; }
.editor-block { border: 1px dashed var(--rule-strong); border-radius: var(--radius); padding: 10px 16px 18px; margin-top: 16px; background: var(--card); }
.editor-block .rblock { margin-top: 10px; }
.editor-block__bar { display: flex; justify-content: space-between; align-items: center; }
.editor-block__tools button { font: 500 14px var(--mono); background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--radius); width: 30px; height: 28px; cursor: pointer; }
.editor-block__tools button:hover { background: var(--ink); color: var(--paper); }
@media (max-width: 1080px) { .editor { grid-template-columns: 1fr; } .editor-grid { grid-template-columns: 1fr; } }

/* Wide tables scroll inside their box instead of widening the page */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
html, body { overflow-x: clip; }
