/* Uber shift dashboard — night-drive instrument cluster.
   One accent (sodium-lamp amber), hairlines instead of shadows, tabular figures everywhere. */

:root {
  color-scheme: dark;
  --page: #050505;          /* true black-ish: lowest luminance for a car at night */
  --surface: #121314;
  --raise: #1d1e21;         /* buttons */
  --raise-press: #2a2b2f;
  --line: #27282b;
  --line-strong: #3b3c40;
  --ink: #f2efe8;
  --ink-2: #b3afa6;
  --ink-3: #7c7973;
  --accent: #ffb648;        /* buttons, focus, accent text (10.5:1 on surface) */
  --accent-mark: #c07d00;   /* chart marks: inside the dark lightness band */
  --on-accent: #1a1200;
  --good: #3ccf6e;
  --bad: #ff5c5c;
  --bad-line: #5a2a2a;
  --seg-1: #8a8b90;         /* de-emphasis grey: energy */
  --seg-2: #6b6c70;         /* de-emphasis grey: platform fee */
  --track: #26272a;
  --scrim: rgba(0, 0, 0, 0.72);
  --font: "Roboto", "Inter", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --radius-panel: 18px;
  --radius-btn: 12px;
  --tap: 56px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --page: #ecebe6;
  --surface: #ffffff;
  --raise: #f3f2ee;
  --raise-press: #e6e4de;
  --line: #dcdad3;
  --line-strong: #c5c3bb;
  --ink: #161513;
  --ink-2: #5f5c56;
  --ink-3: #8a877f;
  --accent: #9a5b00;
  --accent-mark: #c27400;
  --on-accent: #ffffff;
  --good: #0d7a2d;
  --bad: #c62828;
  --bad-line: #e5b4b4;
  --seg-1: #707176;
  --seg-2: #9a9b9f;
  --track: #e6e5e0;
  --scrim: rgba(20, 20, 18, 0.5);
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--page); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.3;
  color: var(--ink);
  background: var(--page);
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}

h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.2;
}

p { margin: 0 0 12px; }
.muted { color: var(--ink-2); }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .toast { transition: opacity 180ms ease; }
}

/* ---------- buttons ---------- */

.btn {
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 22px;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.005em;
  border-radius: var(--radius-btn);
  border: 1px solid var(--line-strong);
  background: var(--raise);
  color: var(--ink);
  white-space: nowrap;
}
.btn:active { background: var(--raise-press); }
.btn.primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: transparent;
}
.btn.primary:active { filter: brightness(0.92); }
.btn.quiet {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}
.btn.quiet:active { background: var(--raise); }
.btn.danger {
  color: var(--bad);
  border-color: var(--bad-line);
  background: transparent;
}
.btn.grow { flex: 1 1 auto; }
.btn[disabled] { opacity: 0.4; cursor: default; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.row-label { color: var(--ink-2); margin-right: 4px; }

.input {
  min-height: var(--tap);
  padding: 0 16px;
  font: inherit;
  font-size: 20px;
  color: var(--ink);
  background: var(--page);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-btn);
  min-width: 0;
}
.input::placeholder { color: var(--ink-3); }

/* ---------- page grid ---------- */

.cluster {
  max-width: 1640px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}
.cluster > * { min-width: 0; }

/* The binnacle is one housing with hairline dividers, not three cards. */
.binnacle {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr) 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  overflow: hidden;
}
.binnacle > * {
  padding: 22px 26px;
  min-width: 0;
}
.binnacle > * + * { border-left: 1px solid var(--line); }

.shift-state { color: var(--ink-2); font-size: 18px; }
.shift-state.on { color: var(--ink); }
.shift-state.on::before {
  content: "";
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--good);
  margin-right: 10px;
  vertical-align: 1px;
}
.clock {
  font-size: 64px;
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 6px 0 18px;
}
.shift { display: flex; flex-direction: column; }
.shift-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.shift-foot { margin-top: auto; padding-top: 14px; display: flex; }
.shift-foot .btn { margin-left: -16px; }
.confirm-text { flex-basis: 100%; color: var(--ink-2); font-size: 17px; }

.hero { display: flex; flex-direction: column; justify-content: flex-start; }
.hero-label { color: var(--ink-2); font-size: 18px; }
.hero-value {
  font-size: clamp(72px, 8.2vw, 132px);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.03em;
  margin: 4px 0 6px;
  white-space: nowrap;
}
.hero-value.neg { color: var(--bad); }
.hero-sub { color: var(--ink-2); font-size: 20px; margin-bottom: 18px; }
.hero-sub strong { color: var(--ink); font-weight: 500; }

