:root {
  --ink: #14213d;      /* navy text, 16.0:1 on white */
  --muted: #4a5568;    /* 7.5:1 on white */
  --line: #8a94a6;     /* borders, 3.1:1 on white */
  --bg: #ffffff;
  --soft: #f3f5f9;
  --accent: #0b6e4f;   /* green buttons, 6.3:1 with white text */
  --warn: #8a3b00;     /* flag text, 7.8:1 on white */
  --focus: #b4530a;    /* focus ring, 5.0:1 on white */
}
* { box-sizing: border-box; }
body { margin: 0; font: 1rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
header, main { max-width: 64rem; margin: 0 auto; padding: 1rem; }
h1 { font-size: 1.75rem; margin: .5rem 0 0; }
h2 { font-size: 1.3rem; margin-top: 2rem; }
p { max-width: 46rem; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--bg); padding: .5rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.drop { border: 3px dashed var(--line); border-radius: 12px; padding: 3rem 1rem; text-align: center; background: var(--soft); cursor: pointer; }
.drop.over { border-color: var(--accent); background: #e6f4ee; }
.drop-big { font-size: 1.3rem; font-weight: 600; margin: 0 auto .25rem; }
.drop p { margin-left: auto; margin-right: auto; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1rem 0; }
.btn { display: inline-flex; align-items: center; min-height: 44px; padding: .5rem 1.1rem; border: 2px solid var(--accent); border-radius: 8px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.secondary { background: var(--bg); color: var(--accent); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
progress { width: 100%; height: 1rem; }
input, select { font: inherit; padding: .4rem .5rem; border: 1px solid var(--line); border-radius: 6px; min-height: 44px; }
.wide { width: min(100%, 36rem); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .35rem .4rem; border-bottom: 1px solid #d5dae3; vertical-align: top; }
.fields input, .fields select { width: 100%; }
.table-wrap { overflow-x: auto; }
.chart { margin: 1.5rem 0; }
.chart h3 { font-size: 1.05rem; margin-bottom: .25rem; }
.flags { list-style: none; padding: 0; }
.flags li { border-bottom: 1px solid #d5dae3; }
.flags summary { min-height: 44px; padding: .6rem .25rem; cursor: pointer; }
.flag-when { font-weight: 600; margin-right: .5rem; }
.flag-why { color: var(--warn); font-weight: 600; }
.flag-body { display: grid; grid-template-columns: minmax(0, 22rem) 1fr; gap: 1rem; padding: .5rem 0 1rem; }
.flags img { width: 100%; height: auto; border-radius: 6px; }
.flags .facts { margin: .5rem 0; }
.flags label { display: block; margin-top: .4rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.error { color: #a4161a; font-weight: 600; }
.panel { border: 1px solid #d5dae3; border-radius: 10px; padding: 0 1rem 1rem; margin: 1.5rem 0; background: var(--soft); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0 1rem; }
.grid label { display: block; font-weight: 600; }
.grid input, .grid select { width: 100%; background: var(--bg); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; }
@media (max-width: 40rem) { .flag-body { grid-template-columns: 1fr; } }
.working { border: 1px solid #d5dae3; border-radius: 10px; padding: 0 1rem 1rem; margin: 1.5rem 0; background: var(--soft); }
.working h2 { margin-top: 1rem; }
#status { font-size: 1.15rem; font-weight: 600; min-height: 1.5em; }
.muted { color: var(--muted); }
header a { color: var(--accent); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
/* Shared foundations remain compatible with the battery view. */
:root {
  --ink:#182b33;
  --muted:#526570;
  --accent:#165b52;
  --soft:#f2f6f5;
  --line:#a7b8b8;
  --warn:#914009;
  --bg:#fff
}
body {
  background:#f5f7f7
}
header,main {
  max-width:1380px;
  padding:24px 40px
}
header.app-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid #d8e2e1;
  padding-top:22px;
  padding-bottom:22px
}
.brand {
  font-size:21px;
  text-decoration:none;
  letter-spacing:-.7px
}
.brand span {
  display:block;
  font-size:12px;
  font-weight:400;
  letter-spacing:.2px;
  color:var(--muted)
}
.badge {
  font-size:11px;
  letter-spacing:.5px;
  font-weight:700;
  background:#e5edeb;
  border-radius:5px;
  padding:6px 9px;
  white-space:normal
}
.workflow {
  display:flex;
  gap:32px;
  padding:0;
  margin:0 0 46px;
  list-style:none;
  color:var(--muted);
  font-size:13px
}
.workflow li {
  display:flex;
  gap:10px;
  padding:10px 0;
  border-bottom:2px solid transparent
}
.workflow .active {
  color:var(--accent);
  border-color:var(--accent);
  font-weight:700
}
.eyebrow {
  font-size:11px;
  font-weight:750;
  letter-spacing:1.8px;
  color:var(--accent);
  margin-bottom:12px
}
h1 {
  font-size:clamp(34px,4vw,54px);
  letter-spacing:-2px;
  line-height:1.12;
  margin-bottom:20px
}
h2 {
  font-size:27px;
  letter-spacing:-.7px;
  margin:0 0 14px
}
h3 {
  margin:0 0 12px;
  font-size:17px
}
.intro {
  font-size:18px;
  color:var(--muted);
  max-width:650px;
  margin-bottom:30px
}
.drop {
  background:#fff;
  border:2px dashed #9ab6ae;
  padding:30px 20px;
  text-align:center;
  max-width:860px
}
.drop h2 {
  font-size:22px;
  margin-top:8px
}
.drop p {
  margin:6px auto
}
.upload-symbol {
  display:inline-flex;
  width:44px;
  height:44px;
  border-radius:50%;
  background:#e7f0ed;
  align-items:center;
  justify-content:center;
  font-size:28px;
  color:var(--accent)
}
.principles {
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:30px;
  margin-top:40px;
  border-top:1px solid #d8e2e1;
  padding-top:18px;
  font-size:14px;
  color:var(--muted)
}
.principles strong {
  color:var(--ink);
  display:inline-block;
  margin-bottom:6px
}
.btn {
  font-size:14px;
  border-radius:6px;
  justify-content:center
}
.btn:disabled {
  cursor:wait
}
label {
  display:block;
  font-size:13px;
  font-weight:600
}
input,select,textarea {
  display:block;
  width:100%;
  max-width:100%;
  min-width:0;
  background:white;
  color:var(--ink);
  margin-top:5px;
  font:inherit
}
textarea {
  border:1px solid var(--line);
  border-radius:6px;
  padding:9px;
  resize:vertical;
  min-height:70px
}
.row {
  align-items:center
}
.panel {
  background:#fff;
  border:1px solid #d9e2e1;
  padding:22px;
  border-radius:10px;
  margin:18px 0;
  min-width:0
}
.section-head {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px
}
.section-head h2 {
  margin-bottom:0
}
.notice {
  padding:14px 18px;
  border-left:3px solid #b46b22;
  background:#fff7e9;
  font-size:14px;
  max-width:none
}
.warning {
  color:var(--warn)
}
.reviewed {
  color:#294ba1
}
.thumbnails {
  display:flex;
  gap:12px;
  overflow:auto;
  margin:20px 0;
  padding-bottom:8px
}
.thumb {
  flex:0 0 140px;
  font-size:11px;
  color:var(--muted);
  overflow-wrap:anywhere
}
.thumb img {
  width:140px;
  height:100px;
  object-fit:cover;
  border-radius:6px;
  border:1px solid #ccd8d5
}
.process {
  display:flex;
  list-style:none;
  gap:20px;
  padding:0;
  font-size:13px;
  flex-wrap:wrap
}
.process .active {
  color:var(--accent);
  font-weight:700
}
.stats {
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:12px
}
.stat {
  background:white;
  border:1px solid #d9e2e1;
  border-radius:8px;
  padding:14px 18px;
  font-size:12px;
  color:var(--muted)
}
.stat strong {
  display:block;
  color:var(--ink);
  font-size:26px;
  font-weight:650
}
.workspace {
  display:grid;
  grid-template-columns:minmax(0,1.5fr) minmax(300px,1fr);
  gap:20px;
  align-items:start
}
.workspace .panel {
  margin-top:6px
}
.measurement-tabs {
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-bottom:22px
}
.measurement-tabs button {
  border:1px solid #cad7d3;
  border-radius:5px;
  background:#f5f8f7;
  padding:9px 12px;
  color:var(--ink);
  cursor:pointer;
  min-height:40px
}
.measurement-tabs button[aria-pressed=true] {
  background:var(--accent);
  color:white;
  border-color:var(--accent)
}
#chart-holder {
  height:320px;
  position:relative
}
.legend {
  display:flex;
  gap:16px;
  flex-wrap:wrap;
  font-size:12px;
  margin-top:16px
}
.plot-panel .muted {
  font-size:12px
}
.check {
  display:flex;
  align-items:center;
  gap:7px;
  font-weight:400
}
.check input {
  width:18px;
  height:18px;
  min-height:18px;
  margin:0
}
#frame-slider {
  accent-color:var(--accent);
  padding:0;
  border:0
}
#frame-position {
  font-size:12px;
  flex:1;
  text-align:center
}
#source-image {
  width:100%;
  max-height:380px;
  object-fit:contain;
  background:#eff3f2;
  border-radius:6px;
  margin-top:14px
}
#frame-meta {
  font-size:12px;
  overflow-wrap:anywhere
}
#frame-flags {
  font-size:13px
}
#correction-fields {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  margin:18px 0
}
.review-list {
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  max-height:160px;
  overflow:auto
}
.review-list button {
  padding:8px;
  border:1px solid #c79e7c;
  background:#fff7ed;
  color:var(--warn);
  border-radius:4px;
  cursor:pointer;
  min-height:40px
}
.review-list button[aria-pressed=true] {
  border:2px solid var(--warn)
}
details summary {
  cursor:pointer;
  min-height:36px;
  font-weight:600;
  font-size:14px
}
#provenance {
  font-size:12px;
  overflow-wrap:anywhere
}
#provenance td {
  padding:6px
}
#provenance table {
  table-layout:fixed
}
.table-wrap {
  max-width:100%;
  font-size:12px
}
.table-wrap button {
  min-height:36px;
  background:none;
  border:0;
  text-decoration:underline;
  color:var(--accent);
  cursor:pointer
}
.setup-layout {
  display:grid;
  grid-template-columns:minmax(0,1.1fr) minmax(280px,1fr);
  gap:24px;
  margin-top:20px;
  align-items:start
}
.field-card {
  background:white;
  border:1px solid #d9e2e1;
  border-radius:8px;
  padding:18px;
  margin-bottom:14px
}
.field-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px
}
.field-card .row {
  margin-bottom:0
}
.crop-controls {
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:8px;
  margin-top:12px
}
.crop-controls label {
  font-size:11px
}
.setup-source {
  position:sticky;
  top:18px;
  margin-top:0
}
#crop-stage {
  position:relative;
  margin-top:15px;
  touch-action:none;
  line-height:0;
  user-select:none
}
#setup-image {
  width:100%;
  display:block;
  pointer-events:none
}
#crop-box {
  position:absolute;
  border:2px solid #fa9b2d;
  background:#fdb14e22;
  pointer-events:none
}
.validation {
  margin-top:32px
}
.validation p {
  font-size:13px
}
footer {
  max-width:1380px;
  margin:0 auto;
  padding:30px 40px;
  color:var(--muted);
  font-size:12px;
  border-top:1px solid #d8e2e1
}
[hidden] {
  display:none!important
}
*,*::before,*::after {
  box-sizing:border-box
}
section {
  min-width:0
}
a {
  color:var(--accent)
}
@media(max-width:900px) {
  .workspace,.setup-layout {
    grid-template-columns:1fr
  }
  .setup-source {
    position:static
  }
  .principles {
    gap:16px
  }
  .workflow {
    gap:16px;
    margin-bottom:28px
  }
}
@media(max-width:540px) {
  header,main {
    padding:20px 16px
  }
  .brand {
    font-size:18px
  }
  .workflow {
    gap:12px;
    font-size:11px
  }
  .workflow li {
    gap:5px
  }
  .principles {
    grid-template-columns:1fr;
    gap:0;
    margin-top:25px
  }
  .section-head {
    align-items:flex-start;
    flex-wrap:wrap
  }
  .panel {
    padding:16px
  }
  .stats {
    gap:6px
  }
  .stat {
    padding:12px 8px
  }
  .stat strong {
    font-size:24px
  }
  .field-grid {
    grid-template-columns:1fr
  }
  .crop-controls {
    grid-template-columns:1fr 1fr
  }
  #correction-fields {
    grid-template-columns:1fr
  }
  .row .btn {
    flex-grow:1
  }
  .process {
    gap:12px
  }
  #chart-holder {
    height:260px
  }
  footer {
    padding:24px 16px
  }
  .badge {
    font-size:10px
  }
  .brand span {
    font-size:11px
  }
}
/* Consumer flow: a short checklist, then a chart. */
header.app-header, main, footer { max-width: 1100px; }
header.app-header { padding-top: 20px; padding-bottom: 20px; }
.workflow { margin-bottom: 36px; }
#intake h1 { font-size: clamp(34px, 4.5vw, 50px); }
#intake .intro { font-size: 18px; line-height: 1.6; }
#intake .drop { margin-top: 28px; }
#customizer > p { color: var(--muted); }
.setup-layout { grid-template-columns: minmax(0, 1.2fr) minmax(240px, 1fr); }
.field-card { position: relative; padding: 16px; margin-bottom: 10px; }
.simple-field > .check { font-size: 16px; font-weight: 600; min-height: 32px; padding-right: 70px; }
.simple-field .include-field { flex: 0 0 20px; width: 20px; height: 20px; accent-color: var(--accent); }
.field-edit > summary { position: absolute; top: 18px; right: 16px; min-height: 32px; font-size: 13px; font-weight: 500; color: var(--accent); }
.field-edit[open] > .field-grid { margin-top: 20px; }
.field-edit .extra-options { margin-top: 16px; }
.text-button { background: none; border: 0; padding: 10px 0; min-height: 44px; font: inherit; font-size: 14px; color: var(--accent); text-decoration: underline; cursor: pointer; }
.setup-source #crop-stage { max-width: 220px; margin: 16px auto 0; }
#crop-target { font-size: 13px; }
.workspace { grid-template-columns: 1fr; }
.inspector-open .workspace { grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); }
#results h2 { font-size: 30px; }
#summary { font-size: 13px; margin-bottom: 12px; }
.check-photos { background: #fff3e4; border: 1px solid #d1a97e; border-radius: 6px; color: var(--warn); padding: 10px 14px; min-height: 44px; font: inherit; font-size: 14px; cursor: pointer; margin-bottom: 12px; }
#chart-holder { height: 370px; }
.chart-help, .quiet-note { font-size: 13px; color: var(--muted); }
.extra-options { margin: 16px 0; }
.extra-options > summary { color: var(--muted); font-size: 13px; font-weight: 400; }
.extra-options > .check { margin: 12px 0; }
#correction-fields { grid-template-columns: 1fr; }
#source-image { max-height: 300px; }
#inspector > .badge { display: inline-block; margin-top: 8px; }
#frame-flags, #correction-form .muted { font-size: 13px; }
#frame-position { font-size: 12px; }
#working-preview { max-width: 500px; }
@media (max-width: 900px) {
  .inspector-open .workspace, .setup-layout { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .workflow { gap: 12px; margin-bottom: 28px; }
  .workflow li { font-size: 11px; }
  #chart-holder { height: 260px; }
  .simple-field > .check { font-size: 15px; }
  .field-edit > summary { top: 19px; }
  .setup-source #crop-stage { max-width: 180px; }
}
