:root {
  --ink: #172033;
  --muted: #5c6578;
  --paper: #f3efe6;
  --card: #fffdf8;
  --line: #d9d1c3;
  --accent: #0f5c4c;
  --accent-2: #c45c26;
  --navy: #141c2b;
  --tap: 44px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-h: calc(118px + var(--safe-top));
}
* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", "Tahoma", "Arial", sans-serif;
  overscroll-behavior-y: contain;
}
body { min-height: 100dvh; }
a { color: var(--accent); text-decoration: none; }
button, a, input, select { touch-action: manipulation; }
a, button { -webkit-tap-highlight-color: rgba(15, 92, 76, 0.12); }
.top {
  position: sticky; top: 0; z-index: 40;
  background: var(--navy); color: #f3efe6;
  border-bottom: 1px solid #2a3548;
  padding-top: var(--safe-top);
}
.top-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 420px) auto;
  align-items: center;
  gap: 12px 16px;
  padding: 12px 20px 8px;
}
.brand { display: flex; gap: 12px; align-items: center; cursor: pointer; min-width: 0; }
.brand > div { min-width: 0; }
.brand strong {
  display: block;
  font-size: 16px;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand small { display: block; color: #9aa6b8; font-size: 11px; margin-top: 2px; }
.mark {
  width: 4px; height: 36px; background: #d7a15c; flex: 0 0 auto;
  border-radius: 2px;
}
.top-search {
  display: flex; gap: 0; min-width: 0; background: #1c2638;
  border: 1px solid #334058; border-radius: 10px; overflow: hidden;
}
.top-search input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: #f3efe6;
  min-height: 42px; padding: 8px 12px; font-size: 15px; border-radius: 0;
}
.top-search input::placeholder { color: #8b96a8; }
.top-search button {
  border: 0; border-radius: 0; background: #d7a15c; color: #141c2b;
  min-height: 42px; padding: 8px 14px; font-weight: 600;
}
.nav-toggle {
  display: none; width: var(--tap); height: var(--tap); padding: 11px 10px;
  background: transparent; border: 1px solid #3a465c; cursor: pointer;
  border-radius: 8px;
}
.nav-toggle span {
  display: block; height: 2px; background: #f3efe6; margin: 5px 0; transition: transform .2s, opacity .2s;
}
.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(-45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(45deg); }
.nav-layer { padding: 0 20px 12px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.tabs a, .tabs button {
  background: var(--card); color: var(--ink); border-color: var(--line);
  min-height: 40px; padding: 8px 12px; border-radius: 999px; font-size: 14px;
}
.tabs a.active, .tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
#nav {
  display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; font-size: 13px;
}
#nav::-webkit-scrollbar { display: none; }
#nav a {
  flex: 0 0 auto; color: #d7dde6; padding: 8px 12px; border-radius: 999px;
  border: 1px solid #2a3548; white-space: nowrap; min-height: 36px;
}
#nav a:hover, #nav a.active { color: #fff; background: #1e2a3d; border-color: #d7a15c; }
#nav a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid #d7a15c; outline-offset: 2px;
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 16px 72px; }
.foot {
  border-top: 1px solid var(--line);
  padding: 14px 16px calc(14px + var(--safe-bottom));
  color: var(--muted); font-size: 12px; line-height: 1.6;
}
h1 { font-size: clamp(22px, 5.4vw, 28px); margin: 0 0 8px; line-height: 1.3; }
h2 { font-size: 18px; margin: 0; }
.sec-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  flex-wrap: wrap; margin: 28px 0 12px;
}
.sec-head a { font-size: 14px; font-weight: 600; white-space: nowrap; }
.guide { margin-top: 8px; }
.guide-card {
  background: var(--card); border: 1px solid var(--line); padding: 16px;
  border-right: 3px solid var(--accent); cursor: pointer; min-height: 160px;
  display: flex; flex-direction: column; gap: 8px; border-radius: 8px;
}
.guide-card:hover { border-color: var(--accent); }
.guide-card h3 { margin: 0; font-size: 17px; }
.guide-card p { margin: 0; color: var(--muted); line-height: 1.7; font-size: 14px; flex: 1; }
.guide-card .go { color: var(--accent); font-size: 13px; font-weight: 600; }
.table-panel {
  margin: 12px 0 22px; border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; background: var(--card);
}
.table-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 11px 14px; background: #f4efe4; border-bottom: 1px solid var(--line);
}
.table-head strong { font-size: 14px; line-height: 1.45; color: var(--ink); }
.table-head span { color: var(--muted); font-size: 12px; flex: 0 0 auto; }
.table-panel .table-wrap { margin: 0; padding: 0; }
.table-panel table { border: 0; }
h3 { font-size: 16px; margin: 0 0 10px; }
.lead { color: var(--muted); margin: 0 0 18px; max-width: 70ch; line-height: 1.65; }
.grid { display: grid; gap: 10px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat, .panel {
  background: var(--card); border: 1px solid var(--line); padding: 12px 14px;
  content-visibility: auto; contain-intrinsic-size: 80px;
}
.stat b { display: block; font-size: clamp(18px, 4vw, 26px); line-height: 1.2; }
.stat span { color: var(--muted); font-size: 12px; }
.stat.click { cursor: pointer; min-height: 88px; }
.stat.click:hover { border-color: var(--accent); }
.stat.click small {
  display: block; margin-top: 8px; color: var(--accent); font-size: 11px; font-weight: 600;
}
.explain {
  background: var(--card); border: 1px solid var(--line); padding: 16px;
  border-right: 3px solid var(--accent); margin: 0 0 18px;
}
.explain h2 { margin: 18px 0 8px; font-size: 16px; }
.explain h2:first-child { margin-top: 0; }
.explain p { margin: 0 0 8px; color: var(--muted); line-height: 1.8; font-size: 15px; }
.explain .formula {
  font-family: Consolas, "Courier New", monospace; font-size: 13px;
  background: #f7f1e6; padding: 10px 12px; border-radius: 8px; color: var(--ink);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.note { border: 1px solid #c9ddcf; background: #eef6f1; padding: 12px 14px; color: #1d4a3c; line-height: 1.6; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 16px; }
input, select, button {
  font: inherit; font-size: 16px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 10px 12px; min-height: var(--tap); border-radius: 8px;
}
button { background: var(--accent); color: #fff; border-color: var(--accent); cursor: pointer; }
button.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
button:disabled { opacity: 0.45; cursor: default; }
.table-wrap {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin-inline: -16px; padding-inline: 16px;
}
table { width: 100%; border-collapse: collapse; background: var(--card); min-width: 520px; display: table; }
table.as-cards { display: table; }
th, td { text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
thead th {
  background: #1e2a3d; color: #e8eef6; font-weight: 600; font-size: 13px;
  letter-spacing: 0.02em; position: sticky; top: var(--header-h); z-index: 4;
  border-bottom: 1px solid #2a3548; white-space: nowrap; padding: 12px 14px;
}
thead th:first-child { width: 3.2em; }
tr { cursor: pointer; }
tr:hover td { background: #f7f1e6; }
.chart { background: var(--card); border: 1px solid var(--line); padding: 12px; height: 300px; }
.chart.tall { height: 420px; }
.muted { color: var(--muted); font-size: 13px; }
.pager {
  display: flex; gap: 8px; align-items: center; justify-content: space-between;
  margin-top: 12px; flex-wrap: wrap;
}
.pager button { flex: 1; min-width: 110px; }
.pager-meta { display: flex; flex-direction: column; align-items: center; text-align: center; flex: 2; min-width: 140px; }
.pager-meta b { color: var(--ink); font-size: 13px; }
.crumb { color: var(--muted); font-size: 13px; margin-bottom: 10px; line-height: 1.6; }
.crumb a { color: var(--accent); }
.kicker { letter-spacing: 0.06em; font-size: 11px; color: var(--accent-2); font-weight: 600; margin: 0 0 4px; }
.insight {
  background: var(--card); border: 1px solid var(--line); padding: 14px 16px;
  border-right: 3px solid var(--accent);
}
.insight h3 { margin: 4px 0 8px; font-size: 16px; }
.insight p { margin: 0; color: var(--muted); line-height: 1.7; font-size: 14px; }
.share { height: 8px; background: #ebe4d6; margin-top: 6px; overflow: hidden; border-radius: 99px; }
.share > i { display: block; height: 100%; background: var(--accent); }
.metric { font-size: 12px; color: var(--muted); }
.headrow { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.tag {
  display: inline-block; font-size: 11px; padding: 3px 7px; border: 1px solid var(--line);
  color: var(--muted); margin: 0 0 4px 6px;
}
.report-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 16px; }
.briefing-cover { padding: 12px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.card {
  background: var(--card); border: 1px solid var(--line); padding: 16px;
  min-height: 140px; cursor: pointer; display: flex; flex-direction: column; gap: 8px;
  border-radius: 8px;
}
.card:hover { border-color: var(--accent); }
.card h3 { margin: 0; font-size: 17px; }
.card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; flex: 1; }
.card .go { color: var(--accent); font-size: 13px; font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.skel {
  height: 18px; background: linear-gradient(90deg, #e8e1d4, #f7f1e6, #e8e1d4);
  background-size: 200% 100%; animation: shine 1.1s linear infinite; margin: 10px 0;
  border-radius: 6px;
}
@keyframes shine { to { background-position: -200% 0; } }
.hide-sm { }
@media print {
  .top, .foot, .tools, .pager, nav, .nav-toggle { display: none !important; }
  body { background: #fff; }
  .wrap { max-width: none; padding: 0; }
  .stat, .panel, .insight, .chart, table, .table-panel { break-inside: avoid; }
  a { color: inherit; }
  thead th { position: static; background: #eee; color: #111; }
  .table-head { background: #f4f4f4; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .skel { animation: none; }
  .nav-toggle span { transition: none; }
}
@media (max-width: 900px) {
  :root { --header-h: calc(122px + var(--safe-top)); }
  .top-bar {
    grid-template-columns: 1fr auto;
    padding: 10px 16px 10px;
  }
  .top-search { grid-column: 1 / -1; }
  .nav-layer { padding-inline: 16px; }
  .g4, .g3 { grid-template-columns: 1fr 1fr; }
  .g2, .report-grid, .cards { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-block; }
  .nav-layer {
    display: none; position: fixed; inset: var(--header-h) 0 0 0;
    background: rgba(20, 28, 43, 0.97);
    padding: 16px 16px calc(24px + var(--safe-bottom));
    overflow: auto; z-index: 30;
    -webkit-overflow-scrolling: touch;
  }
  .nav-open .nav-layer { display: block; }
  #nav { flex-direction: column; overflow: visible; gap: 8px; }
  #nav a {
    width: 100%; text-align: right; min-height: var(--tap); font-size: 16px;
    display: flex; align-items: center; border-radius: 10px;
  }
  .chart { height: 220px !important; }
  .chart.tall { height: 280px !important; }
  .tools {
    flex-direction: column;
    position: sticky;
    top: var(--header-h);
    z-index: 15;
    background: var(--paper);
    margin-inline: -16px;
    padding: 8px 16px 10px;
    border-bottom: 1px solid var(--line);
  }
  .tools input, .tools select, .tools button { width: 100%; }
  .actions { width: 100%; }
  .actions button { flex: 1; min-width: 0; }
  .pager { flex-direction: column; }
  .pager button { width: 100%; }
  .explain p { font-size: 14px; }
  .hide-sm { display: none !important; }
  body.nav-open { overflow: hidden; }
  .table-wrap { margin-inline: 0; padding-inline: 0; overflow: visible; }
  .table-head { flex-direction: column; align-items: flex-start; }
  table.as-cards { min-width: 0; background: transparent; }
  table.as-cards thead { display: none; }
  table.as-cards, table.as-cards tbody { display: block; width: 100%; }
  table.as-cards tr {
    display: block;
    border: 1px solid var(--line);
    background: var(--card);
    margin-bottom: 10px;
    padding: 12px 14px;
    border-radius: 10px;
  }
  table.as-cards tr:hover td { background: transparent; }
  table.as-cards td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    border: 0;
    padding: 5px 0;
    font-size: 15px;
  }
  table.as-cards td.hide-sm { display: none !important; }
  table.as-cards td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    flex: 0 0 auto;
  }
  table.as-cards td:first-child {
    font-weight: 600;
    font-size: 16px;
    padding-bottom: 8px;
  }
}
@media (max-width: 560px) {
  .brand small { display: none; }
  .stat span { font-size: 11px; }
  .card { min-height: 0; }
  .wrap { padding-top: 16px; }
}
@media (max-width: 380px) {
  .g4, .g3, .g2 { grid-template-columns: 1fr; }
}