/* Where the gross went: the one bold element on the page. */
.split-bar {
  display: flex;
  gap: 2px;                /* the surface gap between segments */
  height: 16px;
  margin-top: auto;
}
.seg { flex: 0 0 auto; min-width: 2px; }
.seg:first-child { border-radius: 4px 0 0 4px; }
.seg:last-child { border-radius: 0 4px 4px 0; }
.seg:only-child { border-radius: 4px; }
.seg-net { background: var(--accent-mark); }
.seg-energy { background: var(--seg-1); }
.seg-fee { background: var(--seg-2); }
.split-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-top: 10px;
  font-size: 17px;
  color: var(--ink-2);
}
.leg { display: inline-flex; align-items: center; gap: 8px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.leg-val { color: var(--ink); }
.split-empty {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
}

/* ---------- weather ---------- */

.weather { display: flex; flex-direction: column; gap: 12px; }
.wx-top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.wx-temp { font-size: 48px; font-weight: 300; line-height: 1; letter-spacing: -0.02em; }
.wx-cond { font-size: 22px; }
.wx-place { color: var(--ink-2); font-size: 17px; flex-basis: 100%; }
.wx-label { color: var(--ink-2); font-size: 16px; margin-top: 4px; }
.wx-hours {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.wx-hour { text-align: center; }
.wx-h { color: var(--ink-2); font-size: 15px; }
.wx-p { font-size: 20px; margin: 2px 0 6px; }
.wx-meter { height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.wx-fill { height: 100%; border-radius: 4px; background: var(--accent-mark); }
.wx-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  color: var(--ink-3);
  font-size: 15px;
}
.wx-foot .btn { padding: 0 14px; font-size: 17px; }
.wx-find { display: flex; gap: 8px; }
.wx-find .input { flex: 1 1 auto; }
.wx-empty p { color: var(--ink-2); }
.wx-err { color: var(--bad); font-size: 16px; }

/* ---------- controls ---------- */

.controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.control {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  padding: 18px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.control-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.control-label { font-size: 20px; color: var(--ink-2); }
.control-value {
  font-size: 44px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
}
.chip-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.chip-grid .btn { padding: 0 8px; }
.control-note { color: var(--ink-3); font-size: 15px; margin-top: auto; }

/* ---------- tiles ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  overflow: hidden;
}
.tile { padding: 18px 24px; min-width: 0; }
.tile + .tile { border-left: 1px solid var(--line); }
.tile-label { color: var(--ink-2); font-size: 18px; }
.tile-value {
  font-size: 40px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 4px 0 2px;
}
.tile-note { color: var(--ink-3); font-size: 15px; }
.tile-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.tile-spark { flex: 1 1 110px; display: flex; justify-content: flex-end; min-width: 0; }
.spark { display: block; width: 100%; max-width: 132px; height: auto; }

/* ---------- lower deck ---------- */

.deck {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  padding: 18px 22px 20px;
  min-width: 0;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.side { display: grid; gap: 14px; }

.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.log-table { width: 100%; border-collapse: collapse; font-size: 17px; }
.log-table th, .log-table td {
  text-align: right;
  padding: 0 12px;
  height: 48px;
  border-top: 1px solid var(--line);
  white-space: nowrap;
}
.log-table th:first-child, .log-table td:first-child { text-align: left; padding-left: 0; }
.log-table th:last-child, .log-table td:last-child { padding-right: 0; }
.log-table th { color: var(--ink-2); font-weight: 400; border-top: 0; height: 40px; }
.log-table td.strong { font-weight: 500; }
.log-empty { color: var(--ink-3); padding: 8px 0 2px; }

.link-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 20px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--line-strong);
  background: var(--raise);
  color: var(--ink);
  text-decoration: none;
  font-size: 20px;
  font-weight: 500;
}
.link:active { background: var(--raise-press); }
.link-group { display: inline-flex; }
.link-group .link { border-radius: var(--radius-btn) 0 0 var(--radius-btn); }
.link-group .btn { border-radius: 0 var(--radius-btn) var(--radius-btn) 0; border-left: 0; padding: 0 14px; color: var(--ink-2); }
.link-form { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; }

details.setup > summary {
  list-style: none;
  cursor: pointer;
  font-size: 22px;
  font-weight: 500;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
}
details.setup > summary::-webkit-details-marker { display: none; }
details.setup > summary::before {
  content: "";
  width: 10px; height: 10px;
  border-right: 2px solid var(--ink-2);
  border-bottom: 2px solid var(--ink-2);
  transform: rotate(-45deg);
  margin-left: 4px;
}
details.setup[open] > summary::before { transform: rotate(45deg); margin-top: -4px; }
.checklist { display: grid; gap: 4px; margin-top: 12px; }
.check {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: var(--tap);
  padding: 4px 6px;
  border-radius: var(--radius-btn);
  cursor: pointer;
}
.check:active { background: var(--raise); }
.check input { width: 26px; height: 26px; margin: 0; accent-color: var(--accent); flex: 0 0 auto; }
.check.done span { color: var(--ink-3); text-decoration: line-through; }

.foot { display: flex; align-items: center; gap: 14px; padding: 0 4px 12px; }
.foot:empty { display: none; }
.foot-note { color: var(--ink-3); font-size: 15px; }
.foot-note:empty { display: none; }

/* ---------- sheets ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--scrim);
  display: grid;
  place-items: center;
  padding: 16px;
}
.sheet[hidden] { display: none; }
.sheet-panel {
  width: min(560px, 100%);
  max-height: 100%;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  padding: 20px 22px 22px;
}
.settings-panel { width: min(680px, 100%); }

.keypad-title { color: var(--ink-2); font-size: 18px; }
.keypad-display {
  font-size: 56px;
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.02em;
  min-height: 64px;
  margin: 4px 0 16px;
  text-align: right;
  padding-right: 6px;
  overflow: hidden;
}
.keys {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.key {
  height: 84px;
  font-size: 34px;
  font-weight: 400;
  border-radius: var(--radius-btn);
  border: 1px solid var(--line-strong);
  background: var(--raise);
  color: var(--ink);
  padding: 0;
}
.key:active { background: var(--raise-press); }
.key.soft { font-size: 22px; color: var(--ink-2); }
.key.go { background: var(--accent); color: var(--on-accent); border-color: transparent; font-size: 24px; font-weight: 500; }

.settings-body { display: grid; }
.srow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.srow-text { min-width: 0; }
.srow-name { font-size: 20px; }
.srow-hint { color: var(--ink-3); font-size: 15px; }
.srow .btn { flex: 0 0 auto; }
.seg-ctl { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-btn); overflow: hidden; }
.seg-ctl .btn { border: 0; border-radius: 0; }
.seg-ctl .btn + .btn { border-left: 1px solid var(--line-strong); }
.seg-ctl .btn.on { background: var(--accent); color: var(--on-accent); }
.srow.stack { flex-direction: column; align-items: stretch; }
.srow.stack .btn-row { margin-top: 4px; }

.csv-box {
  width: 100%;
  min-height: 240px;
  font: 15px/1.4 ui-monospace, Menlo, Consolas, monospace;
  color: var(--ink);
  background: var(--page);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-btn);
  padding: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 30;
  background: var(--ink);
  color: var(--page);
  padding: 14px 22px;
  border-radius: var(--radius-btn);
  font-size: 18px;
  max-width: calc(100vw - 32px);
  opacity: 1;
}
.toast[hidden] { display: none; }
.toast.fade { opacity: 0; }

/* ---------- responsive ---------- */

@media (max-width: 1280px) {
  .binnacle { grid-template-columns: 300px minmax(0, 1fr); }
  .weather { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  .wx-hours { max-width: 620px; }
  .hero-value { font-size: clamp(64px, 9vw, 112px); }
}

@media (max-width: 900px) {
  body { font-size: 17px; }
  .cluster { padding: 12px; gap: 12px; }
  .binnacle { grid-template-columns: minmax(0, 1fr); }
  .binnacle > * { padding: 18px 18px; }
  .binnacle > * + * { border-left: 0; border-top: 1px solid var(--line); }
  .clock { font-size: 52px; }
  .hero-value { font-size: clamp(56px, 16vw, 84px); }
  .hero-sub { font-size: 18px; }
  .controls { grid-template-columns: minmax(0, 1fr); }
  .control { padding: 16px 18px 18px; }
  .control-value { font-size: 38px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { padding: 14px 18px; }
  .tile:nth-child(odd) { border-left: 0; }
  .tile:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .tile-value { font-size: 32px; }
  .deck { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 16px 18px 18px; }
  .link-form { grid-template-columns: 1fr; }
  .btn { padding: 0 16px; font-size: 19px; }
  .key { height: 64px; font-size: 28px; }
  .keypad-display { font-size: 44px; }
  .sheet { padding: 8px; align-items: end; }
  .sheet-panel { border-radius: 18px; padding: 16px; }
  .wx-temp { font-size: 40px; }
  .wx-hours { gap: 4px; }
  .wx-p { font-size: 17px; }
  .log-table { font-size: 16px; }
}
