:root {
  --ink: #3a2d24;
  --muted: #75695f;
  --line: #e7d7bd;
  --paper: #fff7e8;
  --card: #fffefa;
  --green: #2f6d4e;
  --green-dark: #265a40;
  --mint: #e6f2e7;
  --amber: #785813;
  --red: #b3261e;
  --gold: #c99a3b;
  --gold-light: #f8eacb;
  --shadow: 0 18px 45px rgba(90, 52, 15, .11);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 0 0, #f8ead3 0, var(--paper) 38rem) fixed;
  font: 16px/1.6 Inter, -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1160px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0 32px; }
.masthead { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.eyebrow, .section-kicker { color: var(--amber); font-size: 11px; font-weight: 800; letter-spacing: .18em; margin: 0 0 6px; }
h1, h2 { letter-spacing: -.035em; line-height: 1.15; margin: 0; }
h1 { color: var(--red); font-size: clamp(2.1rem, 5vw, 4rem); }
h2 { font-size: clamp(1.35rem, 2.6vw, 2rem); }
.subtitle, .muted { color: var(--muted); margin: 10px 0 0; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.login-panel { max-width: 520px; padding: 28px; }
.panel-heading, .section-heading { align-items: center; display: flex; justify-content: space-between; gap: 16px; }
.login-form { display: grid; gap: 10px; margin-top: 24px; }
label { color: var(--muted); font-size: 14px; font-weight: 650; }
input, select { background: #fffdf8; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); padding: 11px 13px; }
input:focus, select:focus { border-color: var(--red); outline: 3px solid rgba(179, 38, 30, .16); }
.button { border: 0; border-radius: 12px; font-weight: 750; padding: 10px 16px; transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .55; transform: none; }
.button-primary { background: var(--red); border: 1px solid #9e211b; box-shadow: 0 8px 18px rgba(132, 38, 24, .2); color: #fffaf0; }
.button-secondary { background: var(--gold-light); border: 1px solid #e1c47d; color: var(--ink); }
.button-quiet { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.button-large { font-size: 16px; padding: 14px 20px; white-space: nowrap; }
.error-message { color: var(--red); min-height: 1.6em; margin: 10px 0 0; }
.hidden { display: none !important; }
.hero-panel { align-items: center; display: flex; justify-content: space-between; gap: 24px; margin-bottom: 18px; padding: 28px; }
.summary-grid { display: grid; gap: 18px; grid-template-columns: repeat(3, 1fr); margin-bottom: 18px; }
.metric { display: grid; gap: 2px; padding: 20px 22px; }
.metric span, .metric small { color: var(--muted); }
.metric strong { color: var(--red); font-size: 1.65rem; letter-spacing: -.03em; }
.metric small { font-size: 12px; }
.current-panel, .history-panel { margin-bottom: 18px; padding: 22px; }
.badge { border-radius: 999px; font-size: 12px; font-weight: 750; padding: 4px 10px; }
.badge-muted { background: #f2ebdf; color: var(--muted); }
.badge-running { background: var(--gold-light); color: var(--amber); }
.badge-success { background: var(--mint); color: var(--green-dark); }
.badge-error { background: #f8e1dc; color: var(--red); }
.empty-state { color: var(--muted); padding: 26px 0 4px; }
.history-toolbar { align-items: flex-start; }
.toolbar-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.batch-list { display: grid; gap: 14px; margin-top: 18px; }
.batch-card { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.batch-header { align-items: center; background: #faeed8; display: flex; justify-content: space-between; gap: 12px; padding: 9px 13px; }
.batch-meta { color: var(--muted); font-size: 11px; }
.progress-box { background: #fffcf6; border-bottom: 1px solid var(--line); padding: 7px 13px 6px; }
.progress-box-compact { padding: 10px 13px 9px; }
.progress-line, .progress-meta { align-items: center; display: flex; gap: 12px; justify-content: space-between; }
.progress-line { color: var(--ink); font-size: 12px; }
.progress-line span, .progress-meta { color: var(--muted); font-size: 10px; }
.progress-track { background: #efe2c9; border-radius: 999px; height: 5px; margin: 5px 0 4px; overflow: hidden; }
.progress-track span { background: var(--red); border-radius: inherit; display: block; height: 100%; transition: width .25s ease; }
.progress-warning { color: var(--amber); font-size: 12px; margin-top: 5px; }
.plan-list { display: grid; }
.plan-row {
  align-items: center;
  border-top: 1px solid var(--line);
  column-gap: 14px;
  display: grid;
  grid-template-columns: minmax(168px, 205px) minmax(285px, 1fr) minmax(300px, 380px);
  padding: 8px 13px;
}
.plan-row:first-child { border-top: 0; }
.plan-ident { min-width: 0; }
.plan-label { font-size: 14px; font-weight: 750; line-height: 1.25; }
.source-label { color: var(--muted); display: block; font-size: 11px; line-height: 1.2; }
.numbers { color: #111111; font-size: 15px; font-variant-numeric: tabular-nums; font-weight: 800; letter-spacing: .055em; line-height: 1.3; margin: 0; white-space: nowrap; word-spacing: .16em; }
.numeric-text { color: #111111 !important; font-variant-numeric: tabular-nums; }
.numbers-placeholder { color: var(--muted); font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
.numbers-placeholder.error { color: var(--red); }
.plan-side { align-items: flex-end; display: grid; gap: 3px; justify-items: end; min-width: 0; }
.plan-actions { align-items: center; display: flex; flex-wrap: nowrap; gap: 5px; justify-content: flex-end; }
.tiny-button { background: #fbf2e2; border: 1px solid rgba(201, 154, 59, .55); border-radius: 7px; color: var(--red); font-size: 10px; line-height: 1.2; padding: 4px 7px; white-space: nowrap; }
.settlement { color: var(--muted); font-size: 10px; line-height: 1.3; margin: 0; max-width: 100%; overflow-wrap: anywhere; text-align: right; }
.settlement strong { color: var(--ink); }
.settlement.pending { color: var(--amber); }
.settlement.error { color: var(--red); }
.source-history { font-size: 10px; line-height: 1.3; margin: 0; max-width: 100%; overflow-wrap: anywhere; text-align: right; }
.source-history.saved { color: var(--green-dark); }
.source-history.warning { color: var(--amber); }
.source-history.pending { color: var(--muted); }
.archive-node { min-width: 0; }
.archive-year { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.archive-year + .archive-year { margin-top: 9px; }
.archive-summary { align-items: center; cursor: pointer; display: flex; gap: 12px; justify-content: space-between; list-style: none; min-height: 38px; padding: 8px 13px; }
.archive-summary::-webkit-details-marker { display: none; }
.archive-summary::before { border-bottom: 2px solid var(--gold); border-right: 2px solid var(--gold); content: ""; flex: 0 0 7px; height: 7px; margin: 0 3px 3px 0; transform: rotate(-45deg); transition: transform .16s ease; }
.archive-node[open] > .archive-summary::before { margin-bottom: 0; transform: rotate(45deg); }
.archive-name { color: var(--ink); flex: 1; font-size: 13px; font-weight: 750; }
.archive-count { color: var(--muted); font-size: 10px; white-space: nowrap; }
.archive-year > .archive-summary { background: #f8ecd6; min-height: 44px; padding-left: 15px; }
.archive-year > .archive-summary .archive-name { color: var(--red); font-size: 14px; }
.archive-months, .archive-days { display: grid; gap: 7px; padding: 0 9px 9px; }
.archive-month { background: #fffbf4; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.archive-month > .archive-summary { padding-left: 15px; }
.archive-day { background: #fdf9f1; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.archive-day > .archive-summary { min-height: 34px; padding-left: 15px; }
.archive-batches { display: grid; gap: 8px; padding: 0 8px 8px; }
.archive-batches .batch-card { border-radius: 11px; }
footer { color: var(--muted); display: flex; font-size: 12px; justify-content: space-between; padding: 8px 4px; }
@media (max-width: 1050px) {
  .plan-row { grid-template-columns: minmax(150px, 190px) minmax(0, 1fr); row-gap: 5px; }
  .numbers { grid-column: 2; grid-row: 1; font-size: 14px; white-space: normal; }
  .plan-side { align-items: center; display: flex; flex-direction: row; flex-wrap: wrap; grid-column: 1 / -1; justify-content: space-between; }
  .settlement { text-align: right; }
  .source-history { text-align: right; }
}
@media (max-width: 700px) {
  .shell { padding-top: 24px; width: min(100% - 22px, 620px); }
  .masthead, .hero-panel, .history-toolbar { align-items: stretch; flex-direction: column; }
  .login-panel, .current-panel, .history-panel, .hero-panel { border-radius: 16px; padding: 20px; }
  .button-large { width: 100%; }
  .summary-grid { grid-template-columns: 1fr; }
  .toolbar-actions { justify-content: stretch; }
  .toolbar-actions select, .toolbar-actions button { flex: 1; }
  .batch-header { align-items: flex-start; flex-direction: column; gap: 5px; }
  .progress-line, .progress-meta { align-items: flex-start; flex-direction: column; gap: 2px; }
  .plan-row { grid-template-columns: 1fr; row-gap: 6px; padding: 10px 12px; }
  .plan-ident { align-items: baseline; column-gap: 8px; display: flex; flex-wrap: wrap; row-gap: 2px; }
  .plan-label { font-size: 13px; }
  .source-label { font-size: 10px; }
  .numbers { font-size: 14px; grid-column: auto; grid-row: auto; letter-spacing: .035em; line-height: 1.35; white-space: normal; word-spacing: .08em; }
  .numbers-placeholder { font-size: 11px; }
  .plan-side { align-items: flex-start; flex-direction: column; grid-column: auto; }
  .plan-actions { flex-wrap: wrap; justify-content: flex-start; }
  .settlement { font-size: 10px; text-align: left; }
  .source-history { font-size: 10px; text-align: left; }
  .archive-summary { padding-right: 10px; padding-left: 10px; }
  .archive-months, .archive-days { padding-right: 6px; padding-left: 6px; }
  .archive-batches { padding-right: 5px; padding-left: 5px; }
  footer { gap: 8px; flex-direction: column; }
}
