/* Layout: a service counter. Conversation on the left, a riveted machine data plate on the right that fills in as photos and answers arrive. On phones the plate folds into a strip above the chat. */
:root {
  --bg: #f1f4f8;
  --surface: #ffffff;
  --ink: #231F20;
  --muted: #6D6E71;
  --line: #d7dde6;
  --accent: #2D6CB5;
  --accent-ink: #ffffff;
  --accent-soft: #e4edf8;
  --plate: #e6e9ed;
  --plate-edge: #aeb6c0;
  --good: #1c7a4b;
  --warn: #8a5200;
  --warn-soft: #fff3dc;
  --font-display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161b; --surface: #1b2129; --ink: #eef1f4; --muted: #a4a9af; --line: #2d3641;
    --accent: #5d9de6; --accent-ink: #0c1118; --accent-soft: #1b2b40;
    --plate: #262d36; --plate-edge: #4a5562; --good: #62c895; --warn: #f1b85e; --warn-soft: #382a10;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161b; --surface: #1b2129; --ink: #eef1f4; --muted: #a4a9af; --line: #2d3641;
  --accent: #5d9de6; --accent-ink: #0c1118; --accent-soft: #1b2b40;
  --plate: #262d36; --plate-edge: #4a5562; --good: #62c895; --warn: #f1b85e; --warn-soft: #382a10;
  color-scheme: dark;
}
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.45; }
*, *::before, *::after { box-sizing: border-box; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); }

