/* Total Towing CRM. Visual system from DESIGN.md: monochrome paper, hairline rings,
   Geist Sans for reading, Geist Mono for labels. Terminal Green is the only color. */

:root {
  --paper: #fafafa;
  --white: #ffffff;
  --hairline: #ebebeb;
  --ash: #c9c9c9;
  --smoke: #a8a8a8;
  --stone: #666666;
  --charcoal: #4d4d4d;
  --obsidian: #171717;
  --green: #297a3a;

  --font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 6px;
  --ring: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 0 0 2px var(--paper);
  --ring-hair: 0 0 0 1px var(--hairline);
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--obsidian);
  font: 400 16px/1.5 var(--font-sans);
  font-feature-settings: "calt" 0, "rlig", "ss11";
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* Mono stamp: labels, metadata, eyebrows */
.eyebrow, .field > label, .label, .section-title, .pill, .dl dt, .hint-mono {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.071em;
  text-transform: uppercase;
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgb(250 250 250 / 0.8);
  backdrop-filter: saturate(1.4) blur(20px);
  -webkit-backdrop-filter: saturate(1.4) blur(20px);
  box-shadow: 0 1px 0 var(--hairline);
}
.topbar-inner {
  max-width: 880px;
  margin: 0 auto;
  height: 60px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.2px;
  text-decoration: none;
  white-space: nowrap;
}
.brand::before {
  content: "TT";
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius);
  background: var(--obsidian);
  color: var(--white);
  font: 600 11px/1 var(--font-mono);
  letter-spacing: 0.04em;
}
.brand .accent { color: var(--stone); font-weight: 400; }
.brand-short { display: none; }
.topnav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; }
.topnav a, .topnav button {
  color: var(--charcoal);
  text-decoration: none;
  background: none;
  border: 0;
  font: 400 14px/1 var(--font-sans);
  padding: 9px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
}
.topnav a:hover, .topnav button:hover { color: var(--obsidian); background: var(--hairline); }
.topnav a.active { color: var(--obsidian); font-weight: 500; box-shadow: var(--ring-hair); background: var(--white); }
@media (max-width: 480px) {
  .brand-full { display: none; }
  .topbar-inner { padding: 0 8px 0 16px; gap: 6px; height: 56px; }
  .topnav a, .topnav button { padding: 9px 7px; font-size: 13px; }
}

main { max-width: 880px; margin: 0 auto; padding: 32px 16px 96px; }
main.narrow { max-width: 640px; }

h1 {
  font-size: 30px;
  font-weight: 450;
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin: 0 0 8px;
}
h1.display { font-size: clamp(36px, 8vw, 56px); line-height: 1; letter-spacing: -0.06em; }
h2 { font-size: 16px; font-weight: 500; letter-spacing: -0.2px; margin: 0 0 16px; }
.sub { color: var(--charcoal); margin: 0 0 24px; }
.eyebrow { color: var(--obsidian); margin: 0 0 12px; display: block; }

/* Bordered card: depth from hairline rings, never drop shadows */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--ring);
  padding: 16px;
  margin-bottom: 16px;
}
@media (min-width: 560px) { .card { padding: 20px 24px; } }
.card > h2 {
  font: 500 11px/1.5 var(--font-mono);
  letter-spacing: 0.071em;
  text-transform: uppercase;
  color: var(--stone);
  padding-bottom: 12px;
  margin: 0 0 16px;
  box-shadow: 0 1px 0 var(--hairline);
}

details.card summary { cursor: pointer; font-weight: 500; list-style: none; display: flex; justify-content: space-between; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after { content: "+"; font-family: var(--font-mono); color: var(--stone); }
details.card[open] summary::after { content: "\2212"; }

.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) {
  .grid.two { grid-template-columns: 1fr 1fr; }
  .grid.three { grid-template-columns: 1fr 1fr 1fr; }
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { color: var(--charcoal); }
.req { color: var(--obsidian); }
.hint { color: var(--stone); font-size: 13px; line-height: 1.54; }

input[type="text"], input[type="tel"], input[type="email"], input[type="number"], input[type="password"],
input[type="search"], textarea, select {
  width: 100%;
  font: 400 16px/1.4 var(--font-sans); /* 16px stops iPhone zooming in */
  color: var(--obsidian);
  background: var(--white);
  border: 0;
  box-shadow: 0 0 0 1px var(--hairline);
  border-radius: var(--radius);
  padding: 11px 12px;
  min-height: 46px;
  transition: box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--smoke); }
