/* Owner dashboard: dark sidebar, cream content (docs/mockups, owner tab). */
body.owner { min-height: 100%; }

/* ---------- login, setup, recovery ---------- */
.auth { max-width: 520px; margin: 0 auto; padding: 32px 16px; }
.auth .card { padding: 22px; }
.auth h2 { margin-bottom: 10px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 1.2rem; margin-bottom: 14px; }
.auth-brand img { width: 36px; height: 36px; border-radius: 10px; }
.stack label { display: grid; gap: 0.3rem; font-weight: 700; }
.token-box { word-break: break-all; background: var(--soft); padding: 0.6rem; border-radius: 8px; font-family: ui-monospace, Menlo, monospace; font-size: 0.8rem; }
#recovery-codes { white-space: pre-line; font-size: 1rem; }
.qr { display: block; width: min(220px, 60vw); height: auto; image-rendering: pixelated; border-radius: 8px; border: 1px solid var(--line); background: #fff; }

/* ---------- dashboard frame ---------- */
.dash { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.dash nav { background: #2b2320; color: #f1ebe3; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; }
.dash nav .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-family: var(--display); font-weight: 800; font-size: 1.1rem; }
.dash nav .brand img { width: 30px; height: 30px; border-radius: 8px; }
.dash nav .pages { display: flex; flex-direction: column; gap: 4px; }
.dash nav .pages a {
  text-decoration: none;
  color: #d8cfc4;
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.dash nav .pages a[aria-current="page"] { background: var(--brand); color: #fff; }
.dash nav .biz { margin-top: auto; font-size: 0.8rem; color: #a79c93; padding: 12px 12px 4px; border-top: 1px solid #4a403b; display: grid; gap: 2px; }
.dash nav .biz b { color: #f1ebe3; overflow: hidden; text-overflow: ellipsis; }
.dash nav .biz span { overflow: hidden; text-overflow: ellipsis; }
.dash nav .biz button { justify-self: start; padding: 4px 0; color: #cfc4b8; text-decoration: underline; }
.dash main { padding: 20px 24px 40px; min-width: 0; display: grid; gap: 14px; align-content: start; }
.page { display: none; gap: 14px; }
.page.active { display: grid; }
.page h1 { margin-bottom: -6px; }
.sub { color: var(--muted); }
.mt { margin-top: 16px; }

.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.tile b { font-family: var(--display); font-size: 1.5rem; display: block; font-variant-numeric: tabular-nums; }
.tile span { font-size: 0.78rem; color: var(--muted); display: block; }
.tile .approx { font-size: 0.72rem; color: var(--warn-ink); }
.two { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; }
.fleetmap { position: relative; height: 420px; border-radius: 10px; overflow: hidden; background: #edf1e6; }
#owner-map { position: absolute; inset: 0; }

.scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tbl th, .tbl td { text-align: left; padding: 8px 5px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th:first-child, .tbl td:first-child { padding-left: 0; }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; }
.tbl th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.tbl td .dot { margin-right: 6px; }
.tbl td.van { white-space: nowrap; }
.tbl td.actions, .tbl td.nowrap { white-space: nowrap; }
.tbl td.van { white-space: nowrap; }
.tbl td.actions, .tbl td.nowrap { white-space: nowrap; }
.tbl .msgbtn { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.tbl .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tbl .confirm { display: inline-flex; gap: 6px; align-items: center; font-size: 0.8rem; flex-wrap: wrap; }
.tbl input.inline { padding: 5px 8px; width: 130px; }
.tbl input[type="color"] { width: 40px; height: 28px; padding: 1px; }
.tbl .empty { color: var(--muted); }
.addvan { margin-top: 12px; }

.form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: 600px; }
.form label { font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; display: block; margin-bottom: 4px; }
.form input[type="text"], .form select { width: 100%; }
.logo-row { display: flex; gap: 14px; align-items: center; }
.logo-row > .stack { min-width: 0; flex: 1; grid-template-columns: minmax(0, 1fr); }
.logo-row input[type="file"] { width: 100%; }
.logo-preview {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: var(--acc, var(--brand));
  color: var(--acc-ink, #fff);
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.4rem;
  overflow: hidden;
  flex: none;
}
.logo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.swatch { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.swatch .prev { border-radius: 12px; padding: 10px 16px; font-family: var(--display); font-weight: 800; background: var(--acc, var(--brand)); color: var(--acc-ink, #fff); }

.hot { list-style: none; margin: 0 0 6px; padding: 0; }
.hot li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.hot .where { width: 170px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hot .bar { flex: 1; height: 10px; background: var(--soft); border-radius: 5px; overflow: hidden; }
.hot .bar i { display: block; height: 100%; width: var(--w, 0%); background: var(--acc, var(--brand)); }
.hot b { min-width: 26px; text-align: right; font-variant-numeric: tabular-nums; }

.sharegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card-preview { display: block; width: 100%; max-width: 440px; height: 96px; border: 0; margin: 8px 0; }
.linkrow { display: flex; gap: 8px; align-items: center; }
.linkrow a { flex: 1; background: var(--soft); border-radius: 10px; padding: 9px 12px; font-size: 0.9rem; overflow-wrap: anywhere; color: var(--fg); text-decoration: none; }
.later-note { background: #fff4d6; border-radius: 12px; padding: 12px 14px; font-size: 0.9rem; }
.passkey-list { list-style: none; padding: 0; margin: 0 0 0.5rem; display: grid; gap: 0.5rem; }
.passkey-list li { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

dialog { border: 0; border-radius: 16px; box-shadow: var(--shadow); max-width: min(520px, 92vw); padding: 22px; background: #fff; color: var(--fg); }
dialog::backdrop { background: rgba(43, 35, 32, 0.5); }
dialog h3 { font-size: 1.15rem; margin-bottom: 6px; }
dialog .qr { margin: 10px auto; }

.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: #2b2320;
  color: #fff;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  z-index: 11;
  box-shadow: var(--shadow);
}

@media (max-width: 900px) {
  .dash { grid-template-columns: minmax(0, 1fr); }
  .dash nav { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 8px; }
  .dash nav .brand { padding: 0 6px 0 0; }
  /* min-width 0 lets the row of pages scroll sideways instead of widening the whole page on phones. */
  .dash nav .pages { flex-direction: row; overflow-x: auto; flex: 1 1 0; min-width: 0; scrollbar-width: none; }
  .dash nav .pages a { white-space: nowrap; padding: 8px 10px; font-size: 0.85rem; }
  .dash nav .biz { margin: 0; border: 0; padding: 0; width: 100%; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }
  .dash main { padding: 14px 12px 40px; }
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .two, .sharegrid { grid-template-columns: 1fr; }
  .fleetmap { height: 320px; }
  .tbl thead { display: none; }
  .tbl tr { display: grid; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .tbl td { display: block; border: 0; padding: 0; }
  .tbl .actions { justify-content: flex-start; }
}

/* ---------- slice 5: areas, schedules, run history, heatmap ---------- */
:root { --area: #6a4fcf; --area-soft: #ece7fb; --area-ink: #3f2c95; --edit: #e0457b; }
.spread { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grow { min-width: 0; flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { border: 1px solid var(--line); background: #fff; color: var(--fg); border-radius: 999px; padding: 4px 11px; font-size: 0.8rem; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.chip[aria-pressed="true"] { background: var(--fg); color: #fff; border-color: var(--fg); }
.chip .dot { width: 10px; height: 10px; margin: 0; }
.fleetmap .viewchips { position: absolute; left: 10px; right: 60px; bottom: 10px; z-index: 2; }
.fleetmap .viewchips .chip { box-shadow: var(--shadow-sm); }
.tag { display: inline-block; border-radius: 999px; padding: 1px 8px; font-size: 0.72rem; font-weight: 700; background: var(--soft); color: #5a4e48; white-space: nowrap; }
.tag.primary { background: var(--area-soft); color: var(--area-ink); }
.tag.pub { background: #fff1dc; color: #8a5a12; }
a.button.sm { padding: 5px 10px; font-size: 0.8rem; }
.status { border-radius: 10px; padding: 9px 11px; font-size: 0.85rem; min-height: 1em; }
.status.ok { background: var(--ok-bg); color: var(--ok-ink); }
.status.bad { background: var(--danger-bg); color: #9b2626; }
.status.info { background: var(--soft); color: #4a403b; }
.status:empty { display: none; }
.field label { font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; display: block; margin-bottom: 4px; }
.field input[type="text"], .field select { width: 100%; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 0.88rem; }
.check input { margin-top: 3px; }
.bigmap { position: relative; border-radius: 10px; overflow: hidden; background: #edf1e6; }
.bigmap > div:first-child { position: absolute; inset: 0; }
.mapcard { padding: 10px; }
.overlay { position: absolute; left: 10px; top: 10px; right: 60px; z-index: 2; pointer-events: none; display: flex; }
.hintbar { background: rgba(43, 35, 32, 0.88); color: #fff; border-radius: 999px; padding: 6px 12px; font-size: 0.8rem; }
.map-label { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font-family: var(--display); font-weight: 800; font-size: 0.8rem; color: var(--area-ink); text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff; pointer-events: none; }
.finish-dot { position: absolute; width: 18px; height: 18px; padding: 0; transform: translate(-50%, -50%); border-radius: 50%; background: var(--edit); border: 3px solid #fff; box-shadow: var(--shadow-sm); cursor: pointer; }

.areas { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 14px; align-items: start; }
#areas-mapbox { height: 640px; }
.alist { display: grid; gap: 8px; max-height: 520px; overflow: auto; padding: 2px; }
.acard { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; cursor: pointer; }
.acard:hover { border-color: #c9bdf0; }
.acard[aria-current="true"] { border-color: var(--area); box-shadow: 0 0 0 2px rgba(106, 79, 207, 0.2); cursor: default; }
.acard .t { display: flex; gap: 10px; align-items: center; }
.acard .nm { font-family: var(--display); font-weight: 800; overflow-wrap: anywhere; }
.shape-icon { width: 26px; height: 26px; flex: none; }
.shapeopt { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); background: #fff; color: var(--fg); border-radius: 12px; padding: 12px; text-align: left; width: 100%; font-weight: 400; }
.shapeopt:hover { border-color: var(--area); }
.shapeopt .shape-icon { width: 40px; height: 40px; }
.shapeopt b { display: block; }
.shapeopt span span { font-family: var(--body); font-size: 0.82rem; color: var(--muted); }

.sched { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 14px; align-items: start; }
.week { display: grid; grid-template-columns: 52px repeat(7, minmax(62px, 1fr)); gap: 0 6px; min-width: 560px; margin-top: 10px; }
.week .dh { text-align: center; font-family: var(--display); font-weight: 800; font-size: 0.85rem; padding-bottom: 6px; }
.week .dh.today { color: var(--brand-ink); }
.week .times, .week .col { position: relative; height: var(--h); }
.week .times span { position: absolute; right: 4px; top: var(--top); font-size: 0.68rem; color: var(--muted); transform: translateY(-50%); }
.week .col { background: repeating-linear-gradient(#fff 0 25px, var(--line) 25px 26px); border-radius: 8px; border: 1px solid var(--line); }
.blk { position: absolute; left: 3px; right: 3px; top: var(--top); height: var(--h); border-radius: 8px; background: var(--area-soft); color: var(--area-ink); text-align: left; padding: 4px 6px; font-family: var(--body); font-weight: 400; font-size: 0.72rem; line-height: 1.25; overflow: hidden; border: 1px solid #cfc3f5; }
.blk b { display: block; font-family: var(--display); font-size: 0.78rem; }
.blk.paused { background: repeating-linear-gradient(135deg, #f4f0ea 0 6px, #ebe4da 6px 12px); color: var(--muted); border-color: var(--line); }
.blk[aria-current="true"] { outline: 3px solid var(--area); outline-offset: 1px; }
.days { display: flex; gap: 4px; flex-wrap: wrap; }
.days button { border: 1px solid var(--line); background: #fff; color: var(--fg); border-radius: 8px; width: 40px; padding: 6px 0; font-size: 0.8rem; }
.days button[aria-pressed="true"] { background: var(--area); border-color: var(--area); color: #fff; }
.two-sel { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: center; }
.usual { border: 1px dashed #d8b36c; background: #fffaf0; border-radius: 12px; padding: 10px 12px; font-size: 0.85rem; }
.usual b { font-family: var(--display); }

.hist { display: grid; grid-template-columns: 318px minmax(0, 1fr); gap: 14px; align-items: start; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 6px; }
.cal .dh { text-align: center; font-size: 0.7rem; font-weight: 700; color: var(--muted); }
.cal button { border: 1px solid var(--line); background: #fff; color: var(--fg); border-radius: 8px; height: 42px; padding: 3px 4px; display: grid; align-content: space-between; text-align: left; font-family: var(--body); font-weight: 400; font-size: 0.72rem; }
.cal button .hb { height: 5px; width: var(--w); border-radius: 3px; background: var(--vc, var(--brand)); }
.cal button.none { background: transparent; color: #b5aba2; border-style: dashed; cursor: default; }
.cal button[aria-current="true"] { outline: 3px solid var(--fg); outline-offset: 1px; }
.tl { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow: auto; }
.tl li { display: grid; grid-template-columns: 62px 1fr; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: 0.82rem; align-items: baseline; }
.tl .tm { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.76rem; }
.tl li.drive { color: var(--muted); font-size: 0.76rem; }
.tl li.stop { cursor: pointer; }
.tl li.stop:hover, .tl li.stop[aria-current="true"] { background: var(--soft); }
.tl .num { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--c); color: #fff; font-weight: 800; font-size: 0.7rem; margin-right: 4px; font-family: var(--display); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.stats div { background: var(--soft); border-radius: 10px; padding: 8px 10px; }
.stats b { font-family: var(--display); font-size: 1.15rem; display: block; font-variant-numeric: tabular-nums; }
.stats span { font-size: 0.74rem; color: var(--muted); }
.hist-map { height: 420px; }
.scrub { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; font-size: 0.82rem; }
.scrub input { width: 100%; accent-color: var(--fg); }
.scrub output { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 64px; }
.stop-dot, .start-dot { position: absolute; transform: translate(-50%, -50%); display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 2px solid #fff; box-shadow: var(--shadow-sm); font-family: var(--display); font-weight: 800; font-size: 0.72rem; color: #fff; }
.stop-dot { background: var(--c); cursor: pointer; }
.stop-dot.on { width: 30px; height: 30px; border-color: var(--fg); }
.start-dot { background: var(--fg); border-radius: 6px; width: 20px; height: 20px; }

.heatctl { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.seg2 { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.seg2 button { border-radius: 0; background: #fff; color: var(--fg); padding: 6px 11px; font-size: 0.82rem; }
.seg2 button + button { border-left: 1px solid var(--line); }
.seg2 button[aria-pressed="true"] { background: var(--fg); color: #fff; }
.dates { display: inline-flex; gap: 6px; align-items: center; font-size: 0.82rem; }
.heatgrid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.heatgrid.compare { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.heatgrid.compare #heat-side { grid-column: 1 / -1; grid-template-columns: auto auto 1fr; align-items: start; }
.heat-map { height: 420px; }
.heatgrid.compare .heat-map { height: 340px; }
.legend { display: flex; gap: 3px; align-items: center; font-size: 0.72rem; color: var(--muted); flex-wrap: wrap; }
.legend i { width: 22px; height: 10px; display: inline-block; background: var(--c); border-radius: 2px; }
.bignum { font-family: var(--display); font-weight: 800; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.chart { display: block; width: 100%; min-width: 520px; height: auto; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { font-size: 11px; fill: var(--muted); font-family: var(--body); }

@media (max-width: 900px) {
  .areas, .sched, .hist, .heatgrid, .heatgrid.compare { grid-template-columns: minmax(0, 1fr); }
  .heatgrid.compare #heat-side { grid-template-columns: minmax(0, 1fr); }
  #areas-mapbox { height: 420px; }
  .hist-map, .heat-map, .heatgrid.compare .heat-map { height: 320px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hot .where { width: 120px; }
}
/* A checkbox with its label inside a .stack (whose labels are otherwise block and bold). */
.stack label.check { display: flex; font-weight: 400; }
.stack .field label { display: block; }
