:root {
  color-scheme: dark;
  --bg: #090909;
  --bg-soft: #101010;
  --panel: rgba(23, 23, 23, 0.9);
  --panel-strong: #191919;
  --line: rgba(244, 190, 70, 0.18);
  --line-soft: rgba(255, 255, 255, 0.09);
  --gold: #f0b949;
  --gold-bright: #ffd77e;
  --gold-soft: rgba(240, 185, 73, 0.12);
  --cream: #f7f1e5;
  --muted: #9b968e;
  --muted-strong: #c3bdb3;
  --danger: #e87f6f;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  color: var(--cream);
  background:
    radial-gradient(circle at 86% 0%, rgba(240, 185, 73, 0.08), transparent 32rem),
    radial-gradient(circle at 0% 40%, rgba(255, 255, 255, 0.025), transparent 24rem),
    var(--bg);
  line-height: 1.55;
  font-size: 16px;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; overflow: hidden; }

.topbar {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: block;
  flex: 0 1 240px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.brand-logo { display: block; width: min(240px, 100%); height: auto; aspect-ratio: 3 / 1; object-fit: contain; }
.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1.3;
}

.topbar-actions, .month-switcher { display: flex; align-items: center; gap: 10px; }
.month-switcher { color: var(--muted-strong); font-size: 14px; white-space: nowrap; }
.icon-button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  color: var(--cream);
  background: transparent;
}
.icon-button:hover { border-color: var(--gold); color: var(--gold-bright); }

main { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 58px 0 80px; }
.intro-block { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 30px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(30px, 4vw, 48px); line-height: 1.15; letter-spacing: -0.04em; }
h2 { margin: 3px 0 0; font-size: 22px; letter-spacing: -0.025em; }
.intro-copy { margin: 0; color: var(--muted); font-size: 16px; }
.local-note { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #74c889; box-shadow: 0 0 0 4px rgba(116, 200, 137, 0.12); }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.8fr); gap: 20px; align-items: start; }
.main-column, .side-column { display: grid; gap: 20px; min-width: 0; }
.panel { padding: 26px; background: linear-gradient(145deg, rgba(30, 30, 30, 0.95), rgba(15, 15, 15, 0.96)); border: 1px solid var(--line-soft); border-radius: 18px; box-shadow: var(--shadow); }
.overview-panel { border-color: var(--line); background: linear-gradient(145deg, rgba(41, 35, 23, 0.96), rgba(17, 17, 17, 0.98) 58%); }
.section-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 24px; }
.compact-heading { margin-bottom: 20px; }
.section-kicker { color: var(--muted); font-size: 13px; }
.status-pill { padding: 6px 10px; border: 1px solid var(--line); border-radius: 99px; color: var(--gold-bright); background: var(--gold-soft); font-size: 12px; white-space: nowrap; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.kpi-card { min-height: 128px; display: flex; flex-direction: column; justify-content: space-between; padding: 16px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(7, 7, 7, 0.34); }
.kpi-featured { border-color: rgba(240, 185, 73, 0.34); background: linear-gradient(145deg, rgba(240, 185, 73, 0.13), rgba(7, 7, 7, 0.2)); }
.kpi-label, .kpi-meta { color: var(--muted); font-size: 12px; }
.kpi-value { color: var(--cream); font-size: clamp(21px, 2.2vw, 31px); line-height: 1.1; letter-spacing: -0.04em; }
.kpi-featured .kpi-value { color: var(--gold-bright); }
.unit { margin-left: 3px; color: var(--muted-strong); font-size: 15px; letter-spacing: 0; }

.progress-section { margin-top: 28px; }
.progress-header, .progress-footer { display: flex; justify-content: space-between; gap: 12px; color: var(--muted-strong); font-size: 13px; }
.progress-header strong { color: var(--gold-bright); }
.progress-track { height: 9px; margin: 10px 0 9px; overflow: hidden; border-radius: 99px; background: rgba(255, 255, 255, 0.08); }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ba7725, var(--gold-bright)); transition: width 300ms ease; }
.progress-footer { color: var(--muted); font-size: 12px; }

