/* SkipOps Lite — design tokens + base styles. Source of truth: DESIGN.md. */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #131216;
  --surface: #1B1A1F;
  --surface-2: #211F26;
  --inset: #0F0E12;
  --border: #2C2A31;
  --border-strong: #3C3A43;
  --ink: #F7F5F1;
  --soft: #C6C1B8;
  --muted: #928E84;
  --amber: #F7A11A;
  --on-amber: #17150F;
  --amber-text: #FFC24B;
  --signal: #2AABEE;
  --go: #2BD576;
  --warn: #FFC24B;
  --stop: #E5484D;
  --radius-card: 15px;
  --radius-control: 11px;
  --font-head: 'Fraunces', Georgia, serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 430px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

h1, h2 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}
h1 { font-size: 28px; }
h2 { font-size: 21px; }

p { margin: 0 0 16px; color: var(--soft); }

a { color: var(--amber-text); word-break: break-all; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px 16px;
  margin: 0 0 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 24px 40px -18px rgba(0, 0, 0, 0.5);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 12px 20px;
  background: var(--amber);
  color: var(--on-amber);
  border: 0;
  border-radius: var(--radius-control);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: filter 180ms ease-out;
}
.btn:hover { filter: brightness(1.06); }
.btn:focus-visible { outline: 3px solid var(--amber-text); outline-offset: 2px; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 12px 20px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 180ms ease-out, background-color 180ms ease-out;
}
.btn-ghost:hover { border-color: var(--muted); background: var(--surface); }
.btn-ghost:focus-visible { outline: 3px solid var(--amber-text); outline-offset: 2px; }

.field { margin: 0 0 18px; }
.field label {
  display: block;
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--soft);
}
.field input, .field textarea, .field select {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  background: var(--inset);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  font-family: var(--font-body);
  font-size: 16px;
}
.field textarea { resize: vertical; }
.field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23928E84' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 0;
  border-color: var(--amber);
}

.namelist { display: flex; flex-direction: column; gap: 10px; margin: 0 0 24px; }
.namelist form { margin: 0; }
.namelist button {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 14px 18px;
  text-align: left;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 180ms ease-out, background-color 180ms ease-out;
}
.namelist button:hover { border-color: var(--amber); background: var(--surface-2); }
.namelist button:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.btn svg, .btn-ghost svg { flex: none; }
.hint {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin: 6px 4px 0;
}

.msglist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.msglist li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 12px 14px;
}
.msgmeta { display: block; font-size: 12px; color: var(--muted); margin: 0 0 4px; }
.msgbody { display: block; font-size: 15px; color: var(--ink); word-break: break-all; }

.rowlist { list-style: none; margin: 0 0 16px; padding: 0; }
.rowlist li {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 10px 2px;
  font-size: 17px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.rowlist li:last-child { border-bottom: 0; }

.personlist { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.personhead { display: flex; align-items: baseline; gap: 10px; margin: 0 0 8px; }
.personname { font-size: 17px; font-weight: 700; }
.roletag {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 2px 10px;
}

.chiprow { display: flex; flex-wrap: wrap; gap: 8px; }
.chiprow form { margin: 0; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 9px 16px;
  background: var(--inset);
  color: var(--soft);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 180ms ease-out, color 180ms ease-out, background-color 180ms ease-out;
}
.chip:hover { border-color: var(--muted); color: var(--ink); }
.chip:focus-visible, .chip:focus-within { outline: 3px solid var(--amber-text); outline-offset: 2px; }
.chip[aria-pressed='true'], .chip:has(input:checked) {
  background: var(--amber);
  color: var(--on-amber);
  border-color: var(--amber);
}
.chip input[type='radio'], .chip input[type='checkbox'] { position: absolute; opacity: 0; pointer-events: none; }
label.chip { position: relative; }

.addbox summary.addrow {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-control);
  color: var(--soft);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 180ms ease-out, color 180ms ease-out;
}
.addbox summary.addrow::-webkit-details-marker { display: none; }
.addbox summary.addrow:hover { border-color: var(--muted); color: var(--ink); }
.addbox summary.addrow:focus-visible { outline: 3px solid var(--amber-text); outline-offset: 2px; }
.addbox[open] summary.addrow { display: none; }
.addbox form { margin-top: 16px; }
.addbox .chiprow { margin: 0 0 18px; }

.field-error { color: var(--stop); font-size: 14px; font-weight: 600; margin: 6px 0 0; }
.hidden { display: none; }

.results { display: flex; flex-direction: column; gap: 8px; margin: 0 0 14px; }
.results:empty { margin: 0; }
.resultrow {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  text-align: left;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 180ms ease-out;
}
.resultrow:hover { border-color: var(--amber); }
.resultrow:focus-visible { outline: 3px solid var(--amber-text); outline-offset: 2px; }

/* Customer tabs: visually-hidden radios drive segment styling AND pane
   visibility, so the toggle needs no JS and the tab posts with the form. */
.tabswitch { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin: 0 0 18px;
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
}
.seg label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: color 180ms ease-out, background-color 180ms ease-out, border-color 180ms ease-out;
}
#tab-new:checked ~ .seg label[for='tab-new'],
#tab-existing:checked ~ .seg label[for='tab-existing'] {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--on-amber);
  font-weight: 700;
}
#tab-new:focus-visible ~ .seg label[for='tab-new'],
#tab-existing:focus-visible ~ .seg label[for='tab-existing'] {
  outline: 3px solid var(--amber-text);
  outline-offset: 2px;
}
#tab-new:checked ~ #pane-existing { display: none; }
#tab-existing:checked ~ #pane-new { display: none; }
.tabpane > .field:last-child { margin-bottom: 4px; }

