/* Styles for the Zagreb debt report. The layout is mobile-first and keeps
   dense financial tables readable on narrow screens. */

:root {
  --bg: #fbfaf6;
  --fg: #18181b;
  --muted: #666a73;
  --border: #d8d4ca;
  --panel: #ffffff;
  --soft: #f0ede6;
  --city: #b42318;
  --city-soft: #fee4df;
  --holding: #1d4ed8;
  --holding-soft: #dbeafe;
  --guarantee: #b7791f;
  --guarantee-soft: #fef3c7;
  --neutral: #374151;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, system-ui, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

header, main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 16px;
}

header {
  padding-top: 34px;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--city);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 820px;
  margin: 0 0 10px;
  font-size: clamp(2rem, 5vw, 4.6rem);
  line-height: 1.02;
}

h2 {
  margin: 2.8em 0 .6em;
  padding-top: 1em;
  border-top: 1px solid var(--border);
  font-size: 1.25rem;
}

h3 {
  margin: 1.6em 0 .4em;
  font-size: 1rem;
}

p { max-width: 780px; }

.lede {
  max-width: 760px;
  margin: 0;
  color: #303036;
  font-size: 1.06rem;
}

.updated, .note {
  color: var(--muted);
  font-size: .88rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 10px;
}

.metric-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric {
  min-height: 118px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.metric.city { border-top: 4px solid var(--city); }
.metric.holding { border-top: 4px solid var(--holding); }
.metric.guarantee { border-top: 4px solid var(--guarantee); }
.metric.neutral { border-top: 4px solid var(--neutral); }

.metric .label {
  min-height: 2.4em;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 650;
}

.metric .value {
  margin: 0;
  font-size: clamp(1.35rem, 4vw, 2.15rem);
  font-weight: 760;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.metric .sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: .78rem;
}

.axis-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 14px;
  color: #2f3035;
  font-size: .88rem;
}

.axis-note span {
  padding: 7px 9px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.finding-box {
  max-width: 920px;
  margin: 14px 0;
  padding: 14px 16px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-left: 5px solid var(--guarantee);
  border-radius: 8px;
}

.finding-box:empty { display: none; }

.finding-box h3 {
  margin-top: 0;
}

.finding-box p {
  margin: 8px 0;
  max-width: none;
}

.finding-box ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.finding-box li {
  margin-bottom: 6px;
}

.finding-box.verdict {
  background: #f8fafc;
  border-color: #cbd5e1;
  border-left-color: var(--neutral);
}

.chart-box {
  position: relative;
  width: 100%;
  height: clamp(300px, 46vw, 470px);
  margin: 14px 0 10px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.chart-box.tall {
  height: clamp(340px, 52vw, 520px);
}

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

.table-wrap {
  width: 100%;
  margin-top: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: .88rem;
}

th, td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--soft);
  font-weight: 700;
}

td.num, th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td.note-cell {
  min-width: 220px;
  color: #3f3f46;
  font-size: .82rem;
}

#scope-notes {
  max-width: 860px;
  padding-left: 20px;
  color: #2f3035;
}

#scope-notes li { margin-bottom: 8px; }

.source-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.source {
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.source a {
  color: var(--holding);
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.source p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: .82rem;
}

@media (max-width: 860px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-grid { grid-template-columns: 1fr; }
  .source-list { grid-template-columns: 1fr; }
}

@media (max-width: 460px) {
  header, main { padding-left: 12px; padding-right: 12px; }
  h1 { font-size: 2rem; }
  h2 { font-size: 1.08rem; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-grid.compact { grid-template-columns: 1fr; }
  .metric { min-height: 96px; }
  .chart-box { padding: 8px; }
  table { font-size: .8rem; }
}

/* Loan registry section */
.chart-toolbar {
  margin: 16px 0 12px;
}
.view-toggle {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 8px 14px;
  margin: 0;
  background: var(--panel, #fff);
  border: 1px solid var(--border, #d8d4ca);
  border-radius: 8px;
  font-size: .92rem;
}
.view-toggle legend {
  padding: 0 6px;
  margin-bottom: 0;
  color: var(--muted, #666a73);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.view-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.view-toggle input[type="radio"] {
  margin: 0;
  accent-color: var(--accent, #b42318);
}
.cat-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .78rem;
  color: var(--muted, #666a73);
  white-space: nowrap;
}
#loan-table tfoot th {
  background: var(--soft, #f0ede6);
  font-size: .9rem;
  border-top: 1.5px solid var(--border, #d8d4ca);
}
