/* ALC Internal System - Direction A in the store palette (spec section 10).
   Primary teal, accent lime, warm beige background, saturated status colours.
   Form stays quiet and slick: hairline dividers, photo-first rows, small pills.
   Red is reserved for exceptions and corrections. */

:root {
  --teal: #0e6b7a;
  --teal-dark: #0a4f5a;
  --lime: #bcc31d;
  --beige: #f4f1ec;
  --ink: #1c1a17;
  --muted: #6f675c;
  --line: #ddd6c9;

  /* Stage colours, carried over from the approved prototype. */
  --st-to_test: #2563eb;
  --st-in_repair: #d97706;
  --st-waiting_part: #7c3aed;
  --st-to_price: #be123c;
  --st-ready: #15803d;
  --st-escalated: #c1272d;
  --st-sold: #6f675c;
  --st-neutral: #6f675c;

  --tap: 48px; /* No interactive element under 48px for floor roles (spec 5.7). */
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--beige);
  color: var(--ink);
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}

.app-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--teal); color: #fff;
  padding: 10px 16px;
}
.app-title { font-weight: 800; font-size: 19px; letter-spacing: .01em; }
.app-title span { font-weight: 400; opacity: .85; font-size: 14px; }
.session-chip { font-size: 13px; opacity: .95; }

.view { max-width: 720px; margin: 0 auto; padding: 14px 14px 24px; }
.view h1 { font-size: 21px; margin: 6px 0 10px; }
.view h2 { font-size: 16px; margin: 18px 0 8px; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  flex: 1; text-align: center; text-decoration: none; color: var(--muted);
  font-size: 13px; font-weight: 600; padding: 12px 0 10px; min-height: var(--tap);
}
.bottom-nav a.active { color: var(--teal-dark); box-shadow: inset 0 3px 0 var(--lime); }
.bottom-nav a.hidden { display: none; }

/* Boards (spec 6.14): one card per stage, count, oldest age. */
.board-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stage-card {
  background: #fff; border: 1px solid var(--line); border-left: 8px solid var(--st-neutral);
  border-radius: 10px; padding: 10px 12px; text-decoration: none; color: var(--ink);
  min-height: var(--tap);
}
.stage-card .count { font-size: 24px; font-weight: 800; }
.stage-card .label { font-size: 14px; font-weight: 700; }
.stage-card .age { font-size: 12px; color: var(--muted); }
.stage-card[data-stage="to_test"] { border-left-color: var(--st-to_test); }
.stage-card[data-stage="in_repair"] { border-left-color: var(--st-in_repair); }
.stage-card[data-stage="waiting_part"] { border-left-color: var(--st-waiting_part); }
.stage-card[data-stage="to_price"] { border-left-color: var(--st-to_price); }
.stage-card[data-stage="ready"] { border-left-color: var(--st-ready); }
.stage-card[data-stage="escalated"] { border-left-color: var(--st-escalated); }

/* Small status pill, used on unit rows everywhere. */
.pill {
  display: inline-block; font-size: 11.5px; font-weight: 700; color: #fff;
  border-radius: 999px; padding: 2px 9px; background: var(--st-neutral);
}
.pill[data-stage="to_test"] { background: var(--st-to_test); }
.pill[data-stage="in_repair"] { background: var(--st-in_repair); }
.pill[data-stage="waiting_part"] { background: var(--st-waiting_part); }
.pill[data-stage="to_price"] { background: var(--st-to_price); }
.pill[data-stage="ready"] { background: var(--st-ready); }
.pill[data-stage="escalated"] { background: var(--st-escalated); }
.pill[data-stage="sold"], .pill[data-stage="donor"], .pill[data-stage="scrapped"] { background: var(--st-sold); }

/* Photo-first rows (unit lists, contractor view). */
.unit-row {
  display: flex; gap: 12px; align-items: center; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px;
  text-decoration: none; color: var(--ink); min-height: 64px;
}
.unit-row img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: var(--beige); }
.unit-row .num { font-size: 20px; font-weight: 800; }
.unit-row .meta { font-size: 13px; color: var(--muted); }

