/* FIDC Market dashboard — Credit Markets design system, Light register.
   Navy register for the gate and highlight slides. Tokens in tokens-*.css. */

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--cm-bg); color: var(--cm-text);
  font-family: var(--cm-font-body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
body.gated { overflow: hidden; }
a { color: inherit; }
button { font: inherit; }
.mono { font-family: var(--cm-font-mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.ic { width: 16px; height: 16px; flex: 0 0 auto; }
:focus-visible { outline: 2px solid var(--cm-ring); outline-offset: 2px; }

/* ── Top bar ──────────────────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 56px; z-index: 50;
  display: flex; align-items: center; gap: 32px; padding: 0 24px;
  background: rgba(250, 251, 255, 0.86);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--cm-border);
}
.brand img { height: 20px; display: block; }
.topnav { display: flex; gap: 4px; height: 100%; }
.topnav a {
  display: flex; align-items: center; padding: 0 12px; position: relative;
  font-size: 13px; font-weight: 500; letter-spacing: 0.01em; text-decoration: none;
  color: var(--cm-text-secondary);
  transition: color var(--cm-duration) var(--cm-ease);
}
.topnav a:hover { color: var(--cm-text); }
.topnav a.active { color: var(--cm-text); }
.topnav a.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px;
  background: var(--cm-accent); border-radius: 2px 2px 0 0;
}
.stamp {
  margin-left: auto; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--cm-text-muted);
}
main { padding-top: 56px; }

/* ── Shared type ──────────────────────────────────────────────────── */
.eyebrow {
  font-weight: 600; font-size: 11px; line-height: 1; letter-spacing: 0.10em;
  text-transform: uppercase; color: var(--cm-accent);
  display: flex; align-items: center; gap: 8px;
}
.eyebrow .ic { width: 14px; height: 14px; }
.headline {
  font-family: var(--cm-font-display); font-weight: 700;
  font-size: 27px; line-height: 1.12; letter-spacing: -0.025em;
  color: var(--cm-text); margin: 11px 0 0; max-width: 46ch;
}
.dek {
  font-size: 14px; line-height: 1.5; color: var(--cm-text-secondary);
  margin: 9px 0 0; max-width: 108ch;
}
.dek + .dek { margin-top: 3px; }
.cap {
  font-weight: 600; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--cm-text-secondary); margin: 0 0 5px;
}
.empty {
  height: 100%; min-height: 120px; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 16px; font-size: 13px; color: var(--cm-text-muted);
  border: 1px dashed var(--cm-border); border-radius: 4px;
}
.empty.big { min-height: 240px; margin-top: 24px; }
.loading { padding: 80px 0; text-align: center; color: var(--cm-text-muted); font-size: 13px; }

.icon-btn {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--cm-border); border-radius: 6px; background: var(--cm-surface);
  color: var(--cm-text-secondary); cursor: pointer;
  transition: border-color var(--cm-duration) var(--cm-ease), color var(--cm-duration) var(--cm-ease);
}
.icon-btn:hover:not(:disabled) { border-color: var(--cm-border-strong); color: var(--cm-text); }
.icon-btn:active:not(:disabled) { transform: scale(0.99); }
.icon-btn:disabled { color: var(--cm-border-strong); cursor: default; }

/* ── Market: rail + stage ─────────────────────────────────────────── */
.view-market { height: calc(100vh - 56px); height: calc(100dvh - 56px); }
.mk { display: grid; grid-template-columns: 272px minmax(0, 1fr); height: 100%; }

.mk-rail {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--cm-surface); border-right: 1px solid var(--cm-border);
}
.rail-head {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 14px 14px 12px; border-bottom: 1px solid var(--cm-border);
}
.rail-title { font-weight: 600; font-size: 11px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--cm-text-secondary); }
.seg { display: inline-flex; padding: 2px; border-radius: 6px; background: var(--cm-bg); border: 1px solid var(--cm-border); }
.seg button {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border: 0; border-radius: 4px;
  background: transparent; color: var(--cm-text-secondary); font-size: 11.5px; font-weight: 500; cursor: pointer;
  transition: background var(--cm-duration) var(--cm-ease), color var(--cm-duration) var(--cm-ease);
}
.seg button .ic { width: 14px; height: 14px; }
.seg button[aria-pressed="true"] { background: var(--cm-surface); color: var(--cm-text); box-shadow: var(--cm-shadow-card); }

