:root {
  color-scheme: light;
  --paper: #f6f5ef;
  --surface: #fffefa;
  --ink: #202823;
  --muted: #57625a;
  --line: #dfdfd3;
  --green: #263630;
  --dark: #24352d;
  --dark-edge: #405349;
  --dark-muted: #c0cec3;
  --lime: #e8f5bf;
  --rust: #8d4027;
  --error: #a32d26;
  --mono: ui-monospace, "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
h1, h2, p, dl, dd { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { display: inline-block; width: 1.2em; height: 1.2em; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.frame { width: min(1112px, calc(100% - 64px)); margin-inline: auto; }
.masthead { border-bottom: 1px solid var(--line); background: #fbfaf5; }
.masthead-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; background: var(--green); color: var(--lime); }
.brand-mark .icon { width: 25px; height: 25px; }
.brand-name { display: block; font-weight: 770; font-size: 14px; letter-spacing: .045em; }
.brand-domain { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.home-link { display: inline-flex; min-height: 44px; align-items: center; gap: 6px; color: #3d5243; padding: 0 4px; white-space: nowrap; font-size: 12px; font-weight: 650; text-decoration: none; }
.home-link .icon { transform: rotate(180deg); }
.home-link:hover, .brand:hover .brand-name { text-decoration: underline; }
.masthead a:focus-visible { outline: 2px solid #5e7966; outline-offset: 3px; border-radius: 4px; }

.intro { display: flex; justify-content: space-between; align-items: center; gap: 30px; padding: 44px 0 31px; }
.eyebrow { display: flex; align-items: center; gap: 8px; color: var(--rust); font: 700 11px/1.4 var(--mono); letter-spacing: .115em; text-transform: uppercase; }
.signal-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--rust); box-shadow: 0 0 0 3px #eddcd0; margin-left: 3px; }
h1 { font-size: clamp(2.35rem, 5vw, 3.8rem); line-height: 1.05; letter-spacing: -.057em; margin: 9px 0 9px; font-weight: 785; }
.intro-copy { color: var(--muted); font-size: 15px; line-height: 1.55; }
.track-motif { width: 195px; flex: 0 0 auto; color: #a8aa94; margin: 0 3px 0 0; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.33fr) minmax(0, 1fr); align-items: start; gap: 22px; }
.entry-panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 19px; padding: 23px 25px; box-shadow: 0 3px 10px #2e312008; }
.entry-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
h2 { font-size: 22px; line-height: 1.15; letter-spacing: -.026em; font-weight: 750; }
.reset-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: #405449; background: transparent; border: 1px solid #daddd2; border-radius: 8px; min-height: 44px; padding: 0 11px; font-size: 13px; font-weight: 650; }
.reset-button:hover { background: #edf1e8; }

fieldset { position: relative; min-width: 0; margin: 0; padding: 0; border: 0; }
fieldset + fieldset { padding-top: 16px; margin-top: 19px; }
fieldset + fieldset::before { position: absolute; inset: 0 0 auto; content: ""; border-top: 1px solid #e8e8df; }
legend { float: left; width: 100%; display: flex; align-items: center; gap: 9px; padding: 0; margin: 0 0 12px; font-size: 14px; font-weight: 730; }
.section-index { display: grid; place-items: center; color: var(--rust); background: #f5eae1; border-radius: 5px; width: 26px; height: 23px; font: 700 11px/1 var(--mono); }
.field-grid { clear: both; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 15px; }
.weight-mode { clear: both; min-height: 32px; width: fit-content; margin-bottom: 9px; cursor: pointer; }
.weight-mode input { width: 17px; height: 17px; margin: 0 2px 0 0; accent-color: var(--green); }
.weight-result { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; padding: 8px 11px; border-radius: 7px; background: #eff1e8; }
.weight-result label { margin: 0; }
#calculated-weight { color: var(--green); font-size: 16px; letter-spacing: 0; }
.field { min-width: 0; }
label { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; font-weight: 640; font-size: 13px; line-height: 1.25; }
.optional { font-size: 10px; font-weight: 650; color: #526253; background: #edf0e8; padding: 2px 5px; border-radius: 4px; }
input, select { width: 100%; min-width: 0; height: 44px; padding: 0 11px; color: var(--ink); background: #fbfbf7; border: 1px solid #d9ddd2; border-radius: 8px; font-size: 16px; }
input::placeholder { color: #67746a; opacity: 1; }
input:hover, select:hover { border-color: #97a398; }
input:focus, select:focus { outline: 2px solid #5e7966; outline-offset: 1px; border-color: #5e7966; }
input[aria-invalid="true"] { border-color: var(--error); }
.input-shell { position: relative; }
.input-shell input { padding-right: 52px; }
.unit { position: absolute; inset: 0 11px 0 auto; display: grid; place-items: center; pointer-events: none; color: #536257; font-size: 12px; font-weight: 650; }
.error { display: block; color: var(--error); margin-top: 5px; font-size: 12px; line-height: 1.4; }
.formula { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 9px; margin-top: 18px; padding: 10px 11px; border-radius: 7px; background: #eff1e8; color: #43564a; font-size: 12px; line-height: 1.45; }
.formula-label { font-weight: 750; }

.dispatch-panel { min-width: 0; overflow: hidden; border-radius: 19px; background: var(--dark); color: #f6f8f2; box-shadow: 0 6px 20px #28362d20; }
.dispatch-top, .dispatch-bottom { padding-inline: 23px; }
.dispatch-top { padding-top: 22px; }
.dispatch-label { display: flex; align-items: center; gap: 7px; color: var(--lime); font: 700 10px/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; margin-bottom: 7px; }
.dispatch-label .icon { width: 17px; height: 17px; }
.route { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 11px; margin: 15px 0; padding: 11px 13px; border: 1px solid #54695b; border-radius: 9px; background: #34493e; }
.route > div:last-child { text-align: right; }
.route-label { display: block; color: #d3dfd2; font: 600 10px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .055em; }
.route strong { display: block; font-size: 17px; line-height: 1.25; margin-top: 3px; overflow-wrap: anywhere; }
.route-arrow { color: #d6e6ae; width: 19px; height: 19px; }
.dispatch-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 13px; padding: 0 0 13px; }
.dispatch-meta > div { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); align-items: baseline; gap: 5px 7px; }
.dispatch-meta > div:nth-child(2n) { text-align: right; }
.dispatch-meta dt, .costs dt { color: var(--dark-muted); font-size: 12px; }
.dispatch-meta dd, .costs dd { font-size: 13px; font-weight: 640; overflow-wrap: anywhere; }
.costs { display: grid; gap: 7px; border-top: 1px dashed #607468; padding: 12px 0 13px; }
.costs > div { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 10px; }
.costs dd, output { font-variant-numeric: tabular-nums; }
.dispatch-bottom { background: #1d2c24; padding-top: 14px; padding-bottom: 14px; border-top: 1px solid var(--dark-edge); }
.total-line { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 11px; }
#total-label { font-size: 13px; font-weight: 700; }
#total-label small { display: inline-block; color: var(--dark-muted); font: 600 10px/1 var(--mono); margin-left: 4px; }
output { min-width: 0; color: var(--lime); font-size: clamp(1.7rem, 3vw, 2.1rem); font-weight: 770; letter-spacing: -.035em; line-height: 1.15; overflow-wrap: anywhere; }
.copy-button { display: flex; width: 100%; min-height: 44px; justify-content: center; align-items: center; gap: 7px; padding: 8px; border: 1px solid transparent; border-radius: 8px; color: #25331e; background: var(--lime); font-weight: 750; font-size: 13px; }
.copy-button:not(:disabled):hover { background: #f2ffd2; }
.copy-button:disabled { color: #d5e2d4; background: #384d40; border-color: #587062; cursor: default; }
button:focus-visible { outline: 2px solid #5e7966; outline-offset: 3px; }
.copy-button:focus-visible { outline-color: var(--lime); }
.copy-hint { color: var(--dark-muted); margin-top: 7px; font-size: 11px; line-height: 1.4; min-height: 1.4em; text-align: center; }
#manual-copy { margin-top: 10px; width: 100%; height: 9em; padding: 8px; font-size: 14px; color: var(--ink); background: var(--surface); border-radius: 6px; }
.page-footer { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); margin-top: 24px; padding: 15px 0 20px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.page-footer span:first-child { letter-spacing: .06em; font-weight: 700; }

@media (max-width: 880px) {
  .frame { width: calc(100% - 40px); }
  .workspace { gap: 15px; }
  .entry-panel { padding-inline: 18px; }
  .dispatch-top, .dispatch-bottom { padding-inline: 17px; }
}

@media (max-width: 720px) {
  .frame { width: min(530px, calc(100% - 32px)); }
  .masthead-inner { min-height: 64px; }
  .intro { padding: 31px 0 22px; }
  .track-motif { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .entry-panel { padding: 17px 15px; }
}

@media (max-width: 370px) {
  .brand { gap: 8px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-name { font-size: 11px; }
  .brand-domain { font-size: 11px; }
  .field-grid { gap: 12px 8px; }
  .optional { padding-inline: 3px; }
}

@media print {
  .entry-panel, .home-link, .track-motif, .copy-button, .copy-hint, #manual-copy, .page-footer { display: none; }
  .workspace { display: block; }
  .dispatch-panel, .dispatch-bottom, .route { color: #000; background: #fff; box-shadow: none; border: 1px solid #999; }
  .dispatch-panel :is(output, dt, small, .dispatch-label, .route-label, .route-arrow) { color: #000; }
}

.challan-link { display: block; margin: 10px 0 0; padding: 8px 4px; color: var(--lime); text-align: center; font-size: 13px; font-weight: 700; text-underline-offset: 3px; }
@media print { .challan-link { display: none; } }
