/* 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; align-items: center; gap: 16px; }
.wordmark__tag { font-size: 11px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: #5b7f7b; line-height: 14px; }
.wordmark__tag span { display: block; white-space: nowrap; }
.brand-mark { width: 80px; height: 57px; flex: none; display: block; }
.brand-mark--sm { width: 32px; height: 12px; display: inline-block; vertical-align: -1px; margin-right: 8px; }
.brand-mark--lg { width: 140px; height: 100px; margin-bottom: 18px; grid-column: 1 / -1; }
.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; border: 0; font-family: var(--text); line-height: 1.3; cursor: pointer; }
.button--ghost { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
.button--mini { padding: 5px 11px; font-size: 12.5px; }
.button--plain { background: transparent; color: var(--ink-2); padding-left: 2px; padding-right: 2px; text-decoration: underline; text-underline-offset: 3px; }
.hero__side { display: flex; flex-direction: column; gap: 20px; align-items: flex-start; }

/* 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: .9; }
.report-row__actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.table--report td.mono { white-space: nowrap; }
.table--report .tone-up { color: var(--up); } .table--report .tone-down { color: var(--down); }
.cell-note { font-family: var(--text); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.report { max-width: 860px; margin: 0 auto; }
.report__blocks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
.report__blocks .rblock { grid-column: 1 / -1; min-width: 0; }
.report__blocks .rblock--half { grid-column: 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; } .report__blocks { grid-template-columns: minmax(0, 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; }

/* Masthead sign-in state */
.inline-form { display: inline; margin: 0; }
.admin-link--button { font: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* Sign-in */
.login-form { max-width: 380px; margin-top: 36px; display: flex; flex-direction: column; gap: 16px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.login-form input { font: 400 16px var(--text); color: var(--ink); background: var(--card); border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: 10px 12px; letter-spacing: 0; text-transform: none; }
.login-form input:focus { outline: 2px solid var(--petrol); outline-offset: 1px; border-color: var(--petrol); }
.login-form .button { align-self: flex-start; border: 0; cursor: pointer; font-family: var(--text); }
.login-form__error { margin: 0; color: var(--down); font-size: 14px; }

/* Bulletin builder */
.page--wide { max-width: 1480px; }
.builder { margin-top: 18px; --field-bg: var(--card); }
.builder input, .builder textarea { font-family: var(--text); color: var(--ink); background: var(--field-bg); border: 1px solid var(--rule); border-radius: var(--radius); padding: 7px 9px; font-size: 14px; }
.builder input:focus, .builder textarea:focus { outline: 2px solid var(--petrol); outline-offset: 0; border-color: var(--petrol); }
.builder button { font-family: var(--text); cursor: pointer; }
.builder__bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 0; margin-bottom: 18px; background: var(--paper); border-bottom: 1px solid var(--ink); }
.builder__back { text-decoration: none; font-weight: 500; font-size: 14px; }
.builder__status { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.builder__status::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--up); margin-right: 6px; vertical-align: 1px; }
.builder__status[data-state="saving"]::before { background: var(--saffron); animation: pulse 1s infinite; }
.builder__status[data-state="error"] { color: var(--down); } .builder__status[data-state="error"]::before { background: var(--down); }
@keyframes pulse { 50% { opacity: .3; } }
.builder__spacer, .bblock__spacer { flex: 1; }
.builder .button { border: 0; font-size: 14px; }
.builder .button--ghost { border: 1px solid var(--ink); }
.publish { display: flex; align-items: center; gap: 10px; margin: 0; }
.publish__confirm[hidden], .publish [hidden] { display: none; }
.publish__confirm { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.publish__note { font-size: 13px; color: var(--ink-2); max-width: 36ch; }
.builder__body { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 28px; align-items: start; }
.builder__help { margin: 18px 0 0; }

/* Palette */
.palette { position: sticky; top: 74px; max-height: calc(100vh - 90px); display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); }
.palette__head { padding: 16px 16px 12px; border-bottom: 1px solid var(--rule); }
.palette__title { font-family: var(--display); font-size: 20px; margin: 0 0 10px; }
.palette__search { width: 100%; }
.palette__label { margin: 12px 16px 6px; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kinds { list-style: none; margin: 0 16px 12px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.kind { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; font-size: 12px; background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--radius); cursor: grab; user-select: none; text-align: center; }
.kind:hover { border-color: var(--ink); }
.kind__icon { font-size: 18px; line-height: 1; }
.palette__series { overflow-y: auto; border-top: 1px solid var(--rule); padding: 6px 0 10px; }
.pgroup { border-bottom: 1px solid var(--rule); }
.pgroup__head { display: flex; align-items: center; gap: 8px; padding: 9px 16px; cursor: pointer; font-size: 13.5px; font-weight: 500; list-style: none; }
.pgroup__head::-webkit-details-marker { display: none; }
.pgroup__head::before { content: "▸"; color: var(--muted); font-size: 11px; transition: transform .15s; }
.pgroup[open] .pgroup__head::before { transform: rotate(90deg); }
.pgroup__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pseries { list-style: none; margin: 0; padding: 0 10px 8px; }
.pchip { display: flex; align-items: center; gap: 8px; padding: 7px 8px; margin: 0 0 4px; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); cursor: grab; }
.pchip:hover { border-color: var(--petrol); }
.pchip__grip, .bblock__grip { font-family: var(--mono); color: var(--rule-strong); letter-spacing: -2px; user-select: none; }
.pchip__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pchip__label { font-size: 13px; line-height: 1.3; }
.pchip__meta { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pchip__add { width: 26px; height: 26px; border: 1px solid var(--rule-strong); border-radius: 50%; background: var(--card); font: 500 16px var(--mono); line-height: 1; color: var(--petrol-deep); }
.pchip__add:hover { background: var(--petrol); color: var(--paper); border-color: var(--petrol); }
.palette__empty { margin: 14px 16px; }

/* Canvas */
.masthead-edit { padding: 18px 20px; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 18px; }
.masthead-edit .eyebrow { margin-bottom: 6px; }
.masthead-edit__title { width: 100%; font-family: var(--display); font-weight: 600; font-size: 32px; letter-spacing: -.02em; padding: 4px 8px; background: transparent; border-color: transparent; }
.masthead-edit__title:hover { border-color: var(--rule); }
.masthead-edit__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin-top: 10px; }
.masthead-edit__grid label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.masthead-edit__grid input, .masthead-edit__grid textarea { letter-spacing: 0; text-transform: none; font-weight: 400; }
.masthead-edit__wide { grid-column: 1 / -1; }
.blocks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.bblock { grid-column: 1 / -1; min-width: 0; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 10px 16px 16px; transition: box-shadow .15s; }
.bblock--half { grid-column: auto; }
.bblock.is-ghost { opacity: .4; border-style: dashed; }
.bblock.is-full { box-shadow: 0 0 0 2px var(--down); }
.bblock:focus-within { box-shadow: 0 0 0 2px var(--petrol); }
.bblock__bar { display: flex; align-items: center; gap: 10px; }
.bblock__grip { font-size: 18px; cursor: grab; padding: 0 2px; }
.bblock__grip:active { cursor: grabbing; }
.badge--kind { border-color: var(--ink); color: var(--ink); }
.bblock__delete { width: 28px; height: 28px; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--paper); font: 500 13px var(--mono); white-space: nowrap; }
.bblock__delete[data-armed] { width: auto; padding: 0 8px; background: var(--down); color: var(--paper); border-color: var(--down); }
.seg { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 999px; overflow: hidden; background: var(--paper); }
.seg button { border: 0; background: transparent; padding: 4px 11px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button.is-active { background: var(--ink); color: var(--paper); }
.bblock__titles { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 8px; margin: 10px 0 8px; }
.bblock__title { font-family: var(--display); font-size: 19px; font-weight: 600; background: transparent; border-color: transparent; padding: 4px 6px; }
.bblock__title--en { font-family: var(--text); font-size: 14px; font-weight: 400; color: var(--ink-2); }
.bblock__title:hover { border-color: var(--rule); }
.bblock__texts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bblock__texts textarea { width: 100%; resize: vertical; line-height: 1.55; }
.bblock__controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.bblock__start { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.bblock__start input { padding: 3px 6px; font-size: 13px; }
.bblock__columns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 10px; }
.bblock__columns-label { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-right: 4px; }
.coltoggle { font-size: 12px; padding: 3px 10px; border: 1px solid var(--rule-strong); border-radius: 999px; background: var(--paper); color: var(--muted); }
.coltoggle:hover { border-color: var(--ink); color: var(--ink); }
.coltoggle.is-active { background: var(--petrol-deep); border-color: var(--petrol-deep); color: var(--paper); }
.bseries { list-style: none; margin: 0 0 6px; padding: 6px; min-height: 44px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px dashed var(--rule-strong); border-radius: var(--radius); background: var(--paper); }
.bseries::after { content: attr(data-hint); font-size: 12px; color: var(--muted); font-style: italic; padding: 2px 6px; }
.bchip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 8px; background: var(--card); border: 1px solid var(--rule-strong); border-radius: 999px; font-size: 12.5px; cursor: grab; }
.bchip__dot { width: 10px; height: 4px; border-radius: 2px; background: var(--s1); }
.bchip:nth-of-type(6n+2) .bchip__dot { background: var(--s2); } .bchip:nth-of-type(6n+3) .bchip__dot { background: var(--s3); }
.bchip:nth-of-type(6n+4) .bchip__dot { background: var(--s4); } .bchip:nth-of-type(6n+5) .bchip__dot { background: var(--s5); }
.bchip:nth-of-type(6n) .bchip__dot { background: var(--s6); }
.bchip button { border: 0; background: transparent; font: 500 15px var(--mono); line-height: 1; color: var(--muted); padding: 0 4px; }
.bchip button:hover { color: var(--down); }
.bblock__preview .rblock { margin-top: 6px; }
.bblock__preview .rblock__title { display: none; }
.bblock__preview .chart { height: 260px; }
.bblock--half .bblock__preview .chart { height: 220px; }
.dropzone { margin-top: 16px; padding: 26px 20px; border: 2px dashed var(--rule-strong); border-radius: var(--radius); text-align: center; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px; font-size: 14px; transition: all .15s; }
.dropzone strong { font-family: var(--display); font-size: 18px; font-weight: 600; }
.dropzone span { font-size: 13px; color: var(--muted); }
.dropzone--empty { padding: 56px 20px; border-color: var(--petrol); background: rgba(0, 140, 128, .04); }
.dropzone .pchip, .dropzone .kind { display: none; }
.sortable-drag { opacity: .9; }
.is-dragging { opacity: .92; box-shadow: 0 10px 30px rgba(19, 33, 43, .18); cursor: grabbing !important; pointer-events: none; }
.canvas-wrap { position: relative; }
.drop-indicator { position: absolute; height: 4px; border-radius: 2px; background: var(--petrol); z-index: 3; pointer-events: none; box-shadow: 0 0 0 3px rgba(0, 140, 128, .18); }
.drop-indicator[hidden] { display: none; }
.bseries.is-over, .dropzone.is-over { border-color: var(--petrol); border-style: solid; background: rgba(0, 140, 128, .08); }
/* While a card is being sorted every card collapses to its title bar in a single column */
.blocks.is-sorting .bblock, .bblock.is-dragging { grid-column: 1 / -1; padding-bottom: 10px; }
.blocks.is-sorting .bblock__titles, .blocks.is-sorting .bblock__controls, .blocks.is-sorting .bblock__columns,
.blocks.is-sorting .bseries, .blocks.is-sorting .bblock__preview, .blocks.is-sorting .bblock__texts,
.bblock.is-dragging .bblock__titles, .bblock.is-dragging .bblock__controls, .bblock.is-dragging .bblock__columns,
.bblock.is-dragging .bseries, .bblock.is-dragging .bblock__preview, .bblock.is-dragging .bblock__texts { display: none; }
.blocks.is-sorting .bblock::after { content: attr(data-summary); display: block; margin: 6px 0 0 30px; font-family: var(--display); font-size: 16px; font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1080px) {
  .builder__body { grid-template-columns: minmax(0, 1fr); }
  .palette { position: static; max-height: 46vh; }
  .blocks, .bblock__texts, .masthead-edit__grid { grid-template-columns: minmax(0, 1fr); }
  .bblock--half { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bblock__titles { grid-template-columns: minmax(0, 1fr); }
  .builder__bar .button { padding: 8px 12px; }
}
