:root {
  font: 16px/1.45 system-ui, sans-serif;
  color: #172433;
  background: #f6f7f9;
  --surface: #fff;
  --border: #dce2e8;
  --muted: #526170;
  --accent: #095b9e;
}
* { box-sizing: border-box; }
body { margin: 0; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.75rem, 3vw, 2.25rem); line-height: 1.15; font-weight: 650; }
h2 { font-size: 1.1rem; line-height: 1.3; font-weight: 650; }
button, select, input { font: inherit; color: inherit; min-height: 48px; border: 1px solid #a7b3bd; border-radius: 8px; padding: 8px 12px; background: var(--surface); }
button { cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible, .sheet:focus-visible { outline: 3px solid #a85808; outline-offset: 2px; }
button:disabled { opacity: .65; cursor: wait; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: max(12px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 12px max(20px, env(safe-area-inset-left)); background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: #fff; background: var(--accent); }
.brand-mark svg { width: 20px; height: 20px; }
.quiet { border-color: var(--border); font-weight: 550; }
.primary { color: #fff; background: var(--accent); border-color: var(--accent); font-weight: 600; }
.primary span { margin-left: 8px; }
main { max-width: 90rem; margin: auto; padding: 24px max(20px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
.page-heading, .sheet-heading, .dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.page-heading { margin-bottom: 20px; }
.eyebrow { color: var(--muted); font-size: .875rem; margin-bottom: 4px; }
#status:not(:empty) { padding: 12px 0; color: var(--muted); }
.overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; gap: 16px; padding: 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.period, .overview-stat, .filter { display: grid; gap: 4px; min-width: 0; }
.period label, .overview-stat span, .filter label { color: var(--muted); font-size: .875rem; }
.period select { width: 100%; }
.overview-stat strong { min-height: 48px; display: flex; align-items: center; font-size: 1.125rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.notice { width: 100%; margin: 16px 0; padding: 12px 16px; text-align: left; color: #75420a; background: #fff7e7; border-color: #e7cd99; }
.notice.ok { color: #205943; background: #edf8f2; border-color: #b6d8c6; }
.worksheet { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.sheet-heading { padding: 20px; align-items: end; flex-wrap: wrap; }
.sheet-heading p, .scroll-hint { color: var(--muted); font-size: .875rem; }
.sheet-heading p { margin-top: 4px; }
.filter select { min-width: 10rem; }
.sheet { overflow: auto; max-height: min(70dvh, 52rem); border-block: 1px solid var(--border); }
table { border-collapse: separate; border-spacing: 0; table-layout: fixed; min-width: 1100px; width: 100%; font-variant-numeric: tabular-nums; }
caption { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
th, td { padding: 10px 12px; border-bottom: 1px solid #e8edf1; text-align: left; white-space: pre-line; vertical-align: middle; }
thead th { position: sticky; top: 0; z-index: 2; background: #f0f3f6; color: #455867; font-size: .8rem; font-weight: 600; white-space: nowrap; }
tbody th { position: sticky; left: 0; z-index: 1; background: #fff; min-width: 9rem; font-weight: 600; }
thead th:first-child { left: 0; z-index: 3; }
.line th, .line td { background: #edf4fa; font-weight: 600; }
.reading { display: block; width: 100%; min-width: 0; padding: 8px 10px; color: #07538d; border-color: #b8d3e8; background: #f2f8fc; text-align: left; font-weight: 600; }
.reading + .reading { margin-top: 4px; }
.reading:hover { background: #e5f2fb; }
.scroll-hint { padding: 10px 20px; }
dialog { width: min(34rem, calc(100% - 32px)); max-height: min(85dvh, 48rem); border: 0; border-radius: 16px; padding: 20px; color: inherit; box-shadow: 0 16px 48px #17243324; }
dialog::backdrop { background: #1a2a3a99; }
.dialog-head { margin-bottom: 16px; }
#panel-text { white-space: pre-wrap; line-height: 1.55; }
#notice:not(:empty) { margin-top: 12px; color: #8a400a; }
#buttons { display: grid; gap: 8px; margin-top: 16px; }
#buttons button { width: 100%; text-align: left; border-color: var(--border); }
#input-form:not([hidden]) { display: grid; gap: 8px; margin-top: 16px; }
#input-form input { width: 100%; }
@media (max-width: 48rem) {
  .overview { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; padding: 16px; }
  .overview .primary { width: 100%; }
  .sheet-heading { padding: 16px; }
  .filter { width: 100%; }
  .filter select { width: 100%; }
  tbody th { min-width: 0; }
  thead th:nth-child(1) { width: 100px; }
  thead th:nth-child(2) { width: 88px; }
  thead th:nth-child(3) { width: 104px; }
  th, td { padding: 8px 10px; }
}
@media (max-width: 24rem) {
  main { padding-inline: 12px; }
  .topbar { padding-inline: 12px; }
}