.rail-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.rail-item {
  width: 100%; display: grid; grid-template-columns: 26px 1fr; gap: 2px 8px; align-items: start;
  text-align: left; padding: 9px 10px; margin: 0 0 2px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; cursor: pointer; color: var(--cm-text);
  transition: background var(--cm-duration) var(--cm-ease), border-color var(--cm-duration) var(--cm-ease);
}
.rail-item:hover { background: var(--cm-surface-raised); }
.rail-item.active { background: var(--cm-surface-raised); border-color: var(--cm-border); }
.ri-n { font-family: var(--cm-font-mono); font-size: 11px; color: var(--cm-text-muted); padding-top: 1px; }
.rail-item.active .ri-n { color: var(--cm-accent); font-weight: 700; }
.ri-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ri-tag { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cm-text-secondary); }
.rail-item.active .ri-tag { color: var(--cm-accent); }
.ri-h { font-size: 12.5px; line-height: 1.35; color: var(--cm-text); }
.thumb { display: none; }

/* Miniatures mode */
.mk[data-rail="thumbs"] .rail-item { padding: 8px; align-items: center; }
.mk[data-rail="thumbs"] .thumb {
  display: block; grid-column: 1 / -1; position: relative; overflow: hidden; width: 100%; height: 132px; margin-bottom: 6px;
  border-radius: 4px; border: 1px solid var(--cm-border); background: var(--cm-bg);
  pointer-events: none;
}
.mk[data-rail="thumbs"] .rail-item.active .thumb { border-color: var(--cm-accent); box-shadow: 0 0 0 1px var(--cm-accent); }
.thumb-inner { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.mk[data-rail="thumbs"] .ri-h { display: none; }

.mk-scrim { display: none; }
.mk-stage { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.mk-deck { position: relative; flex: 1 1 auto; min-height: 0; margin: 18px 22px 0; }
.mk-controls {
  flex: 0 0 52px; display: flex; align-items: center; justify-content: center; gap: 12px;
}
.counter { font-size: 12px; color: var(--cm-text-secondary); min-width: 64px; text-align: center; }
.kbd-hint { position: absolute; right: 22px; font-size: 11px; color: var(--cm-text-muted); }
.rail-toggle { display: none; }

/* ── Slides (the report page, adapted) ────────────────────────────── */
.slide {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  padding: 22px 30px 18px;
  background: var(--cm-bg); color: var(--cm-text);
  border: 1px solid var(--cm-border); border-radius: 6px;
  box-shadow: 0 8px 28px rgba(13, 27, 75, 0.08);
  overflow: hidden auto;
  visibility: hidden; opacity: 0;
  transition: opacity var(--cm-duration) var(--cm-ease), visibility 0s linear var(--cm-duration);
}
.slide.active { visibility: visible; opacity: 1; transition: opacity var(--cm-duration) var(--cm-ease); z-index: 1; }
.slide::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(13, 27, 75, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13, 27, 75, 0.035) 1px, transparent 1px);
  background-size: 80px 80px;
  -webkit-mask-image: radial-gradient(120% 90% at 88% 0%, #000, transparent 70%);
  mask-image: radial-gradient(120% 90% at 88% 0%, #000, transparent 70%);
}
.slide.cm-navy { border-color: var(--cm-navy-900); }
.slide.cm-navy::before {
  -webkit-mask-image: none; mask-image: none;
  background:
    radial-gradient(760px 760px at 88% -12%, rgba(212, 168, 71, 0.05), transparent 62%),
    radial-gradient(520px 520px at 6% 108%, rgba(13, 148, 136, 0.025), transparent 62%),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 80px 80px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 80px 80px;
}
.slide > * { position: relative; z-index: 1; }

.s-chrome { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; }
.s-tag { font-weight: 600; font-size: 11px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--cm-text-secondary); }
.s-num { font-family: var(--cm-font-mono); font-size: 11px; color: var(--cm-text-muted); }
.s-head { flex: 0 0 auto; padding-top: 10px; }
.s-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding-top: 14px; }
.s-foot {
  flex: 0 0 auto; padding-top: 9px; margin-top: 10px; border-top: 1px solid var(--cm-border);
  font-size: 10.5px; line-height: 1.45; letter-spacing: 0.02em; color: var(--cm-text-muted);
}