/* header */
.top { background: var(--surface); border-bottom: 3px solid var(--accent); }
.top-in { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.brand { display: flex; flex-direction: column; min-width: 0; }
.wordmark { font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1; letter-spacing: 0.01em; text-transform: uppercase; }
.wordmark b { color: var(--accent); font-weight: 700; }
.tagline { font-size: 12px; color: var(--muted); margin-top: 3px; }
.top-title { font-family: var(--font-display); font-weight: 600; font-size: 18px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.top-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.chip { font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 8px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); }
.btn { border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 600; padding: 9px 16px; border-radius: 6px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { padding: 5px 12px; font-size: 14px; }

/* main */
.main { max-width: 1120px; width: 100%; min-width: 0; margin: 0 auto; padding-inline: 16px; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; min-height: 0; }
.chat { overflow-y: auto; min-height: 0; min-width: 0; padding-block: 20px 24px; display: flex; flex-direction: column; gap: 12px; }
.log { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.row { display: flex; flex-direction: column; gap: 4px; max-width: min(620px, 92%); min-width: 0; }
.row.me { align-self: flex-end; align-items: flex-end; }
.row.wide { max-width: min(680px, 100%); width: 100%; }
.who { font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; padding: 11px 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.row.me .bubble { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); border-radius: 16px 4px 16px 16px; }
.bubble.note { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.starters { display: flex; flex-wrap: wrap; gap: 8px; }
.starter { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 15px; }
.starter:hover { border-color: var(--accent); color: var(--accent); }
.typing { display: inline-flex; gap: 5px; align-items: center; padding: 14px 16px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: 0.2s; } .typing i:nth-child(3) { animation-delay: 0.4s; }
.typing span { margin-left: 8px; color: var(--muted); font-size: 14px; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; opacity: 0.6; } }

/* composer */
.composer { display: flex; flex-direction: column; gap: 8px; min-width: 0; width: 100%; max-width: 680px; flex: none; }
.pending { display: flex; flex-wrap: wrap; gap: 8px; }
.pending .ph { position: relative; }
.pending img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.pending button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 12px; line-height: 1; padding: 0; }
.bar { display: flex; gap: 8px; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.bar:focus-within { border-color: var(--accent); }
.bar textarea { flex: 1 1 0; width: 0; min-width: 0; border: 0; background: transparent; resize: none; padding: 8px 6px; max-height: 140px; outline: none; }
.photo-btn { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 8px 12px; font-weight: 500; white-space: nowrap; }
.photo-btn:hover { border-color: var(--accent); color: var(--accent); }
.fine { font-size: 12px; color: var(--muted); }

/* side: data plate */
.side { overflow-y: auto; padding-block: 20px 16px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.plate-wrap > summary { display: none; }
.plate { position: relative; background: var(--plate); border: 1px solid var(--plate-edge); border-radius: 4px; padding: 22px 20px 18px; }
.plate::before, .plate::after, .plate .rv::before, .plate .rv::after { content: ""; position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--plate-edge); box-shadow: inset 0 1px 1px rgba(0,0,0,0.25); }
.plate::before { top: 7px; left: 7px; } .plate::after { top: 7px; right: 7px; }
.plate .rv::before { bottom: 7px; left: 7px; } .plate .rv::after { bottom: 7px; right: 7px; }
.plate h2 { margin: 0 0 12px; font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: 0.14em; text-transform: uppercase; text-align: center; }
.plate dl { margin: 0; display: grid; gap: 9px; }
.plate .f { display: grid; gap: 1px; }
.plate dt { font-family: var(--font-display); font-weight: 600; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.plate dd { margin: 0; font-family: var(--font-mono); font-size: 14px; min-height: 22px; border-bottom: 1px dotted var(--plate-edge); overflow-wrap: anywhere; }
.plate dd.empty { color: transparent; }
.plate .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rates { font-size: 14px; display: grid; gap: 6px; }
.rates h3 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.rates .r { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.rates .r span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }
.rates p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

/* contact card */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; padding: 14px 16px; display: grid; gap: 10px; }
.card .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card label { display: grid; gap: 3px; font-size: 13px; color: var(--muted); min-width: 0; }
.card input { border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; background: var(--bg); min-width: 0; width: 100%; }
.card .err { color: var(--warn); font-size: 13px; }

/* estimate ticket */
.ticket { background: var(--surface); border: 1px solid var(--ink); border-radius: 2px; }
.ticket-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; padding: 12px 16px; border-bottom: 2px solid var(--ink); }
.ticket-head h3 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: 0.06em; text-transform: uppercase; }
.ticket-head span { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.ticket-body { padding: 14px 16px; display: grid; gap: 14px; }
.ticket .mach { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.ticket h4 { margin: 0 0 3px; font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.ticket p { margin: 0; }
.lines { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.lines td { padding: 7px 0; border-bottom: 1px dashed var(--line); vertical-align: top; }
.lines td:last-child { text-align: right; white-space: nowrap; padding-left: 12px; font-weight: 500; }
.lines .sub { display: block; font-size: 12.5px; color: var(--muted); font-family: var(--font-mono); overflow-wrap: anywhere; }
.lines .tbc { color: var(--warn); font-weight: 500; white-space: normal; }
.lines tr.total td { border-bottom: 0; border-top: 2px solid var(--ink); font-weight: 600; font-size: 19px; padding-top: 10px; }
.disclaimer { font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.newmach { border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px; display: grid; gap: 4px; background: var(--accent-soft); }
.newmach .nm { font-weight: 600; }
.newmach .pr { font-variant-numeric: tabular-nums; }
.newmach a { color: var(--accent); font-weight: 600; }

/* quick fix */
.qf-steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.qf-steps li { padding-left: 4px; }
.qf-safe { background: var(--warn-soft); color: var(--warn); border-radius: 4px; padding: 8px 12px; font-size: 14px; }
.qf-part { border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px; display: grid; gap: 4px; background: var(--accent-soft); }
.qf-part .nm { font-weight: 600; }
.qf-part .pr { font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 13px; }
.qf-part .pr b { font-family: var(--font-body); font-size: 18px; }
.qf-part .tbc { color: var(--warn); font-weight: 500; }

/* save your machine */
.save h4 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: 0.06em; text-transform: uppercase; }
.save p { margin: 0; color: var(--muted); font-size: 14px; }
.save .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; width: fit-content; }
.save .seg button { border: 0; background: transparent; padding: 6px 14px; font-size: 14px; }
.save .seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* my machines */
.hist { max-width: 760px; width: 100%; margin: 0 auto; padding: 20px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.hist-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.hist-head h2 { margin: 0 auto 0 0; font-family: var(--font-display); font-weight: 700; font-size: 24px; letter-spacing: 0.04em; text-transform: uppercase; }
.hist-find { display: flex; gap: 8px; flex-wrap: wrap; }
.hist-find input { flex: 1 1 220px; min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; background: var(--surface); }
.mach-card { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; }
.mach-card h3 { margin: 0; padding: 12px 16px; border-bottom: 2px solid var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: 0.04em; text-transform: uppercase; }
.mach-card h3 small { display: block; font-family: var(--font-mono); font-weight: 400; font-size: 12.5px; letter-spacing: 0; text-transform: none; color: var(--muted); }
.hist-item { padding: 10px 16px; border-bottom: 1px dashed var(--line); display: grid; gap: 3px; }
.hist-item:last-child { border-bottom: 0; }
.hist-item .top-line { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; }
.hist-item .when { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.hist-item .amt { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.hist-item .what { font-size: 14px; color: var(--muted); }

/* lead log */
.leads { max-width: 1120px; width: 100%; margin: 0 auto; padding: 20px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.leads-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.leads-head h2 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 24px; letter-spacing: 0.04em; text-transform: uppercase; margin-right: auto; }
.leads-head a { color: var(--accent); font-weight: 600; }
.leads p.lede { margin: 0; color: var(--muted); max-width: 70ch; }
.lead-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.lead-table table { border-collapse: collapse; width: 100%; min-width: 860px; font-size: 14px; font-variant-numeric: tabular-nums; }
.lead-table th { text-align: left; font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 9px 12px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.lead-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.lead-table td small { display: block; color: var(--muted); }
.pill { display: inline-block; font-family: var(--font-display); font-weight: 600; font-size: 12.5px; letter-spacing: 0.06em; text-transform: uppercase; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.pill.repair { color: var(--accent); } .pill.replace { color: var(--warn); } .pill.out { color: var(--muted); } .pill.step { color: var(--good); }
.empty-log { padding: 28px 16px; text-align: center; color: var(--muted); }

@media (max-width: 860px) {
  .main { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 0; }
  .side { order: -1; overflow: visible; padding-block: 10px 0; gap: 0; }
  .plate-wrap > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; list-style: none; cursor: pointer; background: var(--plate); border: 1px solid var(--plate-edge); border-radius: 4px; padding: 8px 12px; font-family: var(--font-mono); font-size: 13px; }
  .plate-wrap > summary::-webkit-details-marker { display: none; }
  .plate-wrap > summary b { font-family: var(--font-display); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; font-size: 13px; }
  .plate-wrap[open] > summary { border-radius: 4px 4px 0 0; border-bottom: 0; }
  .plate-wrap[open] .plate { border-radius: 0 0 4px 4px; }
  .rates { display: none; }
  .top-title { display: none; }
  .card .grid { grid-template-columns: 1fr; }
  .wordmark { font-size: 22px; }
}

/* logo header */
.logo { display: block; height: 44px; width: auto; }
.logo-wrap { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo-wrap .wordmark { font-size: 22px; }
@media (max-width: 860px) { .logo { height: 34px; } .logo-wrap .wordmark { display: none; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo { background: #fff; padding: 4px 8px; border-radius: 4px; } }
:root[data-theme="dark"] .logo { background: #fff; padding: 4px 8px; border-radius: 4px; }

/* code entry */
.code-in { font-family: var(--font-mono); font-size: 22px; letter-spacing: 0.3em; text-align: center; max-width: 200px; }
.save .signed { color: var(--good); font-weight: 600; }
.btn.link { background: none; border: 0; color: var(--accent); padding: 0; font-weight: 600; text-decoration: underline; }

/* views switch with the hidden attribute; keep it winning over display:grid/flex */
[hidden] { display: none !important; }

/* photo button sits beside the answer box on desktop and above it on phones */
.bar-wrap { display: flex; gap: 8px; align-items: flex-end; }
.bar-wrap .bar { flex: 1 1 0; min-width: 0; }
.photo-btn { align-self: stretch; display: flex; align-items: center; }
@media (max-width: 860px) {
  .bar-wrap { flex-direction: column; align-items: stretch; }
  .photo-btn { align-self: flex-start; padding: 8px 14px; }
  .bar textarea { font-size: 16px; }
}

.consent { line-height: 1.4; } .consent a, .fine a { color: var(--accent); }

.card label.consent, .consent { display: flex; flex-direction: row; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); line-height: 1.4; cursor: pointer; }
.card input.consent-box, .consent-box { margin: 3px 0 0; width: 18px; height: 18px; padding: 0; flex: 0 0 18px; accent-color: var(--accent); }
.consent span { flex: 1 1 0; min-width: 0; }

/* booking form */
.card.book h4 { margin: 6px 0 0; font-family: var(--font-display); font-weight: 600; font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.card.book textarea, .card.book select { border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; background: var(--bg); width: 100%; min-width: 0; font: inherit; color: inherit; }
.card.book input[type=file] { padding: 6px 0; background: none; border: 0; }
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.day { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 14px; color: var(--ink); cursor: pointer; }
.day:has(input:checked) { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.day input { position: absolute; opacity: 0; width: 0; height: 0; }
.starter.book { border-color: var(--accent); color: var(--accent); font-weight: 600; }
