:root {
  color-scheme: light;
  --ink: #0a0a0a;
  --muted: #666666;
  --subtle: #8a8a8a;
  --line: #e6e6e6;
  --line-strong: #cfcfcf;
  --soft: #f7f7f7;
  --paper: #ffffff;
  --agricore: #0f6b4f;
  --agricore-soft: #eef7f3;
  --danger: #b42318;
  --warning: #7a4b00;
  --warning-soft: #fff8e6;
  --radius: 8px;
  --content: 402px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  color: var(--ink);
  background: #ededed;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: #ededed; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { min-height: 44px; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--agricore); outline-offset: 2px; }
button:disabled { cursor: not-allowed; opacity: .4; }
h1, h2, h3, p { overflow-wrap: anywhere; }

#app {
  min-height: 100dvh;
  max-width: var(--content);
  margin: 0 auto;
  background: var(--paper);
  box-shadow: 0 0 0 1px rgba(0,0,0,.04);
}

.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  min-height: calc(54px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 18px 0;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--paper);
}
.wordmark { font-size: 15px; font-weight: 760; white-space: nowrap; }
.wordmark i { font-style: normal; color: var(--muted); font-weight: 550; }
.top-action { min-height: 44px; border: 0; background: transparent; padding: 0; color: var(--muted); font-size: 13px; }

