/* Barrie Quotes: shared styles.
   Layout: a single centred column; header bar with sign-out; cards for each section. */
:root {
  --bg: #f3f5f1;
  --surface: #ffffff;
  --fg: #1c2420;
  --muted: #5b6a60;
  --line: #d8ded8;
  --accent: #2f6f3a;
  --accent-fg: #ffffff;
  --ok: #2f6f3a;
  --error: #a3261b;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131915; --surface: #1b231e; --fg: #e5ece7; --muted: #9aab9f; --line: #2e3a32;
    --accent: #7cc46f; --accent-fg: #10170f; --ok: #7cc46f; --error: #ff8a7a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 var(--font); }
[hidden] { display: none !important; }

header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.brand { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }

main { max-width: 34rem; margin: 0 auto; padding: 32px 16px; display: grid; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
h1 { font-size: 1.5rem; margin: 0 0 4px; text-wrap: balance; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); font-size: 0.95rem; }

form { display: grid; gap: 14px; margin-top: 16px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 0.95rem; }
input {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--fg);
}
input:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

button {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; padding: 10px 16px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-fg);
}
button.quiet { background: transparent; color: var(--fg); border-color: var(--line); padding: 6px 12px; }
button:disabled { opacity: 0.6; cursor: default; }

.segmented { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; width: fit-content; }
.segmented button {
  border: 0; border-radius: 0; background: transparent; color: var(--fg); padding: 8px 18px;
  border-right: 1px solid var(--line);
}
.segmented button:last-child { border-right: 0; }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); opacity: 1; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
td { text-align: right; }
thead th { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
thead th:not(:first-child) { text-align: right; }

.msg { margin: 8px 0 0; font-size: 0.95rem; }
.msg[data-kind="error"] { color: var(--error); }
.msg[data-kind="ok"] { color: var(--ok); }

nav { display: flex; gap: 4px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
nav button {
  background: transparent; color: var(--muted); border: 0; border-bottom: 3px solid transparent;
  border-radius: 0; padding: 10px 12px;
}
nav button[aria-current="true"] { color: var(--fg); border-bottom-color: var(--accent); }

.big { font-size: 2rem; font-weight: 700; margin: 0 0 4px; font-variant-numeric: tabular-nums; }
.small { font-size: 0.85rem; margin-top: 10px; }

.costs-layout { display: grid; gap: 16px; margin: 0; }
.fields { display: grid; gap: 12px; }
.field { display: grid; grid-template-columns: 1fr 9.5rem; gap: 12px; align-items: center; font-weight: 400; }
.field-label { display: grid; font-weight: 600; font-size: 0.95rem; }
.field-label small { font-weight: 400; color: var(--muted); font-size: 0.82rem; }
.field-input { display: flex; align-items: center; gap: 6px; }
.field-input i { font-style: normal; color: var(--muted); }
.field-input input { width: 100%; text-align: right; font-variant-numeric: tabular-nums; min-width: 0; }
@media (max-width: 480px) { .field { grid-template-columns: 1fr; gap: 6px; } }

.results dl { margin: 0 0 16px; display: grid; gap: 0; }
.results dl div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.results dt { display: grid; }
.results dt small { color: var(--muted); font-size: 0.82rem; }
.results dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.results .key dd { font-size: 1.3rem; color: var(--accent); }

.progress { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.progress li { color: var(--muted); padding-left: 26px; position: relative; }
.progress li::before {
  content: ""; position: absolute; left: 0; top: 4px; width: 14px; height: 14px;
  border-radius: 50%; border: 2px solid var(--muted);
}
.progress li.done { color: var(--fg); }
.progress li.done::before { background: var(--accent); border-color: var(--accent); }

/* Quotes and customers */
main { max-width: 46rem; }
.stack { display: grid; gap: 16px; }
.title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.title-row h1 { margin: 0; }
.search input { width: 100%; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.table-wrap { overflow-x: auto; margin-top: 12px; }
table.list td { text-align: left; vertical-align: top; }
table.list td:last-child { text-align: right; white-space: nowrap; }
table.list thead th:last-child { text-align: right; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover, table.list tbody tr:focus-visible { background: var(--bg); outline: none; }
.small-text { font-size: 0.85rem; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.82rem; border: 1px solid var(--line); }
.pill[data-status="won"] { border-color: var(--ok); color: var(--ok); }
.pill[data-status="lost"] { border-color: var(--error); color: var(--error); }
.pill[data-status="open"] { border-color: var(--accent); }
select, textarea { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
textarea { resize: vertical; }
.fields > label { display: grid; gap: 6px; }
.subfields { display: grid; gap: 12px; padding: 12px; border: 1px dashed var(--line); border-radius: 10px; }
.subfields > label { display: grid; gap: 6px; }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 600; }
label.check input { width: 18px; height: 18px; }
button.link { background: none; border: 0; color: var(--accent); padding: 0; margin-bottom: 8px; font-weight: 600; }
.inset { background: var(--bg); margin: 12px 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

.question { border: 0; padding: 0; margin: 0 0 16px; }
.question legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; font-weight: 400; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; }
.choice small { color: var(--muted); font-variant-numeric: tabular-nums; }
.choice input:checked + span { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.choice input:checked + span small { color: inherit; }
.choice input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

.target-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.target-pair > div { display: grid; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.big-ish { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.reasons { list-style: none; padding: 0; margin: 0; display: grid; }
.reasons li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.reasons b { font-variant-numeric: tabular-nums; }
.note { background: var(--bg); border-left: 3px solid var(--accent); padding: 8px 12px; border-radius: 6px; font-size: 0.92rem; margin-top: 10px; }
@media (max-width: 480px) { .target-pair { grid-template-columns: 1fr; } }
