:root {
  color-scheme: light;
  --ink: #202d26;
  --muted: #59655d;
  --green: #27533c;
  --line: #dfe5dd;
  font: 100%/1.45 Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: #f6f8f4;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
[hidden] { display: none !important; }
.symbols, .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.wrap { width: min(1248px, calc(100% - 7vw)); margin-inline: auto; }
.mast { background: #fff; border-bottom: 1px solid var(--line); }
.mast-inner, .intro, .brand, .period, .reset, h2, .icon-tile, #use-cost { display: flex; align-items: center; }
.mast-inner { min-height: 64px; justify-content: space-between; }
.brand { gap: .65rem; font-size: 1.15rem; font-weight: 720; letter-spacing: -.04em; }
.brandmark { width: 32px; height: 32px; position: relative; color: #365e41; }
.brandmark i { position: absolute; width: 32%; height: 94%; left: 34%; top: 3%; background: currentColor; border-radius: 50%; }
.brandmark i:nth-child(2) { transform: rotate(45deg); }
.brandmark i:nth-child(3) { transform: rotate(90deg); }
.brandmark i:nth-child(4) { transform: rotate(135deg); }
.brandmark b { position: absolute; inset: 42%; background: #eff4df; border-radius: 50%; }
.icon { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.period { gap: .5rem; font-size: .875rem; color: var(--muted); }
.period .icon { width: 17px; height: 17px; color: #637367; }
.intro { justify-content: space-between; gap: 1rem; margin: 2rem 0 1.35rem; }
h1, h2, h3, p, dl, dd, ul { margin: 0; }
h1 { font-size: clamp(2rem, 3.25vw, 2.8rem); line-height: 1.13; font-weight: 650; letter-spacing: -.055em; }
.intro p { color: var(--muted); margin-top: .35rem; font-size: 1rem; }
.reset { gap: .5rem; min-height: 42px; padding: .56rem .95rem; border: 1px solid #ccd5ca; border-radius: 9px; background: #fff; color: #37483c; font-size: .875rem; font-weight: 550; }
.reset:hover { background: #edf3ea; border-color: #8fa58f; }
:is(button, input):focus-visible { outline: 2px solid #4b7958; outline-offset: 3px; }
.hero { isolation: isolate; position: relative; display: flex; align-items: center; gap: clamp(1.6rem,4.4vw,4.7rem); overflow: hidden; border-radius: 17px; padding: 2rem 2.25rem; min-height: 160px; color: #f7faf1; background: linear-gradient(108deg,#1d3d31,#264b37 70%,#385741); }
#botanical { position: absolute; z-index: -1; right: 0; top: 0; width: 33%; height: 100%; }
.hero-metric { min-width: 0; }
.metric-label { display: block; font-size: .95rem; font-weight: 500; color: #d8e6d7; margin-bottom: .5rem; }
.hero strong { display: block; font-weight: 550; letter-spacing: -.055em; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.profit { font-size: clamp(2.7rem,4.5vw,3.95rem); }
.profit .unit { font-size: .7em; color: #d4dfcd; }
.hero .secondary { border-left: 1px solid #708875; padding: .25rem 0 .25rem clamp(1.7rem,4vw,4rem); }
.margin { font-size: clamp(2.1rem,3vw,2.7rem); }
.margin .unit { font-size: .7em; }
.workspace { display: grid; grid-template-columns: minmax(0,1.05fr) minmax(0,1fr); gap: 1.25rem; margin: 1.25rem 0 3rem; align-items: start; }
.card { background: #fff; border-radius: 15px; border: 1px solid var(--line); padding: 1.4rem 1.5rem; }
h2 { gap: .65rem; font-size: 1.3rem; font-weight: 640; letter-spacing: -.035em; line-height: 1.22; }
.icon-tile { width: 34px; height: 34px; flex: none; border-radius: 9px; justify-content: center; background: #eef3e9; color: #45644e; }
h3 { font-size: .98rem; line-height: 1.3; font-weight: 640; letter-spacing: -.015em; }
.fields-section { margin-top: 1.12rem; padding-top: 1.05rem; border-top: 1px solid var(--line); }
.fields-section:first-of-type { border: 0; margin-top: 1.3rem; padding: 0; }
.fields-section h3 { margin-bottom: .75rem; }
.field-grid, .writeoff-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .78rem .9rem; align-items: end; }
.field-label { display: block; color: #4b594f; font-size: .875rem; margin-bottom: .32rem; }
.input-box { min-width: 0; display: flex; align-items: center; height: 42px; border: 1px solid #cdd6cc; border-radius: 8px; background: #fbfcfa; transition: border-color .15s, box-shadow .15s; }
.input-box:focus-within { background: white; border-color: #60836a; box-shadow: 0 0 0 3px #64946e20; }
.input-box:has(input[aria-invalid="true"]) { border-color: #a43f30; }
.input-box input { width: 100%; min-width: 0; height: 100%; color: var(--ink); background: transparent; padding: .45rem .65rem; border: 0; outline: 0; font-size: 1rem; line-height: normal; font-variant-numeric: tabular-nums; }
.input-box input:focus-visible { outline: 0; }
.input-unit { padding-right: .7rem; color: #66736a; font-size: .875rem; }
.field-error { display: block; color: #933f34; font-size: .8125rem; margin-top: .25rem; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: #f0f3ed; border: 1px solid #d9e2d5; padding: 3px; border-radius: 8px; height: 42px; }
.segmented label { position: relative; min-width: 0; }
.segmented input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.segmented span { display: grid; place-items: center; height: 100%; border-radius: 5px; font-size: .875rem; color: #576259; white-space: nowrap; }
.segmented input:checked + span { background: #fff; color: #294e34; font-weight: 650; box-shadow: 0 1px 4px #0e2b1c26; }
.segmented input:focus-visible + span { outline: 2px solid #4b7958; }
#purchase-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .9rem; align-items: end; margin-top: .8rem; }
#use-cost { justify-self: start; justify-content: center; gap: .2rem; min-height: 42px; padding: 0; border: 0; background: transparent; color: var(--green); font-size: .875rem; text-align: left; line-height: 1.25; }
#use-cost:hover { text-decoration: underline; }
.results { display: grid; gap: 1.25rem; }
.distribution { margin: 1.25rem 0 1.15rem; padding: .95rem 1.05rem; border-radius: 10px; background: #f4f6f0; }
.distribution h3 { font-size: .875rem; }
.bar { display: flex; height: 11px; overflow: hidden; gap: 2px; border-radius: 4px; margin: .75rem 0 .65rem; }
.bar span { min-width: 0; }
.legend { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,11.8rem),1fr)); gap: .35rem 1rem; }
.legend li { display: flex; align-items: center; gap: .35rem; font-size: .8125rem; color: #485349; }
.dot { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.cost-color { background: #87a584; }
.writeoff-color { background: #b4a2b7; }
.expenses-color { background: #dfa768; }
.profit-color { background: #315a43; }
.ledger { margin-top: 1.15rem; }
.ledger > div { display: flex; justify-content: space-between; align-items: baseline; gap: .85rem; padding: .27rem 0; font-size: .925rem; }
.ledger dt { color: var(--muted); }
.ledger dd, .sales-grid dd, .mobile-result strong { font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.ledger .subtotal { margin: .25rem 0 .32rem; border-block: 1px solid var(--line); padding: .56rem 0; font-weight: 620; }
.ledger .subtotal dt, .ledger .total dt { color: var(--ink); }
.ledger .total { border-top: 1px solid var(--line); margin-top: .35rem; padding-top: .7rem; font-weight: 620; }
.ledger .net { margin-top: .55rem; padding: .72rem .8rem; border-radius: 8px; background: #eaf2e7; font-weight: 650; color: var(--green); }
.ledger .net dt { color: inherit; }
.ledger .net.loss { color: #883c2e; background: #f9efea; }
.sales-grid { display: grid; grid-template-columns: 1fr 1fr 1.28fr; margin-top: 1.2rem; }
.sales-grid > div { min-width: 0; }
.sales-grid > div + div { border-left: 1px solid var(--line); padding-left: .9rem; }
.sales-grid dt { color: var(--muted); font-size: .875rem; }
.sales-grid dd { text-align: left; font-size: clamp(1rem,1.5vw,1.25rem); letter-spacing: -.035em; font-weight: 630; margin-top: .23rem; }
.mobile-result { display: none; }
@media (max-width: 1000px) and (min-width: 761px) {
  .wrap { width: calc(100% - 2.5rem); }
  .workspace { gap: .9rem; }
  .card { padding: 1.1rem; }
  .writeoff-grid { grid-template-columns: 1.25fr 1fr; }
  .legend { gap: .35rem; }
  .sales-grid { grid-template-columns: 1fr 1fr; gap: .7rem; }
  .sales-grid > div:last-child { grid-column: 1/-1; padding: 0; border: 0; }
}
@media (max-width: 760px) {
  .wrap { width: min(100% - 2rem, 620px); }
  .mast-inner { min-height: 55px; }
  .intro { flex-wrap: wrap; gap: .8rem; margin: 1.45rem 0 1rem; }
  .intro p { font-size: .9375rem; }
  .reset { font-size: .8125rem; min-height: 38px; }
  .hero { min-height: 0; flex-direction: column; align-items: start; gap: 1rem; padding: 1.3rem; }
  .hero .secondary { border: none; padding: 0; display: flex; align-items: baseline; flex-wrap: wrap; column-gap: .55rem; }
  .metric-label { font-size: .875rem; margin-bottom: .24rem; }
  .secondary .metric-label { margin: 0; }
  .profit { font-size: clamp(2rem,8vw,3rem); }
  .margin { font-size: 1.125rem; }
  .margin .unit { font-size: .9em; }
  #botanical { width: 39%; opacity: .58; mask-image: linear-gradient(to right,transparent,#000 25%); }
  .workspace { grid-template-columns: minmax(0,1fr); gap: 1rem; margin: 1rem 0 4.5rem; }
  .results { gap: 1rem; }
  .card { padding: 1.1rem; border-radius: 12px; }
  .mobile-result { position: fixed; inset: auto 0 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom)); background: #234638; color: #fff; box-shadow: 0 -3px 16px #1b352218; }
  .mobile-result span { font-size: .875rem; }
}
@media (max-width: 480px) {
  .period { font-size: .8125rem; gap: .3rem; }
  .brand { font-size: 1.02rem; gap: .4rem; }
  .brandmark { width: 28px; height: 28px; }
  h2 { font-size: 1.16rem; }
  .field-grid { gap: .75rem .65rem; }
  .writeoff-grid { grid-template-columns: 1fr; gap: .7rem; }
  .sales-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .sales-grid > div:last-child { grid-column: 1/-1; padding: 0; border: 0; }
  .legend { grid-template-columns: 1fr; gap: .35rem; }
  .legend li > span:last-child { margin-left: auto; }
}
@media (max-width: 360px) {
  .wrap { width: calc(100% - 1.25rem); }
}