.step-track { height: 52px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 10px 18px 0; border-bottom: 1px solid var(--line); }
.step-track span { min-width: 0; color: var(--subtle); text-align: center; }
.step-track i { display: block; width: 100%; height: 2px; background: var(--line); margin-bottom: 6px; }
.step-track small { font-size: 12px; }
.step-track .is-active { color: var(--ink); font-weight: 650; }
.step-track .is-active i { background: var(--ink); }
.global-notice { margin: 10px 18px 0; padding: 9px 11px; border: 1px solid #ead7a0; background: var(--warning-soft); color: var(--warning); font-size: 12px; line-height: 1.45; border-radius: 6px; }

.screen { flex: 1; padding: 20px 18px calc(156px + env(safe-area-inset-bottom)); min-width: 0; }
.page-heading { margin-bottom: 18px; }
.eyebrow { margin: 0 0 7px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.page-heading h1 { margin: 0; font-size: 24px; line-height: 1.15; font-weight: 760; }
.page-description { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 15px; margin-bottom: 12px; background: var(--paper); }
.panel.compact { padding: 12px; }
.panel h2 { margin: 0 0 12px; font-size: 15px; line-height: 1.3; }
.panel-title { min-height: 36px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.panel-title small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.panel-title h2 { margin: 0; font-size: 15px; }
.section-label { display: flex; align-items: center; justify-content: space-between; margin: 22px 2px 8px; min-height: 28px; }
.section-label > span { font-size: 12px; font-weight: 700; }

.field { display: block; margin-bottom: 13px; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.input-wrap { display: flex; align-items: center; min-width: 0; position: relative; }
input, select {
  width: 100%; height: 44px; min-width: 0; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--paper);
  color: var(--ink); padding: 0 11px; font-size: 14px;
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #777 50%), linear-gradient(135deg, #777 50%, transparent 50%); background-position: calc(100% - 15px) 18px, calc(100% - 11px) 18px; background-size: 4px 4px; background-repeat: no-repeat; padding-right: 28px; }
.input-wrap input { padding-right: 52px; }
.suffix { position: absolute; right: 11px; color: var(--muted); font-size: 12px; pointer-events: none; }
.field-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.entity-row { display: grid; grid-template-columns: minmax(0,1fr) 44px; gap: 8px; align-items: center; margin-bottom: 8px; }
.entity-row input { height: 44px; }
.icon-button { width: 44px; min-height: 44px; height: 44px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--muted); display: grid; place-items: center; font-size: 18px; }
.icon-button.danger:not(:disabled) { color: var(--danger); }
.text-button { min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--agricore); font-size: 12px; font-weight: 650; }
.band-row { min-height: 44px; padding: 0 11px; border: 1px solid var(--line); border-radius: 6px; background: var(--soft); display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; font-size: 12px; }
.band-row strong { color: var(--agricore); text-align: right; }
.tag { display: inline-flex; align-items: center; min-height: 24px; border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; font-size: 12px; color: var(--muted); white-space: nowrap; }

.choice-row { width: 100%; min-height: 58px; display: flex; align-items: flex-start; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); color: var(--ink); text-align: left; margin-bottom: 8px; }
.choice-row:last-child { margin-bottom: 0; }
.choice-row.is-selected { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choice-mark { width: 18px; height: 18px; flex: 0 0 18px; border: 1px solid var(--line-strong); border-radius: 4px; display: grid; place-items: center; font-size: 12px; margin-top: 1px; }
.is-selected > .choice-mark { background: var(--ink); border-color: var(--ink); color: white; }
.choice-copy { min-width: 0; }
.choice-copy strong { display: block; font-size: 13px; line-height: 1.25; }
.choice-copy small { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; margin-top: 3px; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice-grid .choice-row { margin: 0; min-height: 72px; }
.featured-choice { width: 100%; min-height: 82px; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--ink); color: white; padding: 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; text-align: left; }
.featured-choice span { min-width: 0; }
.featured-choice small, .featured-choice em, .featured-choice strong { display: block; }
.featured-choice small { color: #aaa; font-size: 12px; }
.featured-choice strong { font-size: 18px; margin: 3px 0; }
.featured-choice em { color: #cfcfcf; font-size: 12px; font-style: normal; line-height: 1.4; }
.featured-choice b { font-size: 12px; white-space: nowrap; }
.featured-choice.is-selected { background: var(--agricore); border-color: var(--agricore); }
.platform-panel { margin-top: 20px; }
.rule-note { border-left: 2px solid var(--agricore); padding: 2px 0 2px 12px; margin: 18px 2px; }
.rule-note strong { font-size: 12px; }
.rule-note p { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 5px 0 0; }

.total-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; border: 1px solid var(--ink); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; background: var(--ink); }
.total-panel > span { background: var(--ink); color: white; padding: 14px; min-width: 0; }
.total-panel small, .total-panel strong { display: block; }
.total-panel small { color: #aaa; font-size: 12px; margin-bottom: 5px; }
.total-panel strong { font-size: 17px; line-height: 1.15; }
.line-list > div, .scope-list > div { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); font-size: 12px; }
.line-list > div:last-child, .scope-list > div:last-child { border-bottom: 0; }
.line-list strong, .scope-list strong { text-align: right; font-size: 12px; }
.microcopy { margin: 9px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.microcopy.wide { margin: 10px 2px 18px; }
.segments { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segment { min-height: 70px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); text-align: left; padding: 10px; }
.segment strong, .segment small { display: block; }
.segment strong { font-size: 12px; }
.segment small { color: var(--muted); font-size: 12px; margin-top: 5px; line-height: 1.35; }
.segment.is-active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

.hardware-base { padding: 14px 0 18px; border-bottom: 1px solid var(--line); }
.hardware-base:first-of-type { border-top: 1px solid var(--line); }
.hardware-base-title { padding: 0 2px; }
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preset { min-height: 72px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); text-align: left; padding: 10px; }
.preset strong, .preset small { display: block; }
.preset strong { font-size: 12px; line-height: 1.35; }
.preset small { color: var(--muted); font-size: 12px; line-height: 1.35; margin-top: 5px; }
.preset.is-selected { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.device-details { margin-top: 10px; }
.device-details summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-size: 12px; font-weight: 650; list-style: none; }
.device-details summary::-webkit-details-marker { display: none; }
.device-details summary span { color: var(--muted); font-size: 12px; font-weight: 400; }
.device-details h3 { margin: 18px 0 6px; font-size: 12px; }
.hardware-list { border-top: 1px solid var(--line); }
.hardware-row { min-height: 60px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hardware-row > span { min-width: 0; }
.hardware-row strong, .hardware-row small { display: block; }
.hardware-row strong { font-size: 12px; line-height: 1.3; }
.hardware-row small { color: var(--muted); font-size: 12px; margin-top: 3px; }
.stepper { display: grid; grid-template-columns: 44px 30px 44px; flex: 0 0 118px; height: 46px; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.stepper button { min-height: 44px; border: 0; background: var(--soft); padding: 0; font-size: 16px; }
.stepper output { display: grid; place-items: center; font-size: 12px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.hardware-total { margin-top: 18px; }

.quote-header { border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.quote-number { color: var(--muted); font-size: 12px; }
.quote-header h2 { margin: 6px 0 5px; font-size: 19px; }
.quote-header p { margin: 0; color: var(--muted); font-size: 12px; }
.grand-total { padding: 18px 0; border-bottom: 1px solid var(--line); }
.grand-total small { color: var(--muted); font-size: 12px; }
.grand-total strong { display: block; color: var(--agricore); font-size: 34px; line-height: 1.05; margin: 5px 0; white-space: nowrap; }
.grand-total p { margin: 0; color: var(--muted); font-size: 12px; }
.warning-block { border: 1px solid #ead7a0; background: var(--warning-soft); color: var(--warning); border-radius: 6px; padding: 11px; margin-top: 12px; }
.warning-block strong { font-size: 12px; }
.warning-block p { font-size: 12px; line-height: 1.45; margin: 4px 0 0; }
.amount-row { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.amount-row:last-child { border-bottom: 0; }
.amount-row span { min-width: 0; font-size: 12px; }
.amount-row span small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.amount-row strong { white-space: nowrap; font-size: 12px; }
.metric-band { display: grid; grid-template-columns: 1.15fr .85fr; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 18px 0; }
.metric-band > div { padding: 13px 10px 13px 2px; min-width: 0; }
.metric-band > div + div { border-left: 1px solid var(--line); padding-left: 12px; }
.metric-band small, .metric-band strong { display: block; }
.metric-band small { color: var(--muted); font-size: 12px; line-height: 1.35; min-height: 32px; }
.metric-band strong { font-size: 14px; line-height: 1.25; margin-top: 4px; }
.empty-state { color: var(--muted); font-size: 12px; }
.warning-list p { margin: 0; padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--warning); font-size: 12px; line-height: 1.45; }
.warning-list p:last-child { border-bottom: 0; }
.detail-heading { gap: 12px; }
.detail-heading > strong { flex: 0 0 auto; color: var(--agricore); font-size: 12px; white-space: nowrap; }
.detail-list { padding-top: 0; padding-bottom: 0; }
.detail-row { min-height: 64px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.detail-row:last-child { border-bottom: 0; }
.detail-copy { min-width: 0; }
.detail-copy b { display: block; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.detail-formula { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.detail-row > strong { flex: 0 0 auto; padding-top: 1px; font-size: 12px; line-height: 1.4; white-space: nowrap; text-align: right; }
.detail-group { padding: 6px 0 0; border-bottom: 1px solid var(--line-strong); }
.detail-group:last-child { border-bottom: 0; }
.detail-group-title { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.detail-group-title b { min-width: 0; font-size: 12px; overflow-wrap: anywhere; }
.detail-group-title small { flex: 0 0 auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.quote-notes { margin: 20px 2px; }
.quote-notes strong { font-size: 12px; }
.quote-notes p { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 5px 0; }

.actions {
  position: fixed; z-index: 20; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(100%, var(--content)); background: var(--paper); border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, .06);
}
.live-summary { min-height: 64px; padding: 10px 18px; background: var(--ink); color: white; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.live-summary span:first-child { min-width: 0; }
.live-summary small, .live-summary strong { display: block; }
.live-summary small { color: #aaa; font-size: 12px; margin-bottom: 2px; }
.live-summary strong { font-size: 18px; white-space: nowrap; }
.live-meta { color: #bdbdbd; font-size: 12px; text-align: right; line-height: 1.4; }
.bottom-bar { display: grid; grid-template-columns: .75fr 1.25fr; gap: 8px; padding: 10px 18px calc(10px + env(safe-area-inset-bottom)); }
.button { height: 44px; border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 14px; background: var(--paper); color: var(--ink); font-size: 13px; font-weight: 650; }
.button-primary { background: var(--ink); color: white; border-color: var(--ink); }

@media (max-width: 402px) {
  :root, body { background: var(--paper); }
  #app { box-shadow: none; }
  .actions { left: 0; transform: none; }
}

@media (max-width: 365px) {
  .screen, .topbar, .bottom-bar, .live-summary { padding-left: 14px; padding-right: 14px; }
  .step-track { padding-left: 14px; padding-right: 14px; }
  .field-grid, .choice-grid, .preset-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  button { transition: border-color .15s ease, background-color .15s ease, color .15s ease; }
  button:active { transform: translateY(1px); }
}
