:root {
  --navy: #0b1f3a;
  --navy-2: #13355f;
  --ink: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e4e9f1;
  --bg: #f3f5f9;
  --card: #ffffff;
  --gold: #d4a64a;
  --good: #0f766e;
  --bad: #b91c1c;
  --warn: #b45309;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 16px 40px -26px rgba(15, 23, 42, 0.28);
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: 20px; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(19, 53, 95, 0.08), transparent 60%),
    var(--bg);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.wrap { width: min(1260px, 100%); margin: 0 auto; padding: 0 28px; }

/* ---------- top bar ---------- */
.topbar {
  background:
    radial-gradient(1100px 380px at 12% -30%, rgba(56, 116, 184, 0.55), transparent 62%),
    linear-gradient(128deg, #07172c 0%, #0c2442 55%, #0b1f3a 100%);
  color: #fff;
  border-bottom: 3px solid var(--gold);
}

.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding-top: 20px; padding-bottom: 16px;
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }

.mark {
  display: grid; place-items: center;
  width: 46px; height: 46px; border-radius: 13px;
  background: linear-gradient(145deg, #e3bd6b, #b8872c);
  color: #0b1f3a; font-weight: 800; font-size: 15px; letter-spacing: 0.04em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 8px 20px -10px rgba(212,166,74,.9);
  flex: none;
}

.kicker {
  font-size: 10px; letter-spacing: 0.16em; font-weight: 700;
  color: var(--gold); text-transform: uppercase;
}
.brand .kicker { color: #e8c67c; }

.brand h1 {
  font-size: 21px; letter-spacing: 0.015em; font-weight: 700;
  line-height: 1.3; margin-top: 2px;
}

.topbar-right { display: flex; align-items: center; gap: 10px; flex: none; }

.stamp {
  font-size: 11px; color: #b9cbe2; text-align: right; line-height: 1.45;
  padding-right: 4px; white-space: nowrap;
}

.btn {
  appearance: none; border: 1px solid transparent; border-radius: 10px;
  background: linear-gradient(160deg, #e7c377, #c99a3d);
  color: #10233f; font-weight: 700; font-size: 13px;
  padding: 9px 16px; letter-spacing: 0.02em;
  box-shadow: 0 8px 18px -12px rgba(212,166,74,.9);
  transition: transform .15s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.04); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn.ghost {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.22);
  color: #e8eef7; box-shadow: none;
}
.btn.ghost:hover { background: rgba(255,255,255,.12); }
.btn.light {
  background: #fff; border-color: var(--line); color: var(--navy);
  box-shadow: 0 4px 12px -8px rgba(15,23,42,.3);
}
.btn.light:hover { background: #f8fafc; }

.nav {
  display: flex; gap: 26px; padding-bottom: 0;
  overflow-x: auto; scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  position: relative; flex: none;
  padding: 11px 2px 12px;
  color: #a9bfd8; text-decoration: none; font-size: 13px; font-weight: 600;
  letter-spacing: 0.02em; transition: color .15s ease;
}
.nav a:hover { color: #fff; }
.nav a.active { color: #fff; }
.nav a.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--gold); border-radius: 2px;
}

/* ---------- main ---------- */
main.wrap { padding-top: 26px; padding-bottom: 40px; }

.section { margin-bottom: 18px; }

.section-head, .panel-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; margin-bottom: 16px;
}
.section-head h2, .panel-head h2 {
  font-size: 22px; letter-spacing: 0.01em; line-height: 1.35; margin-top: 3px;
}
.panel-head h2 { font-size: 19px; }
.panel-sub {
  color: var(--muted); font-size: 12.5px; margin-top: 5px; max-width: 640px;
}

.asof-chip {
  flex: none; font-size: 12px; font-weight: 700; color: var(--navy);
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 15px; box-shadow: 0 6px 18px -14px rgba(15,23,42,.5);
  font-variant-numeric: tabular-nums;
}

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px 26px; box-shadow: var(--shadow); margin-bottom: 18px;
}

/* ---------- KPI ---------- */
.kpis {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px; margin-bottom: 14px;
}

.kpi {
  position: relative; overflow: hidden;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 18px 16px; box-shadow: var(--shadow);
  min-height: 132px; display: flex; flex-direction: column; justify-content: space-between;
}
.kpi::before {
  content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px;
  border-radius: 3px; background: #cbd5e1;
}
.kpi.accent-1::before { background: var(--navy-2); }
.kpi.accent-2::before { background: #0e7490; }
.kpi.accent-3::before { background: #7c3aed; }
.kpi.accent-4::before { background: var(--warn); }
.kpi.accent-5::before { background: #be185d; }

.kpi.primary {
  background:
    radial-gradient(420px 180px at 100% 0%, rgba(65,122,185,.45), transparent 65%),
    linear-gradient(150deg, #0d2748, #0a1d36);
  border-color: #123058; color: #fff;
}
.kpi.primary::before { background: var(--gold); }
.kpi.primary .kpi-label { color: #a9c1dc; }
.kpi.primary .kpi-sub { color: #b7cbe2; }

.kpi-label {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  letter-spacing: 0.04em; display: flex; align-items: center; gap: 6px;
}
.kpi-label span {
  font-weight: 600; font-size: 10.5px; color: var(--muted-2);
  background: #f1f5f9; border-radius: 5px; padding: 2px 6px;
}
.kpi.primary .kpi-label span { background: rgba(255,255,255,.1); color: #c6d6e8; }

.kpi-value {
  font-size: clamp(25px, 2.2vw, 34px); font-weight: 700; letter-spacing: -0.02em;
  line-height: 1.15; font-variant-numeric: tabular-nums; margin-top: 8px;
}
.kpi-value small { font-size: 0.46em; font-weight: 700; margin-left: 4px; letter-spacing: 0; }

.kpi-sub {
  color: var(--muted); font-size: 11.5px; margin-top: 8px;
  font-variant-numeric: tabular-nums; line-height: 1.5;
}
.kpi-sub b { color: var(--ink); font-weight: 700; }
.kpi.primary .kpi-sub b { color: #fff; }

.delta { font-weight: 700; }
.delta.down { color: var(--good); }
.delta.up { color: var(--bad); }
.kpi.primary .delta.down { color: #7de2c3; }
.kpi.primary .delta.up { color: #fca5a5; }

/* ---------- callouts ---------- */
.callouts { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.callout {
  display: flex; gap: 12px; align-items: flex-start;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; box-shadow: 0 10px 24px -24px rgba(15,23,42,.6);
}
.callout-icon {
  flex: none; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; font-size: 14px; font-weight: 800;
}
.callout.info .callout-icon { background: #e8f0fa; color: #1d4ed8; }
.callout.warn .callout-icon { background: #fef3e2; color: #b45309; }
.callout.good .callout-icon { background: #e7f6f2; color: #0f766e; }
.callout p { font-size: 12.5px; line-height: 1.6; color: #334155; }
.callout b { color: var(--ink); }

/* ---------- charts ---------- */
.chart-panel { padding-bottom: 18px; }
.chart-wrap { position: relative; }
.chart { width: 100%; min-height: 260px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-line { stroke: #eef2f7; stroke-width: 1; }
.chart .axis-text { fill: #94a3b8; font-size: 10.5px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .axis-label { fill: #64748b; font-size: 10.5px; font-weight: 600; }
.chart .future-shade { fill: #0f172a; opacity: .028; }
.chart .now-line { stroke: var(--gold); stroke-width: 1.4; stroke-dasharray: 4 4; opacity: .9; }
.chart .now-label { fill: #a16207; font-size: 10px; font-weight: 700; }
.chart .bar { transition: opacity .15s ease; }
.chart .bar:hover { opacity: .82; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hover-line { stroke: #334155; stroke-width: 1; stroke-dasharray: 3 3; opacity: .55; }
.chart .empty { color: var(--muted); font-size: 13px; padding: 60px 0; text-align: center; }

.tip {
  position: absolute; z-index: 20; pointer-events: none;
  background: rgba(255,255,255,.98); border: 1px solid var(--line);
  border-radius: 11px; padding: 10px 12px; min-width: 188px;
  box-shadow: 0 18px 42px -20px rgba(15,23,42,.45);
  font-size: 11.5px; line-height: 1.55; font-variant-numeric: tabular-nums;
}
.tip .tip-title { font-weight: 700; font-size: 12px; margin-bottom: 5px; color: var(--ink); }
.tip .tip-total { font-weight: 700; font-size: 14px; margin-bottom: 5px; }
.tip .tip-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; color: #475569; }
.tip .tip-row span:last-child { font-weight: 600; color: var(--ink); }
.tip .dot { display: inline-block; width: 7px; height: 7px; border-radius: 3px; margin-right: 5px; vertical-align: 1px; }
.tip .tip-note { color: var(--muted); margin-top: 4px; font-size: 10.5px; }

.legend { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--line); }
.legend-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: #334155;
  border-radius: 999px; padding: 5px 10px; font-size: 11px; font-weight: 600;
  transition: opacity .15s ease, background .15s ease;
}
.legend-chip b { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
.legend-chip:hover { background: #f8fafc; }
.legend-chip.off { opacity: .38; text-decoration: line-through; }
.legend-chip .dot, .company-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* ---------- two column ---------- */
.two-col { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 18px; }
.two-col > .panel { margin-bottom: 18px; }

/* ---------- company ---------- */
.sharebar {
  display: flex; height: 10px; border-radius: 6px; overflow: hidden;
  background: #eef2f7; margin: 4px 0 14px;
}
.sharebar span { height: 100%; }
.company-table { font-size: 12px; }
.company-row {
  display: grid; grid-template-columns: minmax(0, 1.5fr) 74px 52px 66px 38px;
  gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid #f1f4f8;
}
.company-row:first-child { border-top: 0; }
.company-row.head {
  color: var(--muted-2); font-size: 10px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; padding-top: 0; border-top: 0;
}
.company-name { display: flex; align-items: center; gap: 7px; min-width: 0; }
.company-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.company-row .num { text-align: right; font-variant-numeric: tabular-nums; }
.company-row .share { color: var(--muted); }

/* ---------- flow ---------- */
.flow-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.flow-chip {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 9px;
  padding: 6px 10px; font-size: 11px; color: var(--muted); line-height: 1.35;
}
.flow-chip b { display: block; color: var(--ink); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------- segmented ---------- */
.segmented {
  display: inline-flex; background: #eef2f7; border-radius: 10px; padding: 3px;
  border: 1px solid #e6ebf2; flex: none;
}
.segmented button {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  font-size: 11.5px; font-weight: 700; padding: 6px 11px; border-radius: 7px;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.segmented button.active {
  background: #fff; color: var(--navy); box-shadow: 0 2px 6px rgba(15,23,42,.1);
}

/* ---------- maturity ---------- */
.maturity-summary { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 16px; }
.mat-stat {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 13px;
}
.mat-stat .label { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.mat-stat .value { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; margin-top: 2px; }
.mat-stat .value small { font-size: 10px; color: var(--muted); font-weight: 600; margin-left: 3px; }

.maturity-bars { margin: 2px 0 14px; }
.maturity-bars svg { display: block; width: 100%; height: 76px; }
.maturity-bars .mb-bar { fill: #cbd8e8; }
.maturity-bars .mb-bar.has { fill: var(--navy-2); }
.maturity-bars .mb-bar.current { fill: var(--gold); }
.maturity-bars .mb-text { fill: #94a3b8; font-size: 9px; font-family: var(--font); }

.maturity-list { max-height: 360px; overflow: auto; border-top: 1px solid var(--line); }
.mat-group { border-bottom: 1px solid #f1f4f8; padding: 12px 2px; }
.mat-group-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.mat-month { font-weight: 700; font-size: 13.5px; min-width: 92px; font-variant-numeric: tabular-nums; }
.mat-count { font-size: 10.5px; font-weight: 700; color: #1d4ed8; background: #e8f0fa; border-radius: 5px; padding: 2px 7px; }
.mat-money { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; margin-left: auto; }
.mat-money b { color: var(--ink); font-size: 13px; }
.mat-items { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.mat-item {
  font-size: 10.5px; color: #475569; background: #f6f8fb; border: 1px solid #edf1f7;
  border-radius: 6px; padding: 3px 7px; display: inline-flex; align-items: center; gap: 5px;
}
.mat-item .dot { width: 6px; height: 6px; border-radius: 50%; }
.mat-item b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- toolbar / table ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.toolbar select, .toolbar input {
  appearance: none; background: #fff; border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 11px; font-size: 12px; color: #334155; min-height: 36px;
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.toolbar select { padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, #94a3b8 50%), linear-gradient(135deg, #94a3b8 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.toolbar select:focus, .toolbar input:focus { border-color: #93b4d9; box-shadow: 0 0 0 3px rgba(29,78,216,.08); }
.search { flex: 1 1 220px; min-width: 160px; }
.search input { width: 100%; }

.table-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11.5px; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.table-meta b { color: var(--ink); }

.table-scroll { max-height: 640px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.table-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.table-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }

.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.data-table th {
  position: sticky; top: 0; z-index: 2;
  background: #f8fafc; color: var(--muted); font-size: 10px; font-weight: 700;
  letter-spacing: .05em; text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.data-table td { padding: 11px 12px; border-bottom: 1px solid #f1f4f8; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr.contract-row { cursor: pointer; transition: background .12s ease; }
.data-table tbody tr.contract-row:hover { background: #f8fbff; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .muted { color: var(--muted-2); }
.data-table .strong { font-weight: 700; }
.data-table .item { font-weight: 600; }
.data-table .sub { display: block; color: var(--muted-2); font-size: 10px; margin-top: 1px; }
.data-table .company-cell { white-space: nowrap; }
.data-table .company-cell .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.data-table .period { white-space: nowrap; color: #475569; font-variant-numeric: tabular-nums; font-size: 11px; }
.data-table .period span { color: var(--muted-2); margin: 0 3px; }
.data-table .residual { color: #b45309; font-weight: 600; }
.data-table .annual-tag { display: inline-block; margin-left: 4px; font-size: 9px; color: #b45309; background: #fef3e2; border-radius: 4px; padding: 1px 4px; vertical-align: 1px; }

.badge { display: inline-block; font-size: 10px; font-weight: 700; border-radius: 5px; padding: 2px 7px; white-space: nowrap; }
.badge.active { color: #0f766e; background: #e7f6f2; }
.badge.upcoming { color: #1d4ed8; background: #e8f0fa; }
.badge.ended { color: #64748b; background: #eef2f7; }
.badge.unknown { color: #b45309; background: #fef3e2; }

.detail-row td { background: #fafcff; padding: 0 12px 14px !important; }
.detail-box {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px 18px;
  border-left: 2px solid #dbe6f4; padding: 10px 0 2px 14px; font-size: 11.5px;
}
.detail-box .k { color: var(--muted-2); font-size: 10px; display: block; }
.detail-box .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.detail-note { grid-column: 1 / -1; color: var(--muted); font-size: 10.5px; }

.table-empty { color: var(--muted); text-align: center; padding: 40px 0; font-size: 13px; }

/* ---------- notes ---------- */
.notes-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 22px; }
.note-list { list-style: none; margin: 0; padding: 0; }
.note-list li {
  position: relative; padding: 9px 0 9px 26px; border-top: 1px solid #f1f4f8;
  font-size: 12px; color: #334155; line-height: 1.6;
}
.note-list li:first-child { border-top: 0; }
.note-list li::before {
  content: "i"; position: absolute; left: 0; top: 10px;
  width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center;
  font-size: 9px; font-weight: 800; background: #e8f0fa; color: #1d4ed8;
}
.note-list li.warn::before { content: "!"; background: #fef3e2; color: #b45309; }

.method { margin-top: 14px; }
.method summary { cursor: pointer; font-size: 12px; font-weight: 700; color: var(--navy); }
.method ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 11.5px; line-height: 1.7; }
.method li { margin-bottom: 4px; }
.method b { color: #334155; }

.source-card { background: #f8fafc; border: 1px solid var(--line); border-radius: 14px; padding: 18px; align-self: start; }
.source-card h3 { font-size: 14px; margin: 3px 0 12px; }
.source-meta { margin: 0; font-size: 11.5px; }
.source-meta > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid #edf1f7; }
.source-meta > div:first-child { border-top: 0; }
.source-meta dt { color: var(--muted); }
.source-meta dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.source-link { display: inline-block; margin-top: 12px; font-size: 12px; font-weight: 700; color: #1d4ed8; text-decoration: none; }
.source-link:hover { text-decoration: underline; }
.readonly { margin-top: 10px; font-size: 10.5px; color: var(--muted); }

.archive { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.archive summary { cursor: pointer; display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; }
.archive-count { font-size: 10.5px; font-weight: 700; color: var(--muted); background: #eef2f7; border-radius: 5px; padding: 2px 7px; }
.archive .table-scroll { max-height: 360px; margin-top: 10px; }
.data-table.compact td, .data-table.compact th { padding: 8px 10px; }
.small { font-size: 11px; }
.muted { color: var(--muted); }

/* ---------- states ---------- */
.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 52vh; color: var(--muted); font-size: 13px; }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid #dbe4f0; border-top-color: var(--navy-2);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-panel { display: flex; gap: 16px; align-items: flex-start; margin-top: 30px; }
.error-icon { flex: none; width: 38px; height: 38px; border-radius: 11px; background: #fef3e2; color: #b45309; display: grid; place-items: center; font-weight: 800; font-size: 19px; }
.error-panel h2 { font-size: 17px; margin-bottom: 4px; }
.error-panel p { font-size: 12.5px; color: var(--muted); }

.stale-banner {
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
  border-radius: 10px; padding: 9px 13px; font-size: 12px; margin-bottom: 14px;
}

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: rgba(15,23,42,.94); color: #fff; font-size: 12px;
  padding: 9px 15px; border-radius: 9px; z-index: 100;
  box-shadow: 0 16px 40px -18px rgba(0,0,0,.5);
}

.footer {
  display: flex; justify-content: space-between; gap: 16px;
  padding-top: 8px; padding-bottom: 30px; font-size: 11px; color: var(--muted-2);
}

/* ---------- responsive ---------- */
@media (max-width: 1120px) {
  .kpis { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .kpi.primary { grid-column: span 1; }
  .two-col { grid-template-columns: 1fr; }
  .company-row { grid-template-columns: minmax(0,1.5fr) 84px 56px 76px 44px; }
}

@media (max-width: 820px) {
  .wrap { padding: 0 18px; }
  .topbar-inner { align-items: flex-start; }
  .stamp { display: none; }
  .brand h1 { font-size: 18px; }
  .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .kpi { min-height: 118px; padding: 15px; }
  .kpi-value { font-size: 26px; }
  .callouts { grid-template-columns: 1fr; }
  .maturity-summary { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .notes-grid { grid-template-columns: 1fr; }
  .section-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .panel { padding: 19px 17px; }
  .detail-box { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .toolbar select { flex: 1 1 140px; }
  .footer { flex-direction: column; gap: 4px; }
}

@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr; }
  .kpi { min-height: 0; }
  .kpi-value { font-size: 28px; }
  .brand { gap: 10px; }
  .mark { width: 38px; height: 38px; border-radius: 10px; font-size: 12px; }
  .brand .kicker { font-size: 8.5px; }
  .brand h1 { font-size: 16px; }
  .btn { padding: 8px 12px; font-size: 12px; }
  .nav { gap: 20px; }
  .panel-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .company-row { grid-template-columns: minmax(0,1.4fr) 76px 50px 68px 36px; font-size: 11px; }
  .data-table { font-size: 11px; }
}

/* ---------- progress / print ---------- */

@media (max-width: 700px) {
  #contracts .table-scroll { border: 0; border-radius: 0; max-height: 600px; overflow-x: hidden; }
  #contracts .data-table, #contracts .data-table tbody { display: block; width: 100%; }
  #contracts .data-table thead { display: none; }
  #contracts .data-table tr.contract-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 3px 16px;
    padding: 12px 4px 12px 2px; border-bottom: 1px solid var(--line); background: #fff;
  }
  #contracts .data-table tr.contract-row:hover { background: #f8fbff; }
  #contracts .data-table tr.contract-row td {
    display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
    padding: 2px 0; border: 0; font-size: 11.5px; text-align: right;
  }
  #contracts .data-table tr.contract-row td::before {
    content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 600;
    text-align: left; white-space: nowrap;
  }
  #contracts .data-table tr.contract-row td.company-cell {
    grid-column: 1 / -1; display: flex; justify-content: flex-start; font-weight: 700; font-size: 10.5px;
    color: var(--muted);
  }
  #contracts .data-table tr.contract-row td.company-cell::before { content: none; }
  #contracts .data-table tr.contract-row td.item-cell { grid-column: 1 / -1; display: block; text-align: left; }
  #contracts .data-table tr.contract-row td.item-cell::before { content: none; }
  #contracts .data-table tr.contract-row td.item-cell .item { font-size: 13px; }
  #contracts .data-table tr.contract-row td.period-cell { grid-column: 1 / -1; justify-content: flex-start; }
  #contracts .data-table tr.contract-row td.period-cell::before { content: "期間"; margin-right: 8px; }
  #contracts .data-table tr.contract-row td.status-cell { grid-column: 1 / -1; justify-content: flex-start; padding-top: 5px; }
  #contracts .data-table tr.detail-row { display: block; }
  #contracts .data-table tr.detail-row td { display: block; padding: 0 0 12px !important; }
  #contracts .detail-box { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-left: 10px; }
}

@media print {
  @page { size: A4 portrait; margin: 10mm; }
  body { background: #fff; font-size: 10px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .topbar { background: #0b1f3a !important; border-bottom-width: 2px; }
  .topbar-right, .nav, .toolbar, .segmented, .source-link, .toast, .footer, .panel-head .btn { display: none !important; }
  .wrap { width: 100%; padding: 0; }
  main.wrap { padding-top: 12px; }
  .panel, .kpi, .callout { box-shadow: none !important; }
  .panel { border-color: #dbe3ed; break-inside: auto; page-break-inside: auto; padding: 14px; }
  .panel.chart-panel { break-inside: avoid; page-break-inside: avoid; }
  .section { break-inside: avoid; }
  .kpi, .callout { break-inside: avoid; page-break-inside: avoid; }
  .kpis { grid-template-columns: repeat(3, 1fr); gap: 7px; }
  .kpi { min-height: 0; padding: 9px 11px; }
  .kpi-label { font-size: 9.5px; }
  .kpi-label span { font-size: 8px; padding: 1px 4px; }
  .kpi-value { font-size: 19px; }
  .kpi-sub { font-size: 8.5px; }
  .section-head, .panel-head { flex-direction: row; align-items: center; }
  .maturity-summary { grid-template-columns: repeat(4, 1fr); }
  .two-col { grid-template-columns: 1fr 1fr; }
  .chart-panel .chart svg { height: 285px; }
  .chart-panel { padding-bottom: 12px; }
  .callout { padding: 10px 12px; }
  .callout p { font-size: 10.5px; }
  .callouts { grid-template-columns: repeat(3, 1fr); }
  .two-col { grid-template-columns: 1fr 1fr; gap: 10px; }
  .table-scroll { max-height: none; overflow: visible; }
  .maturity-list { max-height: none; }
  .data-table th { position: static; }
  .data-table { font-size: 9px; }
  .data-table td { padding: 5px 6px; }
  .chart { min-height: 0; }
  .tip { display: none !important; }
  .archive[open] .table-scroll { max-height: none; }
  details:not([open]) > *:not(summary) { display: none; }
  a { text-decoration: none; }
}
