:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Yu Gothic", Meiryo, sans-serif;
  color: #20201f;
  background: #f3f3f5;
  font-size: 14px;
  --accent: #ff6b00;
  --ink: #242422;
  --line: #e5e5e8;
  --muted: #757575;
  --radius: 18px;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button, input, select, a { transition: background-color .15s, border-color .15s, box-shadow .15s; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:disabled { opacity: .5; cursor: wait; }
svg { flex-shrink: 0; }
.wrap { max-width: 1440px; padding: 18px 40px 110px; margin: auto; }
.app-header { display: flex; align-items: center; gap: 24px; margin-bottom: 16px; min-height: 48px; }
.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; white-space: nowrap; font-size: 20px; font-weight: 750; letter-spacing: -.7px; }
.logo { display: grid; place-items: center; width: 44px; height: 44px; background: var(--accent); color: white; border-radius: 50%; }
.logo svg { width: 23px; height: 23px; }
h1, h2, p { margin: 0; }
h1 { font-size: 34px; line-height: 1.35; letter-spacing: -1.4px; font-weight: 750; }
h2 { font-size: 18px; line-height: 1.5; font-weight: 700; letter-spacing: -.45px; }
.muted, .tip { color: var(--muted); font-size: 12px; line-height: 1.7; }
.spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 15px; min-height: 40px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn svg { width: 17px; height: 17px; }
.btn:hover { background: #f5f5f5; border-color: #c8c8cd; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: #e95f00; border-color: #e95f00; }
.btn.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.dark:hover { background: #41413e; }
.tabs { display: flex; align-items: center; gap: 4px; }
.tabs .btn { border: 0; background: transparent; border-radius: 24px; padding: 11px 18px; font-size: 14px; }
.tabs .btn:hover { background: #e7e7ea; }
.tabs .primary, .tabs .primary:hover { background: var(--ink); color: #fff; }
.header-actions { display: flex; align-items: center; gap: 8px; padding-left: 18px; border-left: 1px solid #d7d7db; }
.header-actions .btn { border: 0; border-radius: 24px; }
.icon-button { width: 38px; padding: 10px; }
.overview-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.overview-heading p { color: #737373; font-size: 13px; margin-top: 5px; }
.overview-meta { display: flex; align-items: flex-end; flex-direction: column; gap: 9px; }
.period { padding: 11px 17px; background: #fff; border-radius: 24px; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.status { font-size: 11px; color: var(--muted); }
.metrics { display: grid; grid-template-columns: 1.08fr 1fr 1.08fr; grid-template-rows: auto auto; gap: 12px 16px; margin-bottom: 18px; }
.metric { background: #fff; border-radius: var(--radius); padding: 17px 23px; min-width: 0; }
.metric .label { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 650; line-height: 1.5; }
.label > svg { width: 21px; height: 21px; }
.metric-icon { display: grid; place-items: center; width: 34px; height: 34px; background: #f7f7f8; border-radius: 50%; }
.metric-icon svg { width: 23px; height: 23px; }
.value { font-variant-numeric: tabular-nums; font-size: 28px; line-height: 1.25; font-weight: 650; letter-spacing: -.9px; margin: 8px 0 2px; white-space: nowrap; }
.metric-cash { grid-column: 1; grid-row: 1 / 3; display: flex; flex-direction: column; justify-content: space-between; padding: 23px 26px 26px; }
.metric-cash .value { font-size: clamp(36px,3.75vw,58px); letter-spacing: -1.8px; margin: 20px 0 12px; }
.metric-minimum { grid-column: 2; grid-row: 1; }
.metric-slow { grid-column: 2; grid-row: 2; }
.metric-minimum, .metric-slow { padding-top: 9px; padding-bottom: 9px; }
.metric-minimum .muted, .metric-slow .muted { font-size: 10px; }
.metric-room { grid-column: 3; grid-row: 1 / 3; padding: 23px 25px; background: #242422; color: white; display: flex; flex-direction: column; justify-content: center; }
.metric-room .value { font-size: clamp(32px,3vw,48px); letter-spacing: -1.5px; margin: 16px 0 8px; }
.metric-room .negative { color: #fff !important; }
.metric-room .muted { color: #cececa; font-size: 10px; }
.reserve-target { color: #f0f0ee; font-size: 13px; font-variant-numeric: tabular-nums; }
.reserve-rule { height: 4px; border-radius: 4px; background: var(--accent); margin: 17px 0 9px; }
.negative { color: #c84c35 !important; }
.card { min-width: 0; background: #fff; border-radius: var(--radius); padding: 22px 24px; margin-bottom: 16px; }
.section-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.section-head > h2, .section-title { flex: 1; }
.section-title .muted { margin-top: 3px; }
.chart-card { padding: 20px 24px 14px; }
.chart-card .section-head { margin-bottom: 7px; }
.chart { position: relative; min-width: 0; }
.chart svg { display: block; width: 100%; height: 200px; }
.chart text { font-size: 10px; font-family: inherit; fill: #858585; }
.bar { fill: #ff8233; cursor: crosshair; }
.bar:hover, .bar:focus { fill: #ed5e00; stroke: #c74f00; stroke-width: 1; outline: none; }
.chart-tooltip { position: absolute; pointer-events: none; background: #242422; color: #fff; padding: 9px 13px; border-radius: 9px; font-size: 12px; font-variant-numeric: tabular-nums; white-space: pre-line; line-height: 1.7; box-shadow: 0 5px 20px #0002; z-index: 3; }
.chart-tooltip[hidden] { display: none; }
.legend { display: flex; gap: 19px; color: #6e6e6e; font-size: 11px; }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.legend .reserve { width: 24px; height: 0; border-radius: 0; border-top: 2px dashed #929292; background: none; }
.tip { padding-top: 11px; font-size: 11px; }
.chart-card .tip { font-size: 10px; padding: 0 0 0 52px; }
.banner { padding: 8px 16px; background: #fff0e3; color: #985116; border: 1px solid #ffe0c5; border-radius: 11px; font-size: 11px; line-height: 1.7; margin-bottom: 16px; }
#warnings { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; }
.account-head { flex-wrap: nowrap; gap: 20px; }
.extra-bank { display: grid; grid-template-columns: minmax(140px,1.4fr) minmax(120px,.8fr) auto; gap: 9px; max-width: 740px; flex: 1.8; align-items: start; }
.extra-bank input, .extra-bank select { width: 100%; min-width: 0; border: 1px solid #dcdce0; border-radius: 8px; height: 40px; padding: 8px 11px; background: white; font-size: 12px; color: var(--ink); }
.sheet { border: 1px solid #e0e0e5; border-radius: 9px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: #c9c9cc transparent; }
table { width: 100%; border-collapse: separate; border-spacing: 0; white-space: nowrap; }
th { background: #f0f0f2; color: #616161; height: 38px; padding: 0 13px; font-size: 12px; font-weight: 600; text-align: left; border-bottom: 1px solid #dcdce1; border-right: 1px solid #e0e0e5; }
td { height: 44px; padding: 0 13px; border-bottom: 1px solid #e7e7eb; border-right: 1px solid #e7e7eb; font-size: 14px; }
tr:last-child td { border-bottom: 0; }
th:last-child, td:last-child { border-right: 0; }
#accounts td:first-child { font-weight: 550; min-width: 154px; }
#accounts td:nth-child(3) { min-width: 162px; font-size: 12px; }
#accounts td:nth-child(5) { text-align: center; }
.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.edit { padding: 0; background: #fffefd; }
td.edit input, td.edit select { width: 100%; min-width: 105px; height: 43px; padding: 0 12px; border: 0; border-radius: 0; background: transparent; color: #292928; font-size: 14px; }
td.edit input[type=number] { text-align: right; font-variant-numeric: tabular-nums; appearance: textfield; -moz-appearance: textfield; }
input::-webkit-inner-spin-button { appearance: none; }
td.edit input:hover, td.edit select:hover { background: #fff5eb; }
td.edit input:focus, td.edit select:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: #fff5eb; }
.date-cell { min-width: 170px; }
.date-cell input { height: 30px !important; }
.adjusted { display: block; padding: 1px 12px 7px; color: #9b633a; font-size: 10px; font-variant-numeric: tabular-nums; }
.check { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; vertical-align: middle; }
.smallbtn, .bank-delete { display: inline-grid; place-items: center; border: 0; background: transparent; color: #959595; min-width: 28px; min-height: 30px; border-radius: 5px; font-size: 18px; cursor: pointer; }
.smallbtn:hover, .bank-delete:hover { color: #b83e34; background: #fff0ed; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 28px 0 18px; font-size: 12px; color: #686868; }
.toolbar select, .log-tools select { border: 1px solid #dedee3; border-radius: 9px; padding: 9px 12px; background: white; font-size: 12px; color: var(--ink); font-weight: 550; }
.toolbar .btn { margin-left: auto; }
.caption { font-size: 11px; color: var(--muted); line-height: 1.8; margin-bottom: 16px; }
#recentEvents th, #recentEvents td { padding: 10px 13px; }
#recentEvents a { margin-left: 5px; color: #b64f0d; text-underline-offset: 3px; }
.savebar { position: sticky; bottom: 14px; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 14px 21px; background: #fffffff5; backdrop-filter: blur(12px); border: 1px solid #e5e5e8; border-radius: 15px; box-shadow: 0 6px 28px #26262612; margin-top: 24px; }
.savebar strong { font-size: 12px; font-weight: 650; }
.savebar .muted { font-size: 10px; margin-top: 2px; }
.savebar #save { min-width: 128px; }
.toast { position: fixed; bottom: 88px; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 32px); background: #242422; color: white; padding: 12px 22px; border-radius: 10px; box-shadow: 0 6px 24px #0002; z-index: 50; font-size: 12px; line-height: 1.7; }
.error { padding: 14px 17px; color: #b6382b; background: #fff0ed; border: 1px solid #f3cbc3; border-radius: 10px; white-space: pre-wrap; font-size: 12px; margin-bottom: 18px; }
.field-error { display: block; color: #bb382b; font-size: 11px; padding: 4px 8px; white-space: normal; min-width: 95px; }
[aria-invalid="true"] { outline: 2px solid #d04738 !important; outline-offset: -2px !important; background: #fff0ed !important; color: #b6382b !important; }
.edit:has([aria-invalid="true"]) { background: #fff0ed; }
.login { width: min(430px,90vw); border: 1px solid var(--line); border-radius: 20px; padding: 30px; box-shadow: 0 25px 90px #0002; }
.login::backdrop { background: #25252566; backdrop-filter: blur(5px); }
.login h2 { font-size: 21px; }
.login input { display: block; width: 100%; height: 44px; padding: 11px 12px; border: 1px solid #dcdce0; border-radius: 9px; margin: 18px 0 14px; }
.login .btn { width: 100%; }
.settings-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 18px; margin: 22px 0; }
.settings-grid > div { border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.settings-grid label { display: block; color: #626262; font-size: 12px; margin-bottom: 15px; }
.settings-grid label:last-child { margin-bottom: 0; }
.settings-grid input, .settings-grid select, .reserve-input { display: block; width: 100%; padding: 10px; border: 1px solid #dedee2; border-radius: 8px; background: white; margin-top: 8px; font-size: 13px; }
.reserve-input { width: 180px; font-variant-numeric: tabular-nums; }
.settings-help { margin: 14px 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.log-tools { display: flex; gap: 10px; margin-bottom: 18px; }
.logs { white-space: normal; }
.logs td { height: auto; padding: 14px; vertical-align: top; line-height: 1.7; }
.logs td:first-child { white-space: nowrap; }
.logs details { margin-top: 5px; color: var(--muted); font-size: 11px; }
.logs summary { cursor: pointer; }
.logs pre { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 720px; font-size: 11px; line-height: 1.6; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.hidden { display: none !important; }
@media (min-width:1600px) { .wrap { max-width: 1480px; padding-top: 34px; } }
@media (max-width:1190px) {
  .wrap { padding: 24px 28px 100px; }
  .app-header { gap: 14px; }
  .brand { font-size: 17px; gap: 9px; }
  .tabs .btn { padding: 10px 12px; font-size: 12px; }
  .header-actions { padding-left: 12px; }
  .metric { padding: 17px; }
  .metric-cash .value { font-size: 38px; }
  .metric-room .value { font-size: 33px; }
  .metric .label { font-size: 12px; }
  .value { font-size: 26px; }
  .account-head { flex-wrap: wrap; }
  .account-head .section-title { min-width: 200px; }
  .extra-bank { flex-basis: 100%; max-width: none; }
}
@media (max-width:900px) {
  .app-header { flex-wrap: wrap; gap: 17px; margin-bottom: 25px; }
  .tabs { order: 3; flex-basis: 100%; }
  .header-actions { margin-left: auto; }
  .overview-heading { align-items: flex-start; }
  h1 { font-size: 29px; }
  .metrics { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; gap: 13px; }
  .metric-cash { grid-column: 1; grid-row: 1; }
  .metric-room { grid-column: 2; grid-row: 1; }
  .metric-minimum { grid-column: 1; grid-row: 2; }
  .metric-slow { grid-column: 2; grid-row: 2; }
  .metric-cash .value { font-size: 38px; }
  .metric-room .value { font-size: 33px; }
  .settings-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width:540px) {
  .wrap { padding: 18px 15px 100px; }
  .app-header { gap: 16px 10px; margin-bottom: 22px; }
  .brand { font-size: 16px; letter-spacing: -.5px; gap: 8px; }
  .logo { width: 34px; height: 34px; }
  .logo svg { width: 18px; height: 18px; }
  .header-actions { border: 0; padding: 0; gap: 4px; }
  .header-actions #logout { padding: 8px; font-size: 0; width: 32px; min-height: 32px; }
  .header-actions #logout svg { width: 16px; height: 16px; }
  .icon-button { width: 32px; min-height: 32px; padding: 8px; }
  .tabs { justify-content: space-between; gap: 0; }
  .tabs .btn { padding: 10px 14px; font-size: 12px; }
  .overview-heading { flex-direction: column; gap: 13px; margin-bottom: 17px; }
  h1 { font-size: 28px; }
  .overview-heading p { font-size: 11px; }
  .overview-meta { width: 100%; flex-direction: row; justify-content: space-between; align-items: center; gap: 8px; }
  .period { padding: 8px 11px; font-size: 10px; }
  .status { font-size: 10px; }
  .metrics { gap: 10px; }
  .metric { border-radius: 13px; padding: 14px; }
  .metric-cash { grid-column: 1 / -1; grid-row: 1; }
  .metric-room { grid-column: 1 / -1; grid-row: 2; }
  .metric-minimum { grid-column: 1; grid-row: 3; }
  .metric-slow { grid-column: 2; grid-row: 3; }
  .metric-cash .value { font-size: 39px; margin: 12px 0 5px; }
  .metric-room .value { font-size: 36px; margin: 10px 0 5px; }
  .metric-room .muted, .metric .muted { font-size: 10px; }
  .metric .label { font-size: 11px; gap: 7px; }
  .metric-icon { width: 28px; height: 28px; }
  .metric-icon svg { width: 19px; height: 19px; }
  .label > svg { width: 17px; height: 17px; }
  .metric-minimum .label, .metric-slow .label { align-items: flex-start; min-height: 34px; }
  .value { font-size: 23px; letter-spacing: -.8px; }
  .reserve-rule { margin: 12px 0 6px; }
  .reserve-target { font-size: 12px; }
  .card { padding: 18px 14px; border-radius: 14px; margin-bottom: 16px; }
  .section-head { gap: 9px; margin-bottom: 13px; }
  h2 { font-size: 16px; }
  .chart-card { padding: 17px 12px 12px; }
  .chart-card .section-head { gap: 10px; }
  .chart-card .section-head h2 { flex-basis: 100%; }
  .chart svg { height: 215px; }
  .chart-card .tip { padding: 0; font-size: 9px; }
  .legend { font-size: 10px; gap: 16px; }
  #warnings { grid-template-columns: 1fr; padding: 11px 13px; }
  .extra-bank { grid-template-columns: 1fr auto; gap: 8px; }
  .extra-bank input { grid-column: 1 / -1; }
  .extra-bank .btn { padding: 9px 11px; font-size: 11px; }
  .section-head .btn { font-size: 11px; padding: 8px 10px; }
  .section-head > h2 { flex-basis: 100%; }
  .toolbar { gap: 9px; margin: 24px 0 16px; }
  .toolbar .btn { margin-left: 0; flex-basis: 100%; justify-content: flex-start; }
  .savebar { position: sticky; bottom: 10px; padding: 12px; gap: 8px; border-radius: 12px; }
  .savebar .spacer, #savedAt { display: none; }
  .savebar > div:first-child { flex: 1; }
  .savebar strong { font-size: 11px; }
  .savebar .muted { font-size: 9px; max-width: 185px; }
  .savebar #save { min-width: 72px; padding: 10px 14px; }
  .toast { bottom: 90px; font-size: 11px; }
  .settings-grid { grid-template-columns: 1fr; }
  .log-tools select { min-width: 0; flex: 1; font-size: 11px; padding: 9px; }
  .logs td { padding: 10px; font-size: 11px; }
  .logs td:first-child { white-space: normal; min-width: 90px; }
}
@media (prefers-reduced-motion:reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }

/* Sales assumptions stay separate from account snapshots and scheduled receipts. */
.scenario-toolbar { display: grid; grid-template-columns: minmax(240px,1.1fr) minmax(220px,1fr) auto; align-items: start; gap: 16px; padding: 14px 0 17px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.scenario-preset { display: flex; flex-direction: column; gap: 7px; color: #666; font-size: 11px; }
.scenario-preset select { width: 100%; min-width: 0; border: 1px solid #d9dce4; border-radius: 9px; padding: 10px 12px; background: #fff; color: var(--ink); font-size: 13px; font-weight: 600; }
.scenario-caption { padding-top: 24px; color: #717171; font-size: 10px; line-height: 1.7; }
.scenario-caption strong { font-size: 12px; color: #3d4658; font-weight: 600; }
.scenario-assumptions { padding-top: 25px; font-size: 11px; color: #526079; }
.scenario-assumptions summary { cursor: pointer; padding: 5px 0; }
.scenario-assumptions > div { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; max-width: 300px; }
.scenario-assumptions label { display: block; font-size: 10px; line-height: 1.7; }
.scenario-assumptions input { display: block; width: 100%; min-width: 0; margin-top: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; }
.scenario-assumptions p { font-size: 10px; color: var(--muted); margin-top: 8px; line-height: 1.6; }
.legend { flex-wrap: wrap; gap: 10px 17px; }
.legend .scenario { background: #577fda; }
.chart svg { height: 240px; }
.bar .bar-part.booked { fill: #ff8233; }
.bar .bar-part.scenario { fill: #577fda; }
.bar:hover .bar-part.booked, .bar:focus .bar-part.booked { fill: #ed6a15; stroke: #c74f00; }
.bar:hover .bar-part.scenario, .bar:focus .bar-part.scenario { fill: #3b64be; stroke: #264b99; }
.chart-tooltip { max-width: min(340px,100%); overflow-wrap: anywhere; }
.chart-card .scenario-scope { padding-top: 4px; }
.calculation-details { margin-bottom: 20px; }
.calculation-details > summary { cursor: pointer; color: var(--muted); font-size: 12px; padding: 5px 0; }
.calculation-details .banner { margin-top: 10px; margin-bottom: 0; }
@media (max-width:900px) {
  .scenario-toolbar { grid-template-columns: minmax(230px,1fr) minmax(200px,1fr); gap: 10px 16px; }
  .scenario-assumptions { grid-column: 1 / -1; padding-top: 0; }
}
@media (max-width:540px) {
  .scenario-toolbar { grid-template-columns: minmax(0,1fr); gap: 8px; padding: 12px 0; }
  .scenario-preset select { font-size: 12px; padding: 10px; }
  .scenario-caption { padding-top: 0; }
  .scenario-assumptions { padding-top: 0; }
  .scenario-assumptions > div { max-width: none; }
  .chart svg { height: 225px; }
  .chart-card .scenario-scope { padding-top: 5px; }
  .legend { font-size: 9px; gap: 8px 12px; }
}
