:root { font: 14px/1.5 Inter, "Segoe UI", Arial, sans-serif; color: #242821; background: #f4f6f0;
  --yellow: #f2e452; --line: #dce2d6; --muted: #62695e; }
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button { cursor: pointer; border: 0; padding: 8px 13px; border-radius: 8px; }
button:disabled { cursor: default; opacity: .5; }
input, select { min-width: 0; width: 100%; min-height: 39px; padding: 8px 10px; border: 1px solid #cbd3c4;
  background: white; color: inherit; border-radius: 8px; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #637d3d; outline-offset: 3px; }
label { display: grid; gap: 4px; color: #46503f; font-size: .9rem; font-weight: 600; }
h1,h2,p { margin: 0; }
h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); letter-spacing: -.04em; }
h2 { font-size: 1.04rem; }
.logo { background: var(--yellow); padding: 6px 9px; border-radius: 8px; width: 113px; height: 39px; object-fit: contain; }
.primary { background: var(--yellow); border: 1px solid #d9cf46; color: #26291d; font-weight: 650; }
.outline { color: #34412c; background: #fff; border: 1px solid #cbd3c4; }
.primary:hover { background: #e4d842; }
.outline:hover { background: #edf1e7; }
.topbar { padding: 16px 3.5vw; color: #eef2e8; background: #242821; display:flex; align-items:center; gap:40px; flex-wrap:wrap; }
.brand { display:flex; align-items:center; gap:10px; font-weight:700; }
nav { display:flex; gap:7px; flex-wrap:wrap; }
nav button,.session button { color: #eef2e8; background: transparent; }
nav button[aria-current] { background: #3d4635; color: #fbf8b9; }
.session { margin-left:auto; display:flex; align-items:center; gap:13px; }
.session span { max-width:260px; overflow:hidden; text-overflow:ellipsis; }
main { margin: auto; padding: 29px 3.5vw 45px; max-width: 1900px; }
.heading,.filter-actions,.filter-actions>div,.result-heading,.results footer,.results footer>div,.exports,.dialog-heading {
  display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap;
}
.heading { margin-bottom:20px; }
.heading p,.filter-actions>span,.report-card p,.results footer,.result-heading>span { color:var(--muted); font-size:.88rem; }
.filter-card,.results,.report-card { background:white; border:1px solid var(--line); border-radius:12px; overflow:hidden; }
.filter-card { padding:17px; margin-bottom:16px; }
.filter-grid { display:grid; grid-template-columns: repeat(5,minmax(120px,1fr)); gap:12px; }
.filter-actions { margin-top:15px; }
.report-card { padding:17px; display:flex; align-items:center; justify-content:space-between; gap:20px; margin-bottom:16px; }
.result-heading { padding:14px 17px; }
.table-scroll { overflow:auto; max-height:65vh; }
table { width:100%; border-collapse:separate; border-spacing:0; text-align:left; white-space:nowrap; font-size:.9rem; }
th,td { border-top:1px solid #e6eae0; padding:10px 13px; }
th { background:#f5f7f0; position:sticky; top:0; z-index:1; color:#4b5843; font-size:.83rem; }
tbody tr:hover { background:#f8faef; }
td button { color:#3d5f2c; background:#edf3e6; padding:4px 9px; }
td.numeric { text-align:right; font-variant-numeric:tabular-nums; }
.results footer { padding:12px 16px; border-top:1px solid var(--line); }
.empty { padding:35px 20px; color:var(--muted); }
#error,#login-error { color:#892e26; background:#f9e9e4; padding:10px 14px; border-radius:8px; margin-bottom:15px; }
#login { min-height:100vh; display:grid; place-items:center; padding:25px; background:#eef1e8; }
.login-card { width:min(420px,100%); background:white; padding:32px; display:grid; gap:18px;
  border:1px solid var(--line); border-radius:16px; box-shadow:0 12px 40px #2330180a; }
.login-card h1 { font-size:1.9rem; }
.login-card p { color:var(--muted); }
dialog { width:min(900px,calc(100% - 30px)); border:1px solid var(--line); border-radius:13px; padding:20px; max-height:90vh; }
dialog::backdrop { background:#1d251c91; }
.dialog-heading { margin-bottom:18px; }
dl { display:grid; grid-template-columns: minmax(130px,1fr) 3fr; gap:9px 14px; margin:0; }
dt { color:var(--muted); } dd { margin:0; overflow-wrap:anywhere; }
pre { white-space:pre-wrap; overflow-wrap:anywhere; background:#f5f7f1; padding:12px; font-size:.8rem; }
#photo { display:block; max-width:100%; max-height:72vh; object-fit:contain; margin:auto; }
#device-logs-dialog>p,#device-logs-dialog>label { margin-bottom:18px; }
.registry-controls { padding:0 18px; display:flex; gap:20px; align-items:end; flex-wrap:wrap; }
.registry-controls>label { min-width:220px; }
.registry-types { display:flex; gap:8px; flex-wrap:wrap; }
.registry-types button { display:inline-flex;align-items:center;gap:9px; }
.registry-type-icon { width:26px;height:26px;flex:none; }
.registry-actions { display:flex;gap:8px;flex-wrap:wrap; }
#registry-import-dialog { width:min(1100px,94vw); }
#registry-import-table { max-height:48vh; }
#registry-import-error { color:#892e26; }
#device-flow-dialog { width:min(1100px,95vw); }
#device-flow-status { margin:16px 0;color:var(--muted); }
#device-flow-error { color:#892e26;margin:12px 0; }
#device-flow-content details { margin:15px 0;padding:12px;border:1px solid var(--line);border-radius:8px; }
#device-flow-content summary { cursor:pointer;font-weight:650; }
#device-flow-content h3,#device-flow-content p { margin:12px 0; }
.flow-editor { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px; }
.flow-editor fieldset { border:1px solid var(--line);border-radius:8px;padding:15px;display:grid;gap:12px;min-width:0; }
.flow-editor legend { font-weight:650; }
.flow-editor textarea { width:100%;font:inherit;padding:8px;border:1px solid var(--line);border-radius:6px; }
.flow-question { border-top:1px solid var(--line);padding-top:12px;display:grid;gap:8px; }
.flow-order { display:flex;gap:6px;align-items:center; }
.flow-order span { flex:1; }
.flow-conflict { border:2px solid #b88b36;background:#fff9e9;border-radius:8px;padding:15px;overflow:auto; }
.flow-conflict button { margin:8px; }
@media(max-width:700px){.flow-editor{grid-template-columns:1fr;}}
.registry-types button[aria-pressed="true"] { background:var(--yellow);font-weight:650; }
.registry-grid { display:grid; grid-template-columns:repeat(2,minmax(120px,1fr)); gap:14px; }
.registry-grid>div { grid-column:1/-1; }
.registry-check,.registry-check-list label { display:flex; gap:9px; align-items:center; }
.registry-check input,.registry-check-list input { width:18px;min-height:18px;height:18px;flex:none; }
.registry-check-list { display:grid;gap:10px;max-height:200px;overflow:auto; }
#registry-form fieldset { border:1px solid var(--line); border-radius:8px;margin:20px 0;padding:15px; }
#registry-form legend { font-weight:650; }
#registry-error { color:#892e26;margin:12px 0; }
#registry-form p,#registry-pending-status { margin:10px 0;color:var(--muted); }
@media(max-width:600px){.registry-grid{grid-template-columns:1fr;}}
.map-actions { display:flex; gap:14px; align-items:center; flex-wrap:wrap; margin-top:18px; color:var(--muted); }
#map-dialog { width:min(1300px,calc(100% - 28px)); }
#map-dialog>p { color:var(--muted); font-size:.9rem; margin:8px 0; overflow-wrap:anywhere; }
#fueling-map { width:100%; height:min(65vh,640px); min-height:280px; border-radius:9px; background:#e8ece3; }
#map-tile-status { color:#892e26 !important; }
.fueling-pin span,.fueling-cluster span { display:grid; place-items:center; width:100%; height:100%; border-radius:50%; border:2px solid #fff; background:#3b552d; color:white; font-weight:bold; box-shadow:0 1px 6px #0006; }
.fueling-cluster span { background:#e8da47; color:#27311e; border:4px solid #ffffffaa; }
.fueling-popup h3 { font-size:1rem; margin:0 0 10px; }
.fueling-popup label { margin-bottom:12px; }
.fueling-popup dl { grid-template-columns:minmax(105px,1fr) 1.5fr; gap:7px 12px; font:12px/1.5 "Segoe UI",sans-serif; margin-bottom:15px; }
.fueling-popup select { max-width:100%; font-size:12px; }
.fueling-popup dd { white-space:normal; overflow-wrap:anywhere; }
.fueling-popup dt { white-space:normal; }
.api-page { display:grid; gap:16px; max-width:1200px; }
.api-card { background:white; border:1px solid var(--line); border-radius:12px; padding:22px; display:grid; gap:12px; min-width:0; }
.api-card h2 { font-size:1.2rem; }
.api-card p { color:var(--muted); max-width:100ch; }
.api-intro { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:20px; }
.api-intro>div { flex:1; min-width:240px; display:grid; gap:10px; }
.api-badge { background:#edf3e6; color:#3d5f2c; border-radius:20px; padding:4px 10px; width:fit-content; font-size:.85rem; font-weight:600; }
.api-download { text-decoration:none; white-space:nowrap; padding:9px 13px; border-radius:8px; }
.api-card pre { margin:0; padding:16px; max-height:460px; overflow:auto; white-space:pre; border-radius:8px; font:12px/1.6 Consolas,monospace; }
.api-card code { color:#34412c; overflow-wrap:anywhere; }
.api-table { overflow:auto; }
.api-table table { white-space:normal; }
.api-table td { vertical-align:top; overflow-wrap:anywhere; }
.api-table th { position:static; }
.api-table td:first-child { font-family:Consolas,monospace; font-size:.85rem; min-width:170px; max-width:370px; }
.api-table td:nth-child(2) { white-space:nowrap; }
.api-test-grid { display:grid; grid-template-columns:repeat(3,minmax(160px,1fr)); gap:12px; margin-bottom:14px; }
.api-card summary { cursor:pointer; font-weight:600; padding-bottom:8px; }
@media(max-width:650px){.api-test-grid{grid-template-columns:1fr;}.api-card{padding:16px;}.api-card pre{font-size:11px;}}
@media(max-width:1000px){.filter-grid{grid-template-columns:repeat(3,minmax(120px,1fr));}}
@media(max-width:650px){.topbar{gap:13px;}.session{width:100%;margin:0;justify-content:space-between;}
  .filter-grid{grid-template-columns:repeat(2,minmax(100px,1fr));}.report-card{display:block;}.exports{margin-top:12px;justify-content:flex-start;}
  main{padding-inline:14px;}dl{grid-template-columns:1fr;}dd{margin-bottom:10px;}}

tr.meter-warning { background: #fff0df; } .meter-notice { border-left: 4px solid #ac4b12; background: #fff0df; padding: 12px 18px; margin-bottom: 16px; }
@media (min-width: 800px) { .meter-filter { grid-column: span 2; } }
