:root {
  --paper: #f4f1ea;
  --ink: #1a2740;
  --tailored: #5d6570;
  --line: #d6d0c6;
  --white: #fbf9f5;
  --accent: #8c3a2a;
  --ok: #2d5a3d;
  --warn: #8a4b16;
  --shadow: 0 1px 0 rgba(26, 39, 64, 0.04);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Songti SC", "Noto Serif SC", serif;
  --sans: "Avenir Next", "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--ink); }
a:hover { color: var(--accent); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 28px 20px 64px; }
.wrap.wide { max-width: 1280px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 28px;
}
.brand-mark {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 0.02em;
}
.brand-mark small {
  display: block;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--tailored);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 4px;
}
.nav { display: flex; flex-wrap: wrap; gap: 14px 18px; font-size: 13px; }
.nav a { text-decoration: none; color: var(--tailored); }
.nav a.active, .nav a:hover { color: var(--ink); }

h1, h2 { font-family: var(--serif); font-weight: 600; margin: 0 0 12px; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
.lede { color: var(--tailored); max-width: 42em; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 24px 0;
}
.stat {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 16px 18px;
}
.stat b { display: block; font-family: var(--serif); font-size: 26px; }
.stat span { color: var(--tailored); font-size: 12px; letter-spacing: 0.08em; }

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 20px;
  margin: 18px 0;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--tailored); font-weight: 500; font-size: 12px; letter-spacing: 0.06em; }

.btn, button, input[type=submit] {
  appearance: none;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn.ghost, .ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn.danger { background: transparent; color: var(--accent); border-color: var(--accent); }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-actions form { display: inline; }

label { display: block; font-size: 12px; color: var(--tailored); margin: 12px 0 6px; }
input[type=text], input[type=password], input[type=url], input[type=date], input[type=number], input[type=file], select, textarea {
  width: 100%;
  max-width: 560px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  color: var(--ink);
}
textarea { min-height: 110px; }
.check { display: flex; align-items: center; gap: 8px; max-width: 560px; margin-top: 12px; }
.check input { width: auto; }

.flash {
  padding: 10px 12px;
  border: 1px solid var(--line);
  margin-bottom: 16px;
}
.flash.ok { border-color: var(--ok); color: var(--ok); }
.flash.err { border-color: var(--accent); color: var(--accent); }

.login-card {
  max-width: 420px;
  margin: 8vh auto;
  background: var(--white);
  border: 1px solid var(--line);
  padding: 32px 28px 36px;
}
.muted { color: var(--tailored); font-size: 13px; }
.crumb { color: var(--tailored); font-size: 13px; margin-bottom: 10px; }
.crumb a { color: var(--tailored); }
pre.json {
  white-space: pre-wrap;
  font-size: 12px;
  color: var(--tailored);
  margin: 0;
}

.kicker {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--tailored);
  margin: 0 0 8px;
}
.meta-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 24px;
  margin: 24px 0 0;
}
.meta-list dt { font-size: 12px; color: var(--tailored); }
.meta-list dd { margin: 4px 0 0; }
.block { margin: 40px 0; padding-top: 8px; border-top: 1px solid var(--line); }
.fact { margin: 16px 0 24px; }
.prose { max-width: 42em; }
.card-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.card-link {
  display: block;
  border: 1px solid var(--line);
  background: var(--white);
  padding: 14px;
  text-decoration: none;
  min-height: 100%;
}
.card-link img, .hero-img, .media img { max-width: 100%; height: auto; display: block; margin-bottom: 10px; }
.card-link strong { display: block; }
.card-link span { display: block; color: var(--tailored); font-size: 13px; margin-top: 4px; }
.plain-list { padding-left: 1.1em; }
.plain-list li { margin: 8px 0; }
.site-foot { margin-top: 56px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--tailored); font-size: 13px; }
.disclaimer { font-size: 13px; color: var(--tailored); max-width: 46em; }
.hero.dossier h1 { font-size: 34px; }

.geo-subnav { display:flex; flex-wrap:wrap; gap:10px 16px; font-size:13px; margin:0 0 18px; }
.geo-subnav a { color: var(--tailored); text-decoration:none; }
.geo-subnav a.active { color: var(--ink); font-weight:600; }
.qe { display:grid; grid-template-columns: 220px 1fr; gap:16px; }
.qe-list { border:1px solid var(--line); background:var(--white); max-height:70vh; overflow:auto; font-size:13px; }
.qe-list a { display:block; padding:8px 10px; text-decoration:none; border-bottom:1px solid var(--line); color:var(--ink); }
.qe-list a.current { background:#efe8dc; }
.qe-list .st { color:var(--tailored); font-size:11px; }
.qe textarea.answer { min-height:180px; max-width:none; }
.matrix-wrap { overflow:auto; }
.geo-subnav { font-size:12px; }
.matrix-table { min-width: 640px; }
.matrix-table th, .matrix-table td { text-align:center; }
.matrix-table td.q { text-align:left; max-width:320px; }
.filters { display:flex; flex-wrap:wrap; gap:8px; align-items:flex-end; margin-bottom:12px; }
.filters input, .filters select { max-width:220px; }

@media (max-width: 720px) {
  .topbar { flex-direction: column; }
  table:not(.matrix-table), table:not(.matrix-table) thead, table:not(.matrix-table) tbody, table:not(.matrix-table) th, table:not(.matrix-table) td, table:not(.matrix-table) tr { display: block; }
  table:not(.matrix-table) th { display: none; }
  table:not(.matrix-table) td { border: none; border-bottom: 1px solid var(--line); padding-left: 0; }
  .wrap { padding: 20px 16px 48px; }
  .hero.dossier h1 { font-size: 26px; }
  .qe { grid-template-columns: 1fr; }
}