input:hover, textarea:hover { box-shadow: 0 0 0 1px var(--ash); }
input:focus, textarea:focus, select:focus { outline: none; box-shadow: 0 0 0 1px var(--obsidian), 0 0 0 4px rgba(0, 0, 0, 0.06); }
input[readonly] { background: var(--paper); color: var(--charcoal); font-family: var(--font-mono); font-size: 14px; }
textarea { min-height: 96px; resize: vertical; }
input.upper { text-transform: uppercase; }

.money { position: relative; }
.money::before { content: "$"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--stone); font-family: var(--font-mono); z-index: 1; }
.money input { padding-left: 26px; }

/* Choice chips (radio / checkbox) */
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 9px 14px;
  border-radius: 9999px;
  background: var(--white);
  box-shadow: 0 0 0 1px var(--hairline);
  color: var(--charcoal);
  font-size: 15px;
  user-select: none;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
}
.chip:hover span { box-shadow: 0 0 0 1px var(--ash); color: var(--obsidian); }
.chip input:checked + span { background: var(--obsidian); color: var(--white); box-shadow: 0 0 0 1px var(--obsidian); }
.chip input:focus-visible + span { outline: 2px solid var(--obsidian); outline-offset: 2px; }
.chip.check input:checked + span::before { content: "\2713"; font-family: var(--font-mono); font-size: 13px; }

.moods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.moods .chip span {
  flex-direction: column;
  width: 100%;
  border-radius: var(--radius);
  padding: 14px 6px;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.071em;
  text-transform: uppercase;
}
.moods .chip span b { font-size: 30px; line-height: 1; font-weight: 400; filter: grayscale(1); letter-spacing: 0; }
.moods .chip input:checked + span b { filter: none; }

.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 44px; color: var(--obsidian); }
.toggle input { width: 20px; height: 20px; accent-color: var(--obsidian); }