.stepper { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; }
.stepper input {
  width: 72px;
  min-height: 48px;
  text-align: center;
  background: var(--inset);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  font-family: var(--font-body);
  font-size: 19px;
  font-weight: 700;
  -moz-appearance: textfield;
  appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { display: none; }
.stepper input:focus-visible { outline: 3px solid var(--amber); border-color: var(--amber); }
.stepbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex: none;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: border-color 180ms ease-out, background-color 180ms ease-out;
}
.stepbtn:hover { border-color: var(--muted); background: var(--surface-2); }
.stepbtn:focus-visible { outline: 3px solid var(--amber-text); outline-offset: 2px; }
.stepper-sm .stepbtn { width: 44px; height: 44px; }
.stepper-sm input { width: 56px; min-height: 44px; font-size: 17px; }

.wasterow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.wasterow:last-child { border-bottom: 0; }
.wasterow .stepper { margin: 0; }
.wastename { font-size: 16px; font-weight: 600; }
.wasteamount { color: var(--muted); font-weight: 600; margin-left: 8px; }

.alloc { font-size: 14px; font-weight: 600; color: var(--muted); margin: 10px 0 16px; }
.alloc-ok { color: var(--go); }

.addtype { display: flex; gap: 10px; }
.addtype input {
  flex: 1;
  min-height: 48px;
  padding: 10px 14px;
  background: var(--inset);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  font-family: var(--font-body);
  font-size: 16px;
}
.addtype input:focus-visible { outline: 3px solid var(--amber); border-color: var(--amber); }
.addtype .btn-ghost { width: auto; padding: 12px 22px; }

.joblist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.joblist a {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: 'who load' 'where load';
  align-items: center;
  column-gap: 12px;
  min-height: 64px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  text-decoration: none;
  color: var(--ink);
  word-break: normal;
  transition: border-color 180ms ease-out;
}
.joblist a:hover { border-color: var(--border-strong); }
.joblist a:focus-visible { outline: 3px solid var(--amber-text); outline-offset: 2px; }
.jobwho { grid-area: who; font-size: 17px; font-weight: 700; }
.jobwhere { grid-area: where; font-size: 14px; color: var(--muted); }
.jobload { grid-area: load; font-size: 15px; font-weight: 700; color: var(--soft); }
.jobload-big { font-size: 19px; font-weight: 700; color: var(--ink); }

.photogrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 14px; }
.photogrid:empty { margin: 0; }
.photoform { display: flex; flex-direction: column; gap: 10px; }
.photoform input[type='file'] {
  min-height: 48px;
  padding: 11px 14px;
  background: var(--inset);
  color: var(--soft);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  font-family: var(--font-body);
  font-size: 15px;
}
.photoform input[type='file']:focus-visible { outline: 3px solid var(--amber); border-color: var(--amber); }

.photogrid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
}

/* Video spans the full grid width: controls need room, cropping them is useless. */
.photogrid video {
  grid-column: 1 / -1;
  width: 100%;
  max-height: 60vh;
  background: var(--inset);
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
}

.bottomnav {
  position: fixed;
  inset: auto 0 0 0;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 30;
}
.bottomnav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 64px;
  padding: 8px 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  word-break: normal;
  transition: color 180ms ease-out;
}
.bottomnav a:hover { color: var(--soft); }
.bottomnav a.active { color: var(--amber-text); }
.bottomnav a:focus-visible { outline: 3px solid var(--amber-text); outline-offset: -3px; border-radius: 8px; }
body.has-nav { padding-bottom: 84px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
