:root {
  --ink: #17212b;
  --ink-2: #26343f;
  --bench: #e8ecea;
  --panel: #ffffff;
  --line: #d2d9d6;
  --muted: #5a6771;
  --accent: #0e6b63;
  --accent-dark: #0a524c;
  --accent-soft: #dcefec;
  --warn: #a8530a;
  --warn-soft: #fbead7;
  --bad: #b3261e;
  --bad-soft: #f9dedc;
  --good: #1d7340;
  --good-soft: #dbf0e2;
  --info-soft: #e1e8f4;
  --info: #2f4f8a;
  --radius: 6px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.5 var(--sans); color: var(--ink); background: var(--bench); }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 0.95rem; }
a { color: var(--accent-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #6fb7ae; outline-offset: 1px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.right { text-align: right; }
.hidden { display: none !important; }

/* layout */
#app { display: grid; grid-template-columns: 196px minmax(0, 1fr); min-height: 100%; }
#side { background: var(--ink); color: #c9d4dc; padding: 12px 8px; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; position: sticky; top: 0; height: 100vh; }
#side .brand { color: #fff; font-weight: 700; font-size: 1.05rem; padding: 2px 8px 8px; overflow-wrap: anywhere; }
#side a.nav { color: inherit; text-decoration: none; padding: 4px 8px; border-radius: var(--radius); display: flex; align-items: center; gap: 9px; font-size: 0.92rem; line-height: 1.25; }
#side a.nav .ico { flex: none; opacity: .85; }
#side a.nav.on .ico { opacity: 1; }
#side .nav-head { display: flex; width: 100%; align-items: center; justify-content: space-between; background: none; border: 0; cursor: pointer; color: #8396a4; text-transform: uppercase; letter-spacing: .07em; font-size: 0.68rem; font-weight: 700; padding: 8px 8px 3px; }
#side .nav-head:hover { color: #fff; }
#side .nav-head .chev { transition: transform .15s; font-size: .8rem; }
#side .nav-sec.folded .chev { transform: rotate(-90deg); }
#side .nav-sec.folded .nav-items { display: none; }
#side .nav-sec + .nav-sec { margin-top: 2px; }
#side a.nav:hover { background: var(--ink-2); color: #fff; }
#side a.nav.on { background: var(--accent); color: #fff; }
#side .grow { flex: 1; }
#main { padding: 24px 28px 60px; max-width: 1180px; width: 100%; }
#menu-btn { display: none; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .spacer { flex: 1; }
.crumb { font-size: 0.85rem; margin-bottom: 4px; }

/* surfaces */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.card > h2, .card > .card-head h2 { margin-bottom: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 18px; }
.kv dt { color: var(--muted); font-size: 0.8rem; }
.kv dd { margin: 0 0 8px; overflow-wrap: anywhere; }

/* bench board */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; margin-bottom: 16px; }
.board a { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--c, var(--line)); border-radius: var(--radius); padding: 8px 10px; text-decoration: none; color: inherit; }
.board a:hover { border-color: var(--c); }
.board .n { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.board .l { font-size: 0.78rem; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.stat .n { font-size: 1.3rem; font-weight: 650; }
.stat .l { font-size: 0.82rem; color: var(--muted); }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.8rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f3f7f6; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.empty { padding: 26px 10px; text-align: center; color: var(--muted); }

/* controls */
.btn { background: var(--panel); border: 1px solid #b7c2be; border-radius: var(--radius); padding: 7px 13px; cursor: pointer; text-decoration: none; color: var(--ink); display: inline-block; line-height: 1.3; }
.btn:hover { background: #f1f5f4; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.danger { color: var(--bad); border-color: #e2b4b0; }
.btn.small { padding: 3px 9px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.55; cursor: default; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=password], input[type=date], input[type=time], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid #b7c2be; border-radius: var(--radius); background: #fff;
}
textarea { min-height: 84px; resize: vertical; }
.toolbar input[type=text], .toolbar select { width: auto; min-width: 180px; }
label.f { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 10px; }
label.f .hint { font-weight: 400; color: var(--muted); }
label.f input, label.f select, label.f textarea { margin-top: 3px; font-weight: 400; }
label.chk { display: flex; gap: 8px; align-items: center; font-size: 0.9rem; margin-bottom: 10px; }
label.chk input { width: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.err { background: var(--bad-soft); color: var(--bad); padding: 8px 10px; border-radius: var(--radius); margin-bottom: 10px; font-size: 0.9rem; }

/* chips */
.chip { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 0.78rem; font-weight: 600; background: #e3e8e6; color: #3a4750; white-space: nowrap; }
.chip.new, .chip.draft { background: var(--info-soft); color: var(--info); }
.chip.in_progress, .chip.sent, .chip.partial { background: var(--accent-soft); color: var(--accent-dark); }
.chip.customer_reply { background: #fde8e6; color: #b3261e; }
.chip.waiting_parts, .chip.waiting_customer, .chip.high, .chip.declined, .chip.overdue { background: var(--warn-soft); color: var(--warn); }
.chip.invoiced { background: #efe7fa; color: #5b2e91; }
.chip.ready_for_pickup, .chip.paid, .chip.approved, .chip.sms-ok, .chip.sentok { background: var(--good-soft); color: var(--good); }
.chip.urgent, .chip.void, .chip.failed, .chip.low { background: var(--bad-soft); color: var(--bad); }
.chip.ordered { background: var(--info-soft); color: var(--info); }
.chip.received { background: var(--good-soft); color: var(--good); }
.chip.cancelled, .chip.closed, .chip.converted, .chip.low-p, .chip.skipped { background: #e3e8e6; color: #55626b; }

/* thread */
.thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.msg { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; background: #fafcfb; max-width: 92%; }
.msg.out { align-self: flex-end; background: var(--accent-soft); border-color: #b9dcd7; }
.msg.in { align-self: flex-start; background: #fff; }
.thread.full .msg { max-width: 100%; align-self: stretch; }
.msg.note { background: #fdf6e3; border-color: #ecdcae; align-self: stretch; max-width: 100%; }
.msg .meta { font-size: 0.78rem; color: var(--muted); margin-bottom: 2px; }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.composer { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 14px; }
.composer .row { display: flex; gap: 8px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.composer select { width: auto; }

/* modal + toast */
.overlay { position: fixed; inset: 0; background: rgba(23, 33, 43, 0.5); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px; overflow-y: auto; z-index: 58; }
.modal { background: var(--panel); border-radius: 8px; width: 100%; max-width: 560px; padding: 20px 22px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25); }
.modal.wide { max-width: 900px; }
.modal h2 { margin-bottom: 14px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--radius); max-width: 360px; overflow-wrap: anywhere; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25); }
.toast.bad { background: var(--bad); }

/* line-item editor + documents */
.items input { padding: 5px 7px; }
.items td { padding: 5px 6px; vertical-align: middle; }
.items td.desc { min-width: 220px; }
.items textarea.line-desc { width: 100%; box-sizing: border-box; min-height: 0; resize: none; overflow: hidden; padding: 5px 7px; line-height: 1.3; display: block; }
.ml { white-space: pre-line; }
.items td.g { width: 26px; padding-left: 2px; padding-right: 0; text-align: center; }
.grip { display: inline-block; cursor: grab; color: var(--muted, #7a8a85); letter-spacing: -3px; font-weight: 700; user-select: none; touch-action: none; padding: 8px 4px; border-radius: 4px; line-height: 1; }
.grip:hover, .grip:focus-visible { color: var(--ink, #111); background: rgba(0,0,0,.06); outline: none; }
.grip:active { cursor: grabbing; }
.items tr.dragging { opacity: .45; }
.items tr.drop-above > td { box-shadow: inset 0 3px 0 var(--accent, #2b7a6b); }
.items tr.drop-below > td { box-shadow: inset 0 -3px 0 var(--accent, #2b7a6b); }
.items td.q { width: 80px; } .items td.p { width: 110px; } .items td.t { width: 54px; text-align: center; } .items td.x { width: 36px; }
.totals { margin-left: auto; width: 280px; margin-top: 10px; }
.totals div { display: flex; justify-content: space-between; padding: 3px 0; }
.totals .grand { border-top: 2px solid var(--ink); font-weight: 700; font-size: 1.1rem; margin-top: 4px; padding-top: 6px; }
.doc-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.doc-head h2 { font-size: 1.4rem; }

/* auth */
.auth { max-width: 400px; margin: 9vh auto; padding: 0 16px; }
.auth .card { padding: 24px; }
.auth h1 { margin-bottom: 16px; }

@media (max-width: 860px) {
  #app { grid-template-columns: minmax(0, 1fr); }
  #side { position: fixed; z-index: 40; width: 240px; transform: translateX(-100%); transition: transform 0.15s; }
  body.menu-open #side { transform: none; }
  #menu-btn { display: inline-block; position: sticky; top: 8px; margin: 8px 0 0 12px; z-index: 30; }
  #main { padding: 14px 14px 50px; }
  .grid2 { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { #side { transition: none; } }
@media print {
  #side, #menu-btn, .no-print, #toasts { display: none !important; }
  #app { display: block; }
  body { background: #fff; }
  #main { padding: 0; max-width: none; }
  .card { border: 0; padding: 0; }
}

/* customer search box (type-ahead) and WordPress-user picker */
.pick { margin-bottom: 10px; }
.pick > label { display: block; font-size: 0.85rem; font-weight: 600; }
.pick > label .hint { font-weight: 400; color: var(--muted); }
.pick input[type=search] { width: 100%; margin-top: 3px; }
.pick-list { list-style: none; margin: 4px 0 0; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); max-height: 232px; overflow: auto; }
.pick-list li { padding: 7px 9px; border-radius: 4px; cursor: pointer; }
.pick-list li small { display: block; color: var(--muted); }
.pick-list li[aria-selected=true], .pick-list li:hover { background: var(--accent-soft); }
.pick-list li.pick-empty { cursor: default; color: var(--muted); background: none; }
.pick-chosen { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 3px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--accent-soft); }
.pick-chosen small { display: block; color: var(--muted); }
input[type=search] { width: 100%; padding: 7px 9px; border: 1px solid #b7c2be; border-radius: var(--radius); background: #fff; }

/* attachments */
.att-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.att { display: flex; gap: 12px; align-items: center; }
.att-info { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.att-thumb { width: 56px; height: 56px; border-radius: 6px; object-fit: cover; background: var(--line); flex: none; }
.att-icon { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--muted, #667); }
.att-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; border-top: 1px solid var(--line); padding-top: 12px; }
.att-form input[type=file] { max-width: 100%; }
.att-form .hint { flex-basis: 100%; }
@media print { #att-card { display: none; } }
.att-info .chk { font-size: 13px; margin: 4px 0 0; }
.thread-img { display: block; max-width: min(100%, 360px); max-height: 300px; border-radius: 6px; margin: 4px 0; }

/* printed ticket */
.tprint { background: #fff; color: #000; max-width: 780px; margin: 0 auto; padding: 16px 26px; border: 1px solid var(--line); border-radius: var(--radius); }
.tp-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 8px; }
.tp-shop { font-size: 1.3rem; font-weight: 700; }
.tp-num { text-align: right; }
.tp-title { font-size: 0.8rem; letter-spacing: 0.12em; font-weight: 700; }
.tp-id { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.tp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.tp-box { border: 1px solid #999; border-radius: 4px; padding: 5px 9px; margin-bottom: 8px; }
.tp-cols .tp-box { margin-bottom: 0; }
.tp-box h3 { margin: 0 0 2px; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: #444; }
.tp-strong { font-weight: 700; font-size: 1.05rem; }
.tp-kv { border-collapse: collapse; } .tp-kv th { text-align: left; font-weight: 400; color: #444; padding: 1px 10px 1px 0; } .tp-kv td { padding: 1px 0; }
.tp-pass { display: flex; align-items: baseline; gap: 14px; border: 2px solid #000; border-radius: 4px; padding: 6px 12px; margin-bottom: 8px; min-height: 2rem; }
.tp-pass span { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
.tp-pass strong { font-size: 1.4rem; overflow-wrap: anywhere; }
.tp-lines { height: 64px; }          /* an empty space to write in, no ruled lines */
.tp-meta { font-size: 0.8rem; margin-bottom: 6px; }
.tp-terms { font-size: 0.7rem; line-height: 1.22; white-space: pre-wrap; margin-bottom: 8px; color: #222; }
.tp-sign { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; margin: 18px 0 6px; font-size: 0.8rem; }
.tp-sign span { display: block; border-bottom: 1px solid #000; height: 26px; margin-bottom: 3px; }
.tp-foot { font-size: 0.78rem; overflow-wrap: anywhere; }
@media print { .tprint { border: 0; padding: 0; max-width: none; } }

/* sticker label */
#label-sheet { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.label { --lh: var(--h); box-sizing: border-box; width: var(--w); height: var(--h); padding: var(--m, 0.15in); overflow: hidden; background: #fff; color: #000; border: 1px dashed #888;
  display: flex; flex-direction: column; justify-content: center; font-family: Arial, Helvetica, sans-serif; line-height: 1.15; }
.lb-name { font-size: calc((var(--lh) - 2 * var(--m, 0.15in)) * 0.221); font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.lb-phone { font-size: calc((var(--lh) - 2 * var(--m, 0.15in)) * 0.186); margin-top: calc((var(--lh) - 2 * var(--m, 0.15in)) * 0.023); white-space: nowrap; overflow: hidden; }
.lb-ticket { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: calc((var(--lh) - 2 * var(--m, 0.15in)) * 0.058); border-top: 1px solid #000; padding-top: calc((var(--lh) - 2 * var(--m, 0.15in)) * 0.047); }
.lb-ticket .mono { font-size: calc((var(--lh) - 2 * var(--m, 0.15in)) * 0.256); font-weight: 700; }
.lb-ticket small { font-size: calc((var(--lh) - 2 * var(--m, 0.15in)) * 0.128); }
@media print {
  body.printing-label #label-sheet { display: block; }
  /* Fit whatever paper the printer driver is set to (it can differ from the size chosen on screen), and never spill a blank second page. */
  html:has(body.printing-label), body.printing-label, body.printing-label #app, body.printing-label #main, body.printing-label #label-sheet { height: auto !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; overflow: visible !important; }
  body.printing-label .label { --lh: calc(100vh - 0.03in); width: 100vw; height: calc(100vh - 0.03in); border: 0; break-after: page; page-break-after: always; margin: 0; }
  body.printing-label .label:last-child { break-after: auto; page-break-after: auto; }
}

/* receipt printer */
.rcpt { width: var(--w); box-sizing: border-box; background: #fff; color: #000; padding: calc(var(--rm, 5mm) * 0.8) var(--rm, 5mm) var(--rm, 5mm); border: 1px dashed #888; font-family: "Courier New", Courier, monospace; font-size: 11pt; line-height: 1.3; }
.rcpt hr { border: 0; border-top: 1px dashed #000; margin: 2mm 0; }
.rc-center { text-align: center; }
.rc-shop { font-size: 14pt; font-weight: 700; }
.rc-strong { font-weight: 700; }
.rc-row { display: flex; justify-content: space-between; gap: 6px; }
.rc-row span:last-child { white-space: nowrap; text-align: right; }
.rc-item { margin-bottom: 1.5mm; overflow-wrap: anywhere; }
.rc-total { font-weight: 700; font-size: 12.5pt; }
.rc-small { font-size: 9pt; margin-top: 1mm; }
.rc-end { height: 6mm; color: transparent; }
@media print { .rcpt { border: 0; width: var(--w); } }
.rc-bignum { font-size: 20pt; font-weight: 700; letter-spacing: 0.04em; }
.rcpt { overflow-wrap: anywhere; } .rc-row > span:first-child { min-width: 0; }

/* settings tabs and the print template editor */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab { padding: 8px 14px; border: 1px solid transparent; border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; color: var(--muted); text-decoration: none; font-weight: 600; }
.tab.on { background: #fff; border-color: var(--line); color: inherit; margin-bottom: -1px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.pt-bar { position: sticky; top: 0; z-index: 5; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.pt-stage { overflow-x: auto; padding: 4px 2px 12px; }
.pt-wrap { background: #fff; color: #000; }
.pt-wrap.tprint, .pt-wrap.rcpt, .pt-wrap.label { box-shadow: 0 1px 6px rgba(0,0,0,.15); }
.pt-edit { outline: none; min-height: 3em; }
.pt-edit:focus { box-shadow: 0 0 0 2px var(--accent-soft, #cde); }
.pt-edit [data-keep="1"] { outline: 1px dotted #0a7a68; }
.tok { display: inline-block; background: #dff0ed; border: 1px solid #9cc7bf; border-radius: 10px; padding: 0 7px; font: 12px/1.5 Arial, sans-serif; font-weight: 400; font-style: normal; color: #064; white-space: nowrap; user-select: all; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.pt-wrap.label { overflow: hidden; }
/* template editor: the label is shown larger so it is comfortable to edit, and anything that overflows stays visible */
.pt-wrap.label { zoom: 2.2; overflow: visible; }
.pt-wrap.label { margin-bottom: 6rem; }

/* calendar */
.cal-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-bar .spacer { flex: 1; }
.cal-title { font-size: 1.15rem; margin: 0; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; text-decoration: none; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.btn-group .btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin-bottom: 12px; }
.cal-legend .lg { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 3px 12px 3px 8px; cursor: pointer; }
.cal-legend .lg.off { opacity: .45; text-decoration: line-through; }
.cal-legend .lg-opt { margin-left: 8px; font-size: .85rem; display: inline-flex; align-items: center; gap: 6px; }
.cal-legend input[type=color] { width: 30px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; flex: none; }
.cal-legend .dot { margin-right: 0; }
.ev { display: block; width: 100%; text-align: left; border: 2px solid var(--c); background: var(--c); color: var(--t); border-radius: 4px; padding: 1px 5px; font-size: .7rem; line-height: 1.35; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; margin: 0 0 2px; }
.ev.st-pending { background: repeating-linear-gradient(135deg, #fff, #fff 5px, color-mix(in srgb, var(--c) 18%, #fff) 5px, color-mix(in srgb, var(--c) 18%, #fff) 10px); color: var(--ink); border-style: dashed; }
.ev.st-completed { opacity: .55; }
.ev.st-cancelled, .ev.st-no_show { opacity: .5; text-decoration: line-through; background: #fff; color: var(--ink); }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; }
.cal-month .mh { background: var(--bench); font-size: .78rem; font-weight: 600; text-align: center; padding: 5px 0; border-bottom: 1px solid var(--line); }
.mc { min-height: 104px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 3px; cursor: pointer; min-width: 0; }
.mc:nth-child(7n) { border-right: 0; }
.mc.other { background: #f6f8f7; }
.mc.other .mnum { color: #9aa6ad; }
.mc.today { background: #f1faf8; }
.mc.today .mnum { background: var(--accent); color: #fff; }
.mnum { display: inline-block; min-width: 22px; text-align: center; border-radius: 99px; font-size: .8rem; font-weight: 600; color: var(--ink); text-decoration: none; margin-bottom: 2px; }
.more { font-size: .75rem; color: var(--muted); }
.cal-tg { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow-x: auto; }
.tg-head, .tg-body { display: grid; grid-template-columns: 58px repeat(var(--n), minmax(110px, 1fr)); min-width: calc(58px + var(--n) * 110px); }
.tg-head { position: sticky; top: 0; background: var(--bench); border-bottom: 1px solid var(--line); }
.tdh { text-align: center; padding: 6px 2px; font-size: .82rem; font-weight: 600; color: var(--ink); text-decoration: none; border-left: 1px solid var(--line); }
.tdh.today { background: var(--accent); color: #fff; }
.th { font-size: .7rem; color: var(--muted); text-align: right; padding: 0 6px; transform: translateY(-.55em); }
.tgutter { padding-top: 0; }
.tcol { position: relative; border-left: 1px solid var(--line); cursor: pointer; background: repeating-linear-gradient(to bottom, transparent 0, transparent 47px, var(--line) 47px, var(--line) 48px); }
.tcol.today { background-color: #f1faf8; }
.ev.blk { position: absolute; white-space: normal; padding: 2px 4px; margin: 0; width: auto; font-size: .68rem; line-height: 1.25; }
.ev.blk .sub { display: block; opacity: .9; font-size: .63rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowline { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid #d33; z-index: 3; pointer-events: none; }
.ag h3 { margin-bottom: 6px; }
.ag-row { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; text-align: left; background: none; border: 0; border-left: 5px solid var(--c); padding: 7px 10px; margin-top: 6px; cursor: pointer; border-radius: 3px; background: #f7f9f8; }
.ag-row:hover { background: var(--accent-soft); }
.ag-row.st-completed { opacity: .6; } .ag-row.st-cancelled, .ag-row.st-no_show { opacity: .5; text-decoration: line-through; }
.ag-time { font-weight: 600; font-size: .9rem; } .ag-time small { display: block; font-weight: 400; color: var(--muted); }
.ag-main span.muted { display: block; font-size: .85rem; overflow-wrap: anywhere; }
.ag-tech { font-size: .85rem; white-space: nowrap; }
.ap-head { display: flex; gap: 12px; align-items: stretch; margin-bottom: 10px; }
.ap-bar { width: 6px; border-radius: 3px; flex: none; }
.ap-dl { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 6px 10px; margin: 0 0 14px; }
.ap-dl dt { color: var(--muted); font-size: .85rem; } .ap-dl dd { margin: 0; }
.actions.wrap { flex-wrap: wrap; }
.warn-box { grid-column: 1 / -1; margin: 10px 0 0; padding: 8px 12px; background: var(--warn-soft); color: var(--warn); border-radius: var(--radius); }
.warn-box .chk { display: flex; margin-top: 6px; }
.appt-li { margin-bottom: 4px; }
.book-hours { display: grid; grid-template-columns: 110px auto auto auto; gap: 6px 10px; align-items: center; max-width: 520px; }
.tech-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--line); }
.tech-row input[type=color] { width: 40px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 4px; }
@media (max-width: 760px) {
  .mc { min-height: 70px; } .cal-month .ev { font-size: .64rem; padding: 0 3px; } .cal-month .ev b { display: none; }
  .ag-row { grid-template-columns: 62px minmax(0, 1fr); } .ag-tech { grid-column: 2; }
}

/* online booking page */
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { border: 1px solid var(--line); background: #fff; border-radius: var(--radius); padding: 10px 14px; cursor: pointer; text-align: left; min-width: 0; }
.opt small { display: block; color: var(--muted); font-weight: 400; margin-top: 2px; }
.opts:not(.small) .opt { flex: 1 1 210px; }
.opt:hover { border-color: var(--accent); }
.opt.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }

/* inventory search box on estimates and invoices */
.stock-pick { position: relative; flex: 1 1 280px; min-width: 220px; max-width: 440px; }
.stock-pick input { width: 100%; }
.stock-pick .pick-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin-top: 2px; box-shadow: 0 6px 18px rgba(0,0,0,.14); }

/* notices (customer payment page) */
.notice { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--accent-soft); margin: 0 0 12px; }
.notice.good { background: var(--good-soft); border-color: var(--good); color: var(--ink); }

/* incoming-call popups */
#call-pops { position: fixed; top: 14px; right: 14px; z-index: 200; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 28px)); }
.call-pop { background: var(--panel); border: 1px solid var(--line); border-left: 6px solid var(--accent); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.28); padding: 12px 14px; animation: cp-in .18s ease-out; }
@keyframes cp-in { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
.cp-head { display: flex; align-items: center; gap: 8px; }
.cp-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.cp-x { margin-left: auto; border: 0; background: none; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }
.cp-num { font-size: 1.25rem; font-weight: 700; margin: 4px 0 2px; }
.cp-name { margin-bottom: 4px; }
.cp-tix { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.cp-tk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cp-tk .btn { text-align: left; max-width: 100%; white-space: normal; }
.cp-actions { margin-top: 8px; display: flex; gap: 8px; }
.cp-foot { font-size: .8rem; margin-top: 8px; }
.voip-url { margin: 10px 0; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg, #f6f8f7); }
.voip-url .mono { word-break: break-all; font-size: .82rem; margin: 4px 0 8px; }
@media print { #call-pops { display: none; } }

/* signatures */
body.kiosk #side, body.kiosk #menu-btn { display: none !important; }
body.kiosk #app { grid-template-columns: minmax(0, 1fr); }
.sign-wrap { max-width: 760px; margin: 0 auto; padding: 8px 0 40px; }
.sign-wrap h1 { margin: 6px 0 12px; }
.sign-head { text-align: center; margin-bottom: 4px; }
.sign-biz { font-size: 1.3rem; font-weight: 700; }
.sign-sum { display: grid; gap: 4px; margin-bottom: 12px; }
.sign-terms { border: 1px solid var(--line, #cfd8dc); border-radius: 6px; padding: 10px 12px; max-height: 180px; overflow: auto; white-space: pre-wrap; background: #fafbfc; font-size: 0.95rem; margin-bottom: 14px; }
.sign-agree { font-size: 1.05rem; margin: 10px 0; }
.sign-agree input { width: 22px; height: 22px; }
.sign-padbox { position: relative; border: 2px dashed #7b8a94; border-radius: 8px; background: #fff; height: 240px; margin-bottom: 10px; }
.sp-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; border-radius: 8px; }
.sp-line { position: absolute; left: 16px; right: 16px; bottom: 34px; border-top: 1px solid #9aa7b0; text-align: center; font-size: 0.75rem; color: #7b8a94; pointer-events: none; padding-top: 2px; }
.sign-padbox.inked .sp-line { opacity: 0.5; }
.sign-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.btn.big { padding: 14px 24px; font-size: 1.1rem; min-height: 52px; }
.sign-wait, .sign-thanks { text-align: center; padding-top: 12vh; }
.sign-wait p { font-size: 1.2rem; }
.sign-tick { font-size: 4rem; color: var(--accent, #0f766e); line-height: 1; }
.sign-corner { position: fixed; right: 14px; bottom: 14px; opacity: 0.6; }
.sign-corner:hover { opacity: 1; }
.sign-waiting { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.sig-thumb { display: block; max-width: 100%; max-height: 90px; border: 1px solid #cfd8dc; border-radius: 4px; background: #fff; margin-bottom: 6px; }
.sig-full { display: block; max-width: 100%; border: 1px solid #cfd8dc; border-radius: 4px; background: #fff; }
.tp-sigbox { margin: 10px 0 6px; }
.tp-sigimg { display: block; max-height: 90px; max-width: 320px; }
.tp-sigbox .tp-sign { margin: 2px 0 0; border-top: 1px solid #000; padding-top: 3px; }
@media (max-width: 600px) { .sign-padbox { height: 200px; } }
.ci-h { margin: 18px 0 6px; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted, #5b6b75); }
.ci-num { font-size: 2.6rem; font-weight: 700; margin: 0 0 6px; }
.sign-wait .btn.big { margin-top: 8px; }
body.kiosk .sign-wrap input, body.kiosk .sign-wrap select, body.kiosk .sign-wrap textarea { font-size: 1.05rem; min-height: 44px; }
body.kiosk .sign-wrap label.f { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-weight: 600; }
body.kiosk .sign-wrap label.f input, body.kiosk .sign-wrap label.f select, body.kiosk .sign-wrap label.f textarea { width: 100%; box-sizing: border-box; font-weight: 400; }
body.kiosk .sign-wrap .form-grid { gap: 0 16px; }



/* import / export */
.imp-opts { border: 0; padding: 0; margin: 0; }
.imp-opts legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
.imp-h { margin: 18px 0 6px; font-size: 1rem; }
.imp-sum { display: flex; flex-wrap: wrap; gap: 10px; }
.imp-sum > div { background: #f3f6f7; border: 1px solid var(--line, #dde3e6); border-radius: 8px; padding: 10px 14px; min-width: 140px; flex: 1 1 150px; }
.imp-sum strong { display: block; font-size: 1.5rem; }
.imp-sum span { font-size: 0.85rem; color: var(--muted, #5b6b75); }
.imp-sum .good { border-color: #7bb8ae; background: #eef7f5; }
.imp-sum .bad { border-color: #e0a8a8; background: #fbeeee; }
.imp-pill { display: inline-block; background: #eef2f4; border-radius: 999px; padding: 2px 10px; margin: 0 4px 4px 0; font-size: 0.85rem; color: var(--ink, #1c2b36); }
.imp-more { margin-top: 8px; }
.imp-prog { height: 10px; background: #e3e9ec; border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.imp-prog > div { height: 100%; background: var(--accent, #0f766e); transition: width 0.2s; }
.imp-done { background: #eef7f5; border: 1px solid #7bb8ae; border-radius: 8px; padding: 14px 16px; margin-top: 14px; }
.imp-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--line, #dde3e6); }
.imp-tabs a { padding: 8px 16px; text-decoration: none; color: var(--muted, #5b6b75); border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 600; }
.imp-tabs a:hover { color: var(--ink, #1c2b36); }
.imp-tabs a.on { color: var(--accent-dark, #0b5f58); border-bottom-color: var(--accent, #0f766e); }

.bad-text { color: var(--bad, #b3261e); }

/* estimate cost and profit (private to the shop) */
.profit > div { display: flex; justify-content: space-between; gap: 24px; padding: 2px 0; }
.profit .neg { color: #b42318; }

/* inventory barcode label: name and price on top, barcode filling the rest */
.ib { justify-content: space-between; }
.ib-top { display: flex; align-items: flex-start; justify-content: space-between; gap: calc(var(--h) * 0.08); }
.ib-name { line-height: 1.15; min-width: 0; flex: 1; }
.ib-name > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-price { font-weight: 700; white-space: nowrap; line-height: 1.1; }
.ib-code-wrap { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.ib-bars { display: block; max-width: 100%; }
.ib-code { letter-spacing: 0.06em; white-space: nowrap; margin-top: calc(var(--h) * 0.01); line-height: 1.1; }

/* dashboard: tickets take half the width, reminders the other half */
.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.dash-cols > .card { min-width: 0; }
@media (max-width: 1000px) { .dash-cols { grid-template-columns: 1fr; } }

/* reminders */
.rem-list { display: flex; flex-direction: column; }
.rem { display: flex; gap: 10px; align-items: flex-start; padding: 10px 2px; border-top: 1px solid var(--line); }
.rem:first-child { border-top: 0; }
.rem-body { flex: 1; min-width: 0; }
.rem-msg { font-weight: 600; overflow-wrap: anywhere; }
.rem-note { color: var(--muted); font-size: 0.9rem; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.rem-meta { color: var(--muted); font-size: 0.85rem; margin-top: 3px; }
.rem-late .rem-when { color: #b42318; font-weight: 600; }
.rem-done { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); background: var(--panel); color: transparent; font-size: 1rem; cursor: pointer; line-height: 1; }
.rem-done:hover, .rem-done:focus-visible { border-color: #1d7340; background: #1d7340; color: #fff; }

.rem-more { color: var(--muted); font-size: 0.85rem; padding: 8px 2px 0; border-top: 1px solid var(--line); }

/* invoices, estimates and other pages: a margin even when the print window is set to None */
@page { margin: 12mm; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 12px 0 2px; flex-wrap: wrap; }
.pager .btn.disabled { opacity: .45; pointer-events: none; }
.pager-note { text-align: center; margin: 10px 0 0; }

/* the person and their bell */
#side .usr { display: flex; align-items: center; gap: 8px; padding: 2px 6px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--ink-2); }
#side .avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 0.78rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
#side .uname { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 0.86rem; color: #fff; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#side .uname small { color: #8396a4; font-size: 0.7rem; }
#side .bell { position: relative; flex: none; background: none; border: 0; color: #c9d4dc; cursor: pointer; padding: 6px; border-radius: var(--radius); display: flex; }
#side .bell:hover, #side .bell[aria-expanded=true] { background: var(--ink-2); color: #fff; }
#side .bell-n { position: absolute; top: 0; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #e5484d; color: #fff; font-size: 0.66rem; font-weight: 700; line-height: 16px; text-align: center; }
.bell-panel { position: fixed; z-index: 60; top: 8px; left: 204px; width: 360px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow-y: auto; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.25); }
.bp-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: inherit; }
.bp-head .spacer { flex: 1; }
.bp-list { list-style: none; margin: 0; padding: 0; }
.bp-item { display: flex; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; cursor: pointer; color: inherit; }
.bp-item:hover { background: rgba(0,0,0,.04); }
.bp-item.unread { background: var(--accent-soft); }
.bp-item.unread strong::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #e5484d; margin-right: 6px; }
.bp-item .ico { flex: none; margin-top: 2px; opacity: .7; }
.bp-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 0.9rem; }
.bp-body { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.bp-when { font-size: 0.78rem; }
.bp-empty { padding: 22px 14px; }
@media (max-width: 860px) { .bell-panel { left: 8px; right: 8px; width: auto; top: 56px; max-height: calc(100vh - 70px); } }

/* accounting reports */
.rep-group { font-size: 1rem; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.rep-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.rep-card { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; }
.rep-card:hover { border-color: var(--accent); }
.rep-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.rep-filter label { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; }
.rep-sub { margin: 0 0 10px; }
.rep-tiles { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.rep-tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px; display: flex; flex-direction: column; min-width: 120px; }
.rep-tile strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.rep-scroll { overflow-x: auto; }
.rep-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.rep-table th, .rep-table td { padding: 5px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.rep-table th.num, .rep-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rep-table thead th { position: sticky; top: 0; background: var(--panel); border-bottom: 2px solid var(--line); font-size: 0.8rem; }
.rep-gh th { background: var(--accent-soft); font-size: 0.85rem; }
.rep-st td { font-weight: 600; background: rgba(0,0,0,.03); }
.rep-tot td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; }
.rep-note { margin: 8px 0 0; font-size: 0.85rem; }
@media print {
  .rep-table { font-size: 8.5pt; } .rep-table th, .rep-table td { padding: 2px 6px; }
  .rep-table thead th { position: static; } .rep-table tr { break-inside: avoid; }
  .rep-tile { border: 1px solid #999; } .rep-scroll { overflow: visible; }
}

.msg.pub { border-style: dashed; background: #eef5ff; border-color: #a9c4ea; }

/* formatted messages */
.rte-bar { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
.rte-bar button { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 3px 9px; font: inherit; font-size: 0.85rem; cursor: pointer; min-width: 30px; }
.rte-bar button:hover { background: var(--accent-soft); }
.rte-bar .sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.rte { min-height: 90px; max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; background: #fff; overflow-wrap: anywhere; }
.rte:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.rte:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.rte p, .rte div { margin: 0; }
.msg .body.rich { white-space: normal; }
.msg .body.rich p { margin: 0 0 0.6em; }
.msg .body.rich p:last-child, .msg .body.rich ul:last-child, .msg .body.rich ol:last-child { margin-bottom: 0; }
.msg .body.rich ul, .msg .body.rich ol, .rte ul, .rte ol { margin: 0 0 0.6em; padding-left: 1.4em; }
.msg .body.rich blockquote { margin: 0 0 0.6em; padding-left: 10px; border-left: 3px solid var(--line); color: var(--muted); }
.msg .body.rich a, .rte a { color: var(--accent); text-decoration: underline; }
.msg .body.rich pre { white-space: pre-wrap; margin: 0 0 0.6em; }
.msg .body.rich h3 { font-size: 1rem; margin: 0 0 0.4em; }

/* leads */
.lead-body { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 14em; overflow: auto; background: #fafcfb; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.lead-n { margin-left: auto; background: var(--accent); color: #fff; border-radius: 999px; font-size: 0.72rem; min-width: 20px; padding: 0 6px; text-align: center; line-height: 18px; }
.lead-n[hidden] { display: none; }

/* tables and pictures in messages */
.rte-table { margin: -2px 0 6px; padding: 4px 6px; background: var(--accent-soft); border-radius: 6px; }
.rte-table[hidden] { display: none; }
.rte table, .msg .body.rich table, .lead-body.rich table { border-collapse: collapse; margin: 0 0 0.6em; max-width: 100%; }
/* a table made in the message box gets plain grid lines; a table that came with its own look (an email, a pasted page) keeps exactly that look */
.rte table:not(.fmt) td, .rte table:not(.fmt) th, .msg .body.rich table:not(.fmt) td, .msg .body.rich table:not(.fmt) th, .lead-body.rich table:not(.fmt) td, .lead-body.rich table:not(.fmt) th { border: 1px solid #b9c3bf; padding: 4px 8px; min-width: 48px; vertical-align: top; text-align: left; }
.rte table:not(.fmt) th, .msg .body.rich table:not(.fmt) th, .lead-body.rich table:not(.fmt) th { background: #eef2f0; }
.rte table.fmt td, .rte table.fmt th, .msg .body.rich table.fmt td, .msg .body.rich table.fmt th, .lead-body.rich table.fmt td, .lead-body.rich table.fmt th { padding: 1px; vertical-align: top; }
.rte img, .msg .body.rich img, .lead-body.rich img { max-width: 100%; height: auto; border-radius: 4px; }
.msg .body.rich img, .lead-body.rich img { cursor: zoom-in; }
.msg .body.rich, .lead-body.rich { overflow-x: auto; }
.rte h3 { font-size: 1rem; margin: 0 0 0.4em; }
.rte blockquote { margin: 0 0 0.6em; padding-left: 10px; border-left: 3px solid var(--line); color: var(--muted); }

/* collapsible delivery log */
details.dlog > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
details.dlog > summary::-webkit-details-marker { display: none; }
details.dlog > summary::before { content: '\25B8'; color: var(--muted); }
details.dlog[open] > summary::before { content: '\25BE'; }
details.dlog > summary h2 { margin: 0; flex: 1; }
details.dlog[open] > summary { margin-bottom: 10px; }

.maplink { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; }
.maplink:hover { color: var(--accent); text-decoration: underline; }

/* the Settings page of tiles */
.set-h { font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 22px 0 8px; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.set-tile { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); color: inherit; text-decoration: none; position: relative; min-height: 64px; }
.set-tile:hover, .set-tile:focus-visible { border-color: var(--accent); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08); }
.set-ico { flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.set-ico .ico { width: 22px; height: 22px; }
.set-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.set-txt .muted { font-size: 0.82rem; line-height: 1.25; }
.set-st { margin-top: 4px; align-self: flex-start; }

/* search everything */
.topbar { position: sticky; top: 0; z-index: 55; padding: 10px 28px; max-width: 1180px; width: 100%; background: linear-gradient(var(--bench) 78%, rgba(232, 236, 234, 0)); }
.topbar .gs-wrap { margin: 0 auto; }
body.kiosk #topbar { display: none; }
@media (max-width: 900px) { .topbar { padding: 8px 14px; } }
.gs-wrap { flex: 1 1 320px; max-width: 620px; margin: 0 auto; }
.gs { position: relative; }
.gs input { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font: inherit; }
.gs input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.gs-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.gs-pop { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16); max-height: 70vh; overflow: auto; z-index: 60; padding: 4px 0; }
.gs-pop[hidden] { display: none; }
.gs-gh { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 8px 14px 3px; display: flex; justify-content: space-between; }
.gs-gh a { text-transform: none; letter-spacing: 0; }
.gs-item { display: flex; align-items: center; gap: 10px; padding: 7px 14px; color: inherit; text-decoration: none; }
.gs-item:hover, .gs-item.on { background: var(--accent-soft); }
.gs-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gs-t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-s { font-size: 0.82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.gs-all, .gs-none { display: block; padding: 9px 14px; border-top: 1px solid var(--line); color: var(--accent); text-decoration: none; }
.gs-none { color: var(--muted); border: 0; }
.gs-page { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 0 8px; margin-top: 12px; }
@media (max-width: 700px) { .gs-wrap { order: 3; flex-basis: 100%; max-width: none; } }

.lm-row { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 10px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; margin-bottom: 6px; font: inherit; cursor: pointer; }
.lm-row:hover, .lm-row:focus-visible { border-color: var(--accent); background: var(--accent-soft); }

.lead-body.rich { white-space: normal; max-height: 34em; }
.lead-body.rich p { margin: 0 0 0.6em; }
.lead-files { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }

.bp-foot { display: flex; gap: 14px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: .85rem; position: sticky; bottom: 0; background: inherit; }
.alert-hint { position: fixed; z-index: 70; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; max-width: calc(100vw - 24px); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: 10px 14px; }

/* an email that brought its own look is shown on a white panel, as its sender designed it */
.msg .body.rich.panel { background: #fff; color: #1f2933; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin-top: 4px; }

/* pattern lock (phones and tablets) */
.pat-wrap { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.pat-pad.edit { touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; background: #f4f7f6; }
.pat-side { display: flex; flex-direction: column; gap: 8px; min-width: 180px; flex: 1; }
.pat-txt { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }
.pat-txt input { max-width: 12rem; letter-spacing: 0.15em; }
.pat-help, .pat-msg { font-size: 0.85rem; }
.pat-show { display: flex; gap: 12px; align-items: center; }
.tp-pat { display: flex; gap: 14px; align-items: center; }

/* the formatted-text boxes for the automatic messages (Settings) */
.rich-f .rte { min-height: 9rem; max-height: 420px; }
.rich-f .rte p { margin: 0 0 0.6em; }
.rich-f .rte ul, .rich-f .rte ol { margin: 0 0 0.6em; padding-left: 1.4em; }
.rich-f .rte h3 { font-size: 1.05rem; margin: 0 0 0.4em; }
.rich-f .rte a { color: var(--accent); text-decoration: underline; }
.rich-f .rte-bar select { width: auto; max-width: 16rem; font: inherit; font-size: 0.85rem; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line); background: #fff; margin-left: auto; }

/* the "Insert placeholder" picker */
.ph-select { width: auto; max-width: 16rem; font: inherit; font-size: 0.85rem; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line); background: #fff; align-self: flex-start; margin-top: 4px; }
.rte-bar .ph-select, .composer .row .ph-select { margin-top: 0; }

/* canned responses */
.cn-list { max-height: 55vh; overflow: auto; margin-top: 10px; }
.cn-cat { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #666; margin: 12px 0 4px; }
.cn-item { display: block; width: 100%; text-align: left; padding: 8px 10px; margin: 0 0 6px; border: 1px solid #d9dde3; border-radius: 6px; background: #fff; cursor: pointer; font: inherit; }
.cn-item:hover, .cn-item:focus-visible { border-color: #2271b1; background: #f3f8fc; outline: none; }
.cn-item .muted { display: block; font-size: .85rem; margin-top: 2px; }

/* audit log */
.au-ch { margin: 4px 0 0; padding-left: 18px; font-size: .88rem; color: #444; }
.au-ch li { margin: 1px 0; }

/* refurbs */
.rf-sum { width: 100%; border-collapse: collapse; }
.rf-sum td { padding: 4px 0; }
.rf-sum .rf-total td { border-top: 1px solid var(--line, #ccc); padding-top: 8px; }
.rf-note { padding: 8px 0; border-top: 1px solid var(--line, #e3e8e6); }
.rf-note:first-child { border-top: 0; }

/* ---- dashboard: month to date ---- */
.sum-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.sum-cols h3, .vz h3 { margin: 0 0 6px; font-size: 0.85rem; color: var(--muted); font-weight: 600; text-transform: none; }
.sum-row { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px solid var(--line); }
.sum-row strong { font-variant-numeric: tabular-nums; }
.vz-grid-wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.vz { min-width: 0; }
.vz svg { width: 100%; height: auto; display: block; }
.vz-donut { display: flex; align-items: center; gap: 14px; }
.vz-donut svg { width: 150px; flex: 0 0 150px; }
.vz-big, .vz-sub { pointer-events: none; }
.vz-big { font-size: 15px; font-weight: 700; fill: var(--ink); }
.vz-sub, .vz-axis { font-size: 9px; fill: var(--muted); }
.vz-grid { stroke: var(--line); stroke-width: 1; }
.vz-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; font-size: 0.85rem; }
.vz-legend li { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.vz-legend .sw { width: 10px; height: 10px; border-radius: 2px; flex: 0 0 10px; }
.vz-legend .lb { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vz-legend .v { font-variant-numeric: tabular-nums; color: var(--muted); }
.vz-empty { color: var(--muted); padding: 30px 0; text-align: center; }
.vz-hit:hover .vz-mark, .vz-mark:hover { opacity: 0.8; }
.vz-table { margin-top: 6px; font-size: 0.8rem; }
.vz-table summary { cursor: pointer; color: var(--muted); }
.vz-tip { position: fixed; z-index: 9999; background: var(--ink); color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 0.8rem; pointer-events: none; white-space: nowrap; }
.vz-tip[hidden] { display: none; }

/* ---- staff notifications page ---- */
.sn-tbl td.c, .sn-tbl th.c { text-align: center; width: 64px; }
.sn-tbl select { max-width: 280px; }
.sn-also summary { cursor: pointer; }
.sn-also .chk { display: block; margin: 4px 0; font-weight: 400; }

/* the account menu under the avatar */
#side .usr-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 3px 4px; margin: -3px 0; border-radius: var(--radius); color: inherit; cursor: pointer; text-align: left; font: inherit; }
#side .usr-btn:hover, #side .usr-btn[aria-expanded=true] { background: var(--ink-2); }
#side .usr-caret { color: #8396a4; font-size: 0.8rem; padding-right: 2px; }
.user-menu { position: fixed; z-index: 61; min-width: 190px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.25); padding: 4px; display: flex; flex-direction: column; }
.user-menu.hidden { display: none; }
.user-menu a, .user-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 6px; font: inherit; font-size: 0.92rem; color: var(--ink); text-decoration: none; cursor: pointer; }
.user-menu a:hover, .user-menu button:hover, .user-menu a:focus-visible, .user-menu button:focus-visible { background: var(--accent-soft); outline: none; }

/* ---- charts: the colours come from these so dark mode can swap them ---- */
:root { --vz-1: #2a78d6; --vz-2: #eb6834; --vz-3: #1baf7a; --vz-4: #eda100; --vz-5: #e87ba4; --vz-6: #008300; --vz-other: #8a969e; }

/* ---- dark mode (screen only; printed pages stay on white paper) ---- */
@media screen {
  html[data-theme="dark"] {
    color-scheme: dark;
    --ink: #e4ebf0; --ink-2: #243440; --bench: #0e151b; --panel: #17212a; --line: #2d3b47; --line-2: #42535f; --field: #0f171e; --muted: #9aabb8;
    --accent-dark: #5cc4b7; --accent-soft: #16343a;
    --warn: #f0a45a; --warn-soft: #3b2a15; --bad: #ff8f86; --bad-soft: #3f2120; --good: #5dd08a; --good-soft: #173324; --info: #92b2f0; --info-soft: #1b2a45;
    --vz-1: #3987e5; --vz-2: #d95926; --vz-3: #199e70; --vz-4: #c98500; --vz-5: #d55181; --vz-6: #008300; --vz-other: #6f7d88;
  }
  html[data-theme="dark"] body { background: var(--bench); color: var(--ink); }
  html[data-theme="dark"] #side { background: #0a1015; }
  html[data-theme="dark"] :focus-visible { outline-color: #5cc4b7; }
  html[data-theme="dark"] .toast, html[data-theme="dark"] .vz-tip { background: #2b3b48; color: #fff; }
  html[data-theme="dark"] .overlay { background: rgba(0, 0, 0, 0.62); }
  html[data-theme="dark"] .modal, html[data-theme="dark"] .bell-panel, html[data-theme="dark"] .user-menu, html[data-theme="dark"] .call-pop { box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6); }

  /* fields and buttons */
  html[data-theme="dark"] input:not([type]), html[data-theme="dark"] input[type=url], html[data-theme="dark"] input[type=datetime-local], html[data-theme="dark"] input[type=text], html[data-theme="dark"] input[type=email], html[data-theme="dark"] input[type=tel], html[data-theme="dark"] input[type=number],
  html[data-theme="dark"] input[type=password], html[data-theme="dark"] input[type=date], html[data-theme="dark"] input[type=search], html[data-theme="dark"] input[type=time],
  html[data-theme="dark"] select, html[data-theme="dark"] textarea, html[data-theme="dark"] .gs input, html[data-theme="dark"] .rich-f .rte-bar select, html[data-theme="dark"] .ph-select {
    background: var(--field); color: var(--ink); border-color: var(--line-2);
  }
  html[data-theme="dark"] ::placeholder { color: #70818e; }
  html[data-theme="dark"] .btn { border-color: var(--line-2); }
  html[data-theme="dark"] .btn:hover { background: #22303b; }
  html[data-theme="dark"] .btn.primary { color: #fff; }
  html[data-theme="dark"] .btn.primary:hover { background: #128178; border-color: #128178; }
  html[data-theme="dark"] .btn.danger { border-color: #6b3633; }

  /* tables, chips, thread, cards */
  html[data-theme="dark"] tr.click:hover td { background: #1d2a34; }
  html[data-theme="dark"] .chip { background: #2a3843; color: #c3d0d9; }
  html[data-theme="dark"] .chip.new, html[data-theme="dark"] .chip.draft, html[data-theme="dark"] .chip.ordered { background: var(--info-soft); color: var(--info); }
  html[data-theme="dark"] .chip.in_progress, html[data-theme="dark"] .chip.sent, html[data-theme="dark"] .chip.partial { background: var(--accent-soft); color: var(--accent-dark); }
  html[data-theme="dark"] .chip.customer_reply { background: #4a2523; color: #ff9d95; }
  html[data-theme="dark"] .chip.waiting_parts, html[data-theme="dark"] .chip.waiting_customer, html[data-theme="dark"] .chip.high, html[data-theme="dark"] .chip.declined, html[data-theme="dark"] .chip.overdue { background: var(--warn-soft); color: var(--warn); }
  html[data-theme="dark"] .chip.invoiced { background: #3a2a55; color: #d6bcff; }
  html[data-theme="dark"] .chip.ready_for_pickup, html[data-theme="dark"] .chip.paid, html[data-theme="dark"] .chip.approved, html[data-theme="dark"] .chip.sms-ok, html[data-theme="dark"] .chip.sentok, html[data-theme="dark"] .chip.received { background: var(--good-soft); color: var(--good); }
  html[data-theme="dark"] .chip.urgent, html[data-theme="dark"] .chip.void, html[data-theme="dark"] .chip.failed, html[data-theme="dark"] .chip.low { background: var(--bad-soft); color: var(--bad); }
  html[data-theme="dark"] .chip.cancelled, html[data-theme="dark"] .chip.closed, html[data-theme="dark"] .chip.converted, html[data-theme="dark"] .chip.low-p, html[data-theme="dark"] .chip.skipped { background: #2a3843; color: #9fb0bc; }
  html[data-theme="dark"] .msg { background: #1b2630; }
  html[data-theme="dark"] .msg.out { background: var(--accent-soft); border-color: #2a5a60; }
  html[data-theme="dark"] .msg.in { background: #1d2a34; }
  html[data-theme="dark"] .msg.note { background: #332c18; border-color: #5a4d25; }
  html[data-theme="dark"] .msg.pub { background: #1b2a45; border-color: #36528a; }
  html[data-theme="dark"] .msg .body.rich.panel { background: #f4f6f7; color: #1f2933; }     /* a customer's email keeps its own light look */
  html[data-theme="dark"] .tab.on, html[data-theme="dark"] .set-tile, html[data-theme="dark"] .opt, html[data-theme="dark"] .gs-pop, html[data-theme="dark"] .gs-page,
  html[data-theme="dark"] .lm-row, html[data-theme="dark"] .alert-hint, html[data-theme="dark"] .cn-item, html[data-theme="dark"] .rte-bar button, html[data-theme="dark"] .cal-legend .lg { background: var(--panel); color: var(--ink); }
  html[data-theme="dark"] .cn-item { border-color: var(--line-2); }
  html[data-theme="dark"] .cn-item:hover, html[data-theme="dark"] .cn-item:focus-visible { background: #1d2a34; border-color: var(--accent-dark); }
  html[data-theme="dark"] .rte, html[data-theme="dark"] .sign-terms { background: var(--field); color: var(--ink); }
  html[data-theme="dark"] .lead-body, html[data-theme="dark"] .voip-url, html[data-theme="dark"] .pat-pad.edit { background: #131d25; color: var(--ink); }
  html[data-theme="dark"] .rte table:not(.fmt) th, html[data-theme="dark"] .msg .body.rich table:not(.fmt) th, html[data-theme="dark"] .lead-body.rich table:not(.fmt) th { background: #22303b; }
  html[data-theme="dark"] .rte table:not(.fmt) td, html[data-theme="dark"] .rte table:not(.fmt) th, html[data-theme="dark"] .msg .body.rich table:not(.fmt) td, html[data-theme="dark"] .msg .body.rich table:not(.fmt) th { border-color: var(--line-2); }
  html[data-theme="dark"] .bp-item:hover { background: rgba(255, 255, 255, 0.06); }
  html[data-theme="dark"] .rep-st td { background: rgba(255, 255, 255, 0.05); }
  html[data-theme="dark"] .au-ch, html[data-theme="dark"] .cn-cat { color: var(--muted); }

  /* calendar */
  html[data-theme="dark"] .cal-month, html[data-theme="dark"] .cal-tg { background: var(--panel); }
  html[data-theme="dark"] .mc.other { background: #121b23; }
  html[data-theme="dark"] .mc.other .mnum { color: #8697a4; }
  html[data-theme="dark"] .mc.today, html[data-theme="dark"] .tcol.today { background-color: #15303a; }
  html[data-theme="dark"] .ev.st-pending { background: repeating-linear-gradient(135deg, #17212a, #17212a 5px, color-mix(in srgb, var(--c) 30%, #17212a) 5px, color-mix(in srgb, var(--c) 30%, #17212a) 10px); color: var(--ink); }
  html[data-theme="dark"] .ev.st-cancelled, html[data-theme="dark"] .ev.st-no_show { background: var(--panel); color: var(--ink); }

  /* import / export and other tinted boxes */
  html[data-theme="dark"] .imp-sum > div { background: #1b2630; }
  html[data-theme="dark"] .imp-sum .good, html[data-theme="dark"] .imp-done { background: #14302c; border-color: #2b6b62; }
  html[data-theme="dark"] .imp-sum .bad { background: #3a1f1f; border-color: #7a3a3a; }
  html[data-theme="dark"] .imp-pill { background: #25333e; color: var(--ink); }
  html[data-theme="dark"] .imp-prog { background: #25333e; }
  html[data-theme="dark"] .profit .neg, html[data-theme="dark"] .rem-late .rem-when { color: #ff8f86; }

  /* paper previews (tickets, receipts, labels, signing pad) stay white on purpose */
  html[data-theme="dark"] .tprint, html[data-theme="dark"] .label, html[data-theme="dark"] .rcpt, html[data-theme="dark"] .pt-wrap, html[data-theme="dark"] .sign-padbox { color-scheme: light; }
  html[data-theme="dark"] .tok { background: #1d3b3a; border-color: #2f6b66; color: #9fe3d6; }

  /* charts */
  html[data-theme="dark"] .vz-big { fill: var(--ink); }
}

.um-label { padding: 6px 12px 2px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.um-themes { display: flex; flex-direction: column; }
.user-menu button[aria-checked=true]::before { content: '\2713'; display: inline-block; width: 1.2em; color: var(--accent); font-weight: 700; }
.user-menu button[aria-checked=false]::before { content: ''; display: inline-block; width: 1.2em; }
.um-sep { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* ---- the calculator pop-out ---- */
.calc { position: fixed; z-index: 57; width: 268px; max-width: calc(100vw - 8px); background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 36px rgba(0, 0, 0, .3); outline: none; touch-action: none; }
.calc-head { display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 12px; cursor: move; user-select: none; border-bottom: 1px solid var(--line); }
.calc-head .spacer { flex: 1; }
.calc-x { background: none; border: 0; color: var(--muted); font-size: 1.1rem; line-height: 1; width: 28px; height: 28px; border-radius: 6px; cursor: pointer; }
.calc-x:hover { background: var(--accent-soft); color: var(--ink); }
.calc-body { padding: 8px 10px 10px; }
.calc-tape { list-style: none; margin: 0 0 6px; padding: 0; max-height: 74px; overflow-y: auto; font-size: .78rem; color: var(--muted); }
.calc-tape:empty { display: none; }
.calc-tape button { display: flex; justify-content: space-between; gap: 8px; width: 100%; background: none; border: 0; padding: 2px 4px; border-radius: 4px; font: inherit; color: inherit; cursor: pointer; text-align: right; }
.calc-tape button:hover { background: var(--accent-soft); color: var(--ink); }
.calc-e { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calc-screen { background: var(--field, #f4f7f6); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; text-align: right; margin-bottom: 8px; min-height: 66px; }
html:not([data-theme="dark"]) .calc-screen { background: #f4f7f6; }
.calc-expr { font-size: .9rem; color: var(--muted); overflow-x: auto; white-space: nowrap; min-height: 1.3em; }
.calc-res { font-size: 1.7rem; font-weight: 600; font-variant-numeric: tabular-nums; overflow-x: auto; white-space: nowrap; line-height: 1.3; min-height: 1.3em; }
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.calc-k { position: relative; padding: 10px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; font-size: 1.02rem; cursor: pointer; }
.calc-k:hover { background: var(--accent-soft); }
.calc-k:active { transform: translateY(1px); }
.calc-k.op { color: var(--accent-dark); font-weight: 600; }
.calc-k.fn { background: var(--bench); font-size: .85rem; }
.calc-k.mem { font-size: .8rem; color: var(--muted); padding: 7px 0; }
.calc-k.eq { grid-column: span 2; background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.calc-k.eq:hover { background: var(--accent-dark); }
html[data-theme="dark"] .calc-k.eq:hover { background: #128178; }
.calc-dot { position: absolute; top: 4px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.calc-foot { display: flex; justify-content: space-between; gap: 6px; margin-top: 8px; }
@media print { .calc { display: none; } }

/* Staff chat pop-out */
.chat { position: fixed; z-index: 56; right: 16px; bottom: 16px; width: 360px; max-width: calc(100vw - 16px); height: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 36px rgba(0, 0, 0, .3); overflow: hidden; }
.chat-head { cursor: move; user-select: none; touch-action: none; display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); }
.chat-head .spacer { flex: 1; }
.chat-head .calc-x { cursor: pointer; }
.chat-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-body { flex: 1; overflow-y: auto; padding: 6px; }
.chat-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: 8px; color: var(--ink); cursor: pointer; font: inherit; }
.chat-row:hover { background: var(--accent-soft); }
.chat-av { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); display: grid; place-items: center; font-weight: 700; }
.chat-rt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-prev { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
.chat-row.unread .chat-prev { color: var(--ink); font-weight: 600; }
.chat-dot, .chat-badge { background: var(--bad); color: #fff; border-radius: 999px; font-size: .72rem; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px; display: inline-grid; place-items: center; }
.chat-badge { margin-left: auto; }
.chat-sec { padding: 10px 8px 4px; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.chat-note { padding: 6px 12px; font-size: .78rem; border-top: 1px solid var(--line); }
.chat-empty { padding: 20px; text-align: center; }
.chat-thread { display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.chat-msg { max-width: 85%; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; text-align: right; }
.chat-meta { font-size: .72rem; margin-bottom: 2px; }
.chat-bub { display: inline-block; text-align: left; background: var(--bench); border-radius: 10px; padding: 6px 10px; overflow-wrap: anywhere; }
.chat-msg.mine .chat-bub { background: var(--accent); color: #fff; }
.chat-msg.mine .chat-bub a { color: #fff; }
.chat-msg.gone .chat-bub { background: none; border: 1px dashed var(--line); color: var(--muted); }
.chat-del { background: none; border: 0; color: var(--muted); font-size: .72rem; cursor: pointer; text-decoration: underline; padding: 0; }
.chat-compose { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.chat-compose textarea { flex: 1; resize: none; max-height: 90px; font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: var(--panel); color: var(--ink); }
@media (max-width: 600px) { .chat { right: 8px; bottom: 8px; left: 8px; width: auto; height: calc(100vh - 80px); } }

.chat-img { display: block; max-width: 220px; max-height: 200px; border-radius: 10px; border: 1px solid var(--line); margin-bottom: 3px; background: var(--bench); }
.chat-msg.mine .chat-img { margin-left: auto; }
.chat-file { display: inline-flex; align-items: center; gap: 6px; text-align: left; background: var(--bench); border-radius: 10px; padding: 6px 10px; margin-bottom: 3px; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.chat-file:hover { background: var(--accent-soft); }
.chat-pending { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-top: 1px solid var(--line); background: var(--accent-soft); font-size: .85rem; }
.chat-pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-clip { align-self: flex-end; }

.switch-banner { background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--line); padding: 6px 12px; font-size: .9rem; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sw-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; margin: 8px 0; }
.sw-item { display: flex; align-items: center; gap: 10px; text-align: left; width: 100%; }
.sw-item .muted { margin-left: auto; font-size: .8rem; }
.sw-av { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); display: grid; place-items: center; font-weight: 700; }
textarea[name=ticket_terms] { min-height: 16em; }

/* Texts */
.tx-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 12px; align-items: start; }
.tx-list { padding: 4px; max-height: 70vh; overflow-y: auto; }
.tx-row { position: relative; display: block; padding: 8px 34px 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.tx-row:hover, .tx-row.on { background: var(--accent-soft); }
.tx-row.unread .tx-prev { color: var(--ink); font-weight: 600; }
.tx-top { display: flex; gap: 8px; justify-content: space-between; }
.tx-when { font-size: .75rem; white-space: nowrap; }
.tx-prev { display: block; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-row .chat-dot { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.tx-pane { padding: 0; min-height: 320px; display: flex; flex-direction: column; }
.tx-head { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tx-back { display: none; }
.tx-msgs { flex: 1; overflow-y: auto; min-height: 220px; max-height: 58vh; }
.tx-empty { padding: 20px; text-align: center; }
.tx-bad { color: var(--bad); font-size: .78rem; margin-top: 2px; }
.tx-compose { align-items: stretch; }
.tx-side { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.tx-count { font-size: .72rem; text-align: center; }
.tx-reason { padding: 12px; margin: 0; }
@media (max-width: 760px) {
  .tx-wrap { grid-template-columns: 1fr; }
  .tx-wrap.open .tx-list { display: none; }
  .tx-wrap:not(.open) .tx-pane { display: none; }
  .tx-back { display: inline-block; }
}

.tx-pics { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.tx-pic { display: block; max-width: 220px; max-height: 220px; border-radius: 8px; }
.tx-pend { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 12px 0; }
.tx-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 6px 2px 2px; border: 1px solid var(--line); border-radius: 8px; font-size: .8rem; }
.tx-chip img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; }
.tx-chip button { border: 0; background: none; color: var(--ink); font-size: 1.1rem; cursor: pointer; }
.tx-wait { font-size: .78rem; margin-top: 2px; }

.tx-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 6px 12px; border-bottom: 1px solid var(--line); font-size: .8rem; }
.tx-pick { width: 14px; height: 14px; margin: 0 4px 0 0; vertical-align: -2px; opacity: .55; }
.tx-pick:checked, .tx-msgs .chat-msg:hover .tx-pick { opacity: 1; }
.tm-list { max-height: 220px; overflow: auto; position: static; display: block; }
.tm-list li[aria-selected="true"] { background: var(--accent-soft, rgba(15, 118, 110, .12)); }

.items .pnote { display: block; font-size: .74rem; line-height: 1.25; margin-top: 2px; text-align: left; }
.items .pnote:empty { display: none; }
.warn-text { color: #b45309; font-weight: 600; }

.cashbox{margin-top:.6rem}.cashbox .change{display:flex;flex-direction:column;justify-content:flex-end;font-size:.85rem}.cashbox .change-amt{font-size:1.5rem;color:#0f766e;line-height:1.3}.cashbox .change-amt.short{color:#b45309;font-size:1.1rem}

.rc-logo{display:block;margin:0 auto 1.5mm;max-width:100%;max-height:28mm;object-fit:contain}
.tp-shop .rc-logo{margin:0;max-height:20mm;max-width:70mm}
.rc-qrs{display:flex;flex-wrap:wrap;justify-content:center;gap:1.5mm 2mm;margin-top:1mm}
.rc-qr{text-align:center;font-size:7pt;line-height:1.15;max-width:25mm;overflow-wrap:anywhere}
.rc-qr svg{display:block;margin:0 auto}
.doc-logo{display:block;max-height:22mm;max-width:70mm;margin:0 0 6px}
.logo-box{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin:8px 0}.logo-prev{min-width:140px;min-height:70px;display:flex;align-items:center;justify-content:center;border:1px dashed var(--line,#cbd5d1);border-radius:8px;padding:8px;background:#fff}.logo-prev img{max-width:220px;max-height:90px}
@media print { .pay-card th:last-child, .pay-card td:last-child { display: none; } }

.notes-split{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.notes-split .f{margin:0}
.notes-split .private textarea{background:#fffbeb;border-color:#e8d9a8}
.private-notes{border-left:4px solid #e0b43a}
@media (max-width:700px){.notes-split{grid-template-columns:1fr}}
.wrap-long{overflow-wrap:anywhere;word-break:break-word}

/* ticket page: the small info cards (customer, estimates, parts...) sit in a narrow column on the left */
.tk-grid > .tk-main { min-width: 0; }
@media (min-width: 861px) {
  .tk-grid { grid-template-columns: 220px minmax(0, 1fr); gap: 14px; }
  .tk-grid > .tk-side { order: -1; }
}
.tk-side { min-width: 0; overflow-wrap: anywhere; }
.tk-side .card { padding: 7px 10px; margin-bottom: 7px; font-size: 0.78rem; line-height: 1.35; border-radius: 8px; }
.tk-side .card > h2, .tk-side .card > .card-head h2, .tk-side details.dlog > summary h2 { font-size: 0.8rem; margin-bottom: 3px; }
.tk-side .card-head { margin-bottom: 3px; gap: 6px; }
.tk-side .btn.small { padding: 0 7px; font-size: 0.7rem; min-height: 0; line-height: 1.6; }
.tk-side .chip { font-size: 0.66rem; padding: 0 6px; }
.tk-side .mono { font-size: 0.76rem; }
.tk-side .att-list { gap: 5px; margin-bottom: 6px; }
.tk-side .att { gap: 6px; }
.tk-side .att-thumb { width: 28px; height: 28px; border-radius: 4px; }
.tk-side .sig-thumb { max-width: 100%; max-height: 40px; }
.tk-side .hint, .tk-side .muted { font-size: 0.72rem; }
.tk-side .att-form input[type=file] { max-width: 100%; font-size: 0.7rem; }
.tk-side details.dlog[open] > summary { margin-bottom: 4px; }
.tk-side .chk { font-size: 0.72rem; margin: 3px 0; gap: 5px; }
.tk-side input[type=checkbox] { width: 13px; height: 13px; }
.tk-main select { max-width: 100%; }

.msg-tools { margin-left: 6px; }
.msg-tools .linkbtn { background: none; border: 0; padding: 0 4px; color: var(--accent, #0b6b61); cursor: pointer; font-size: inherit; text-decoration: underline; }
.attach-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.attach-list:empty { display: none; }
.attach-chip { background: var(--accent-soft); color: var(--accent-dark); }
.attach-chip .linkbtn { background: none; border: 0; cursor: pointer; font-size: 1rem; line-height: 1; color: inherit; padding: 0 2px; }
.msg-files { margin-top: 4px; font-size: 0.85rem; }
.btn[hidden], button[hidden] { display: none !important; }
/* the Send-as dropdown stays narrow so Canned response, Attach file and Send fit on the same row */
.composer .row select[name="channel"] { width: 11.5rem; max-width: 100%; flex: 0 0 auto; }
.composer .row .btn { white-space: nowrap; }

.ev .ty { display: inline-block; min-width: 1.1em; text-align: center; margin-right: 1px; }
.ag-main .ty { color: var(--accent-dark, inherit); }

.inv-sum { margin-bottom: 12px; }
a.stat { display: block; color: inherit; text-decoration: none; }
a.stat:hover { background: var(--accent-soft); }
.stat.warn .n { color: var(--bad, #b3261e); }

/* two-factor sign-in */
.gate { max-width: 460px; margin: 0 auto; }
.tf-code { font-size: 1.6rem; letter-spacing: 0.15em; text-align: center; width: 100%; padding: 10px; }
.tf-steps { padding-left: 20px; line-height: 1.5; } .tf-steps li { margin-bottom: 12px; }
.qr-box { background: #fff; padding: 10px; display: inline-block; margin: 8px 0; border: 1px solid var(--border, #ddd); }
.qr-box svg { display: block; }
.tf-key { font-size: 1.05rem; letter-spacing: 0.08em; word-break: break-all; margin: 6px 0; }
.rec-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-size: 1.05rem; margin: 12px 0; padding: 12px; border: 1px dashed var(--border, #bbb); }
.linkbtn { background: none; border: 0; color: var(--link, #1a5fb4); cursor: pointer; padding: 0; text-decoration: underline; }
.bad-text { color: #b3261e; }
.gate .row-actions, .card .row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }

/* private password form and the ticket card */
.vault-pg .big { font-size: 1.15rem; line-height: 1.5; }
.vault-pg .vault-msg { background: var(--panel, #f4f7f6); padding: 10px 12px; border-left: 4px solid var(--accent, #0f6b5c); }
.vault-pg .vault-row { border: 1px solid var(--border, #d5ddda); border-radius: 8px; padding: 12px 14px; margin: 14px 0; }
.vault-pg .vault-row h3 { margin: 0 0 8px; }
.vault-pg input, .vault-pg select { font-size: 1.1rem; padding: 10px; }
.vault-pg .big-btn { font-size: 1.2rem; padding: 12px 22px; }
.vault-req { margin-bottom: 12px; }
.vault-item { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border, #e3e8e6); }
.vault-pw { width: 100%; background: var(--panel, #f4f7f6); padding: 8px; border-radius: 6px; }
.vault-secret { font-size: 1.1rem; user-select: all; word-break: break-all; }
.small { font-size: 0.8rem; }
.vault-pg .vault-warn { background: #fff4e0; border: 1px solid #e0b060; border-radius: 6px; padding: 10px 12px; font-size: 1.05rem; }

/* inventory list: one tidy row per item, no sideways scrolling */
.inv-name { min-width: 14rem; }
.inv-sub { display: block; font-size: .78rem; color: var(--muted); font-weight: 400; line-height: 1.35; white-space: nowrap; }
.inv-name .inv-sub { white-space: normal; }
.inv-act { min-width: 11rem; }
.inv-act .btn { margin: 2px 0; }
.inv-act .btn.small { padding: 4px 9px; }
.pop-menu { position: fixed; z-index: 1000; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: 4px; display: flex; flex-direction: column; min-width: 130px; }
.pop-menu button { background: none; border: 0; text-align: left; padding: 8px 12px; font: inherit; cursor: pointer; border-radius: 4px; }
.pop-menu button:hover, .pop-menu button:focus { background: var(--panel, #eef3f1); outline: none; }
.pop-menu .danger-text { color: #b3261e; }
.inv-terms { margin-top: 18px; font-size: .9rem; } .inv-terms .pre { white-space: pre-wrap; margin-top: 2px; }

.form-grid .set-sub { grid-column: 1 / -1; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line, #e3e3e3); }
.form-grid .set-sub:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.form-grid .set-sub h3 { margin: 0 0 2px; font-size: 1rem; }
.form-grid .set-sub p { margin: 0; }
/* invoice list: old unpaid invoices */
tr.inv-warn-yellow > td { background: #fff4c2; }
tr.inv-warn-red > td { background: #fbd5d1; }
tr.inv-warn-yellow:hover > td { background: #ffec99; }
tr.inv-warn-red:hover > td { background: #f7bdb7; }
.age-note { font-size: .8rem; font-weight: 600; margin-left: 4px; }
tr.inv-warn-yellow .age-note { color: #8a5a00; }
tr.inv-warn-red .age-note { color: #a1271b; }
.warn-banner { padding: 8px 12px; border-radius: var(--radius, 6px); margin: 0 0 10px; font-weight: 600; }
.warn-banner.yellow { background: #fff4c2; color: #6b4600; }
.warn-banner.red { background: #fbd5d1; color: #8f1d12; }
html[data-theme="dark"] tr.inv-warn-yellow > td, html[data-theme="dark"] .warn-banner.yellow { background: #4a3d0e; color: #ffe9a0; }
html[data-theme="dark"] tr.inv-warn-red > td, html[data-theme="dark"] .warn-banner.red { background: #4d1d1a; color: #ffc9c3; }
html[data-theme="dark"] tr.inv-warn-yellow:hover > td { background: #5a4a12; }
html[data-theme="dark"] tr.inv-warn-red:hover > td { background: #5e2420; }
html[data-theme="dark"] tr.inv-warn-yellow .age-note { color: #ffd966; }
html[data-theme="dark"] tr.inv-warn-red .age-note { color: #ffa59b; }

.toolbar.compact { gap: 6px; }
.toolbar.compact .btn { padding: 4px 9px; font-size: .83rem; }
.pop-menu .pop-link { display: block; padding: 8px 12px; color: inherit; text-decoration: none; border-radius: 4px; }
.pop-menu .pop-link:hover, .pop-menu .pop-link:focus { background: var(--panel, #eef3f1); outline: none; }
