[hidden] { display: none !important; }
:root {
  --bg: #eef1f5;
  --card: #ffffff;
  --ink: #18212d;
  --muted: #5b6878;
  --line: #d5dbe3;
  --accent: #1d5fbf;
  --accent-ink: #ffffff;
  --accent-soft: #e6effb;
  --danger: #b3261e;
  --warn-bg: #fff6dd;
  --warn-line: #e2bf55;
  --ok-bg: #e7f5ec;
  --ok-line: #8cc7a0;
  --radius: 8px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body.has-savebar { padding-bottom: 84px; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 .35rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); font-size: .9rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; }
.sr-only { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 20px; padding-bottom: 32px; }
body.narrow main.wrap { max-width: 460px; }

/* header */
.top { background: #16202c; color: #fff; }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 1.05rem; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px; }
.top nav a { color: #cfd8e3; text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: .92rem; }
.top nav a:hover, .top nav a.on { background: #2a3a4d; color: #fff; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 0 0 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h2 { margin: 0; }

.flash { border-radius: var(--radius); padding: 10px 14px; margin: 0 0 14px; border: 1px solid var(--ok-line); background: var(--ok-bg); }
.flash-err { border-color: #e2a29d; background: #fdeceb; color: #7a1712; }

/* forms */
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; margin-bottom: 12px; }
.span2 { grid-column: span 2; }
.span4 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span:first-child { font-size: .82rem; font-weight: 600; color: #36414f; }
.field-bottom { align-self: end; padding-bottom: 9px; }
input[type=text], input[type=password], input[type=email], input[type=date], input[type=time], input[type=datetime-local], input[type=tel], input[type=number], input:not([type]), select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1px solid #b9c2ce; border-radius: 6px; padding: 8px 10px; min-height: 40px;
}
textarea { resize: vertical; min-height: 60px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.with-btn { display: flex; gap: 8px; }
.with-btn input { flex: 1; min-width: 0; }

/* VIN barcode scanner */
.scan-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(8, 12, 18, .94); display: flex; align-items: center; justify-content: center; padding: 12px; overflow-y: auto; }
.scan-box { width: 100%; max-width: 640px; color: #fff; }
.scan-title { font-weight: 700; font-size: 1.1rem; margin-bottom: 8px; }
.scan-stage { position: relative; width: -moz-fit-content; width: fit-content; max-width: 100%; margin: 0 auto; background: #000; border-radius: var(--radius); overflow: hidden; line-height: 0; }
.scan-stage video { display: block; width: auto; height: auto; max-width: 100%; max-height: 62vh; }
.scan-guide { position: absolute; left: 4%; right: 4%; top: 32%; height: 36%; border: 3px solid #5fd08a; border-radius: 8px; box-shadow: 0 0 0 2000px rgba(0, 0, 0, .35); pointer-events: none; }
.scan-status { margin: 10px 0 4px; font-weight: 600; min-height: 1.4em; }
.scan-tip { font-size: .86rem; color: #c3cedb; margin-bottom: 12px; }
.scan-row { display: flex; gap: 10px; justify-content: flex-end; }
.scan-row .btn { min-width: 96px; }
.scan-guide.vertical { left: 32%; right: auto; width: 36%; top: 4%; height: 92%; }
.scan-turn { display: flex; gap: 6px; margin: 10px 0 0; flex-wrap: wrap; }
.scan-turn button { flex: 1 1 140px; background: #223042; color: #fff; border: 1px solid #3c4f66; border-radius: 6px; padding: 9px 10px; font: inherit; font-size: .9rem; cursor: pointer; }
.scan-turn button[aria-pressed="true"] { background: #2f7d4f; border-color: #5fd08a; font-weight: 700; }
@media (hover: hover) and (pointer: fine) { .att-camera { display: none; } }
.checkline { display: flex; align-items: flex-start; gap: 8px; font-size: .93rem; margin: 4px 0; cursor: pointer; }
.checkline input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
fieldset.why { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 2px; margin: 0 0 12px; background: #f8fafc; }
fieldset.why legend { font-size: .82rem; font-weight: 700; padding: 0 6px; color: #36414f; }
.phrase-pick, .field-phrase { margin-top: 6px; font-size: .9rem; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: .93rem; line-height: 1.2;
  padding: 9px 14px; min-height: 40px; border-radius: 6px; cursor: pointer; text-decoration: none; white-space: nowrap;
  border: 1px solid #aab4c1; background: #fff; color: var(--ink);
}
.btn:hover { background: #f1f4f8; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #184f9f; }
.btn-small { padding: 6px 10px; min-height: 34px; font-size: .86rem; }
.btn-danger-quiet { color: var(--danger); border-color: #dfb3b0; background: #fff; }
.btn-danger-quiet:hover { background: #fdeceb; }
.btn[disabled] { opacity: .6; cursor: default; }
.danger-zone { margin: 8px 0 24px; text-align: right; }

/* records list */
.lookup-form { display: flex; gap: 10px; max-width: 460px; margin-bottom: 8px; }
.lookup-form input { font-size: 1.15rem; min-height: 46px; }
.lookup-form .btn { min-height: 46px; padding: 0 22px; }
.search-form { display: flex; gap: 8px; flex: 1; max-width: 520px; }
/* position: relative keeps anything placed absolutely inside a table (hidden labels) within the scroll area,
   so a wide table scrolls on its own instead of widening the whole page on a phone. */
.table-scroll { overflow-x: auto; position: relative; }
table { border-collapse: collapse; width: 100%; }
table.list th, table.list td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: .93rem; vertical-align: top; }
table.list th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
table.list td.num, table.list th.num { text-align: right; }
table.edit th { text-align: left; font-size: .8rem; color: var(--muted); padding: 4px 6px; }
table.edit td { padding: 4px 6px; vertical-align: top; }
table.edit td.center { text-align: center; vertical-align: middle; }
table.edit td.center input { width: 18px; height: 18px; }
table.edit tr.newrow td { padding-top: 14px; }
.pager { display: flex; gap: 8px; margin-top: 12px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
form.inline { display: inline-flex; gap: 6px; }
form.inline input { min-height: 34px; padding: 4px 8px; width: 150px; font-size: .88rem; }

/* RO page */
.ro-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.ro-head p { margin: 0; }
.back { font-size: .88rem; text-decoration: none; }
.check summary { cursor: pointer; font-weight: 700; }
.check ul { margin: 10px 0 8px; padding-left: 20px; }
.check li { margin: 3px 0; font-size: .93rem; }
.check-warn { background: var(--warn-bg); border-color: var(--warn-line); }
.check-ok { background: var(--ok-bg); border-color: var(--ok-line); }
.check p { margin: 0; }

.task { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 14px; margin: 0 0 14px; }
.task-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.addtasks { border: 1px dashed #aab4c1; border-radius: var(--radius); padding: 14px; background: #f8fafc; }
.addtasks h3 { margin-bottom: 8px; }
.catalog { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 24px; margin-bottom: 12px; }
.catgroup strong { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 6px 0 2px; }
.addtasks .field { max-width: 460px; margin-bottom: 12px; }

/* attachments */
.att-group { margin-top: 4px; }
.att-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.att-list:not(:empty) { margin-bottom: 10px; }
.att { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; background: #fff; }
.att-thumb { flex: none; width: 84px; height: 84px; border-radius: 6px; overflow: hidden; background: #e3e8ee; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.att-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-link { font-weight: 800; color: #1d5fbf; background: var(--accent-soft); letter-spacing: .05em; font-size: .85rem; }
.att-linkform { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; padding: 10px; border: 1px dashed #aab4c1; border-radius: var(--radius); background: #f8fafc; }
.att-linkform[hidden] { display: none; }
.att-linkform input { flex: 1 1 260px; min-width: 0; min-height: 34px; padding: 5px 8px; font-size: .9rem; }
.att-linkform select { flex: 0 1 220px; min-height: 34px; padding: 5px 8px; font-size: .9rem; }
.att-pdf { font-weight: 800; color: #9a2b21; background: #fbe9e7; letter-spacing: .05em; }
.att-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.att-meta input, .att-meta select { min-height: 34px; padding: 5px 8px; font-size: .9rem; }
.att-info { font-size: .76rem; color: var(--muted); overflow-wrap: anywhere; }
.att-del { flex: none; width: 34px; height: 34px; border: 1px solid transparent; background: none; color: var(--muted); font-size: 1.4rem; line-height: 1; border-radius: 6px; cursor: pointer; }
.att-del:hover { color: var(--danger); background: #fdeceb; }
.att-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.att-status { font-size: .88rem; color: var(--muted); }
.att-status.err { color: var(--danger); font-weight: 600; }
.att.saved { border-color: var(--ok-line); }

/* sticky save */
.savebar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -2px 10px rgba(20, 30, 45, .08); z-index: 10; }
.savebar-in { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.savebar .btn { min-width: 150px; }
#dirty-note.dirty { color: #8a5a00; font-weight: 600; }

.logo-row { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.logo-preview { max-height: 70px; max-width: 220px; border: 1px solid var(--line); border-radius: 6px; padding: 4px; background: #fff; }

.badge { display: inline-block; font-size: .78rem; font-weight: 700; line-height: 1; padding: 5px 10px; border-radius: 12px; white-space: nowrap; border: 1px solid transparent; }
.st-in_queue { background: #eef1f5; color: #3b4757; border-color: #c5cdd8; }
.st-in_progress { background: #e6effb; color: #154a96; border-color: #a9c6ee; }
.st-completed { background: #e7f5ec; color: #1c6b3a; border-color: #8cc7a0; }
.st-closed { background: #f6ece2; color: #7a4a14; border-color: #dcb98e; }
.statusbar { padding-top: 14px; padding-bottom: 12px; }
.status-main { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.status-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.status-note { margin: 10px 0 0; }
.status-help { margin: 8px 0 0; }
.closebox { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-top: 10px; padding: 10px; border: 1px dashed #dcb98e; border-radius: var(--radius); background: #fbf6f0; }
.closebox[hidden] { display: none; }
.closebox .field { flex: 1 1 320px; }
.status-history { margin-top: 8px; font-size: .9rem; }
.status-history summary { cursor: pointer; color: var(--accent); }
.status-history ul { margin: 6px 0 0; padding-left: 18px; }
.task-done { border-left-color: #2f8f55; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 18px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font-size: .9rem; font-weight: 600; }
.tabs a:hover { background: #f1f4f8; }
.tabs a.on { background: #16202c; border-color: #16202c; color: #fff; }
.tabs .count { font-weight: 700; font-size: .78rem; background: rgba(120, 135, 155, .22); border-radius: 10px; padding: 1px 7px; }
.since { font-size: .76rem; margin-top: 3px; white-space: nowrap; }
.small { font-size: .78rem; }
.period-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin-bottom: 10px; }
.period-form .field { flex: 0 1 230px; }
.period-line { margin: 2px 0 0; }
.tiles { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin: 4px 0 14px; }
.tiles > div { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; background: #f8fafc; }
.tiles dt { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.tiles dd { margin: 2px 0 0; font-size: 1.45rem; font-weight: 700; }
table.report td { border-bottom-color: #e6eaef; }
table.report tr.group-start td { border-top: 2px solid var(--line); }
table.report td .badge { margin-top: 4px; }
.totals { margin: 12px 0 6px; }
.rowact { margin: 0; }
.rowact select { min-height: 32px; padding: 3px 6px; font-size: .84rem; width: auto; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.new-estimator { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.new-estimator[hidden] { display: none; }
.mailhead { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 6px; }
.mailhead dt { color: var(--muted); font-size: .9rem; }
.mailhead dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.tag { font-size: .74rem; font-weight: 700; background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 1px 8px; white-space: nowrap; }
.checkline.sub { margin-left: 26px; }
.formrow { display: flex; gap: 10px; margin-bottom: 24px; }
.flash-warn { border-color: var(--warn-line); background: var(--warn-bg); }
.maillog { list-style: none; margin: 6px 0 0; padding: 0; }
.maillog li { padding: 7px 0; border-top: 1px solid var(--line); font-size: .93rem; overflow-wrap: anywhere; }
.maillog li .muted { display: block; font-size: .82rem; }
.maillog li.failed strong { color: var(--danger); }
.cost-row { align-items: center; }
.cost-row select { flex: 0 0 auto; width: auto; }
.cost-row input { flex: 1 1 80px; }
.cost-calc { display: block; margin-top: 3px; }
.cost-total { margin: 4px 0 12px; font-weight: 700; }
.optgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px 20px; margin-bottom: 8px; }
.optnote { display: block; margin-top: 2px; }
.opthead { margin: 16px 0 4px; }

@media (max-width: 760px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .optgrid { grid-template-columns: 1fr; }
  .new-estimator { grid-column: 1 / -1; grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span2 { grid-column: 1 / -1; }
  .att-list, .catalog { grid-template-columns: 1fr; }
  .card { padding: 14px; }
  .ro-head { align-items: flex-start; }
}
@media (max-width: 460px) {
  .with-btn { flex-wrap: wrap; }
  .with-btn input { flex: 1 1 100%; }
  .with-btn .btn { flex: 1; }
  .savebar .muted { font-size: .78rem; }
  .att-thumb { width: 68px; height: 68px; }
}

/* Printing a report: the page furniture drops away and the table uses the full sheet. */
@media print {
  body { background: #fff; font-size: 11pt; }
  .top, .no-print, .flash, .savebar { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .card { border: 0; padding: 0; margin: 0 0 10px; }
  .table-scroll { overflow: visible; }
  .report-page h1 { display: none; }
  .tiles { grid-template-columns: repeat(7, 1fr); }
  .tiles > div, .badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.report tr { break-inside: avoid; page-break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

.btnrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.att-status.ok { color: #1d6b36; font-weight: 600; }

/* Estimators */
.readonly-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 16px; margin: 6px 0 8px; }
.readonly-grid dt { font-size: .78rem; color: var(--muted); }
.readonly-grid dd { margin: 0; overflow-wrap: anywhere; }
.field.locked .locked-val { padding: 8px 10px; border: 1px dashed var(--line); border-radius: 8px; background: #f6f8fa; min-height: 38px; overflow-wrap: anywhere; }
.plain-list { margin: 6px 0; padding-left: 18px; }
.plain-list li { margin: 3px 0; }
.plain-list.files { font-size: .9rem; }
.est-who { margin: 8px 0; }
.assign-bar { border-left: 4px solid #c58a00; }
.assign-bar p { margin-top: 0; }
.tag.added-by { margin-left: 6px; }
.att.att-ro .att-cap-ro { margin-bottom: 2px; }
.est-links { margin-top: 8px; }
.est-links summary { cursor: pointer; color: var(--muted); font-size: .88rem; }
.est-links form { margin-top: 8px; }
.lbl { font-weight: 600; }

/* History */
.hist-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 28px; }
.hist-sec { margin-top: 18px; }
.hist-sec h3 { margin: 0 0 8px; font-size: 1rem; display: flex; align-items: baseline; gap: 10px; }
.hist-sec h3 .small { font-weight: 400; }
.hbars { list-style: none; margin: 0 0 6px; padding: 0; }
.hbars li { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; align-items: center; gap: 8px; padding: 3px 0; font-size: .9rem; }
.hbars li[hidden] { display: none; }
.hb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { background: #eef1f5; border-radius: 4px; height: 12px; overflow: hidden; }
.hb-bar { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.hb-bar.task { background: #2f7d4f; }
.hb-n { white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 72px; text-align: right; }
.hbars.months .hb-n { min-width: 130px; }
td.bad { color: var(--danger); font-weight: 700; }
@media print { .hb-more { display: none; } .hbars li[hidden] { display: grid !important; } }

/* Scan inbox and scan email setup */
.nav-count { display: inline-block; min-width: 18px; padding: 1px 6px; margin-left: 4px; border-radius: 9px; background: #e2bf55; color: #18212d; font-size: .76rem; font-weight: 700; text-align: center; }
.scan-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; justify-content: space-between; }
.scan-head p { flex: 1 1 320px; margin-top: 0; }
.scan-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.scan-top .mono { overflow-wrap: anywhere; }
.badge.scan-pre { background: var(--accent-soft); color: var(--accent); border-color: #b9cdea; }
.badge.scan-post { background: var(--ok-bg); color: #1d6b3c; border-color: var(--ok-line); }
.badge.scan-unknown { background: var(--warn-bg); border-color: var(--warn-line); }
.scan-meta { margin: 6px 0; }
.scan-note { margin: 6px 0; padding: 8px 10px; border-left: 3px solid var(--warn-line); background: var(--warn-bg); border-radius: 4px; }
.scan-item a { overflow-wrap: anywhere; }
.scan-more { margin-top: 10px; }
.scan-more summary { cursor: pointer; color: var(--accent); }
.scan-more form { margin-top: 8px; }
.scan-log { list-style: none; padding-left: 0; margin: 0; }
.scan-log li { padding: 5px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.scan-log li:last-child { border-bottom: 0; }
.scan-log .lvl-warn { color: #7a5600; }
.scan-log .lvl-error { color: var(--danger); }
.scan-status p { margin-top: 0; }
pre.cron { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px; }
.tools-table input, .tools-table select { width: 100%; min-width: 120px; }
.scan-form-wrap { flex-wrap: wrap; max-width: none; align-items: center; }
.scan-form-wrap input[type=file] { flex: 1 1 220px; min-width: 0; font-size: 1rem; }
.scan-form-wrap input:not([type=file]) { flex: 1 1 160px; min-width: 0; }
.cost-lines { display: inline-grid; gap: 2px; min-width: 260px; font-weight: 400; }
.cost-lines > div { display: flex; justify-content: space-between; gap: 18px; }
.cost-lines .cost-grand { font-weight: 700; border-top: 1px solid var(--line); padding-top: 3px; }
.tax-table input, .tax-table select { width: 100%; min-width: 90px; }
.ro-taxes { margin: 6px 0 14px; }
.ro-taxes summary { cursor: pointer; color: var(--accent); }
.perm-list .checkline { margin: 6px 0; }
.perm-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

/* ===================== CalRecords 2.0 ===================== */

/* header: brand, main menu, account menu */
.top-in { flex-wrap: nowrap; }
.brand { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-app { font-size: .74rem; font-weight: 600; color: #9fb0c4; letter-spacing: .04em; text-transform: uppercase; }
.brand-shop { font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-app:only-child { font-size: 1.05rem; color: #fff; text-transform: none; letter-spacing: 0; }
.main-nav { display: flex; gap: 4px; margin-left: auto; }
.main-nav a { display: inline-flex; align-items: center; gap: 7px; color: #cfd8e3; text-decoration: none; padding: 7px 11px; border-radius: 6px; font-size: .93rem; }
.main-nav a:hover, .main-nav a.on { background: #2a3a4d; color: #fff; }
.ico { width: 18px; height: 18px; flex: none; }
.nav-count { display: inline-block; min-width: 18px; padding: 1px 6px; margin-left: 2px; border-radius: 9px; background: #e2bf55; color: #18212d; font-size: .74rem; font-weight: 700; text-align: center; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; color: #fff; padding: 4px; border-radius: 20px; }
.user-menu summary::-webkit-details-marker { display: none; }
.avatar { display: inline-flex; width: 32px; height: 32px; border-radius: 50%; align-items: center; justify-content: center; background: #2f4b6e; color: #fff; font-weight: 700; flex: none; }
.user-name { font-size: .9rem; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-list { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(15, 25, 40, .16); min-width: 180px; padding: 8px; z-index: 40; }
.user-menu-list a { display: block; padding: 8px 10px; color: var(--ink); text-decoration: none; border-radius: 6px; }
.user-menu-list a:hover { background: #f1f4f8; }
.user-menu-list .muted { padding: 2px 10px 6px; }

/* phones: the main menu becomes a tab bar along the bottom */
@media (max-width: 760px) {
  .user-name { display: none; }
  body.signed-in { padding-bottom: 70px; }
  body.signed-in.has-savebar { padding-bottom: 140px; }
  .main-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #16202c; margin: 0; height: calc(62px + env(safe-area-inset-bottom)); padding: 4px 4px env(safe-area-inset-bottom); justify-content: space-around; align-items: stretch; gap: 0; border-top: 1px solid #2a3a4d; }
  .main-nav a { flex: 1; flex-direction: column; justify-content: center; gap: 2px; font-size: .7rem; padding: 4px 2px; text-align: center; position: relative; }
  .main-nav a .ico { width: 22px; height: 22px; }
  .main-nav .nav-count { position: absolute; top: 2px; left: 55%; margin: 0; }
  .has-savebar .savebar { bottom: calc(62px + env(safe-area-inset-bottom)); }
}

/* settings area */
.settings-tabs { margin-bottom: 16px; }
.subtabs a { font-size: .85rem; padding: 5px 10px; }
.lead { font-size: .95rem; margin-bottom: 14px; }
.page-sub { margin: 4px 0 12px; }
.opt-group .opt-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.opt-group .opt-head h2 { margin: 0; }
.opt-head-tools { display: flex; gap: 6px; }
.opt-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 22px; }
.opt-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid #eef1f4; }
.opt-main { flex: 1; min-width: 0; margin: 0; }
.opt-row .field.opt-main { max-width: 340px; }
.opt-lock { flex: none; display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; color: var(--muted); border: 1px solid var(--line); border-radius: 14px; padding: 3px 9px; cursor: pointer; white-space: nowrap; margin-top: 2px; }
.opt-lock:has(input:checked) { background: #16202c; color: #fff; border-color: #16202c; }
.opt-lock input { width: 14px; height: 14px; margin: 0; }
.opt-tools { margin-bottom: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.static-save { position: sticky; bottom: 0; padding: 10px 0; background: linear-gradient(rgba(238, 241, 245, 0), var(--bg) 30%); z-index: 5; border: 0; box-shadow: none; }
.static-save .btn { min-width: 200px; }
.reset-form { margin: 6px 0 24px; }
@media (max-width: 760px) {
  .opt-list { grid-template-columns: 1fr; }
  .static-save { bottom: calc(62px + env(safe-area-inset-bottom)); }
}

/* users */
.add-user summary, .user-card summary, .removed-list summary { cursor: pointer; }
.user-card { padding: 0; }
.user-card > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
.user-card > summary::-webkit-details-marker { display: none; }
.user-card[open] > summary { border-bottom: 1px solid var(--line); }
.user-card .user-sum { display: flex; flex-direction: column; min-width: 0; flex: 1 1 200px; }
.user-card .user-sum .muted { overflow-wrap: anywhere; }
.user-card .user-count { flex: 0 0 auto; }
.user-card .user-form, .user-card .user-toggle { padding: 14px 16px; }
.user-card .user-toggle { padding-top: 0; }
.user-card.inactive { opacity: .7; }
.user-form .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.role-manager { background: #16202c; color: #fff; }
.role-tech { background: var(--accent-soft); color: #154a96; border-color: #a9c6ee; }
.role-estimator { background: #f3eefb; color: #5b2f99; border-color: #cdb8ec; }
.perm-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 6px 0 6px; }
.preset-pick { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); }
.preset-pick { flex-wrap: wrap; max-width: 100%; }
.preset-pick select { width: auto; max-width: 100%; min-width: 0; min-height: 34px; padding: 4px 8px; font-size: .88rem; }
.perm-boxes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 22px; }
.perm-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px 8px; margin: 0; }
.perm-group legend { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 0 6px; }
@media (max-width: 760px) {
  .user-form .grid { grid-template-columns: 1fr 1fr; }
  .perm-boxes { grid-template-columns: 1fr; }
}

/* estimators list */
.est-row { display: grid; grid-template-columns: 1.2fr 1.4fr 1fr 1.2fr auto; gap: 10px; align-items: end; padding: 10px 0; border-bottom: 1px solid #eef1f4; }
.est-side { padding-bottom: 8px; min-width: 90px; }
.removed-list { margin-top: 14px; }
.removed-list .with-btn { align-items: center; margin: 6px 0; }
@media (max-width: 760px) {
  .est-row { grid-template-columns: 1fr 1fr; }
}

/* records list */
.setup-list .checklist { list-style: none; padding: 0; margin: 0; }
.setup-list .checklist li { padding: 7px 0 7px 30px; position: relative; border-top: 1px solid #eef1f4; }
.setup-list .checklist li::before { content: ""; position: absolute; left: 4px; top: 10px; width: 16px; height: 16px; border: 2px solid #aab4c1; border-radius: 50%; }
.setup-list .checklist li.done::before { background: #2f8f55; border-color: #2f8f55; }
.setup-list .checklist li.done a { color: var(--muted); text-decoration: line-through; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.list-head h1 { margin: 0; }
.new-ro { display: flex; gap: 8px; flex-wrap: wrap; flex: 0 1 560px; }
.new-ro input { flex: 1 1 160px; min-width: 0; font-size: 1.05rem; }
.new-ro select { flex: 0 1 180px; width: auto; }
.list-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.list-tools .search-form { flex: 1 1 320px; max-width: none; }
input[type=search] { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid #b9c2ce; border-radius: 6px; padding: 8px 10px; min-height: 40px; }
.vin-find { display: inline-flex; align-items: center; gap: 8px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: thin; }
.chips a { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 18px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font-size: .88rem; font-weight: 600; }
.chips a.on { background: #16202c; border-color: #16202c; color: #fff; }
.chips a.has:not(.on) { border-color: var(--warn-line); background: var(--warn-bg); }
.chips .count { font-size: .76rem; background: rgba(120, 135, 155, .22); border-radius: 10px; padding: 1px 7px; }
.scope-tabs { margin-bottom: 8px; }
.ro-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ro-list table.list td { vertical-align: middle; }
.ro-list tbody tr:hover { background: #f8fafc; }
.empty { text-align: center; padding: 28px 18px; }
@media (max-width: 760px) {
  .ro-list { background: none; border: 0; }
  table.cards-on-phone thead { display: none; }
  table.cards-on-phone, table.cards-on-phone tbody { display: block; }
  table.cards-on-phone tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; }
  table.cards-on-phone td { border: 0; padding: 0; font-size: .9rem; }
  table.cards-on-phone .c-ro { grid-column: 1; font-size: 1.05rem; }
  table.cards-on-phone .c-status { grid-column: 2; grid-row: 1; text-align: right; }
  table.cards-on-phone .c-veh { grid-column: 1 / -1; }
  table.cards-on-phone .c-vin { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
  table.cards-on-phone .c-tech { grid-column: 1; font-size: .84rem; color: var(--muted); }
  table.cards-on-phone .c-tasks, table.cards-on-phone .c-files { display: inline; font-size: .8rem; color: var(--muted); text-align: left; }
  table.cards-on-phone .c-tasks::before, table.cards-on-phone .c-files::before { content: attr(data-label) " "; }
  table.cards-on-phone .c-when { grid-column: 1 / -1; font-size: .78rem; color: var(--muted); }
  table.cards-on-phone .c-act:empty { display: none; }
  table.cards-on-phone .c-act { grid-column: 1 / -1; margin-top: 4px; }
  .new-ro select { flex: 1 1 100%; }
}

/* record page */
.ro-head { align-items: flex-start; }
.ro-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ro-head h1 .badge { font-size: .76rem; }
.ro-sub { margin: 2px 0 0; }
.head-actions { align-items: center; }
.more-menu { position: relative; }
.more-menu summary { list-style: none; min-width: 44px; font-size: 1.2rem; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-list { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(15, 25, 40, .16); min-width: 260px; padding: 6px; z-index: 40; }
.more-list a, .more-list button { display: block; width: 100%; text-align: left; padding: 9px 10px; border: 0; background: none; font: inherit; font-size: .93rem; color: var(--ink); text-decoration: none; border-radius: 6px; cursor: pointer; }
.more-list a:hover, .more-list button:hover { background: #f1f4f8; }
.more-list .danger { color: var(--danger); }
.assign-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 16px; }
.assign-bar p { margin: 0; }
.assign-bar.unassigned { background: var(--warn-bg); border-color: var(--warn-line); }
.assign-bar select { width: auto; min-width: 160px; }
.scan-banner { background: var(--accent-soft); border-color: #a9c6ee; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 16px; }
.scan-banner p { margin: 0; }
.jump { position: sticky; top: 0; z-index: 8; display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; margin: 0 0 8px; background: var(--bg); scrollbar-width: none; }
.jump::-webkit-scrollbar { display: none; }
.jump a { flex: none; padding: 5px 11px; border-radius: 16px; background: #fff; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: .85rem; font-weight: 600; }
.jump a.ok { border-color: var(--ok-line); color: #1c6b3a; }
.jump a.warn { border-color: var(--warn-line); background: var(--warn-bg); }
.jump a b { background: #e2bf55; border-radius: 9px; padding: 0 6px; font-size: .74rem; }
.status-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; }
.status-tools .closebox { flex-basis: 100%; }
details.sec { padding: 0; scroll-margin-top: 54px; }
section.sec-plain { scroll-margin-top: 54px; }
details.sec > summary { list-style: none; cursor: pointer; padding: 14px 18px; display: flex; flex-direction: column; gap: 2px; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::after { content: "Show"; position: absolute; right: 18px; top: 16px; font-size: .8rem; color: var(--accent); font-weight: 600; }
details.sec[open] > summary::after { content: "Hide"; }
details.sec { position: relative; }
details.sec > summary h2 { margin: 0; }
.sec-title { display: flex; align-items: center; gap: 8px; padding-right: 50px; }
.sec-plain .sec-title { margin-bottom: 10px; }
.sec-plain .sec-title h2 { margin: 0; }
.sec-line { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.sec[open] .sec-line { display: none; }
.sec-body { padding: 0 18px 16px; }
.sec-flag { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; border-radius: 11px; font-size: .78rem; font-weight: 700; padding: 0 6px; }
.sec-flag.ok { background: var(--ok-bg); color: #1c6b3a; border: 1px solid var(--ok-line); }
.sec-flag.warn { background: #e2bf55; color: #18212d; }
.sec-warn { margin: 0 0 12px; padding: 8px 12px 8px 28px; background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius); font-size: .9rem; }
.sec-warn li { margin: 2px 0; }
details.task { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 0; margin: 0 0 12px; background: #fff; }
details.task.task-done { border-left-color: #2f8f55; }
details.task > summary { list-style: none; cursor: pointer; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 4px 12px; flex-wrap: wrap; }
details.task > summary::-webkit-details-marker { display: none; }
details.task[open] > summary { border-bottom: 1px solid #eef1f4; }
.task-name { min-width: 0; }
.task-line { font-size: .86rem; }
.res-done { color: #1c6b3a; font-weight: 600; }
.res-open { color: #8a5a00; font-weight: 600; }
.task-body { padding: 12px 14px 4px; }
.task-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.task-tools .btn { margin-left: auto; }
.add-tasks-open { margin-top: 4px; }
dialog.task-picker { width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 40px); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: 0 20px 50px rgba(10, 20, 35, .3); }
dialog.task-picker::backdrop { background: rgba(10, 18, 28, .55); }
.tp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.tp-head h2 { margin: 0; }
.tp-close { font-size: 1.2rem; min-width: 40px; }
.tp-search { margin-bottom: 10px; }
.tp-foot { position: sticky; bottom: -16px; background: #fff; padding: 10px 0 0; border-top: 1px solid #eef1f4; display: flex; justify-content: flex-end; }
.tp-foot .btn { min-width: 160px; }
.add-menu { position: relative; display: inline-block; }
.add-menu > summary { list-style: none; }
.add-menu > summary::-webkit-details-marker { display: none; }
.add-menu-list { position: absolute; left: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(15, 25, 40, .16); min-width: 210px; padding: 6px; z-index: 20; }
.add-menu-list label, .add-menu-list button { display: block; width: 100%; text-align: left; padding: 10px 10px; border: 0; background: none; font: inherit; font-size: .93rem; color: var(--ink); border-radius: 6px; cursor: pointer; }
.add-menu-list label:hover, .add-menu-list button:hover { background: #f1f4f8; }
@media (hover: hover) and (pointer: fine) { .add-camera { display: none !important; } }
.att-ro .att-meta { padding-top: 4px; }
.cost-table input, .cost-table select { min-height: 34px; padding: 4px 8px; font-size: .9rem; }
.cost-table input { max-width: 120px; }
#cost-box { margin-top: 10px; }
.readonly-note { text-align: center; margin: 10px 0 30px; }
#dirty-note.saved { color: #1c6b3a; font-weight: 600; }
#dirty-note.err { color: var(--danger); font-weight: 600; }
@media (max-width: 760px) {
  .ro-head { flex-direction: column; }
  .head-actions { width: 100%; justify-content: flex-start; }
  .assign-bar .with-btn { width: 100%; flex-wrap: wrap; }
  .sec-body { padding: 0 14px 14px; }
  details.sec > summary { padding: 12px 14px; }
}

/* reports dashboard */
.dash-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 6px 0 16px; }
.tile { display: flex; flex-direction: column; gap: 2px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: var(--ink); }
a.tile:hover { border-color: var(--accent); }
.tile-n { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.tile-l { font-size: .84rem; color: var(--muted); }
.tile-s { font-size: .78rem; color: var(--muted); }

/* setup and login */
.setup h2 { margin-top: 14px; }
.login-logo { max-height: 70px; max-width: 220px; display: block; margin-bottom: 10px; }

.phrase-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.phrase-tools select { flex: 1 1 200px; margin-top: 0; }
.save-phrase { border: 0; background: none; color: var(--accent); font: inherit; font-size: .84rem; cursor: pointer; padding: 4px 2px; white-space: nowrap; }
.save-phrase:hover { text-decoration: underline; }

/* ---------- 2.0.1: metrics charts ---------- */
:root { --series-1: #2a78d6; --chart-track: #eef1f5; --chart-grid: #e3e8ee; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-bottom: 14px; }
.chart-grid > .card { margin: 0; }
.chart { margin: 0; }
.chart figcaption { margin-bottom: 10px; }
.mbars { display: flex; flex-direction: column; gap: 6px; }
.mbar { display: grid; grid-template-columns: minmax(80px, 40%) 1fr; align-items: center; gap: 10px; font-size: .88rem; border-radius: 4px; cursor: default; padding: 2px 0; }
.mbar:hover, .mbar:focus { background: var(--accent-soft); outline: none; }
.mbar-label { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; overflow-wrap: anywhere; }
.mbar-track { display: flex; align-items: center; gap: 8px; min-width: 0; padding-right: 92px; }
.mbar-fill { display: block; height: 14px; background: var(--series-1); border-radius: 0 4px 4px 0; flex: 0 0 auto; }
.mbar-val { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ink); font-size: .84rem; }
.cols-wrap { display: grid; grid-template-columns: auto 1fr; gap: 6px; }
.cols-axis { position: relative; width: 44px; height: 170px; font-size: .72rem; color: var(--muted); }
.cols-axis span { position: absolute; right: 0; transform: translateY(50%); font-variant-numeric: tabular-nums; }
.cols { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 170px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.cols-grid { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--chart-grid); pointer-events: none; }
.col { position: relative; flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; min-width: 0; cursor: default; }
.col:hover, .col:focus { background: var(--accent-soft); outline: none; }
.col-bar { display: block; width: 70%; max-width: 28px; background: var(--series-1); border-radius: 4px 4px 0 0; min-height: 1px; }
.col-bar.zero { background: transparent; }
.col-x { position: absolute; top: 100%; margin-top: 4px; font-size: .7rem; color: var(--muted); white-space: nowrap; }
.col-x.hide { visibility: hidden; }
.chart-table { margin-top: 4px; font-size: .84rem; }
.chart-table summary { cursor: pointer; color: var(--accent); }
.chart-table table { margin-top: 6px; }
.chart-tip { position: absolute; z-index: 50; max-width: 280px; background: #18212d; color: #fff; font-size: .82rem; padding: 6px 9px; border-radius: 6px; pointer-events: none; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.metrics-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 10px; }
.metrics-form .field { margin: 0; }
.metrics-table td.num, .metrics-table th.num, .metrics-table td + td { text-align: right; font-variant-numeric: tabular-nums; }
.metrics-table th { white-space: nowrap; }
@media (max-width: 760px) {
  .chart-grid { grid-template-columns: 1fr; }
  .cols-axis, .cols { height: 140px; }
  .mbar { grid-template-columns: minmax(70px, 34%) 1fr; }
}
@media print { .chart-tip, .chart-table { display: none; } .mbar-fill, .col-bar { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* ---------- 2.0.1: activity log ---------- */
.log-table td { vertical-align: top; }
.log-table .nowrap { white-space: nowrap; }
.log-table .block { display: block; }
.log-kind { display: inline-block; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 0 7px; margin-right: 4px; }
.log-details { white-space: pre-line; font-size: .84rem; color: var(--muted); max-width: 520px; overflow-wrap: anywhere; }
.log-details summary { cursor: pointer; white-space: pre-line; }
.log-login .log-kind { background: var(--accent-soft); }
.log-filters .btnrow { margin-top: 8px; }
@media (max-width: 760px) {
  table.log-table.cards-on-phone tr { grid-template-columns: 1fr; }
  table.log-table.cards-on-phone td { grid-column: 1; }
  table.log-table.cards-on-phone td:empty { display: none; }
  .log-details { max-width: none; }
}

/* ---------- 2.0.1: task timer, templates ---------- */
.task-timer { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .86rem; color: var(--muted); }
.task-timer.running .timer-text { color: #1b6f43; font-weight: 600; }
.tpl-list { display: flex; flex-direction: column; gap: 8px; }
.tpl { border: 1px solid var(--line); border-radius: var(--radius); }
.tpl > summary { cursor: pointer; padding: 10px 14px; }
.tpl[open] > summary { border-bottom: 1px solid var(--line); }
.tpl-form { padding: 12px 14px; }
.tpl-form .perm-boxes { margin: 10px 0; }

/* ---------- 2.0.2: import from 1.x ---------- */
.progress { height: 14px; background: var(--chart-track); border-radius: 7px; overflow: hidden; margin: 12px 0 6px; }
.progress-bar { display: block; height: 100%; background: var(--series-1); border-radius: 7px; transition: width .3s; }
.import-people .block { display: block; }
.import-people select { min-width: 220px; }
.import-notes { max-height: 320px; overflow: auto; font-size: .9rem; }
.export-list .block { display: block; overflow-wrap: anywhere; }
.export-list .nowrap { white-space: nowrap; }
.export-list { margin-top: 12px; }
.section-title { margin: 22px 0 6px; }

/* ---------- 2.0.4: task list and reasons as a list (fits a phone) ---------- */
.sort-list { list-style: none; margin: 12px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sort-item { display: flex; align-items: flex-start; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; background: var(--card); transition: background .3s; }
.sort-item.moved { background: var(--accent-soft); }
.sort-item.retired { opacity: .65; }
.sort-item > details { flex: 1 1 auto; min-width: 0; }
.sort-item summary { cursor: pointer; list-style: none; padding: 4px 0; display: flex; gap: 4px; align-items: flex-start; }
.sort-item summary::-webkit-details-marker { display: none; }
.sort-item summary::before { content: '\25B8'; flex: 0 0 1em; color: var(--muted); line-height: 1.4; }
.sort-item details[open] summary::before { content: '\25BE'; }
.si-main { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.si-name { overflow-wrap: anywhere; }
.si-sub { font-size: .84rem; }
.si-body { padding: 8px 0 4px 1em; display: grid; gap: 8px; }
.si-body .field { margin: 0; }
.si-move { display: flex; gap: 4px; flex: 0 0 auto; }
.si-move .btn { min-width: 40px; min-height: 36px; padding: 4px 8px; font-size: 1rem; }
.si-reason { flex: 1 1 auto; min-width: 0; display: grid; gap: 4px; }
.si-reason textarea { width: 100%; min-height: 2.6em; resize: vertical; }
.new-item { margin-top: 12px; }
.new-item .field { margin: 0 0 8px; }
@media (max-width: 460px) {
  .si-move { flex-direction: column; }
}

/* ---------- 2.0.4: shared record page ---------- */
.share-page main { padding-top: 16px; padding-bottom: 30px; }
.share-page h1 { font-size: 1.3rem; }
.share-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 18px; margin: 10px 0 14px; }
.share-fields dt { font-size: .8rem; color: var(--muted); }
.share-fields dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.share-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.share-list .block { display: block; overflow-wrap: anywhere; }
.share-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.share-photos a { display: block; text-decoration: none; color: var(--muted); font-size: .84rem; }
.share-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; margin-bottom: 4px; }
.share-box { display: grid; gap: 6px; margin-top: 8px; }
.share-box .share-url { display: flex; gap: 6px; }
.share-box input { flex: 1 1 auto; min-width: 0; font-size: .82rem; }
.linkish { border: 0; background: none; padding: 2px 0; color: var(--accent); font: inherit; font-size: .84rem; cursor: pointer; text-decoration: underline; }
.att-meta .share-box { margin-top: 4px; }

/* ---------- 2.0.5: labor rates ---------- */
.with-unit { display: flex; align-items: center; gap: 6px; }
.with-unit input { flex: 1 1 auto; min-width: 0; max-width: 140px; }
.rate-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 16px; }
.rate-rows .field { margin: 0; }
.ro-rates { margin-top: 10px; }
.rate-pick { min-width: 150px; }
@media (max-width: 760px) {
  .cost-table thead { display: none; }
  .cost-table, .cost-table tbody { display: block; }
  .cost-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .cost-table td { border: 0; padding: 0; }
  .cost-table td:first-child { grid-column: 1 / -1; font-weight: 600; }
  .cost-table td.rate-cell { grid-column: 1 / -1; }
  .cost-table td.rate-cell:has(select[hidden]) { display: none; }
  .cost-table td.num { grid-column: 1 / -1; text-align: right; }
  .cost-table select, .cost-table input { width: 100%; max-width: none; }
}
.rates-table td:first-child input { min-width: 130px; }

/* ---------- 2.0.6: equipment ---------- */
.equip-list { display: grid; gap: 10px; }
.equip-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 8px 12px; align-items: end; border-top: 1px solid var(--line); padding-top: 10px; }
.equip-row .field { margin: 0; }
.equip-row.retired { opacity: .6; }
.equip-row .checkline { margin-bottom: 8px; }
.equip-row .equip-notes { grid-column: 1 / 5; }
.equip-frame .equip-row { grid-template-columns: 2fr 1fr 1fr auto; }
.equip-frame .equip-row .equip-notes { grid-column: 1 / 4; }
.equip-group { margin-top: 8px; }
.equip-group .field { margin: 6px 0; }
.equip-targets { display: grid; gap: 2px; margin-top: 6px; }
.equip-label { font-size: .84rem; font-weight: 600; }
.equip-ticks { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
@media (max-width: 760px) {
  .equip-row { grid-template-columns: 1fr 1fr; }
  .equip-row .field:first-child { grid-column: 1 / -1; }
  .equip-frame .equip-row { grid-template-columns: 1fr 1fr; }
  .equip-row .equip-notes, .equip-frame .equip-row .equip-notes { grid-column: 1 / -1; }
}

/* ---------- 2.0.6: calibration library ---------- */
.lib-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 16px; }
.lib-link p { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lib-link .ico { width: 20px; height: 20px; color: var(--accent); }
.lib-pick { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.lib-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.lib-thumbs img { height: 110px; border-radius: 6px; border: 1px solid var(--line); }
.lib-pdf { display: inline-flex; flex-direction: column; justify-content: center; align-items: center; width: 90px; height: 110px; border-radius: 6px; border: 1px solid var(--line); text-align: center; font-weight: 700; text-decoration: none; overflow: hidden; padding: 4px; }
.lib-pdf small { font-weight: 400; font-size: 11px; word-break: break-all; }
.lib-row-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 12px; }
.lib-row-grid .field { margin: 0; }
.lib-row-grid .span-all { grid-column: 1 / -1; }
.lib-row-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.lib-row-head .lib-remove { margin-left: auto; }
.lib-system h3 { margin: 0 0 8px; }
.lib-item { border-top: 1px solid var(--line); padding: 10px 0; }
.lib-item:first-of-type { border-top: 0; }
.lib-item-head { display: flex; gap: 8px 12px; flex-wrap: wrap; align-items: baseline; }
.lib-cal { background: var(--accent-soft); color: var(--accent); }
.lib-triggers { margin: 6px 0; color: #8a1c1c; }
.pre { white-space: pre-line; overflow-wrap: anywhere; }
.lib-edit summary { cursor: pointer; color: var(--accent); font-size: .88rem; }
.lib-edit form { margin-top: 8px; }
.lib-sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.lib-source { display: grid; gap: 4px; }
.lib-source img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
@media (max-width: 760px) {
  .lib-row-grid { grid-template-columns: 1fr 1fr; }
}

/* Library list: find by year / make / model, vehicles grouped by make with a link per model year */
.lib-find { display: grid; grid-template-columns: 90px minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.lib-find .field { margin: 0; }
.lib-find select { width: 100%; }
.lib-find-btns { display: flex; gap: 6px; }
.lib-find-btns:empty { display: none; }
@media (max-width: 560px) {
  .lib-find { grid-template-columns: 84px minmax(0, 1fr) minmax(0, 1fr); }
  .lib-find-btns { grid-column: 1 / -1; }
}
.lib-makes { margin-bottom: 12px; display: grid; gap: 8px; }
.lib-make { margin: 0; padding: 0; }
.lib-make > summary { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 14px 16px; cursor: pointer; list-style: none; }
.lib-make > summary::-webkit-details-marker, .lib-model > summary::-webkit-details-marker { display: none; }
.lib-make > summary::before, .lib-model > summary::before { content: "\25B8"; color: var(--muted); margin-right: 8px; display: inline-block; }
.lib-make[open] > summary::before, .lib-model[open] > summary::before { transform: rotate(90deg); }
.lib-make-name { font-weight: 700; font-size: 1.1rem; margin-right: auto; }
.lib-models { padding: 0 16px 8px; }
.lib-model { border-top: 1px solid var(--line); }
.lib-model > summary { display: flex; align-items: baseline; gap: 10px; padding: 10px 0; cursor: pointer; list-style: none; }
.lib-model .lib-years { padding: 0 0 12px 22px; }
.lib-model-name { font-weight: 700; font-size: 1.02rem; margin-right: auto; }
.lib-years { display: flex; flex-wrap: wrap; gap: 6px; }
.lib-year { display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--accent-soft); font-weight: 700; text-decoration: none; }
.lib-year small { font-weight: 400; color: var(--muted); font-size: .78rem; }
.lib-year:hover, .lib-year:focus-visible { background: var(--accent); color: var(--accent-ink); }
.lib-year:hover small, .lib-year:focus-visible small { color: var(--accent-ink); }
.lib-waiting { list-style: none; margin: 0; padding: 0; }
.lib-waiting li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.lib-waiting li:first-child { border-top: 0; }
.lib-waiting .small { flex-basis: 100%; }
.lib-trims { margin: 2px 0 0; }
.lib-system, .lib-item, .lib-triggers { overflow-wrap: anywhere; }

/* Calibration library on records: a task's OEM requirement, and the picker */
.lib-ref { border: 1px dashed var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 4px 0; background: #fbfcfe; overflow-wrap: anywhere; }
.lib-ref-show { display: grid; gap: 4px; }
.lib-ref-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.lib-ref-text { margin: 0; font-size: .92rem; }
.lib-ref-link { margin: 0; }
.lib-ref-btns { display: flex; gap: 14px; }
.lib-ref-empty { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lib-suggest { margin: 0; flex: 1 1 260px; }
.lib-scan { margin-top: 10px; }
dialog.lib-picker { width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: 0 20px 50px rgba(10, 20, 35, .3); }
dialog.lib-picker::backdrop { background: rgba(10, 18, 28, .55); }
.lp-sys { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 12px 0 4px; }
.lp-entry { display: block; width: 100%; text-align: left; padding: 10px 12px; margin: 0 0 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); cursor: pointer; font: inherit; color: inherit; }
.lp-entry:hover, .lp-entry:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.lp-suggested { border-color: var(--accent); }
.lp-checks { display: grid; gap: 6px; margin: 8px 0; }
.lp-line { align-items: flex-start; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
.lp-line span { overflow-wrap: anywhere; }
.lp-link { overflow-wrap: anywhere; }

/* Tasks & reasons: task groups */
.grp-head { margin: 14px 0 4px; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.groups-list .si-reason { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.groups-list .si-reason input[type=text], .groups-list .si-reason input:not([type]) { flex: 1 1 180px; min-width: 0; }
.est-link { grid-column: 1 / -1; margin: 0; }

/* Section tabs inside a page */
.ptabs-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: -4px 0 14px; }
.ptabs { display: flex; gap: 4px; overflow-x: auto; position: relative; scrollbar-width: thin; flex: 1 1 auto; min-width: 0; padding-bottom: 2px; border-bottom: 2px solid var(--line); }
.ptabs:empty { display: none; }
.ptabs a { flex: 0 0 auto; padding: 8px 12px; margin-bottom: -2px; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 600; font-size: .92rem; text-decoration: none; white-space: nowrap; position: relative; }
.ptabs a:hover { color: var(--ink); }
.ptabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.ptabs a.dirty::after { content: ""; position: absolute; top: 7px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: #e0912b; }
.ptab-search { flex: 0 1 220px; min-width: 150px; }
.js-ptabs [data-tab]:not(.ptab-on) { display: none !important; }
.js-ptabs.ptabs-searching [data-tab] { display: block !important; }
.js-ptabs.ptabs-searching [data-tab].ptab-nomatch { display: none !important; }
.js-ptabs.ptabs-searching .ptabs a { opacity: .45; }
@media (max-width: 560px) { .ptab-search { flex: 1 1 100%; } }
.dimmed { opacity: .45; }

/* ---------- 2.0.18: extra line items, quotes & invoices ---------- */
.ro-extras { margin-top: 14px; }
.extras-table input:not([type=checkbox]), .extras-table select { min-height: 34px; padding: 4px 8px; font-size: .9rem; width: 100%; }
.extras-table td:first-child input { min-width: 160px; }
.extras-table td:nth-child(3) input { max-width: 110px; }
.extras-add { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.extras-add select { min-height: 36px; max-width: 100%; }
@media (max-width: 760px) {
  /* On a phone each extra line is a small card: description on top, then labelled fields two by two. */
  .extras-table thead { display: none; }
  .extras-table, .extras-table tbody { display: block; }
  .extras-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: end; }
  table.extras-table td { border: 0; padding: 0; min-width: 0; }
  .extras-table td[data-label]::before { content: attr(data-label); display: block; font-size: .78rem; color: var(--muted); margin-bottom: 2px; }
  .extras-table td.xt-cell::before, .extras-table td.num::before { display: none; }
  .extras-table td:first-child { grid-column: 1 / -1; }
  .extras-table td:first-child input { min-width: 0; }
  .extras-table td:nth-child(3) input { max-width: none; }
  .extras-table td.xr-cell:has(select[hidden]) { display: none; }
  .extras-table td.xt-cell { text-align: left; }
  .extras-table td.num { text-align: right; align-self: center; font-weight: 600; }
  .extras-table td:empty { display: none; }
}
.narrow-label { display: none; }
@media (max-width: 760px) { .narrow-label { display: inline; } }
.js-rate[hidden], select.js-rate[hidden] { display: none !important; }
.xi-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.xi-pair .field { margin: 0; }
.xi-new .checkline { margin-top: 4px; }

#costs .sec-title .btn-small { margin-left: auto; }
.q-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 10px 0; }
.q-col { border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px 12px; min-width: 0; }
.q-col legend { font-weight: 700; padding: 0 6px; }
.q-col .field { display: block; margin: 8px 0 0; }
.q-col input, .q-col select, .q-col textarea { width: 100%; max-width: 100%; }
.q-num-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.q-num-row [hidden] { display: none !important; }
.q-example { margin: 4px 0 0; }
@media (max-width: 760px) { .q-cols { grid-template-columns: 1fr; } }
.xi-move { white-space: nowrap; }
.xi-move .btn-small { padding: 2px 7px; min-height: 0; }
.xi-table input[type=text], .xi-table input:not([type]), .xi-table select { width: 100%; }

/* ---------- 2.0.20: the record's "..." menu ---------- */
/* Wider screens: under the button, never wider than the screen. */
.more-list { max-width: calc(100vw - 24px); }
@media (max-width: 760px) {
  /* The record's buttons stay on one row with "..." at the right. */
  .ro-head .head-actions { flex-wrap: nowrap; align-items: stretch; }
  .ro-head .head-actions > .btn { flex: 1 1 auto; min-width: 0; padding-left: 10px; padding-right: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
  .ro-head .head-actions > .more-menu { flex: 0 0 auto; margin-left: auto; }
  /* Phones: the menu opens as a panel across the screen, just above the tab bar, with the page dimmed behind it. */
  .more-menu[open] > summary::before { content: ''; position: fixed; inset: 0; background: rgba(15, 25, 40, .35); z-index: 55; cursor: default; }
  .more-list { position: fixed; left: 10px; right: 10px; top: auto; bottom: calc(72px + env(safe-area-inset-bottom)); min-width: 0; max-width: none;
    max-height: 70vh; overflow-y: auto; z-index: 60; padding: 8px; border-radius: 14px; box-shadow: 0 12px 36px rgba(15, 25, 40, .3); }
  .more-list a, .more-list button { padding: 13px 12px; font-size: 1rem; }
}

/* ---------- 2.0.20: app icon (Settings > Shop) ---------- */
.opthead-lg { margin-top: 22px; }
.icon-setup { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 24px; align-items: start; margin-bottom: 14px; }
.icon-choices { display: grid; gap: 8px; }
.icon-choices .field { margin: 4px 0 0; max-width: 200px; }
.icon-choices input[type=color] { width: 64px; height: 40px; padding: 2px; }
.icon-upload[hidden], .icon-bg[hidden] { display: none !important; }
.ip-shapes { display: flex; gap: 14px; align-items: flex-end; }
.ip-shapes figure { margin: 0; text-align: center; font-size: .78rem; color: var(--muted); }
.ip-tile { width: 76px; height: 76px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #fff; box-shadow: 0 1px 4px rgba(15, 25, 40, .25); margin: 0 auto 4px; }
.ip-tile img { width: 84%; height: 84%; object-fit: contain; }
.ip-tile.ip-fill img { width: 100%; height: 100%; }
.ip-tile.ip-std img { width: 100%; height: 100%; }
.ip-circle img { width: 60%; height: 60%; }
.ip-circle.ip-fill img { width: 80%; height: 80%; }
.ip-round { border-radius: 22%; }
.ip-circle { border-radius: 50%; }
.ip-tab { width: 32px; height: 32px; border-radius: 4px; }
.ip-tab img { width: 100%; height: 100%; }
@media (max-width: 760px) { .icon-setup { grid-template-columns: 1fr; } }
