:root {
  color-scheme: light;
  --brand: #55251f;
  --accent: #984d3a;
  --ink: #392520;
  --muted: #725951;
  --line: #ecded5;
  --paper: #fffdfb;
  --canvas: #fbf6f1;
  --blush: #faebe2;
  --green: #375944;
  --mint: #eef4eb;
  --red: #a52b32;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  font-synthesis: none;
  color: var(--ink);
  background: var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, p, dl, dd { margin: 0; }
button, input, select { font: inherit; }
button, summary { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid #a25844; outline-offset: 3px; }
[hidden] { display: none !important; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
svg:not(.symbols) { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.shell { width: min(100% - 64px, 1180px); margin-inline: auto; }

.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand, .guide-link { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand { color: var(--brand); white-space: nowrap; }
.brand strong { display: block; font: 700 1.21rem/1.05 Georgia, serif; letter-spacing: -.02em; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: .71rem; }
.brand-logo { flex: none; border-radius: 50%; background: #fff; border: 1px solid #e7c7b7; }
.guide-link { padding: 8px 11px; border: 1px solid var(--line); border-radius: 24px; font-size: .8rem; font-weight: 650; color: var(--brand); white-space: nowrap; }
.guide-link:hover { background: var(--blush); }

.intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, .58fr); align-items: center; gap: 12px; min-height: 202px; margin-block: 23px 24px; padding: 20px clamp(20px, 4vw, 45px); overflow: hidden; border: 1px solid #ecd1c3; border-radius: 25px; background: linear-gradient(108deg, #fffaf3 6%, #f9e7dd 68%, #f5d9cb); }
.eyebrow, .step { color: var(--accent); font-size: .69rem; font-weight: 800; letter-spacing: .14em; }
.eyebrow { display: flex; align-items: center; gap: 8px; }
.eyebrow span { width: 21px; height: 2px; border-radius: 4px; background: #b6705a; }
h1 { margin-block: 10px 8px; color: var(--brand); font: 700 clamp(2.05rem, 4.65vw, 4rem)/1.04 Georgia, serif; letter-spacing: -.055em; }
h1 em { color: var(--accent); font-weight: inherit; }
.intro-note { color: var(--muted); line-height: 1.5; font-size: .98rem; }
.intro .hero-art { justify-self: end; width: min(100%, 340px); height: auto; max-height: 178px; stroke: none; }
.art-orbit { stroke: #ba806e; stroke-width: 1; stroke-dasharray: 4 6; opacity: .65; }
.art-shadow { fill: #a95843; opacity: .12; }
.art-line { stroke: #a25c4a; stroke-width: 1.35; }
.art-spark { stroke: #a25c4a; stroke-width: 1.4; }
.art-dot { fill: #bd735c; }

.chooser-title { margin-bottom: 9px; color: var(--brand); font-size: .92rem; font-weight: 750; }
.product-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.product-tab { display: flex; align-items: center; gap: 11px; min-width: 0; min-height: 69px; padding: 9px 12px; text-align: left; color: var(--brand); background: var(--paper); border: 1px solid var(--line); border-radius: 13px; }
.product-tab strong, .product-tab small { display: block; }
.product-tab strong { font-size: .91rem; line-height: 1.23; }
.product-tab small { margin-top: 3px; color: var(--muted); font-size: .72rem; line-height: 1.3; }
.product-tab:hover { background: #fff7f0; border-color: #d8ab99; }
.product-tab[aria-selected="true"] { background: var(--blush); border-color: #b9715a; box-shadow: inset 0 0 0 1px #b9715a; }
.product-tab-icon, .panel-icon { display: grid; place-items: center; flex: none; border-radius: 10px; }
.product-tab-icon { width: 39px; height: 39px; background: #f8e8df; color: var(--accent); font-size: 1.18rem; }
.product-tab[aria-selected="true"] .product-tab-icon { color: #fffaf4; background: var(--accent); }

.workspace-toolbar { display: flex; align-items: center; gap: 8px; min-height: 51px; margin-block: 6px; }
.workspace-toolbar p { flex: 1; color: var(--muted); font-size: .81rem; line-height: 1.4; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 6px 11px; border: 1px solid #e2cabe; border-radius: 8px; background: var(--paper); color: var(--brand); font-size: .8rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.button:hover { background: var(--blush); }
.button:disabled { opacity: .55; cursor: default; }
.mobile-summary, .edit-link { display: none; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(0, 1fr); align-items: start; gap: 22px; }
.panel { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 17px; box-shadow: 0 6px 18px #55251f09; }
.panel-head { display: flex; align-items: center; gap: 12px; min-height: 75px; padding: 13px 21px; border-bottom: 1px solid var(--line); }
.panel-icon { width: 40px; height: 40px; background: var(--blush); color: var(--accent); font-size: 1.17rem; }
.panel-head h2 { margin-top: 2px; color: var(--brand); font: 700 1.26rem Georgia, serif; letter-spacing: -.02em; }
.panel-body { padding: 19px 21px 21px; }
.live { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; background: var(--mint); color: var(--green); border-radius: 20px; font-size: .7rem; font-weight: 700; white-space: nowrap; }
.live span { width: 6px; height: 6px; border-radius: 50%; background: #2b885f; }

fieldset { min-width: 0; border: 0; padding: 0; margin: 0 0 17px; }
fieldset + fieldset { border-top: 1px solid var(--line); }
legend, h3 { color: var(--brand); font-size: .9rem; font-weight: 750; }
legend { float: left; width: 100%; padding: 0; margin: 0 0 10px; }
fieldset + fieldset legend { margin-top: 15px; }
.fields { clear: both; display: grid; gap: 10px 12px; }
.fields-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { min-width: 0; display: flex; flex-direction: column; justify-content: end; gap: 4px; font-size: .78rem; font-weight: 650; }
.input-wrap { min-width: 0; position: relative; display: flex; align-items: center; }
input, select, .readout { width: 100%; min-width: 0; height: 39px; border: 1px solid #e6d4c7; border-radius: 8px; color: var(--ink); background: #fff8ef; }
input, .readout { font-size: .92rem; font-weight: 650; font-variant-numeric: tabular-nums; }
input { padding: 5px 9px; }
.with-unit { padding-inline-end: 57px; }
.unit { position: absolute; inset-inline-end: 9px; color: var(--muted); font-size: .72rem; font-weight: 600; pointer-events: none; }
.readout { display: flex; align-items: center; padding-inline: 9px; background: var(--mint); border-color: #d5e2d0; color: var(--green); }
input[aria-invalid="true"] { border-color: #c45357; background: #fff2ef; }
.field-note { margin-top: 7px; color: var(--muted); font-size: .75rem; line-height: 1.45; }
.target-label { display: block; margin-block: 9px 4px; font-size: .78rem; font-weight: 650; }
select { padding-inline: 8px; font-size: .82rem; }

.disclosure { border: 1px solid var(--line); border-radius: 10px; background: #fcf5ef; }
.disclosure summary { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; list-style: none; color: var(--brand); }
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary:hover { background: var(--blush); border-radius: 9px; }
.disclosure summary strong, .disclosure summary small { display: block; }
.disclosure summary strong { font-size: .82rem; }
.disclosure summary small { margin-top: 2px; color: var(--muted); font-size: .74rem; line-height: 1.35; }
.disclosure[open] summary svg { transform: rotate(180deg); }
.disclosure-body { padding: 10px 12px 13px; border-top: 1px solid var(--line); }

.message { padding: 9px 11px; margin-bottom: 10px; border-radius: 7px; background: #fff4da; color: #684713; font-size: .82rem; }
.price-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 15px; border: 1px solid #71372d; color: #fff9f2; background: var(--brand); border-radius: 12px; }
.price-caption { color: #f5dbcd; font-size: .81rem; font-weight: 750; }
.price { font-size: clamp(1.55rem, 3.4vw, 2.6rem); line-height: 1.14; font-weight: 800; letter-spacing: -.045em; margin-block: 3px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.price-note { color: #f5dbcd; font-size: .72rem; line-height: 1.4; }
.price-minimum { flex: 0 1 auto; min-width: 0; padding-left: 12px; border-left: 1px solid #986459; }
.price-minimum p, .price-minimum small { display: block; color: #f5dbcd; font-size: .72rem; }
.price-minimum strong { display: block; font-size: 1.08rem; margin-block: 3px; overflow-wrap: anywhere; }
.profit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-block: 9px 17px; }
.profit-card { padding: 9px; border-radius: 9px; border: 1px solid #dce6d6; background: var(--mint); color: var(--green); }
.profit-card p { font-size: .72rem; font-weight: 650; line-height: 1.3; }
.profit-card strong { display: block; margin-top: 4px; font-size: 1.04rem; letter-spacing: -.025em; overflow-wrap: anywhere; }
.ledger { margin-block: 6px 15px; font-size: .8rem; }
.ledger div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, auto); align-items: baseline; gap: 8px; border-bottom: 1px solid #f1e7e0; padding: 5px 7px; }
.ledger dd { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ledger .ledger-total { color: var(--green); font-weight: 700; background: var(--mint); }
.ledger .ledger-total:last-child { border-radius: 0 0 6px 6px; }
.sales-ledger, .manual-ledger { margin-bottom: 10px; }
.manual-ledger { margin-bottom: 0; }
.negative { color: var(--red); }
.result-actions { display: flex; align-items: center; gap: 9px; margin-top: 12px; }
.copy-button { background: var(--brand); border-color: var(--brand); color: #fff9f2; }
.copy-button:hover:not(:disabled) { background: #71372d; }
.copy-button:disabled:hover { background: var(--brand); }
.action-note { color: var(--muted); font-size: .75rem; }

.guide { display: grid; grid-template-columns: .9fr repeat(3, minmax(0, 1fr)); gap: 22px; margin-top: 23px; padding: 20px 21px; border: 1px solid var(--line); border-radius: 15px; background: var(--paper); }
.guide h2 { margin-top: 3px; color: var(--brand); font: 700 1.3rem Georgia, serif; }
.guide strong { color: var(--brand); font-size: .85rem; }
.guide p:not(.eyebrow) { color: var(--muted); font-size: .79rem; line-height: 1.5; margin-top: 5px; }
.footer { display: flex; justify-content: space-between; gap: 10px; padding-block: 15px 25px; color: var(--muted); font-size: .76rem; }

@media (max-width: 910px) {
  .shell { width: min(100% - 32px, 1240px); }
  .workspace { gap: 14px; }
  .panel-head, .panel-body { padding-inline: 14px; }
  .guide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .live { display: none; }
}

@media (max-width: 720px) {
  html { scroll-padding-top: 76px; }
  .shell { width: calc(100% - 24px); }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .intro { grid-template-columns: minmax(0, 1fr) minmax(80px, .36fr); min-height: 0; margin-block: 12px 16px; padding: 14px; border-radius: 18px; }
  .intro h1 { font-size: clamp(1.7rem, 5.9vw, 2.5rem); }
  .intro-note { font-size: .86rem; }
  .product-tabs { grid-template-columns: minmax(0, .78fr) minmax(0, .78fr) minmax(0, 1.44fr); gap: 7px; }
  .product-tab { justify-content: center; align-items: center; flex-direction: column; gap: 5px; min-height: 70px; padding: 7px; text-align: center; }
  .product-tab strong { overflow-wrap: anywhere; }
  .product-tab-icon { width: 30px; height: 30px; font-size: .97rem; }
  .product-tab small { display: none; }
  .workspace-toolbar { flex-wrap: wrap; padding-block: 4px; }
  .workspace-toolbar p { flex: 1 1 145px; }
  .guide-link, .button, .edit-link, .disclosure summary { min-height: 44px; }

  .mobile-summary { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; padding: 6px 10px; background: var(--brand); color: #fff9f2; border: 1px solid #71372d; border-radius: 11px; box-shadow: 0 3px 10px #55251f20; }
  .mobile-summary p { min-width: 0; }
  .mobile-summary span, .mobile-summary strong { display: block; }
  .mobile-summary span { color: #f5dbcd; font-size: .76rem; }
  .mobile-summary strong { margin-top: 2px; font-size: 1.14rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  .mobile-summary .button { flex: none; }
  .edit-link { display: inline-flex; align-items: center; margin-inline-start: auto; padding-inline: 4px; color: var(--accent); font-size: .8rem; font-weight: 750; text-underline-offset: 3px; }
  .live { display: none; }

  .panel-head { min-height: 66px; }
  .panel-body { padding-block: 15px 17px; }
  .field, .target-label { font-size: .86rem; line-height: 1.3; }
  .field-note { font-size: .81rem; }
  input, select, .readout { height: 46px; font-size: 1rem; }
  #lot-fields .with-unit { padding-inline-end: 25px; }
  .ledger { font-size: .86rem; }
  .ledger div { padding-block: 7px; }
  .price { font-size: 2rem; }
  .footer { flex-direction: column; }
}

@media (max-width: 390px) {
  .shell { width: calc(100% - 22px); }
  .topbar-inner { min-height: 66px; gap: 8px; }
  .brand { min-width: 0; gap: 8px; }
  .brand-logo { width: 43px; height: 43px; }
  .brand strong { font-size: 1.06rem; }
  .brand small { font-size: .65rem; white-space: normal; }
  .guide-link { flex: none; gap: 5px; padding-inline: 7px; }
  .intro { padding: 13px; }
  .product-tab strong { font-size: .8rem; }
  .panel-head, .panel-body { padding-inline: 11px; }
  .fields { column-gap: 7px; }
  .guide { grid-template-columns: minmax(0, 1fr); gap: 13px; }
}

@media (max-width: 360px) {
  .guide-link svg { display: none; }
  .intro { grid-template-columns: minmax(0, 1fr) 60px; gap: 6px; }
  .price-card { flex-direction: column; align-items: stretch; }
  .price-minimum { padding: 8px 0 0; border: 0; border-top: 1px solid #986459; }
}