.grid { display: grid; gap: 12px; flex: 1 1 auto; min-height: 0; }
.panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.panel .chart, .slide .chart { flex: 1 1 auto; min-height: 120px; width: 100%; }

.metrics { display: grid; gap: 12px; flex: 0 0 auto; }
.metrics.c4 { grid-template-columns: repeat(4, 1fr); }
.metrics.c3 { grid-template-columns: repeat(3, 1fr); }
.metrics.c2 { grid-template-columns: repeat(2, 1fr); }
.metric {
  background: var(--cm-surface); border: 1px solid var(--cm-border);
  border-radius: 6px; box-shadow: var(--cm-shadow-card); padding: 12px 15px 13px;
}
.metric .v {
  font-family: var(--cm-font-mono); font-weight: 700; font-size: 24px; line-height: 1;
  letter-spacing: -0.02em; color: var(--cm-signal);
}
.cm-navy .metric .v { color: var(--cm-text); }
.metric .l { font-size: 10.5px; margin-top: 8px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--cm-text-secondary); }
.metric .h { font-size: 10.5px; margin-top: 4px; color: var(--cm-text-muted); line-height: 1.4; }

/* Cover */
.slide.cover .s-head { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; padding: 0 0 0 4px; }
.slide.cover .s-body { flex: 0 0 auto; }
.cover-rule { height: 3px; width: 64px; background: var(--cm-signal); border-radius: 2px; margin-bottom: 28px; }
.cover-h {
  font-family: var(--cm-font-display); font-weight: 700; color: var(--cm-signal);
  font-size: clamp(36px, 5.2vw, 64px); line-height: 1.04; letter-spacing: -0.035em; margin: 0; max-width: 18ch;
}
.cover-sub { font-size: clamp(15px, 1.5vw, 20px); line-height: 1.45; color: var(--cm-text-secondary); margin: 24px 0 0; max-width: 60ch; }
.cover-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding: 18px 0 6px; border-top: 1px solid var(--cm-border); }
.cover-figs .v { font-family: var(--cm-font-mono); font-weight: 700; font-size: clamp(20px, 2.2vw, 28px); color: var(--cm-text); letter-spacing: -0.02em; }
.cover-figs .l { margin-top: 6px; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cm-text-secondary); }

/* Methodology */
.method { column-count: 3; column-gap: 26px; flex: 1 1 auto; min-height: 0; }
.method .item { border-top: 1px solid var(--cm-border); padding-top: 6px; margin-bottom: 8px; break-inside: avoid; }
.method .k { font-weight: 600; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cm-accent); }
.method .t { font-size: 11px; line-height: 1.4; color: var(--cm-text-secondary); margin-top: 3px; }
.method .t .mono { color: var(--cm-text); }
.disclaimer { flex: 0 0 auto; padding-top: 8px; border-top: 1px solid var(--cm-border); font-size: 10.5px; color: var(--cm-text-muted); }

/* Clones in the miniature rail: static, never interactive. */
.slide.is-clone { visibility: visible; opacity: 1; transition: none; box-shadow: none; overflow: hidden; }

/* Short viewports: let a slide scroll rather than crush its charts. */
@media (max-height: 760px) {
  .slide .s-body { min-height: 520px; }
}

/* ── Pages (directory, fund) ──────────────────────────────────────── */
.page { max-width: 1240px; margin: 0 auto; padding: 32px 24px 72px; }
.page-head { margin-bottom: 22px; }
.page-head .headline { font-size: 30px; }

