:root {
  --ink: #1d2730;
  --muted: #5b6b78;
  --bg: #f4f6f8;
  --card: #ffffff;
  --line: #d9e0e6;
  --accent: #1f6f8b;
  --accent-ink: #ffffff;
  --warn-bg: #fff6e0;
  --warn-line: #e8c46a;
  --bad: #b3261e;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.wrap { max-width: 960px; margin: 0 auto; padding: 0 1rem; }

.site-header { background: var(--accent); color: var(--accent-ink); padding: 1.5rem 0 1.25rem; }
.site-header h1 { margin: 0 0 .25rem; font-size: 1.75rem; }
.tagline { margin: 0; opacity: .92; }

main { padding: 1.25rem 1rem 2rem; }

h2 { font-size: 1.2rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }

.notice {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-bottom: 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .5rem; }
.units { display: flex; gap: 1rem; }
.units label { display: flex; align-items: center; gap: .4rem; font-size: .95rem; }

label { font-size: .95rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem 1rem; }
.grid-3 label { display: flex; flex-direction: column; gap: .25rem; }

input, select, button { font: inherit; }
input[type="number"], input[type="text"], input[type="email"], select {
  padding: .4rem .5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-width: 0;
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .35rem .4rem; border-bottom: 1px solid var(--line); }
th { font-size: .85rem; color: var(--muted); font-weight: 600; }
.cartons input { width: 100%; min-width: 4.5rem; }
.cartons td.line-cbm { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.cartons tr.invalid input { border-color: var(--bad); background: #fff3f2; }
.row-error { color: var(--bad); margin: .5rem 0 0; font-size: .95rem; }

.actions { display: flex; gap: .5rem; margin-top: .75rem; }

.btn {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: .45rem .9rem;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn-quiet { background: transparent; color: var(--accent); }
.btn-small { padding: .2rem .6rem; font-size: .9rem; }
.btn-remove {
  background: none; border: none; color: var(--muted);
  font-size: 1.3rem; line-height: 1; cursor: pointer; padding: .2rem .4rem;
}
.btn-remove:hover { color: var(--bad); }

.hint { color: var(--muted); font-size: .92rem; margin: .5rem 0 0; }
details.hint summary { cursor: pointer; color: var(--accent); }
details.hint ul { margin: .5rem 0 0; padding-left: 1.2rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin: 0; }
.stats div { background: var(--bg); border-radius: 8px; padding: .6rem .75rem; }
.stats dt { font-size: .85rem; color: var(--muted); }
.stats dd { margin: .15rem 0 0; font-size: 1.1rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stats .stat-key { background: var(--accent); color: var(--accent-ink); }
.stats .stat-key dt { color: var(--accent-ink); opacity: .9; }
.basis { margin: .75rem 0 0; }
.compare td { font-variant-numeric: tabular-nums; }
.compare tr.selected td { font-weight: 600; background: #eef6f9; }

.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; }
.inline-form input { flex: 1 1 220px; }

.preset-list { list-style: none; padding: 0; margin: .75rem 0 0; }
.preset-list li { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--line); }
.preset-list li.empty { color: var(--muted); border: none; }
.preset-name { flex: 1; }

.sponsor { border-style: dashed; }
.sponsor-label {
  display: inline-block; margin: 0 0 .5rem;
  font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: .05rem .4rem;
}
.sponsor-title { font-weight: 600; margin: 0 0 .25rem; }
.sponsor-body p:last-child { margin-bottom: 0; }

.site-footer { color: var(--muted); font-size: .9rem; padding: 1rem 0 2rem; border-top: 1px solid var(--line); }
.site-footer a { color: var(--accent); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
