/* Quotewright: shared styles for the dashboard, customer form and quote page. */
:root {
  --bg: #f5f5f2;
  --panel: #ffffff;
  --ink: #1a1a1e;
  --muted: #64646d;
  --faint: #8d8d96;
  --line: #e6e4de;
  --line-strong: #d4d1c9;
  --brand: #ea580c;
  --brand-ink: #ffffff;
  --brand-soft: #fff1e8;
  --nav: #16171b;
  --nav-ink: #e9e9ec;
  --nav-muted: #9a9aa3;
  --ok: #15803d;
  --ok-soft: #e8f6ec;
  --warn: #a16207;
  --warn-soft: #fdf5dc;
  --bad: #b91c1c;
  --bad-soft: #fdeceb;
  --info: #1d4ed8;
  --info-soft: #e9effd;
  --violet: #6d28d9;
  --violet-soft: #f1ebfd;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 20, 25, 0.05), 0 4px 16px rgba(20, 20, 25, 0.04);
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

/* ------------------------------------------------------------ controls */
button, .btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}
button:hover, .btn:hover { border-color: #b9b5ab; background: #fafaf8; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary, button.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover, button.primary:hover { filter: brightness(0.95); background: var(--brand); }
.btn.dark, button.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ghost, button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover, button.ghost:hover { background: rgba(0, 0, 0, 0.04); }
.btn.danger, button.danger { color: var(--bad); }
.btn.sm, button.sm { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn.block, button.block { width: 100%; }

input, select, textarea {
  font: inherit;
  font-size: 14px;
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 38px;
}
textarea { resize: vertical; min-height: 80px; line-height: 1.45; }
input:focus, select:focus, textarea:focus, button:focus-visible, .btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent);
  outline-offset: 1px;
  border-color: var(--brand);
}
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; min-height: 0; accent-color: var(--brand); margin: 0; }
input[type="color"] { padding: 2px; width: 52px; }
label { display: block; font-size: 13px; font-weight: 600; color: #35353b; margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; font-weight: 400; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; color: var(--ink); cursor: pointer; margin: 0; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ------------------------------------------------------------ surfaces */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { flex: 1; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 650;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
  background: #efefec;
  color: #4a4a52;
}
.pill.new { background: #efefec; color: #4a4a52; }
.pill.draft { background: var(--warn-soft); color: var(--warn); }
.pill.sent { background: var(--info-soft); color: var(--info); }
.pill.accepted { background: var(--violet-soft); color: var(--violet); }
.pill.deposit_paid { background: var(--ok-soft); color: var(--ok); }
.pill.completed { background: #e9eef3; color: #3d4b5c; }
.pill.cancelled, .pill.declined { background: var(--bad-soft); color: var(--bad); }
.pill.flag { background: var(--warn-soft); color: var(--warn); }
.pill.outline { background: transparent; border: 1px solid var(--line-strong); color: var(--muted); }

.alert {
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 12px;
  border: 1px solid transparent;
}
.alert.warn { background: var(--warn-soft); border-color: #f1df9f; color: #6b4a06; }
.alert.bad { background: var(--bad-soft); border-color: #f5c7c3; color: #7f1d1d; }
.alert.ok { background: var(--ok-soft); border-color: #bfe5ca; color: #14532d; }
.alert.info { background: var(--info-soft); border-color: #c7d6fb; color: #1e3a8a; }
.alert strong { font-weight: 650; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.7s linear infinite; display: inline-block; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all 0.2s; z-index: 50; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--bad); }

/* ------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fbfbf9; white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #fbfaf7; }
td.right, th.right { text-align: right; }

/* ------------------------------------------------------------ auth screens */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth .card { width: 100%; max-width: 400px; padding: 28px; }
.auth h1 { margin-bottom: 6px; }
.brand-mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 16px; flex: none;
}

/* ------------------------------------------------------------ dashboard shell */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.nav { background: var(--nav); color: var(--nav-ink); padding: 18px 14px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; }
.nav .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; padding: 0 6px; }
.nav nav { display: flex; flex-direction: column; gap: 2px; }
.nav nav a { text-decoration: none; padding: 8px 10px; border-radius: 7px; color: var(--nav-muted); font-weight: 550; font-size: 14px; }
.nav nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.nav nav a.active { color: #fff; background: rgba(255, 255, 255, 0.1); }
.nav select { background: #24252b; color: #fff; border-color: #34353c; }
.nav label { color: var(--nav-muted); font-weight: 550; font-size: 12px; }
.nav-foot { margin-top: auto; font-size: 13px; color: var(--nav-muted); display: flex; flex-direction: column; gap: 10px; }
.nav-foot button { background: transparent; color: var(--nav-muted); border-color: #34353c; }
.quota-bar { height: 6px; background: #2c2d33; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.quota-bar span { display: block; height: 100%; background: var(--brand); }

main { padding: 26px 30px 60px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin-right: auto; }
.back { text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 550; display: inline-block; margin-bottom: 6px; }
.back:hover { color: var(--ink); }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.metric .label { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.metric .value { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.metric .sub { font-size: 12px; color: var(--faint); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.tabs { display: flex; gap: 4px; background: #ebeae5; padding: 3px; border-radius: 9px; overflow-x: auto; max-width: 100%; }
.tabs button { border: 0; background: transparent; min-height: 32px; padding: 4px 12px; font-weight: 600; color: var(--muted); }
.tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.tabs .count { font-weight: 500; color: var(--faint); margin-left: 2px; }
.toolbar input[type="search"] { max-width: 260px; }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty h2 { color: var(--ink); margin-bottom: 6px; }

/* ------------------------------------------------------------ job page */
.job-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.job-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-right: auto; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 4px 10px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.photos img { width: 86px; height: 86px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
.timeline li { padding: 6px 0 6px 14px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.timeline li.warning::before { background: var(--warn); }
.timeline li.paid::before, .timeline li.accepted::before { background: var(--ok); }
.timeline time { display: block; font-size: 12px; color: var(--faint); }

.editor-section { margin-top: 18px; }
.editor-section h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.editor-section h3 .sec-total { margin-left: auto; font-variant-numeric: tabular-nums; }
.lines { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
.lines td { padding: 0 6px 0 0; border: 0; vertical-align: middle; }
.lines th { padding: 0 6px 2px 0; background: none; border: 0; font-size: 11.5px; }
.lines input, .lines select { min-height: 34px; padding: 6px 8px; }
.lines .amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-right: 8px; color: var(--muted); font-size: 14px; }
.lines .x { padding-right: 0; width: 34px; }
.lines .x button { min-height: 32px; width: 32px; padding: 0; color: var(--faint); border-color: transparent; background: transparent; font-size: 18px; }
.lines .x button:hover { color: var(--bad); }
.w-num { width: 84px; }
.w-unit { width: 84px; }
.w-role { width: 150px; }

.totals { font-size: 14px; }
.totals .line { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-variant-numeric: tabular-nums; }
.totals .line.sub { color: var(--muted); font-size: 13px; padding-left: 10px; }
.totals .line.strong { font-weight: 700; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; font-size: 16px; }
.totals .line.deposit { color: var(--brand); font-weight: 650; }

.status-box { display: flex; flex-direction: column; gap: 8px; }
.status-box .btn, .status-box button { width: 100%; }
.status-line { font-size: 13.5px; color: var(--muted); }
.status-line strong { color: var(--ink); font-weight: 600; }

.code { font-family: var(--mono); font-size: 12.5px; background: #f3f2ee; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.outbox-body { white-space: pre-wrap; font-size: 13.5px; color: #35353b; background: #fbfbf9; }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 14px; align-items: start; }
.settings-grid .card + .card { margin-top: 0; }
.savebar { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 35%); padding: 18px 0 4px; display: flex; justify-content: flex-end; gap: 10px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--faint); }
.status-dot.on { background: var(--ok); }
.status-dot.off { background: #c9c6be; }
.int-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.int-list li { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); }
.int-list li:last-child { border-bottom: 0; }

dialog { border: 0; border-radius: 12px; padding: 0; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); max-width: min(560px, calc(100vw - 32px)); width: 100%; }
dialog::backdrop { background: rgba(20, 20, 25, 0.45); }
dialog .card { box-shadow: none; border: 0; }

/* ------------------------------------------------------------ test mode, demo, billing */
.content { min-width: 0; display: flex; flex-direction: column; }
.mode-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; padding: 10px 30px; font-size: 14px; border-bottom: 1px solid; }
.mode-banner.test { background: var(--warn-soft); border-color: #f1df9f; color: #5c3d03; }
.mode-banner.demo { background: var(--violet-soft); border-color: #ddd0fb; color: #3b1a7a; }
.mode-banner > div:first-child { flex: 1; min-width: 240px; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); line-height: 1.8; }
.auth-foot a { color: var(--ink); font-weight: 600; }
.guide { margin-bottom: 18px; border-color: #ddd0fb; background: linear-gradient(180deg, #fbf9ff, #fff); }
.guide h2 { margin-bottom: 8px; }
.guide ol { margin: 0; padding-left: 20px; line-height: 1.75; }
.guide a { font-weight: 600; color: var(--violet); }
.test-tools { border: 1px dashed #e3c86b; background: #fffbea; border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.plan { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.plan.popular { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow); }
.plan.current { background: #fbfbf9; }
.plan .price { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.plan .price span { font-size: 14px; font-weight: 500; color: var(--muted); }
.plan button { margin-top: auto; }
.plan-now { font-size: 15px; margin-bottom: 4px; }
.quota-bar.light { background: #ebeae5; height: 8px; margin-top: 8px; }
code { font-family: var(--mono); font-size: 12.5px; background: #f3f2ee; padding: 1px 5px; border-radius: 4px; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1080px) {
  .job-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .nav { min-width: 0; position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; gap: 10px; }
  .nav nav { flex-direction: row; overflow-x: auto; width: 100%; order: 3; scrollbar-width: none; }
  .nav nav::-webkit-scrollbar { display: none; }
  .nav nav a { white-space: nowrap; }
  .nav-foot { margin-top: 0; margin-left: auto; flex-direction: row; align-items: center; }
  .nav-foot .quota { display: none; }
  .nav .company-switch { order: 2; width: 100%; }
  main { padding: 18px 16px 50px; }
  .mode-banner { padding: 10px 16px; }
  .lines, .lines tbody, .lines tr, .lines td { display: block; width: 100%; }
  .lines thead { display: none; }
  .lines tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
  .lines input, .lines select { min-width: 0; }
  .nav-foot .inline { display: none; }
  .job-title h1 { font-size: 20px; }
  .lines td.desc { grid-column: 1 / -1; }
  .lines td { padding: 0; }
  .lines .amt { text-align: left; align-self: center; }
  .w-num, .w-unit, .w-role { width: auto; }
}

/* Example buttons on Add a job */
.examples { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 14px; }
.examples button.active { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* Reviewing an AI draft */
.review-card { border-left: 4px solid var(--brand); }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist label.check { align-items: flex-start; font-weight: 500; font-size: 13.5px; line-height: 1.45; margin: 0; }
.checklist input { margin-top: 2px; flex: none; }
.checklist input:checked + span { color: var(--muted); text-decoration: line-through; }
.price-tag { display: inline-block; margin-top: 4px; font-size: 11px; font-weight: 650; padding: 1px 7px; border-radius: 999px; }
.price-tag.ai { background: #fff4d6; color: #8a5a00; }
.price-tag.list { background: #e8f5ee; color: #1f6b43; }
.set-total { margin-top: 14px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 10px; }
.set-total label { font-weight: 600; }
.set-total input { max-width: 140px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; min-height: 0; }
.send-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; }
.send-sum div { display: flex; flex-direction: column; }
.send-sum strong { font-size: 22px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
label.check.choice { align-items: flex-start; font-weight: 500; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin: 8px 0 0; }
label.check.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
label.check.choice input { margin-top: 3px; flex: none; }
.checklist ul { margin: 4px 0 0; padding-left: 18px; list-style: disc; display: block; }
.checklist ul li { margin: 2px 0; }
.totals .line.range { margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--line); font-weight: 650; }