/* Directory */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 0; border-top: 1px solid var(--cm-border); }
.search {
  flex: 1 1 280px; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px;
  border: 1px solid var(--cm-border); border-radius: 4px; background: var(--cm-surface); color: var(--cm-text-muted);
}
.search:focus-within { border-color: var(--cm-accent); box-shadow: 0 0 0 3px var(--cm-ring); }
.search input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: 13.5px; color: var(--cm-text); min-width: 0; }
.filters select {
  height: 36px; padding: 0 30px 0 10px; border: 1px solid var(--cm-border); border-radius: 4px;
  background: var(--cm-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center;
  -webkit-appearance: none; appearance: none; font: inherit; font-size: 13px; color: var(--cm-text); max-width: 240px; min-width: 0;
}
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--cm-text-secondary); cursor: pointer; }
.check input { accent-color: var(--cm-accent); width: 15px; height: 15px; }
.btn-ghost {
  height: 36px; padding: 0 12px; border: 1px solid transparent; border-radius: 4px; background: transparent;
  color: var(--cm-accent); font-size: 13px; font-weight: 500; cursor: pointer;
}
.btn-ghost:hover { border-color: var(--cm-border); }
.table-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--cm-text-muted); padding: 2px 0 8px; }

.table-wrap {
  overflow-x: auto; border: 1px solid var(--cm-border); border-radius: 6px;
  background: var(--cm-surface); box-shadow: var(--cm-shadow-card);
}
.dtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.dtable th {
  position: sticky; top: 0; background: var(--cm-surface); z-index: 1;
  text-align: left; white-space: nowrap; padding: 11px 12px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cm-text-secondary);
  border-bottom: 1px solid var(--cm-border); cursor: pointer; user-select: none;
}
.dtable th:hover, .dtable th.sorted { color: var(--cm-text); }
.dtable th.sorted::after { content: " ↓"; color: var(--cm-accent); }
.dtable th[aria-sort="ascending"]::after { content: " ↑"; }
.dtable td { padding: 10px 12px; border-bottom: 1px solid var(--cm-border); vertical-align: top; }
.dtable tbody tr:last-child td { border-bottom: 0; }
.dtable tbody tr[data-d] { cursor: pointer; transition: background var(--cm-duration) var(--cm-ease); }
.dtable tbody tr[data-d]:hover { background: var(--cm-surface-raised); }
.dtable .num { text-align: right; white-space: nowrap; font-family: var(--cm-font-mono); font-size: 12.5px; }
.dtable th.num { font-family: var(--cm-font-body); }
.dtable .c-name { min-width: 280px; max-width: 420px; }
.dtable .c-name a {
  text-decoration: none; font-weight: 500; color: var(--cm-text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.dtable .c-name a:hover { color: var(--cm-accent); text-decoration: underline; text-underline-offset: 2px; }
.dtable .c-seg { white-space: nowrap; color: var(--cm-text-secondary); }
.dtable .sub { display: block; margin-top: 2px; font-size: 11px; color: var(--cm-text-muted); font-family: var(--cm-font-mono); }
.dtable .nil { color: var(--cm-border-strong); }
.dtable.compact th { position: static; cursor: default; }
.dtable.compact td, .dtable.compact th { padding: 7px 10px; }
.empty-row { text-align: center; padding: 40px 12px !important; color: var(--cm-text-muted); }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; padding-top: 16px; font-size: 12px; color: var(--cm-text-secondary); }

/* Fund page */
.back {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; text-decoration: none;
  color: var(--cm-text-secondary); margin-bottom: 18px;
}
.back:hover { color: var(--cm-accent); }
.f-head .headline { font-size: 26px; line-height: 1.15; max-width: 60ch; }
.tag-stale {
  font-family: var(--cm-font-mono); font-size: 10px; letter-spacing: 0.06em; padding: 3px 6px; border-radius: 2px;
  background: rgba(245, 158, 11, 0.10); color: #92400E; border: 1px solid rgba(245, 158, 11, 0.30);
}
.f-meta { display: flex; flex-wrap: wrap; gap: 10px 32px; margin: 16px 0 0; }
.f-meta div { min-width: 0; }
.f-meta dt { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cm-text-muted); }
.f-meta dd { margin: 3px 0 0; font-size: 13.5px; color: var(--cm-text); }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin: 24px 0 0; }
.kpi {
  background: var(--cm-surface); border: 1px solid var(--cm-border); border-radius: 6px;
  box-shadow: var(--cm-shadow-card); padding: 14px 15px 13px; min-width: 0;
}
.kpi .v { font-family: var(--cm-font-mono); font-weight: 700; font-size: 22px; line-height: 1; letter-spacing: -0.02em; color: var(--cm-signal); white-space: nowrap; }
.kpi .l { margin-top: 8px; font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--cm-text-secondary); }
.kpi .h { margin-top: 4px; font-size: 11px; line-height: 1.4; color: var(--cm-text-muted); }