.hidden { display: none !important; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: 500 15px/1 var(--font-sans);
  min-height: 48px;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 0;
  background: var(--obsidian);
  color: var(--white);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.btn:hover { background: #383838; }
.btn:disabled { opacity: 0.5; cursor: wait; }
.btn:focus-visible { outline: 2px solid var(--obsidian); outline-offset: 2px; }
.btn.block { width: 100%; }
.btn.big { min-height: 54px; font-size: 16px; }
.btn.wa { background: var(--green); }
.btn.wa::before { content: "\2192"; font-family: var(--font-mono); }
.btn.wa:hover { background: #22662f; }
.btn.outline { background: var(--white); color: var(--charcoal); box-shadow: var(--ring-hair); }
.btn.outline:hover { color: var(--obsidian); box-shadow: 0 0 0 1px var(--ash); }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: 14px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-row .btn { flex: 1 1 200px; }

/* Messages. Errors use the inverted surface so they stand out without color. */
.alert {
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 15px;
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.alert::before { font-family: var(--font-mono); font-weight: 600; flex: none; }
.alert.error { background: var(--obsidian); color: var(--white); }
.alert.error::before { content: "\2715"; }
.alert.ok { background: var(--white); color: var(--obsidian); box-shadow: var(--ring); }
.alert.ok::before { content: "\2713"; color: var(--green); }
.alert.warn, .alert.info { background: var(--white); color: var(--charcoal); box-shadow: var(--ring-hair); }
.alert.warn::before { content: "!"; color: var(--obsidian); }

/* CLI output panel: message previews */
.preview {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--paper);
  box-shadow: var(--ring-hair);
  border-radius: var(--radius);
  padding: 14px 16px;
  font: 400 12.5px/1.6 var(--font-mono);
  color: var(--obsidian);
  max-height: 360px;
  overflow: auto;
  margin: 0 0 16px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--obsidian);
  color: var(--white);
  padding: 10px 16px;
  border-radius: var(--radius);
  font: 400 13px/1.4 var(--font-mono);
  z-index: 100;
  max-width: calc(100% - 32px);
}

/* Photos */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-bottom: 12px; }
.thumbs:empty { display: none; }
.thumb { position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--paper); box-shadow: var(--ring-hair); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-x {
  position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: var(--radius);
  border: 0; background: rgb(23 23 23 / 0.8); color: var(--white); font-size: 16px; line-height: 1; cursor: pointer;
}

/* Status pills */
.pill {
  display: inline-block; padding: 3px 8px; border-radius: 9999px; white-space: nowrap;
  background: var(--white); color: var(--charcoal); box-shadow: var(--ring-hair);
}
.pill.completed { color: var(--green); }
.pill.completed::before { content: "\2713  "; white-space: pre; }
.pill.open::before { content: "\25CB  "; white-space: pre; }
.pill.bad { background: var(--obsidian); color: var(--white); box-shadow: none; }

/* Home tiles */
.tiles { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .tiles { grid-template-columns: 1fr 1fr; } }
.tile {
  display: flex; flex-direction: column; gap: 4px; text-decoration: none;
  background: var(--white); border-radius: var(--radius); box-shadow: var(--ring);
  padding: 20px; min-height: 128px; transition: box-shadow 0.15s;
}
.tile:hover { box-shadow: 0 0 0 1px var(--obsidian), 0 0 0 2px var(--paper); }
.tile .icon { font: 500 11px/1.5 var(--font-mono); letter-spacing: 0.071em; text-transform: uppercase; color: var(--stone); margin-bottom: auto; padding-bottom: 20px; }
.tile b { display: flex; justify-content: space-between; font-size: 18px; font-weight: 500; letter-spacing: -0.3px; }
.tile b::after { content: "\2192"; font-family: var(--font-mono); font-weight: 400; color: var(--smoke); }
.tile:hover b::after { color: var(--obsidian); }
.tile small { color: var(--charcoal); font-size: 14px; }
.tile.inverted { background: var(--obsidian); box-shadow: none; }
.tile.inverted b, .tile.inverted small { color: var(--white); }
.tile.inverted .icon, .tile.inverted b::after { color: var(--smoke); }
.tile.soon { background: transparent; box-shadow: 0 0 0 1px var(--hairline); pointer-events: none; min-height: 96px; }
.tile.soon b, .tile.soon small { color: var(--smoke); }
.tile.soon b::after { content: ""; }
.section-title { color: var(--stone); margin: 40px 0 12px; }

/* Jobs list */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.toolbar input { flex: 1 1 220px; }
.tabs { display: flex; gap: 2px; padding: 3px; background: var(--white); border-radius: var(--radius); box-shadow: var(--ring-hair); }
.tabs button {
  font: 500 11px/1 var(--font-mono); letter-spacing: 0.071em; text-transform: uppercase;
  min-height: 40px; padding: 0 14px; border-radius: 4px;
  border: 0; background: transparent; color: var(--stone); cursor: pointer;
}
.tabs button:hover { color: var(--obsidian); }
.tabs button.active { background: var(--obsidian); color: var(--white); }
.job-row {
  display: block; text-decoration: none; background: var(--white); border-radius: var(--radius);
  box-shadow: var(--ring); padding: 14px 16px; margin-bottom: 8px; transition: box-shadow 0.15s;
}
.job-row:hover { box-shadow: 0 0 0 1px var(--obsidian), 0 0 0 2px var(--paper); }
.job-row .top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.job-row .tt { font: 600 13px/1 var(--font-mono); letter-spacing: 0.02em; }
.job-row .when { margin-left: auto; color: var(--stone); font: 400 12px/1.5 var(--font-mono); }
.job-row .meta { color: var(--stone); font-size: 14px; margin-top: 2px; }
.empty { text-align: center; color: var(--stone); padding: 48px 16px; font: 400 13px/1.5 var(--font-mono); box-shadow: 0 0 0 1px var(--hairline); border-radius: var(--radius); }

/* Detail list */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; margin: 0; align-items: baseline; }
.dl dt { color: var(--stone); }
.dl dd { margin: 0; word-break: break-word; color: var(--obsidian); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; padding: 28px 24px; }

/* Driver quick actions: call and navigate */
.quick { display: flex; flex-direction: column; gap: 14px; }
.qa-place { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; box-shadow: 0 -1px 0 var(--hairline); }
.qa-where { display: flex; flex-direction: column; gap: 2px; }
.qa-where .label { color: var(--stone); }

/* Add to home screen */
.install { display: flex; flex-direction: column; gap: 12px; }
.install ol { margin: 0; padding-left: 20px; color: var(--charcoal); }
.install ol li { margin: 4px 0; }
.kbd { font: 500 12px/1 var(--font-mono); padding: 3px 6px; border-radius: 4px; box-shadow: var(--ring-hair); background: var(--paper); }

/* Jobs saved on the phone, waiting for signal */
.outbox-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 880px; margin: 0 auto; padding: 8px 16px;
  font: 400 12px/1.4 var(--font-mono); color: var(--obsidian);
}
.outbox-bar::before { content: "CF"; color: var(--obsidian); animation: pulse 1.6s ease-in-out infinite; }
.outbox-bar span { flex: 1; }
.outbox-bar button {
  font: 500 12px/1 var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--obsidian); color: var(--white); border: 0; border-radius: var(--radius);
  padding: 9px 12px; min-height: 36px; cursor: pointer; flex: none;
}
@keyframes pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .outbox-bar::before { animation: none; } }

.sub.tight { margin: 0 0 12px; }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