.form-grid { display: grid; gap: 14px; }
.form-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.compact-fields { margin-top: 14px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field > span { color: var(--muted-strong); font-size: 13px; }
.field em { color: var(--muted); font-size: 11px; font-style: normal; }
.field small { min-height: 16px; color: var(--muted); font-size: 11px; }
input, select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  outline: none;
  color: var(--cream);
  background: rgba(4, 4, 4, 0.52);
}
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(240, 185, 73, 0.1); }
input::placeholder { color: #6f6a63; }
.form-bottom-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; gap: 14px; margin-top: 14px; }
.entry-preview { min-width: 120px; display: grid; gap: 2px; padding: 8px 0; }
.entry-preview span { color: var(--muted); font-size: 12px; }
.entry-preview strong { color: var(--gold-bright); font-size: 18px; }
.button { min-height: 44px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; padding: 10px 16px; border: 1px solid transparent; border-radius: 9px; font-size: 14px; font-weight: 700; transition: transform 160ms ease, border-color 160ms ease, background 160ms ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #12100b; background: var(--gold); }
.button-primary:hover { background: var(--gold-bright); }
.button-secondary { color: #16120a; background: var(--gold-bright); }
.button-outline { border-color: var(--line); color: var(--gold-bright); background: transparent; }
.button-outline:hover { border-color: var(--gold); background: var(--gold-soft); }
.button-ghost { border-color: var(--line-soft); color: var(--muted-strong); background: transparent; }
.button-ghost:hover { border-color: var(--muted-strong); }
.button-danger { border-color: rgba(232,127,111,.55); color: #ffb3a8; background: rgba(120,35,28,.16); }
.button-danger:hover, .button-danger:focus-visible { border-color: var(--danger); background: rgba(120,35,28,.28); }
.button-small { min-height: 36px; padding: 7px 12px; font-size: 12px; }
.full-width { width: 100%; }
.form-message { min-height: 20px; margin: 10px 0 0; color: var(--gold-bright); font-size: 12px; }
.form-message.error { color: var(--danger); }
.line-editor-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-top: 18px; }
.line-editor-section { min-width: 0; padding: 16px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(7,7,7,.28); }
.line-editor-heading { min-height: 44px; display: flex; align-items: start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.line-editor-heading h3, .item-management-grid h3 { margin: 2px 0 0; color: var(--cream); font-size: 16px; }
.line-list { display: grid; gap: 10px; }
.line-card { min-width: 0; padding: 12px; border: 1px solid var(--line-soft); border-radius: 10px; background: rgba(20,20,20,.72); }
.line-card-main { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(110px,.65fr); gap: 10px; }
.line-tax-settings { margin-top: 8px; }
.line-tax-settings > summary { min-height: 44px; display: flex; align-items: center; color: var(--muted-strong); cursor: pointer; font-size: 12px; }
.line-tax-settings > .field { margin-top: 4px; }
.line-delete { width: 100%; margin-top: 10px; }
.line-empty { margin: 6px 0 12px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.line-editor-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.line-editor-actions .button { flex: 1 1 150px; }
.inline-item-creator { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.legacy-amounts-panel { margin-top: 16px; }
.item-management-panel { margin-top: 20px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.item-management-panel > summary { min-height: 44px; display: flex; align-items: center; color: var(--gold-bright); cursor: pointer; font-weight: 700; }
.item-management-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-top: 16px; }
.item-management-list { display: grid; gap: 10px; margin-top: 10px; }
.item-management-row { min-width: 0; padding: 12px; border: 1px solid var(--line-soft); border-radius: 10px; background: rgba(7,7,7,.24); }
.item-management-actions { display: grid; grid-template-columns: minmax(0,1fr) auto auto minmax(90px,auto); gap: 6px; margin-top: 8px; }
.item-management-actions .button { margin-top: 0; }
.entry-tax-settings { margin-top: 16px; padding: 4px 0 10px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.entry-tax-settings > summary, .tax-help > summary, .tax-breakdown-details > summary { min-height: 44px; display: flex; align-items: center; color: var(--gold-bright); cursor: pointer; font-size: 14px; }
.tax-config-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-top: 14px; }
.tax-config-grid fieldset { min-width: 0; margin: 0; padding: 14px; border: 1px solid var(--line-soft); border-radius: 10px; }
.tax-config-grid legend { padding: 0 5px; color: var(--gold); font-size: 13px; }
.taxable-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 10px; }
.tax-help p { margin: 0 0 8px; color: var(--muted-strong); font-size: 13px; }
.tax-breakdown-details { flex-basis: 100%; width: 100%; }
.tax-breakdown-list { display: grid; gap: 10px; min-width: 0; margin-top: 8px; }
.tax-breakdown-block { min-width: 0; padding: 12px; border: 1px solid var(--line-soft); border-radius: 10px; background: rgba(7,7,7,.24); }
.tax-breakdown-block h4 { margin: 0 0 4px; color: var(--gold-bright); font-size: 13px; }
.tax-breakdown-block .money-list > div { grid-template-columns: minmax(0,1fr) 11ch; gap: 8px; padding: 7px 0; }
.tax-breakdown-block .money-list dd { min-width: 0; font-variant-numeric: tabular-nums; }
.aligned-yen { width: 100%; display: grid; grid-template-columns: 1ch minmax(0,1fr); gap: .35ch; align-items: baseline; font-variant-numeric: tabular-nums; }
.aligned-yen > :first-child { text-align: left; }
.aligned-yen > :last-child { text-align: right; }
@media (max-width: 700px) { .line-editor-grid, .item-management-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .tax-config-grid { grid-template-columns: 1fr; }
  .line-editor-section { padding: 13px; }
  .line-card-main, .inline-item-creator { grid-template-columns: 1fr; }
  .line-editor-actions .button, .inline-item-creator .button { width: 100%; }
  .item-management-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .item-management-actions .button { min-height: 44px; }
}

.entry-list { display: grid; gap: 8px; }
.entry-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto auto; align-items: center; gap: 15px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.entry-date { display: grid; gap: 1px; }
.entry-date strong { font-size: 14px; }
.entry-date span { color: var(--muted); font-size: 11px; }
.entry-details { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.entry-chip { padding: 4px 7px; border: 1px solid var(--line-soft); border-radius: 5px; color: var(--muted-strong); font-size: 11px; }
.entry-complete-total { width: 100%; color: var(--gold-bright); font-size: 12px; }
.entry-note { width: 100%; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.entry-expense { color: var(--muted); font-size: 12px; white-space: nowrap; }
.entry-total { color: var(--gold-bright); font-size: 17px; white-space: nowrap; }
.delete-entry { position: relative; z-index: 2; padding: 6px; border: 0; color: var(--muted); background: transparent; font-size: 16px; touch-action: manipulation; }
.delete-entry:hover, .delete-entry:focus-visible { color: var(--danger); }
.empty-state { display: grid; justify-items: center; gap: 4px; padding: 44px 16px 28px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--muted-strong); font-size: 15px; }
.empty-mark { width: 38px; height: 38px; display: grid; place-items: center; margin-bottom: 5px; border: 1px dashed var(--line); border-radius: 50%; color: var(--gold); font-size: 22px; }

.settings-symbol { color: var(--gold); font-size: 21px; }
.settings-divider { height: 1px; margin: 20px 0; background: var(--line-soft); }
.settings-subheading { margin-bottom: 13px; color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; }
.settings-panel .field + .field { margin-top: 13px; }
.settings-panel .button { margin-top: 18px; }
.app-info { display: flex; align-items: center; margin-top: 10px; }
.app-info .button { margin-top: 0; }
.snapshot-list { display: grid; gap: 0; margin: 0; }
.snapshot-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.snapshot-list dt { color: var(--muted); font-size: 13px; }
.snapshot-list dd { margin: 0; color: var(--muted-strong); font-size: 14px; font-weight: 700; }
.snapshot-list .snapshot-category dd, .snapshot-list .snapshot-total dd { display: grid; grid-template-columns: auto minmax(86px, auto); align-items: baseline; justify-content: end; gap: 8px 14px; text-align: right; }
.snapshot-list .snapshot-category dd strong, .snapshot-list .snapshot-total dd strong { color: var(--muted-strong); font-size: 14px; white-space: nowrap; }
.snapshot-list .snapshot-category dd span, .snapshot-list .snapshot-total dd span { color: var(--gold-bright); font-size: 15px; white-space: nowrap; }
.snapshot-list .snapshot-total { margin-top: 4px; border-top-color: var(--line); border-bottom: 1px solid var(--line); }
.snapshot-list .snapshot-total dt, .snapshot-list .snapshot-total dd strong { color: var(--cream); font-weight: 800; }
.snapshot-list .snapshot-emphasis dd { color: var(--gold-bright); }
.field-log-toggle-meta { display: flex; align-items: center; gap: 14px; }
.field-log-content { min-width: 0; }
.payment-panel { border-color: rgba(240, 185, 73, 0.26); }
.payment-toggle-meta { display: flex; align-items: center; gap: 14px; }
.payment-panel[open] > .settings-toggle { margin-bottom: 18px; }
.payment-summary-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0; }
.payment-summary-list > div { min-width: 0; padding: 13px; border: 1px solid var(--line-soft); border-radius: 10px; background: rgba(7, 7, 7, 0.3); }
.payment-summary-list dt { color: var(--muted); font-size: 12px; }
.payment-summary-list dd { margin: 5px 0 0; color: var(--cream); font-size: clamp(17px, 2vw, 23px); font-weight: 800; line-height: 1.2; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.payment-summary-list small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.payment-summary-list .payment-expected { border-color: rgba(240, 185, 73, 0.34); background: var(--gold-soft); }
.payment-summary-list .payment-expected dd, .payment-summary-list .payment-difference dd { color: var(--gold-bright); }
.confirmed-payment-form { display: grid; grid-template-columns: minmax(0, 320px) auto; align-items: end; gap: 12px; margin-top: 16px; }
.confirmed-payment-actions { display: flex; gap: 8px; }
.annual-payment-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.annual-payment-list .payment-supporting { background: rgba(7,7,7,.18); }
.annual-payment-list .payment-supporting dt, .annual-payment-list .payment-supporting dd { color: var(--muted-strong); }
.annual-payment-list .payment-primary { border-color: rgba(240,185,73,.28); }
@media (max-width: 900px) {
  .payment-summary-list, .annual-payment-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .payment-summary-list .payment-difference { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .confirmed-payment-form { grid-template-columns: 1fr; }
  .confirmed-payment-actions .button { flex: 1; min-height: 46px; }
  .payment-summary-list > div { padding: 12px; }
  .payment-summary-list dd { font-size: 18px; }
}
.backup-panel p { margin-bottom: 14px; color: var(--muted); font-size: 13px; }
.backup-actions { display: grid; gap: 8px; }

.recurring-expense-panel { border-color: var(--line); }
.recurring-expense-list { display: grid; gap: 12px; margin-top: 18px; }
.recurring-expense-item { padding: 16px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(7,7,7,.28); }
.recurring-expense-heading { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.recurring-expense-heading > div { display: grid; gap: 3px; min-width: 0; }
.recurring-expense-heading strong { color: var(--cream); font-size: 16px; overflow-wrap: anywhere; }
.recurring-expense-heading span { color: var(--gold-bright); font-size: 13px; }
.recurring-expense-item details > summary, .recurring-expense-editor > summary, .recurring-expense-advanced > summary { min-height: 44px; display: flex; align-items: center; color: var(--gold-bright); cursor: pointer; font-size: 14px; }
.recurring-history { display: grid; gap: 0; border-top: 1px solid var(--line-soft); }
.recurring-history > div { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.recurring-history span, .recurring-history small { color: var(--muted); font-size: 12px; }
.recurring-history strong { color: var(--cream); font-variant-numeric: tabular-nums; }
.recurring-history small { grid-column: 1 / -1; }
.recurring-change-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.recurring-history-actions { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 7px; }
.recurring-stop { display: grid; grid-template-columns: minmax(0,220px) auto; align-items: end; gap: 10px; margin-top: 12px; }
.recurring-delete-expense { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.recurring-delete-expense small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.recurring-expense-editor { margin-top: 16px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.recurring-expense-form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.recurring-expense-advanced { margin-top: 10px; }
.recurring-expense-advanced .field { max-width: 340px; }
.recurring-form-actions { display: flex; gap: 10px; margin-top: 16px; }
.recurring-expense-empty { padding-block: 26px 18px; }
.settings-panel .recurring-expense-panel .field + .field { margin-top: 0; }
.settings-panel .recurring-expense-panel .button { margin-top: 0; }
@media (max-width: 600px) {
  .recurring-expense-form-grid { grid-template-columns: 1fr; }
  .recurring-expense-heading { align-items: stretch; }
  .recurring-expense-heading .button { flex: 0 0 auto; }
  .recurring-stop { grid-template-columns: 1fr; }
  .recurring-stop .button { width: 100%; }
  .recurring-history-actions .button { flex: 1; min-height: 44px; }
  .recurring-delete-expense { align-items: stretch; flex-direction: column; }
  .recurring-delete-expense .button { width: 100%; min-height: 44px; }
}

.app-shell { --global-footer-reserve: calc(76px + env(safe-area-inset-bottom, 0px)); }
.app-shell > main { padding-bottom: calc(var(--global-footer-reserve) + 16px); }
.system-footer { position: fixed; left: 50%; bottom: 0; z-index: 8; width: min(1120px, calc(100% - 48px)); display: grid; gap: 2px; margin: 0; padding: 12px 2px max(18px, env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line-soft); color: var(--muted); background: rgba(9,9,9,.98); box-shadow: 0 -10px 24px rgba(0,0,0,.28); backdrop-filter: blur(14px); font-size: 12px; line-height: 1.45; transform: translateX(-50%); }
.system-footer-links, .system-footer-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.system-footer a { display: inline-flex; align-items: center; min-height: 38px; color: var(--gold-bright); font-weight: 800; text-decoration: none; }
.system-footer strong { color: var(--muted-strong); font-variant-numeric: tabular-nums; }
.monthly-settings-card { width: min(430px, 100%); max-height: min(78vh, 620px); overflow-y: auto; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); }
.monthly-settings-card h2 { margin: 4px 0 8px; font-size: 21px; }
.monthly-settings-card > p:not(.eyebrow) { margin: 0 0 14px; color: var(--muted-strong); font-size: 14px; line-height: 1.65; }
.monthly-settings-confirmation-list { display: grid; gap: 0; margin: 0 0 16px; }
.monthly-settings-confirmation-list div { display: grid; grid-template-columns: minmax(0, 1fr) max-content; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.monthly-settings-confirmation-list dt { min-width: 0; overflow-wrap: anywhere; color: var(--muted-strong); }
.monthly-settings-confirmation-list dd { margin: 0; white-space: nowrap; color: var(--cream); font-weight: 850; font-variant-numeric: tabular-nums; }
.toast { position: fixed; right: 20px; bottom: calc(var(--global-footer-reserve) + 12px); z-index: 10; max-width: min(360px, calc(100% - 40px)); padding: 12px 15px; border: 1px solid var(--line); border-radius: 10px; color: var(--cream); background: #1d1a14; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity 180ms ease, transform 180ms ease; }
.toast.show { opacity: 1; transform: translateY(0); }

.release-overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: calc(18px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom)); background: rgba(0,0,0,.8); backdrop-filter: blur(8px); }
.release-overlay[hidden] { display: none; }
.update-notice-card, .changelog-card { width: min(520px,100%); border: 1px solid rgba(240,185,73,.48); border-radius: 18px; background: linear-gradient(150deg,#211b10,#0d0d0d 62%); box-shadow: 0 28px 90px rgba(0,0,0,.68); }
.update-notice-card { padding: 24px; }
.update-notice-card h2 { margin-top: 3px; color: var(--cream); font-size: clamp(23px,6vw,32px); }
.release-version { display: block; margin: 12px 0 7px; color: var(--gold-bright); font-size: 28px; font-variant-numeric: tabular-nums; }
.update-notice-card > p:not(.eyebrow) { color: var(--muted-strong); font-size: 14px; line-height: 1.7; }
.release-actions { display: flex; gap: 10px; margin-top: 20px; }
.release-actions .button { flex: 1; }
.changelog-card { max-height: min(86vh,760px); display: grid; grid-template-rows: auto minmax(0,1fr); overflow: hidden; }
.changelog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 20px 14px; border-bottom: 1px solid var(--line-soft); }
.changelog-heading h2 { margin-top: 2px; color: var(--cream); font-size: 25px; }
.changelog-close-hint { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.changelog-list { overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; padding: 0 20px 22px; }
.changelog-entry { padding: 20px 0; border-bottom: 1px solid var(--line-soft); scroll-margin-top: 16px; }
.changelog-entry:last-child { border-bottom: 0; }
.changelog-version-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.changelog-version-line strong { color: var(--gold-bright); font-size: 22px; font-variant-numeric: tabular-nums; }
.changelog-version-line time { color: var(--muted); font-size: 12px; }
.changelog-summary { margin: 6px 0 14px; color: var(--cream); font-size: 15px; font-weight: 700; }
.changelog-section + .changelog-section { margin-top: 13px; }
.changelog-section h3 { margin-bottom: 6px; color: var(--muted-strong); font-size: 13px; }
.changelog-section ul { display: grid; gap: 6px; margin: 0; padding-left: 20px; color: var(--muted-strong); font-size: 13px; line-height: 1.65; }

@media (max-width: 980px) {
  .content-grid { grid-template-columns: 1fr; }
  .side-column { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .backup-panel { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .topbar, main, .system-footer { width: min(100% - 28px, 1440px); }
  .topbar { padding-top: 18px; gap: 10px; }
  .brand { flex-basis: 180px; }
  .topbar-actions { gap: 6px; }
  .month-switcher { gap: 5px; font-size: 12px; }
  .month-switcher .icon-button { width: 27px; height: 27px; }
  .button-small { padding-inline: 9px; }
  main { padding-top: 38px; }
  .intro-block { display: grid; align-items: start; gap: 14px; margin-bottom: 22px; }
  h1 { font-size: 34px; }
  .panel { padding: 20px 16px; border-radius: 14px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-card { min-height: 112px; padding: 13px; }
  .kpi-value { font-size: 23px; }
  .form-grid-three { grid-template-columns: 1fr 1fr; }
  .form-grid-three .field:first-child { grid-column: 1 / -1; }
  .form-bottom-row { grid-template-columns: 1fr 1fr; }
  .field-note { grid-column: 1 / -1; }
  .entry-preview { padding: 0; }
  .form-bottom-row .button { width: 100%; }
  .side-column { grid-template-columns: 1fr; }
  .backup-panel { grid-column: auto; }
  .entry-row { grid-template-columns: 86px minmax(0, 1fr) auto; gap: 9px; }
  .entry-expense { display: none; }
  .delete-entry { grid-column: 3; grid-row: 1; }
  .entry-total { grid-column: 3; grid-row: 2; }
  .app-info { align-items: stretch; flex-direction: column; }
  .app-info .button { width: 100%; }
  .release-actions { flex-direction: column; }
  .update-notice-card { padding: 21px 17px; }
  .changelog-heading { padding-inline: 16px; }
  .changelog-list { padding-inline: 16px; }
}

@media (max-width: 430px) {
  .topbar { gap: 8px; }
  .brand { flex-basis: 154px; }
  .topbar-actions .button-small { font-size: 11px; }
  .kpi-meta { font-size: 11px; }
  .progress-footer { display: grid; gap: 3px; }
  .form-grid-three { grid-template-columns: 1fr; }
  .form-grid-three .field:first-child { grid-column: auto; }
  .form-bottom-row { grid-template-columns: 1fr 1fr; }
  .entry-preview strong { font-size: 16px; }
  .entry-row { grid-template-columns: 78px minmax(0, 1fr) auto; }
  .entry-chip { font-size: 10px; }
}

/* PWA app chrome: the header and section navigation stay available while the long cockpit scrolls. */
:root {
  --site-header-height: 96px;
  --section-nav-height: 48px;
  --fixed-chrome-offset: calc(var(--site-header-height) + var(--section-nav-height));
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

.app-shell { padding-top: var(--fixed-chrome-offset); }
.topbar {
  position: fixed;
  z-index: 50;
  top: 0;
  left: 50%;
  width: min(1440px, 100%);
  margin: 0;
  padding: calc(18px + var(--safe-top)) max(24px, var(--safe-right)) 14px max(24px, var(--safe-left));
  background: rgba(9, 9, 9, 0.96);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
  transition: padding 180ms ease, background 180ms ease;
}
.section-nav {
  position: fixed;
  z-index: 49;
  top: var(--site-header-height);
  left: 0;
  width: 100%;
  min-height: var(--section-nav-height);
  padding: 3px max(10px, var(--safe-right)) 3px max(10px, var(--safe-left));
  border-bottom: 1px solid var(--line-soft);
  background: rgba(13, 13, 13, 0.96);
  backdrop-filter: blur(14px);
  transition: top 180ms ease;
}
.section-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; }
.section-nav a {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: 8px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-decoration: none;
  transition: color 140ms ease, background 140ms ease;
}
.section-nav a:hover, .section-nav a[aria-current="true"] { color: var(--gold-bright); background: var(--gold-soft); }
.section-nav a[hidden] { display: none; }
.section-nav.game-off { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#todayInputSection, #monthlyOverview, #paymentCheckPanel, #gameZone, #settingsPanel { scroll-margin-top: calc(var(--fixed-chrome-offset) + 14px); }

.startup-splash {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: calc(24px + var(--safe-top)) max(24px, var(--safe-right)) calc(24px + env(safe-area-inset-bottom, 0px)) max(24px, var(--safe-left));
  background: #080808;
  opacity: 1;
  overflow: hidden;
  isolation: isolate;
  animation: startup-splash-failsafe 350ms ease 2.4s forwards;
  transition: opacity 220ms ease;
}
.startup-splash[hidden] { display: none; }
.startup-splash.is-hidden { opacity: 0; pointer-events: none; }
html.pwa-standalone #startupSplash.is-white-transition { background: transparent; }
.startup-splash img { position: relative; z-index: 1; display: block; width: min(76vw, 360px); height: auto; filter: drop-shadow(0 16px 34px rgba(240, 185, 73, .18)); animation: startup-logo-push 1650ms cubic-bezier(.2,.7,.2,1) both; }
.startup-splash-white { position: absolute; z-index: 2; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.startup-splash.is-white-transition .startup-splash-white { animation: startup-white-transition 700ms ease-out both; }
@keyframes startup-logo-push {
  0% { opacity: 0; transform: scale(.92); }
  16% { opacity: 1; transform: scale(1); }
  54% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(8); }
}
@keyframes startup-white-transition {
  0% { opacity: 0; }
  28% { opacity: 1; }
  58% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes startup-splash-failsafe { to { opacity: 0; visibility: hidden; pointer-events: none; } }

@media (max-width: 700px) {
  .topbar { padding-inline: max(14px, var(--safe-right)) max(14px, var(--safe-left)); }
  .section-nav a { font-size: 11px; }
}
@media (max-width: 390px) {
  .section-nav { gap: 1px; padding-inline: max(6px, var(--safe-right)) max(6px, var(--safe-left)); }
  .section-nav a { min-height: 40px; font-size: 10px; letter-spacing: 0; }
  .topbar { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .topbar, .section-nav, .startup-splash { transition: none; }
  .startup-splash { animation-delay: .8s; animation-duration: 100ms; }
  .startup-splash img { animation: none; }
  .startup-splash.is-white-transition .startup-splash-white { animation: startup-white-reduced 280ms ease-out both; }
}

@keyframes startup-white-reduced {
  0% { opacity: 0; }
  35% { opacity: .9; }
  100% { opacity: 0; }
}

[hidden] { display: none !important; }
@media (min-width: 701px) { .entry-row { grid-template-columns: 80px minmax(0, 1fr) auto auto auto; } }

.annual-panel { margin-bottom: 20px; border-color: var(--line); }
.annual-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.annual-kpis .kpi-value { font-size: clamp(24px, 3vw, 38px); overflow-wrap: anywhere; }
.annual-kpis .kpi-label { font-size: 14px; }
.annual-note { color: var(--muted-strong); font-size: 14px; margin: 16px 0 0; }
.annual-detail-stack { display: grid; gap: 10px; margin-top: 18px; }
.annual-detail-block { border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(7,7,7,.24); overflow: hidden; }
.annual-payment-panel { padding: 0; }
.annual-detail-summary { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 16px; cursor: pointer; list-style: none; }
.annual-detail-summary::-webkit-details-marker { display: none; }
.annual-detail-summary > span:first-child { display: grid; gap: 2px; min-width: 0; }
.annual-detail-summary small { color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: .15em; }
.annual-detail-summary strong { color: var(--cream); font-size: 17px; line-height: 1.35; }
.annual-detail-state { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-width: 0; }
.annual-detail-state b { color: var(--muted-strong); font-size: 12px; font-weight: 700; white-space: nowrap; }
.annual-detail-block[open] > .annual-detail-summary { border-bottom: 1px solid var(--line-soft); }
.annual-detail-summary:focus-visible { outline: 2px solid var(--gold); outline-offset: -4px; border-radius: 10px; }
.annual-detail-content { padding: 16px; }
.annual-detail-content > .annual-note:first-child, .annual-detail-note { margin-top: 0; }
.annual-tax-summary { margin-top: 0; border: 0; padding: 0; background: transparent; }
.annual-table-wrap { max-width: 100%; overflow-x: auto; margin-top: 16px; -webkit-overflow-scrolling: touch; overscroll-behavior-inline: contain; }
.annual-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.annual-table caption { text-align: left; margin: 0 0 12px; }
.annual-table th, .annual-table td { padding: 10px; text-align: right; border-bottom: 1px solid var(--line-soft); }
.annual-table th:first-child { position: sticky; left: 0; z-index: 1; text-align: left; background: var(--panel-strong); border-right: 1px solid var(--line-soft); box-shadow: 6px 0 10px rgba(0,0,0,.18); }
.annual-table thead th:first-child, .annual-table tfoot th:first-child { z-index: 2; }
.annual-table tr.selected-month th:first-child { background: #302719; }
.annual-table thead { color: var(--muted-strong); }
.annual-table tfoot { color: var(--gold-bright); font-weight: 700; }
.selected-month { background: var(--gold-soft); }
.annual-month-button { border: 0; background: transparent; color: var(--gold-bright); min-height: 44px; padding: 4px 10px; text-decoration: underline; font-size: 14px; }
#monthlyOverview { scroll-margin-top: calc(var(--fixed-chrome-offset) + 14px); }
@media (max-width: 600px) { .annual-kpis { grid-template-columns: 1fr; } .annual-kpis .kpi-card { min-height: 102px; } .annual-panel .section-heading { flex-wrap: wrap; } .annual-detail-summary { min-height: 64px; padding: 11px 13px; } .annual-detail-content { padding: 13px; } .annual-detail-state { gap: 8px; } .annual-detail-state b { font-size: 11px; } }

main { padding-top: 24px; }
main > .entry-panel, main > .settings-panel { margin-bottom: 20px; }
.settings-toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; min-height: 44px; }
.settings-toggle h2 { font-size: 18px; }
.settings-panel[open] .settings-toggle { margin-bottom: 20px; }
.settings-panel { scroll-margin-top: calc(var(--fixed-chrome-offset) + 14px); }
main > .settings-panel form { max-width: 720px; }
@media (max-width: 430px) { .entry-panel .form-grid-three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.ordered-panels { display: flex; flex-direction: column; gap: 20px; max-width: 1120px; }
.ordered-panels > .panel { width: 100%; margin-bottom: 0; }
.fold-panel[open] > summary { margin-bottom: 20px; }
.fold-indicator::after { content: "＋"; color: var(--gold-bright); font-size: 22px; }
details[open] > summary .fold-indicator::after { content: "−"; }
.settings-toggle { list-style: none; }
.settings-toggle::-webkit-details-marker { display: none; }
.settings-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 6px; border-radius: 4px; }
#toggleRecords { margin-top: 16px; }

.duplicate-notice { border: 1px solid var(--gold); padding: 12px; margin: 12px 0; border-radius: 9px; }
.duplicate-notice p { margin: 6px 0; font-size: 14px; }
#editNotice { margin-bottom: 16px; }
#cancelEditButton { grid-column: 1 / -1; }
.entry-row { grid-template-columns: 80px minmax(0, 1fr) auto auto auto auto; }
@media(max-width:700px) { .entry-row { grid-template-columns: 70px minmax(0, 1fr) auto; } .entry-total { grid-column: 2; grid-row: 2; } .edit-entry { grid-column: 3; grid-row: 2; } .delete-entry { grid-column: 3; grid-row: 1; min-height: 44px; min-width: 44px; } }

.invoice-switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; font-size: 16px; }
.invoice-switch input { width: 48px; min-height: 28px; height: 28px; accent-color: var(--gold); cursor: pointer; }
#entryTaxPreview { font-size: 12px; color: var(--muted-strong); max-width: 220px; }

.category-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.category-inputs > .field { grid-column: auto; }
.category-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.category-settings fieldset { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.category-settings legend { color: var(--gold-bright); font-size: 14px; padding: 0 5px; }
.category-settings-details { display: grid; gap: 13px; }
.category-settings-details[hidden] { display: none; }
@media(max-width:480px) { .category-settings { grid-template-columns: 1fr; } }

@media(max-width:360px) {
  .snapshot-list .snapshot-category dd, .snapshot-list .snapshot-total dd { grid-template-columns: 1fr; gap: 2px; }
}

.category-check { display: flex; align-items: center; gap: 12px; min-height: 44px; margin-bottom: 12px; font-size: 14px; cursor: pointer; }
.category-check input { width: 24px; height: 24px; min-height: 24px; accent-color: var(--gold); }

.tax-summary { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 20px; border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-top: 20px; }
.tax-summary span { font-size: 14px; }
.tax-summary strong { color: var(--gold-bright); font-size: 24px; font-variant-numeric: tabular-nums; }
.tax-summary small { flex-basis: 100%; color: var(--muted-strong); font-size: 13px; }

.tax-triple { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); width:100%; gap:16px; margin:0; }
.tax-triple dt { font-size:14px; color:var(--muted-strong); }
.tax-triple dd { margin:4px 0 0; font-size:clamp(18px,3vw,28px); font-weight:700; color:var(--gold-bright); overflow-wrap:anywhere; }
@media(max-width:480px) { .tax-triple { grid-template-columns:1fr; } .tax-triple > div { display:flex; justify-content:space-between; gap:12px; align-items:center; } }

/* DELIPIT GAME begins only after the CORE work surfaces. */
.game-zone {display:grid;gap:20px;padding-top:24px;margin-top:10px;border-top:2px solid rgba(240,185,73,.56);}
.game-zone-heading {display:grid;grid-template-columns:auto minmax(40px,1fr) auto;align-items:center;gap:14px;padding:0 4px;}
.game-zone-heading > span {color:var(--muted);font-size:11px;font-weight:800;letter-spacing:.16em;}
.game-zone-heading > i {height:1px;background:linear-gradient(90deg,var(--line-soft),var(--gold));}
.game-zone-heading > div {text-align:right;}
.game-zone-heading h2 {font-size:18px;color:var(--cream);}
.game-panel {border-color:rgba(240,185,73,.3);background:linear-gradient(145deg,rgba(38,31,18,.96),rgba(12,12,12,.98) 62%);}
.driver-status-layout {display:grid;grid-template-columns:minmax(0,1fr) 126px;gap:10px 18px;align-items:start;}
.driver-status-layout.crew-only {grid-template-columns:1fr;}
.driver-status-layout.crew-only .pit-crew-home {min-height:130px;border-left:0;}
.driver-readout {min-width:0;}
.driver-line {display:flex;align-items:center;justify-content:space-between;gap:16px;color:var(--gold-bright);font-weight:700;font-size:16px;}
.driver-line strong {font-size:32px;font-variant-numeric:tabular-nums;}
.game-panel progress {width:100%;height:10px;margin:12px 0;accent-color:var(--gold);border:0;border-radius:8px;overflow:hidden;}
progress::-webkit-progress-bar {background:#34312a;} progress::-webkit-progress-value {background:var(--gold);} progress::-moz-progress-bar {background:var(--gold);}
.game-note {font-size:14px;line-height:1.7;color:var(--muted-strong);margin:8px 0;}
.game-panel summary,.game-settings summary {cursor:pointer;min-height:44px;padding:10px 0;color:var(--gold-bright);font-size:16px;}
.driver-details {grid-column:1/-1;}
.level-next-grid {display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;margin-top:2px;}
.level-next-grid > div {display:grid;gap:2px;}
.level-next-grid > div:last-child {text-align:right;}
.level-next-grid span {color:var(--muted);font-size:11px;font-weight:800;letter-spacing:.1em;}
.level-next-grid strong {color:var(--gold-bright);font-size:clamp(18px,3.2vw,25px);font-variant-numeric:tabular-nums;line-height:1.2;overflow-wrap:anywhere;}
.pit-crew-home {position:relative;min-height:112px;border-left:1px solid var(--line);overflow:hidden;background:radial-gradient(circle at 54% 70%,rgba(240,185,73,.12),transparent 62%);}
.pit-crew-label {position:absolute;top:0;right:0;color:var(--muted-strong);font-size:10px;font-weight:800;letter-spacing:.13em;}
.crew-sprite {display:block;filter:drop-shadow(0 10px 12px rgba(0,0,0,.5));}
.crew-sprite img {display:block;width:100%;height:100%;object-fit:contain;}
.crew-sprite img[hidden],.crew-sprite[hidden] {display:none;}
.crew-sprite-pito {position:absolute;left:7px;bottom:-1px;width:64px;height:88px;z-index:2;animation:pito-idle 4s ease-in-out infinite;}
.crew-sprite-rona {position:absolute;right:-2px;top:29px;width:72px;height:58px;animation:rona-idle 3s ease-in-out infinite;}
@keyframes pito-idle {0%,100%{transform:translateY(0)}45%{transform:translateY(-3px)}90%{transform:translateY(0)}}
@keyframes rona-idle {0%,100%{transform:translateY(0) rotate(0)}25%{transform:translateY(-3px) rotate(1deg)}50%{transform:translateY(0) rotate(0)}75%{transform:translateY(3px) rotate(-1deg)}}
.game-settings {border-bottom:1px solid var(--line);padding-bottom:20px;margin-bottom:24px;}
.game-settings small {display:block;font-size:14px;color:var(--muted);}
@media(prefers-reduced-motion:reduce) {*,*::before,*::after {transition:none!important;animation:none!important;scroll-behavior:auto!important;}}

.achievement-grid {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;padding:0;list-style:none;}
.achievement {display:grid;gap:8px;padding:16px;border:1px solid var(--line-soft);border-radius:9px;color:var(--muted-strong);}
.achievement strong {font-size:16px;overflow-wrap:anywhere;}.achievement span,.achievement small {font-size:14px;line-height:1.6;}
.achievement.unlocked {border-color:var(--line);background:var(--gold-soft);}.achievement.unlocked strong {color:var(--gold-bright);}
.game-panel h3 {font-size:14px;letter-spacing:.1em;margin-top:24px;}
.milestone-panel h2 {color:var(--gold-bright);font-size:clamp(24px,4vw,34px);margin:6px 0;}
.feature-card {margin-top:12px;padding:14px;border:1px solid var(--line);border-radius:10px;background:rgba(240,185,73,.06);color:var(--cream);line-height:1.6;overflow-wrap:anywhere;}
.feature-card strong {display:block;color:var(--gold-bright);letter-spacing:.05em;}
.feature-card small {display:block;color:var(--muted-strong);}
.milestone-panel[data-feature-theme="veteran"] .feature-card {border-color:#b9a77c;background:rgba(160,140,92,.12);}
.milestone-panel[data-feature-theme="legend"] .feature-card {border-color:#d7c17c;background:linear-gradient(130deg,rgba(131,94,25,.2),rgba(35,29,16,.7));}
.milestone-panel[data-feature-theme="final"] .feature-card {border-color:#f0d786;box-shadow:inset 0 0 20px rgba(240,185,73,.11);}
.milestone-panel details {border-top:1px solid var(--line-soft);margin-top:18px;}
.career-history-list {display:grid;gap:10px;padding:0;list-style:none;max-height:360px;overflow:auto;}
.career-history-list li {display:grid;grid-template-columns:minmax(0,1fr) auto;gap:3px 12px;padding:12px;border:1px solid var(--line-soft);border-radius:9px;}
.career-history-list li strong {grid-column:1/-1;color:var(--gold-bright);font-size:11px;letter-spacing:.08em;}
.career-history-list li span {overflow-wrap:anywhere;}.career-history-list li small {color:var(--muted-strong);}
#milestoneSharePreview img {display:block;width:min(100%,360px);height:auto;margin:14px 0;border:1px solid var(--line-soft);}
.game-stat-grid {display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:10px;}
.game-stat {display:grid;align-content:start;gap:3px;min-width:0;padding:13px;border:1px solid var(--line-soft);border-radius:10px;background:rgba(4,4,4,.3);}
.game-stat > span,.game-stat > small {color:var(--muted);font-size:11px;font-weight:800;letter-spacing:.08em;line-height:1.35;}
.game-stat > strong {color:var(--gold-bright);font-size:clamp(20px,3.4vw,28px);font-weight:800;line-height:1.15;font-variant-numeric:tabular-nums;overflow-wrap:anywhere;}
.game-stat > em {color:var(--muted-strong);font-size:11px;font-style:normal;}
.game-stat-wide {grid-column:span 2;}
.career-summary {display:grid!important;gap:10px;}
.career-summary > span:first-child {color:var(--gold-bright);}
.achievement-stat-grid {grid-template-columns:repeat(3,minmax(0,1fr));width:100%;margin:0;}
.achievement-stat-grid .game-stat {padding:10px 12px;}
.achievement-stat-grid .game-stat > strong {font-size:clamp(19px,3vw,25px);}
.game-notice {position:fixed;left:50%;bottom:calc(var(--global-footer-reserve) + 12px);width:min(540px,calc(100% - 28px));display:grid;grid-template-columns:156px minmax(0,1fr);align-items:center;gap:18px;padding:18px;border:1px solid var(--gold);border-radius:16px;background:linear-gradient(145deg,rgba(34,29,18,.98),rgba(12,12,12,.98));color:var(--cream);z-index:12;pointer-events:none;box-shadow:0 20px 70px rgba(0,0,0,.48);overflow:hidden;transform:translateX(-50%);}
.game-notice[hidden] {display:none;}
.game-notice.no-crew {grid-template-columns:1fr;}
.game-notice.is-active {animation:pit-event-in .28s ease-out both;}
.pit-event-glow {position:absolute;inset:-60%;background:radial-gradient(circle,rgba(240,185,73,.24),transparent 47%);opacity:.65;animation:pit-glow 2s ease-in-out infinite;}
.pit-event-crew {position:relative;z-index:1;min-height:112px;}
.pit-event-crew .crew-sprite {position:absolute;width:84px;height:108px;}
.pit-event-crew .crew-sprite:first-child {left:0;bottom:-8px;z-index:2;}
.pit-event-crew .crew-sprite:last-child {right:-2px;top:8px;width:94px;height:76px;}
.pit-event-copy {position:relative;z-index:2;display:grid;gap:4px;min-width:0;}
.pit-event-copy > span:first-child {color:var(--gold);font-size:10px;font-weight:800;letter-spacing:.16em;}
.pit-event-badge {display:none;width:max-content;padding:4px 8px;border:1px solid var(--gold);border-radius:999px;background:rgba(240,185,73,.12);color:var(--gold-bright)!important;font-size:10px!important;font-weight:900;letter-spacing:.12em!important;}
.pit-event-copy strong {color:var(--gold-bright);font-size:clamp(19px,4vw,28px);line-height:1.12;overflow-wrap:anywhere;}
.pit-event-copy > span {font-size:14px;}
.pit-event-copy b {font-size:15px;line-height:1.35;overflow-wrap:anywhere;font-variant-numeric:tabular-nums;}
.pit-particles {position:absolute;inset:0;z-index:1;}
.pit-particles i {position:absolute;width:5px;height:5px;border-radius:50%;background:var(--gold-bright);opacity:0;animation:pit-spark 1.25s ease-out infinite;}
.pit-particles i:nth-child(1){left:13%;top:18%;animation-delay:.1s}.pit-particles i:nth-child(2){left:38%;top:10%;animation-delay:.45s}.pit-particles i:nth-child(3){right:18%;top:16%;animation-delay:.25s}.pit-particles i:nth-child(4){right:8%;bottom:24%;animation-delay:.65s}.pit-particles i:nth-child(5){left:45%;bottom:12%;animation-delay:.8s}
.game-notice[data-motion="greeting"] .pit-particles {display:none;}
.game-notice[data-motion="greeting"] .pit-event-crew .crew-sprite:first-child {animation:pito-wave .62s ease-in-out 2;}
.game-notice[data-motion="greeting"] .pit-event-crew .crew-sprite:last-child {animation:rona-pop .65s ease-out 1,rona-idle 1.4s .65s ease-in-out infinite;}
.game-notice[data-motion="level"] .pit-event-crew .crew-sprite:first-child {animation:pito-cheer .7s ease-in-out 2;}
.game-notice[data-motion="level"] .pit-event-crew .crew-sprite:last-child,.game-notice[data-motion="best"] .pit-event-crew .crew-sprite:last-child {animation:rona-pop .62s ease-out 1,rona-idle 1.2s .62s ease-in-out infinite;}
.game-notice[data-motion="achievement"] .pit-event-crew .crew-sprite:first-child,.game-notice[data-motion="best"] .pit-event-crew .crew-sprite:first-child {animation:pito-cheer .72s ease-in-out 2;}
.game-notice[data-motion="achievement"] .pit-event-badge {display:inline-flex;animation:pit-badge-flash .9s ease-out 1;}
.game-notice[data-motion="level"] .pit-event-copy b,.game-notice[data-motion="best"] .pit-event-copy b {animation:pit-value-flash .9s ease-out 1;}
@keyframes pit-event-in {from{opacity:0;transform:translate(-50%,18px) scale(.98)}to{opacity:1;transform:translate(-50%,0) scale(1)}}
@keyframes pit-glow {0%,100%{opacity:.35;transform:scale(.96)}50%{opacity:.72;transform:scale(1.04)}}
@keyframes pit-spark {0%{opacity:0;transform:translateY(8px) scale(.4)}35%{opacity:1}100%{opacity:0;transform:translateY(-22px) scale(1.2)}}
@keyframes pito-wave {0%,100%{transform:rotate(0) translateY(0)}50%{transform:rotate(-4deg) translateY(-4px)}}
@keyframes pito-cheer {0%,100%{transform:translateY(0) scale(1)}50%{transform:translateY(-9px) scale(1.03)}}
@keyframes rona-pop {0%{opacity:0;transform:translate(24px,-14px) rotate(8deg) scale(.8)}70%{opacity:1;transform:translate(-2px,2px) rotate(-3deg) scale(1.04)}100%{transform:none}}
@keyframes pit-badge-flash {0%{opacity:.35;box-shadow:0 0 0 rgba(240,185,73,0)}45%{opacity:1;box-shadow:0 0 22px rgba(240,185,73,.72)}100%{box-shadow:0 0 0 rgba(240,185,73,0)}}
@keyframes pit-value-flash {0%{color:var(--cream);text-shadow:none}45%{color:var(--gold-bright);text-shadow:0 0 18px rgba(240,185,73,.78)}100%{text-shadow:none}}
@media(max-width:650px){.achievement-grid{grid-template-columns:1fr;}}

.game-grid {display:grid;grid-template-columns:1fr 1fr;gap:16px;margin:16px 0;}
.game-grid-single {grid-template-columns:minmax(0,1fr);}
.game-tile {min-width:0;padding:18px;background:#101010;border:1px solid var(--line-soft);border-radius:12px;}
.rank-value {display:block;font-size:clamp(24px,5vw,40px);color:var(--gold-bright);margin-top:12px;overflow-wrap:anywhere;}
@media(max-width:650px){.game-grid{grid-template-columns:1fr;}}

.result-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-top:20px;}
.result-grid .game-tile{display:grid;gap:12px;align-content:space-between;}.result-grid span{font-size:14px;color:var(--muted-strong);}.result-grid strong{font-size:clamp(20px,3vw,30px);color:var(--gold-bright);overflow-wrap:anywhere;}
@media(max-width:700px){.result-grid{grid-template-columns:repeat(2,minmax(0,1fr));}}

.share-panel {border-top:1px solid var(--line);margin-top:20px;padding-top:10px;}.share-options {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 20px;}.share-options .category-check{margin:0;}
#shareImage{display:block;width:min(100%,420px);height:auto;border:1px solid var(--line);border-radius:10px;margin-top:16px;}.share-actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:16px;}.share-actions a{text-decoration:none;}
@media(max-width:420px){.share-options{grid-template-columns:1fr;}}

.today-result {position:fixed;inset:0;z-index:20;display:grid;place-items:center;padding:calc(18px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));background:rgba(0,0,0,.78);backdrop-filter:blur(8px);cursor:pointer;}
.today-result[hidden] {display:none;}
.today-result-card {width:min(480px,100%);padding:24px;border:1px solid rgba(240,185,73,.48);border-radius:18px;background:linear-gradient(150deg,#211b10,#0d0d0d 62%);box-shadow:0 28px 90px rgba(0,0,0,.65);}
.today-result-card h2 {font-size:clamp(25px,7vw,38px);color:var(--gold-bright);letter-spacing:.02em;}
.today-result-date {display:block;margin:4px 0 18px;color:var(--muted-strong);font-size:17px;letter-spacing:.12em;}
.today-result-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;}
.today-result-grid > div {display:grid;gap:3px;padding:14px;border:1px solid var(--line-soft);border-radius:11px;background:rgba(0,0,0,.28);}
.today-result-grid span {color:var(--muted);font-size:12px;font-weight:800;letter-spacing:.08em;}
.today-result-grid strong {color:var(--cream);font-size:clamp(23px,7vw,34px);line-height:1.12;font-variant-numeric:tabular-nums;overflow-wrap:anywhere;}
.today-result-grid small {color:var(--muted-strong);font-size:12px;}
.today-result-card > p:last-child {margin:18px 0 0;color:var(--muted);font-size:12px;text-align:center;}

@media(max-width:520px){
  .driver-status-layout {grid-template-columns:minmax(0,1fr) 92px;gap:8px 10px;}
  .pit-crew-home {min-height:98px;}
  .pit-crew-label {font-size:8px;}
  .crew-sprite-pito {left:4px;width:52px;height:72px;}
  .crew-sprite-rona {width:61px;height:48px;top:31px;}
  .level-next-grid {gap:8px;}
  .level-next-grid strong {font-size:18px;}
  .game-stat-grid {grid-template-columns:repeat(2,minmax(0,1fr));}
  .achievement-stat-grid {grid-template-columns:repeat(3,minmax(0,1fr));}
  .achievement-stat-grid .game-stat {padding:9px 7px;}
  .achievement-stat-grid .game-stat > strong {font-size:17px;}
  .achievement-stat-grid .game-stat > small {font-size:9px;letter-spacing:.03em;}
  .game-notice {grid-template-columns:112px minmax(0,1fr);gap:12px;padding:14px;}
  .pit-event-crew {min-height:92px;}
  .pit-event-crew .crew-sprite {width:66px;height:88px;}
  .pit-event-crew .crew-sprite:last-child {width:72px;height:60px;}
  .pit-event-copy > span {font-size:13px;}
  .pit-event-copy b {font-size:13px;}
}

@media(max-width:390px){
  .topbar {display:grid;grid-template-columns:1fr;}
  .brand {width:168px;max-width:58vw;}
  .topbar-actions {width:100%;justify-content:space-between;}
}

@media(max-width:350px){
  .topbar-actions .button-small {padding-inline:6px;font-size:10px;}
  .month-switcher {font-size:11px;}
  .game-zone-heading {grid-template-columns:auto minmax(20px,1fr);}
  .game-zone-heading > div {grid-column:1/-1;text-align:left;}
  .achievement-stat-grid {grid-template-columns:1fr;}
  .achievement-stat-grid .game-stat {grid-template-columns:1fr auto;align-items:end;}
  .today-result-card {padding:18px 14px;}
}

/* V35 integration: fixed global period header, view navigation, and shared finance layout. */
:root { --fixed-chrome-offset: calc(var(--site-header-height) + var(--section-nav-height)); }
.app-shell { padding-top: var(--fixed-chrome-offset); }
.section-nav {
  position: fixed;
  z-index: 49;
  top: var(--site-header-height);
  left: 50%;
  width: min(1440px, 100%);
  margin: 0;
  padding-inline: max(10px, var(--safe-left)) max(10px, var(--safe-right));
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line-soft);
  border-radius: 0 0 14px 14px;
  transform: translateX(-50%);
}
.section-nav a[aria-current="page"] { color: var(--gold-bright); background: var(--gold-soft); }
.app-view[hidden] { display: none !important; }
.app-view { display: grid; gap: 20px; min-width: 0; }
#monthView #todayInputSection { order: 1; }
#monthView #monthlyOverview { order: 2; }
#monthView #monthlyCalendarPanel { order: 3; }
#monthView #snapshotPanel { order: 4; }
#monthView #fieldLogPanel { order: 5; }
#monthView #monthlyFinancePanel { order: 6; }
.monthly-calendar-panel { min-width: 0; overflow: hidden; }
.monthly-calendar-panel .compact-heading { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: flex-start; margin-bottom: 12px; }
.monthly-calendar-panel .section-kicker { flex: 0 0 auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.calendar-weekdays, .monthly-calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; min-width: 0; }
.calendar-weekdays { margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 800; text-align: center; }
.calendar-weekdays span:first-child { color: #cf8a78; }
.calendar-weekdays span:last-child { color: #829cc2; }
.calendar-day { position: relative; display: grid; grid-template-rows: auto 1fr; align-content: stretch; justify-items: start; min-width: 0; min-height: 52px; overflow: hidden; padding: 5px 6px; border: 1px solid var(--line-soft); border-radius: 9px; color: var(--cream); background: rgba(0,0,0,.2); font: inherit; text-align: left; }
button.calendar-day { cursor: pointer; touch-action: manipulation; }
button.calendar-day:active { border-color: var(--gold); background: var(--gold-soft); }
.calendar-day.is-empty { border-color: transparent; background: transparent; }
.calendar-day.is-today { border-color: var(--gold); box-shadow: inset 0 0 0 1px rgba(212,175,55,.25); }
.calendar-day.is-day-off { background: rgba(255,255,255,.035); }
.calendar-date { font-size: 11px; font-weight: 800; line-height: 1; }
.calendar-count { align-self: end; justify-self: end; max-width: 100%; color: var(--gold-bright); font-size: clamp(11px, 3.4vw, 15px); font-weight: 900; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.calendar-day-off { align-self: end; justify-self: end; color: var(--muted-strong); font-size: 13px; font-weight: 900; line-height: 1; }
.calendar-today-label { position: absolute; top: 19px; left: 6px; color: var(--gold); font-size: 7px; font-weight: 900; letter-spacing: .04em; line-height: 1; }
.day-off-overlay { z-index: 80; }
.day-off-card { width: min(380px,100%); padding: 24px; border: 1px solid rgba(240,185,73,.48); border-radius: 18px; background: linear-gradient(150deg,#211b10,#0d0d0d 62%); box-shadow: 0 28px 90px rgba(0,0,0,.68); }
.day-off-card h2 { margin-top: 4px; color: var(--cream); font-size: 26px; }
.day-off-card > p:not(.eyebrow) { margin-top: 12px; color: var(--muted-strong); font-size: 15px; line-height: 1.7; }
.global-period-switcher > span { display: grid; min-width: 92px; text-align: center; line-height: 1.15; }
.global-period-switcher small { color: var(--gold); font-size: 9px; letter-spacing: .14em; }
.global-period-switcher strong { color: var(--cream); font-size: clamp(16px, 3.8vw, 22px); }
.auxiliary-entry-panel { margin-top: 16px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(0,0,0,.22); }
.auxiliary-entry-panel > summary { display: flex; justify-content: space-between; gap: 12px; padding: 15px; cursor: pointer; list-style: none; }
.auxiliary-entry-panel > summary > span { display: grid; min-width: 0; }
.auxiliary-entry-panel > summary small, #auxiliarySummary { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.auxiliary-entry-panel .line-editor-grid { padding: 0 14px 14px; }
.finance-body, .system-panel-body { display: grid; gap: 12px; padding-top: 18px; }
.finance-primary { display: grid; gap: 3px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--gold-soft); }
.finance-primary strong { color: var(--gold-bright); font-size: clamp(28px, 7vw, 42px); font-variant-numeric: tabular-nums; }
.finance-primary small { color: var(--muted); }
.finance-category, .finance-detail { border: 1px solid var(--line-soft); border-radius: 11px; background: rgba(0,0,0,.2); }
.finance-category > summary, .finance-detail > summary { display: flex; justify-content: space-between; gap: 12px; padding: 14px; cursor: pointer; }
.finance-category-body { padding: 0 14px 14px; }
.money-list { display: grid; gap: 0; margin: 0; }
.money-list > div { display: grid; grid-template-columns: minmax(0,1fr) minmax(9.5ch,auto); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.money-list dt { min-width: 0; overflow-wrap: anywhere; color: var(--muted-strong); }
.money-list dd { margin: 0; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.money-list .is-total { color: var(--gold-bright); font-weight: 800; }
.annual-panel .kpi-card { height: 100%; }
.annual-panel > .annual-note { padding-top: 2px; border-top: 1px solid var(--line-soft); }
.annual-month-list { display: grid; gap: 8px; padding-top: 14px; }
.annual-month-row { display: grid; gap: 8px; padding: 11px 12px; border: 1px solid var(--line-soft); border-radius: 10px; background: rgba(0,0,0,.16); }
.annual-month-button { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; width: 100%; min-width: 0; color: var(--cream); background: transparent; border: 0; padding: 0; font: inherit; text-align: left; cursor: pointer; }
.annual-month-button span { color: var(--gold-bright); font-weight: 900; }
.annual-month-button strong { margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.annual-month-metrics { display: grid; gap: 0; margin: 0; }
.annual-month-metrics > div { display: grid; grid-template-columns: minmax(0,1fr) minmax(10ch,auto); gap: 10px; padding: 6px 0; border-top: 1px solid var(--line-soft); }
.annual-month-metrics dt { min-width: 0; color: var(--muted-strong); }
.annual-month-metrics dd { margin: 0; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.annual-month-metrics .is-total { color: var(--gold-bright); font-weight: 800; }
.annual-month-empty { margin: 0; color: var(--muted); font-size: 12px; }
.system-group-heading { margin-top: 8px; padding: 10px 4px 0; }
.guide-system-body { display: grid; gap: 14px; padding-top: 18px; }
.guide-system-actions, .guide-item-grid { display: grid; gap: 8px; }
.guide-item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.guide-item-grid .button { min-height: 42px; text-align: left; }
.guide-overlay { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.guide-overlay[hidden] { display: none; }
.guide-backdrop { position: absolute; inset: 0; z-index: 70; background: rgba(0,0,0,.18); pointer-events: none; transition: background .18s ease; }
.guide-overlay.is-tour .guide-backdrop { background: transparent; }
.guide-spotlight { position: fixed; z-index: 71; display: none; border: 2px solid var(--gold-bright); border-radius: 12px; background: transparent; box-shadow: 0 0 0 9999px rgba(0,0,0,.32), 0 0 20px rgba(240,185,73,.4); pointer-events: none; transition: top .14s ease, left .14s ease, width .14s ease, height .14s ease; }
.guide-card { position: fixed; z-index: 72; left: 50%; bottom: calc(var(--global-footer-reserve, 76px) + 14px); width: min(420px, calc(100vw - 24px)); max-height: min(54vh, 460px); overflow: auto; transform: translateX(-50%); padding: 15px 16px; border: 1px solid rgba(240,185,73,.52); border-radius: 18px; background: linear-gradient(150deg, rgba(35,29,15,.98), rgba(10,10,10,.98) 65%); box-shadow: 0 18px 60px rgba(0,0,0,.66); pointer-events: auto; }
.guide-overlay.is-event .guide-card { bottom: max(calc(var(--global-footer-reserve, 76px) + 16px), calc(env(safe-area-inset-bottom, 0px) + 88px)); }
.guide-overlay.is-tour .guide-card { left: 8px; top: var(--guide-card-top, auto); bottom: auto; width: min(360px, calc(100vw - 16px)); max-height: var(--guide-card-max-height, 248px); transform: none; padding: 10px 11px; border-radius: 14px; box-shadow: 0 10px 34px rgba(0,0,0,.58); }
.guide-characters { display: flex; align-items: end; gap: 5px; height: 42px; margin-bottom: 4px; }
.guide-overlay.is-tour .guide-characters { position: absolute; right: 10px; top: 8px; height: 30px; opacity: .94; }
.guide-characters img { width: 36px; height: 36px; object-fit: contain; }
.guide-characters img + img { width: 32px; height: 32px; }
.guide-overlay.is-tour .guide-characters img { width: 27px; height: 27px; }
.guide-overlay.is-tour .guide-characters img + img { width: 24px; height: 24px; }
.guide-card h2 { margin: 3px 0 8px; color: var(--cream); font-size: clamp(20px, 5.4vw, 28px); }
.guide-overlay.is-tour .guide-card h2 { max-width: calc(100% - 62px); margin-block: 2px 5px; font-size: 17px; }
.guide-card > p:not(.eyebrow):not(.guide-instruction):not(.guide-progress) { margin: 0; color: var(--muted-strong); line-height: 1.65; }
.guide-overlay.is-tour .guide-card > p:not(.eyebrow):not(.guide-instruction):not(.guide-progress) { font-size: 12px; line-height: 1.45; }
.guide-instruction { margin: 10px 0 0; color: var(--gold-bright); font-weight: 800; line-height: 1.5; }
.guide-overlay.is-tour .guide-instruction { margin-top: 6px; font-size: 11px; line-height: 1.35; }
.guide-progress { margin: 8px 0 0; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.guide-overlay.is-tour .guide-progress { margin-top: 5px; font-size: 10px; }
.guide-actions { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; margin-top: 13px; }
.guide-overlay.is-tour .guide-actions { gap: 5px; margin-top: 8px; }
.guide-actions .button { min-height: 38px; }
.guide-overlay.is-tour .guide-actions .button { min-height: 34px; padding: 7px 9px; font-size: 11px; }
.guide-choice { display: grid; gap: 8px; margin-top: 13px; }
.guide-card.game-welcome { border-color: rgba(240,185,73,.9); box-shadow: 0 0 0 1px rgba(240,185,73,.22), 0 18px 90px rgba(190,130,20,.35); }
.guide-card.game-welcome h2 { color: var(--gold-bright); }
.guide-terminal { position: relative; min-height: 190px; margin-top: 10px; padding: 14px 12px 42px; border: 1px solid rgba(240,185,73,.32); border-radius: 10px; background: #050505; overflow: hidden; }
.guide-terminal pre { margin: 0; color: var(--gold-bright); font: 700 12px/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.guide-terminal-cursor { display: inline-block; width: 7px; height: 14px; margin-left: 2px; background: var(--gold-bright); animation: guide-cursor 1s steps(1,end) infinite; }
.guide-terminal #guideSkip { position: absolute; right: 9px; bottom: 8px; min-height: 32px; }
@keyframes guide-cursor { 50% { opacity: .18; } }
@media (prefers-reduced-motion: reduce) { .guide-terminal-cursor { animation: none; } .guide-spotlight { transition: none; } }
@media (max-width: 390px) {
  .guide-card { width: calc(100vw - 16px); border-radius: 15px; padding-inline: 13px; }
  .guide-overlay.is-tour .guide-card { width: calc(100vw - 12px); left: 6px; }
  .guide-terminal { min-height: 172px; padding-inline: 10px; }
  .guide-terminal pre { font-size: 11px; }
  .guide-item-grid { grid-template-columns: 1fr; }
  .guide-actions { justify-content: stretch; }
  .guide-actions .button { flex: 1 1 auto; }
}

@media (max-width: 390px) {
  .topbar { display: flex; grid-template-columns: none; padding-inline: 10px; }
  .brand { flex: 0 1 112px; width: auto; max-width: 35vw; }
  .brand-logo { width: 112px; }
  .topbar-actions { width: auto; flex: 1 1 auto; justify-content: flex-end; min-width: 0; }
  .global-period-switcher { gap: 3px; min-width: 0; }
  .global-period-switcher > span { min-width: 76px; }
  .global-period-switcher strong { font-size: 16px; }
  .global-period-switcher .icon-button { width: 32px; height: 32px; flex: 0 0 32px; }
  .section-nav { width: 100%; padding-inline: max(3px, var(--safe-left)) max(3px, var(--safe-right)); }
  main { width: calc(100% - 20px); }
  .panel { padding: 18px 14px; }
  .tax-breakdown-block { padding: 10px; }
  .tax-breakdown-block .money-list > div { grid-template-columns: minmax(0,1fr) 10.5ch; gap: 6px; }
  .calendar-weekdays, .monthly-calendar-grid { gap: 3px; }
  .monthly-calendar-panel .compact-heading { gap: 8px; }
  .monthly-calendar-panel .section-kicker { font-size: 11px; }
  .calendar-day { min-height: 48px; padding: 5px 4px; border-radius: 8px; }
  .calendar-count { font-size: 11px; }
}
/* Isolated development additions: preserve established DELIPIT layout. */
.dev-banner{background:#e5b94f;color:#161309;padding:9px 12px;text-align:center;font-size:11px;font-weight:800;overflow-wrap:anywhere}.multi-company,.multi-job,.multi-reward{border:1px solid #ffffff26;border-radius:12px;padding:12px;margin:12px 0;min-width:0}.multi-actions{display:flex;flex-wrap:wrap;gap:8px;margin:8px 0}.multi-actions button,.multi-job button{min-height:44px}.multi-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.multi-day-total{color:var(--gold,#e5b94f);font-size:13px;overflow-wrap:anywhere}.multi-day-choices{display:flex;flex-direction:column;gap:10px}.multi-day-choices[hidden]{display:none}.multi-package-add{margin:16px 0}.multi-company small{display:block;overflow-wrap:anywhere}#contractorManagement select,#contractorManagement input,#contractorSwitcher,#rewardInputPanel input,#newPackageName,#aggregateContractor{width:100%;max-width:100%;min-width:0;box-sizing:border-box}#contractorAggregation p{overflow-wrap:anywhere}.category-settings fieldset{min-width:0}#selectedContractorLabel:empty{display:none}#contractorManagement h2{font-size:18px}@media(max-width:360px){.multi-grid{grid-template-columns:minmax(0,1fr)}.multi-company,.multi-job,.multi-reward{padding:10px}.category-inputs{grid-template-columns:repeat(2,minmax(0,1fr))}}
#legacySettingsUI[hidden],#multiSettingsUI[hidden]{display:none}
.multi-common-goal,.multi-add-contractor{margin:18px 0}
.multi-settings-panel{border:1px solid var(--line);border-radius:12px;margin:14px 0;background:rgba(0,0,0,.16);min-width:0}
.multi-settings-panel>summary{padding:14px;cursor:pointer;min-height:52px;align-items:center;list-style:none}
.multi-settings-panel>summary::-webkit-details-marker{display:none}
.multi-settings-panel>summary strong{display:block;color:var(--gold-bright);font-size:17px;overflow-wrap:anywhere}
.multi-settings-panel>summary small{display:block;color:var(--muted-strong);font-size:12px;margin-top:3px}
.multi-settings-body{padding:0 14px 16px;min-width:0}
.multi-settings-body .field,.multi-settings-body input,.multi-settings-body select,#multiSettingsUI input,#multiSettingsUI select{min-width:0;max-width:100%;box-sizing:border-box}
.multi-settings-body .category-settings{grid-template-columns:1fr;margin:12px 0}
.multi-settings-body .category-settings fieldset{padding:12px}
.multi-settings-body .full-width{margin-top:12px}
.multi-settings-panel[data-dirty="true"]>summary strong::after{content:" • 未保存";font-size:11px}
@media(max-width:360px){.multi-settings-body{padding:0 10px 14px}.multi-settings-panel>summary{padding:12px}}
/* The scrollbar may reduce a 320px desktop QA frame to 305px of content. */
html{min-width:0}#monthView #contractorAggregation{order:5}#monthView #calendarDayChoices{order:5}#yearContractorBreakdown{order:5}.brand{position:relative}.dev-tag{position:absolute;left:2px;bottom:-5px;padding:0 4px;border-radius:3px;background:#e5b94f;color:#111;font-size:8px;font-weight:900;letter-spacing:.12em}.multi-day-choices .button{white-space:normal;overflow-wrap:anywhere}#yearContractorRows dd{overflow-wrap:anywhere}