.f-nav {
  position: sticky; top: 56px; z-index: 5; display: flex; gap: 4px; overflow-x: auto;
  margin: 28px -24px 0; padding: 0 24px;
  background: rgba(250, 251, 255, 0.9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--cm-border);
}
.f-nav a {
  position: relative; padding: 12px 12px; white-space: nowrap; text-decoration: none;
  font-size: 13px; font-weight: 500; color: var(--cm-text-secondary);
}
.f-nav a:hover { color: var(--cm-text); }
.f-nav a.active { color: var(--cm-text); }
.f-nav a.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--cm-accent); }

.f-sec { padding-top: 36px; scroll-margin-top: 104px; }
.sec-head { margin-bottom: 14px; }
.sec-head h2 { font-family: var(--cm-font-display); font-weight: 700; font-size: 20px; letter-spacing: -0.02em; margin: 0; }
.sec-head .dek { margin-top: 6px; font-size: 14px; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.card {
  margin: 0; min-width: 0; background: var(--cm-surface); border: 1px solid var(--cm-border);
  border-radius: 6px; box-shadow: var(--cm-shadow-card); padding: 14px 16px 10px;
}
.card.wide { grid-column: 1 / -1; }
.card .chart { width: 100%; }
.card-note { margin: 6px 0 0; font-size: 11px; color: var(--cm-text-muted); }
.card.series { padding: 0; }
.card.series summary {
  cursor: pointer; padding: 12px 16px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--cm-text-secondary);
}
.card.series .table-wrap { border: 0; border-top: 1px solid var(--cm-border); border-radius: 0 0 6px 6px; box-shadow: none; max-height: 320px; overflow: auto; }
.card.provider { padding: 16px 18px; }
.p-name { font-family: var(--cm-font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.01em; margin-top: 6px; }
.p-cnpj { font-size: 12px; color: var(--cm-text-muted); margin-top: 3px; }
.p-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 14px 0 0; }
.p-stats dt { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cm-text-muted); }
.p-stats dd { margin: 3px 0 0; font-family: var(--cm-font-mono); font-size: 14px; color: var(--cm-text); }
.f-source { margin-top: 40px; padding-top: 12px; border-top: 1px solid var(--cm-border); font-size: 11px; line-height: 1.5; color: var(--cm-text-muted); max-width: 120ch; }

