:root {
  color-scheme: light;
  --paper: #edeadf;
  --panel: #fffdf6;
  --ink: #263831;
  --muted: #526158;
  --line: #d6d9ca;
  --green: #365b49;
  --pale: #e9eee2;
  --clay: #9b4734;
  --gold: #f4e5c7;
  font: 16px/1.5 system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); }
h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2 { font-family: Georgia, serif; line-height: 1.05; }
h2 { font-size: clamp(1.5rem, 2.5vw, 2rem); }
h3 { font-size: .93rem; }
button, select, input { font: inherit; color: inherit; }
button, select, input[type=number] { border: 1px solid #b4bfae; border-radius: 7px; background: var(--panel); }
button { min-height: 44px; min-width: 44px; padding: .45rem .8rem; font-size: .87rem; font-weight: 700; }
button:enabled, select:enabled, summary { cursor: pointer; }
button:enabled:hover { background: var(--pale); }
button:disabled { opacity: .62; }
:focus-visible { outline: 3px solid #a04732; outline-offset: 3px; }
.primary { background: var(--green); color: white; border-color: var(--green); padding-inline: 1.15rem; }
.primary:enabled:hover { background: #254637; }
.small { color: var(--muted); font-size: .84rem; }
.eyebrow { color: var(--green); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; margin-bottom: .35rem; }
.shell { max-width: 1180px; width: calc(100% - 3rem); margin-inline: auto; }
.masthead, .brand, .tools { display: flex; align-items: center; }
.masthead { justify-content: space-between; min-height: 65px; border-bottom: 1px solid #cbd0c0; gap: .6rem; }
.brand { gap: .65rem; }
.brand h1 { font-size: clamp(1.18rem, 3vw, 1.56rem); }
.brand-mark { background: var(--green); color: #fff1d6; border-radius: 12px 12px 5px 5px; display: grid; place-items: center; width: 34px; min-width: 34px; height: 34px; font: bold .9rem Georgia, serif; }
.tools { gap: .45rem; }
.tools button { background: transparent; white-space: nowrap; }
.overview { display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding-block: 1.8rem .65rem; }
.shop-identity h2 { font-size: clamp(2.75rem, 6vw, 4rem); letter-spacing: -.06em; }
.shop-identity .eyebrow { color: var(--clay); }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; font-variant-numeric: tabular-nums; }
.metrics div { padding: .55rem 1rem; min-width: 100px; }
.metrics div + div { border-left: 1px solid var(--line); }
.metrics dt { font-size: .76rem; color: var(--muted); white-space: nowrap; }
.metrics dd { font-size: clamp(1rem, 3vw, 1.4rem); font-weight: 750; }
.model-note { color: var(--muted); font-size: .8rem; margin-bottom: 1.1rem; }
.notice { padding: .75rem 1rem; margin-bottom: .9rem; border-radius: 9px; border: 1px solid #c2cfb8; background: var(--pale); font-weight: 650; }
.notice[data-tone=error] { background: #f7e3d5; border-color: #d9b3a1; color: #823b2e; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.panel { padding: 1.1rem; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); min-width: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .85rem; }
.section-meta { color: var(--muted); font-weight: 650; font-size: .83rem; }
.store { padding: 0; overflow: hidden; }
.store-head, .shop-feed { padding: .95rem 1.1rem; }
.store-head { margin-bottom: 0; }
.store-art { background: #c3d9ce; border-block: 1px solid #bac7b2; }
.store-art svg { width: 100%; height: auto; display: block; }
.feed-summary { font-size: .87rem; font-weight: 700; }
.activity, .visits { margin: .35rem 0 0; padding-left: 1.25rem; font-size: .84rem; color: var(--muted); }
.activity:empty { display: none; }
.visits, .ledger-lines { max-height: 16rem; overflow: auto; }
details { margin-top: .65rem; }
summary { padding-block: .65rem; min-height: 44px; font-size: .85rem; font-weight: 750; }
.forecast { background: var(--gold); border-radius: 8px; padding: .55rem .7rem; margin-bottom: .65rem; font-size: .85rem; }
.forecast p { color: #5d533e; }
.classic-trade { margin-bottom: .75rem; }
.classic-trade button { margin-top: .35rem; }
.market-signals { background: var(--pale); border-radius: 8px; padding: .55rem .7rem; margin-bottom: .65rem; }
#customer-standing { font-size: .87rem; font-weight: 750; }
.market-signals details { margin-top: 0; }
.rival-list { margin: .35rem 0 0; padding: 0; list-style: none; font-size: .82rem; }
.rival-list li + li { margin-top: .35rem; padding-top: .35rem; border-top: 1px solid var(--line); }
.rival-list strong { display: block; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.product-table { display: grid; grid-template-columns: minmax(0, 1fr) minmax(60px, 72px) minmax(60px, 72px); gap: .45rem; align-items: center; font-size: .83rem; }
.product-table .column { color: var(--muted); font-weight: 650; }
.product-name { display: block; font-size: .93rem; }
.product-cost { display: block; font-size: .75rem; color: var(--muted); }
.product-table input { width: 100%; padding: .3rem .32rem .3rem .45rem; min-height: 44px; font-size: 1rem; font-variant-numeric: tabular-nums; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; margin-block: .85rem .5rem; }
.options label, .supplier-option { display: grid; gap: .25rem; font-size: .78rem; color: var(--muted); font-weight: 700; min-width: 0; }
.planning select { min-height: 44px; width: 100%; font-size: .87rem; padding-inline: .35rem; color: var(--ink); }
#branch-option, #response-option, .item-suppliers label { margin-bottom: .55rem; }
.item-suppliers { margin-top: .55rem; }
#supplier-note { margin-block: .3rem .55rem; }
.plan-feedback { color: #823b2e; font-size: .85rem; font-weight: 650; margin-top: .55rem; }
.open-row { display: flex; align-items: center; justify-content: space-between; gap: .65rem; border-top: 1px solid var(--line); margin-top: .75rem; padding-top: .75rem; }
.open-row span { font-size: .84rem; color: var(--muted); }
.open-row strong { display: block; color: var(--ink); font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.open-row button { flex-shrink: 0; }
.open-row strong[data-over=true] { color: var(--clay); }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.empty { color: var(--muted); font-size: .9rem; }
.pnl > div, .ledger-row { display: flex; justify-content: space-between; gap: .45rem; padding-block: .23rem; font-size: .83rem; font-variant-numeric: tabular-nums; }
.pnl dt { color: var(--muted); }
.pnl .net { border-top: 1px solid var(--line); margin-top: .25rem; padding-top: .35rem; font-weight: 750; }
.pnl .net dt { color: var(--ink); }
.negative { color: var(--clay); }
.positive { color: var(--green); }
#waste, #delivery-report, #branch-report { margin-top: .4rem; }
.outcome-line { margin-top: .34rem; }
.outcome-line label, .goals label { display: flex; justify-content: space-between; gap: .4rem; font-size: .82rem; }
progress { display: block; width: 100%; height: 8px; margin-block: .22rem .45rem; border: 0; border-radius: 8px; overflow: hidden; appearance: none; background: #e6e9de; accent-color: var(--green); }
progress::-webkit-progress-bar { background: #e6e9de; }
progress::-webkit-progress-value { background: var(--green); }
progress::-moz-progress-bar { background: var(--green); }
.outcome-line:not(:first-child) progress::-webkit-progress-value { background: #a35742; }
.outcome-line:not(:first-child) progress::-moz-progress-bar { background: #a35742; }
.trend-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .3rem; margin-top: .85rem; }
.trend { width: 100%; display: block; margin-block: .25rem .4rem; background: #f2f2e9; border-radius: 7px; }
.ledger { border-top: 1px solid var(--line); }
.ledger-row + .ledger-row { border-top: 1px solid var(--line); }
.goals { padding: .65rem .75rem; border-radius: 8px; background: var(--pale); }
.goals h3 { margin-bottom: .4rem; }
.goals span { font-weight: 700; text-align: right; }
.goals progress { background: #d4ddce; }
.goals progress::-webkit-progress-bar { background: #d4ddce; }
.growth-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem .65rem; margin-top: .75rem; }
.growth-actions button { width: 100%; height: auto; padding-inline: .35rem; }
.growth-actions p { margin-top: .25rem; font-size: .76rem; }
footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .3rem 1rem; padding-block: .85rem 1.5rem; color: var(--muted); font-size: .76rem; }
dialog { width: min(480px, calc(100% - 1.5rem)); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--ink); }
dialog::backdrop { background: #203a32a8; }
.dialog-inner { padding: 1.25rem; }
.dialog-inner > p:not(.eyebrow) { margin-top: .7rem; }
.dialog-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: .45rem; margin-top: 1.15rem; }
.sr-only, .notice:empty, .plan-feedback:empty {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; border: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

@media (max-width: 880px) {
  .shell { width: calc(100% - 1.5rem); }
  .workspace { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: .7rem; }
  .report-grid { grid-template-columns: 1fr; gap: .6rem; }
}

@media (max-width: 690px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .overview { align-items: stretch; flex-direction: column; padding-top: 1.25rem; gap: .65rem; }
  .metrics div { padding: .45rem .65rem; min-width: 0; }
  .metrics dt { white-space: normal; }
  .report-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .65rem; }
  .panel { padding: .85rem; }
  .store { padding: 0; }
  .store-head, .shop-feed { padding: .7rem .85rem; }
  .brand { gap: .4rem; }
  .tools { gap: .25rem; }
  .tools button { padding-inline: .5rem; }
}

@media (max-width: 400px) {
  .report-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; transition: none !important; }
}