/* Buttons: verb plus object, self-explanatory (review standard, Oct 29 2026). */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: 10px 16px; border-radius: 10px; border: 0;
  background: var(--teal); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
}
.btn.secondary { background: #fff; color: var(--teal-dark); border: 1.5px solid var(--teal); }
.btn.danger { background: var(--st-escalated); }
.btn.block { display: flex; width: 100%; margin-top: 10px; }

/* Two-step confirm bar (spec 6.3): state changes never fire on one abrupt tap. */
.confirm-bar {
  background: #fff7ed; border: 1.5px solid var(--st-in_repair); border-radius: 10px;
  padding: 12px; margin-top: 10px; font-size: 14px;
}
.confirm-bar .row { display: flex; gap: 10px; margin-top: 10px; }
.confirm-bar .row .btn { flex: 1; }

.notice {
  background: #fff; border: 1px solid var(--line); border-left: 8px solid var(--lime);
  border-radius: 10px; padding: 12px; font-size: 14px; line-height: 1.45;
}
input[type="text"], input[type="number"], input[type="tel"], select, textarea {
  width: 100%; min-height: var(--tap); font-size: 16px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
label.field { display: block; font-size: 13px; font-weight: 700; margin: 12px 0 4px; }

/* Desktop density (spec 5.7): same data, wider boards. */
@media (min-width: 1100px) {
  .view { max-width: 1100px; }
  .board-grid { grid-template-columns: repeat(4, 1fr); }
}


/* Authentication and live Slice 1 forms. */
.hidden { display: none !important; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-button {
  min-height: 36px; border: 1px solid rgba(255, 255, 255, .65); border-radius: 8px;
  background: transparent; color: #fff; font-weight: 700; cursor: pointer; padding: 6px 10px;
}
.mode-switcher {
  width: auto; min-height: 36px; font-size: 13px; padding: 5px 8px;
}
.auth-card, .profile-card, .test-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; margin-bottom: 12px;
}
.auth-card { max-width: 520px; margin: 20px auto; }
.auth-card h1 { margin-top: 0; }
.auth-switch { margin-top: 16px; font-size: 14px; }
.auth-switch a, .admin-alert { color: var(--teal-dark); font-weight: 700; }
.error { color: var(--st-escalated); font-size: 14px; font-weight: 700; margin-top: 10px; }
.success { color: var(--st-ready); font-size: 14px; font-weight: 700; margin-top: 10px; }
.form-row { display: flex; gap: 8px; align-items: stretch; }
.form-row > * { flex: 1; }
.form-row.spaced { margin-top: 6px; }
.grow { flex: 1; min-width: 0; }
.results { margin-top: 12px; }
.admin-alert {
  display: block; background: #fff; border: 1px solid var(--line);
  border-left: 8px solid var(--st-escalated); border-radius: 10px;
  padding: 12px; margin-bottom: 12px; text-decoration: none;
}
.unit-row.flat { border: 0; padding: 0; margin: 0; }
.meta.strong { color: var(--ink); font-weight: 700; }
fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 14px 0; padding: 10px; }
legend { font-size: 13px; font-weight: 800; padding: 0 5px; }
.check-grid, .pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check-item {
  display: flex; gap: 8px; align-items: center; min-height: var(--tap);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 14px;
}
.check-item input { width: 20px; height: 20px; flex: 0 0 auto; }
.pay-grid label span { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.assigned-number {
  background: #fff; border: 2px solid var(--st-ready); border-radius: 12px;
  padding: 18px; text-align: center; margin-top: 14px;
}
.assigned-number strong { display: block; font-size: 52px; line-height: 1.1; color: var(--teal-dark); }
.module-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.module-link {
  display: flex; align-items: center; min-height: 64px; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  color: var(--teal-dark); font-weight: 800; text-decoration: none;
}
input[type="email"], input[type="password"], input[type="date"] {
  width: 100%; min-height: var(--tap); font-size: 16px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
button:disabled { opacity: .55; cursor: wait; }

@media (max-width: 520px) {
  .app-header { align-items: flex-start; gap: 8px; }
  .header-actions { flex-wrap: wrap; justify-content: flex-end; }
  .session-chip { width: 100%; text-align: right; order: 3; }
  .check-grid, .pay-grid { grid-template-columns: 1fr; }
  .load-row { align-items: stretch; flex-direction: column; }
}


/* ------------------------------------------------------------------
   Slices 2 to 7 components. Direction A stays: teal primary, lime on
   the primary action, saturated stage colours, red only for exceptions.
   ------------------------------------------------------------------ */

.card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; margin-bottom: 12px;
}
.card h2, .card h3 { margin-top: 0; }
.muted { color: var(--muted); }
.strong { font-weight: 700; }
.small { font-size: 13px; }
.mt { margin-top: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
a.unit-row { cursor: pointer; }
button.unit-row { width: 100%; text-align: left; font: inherit; cursor: pointer; }

/* Key-value detail rows on unit, sale, claim, and stop cards. */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); font-weight: 600; }
.kv .v { font-weight: 700; text-align: right; }
.kv .v.big { font-size: 19px; }

/* Tappable identity fields (F10, F11): the field itself is the target,
   a small pencil mark shows it can be tapped. */
.tappable { cursor: pointer; }
.tappable::after { content: " \270E"; color: var(--muted); font-size: 12px; }
.inline-edit { display: flex; gap: 8px; align-items: stretch; margin-top: 6px; }
.inline-edit > * { flex: 1; }

/* Fault chips (F12): multi-select at testing, tap again to clear. */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip {
  min-height: var(--tap); padding: 8px 14px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--teal); background: #fff; color: var(--teal-dark);
  font-size: 14px; font-weight: 700;
}
.chip.selected { background: var(--teal); color: #fff; }
.fault-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.fault-row:last-child { border-bottom: 0; }

/* Timeline (spec 6.5): the unit's whole life, newest first. */
.timeline { margin-top: 6px; }
.timeline-entry { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.timeline-entry:last-child { border-bottom: 0; }
.timeline-entry .when { color: var(--muted); font-size: 12.5px; }
.timeline-entry.correction { border-left: 4px solid var(--st-escalated); padding-left: 8px; }

/* Stepper (F27): one step at a time, progress header, live gates (F28). */
.stepper-head { margin-bottom: 10px; }
.stepper-title { font-size: 16px; font-weight: 800; margin-bottom: 6px; }
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--lime); }
.stepper-bar { display: flex; gap: 10px; margin-top: 14px; }
.stepper-bar .btn { flex: 1; }
.review-row { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.review-row:last-child { border-bottom: 0; }

/* Quiet fixed action bar on stop screens (P2): details carry the screen,
   completion sits secondary at the bottom. */
.stopbar {
  position: sticky; bottom: calc(64px + env(safe-area-inset-bottom));
  display: flex; gap: 10px; background: var(--beige); padding: 10px 0; z-index: 5;
}
.stopbar .btn { flex: 1; }
.btn.ghost { background: transparent; color: var(--st-escalated); border: 1.5px solid var(--st-escalated); }

/* Photo-led rows (P4): big thumbnail space, big number, short labels. */
.bigrow { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; text-decoration: none; color: var(--ink); min-height: 84px; }
.bigrow .thumb { width: 64px; height: 64px; border-radius: 8px; background: var(--beige); display: flex; align-items: center; justify-content: center; font-size: 26px; flex: 0 0 auto; }
.bigrow .num { font-size: 21px; font-weight: 800; }
.bigrow .meta { font-size: 13px; color: var(--muted); }

/* Warranty visit identity (P4): violet band everywhere a visit appears,
   so a visit is never mistaken for a repair assignment. */
.visit-band { border-left: 8px solid #7c3aed !important; }
.visit-chip { background: #7c3aed; color: #fff; font-size: 11.5px; font-weight: 800; border-radius: 999px; padding: 2px 9px; display: inline-block; }
.visit-banner { background: #7c3aed; color: #fff; border-radius: 10px; padding: 10px 12px; font-weight: 800; margin-bottom: 10px; }

/* Operations Manager task board (B2): each task type reads differently
   at a glance, own colour band, count, and deadline line. */
.task-card {
  display: flex; gap: 12px; align-items: center; background: #fff; text-decoration: none; color: var(--ink);
  border: 1px solid var(--line); border-left: 8px solid var(--st-neutral);
  border-radius: 10px; padding: 12px; margin-bottom: 8px; min-height: 64px;
}
.task-card .count { font-size: 24px; font-weight: 800; min-width: 40px; text-align: center; }
.task-card .label { font-size: 15px; font-weight: 800; }
.task-card .sub { font-size: 13px; color: var(--muted); }
.task-card[data-kind="plan"] { border-left-color: var(--teal); }
.task-card[data-kind="pricing"] { border-left-color: var(--st-to_price); }
.task-card[data-kind="approvals"] { border-left-color: var(--st-in_repair); }
.task-card[data-kind="exceptions"] { border-left-color: var(--st-escalated); }
.task-card[data-kind="claims"] { border-left-color: #7c3aed; }
.task-card[data-kind="requests"] { border-left-color: #2563eb; }
.task-card.overdue { background: #fdf2f2; border-color: var(--st-escalated); }

/* Exceptions strip (spec 6.14). */
.exception-strip { background: #fdf2f2; border: 1px solid var(--st-escalated); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }
.exception-strip .item { padding: 4px 0; }
.banner { border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 10px; border: 1px solid var(--line); background: #fff; }
.banner.amber { border-left: 8px solid var(--st-in_repair); }
.banner.red { border-left: 8px solid var(--st-escalated); background: #fdf2f2; }
.banner.violet { border-left: 8px solid #7c3aed; }
.banner.teal { border-left: 8px solid var(--teal); }

/* Smart unit field identity card. */
.smart-card { border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 8px; background: #fff; }
.smart-card .num { font-size: 20px; font-weight: 800; }
.smart-card.ok { border-color: var(--st-ready); }
.smart-card.warn { border-color: var(--st-in_repair); }
.smart-card.bad { border-color: var(--st-escalated); background: #fdf2f2; }
.flag-line { color: var(--st-escalated); font-weight: 700; font-size: 13.5px; margin-top: 3px; }

/* Guidance pinned from the Operations Manager (B19). */
.guidance-card { background: #fff7ed; border: 1.5px solid var(--st-in_repair); border-radius: 10px; padding: 12px; margin-bottom: 12px; font-size: 14.5px; }

/* Planning map panel (N4 stand-in until live maps): pins in order, the
   line runs out of the warehouse and back (P1). */
.map-panel { position: relative; background: #eef3f1; border: 1px solid var(--line); border-radius: 12px; min-height: 220px; margin-bottom: 12px; overflow: hidden; }
.map-pin {
  position: absolute; width: 30px; height: 30px; border-radius: 50%; transform: translate(-50%, -50%);
  background: var(--teal); color: #fff; font-weight: 800; font-size: 14px;
  display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
}
.map-pin.warehouse { background: var(--ink); border-radius: 8px; }
.map-pin.done { background: var(--st-ready); }
.map-pin.attempted { background: var(--st-escalated); }
.map-pin.visit { background: #7c3aed; }

/* Segmented choices and tables. */
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.seg button { flex: 1; min-height: var(--tap); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
.table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); }
.table th { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; }
.tabs a, .tabs button {
  flex: 0 0 auto; min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--teal);
  background: #fff; color: var(--teal-dark); font-weight: 700; font-size: 14px; text-decoration: none;
  display: inline-flex; align-items: center; cursor: pointer;
}
.tabs a.active, .tabs button.active { background: var(--teal); color: #fff; }
input[type="time"] {
  width: 100%; min-height: var(--tap); font-size: 16px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.photo-check-rules { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 10px; }
.photo-check-rules li { margin: 3px 0; }

/* Download app help sheet (bottom sheet over a dimmed backdrop). */
.install-help {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(28, 26, 23, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.install-card {
  background: #fff; width: 100%; max-width: 480px;
  border-radius: 14px 14px 0 0; padding: 18px;
}
.install-card ol { margin: 8px 0 14px 20px; }
.install-card li { margin-bottom: 6px; }