/* ── Gate (Navy register) ─────────────────────────────────────────── */
.gate {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px;
  background:
    radial-gradient(900px 900px at 88% -10%, rgba(212, 168, 71, 0.06), transparent 62%),
    radial-gradient(640px 640px at 6% 110%, rgba(13, 148, 136, 0.03), transparent 62%),
    var(--cm-bg);
  color: var(--cm-text);
}
.gate::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.035;
  background-image:
    linear-gradient(rgba(255, 255, 255, 1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 1) 1px, transparent 1px);
  background-size: 64px 64px;
}
.gate-card { position: relative; width: 100%; max-width: 440px; }
.gate-logo { height: 22px; display: block; }
.gate-rule { height: 3px; width: 56px; background: var(--cm-signal); border-radius: 2px; margin: 40px 0 22px; }
.gate h1 { font-family: var(--cm-font-display); font-weight: 700; font-size: 30px; line-height: 1.1; letter-spacing: -0.03em; margin: 0; }
.gate p { font-size: 14px; line-height: 1.55; color: var(--cm-text-secondary); margin: 14px 0 0; }
.gate form { display: flex; gap: 8px; margin-top: 26px; }
.gate input {
  flex: 1; min-width: 0; height: 42px; padding: 0 12px; border-radius: 4px;
  border: 1px solid var(--cm-border-strong); background: var(--cm-surface); color: var(--cm-text);
  font: inherit; font-size: 14px;
}
.gate input:focus { outline: none; border-color: var(--cm-accent); box-shadow: 0 0 0 3px var(--cm-ring); }
.gate button {
  height: 42px; padding: 0 18px; border: 0; border-radius: 6px; cursor: pointer;
  background: var(--cm-signal); color: var(--cm-accent-contrast); font-weight: 600; font-size: 14px;
  box-shadow: var(--cm-shadow-amber-btn);
  transition: background var(--cm-duration) var(--cm-ease);
}
.gate button:hover { background: var(--cm-signal-hover); }
.gate button:active { transform: scale(0.99); }
.gate button:disabled { opacity: 0.6; cursor: default; }
.gate .gate-err { color: #FCA5A5; min-height: 1.4em; margin-top: 8px; font-size: 13px; }
.gate .gate-note { font-size: 12px; color: var(--cm-text-muted); margin-top: 4px; }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .method { column-count: 2; }
}
@media (max-width: 960px) {
  .mk { grid-template-columns: minmax(0, 1fr); }
  .mk-rail {
    position: fixed; top: 56px; bottom: 0; left: 0; width: min(300px, 86vw); z-index: 40;
    transform: translateX(-102%); transition: transform var(--cm-duration-slow, 300ms) var(--cm-ease);
    box-shadow: 0 12px 40px rgba(13, 27, 75, 0.18);
  }
  .mk.rail-open .mk-rail { transform: none; }
  .mk.rail-open .mk-scrim { display: block; position: fixed; inset: 56px 0 0 0; z-index: 30; background: rgba(13, 27, 75, 0.24); }
  .rail-toggle { display: inline-flex; position: absolute; left: 16px; }
  .kbd-hint { display: none; }
  .mk-deck { margin: 12px 16px 0; }
  .slide { padding: 18px 16px 14px; }
  .slide .grid { grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: none !important; flex: 0 0 auto; }
  .slide .s-body { flex: 0 0 auto; min-height: 0; }
  .slide .panel { flex: 0 0 auto !important; }
  .slide .chart { flex: 0 0 auto; height: 280px; min-height: 280px; }
  .metrics.c4, .metrics.c3 { grid-template-columns: repeat(2, 1fr); }
  .headline { font-size: 22px; }
  .method { column-count: 1; }
  .cover-figs { grid-template-columns: 1fr; gap: 14px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .f-head .headline, .page-head .headline { font-size: 24px; }
}
@media (max-width: 640px) {
  .topbar { gap: 12px; padding: 0 16px; }
  .topnav a { padding: 0 8px; }
  .stamp { display: none; }
  .page { padding: 24px 16px 56px; }
  .f-nav { margin: 24px -16px 0; padding: 0 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .v { font-size: 19px; }
  .filters select { flex: 1 1 100%; width: 100%; min-width: 0; max-width: 100%; }
  .metrics.c2 { grid-template-columns: 1fr; }
  .gate form { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; scroll-behavior: auto !important; }
}

/* ── Dashboard (#/dashboard) ──────────────────────────────────────── */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.dash-month { display: flex; flex-direction: column; flex: 0 0 auto; }
.dash-month select {
  height: 38px; min-width: 190px; padding: 0 32px 0 12px; border: 1px solid var(--cm-border-strong); border-radius: 4px;
  background: var(--cm-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  -webkit-appearance: none; appearance: none; font: inherit; font-size: 13.5px; font-weight: 500; color: var(--cm-text); cursor: pointer;
}
.dash-month select:focus { outline: none; border-color: var(--cm-accent); box-shadow: 0 0 0 3px var(--cm-ring); }
.dash-sec { padding-top: 34px; }
.dash-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 14px; }
.dash-sec .sec-head .dek[hidden] { display: none; }
.dash-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 34px; }
.dash-link { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; text-decoration: none; color: var(--cm-text);
  transition: border-color var(--cm-duration) var(--cm-ease); }
.dash-link:hover { border-color: var(--cm-accent); }
.dash-link-t { display: flex; align-items: center; gap: 4px; font-family: var(--cm-font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.dash-link:hover .dash-link-t { color: var(--cm-accent); }
@media (max-width: 960px) {
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .brand img { height: 15px; }
  .topnav { overflow-x: auto; scrollbar-width: none; }
  .topnav a { padding: 0 6px; font-size: 12.5px; white-space: nowrap; }
  .topnav a.active::after { left: 6px; right: 6px; }
  .dash-head { flex-direction: column; align-items: stretch; }
  .dash-month select { width: 100%; }
  .dash .cards, .dash-links { grid-template-columns: minmax(0, 1fr); }
  .dash-kpis .kpi .v { font-size: 19px; }
}
