/* ---- Base (from the original prototype, un-minified) ---- */
:root { font-family: Inter, system-ui, Arial, sans-serif; color: #0f172a; background: #f8fafc; }
* { box-sizing: border-box; }
body { margin: 0; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
h1, h2, h3 { margin: 4px 0 10px; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
a { color: inherit; }
.muted { color: #64748b; }
.small { font-size: 13px; }

.app { min-height: 100vh; padding: 24px; max-width: 1500px; margin: auto; }
.top, .card, .job-header { background: white; border: 1px solid #e2e8f0; border-radius: 28px; padding: 22px; box-shadow: 0 8px 24px rgba(15, 23, 42, .04); }
.top h1 { font-size: 36px; margin: 4px 0; }
.eyebrow { font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: #94a3b8; margin: 0; }
.tabs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #f1f5f9; border-radius: 24px; padding: 8px; margin-top: 20px; }
.top button, .tabs button, .card button, .job-header button, .modal-card button, .field input, .field select, select, input, textarea {
  border-radius: 16px; border: 1px solid #e2e8f0; background: white; padding: 10px 14px; color: #334155;
}
.active, .primary { background: #020617 !important; color: white !important; }
.danger { color: #b91c1c !important; border-color: #fecaca !important; }
.spacer { flex: 1; }
.separator { border-left: 1px solid #cbd5e1; width: 1px; align-self: stretch; }
.page { display: grid; gap: 18px; margin-top: 18px; grid-template-columns: minmax(0, 1fr); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.job-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.grid2 > div { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.stat-grid h2 { font-size: 30px; margin: 0; }
.stat-grid h3 { color: #64748b; font-size: 14px; margin: 0 0 6px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.row, .toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.row > *, .toolbar > * { min-width: 0; max-width: 100%; }
.grid2 > *, .grid3 > *, .stat-grid > * { min-width: 0; }
.field input, .field select { min-width: 0; max-width: 100%; }
.toolbar input { flex: 1; min-width: 240px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.detail { margin-top: 14px; } /* job, client, team member and invoice pages, under the top bar */

/* ---- Calendar ---- */
.calendar { display: block; }
.dow-row, .week-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.dow-row { margin-bottom: 10px; }
.week-row { position: relative; margin-bottom: 10px; }
.dow { text-align: center; color: #64748b; }
.day { min-height: 150px; background: white; border: 1px solid #e2e8f0; border-radius: 22px; padding: 10px; }
.day.other { opacity: .45; }
.day.today { border: 1px solid #020617; box-shadow: 0 0 0 1px #020617; } /* a 2px ring that takes no room, so the cards and bars inside line up with the other days */
.day.drop { background: #eff6ff; }
.day-head { display: flex; justify-content: space-between; align-items: center; height: 28px; }
.day-head button { border: none; background: none; padding: 2px 6px; font-size: 18px; color: #94a3b8; }
.more { font-size: 12px; color: #475569; background: none; border: none; padding: 2px; text-decoration: underline; }
.appt { display: block; width: 100%; margin: 6px 0; border-radius: 12px; padding: 7px 8px; text-align: left; color: white; font-weight: 800; border: none; font-size: 13px; }
.appt small { display: block; opacity: .88; font-weight: 600; }
.finished { background: white !important; color: #334155 !important; border: 1px solid #cbd5e1 !important; }
.lost { background: #f1f5f9 !important; color: #94a3b8 !important; text-decoration: line-through; }
.agenda { display: grid; gap: 14px; }
.agenda-day h3 { margin: 0 0 6px; }
.confirm-msg { margin: 0 0 8px; color: #475569; }
.reopen-note { background: #fffbeb; border-left: 3px solid #f59e0b; border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.job-header .done-btn:hover { background: #fef3c7; border-color: #f59e0b; }
/* Calendar: dragging jobs between days in Month view (pointer events — mouse and touch) */
.appt.movable { cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none; }
/* The card under the cursor while dragging (a copy of the appointment), and the faded original left in place */
.appt.drag-card { position: fixed; z-index: 300; margin: 0; pointer-events: none; transform: rotate(-2deg) scale(1.04);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .35); opacity: .96; }
.appt.drag-source { opacity: .35; }
body:has(.drag-card), body:has(.drag-card) * { cursor: grabbing !important; }
.day.drop { outline: 2px dashed #2563eb; outline-offset: -2px; }
/* Calendar header pinned under the top bar (wide screens; on phones only the top bar stays) */
@media (min-width: 700px) {
  .cal-head { position: sticky; top: calc(var(--topbar-h, 66px) + 18px); z-index: 45; border-radius: 28px; }
}
.cal-legend { margin-top: 10px; }
/* Calendar: List view — date on the left, the day's appointments on the right */
.list-view { gap: 10px; }
.list-edge { text-align: center; padding: 6px; min-height: 24px; }
.card.list-day { padding: 14px 16px; }
.list-day-grid { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 16px; align-items: start; scroll-margin-top: 90px; }
.card .list-date { border: none; background: #f8fafc; border-radius: 14px; padding: 10px 6px; display: grid; justify-items: center; gap: 2px; color: inherit; position: sticky; top: calc(var(--topbar-h, 66px) + 20px); }
@media (min-width: 700px) { .card .list-date { top: calc(var(--topbar-h, 66px) + var(--calhead-h, 90px) + 30px); } }
.list-jobs .job-row { margin: 0; }
.card .list-date:hover { background: #f1f5f9; }
.list-date span { font-size: 12px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .04em; }
.list-date b { font-size: 28px; line-height: 1.1; }
.list-date em { font-style: normal; font-size: 11px; font-weight: 800; color: white; background: #2563eb; border-radius: 999px; padding: 1px 8px; margin-top: 2px; }
.list-day.is-today { border-color: #2563eb; }
.card.list-day.is-today .list-date { background: #eff6ff; }
.list-jobs { display: grid; gap: 8px; }
@media (max-width: 640px) { .list-day-grid { grid-template-columns: 64px minmax(0, 1fr); gap: 10px; } .list-date b { font-size: 22px; } }
/* Calendar: "＋ New job" bubble where an empty spot was clicked */
.add-pop { position: fixed; z-index: 120; display: grid; gap: 5px; justify-items: center; text-align: center; background: white; border: 1px solid #e2e8f0;
  border-radius: 14px; padding: 9px 10px 8px; box-shadow: 0 16px 40px rgba(15, 23, 42, .2); width: max-content; min-width: 128px; } /* fits its content; button and date centered */
.add-pop button { border: none; border-radius: 10px; padding: 8px 16px; font-weight: 700; white-space: nowrap; }
.calendar .day, .wv-col, .dv-events.can-add { cursor: cell; }
.calendar .day .appt, .wv-col .appt, .dv-events .appt { cursor: pointer; }
.calendar .day .appt.movable, .wv-col .appt.movable { cursor: grab; }
/* Calendar: Week view (7 day columns on the Day view's time grid) */
.weekview-card { padding: 12px 12px 16px 8px; }
.wv-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin: 0 0 8px 58px; gap: 0; }
.card .wv-day { border: none; background: none; padding: 6px 2px; border-radius: 10px; display: grid; justify-items: center; gap: 2px; color: inherit; }
.card .wv-day span { font-size: 12px; color: #64748b; font-weight: 600; }
.card .wv-day b { font-size: 18px; }
.card .wv-day:hover { background: #f1f5f9; }
.card .wv-day.today b { background: #020617; color: white; border-radius: 999px; min-width: 32px; padding: 2px 8px; }
.wv-cols { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.wv-col { position: relative; border-left: 1px solid #e2e8f0; }
.wv-col:last-child { border-right: 1px solid #e2e8f0; }
.wv-col.today { background: rgba(37, 99, 235, .04); }
.wv-col.drop { background: #eff6ff; outline: 2px dashed #2563eb; outline-offset: -2px; }
.wv-col .dv-appt { font-size: 12px; padding: 4px 6px; border-radius: 8px; }
.wv-col .dv-appt small { font-size: 11px; }
.wv-drop-line { position: absolute; left: 0; right: 0; height: 2px; background: #2563eb; z-index: 3; pointer-events: none; }
.wv-drop-line span { position: absolute; right: 2px; top: -18px; font-size: 11px; font-weight: 800; color: #1d4ed8; background: white; border-radius: 6px; padding: 0 4px; }
.drag-card .drag-time { display: block; margin-top: 2px; font-weight: 800; }
/* Calendar: view switch, clickable dates, Day view time grid */
.card .cal-views button { padding: 8px 14px; }
.day-head .day-num { font-size: 15px; font-weight: 800; color: inherit; padding: 2px 6px; border-radius: 8px; }
.day-head .day-num:hover { background: #f1f5f9; }
.card .day-link { border: none; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.card .day-link:hover { text-decoration: underline; }
.list-earlier { justify-self: start; font-size: 13px; }
.dayview-card { padding: 16px 16px 16px 8px; }
.dayview { position: relative; margin-left: 58px; }
.dv-hour { position: absolute; left: 0; right: 0; border-top: 1px solid #e2e8f0; }
.dv-hour span { position: absolute; left: -58px; top: -8px; width: 50px; text-align: right; font-size: 12px; color: #64748b; }
.dv-events { position: absolute; inset: 0; }
.dv-appt { position: absolute; margin: 0; overflow: hidden; text-align: left; z-index: 1; }
.dv-appt small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-now { position: absolute; left: -6px; right: 0; height: 2px; background: #dc2626; z-index: 2; pointer-events: none; }
.dv-now::before { content: ""; position: absolute; left: 0; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #dc2626; }

/* Profile colors */
.blue { background: #2563eb; } .green { background: #059669; } .slate { background: #0f172a; } .gray { background: #4b5563; }
.black { background: #000; } .sky { background: #0ea5e9; } .cyan { background: #06b6d4; } .teal { background: #0d9488; }
.lime { background: #84cc16; color: #111; } .yellow { background: #facc15; color: #111; } .amber { background: #f59e0b; }
.orange { background: #f97316; } .red { background: #dc2626; } .rose { background: #f43f5e; } .pink { background: #ec4899; }
.purple, .violet { background: #7c3aed; } .indigo { background: #4f46e5; } .unassigned { background: #94a3b8; }
/* Member page: calendar color circles (ColorPicker in Team.jsx) */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
:is(.card, .modal-card) .swatch { width: 36px; height: 36px; padding: 3px; border-radius: 50%; border: 2px solid transparent; background: none; cursor: pointer; }
:is(.card, .modal-card) .swatch:hover:not(:disabled) { border-color: #cbd5e1; }
:is(.card, .modal-card) .swatch.on { border-color: #0f172a; }
:is(.card, .modal-card) .swatch:disabled { cursor: default; opacity: .35; }
.swatch i { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; color: #ffffff; font-style: normal; font-weight: 900; font-size: 14px; }
/* Same technician colors for appointments shown inside a card (Day / Week views), where `.card button` would make them white */
.card .appt { color: white; border: none; }
.card .appt.blue { background: #2563eb; } .card .appt.green { background: #059669; } .card .appt.slate { background: #0f172a; } .card .appt.gray { background: #4b5563; }
.card .appt.black { background: #000; } .card .appt.sky { background: #0ea5e9; } .card .appt.cyan { background: #06b6d4; } .card .appt.teal { background: #0d9488; }
.card .appt.lime { background: #84cc16; color: #111; } .card .appt.yellow { background: #facc15; color: #111; } .card .appt.amber { background: #f59e0b; }
.card .appt.orange { background: #f97316; } .card .appt.red { background: #dc2626; } .card .appt.rose { background: #f43f5e; } .card .appt.pink { background: #ec4899; }
.card .appt:is(.purple, .violet) { background: #7c3aed; } .card .appt.indigo { background: #4f46e5; } .card .appt.unassigned { background: #94a3b8; }

.hovercard { position: fixed; z-index: 50; background: white; border: 1px solid #e2e8f0; border-radius: 18px; box-shadow: 0 20px 60px rgba(15, 23, 42, .2); padding: 14px; width: 280px; pointer-events: none; }
.hovercard p { margin: 4px 0; }

/* ---- Lists ---- */
.list { display: grid; gap: 10px; }
.client-row, .job-row { display: grid; grid-template-columns: 1fr 1fr 1.3fr auto auto; gap: 14px; align-items: center; text-align: left; background: white; border: 1px solid #e2e8f0; border-radius: 22px; padding: 16px; width: 100%; color: inherit; }
.job-row { grid-template-columns: 1.2fr 1.3fr 1fr auto auto; }
.job-row .pill, .client-row .pill { justify-self: start; }
.pill { display: inline-block; font-size: 12px; font-weight: 800; border-radius: 999px; padding: 4px 10px; background: #f1f5f9; color: #334155; white-space: nowrap; }
.pill.Scheduled { background: #dbeafe; color: #1d4ed8; }
.pill.In.Progress, .pill.InProgress { background: #fef3c7; color: #92400e; }
.pill.Completed { background: #dcfce7; color: #166534; }
.pill.Lost, .pill.Not.sent { background: #fee2e2; color: #991b1b; }
.pill.Paid { background: #dcfce7; color: #166534; }
.pill.Partially.paid, .pill.Sent { background: #fef3c7; color: #92400e; }

/* ---- Forms ---- */
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field span { font-size: 13px; font-weight: 800; color: #475569; }
.field input, .field select, textarea { width: 100%; border: 1px solid #e2e8f0; min-height: 42px; }
textarea { min-height: 90px; width: 100%; }
.check { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.check input { min-height: 0; width: auto; }
.media, .member { background: white; border: 1px solid #e2e8f0; border-radius: 22px; padding: 18px; text-align: left; color: inherit; }
.member.inactive { opacity: .5; }
.log, .line { background: #f8fafc; border-radius: 18px; padding: 14px; margin: 10px 0; }
.log small { color: #64748b; }
.log-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.card .log-undo { border: 1px solid #cbd5e1; background: white; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #1565c0; white-space: nowrap; }
.card .log-undo:hover { border-color: #1565c0; background: #eff6ff; }
.log.undone { opacity: .55; }
.log.undone .log-head b { text-decoration: line-through; }
.log-tag { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: #64748b; }
.confirm-msg { white-space: pre-line; }
.line .grid3 { align-items: end; }
.line-total { font-weight: 900; text-align: right; padding-bottom: 22px; }
.error { background: #fef2f2; color: #991b1b; border-radius: 14px; padding: 10px 14px; margin: 8px 0; }

/* ---- Job page ---- */
/* Job page header: job info on the left, buttons on the right, always on ONE line (phones excepted). When space runs out the
   buttons shrink a little (clamp) and the info splits into two rows: the job name, then the status pills + job number. */
.job-header { display: flex; justify-content: space-between; align-items: center; gap: clamp(10px, 1.6vw, 18px); margin-bottom: 18px; }
.job-info { flex: 1 1 auto; min-width: 0; }
.job-title { min-height: 48px; display: flex; align-items: center; column-gap: 12px; row-gap: 4px; flex-wrap: wrap; }
.job-title h1 { font-size: clamp(24px, 2.6vw, 32px); overflow-wrap: break-word; }
.job-tags { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.job-actions { display: flex; align-items: center; gap: clamp(5px, .7vw, 8px); flex: none; }
.job-actions button, .job-total { height: clamp(42px, 4.2vw, 48px); font-variant-numeric: tabular-nums; min-width: clamp(84px, 9vw, 120px); border-radius: 16px; display: flex; align-items: center;
  justify-content: center; font-weight: 900; padding: 0 clamp(9px, 1.1vw, 14px); font-size: clamp(14px, 1.25vw, 16px); white-space: nowrap; }
/* Appointment card: Start / End summary (ApptSummary in components/ApptTime.jsx); the box opens the "Appointment time" pop-up */
:is(.card, .modal-card) .appt-sum { display: block; width: 100%; text-align: left; background: #f8fafc; border: 1px solid #e2e8f0; container-type: inline-size;
  border-radius: 18px; padding: 12px 14px; margin: 4px 0 14px; color: #0f172a; font: inherit; }
.as-in { display: flex; align-items: center; gap: 12px; }
:is(.card, .modal-card) button.appt-sum { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
:is(.card, .modal-card) button.appt-sum:hover { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(37, 99, 235, .08); }
.as-rows { flex: 1; min-width: 0; display: grid; gap: 6px; }
.as-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: baseline; gap: 8px; }
.as-dot { display: none; }
.as-lbl { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #94a3b8; }
.as-row b { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-time { font-weight: 700; color: #334155; white-space: nowrap; }
.as-edit { display: inline-flex; align-items: center; gap: 5px; flex: none; font-size: 13px; font-weight: 800; color: #2563eb; background: #eff6ff;
  border-radius: 999px; padding: 6px 10px; }
/* Narrow box (e.g. the 1/3 column on a small laptop): label on top, then "date · time"; Change under them */
@container (max-width: 330px) {
  .as-in { flex-direction: column; align-items: stretch; gap: 10px; }
  .as-rows { gap: 8px; }
  .as-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; }
  .as-lbl { flex-basis: 100%; }
  .as-dot { display: inline; color: #94a3b8; }
  .as-edit { align-self: flex-start; }
}
/* "Appointment time" pop-up: per line a 📅 button, a date wheel and a time wheel (scroll / drag / arrow keys), and a month calendar */
.modal-card.appt-modal { max-width: 470px; }
.modal-card.inroute-modal { max-width: 420px; }
.inroute-etas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 4px; }
.inroute-etas button { padding: 12px 4px; font-weight: 600; white-space: nowrap; }
.inroute-preview { font-style: italic; }
.inroute-modal .inroute-wide { display: block; width: 100%; margin-top: 8px; padding: 11px; }
.when { margin-bottom: 14px; }
.when-title { font-size: 13px; font-weight: 800; color: #475569; margin-bottom: 6px; }
.when-row { display: grid; grid-template-columns: 46px minmax(0, 1fr) 118px; gap: 8px; align-items: center; }
.modal-card .when-cal { width: 46px; height: 46px; padding: 0; display: grid; place-items: center; border-radius: 14px; color: #2563eb; background: #eff6ff; border-color: #dbeafe; }
.modal-card .when-cal.on { background: #2563eb; color: #ffffff; border-color: #2563eb; }
.wheel { position: relative; height: 150px; overflow: hidden; border: 1px solid #e2e8f0; border-radius: 16px; background: #ffffff; cursor: ns-resize;
  user-select: none; -webkit-user-select: none; touch-action: none; display: grid; grid-template-rows: repeat(5, 30px); align-content: center; outline: none; }
.wheel::before { content: ""; position: absolute; left: 6px; right: 6px; top: 50%; height: 34px; transform: translateY(-50%); background: #f1f5f9; border-radius: 11px; }
.wheel:hover { border-color: #cbd5e1; }
.wheel:focus-visible { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.wheel-row { position: relative; display: flex; align-items: center; justify-content: center; height: 30px; white-space: nowrap; font-size: 14px; color: #64748b; cursor: pointer; }
.wheel-row.far2 { opacity: .35; font-size: 13px; }
.wheel-row.far1 { opacity: .75; }
.wheel-row[data-d]:hover { opacity: 1; color: #334155; } /* the visible dates/times can be clicked: they just get a bit darker, no color */
.wheel-cur { font-size: 17px; font-weight: 900; color: #020617; cursor: inherit; }
.wheel-cur.from-below { animation: wheel-up .16s ease-out; }
.wheel-cur.from-above { animation: wheel-down .16s ease-out; }
@keyframes wheel-up { from { transform: translateY(10px); opacity: .4; } }
@keyframes wheel-down { from { transform: translateY(-10px); opacity: .4; } }
.mp { margin-top: 10px; border: 1px solid #e2e8f0; border-radius: 20px; padding: 12px; background: #ffffff; box-shadow: 0 12px 30px rgba(15, 23, 42, .08); }
.mp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mp-head b { font-size: 16px; }
.mp .mp-nav, .mp .mp-today { border: 1px solid #e2e8f0; background: #ffffff; color: #334155; border-radius: 12px; padding: 8px 12px; font: inherit; cursor: pointer; }
.mp .mp-nav { width: 36px; height: 36px; padding: 0; border-radius: 12px; font-size: 20px; line-height: 1; }
.mp-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.mp-wd { text-align: center; font-size: 12px; font-weight: 800; color: #94a3b8; padding: 4px 0; }
.mp .mp-day { height: 38px; padding: 0; border: none; border-radius: 12px; background: none; font-weight: 700; color: #0f172a; }
.mp .mp-day.off { color: #cbd5e1; }
.mp .mp-day.in { background: #eff6ff; color: #1d4ed8; }
.mp .mp-day:not(.on):hover:not(:disabled) { background: #f1f5f9; }
.mp .mp-day.today { box-shadow: inset 0 0 0 2px #2563eb; }
.mp .mp-day.on { background: #020617; color: #ffffff; }
.mp .mp-day:disabled { color: #e2e8f0; cursor: default; }
.mp .mp-today { margin-top: 8px; width: 100%; font-weight: 800; color: #2563eb; }
.mp .mp-today:disabled { opacity: .45; cursor: default; }
/* A date box that opens the CRM month calendar (DateField in ApptTime.jsx); drops down, or opens in place (.inline) in pop-ups */
.date-field { position: relative; }
.date-field.field { gap: 6px; } /* same spacing as a normal box (.grid2 > div would make it 18px) */
.date-field .df-btn { display: inline-flex; align-items: center; gap: 8px; width: 100%; min-height: 42px; padding: 10px 14px; border: 1px solid #e2e8f0;
  border-radius: 16px; background: #ffffff; color: #0f172a; font: inherit; text-align: left; cursor: pointer; white-space: nowrap; }
.date-field .df-btn svg { color: #2563eb; flex: none; }
.date-field .df-btn span { font-size: inherit; font-weight: inherit; color: inherit; } /* not the small bold .field label look */
.date-field .df-btn span.muted { color: #94a3b8; }
.date-field .df-btn:hover, .date-field .df-btn.on { border-color: #93c5fd; }
.df-pop { position: fixed; top: 0; left: 0; visibility: hidden; z-index: 150; width: 300px; max-width: calc(100vw - 24px); }
.df-pop .mp { margin-top: 0; box-shadow: 0 18px 40px rgba(15, 23, 42, .18); }
.btns .date-field, .an-filters .date-field { min-width: 150px; }
/* Settings → General Information: opening / closing time wheels */
.hours-wheels { display: grid; grid-template-columns: repeat(2, minmax(0, 170px)); gap: 16px; margin-bottom: 8px; }
.when-len { font-weight: 800; margin: 4px 0 2px; }
.when-len.bad { color: #b91c1c; }
.when-hint { margin: 0 0 8px; }
@media (max-width: 420px) { .when-row { grid-template-columns: 42px minmax(0, 1fr) 100px; gap: 6px; } .wheel-cur { font-size: 15px; } }
.job-total { background: #020617; color: white; }

/* ---- Invoice ---- */
/* Invoice page: a light, card-style document (same look on screen, in dark mode and in print). */
.inv { --inv-navy: #1e3a8a; --inv-blue: #2f6bf2; --inv-line: #dbe5f4; --inv-soft: #f5f8fe; --inv-text: #1f2937; --inv-muted: #64748b;
  max-width: 1000px; margin: 0 auto; color: var(--inv-text); display: grid; gap: 18px; color-scheme: light; }
.inv p { margin: 0; }
.inv h1, .inv h2, .inv h3 { margin: 0; }
.inv-card { background: var(--inv-soft); border: 2px solid var(--inv-line); border-radius: 26px; padding: 22px 30px; }
.inv-blue { color: var(--inv-blue); font-weight: 700; }
.inv a.inv-blue { text-decoration: none; }
.inv-muted { color: var(--inv-muted); }
.inv-red { color: #c0392b; }
.inv-head { display: grid; grid-template-columns: auto 1fr auto; gap: 26px; align-items: start; }
.inv-logo { width: 140px; height: 140px; object-fit: contain; }
.inv-co h1 { text-transform: uppercase; overflow-wrap: break-word; } /* break a name only if it truly cannot fit */
.inv-co h1, .inv-title h1 { color: var(--inv-navy); font-size: 25px; font-weight: 900; letter-spacing: .5px; line-height: 1.2; } /* same size as the invoice # (owner) */
.inv-co h1 { margin-bottom: 12px; } /* space under the company name before the address ("Service Invoice" line removed, owner) */
.inv-co p { color: var(--inv-muted); line-height: 1.75; }
.inv-title { text-align: right; }
.inv-title .inv-num { font-size: 25px; margin: 10px 0 18px; }
.inv-title p:last-child { color: var(--inv-muted); font-weight: 600; }
.inv-two { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.inv-label { color: var(--inv-blue); font-weight: 800; text-transform: uppercase; letter-spacing: .3px; margin-bottom: 10px !important; }
.inv-two h2 { font-size: 25px; font-weight: 700; margin-bottom: 8px; }
.inv-two p { line-height: 1.6; }
.inv-two .inv-muted { margin-top: 10px; font-weight: 600; }
.inv-big { font-size: 19px; }
.inv-band { display: flex; background: var(--inv-blue); color: white; border-radius: 20px; padding: 14px 20px; }
.inv-band div { flex: 1; display: grid; padding: 0 20px; }
.inv-band div:first-child { padding-left: 0; }
.inv-band div + div { border-left: 1px solid rgba(255, 255, 255, .45); }
.inv-band span { font-size: 15px; font-weight: 700; }
.inv-band b { font-size: 29px; font-weight: 900; line-height: 1.2; }
.inv-lines h3 { color: var(--inv-navy); font-size: 25px; font-weight: 800; padding-bottom: 12px; border-bottom: 2px solid var(--inv-line); }
.inv-line { padding: 14px 0; }
.inv-line + .inv-line { border-top: 2px solid var(--inv-line); }
/* Item | Qty | Unit price | Amount: every row is the same grid, so the numbers line up in their own columns (Qty / Unit price are the owner's "Show on invoice" choices) */
.inv-lines { --w-qty: 80px; --w-price: 140px; --w-amt: 140px; }
.inv-line-top, .inv-cols { display: grid; grid-template-columns: minmax(0, 1fr) var(--w-amt); align-items: baseline; gap: 16px; }
.inv-line-top.q, .inv-cols.q { grid-template-columns: minmax(0, 1fr) var(--w-qty) var(--w-amt); }
.inv-line-top.p, .inv-cols.p { grid-template-columns: minmax(0, 1fr) var(--w-price) var(--w-amt); }
.inv-line-top.q.p, .inv-cols.q.p { grid-template-columns: minmax(0, 1fr) var(--w-qty) var(--w-price) var(--w-amt); }
.inv-line-top { font-size: 23px; }
.inv-line-top b { font-weight: 400; } /* item names and amounts are regular weight; only the "Services" / "Materials" titles are bold */
.inv-line-top > :not(:first-child), .inv-cols > :not(:first-child) { text-align: right; white-space: nowrap; }
.inv-cols { color: var(--inv-muted); font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 10px 0 0; }
.inv-desc { color: var(--inv-muted); margin-top: 10px !important; line-height: 1.5; }
.inv-bullets { margin: 12px 0 0; padding-left: 20px; line-height: 1.45; }
.inv-bullets.two { columns: 2; column-gap: 40px; }
.inv-bullets li { break-inside: avoid; }
.inv-foot { display: grid; grid-template-columns: 1.3fr 1fr; gap: 26px; align-items: start; }
.inv-thanks { border-top: 2px solid var(--inv-line); padding: 18px 8px; display: grid; gap: 10px; color: var(--inv-muted); }
.inv-thanks .inv-thanks-msg { color: var(--inv-navy); font-weight: 800; font-size: 19px; white-space: pre-line; }
.inv-terms { margin: 4px 0 0 !important; text-align: center; color: var(--inv-muted); font-size: 13px; }
.inv-terms a { word-break: break-all; }
.inv.compact .inv-terms { font-size: 10.5px; margin-top: 0 !important; }
.inv-totals { background: white; display: grid; gap: 14px; padding: 22px 24px; }
.inv-totals p { display: flex; justify-content: space-between; gap: 12px; font-size: 18px; }
.inv-totals p span { color: var(--inv-muted); }
.inv-totals .inv-sep { border-top: 2px solid var(--inv-line); padding-top: 12px; }
.inv-due { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: #e8effc; border-radius: 16px; padding: 16px 20px; border-top: 0; }
.inv-due span { color: var(--inv-navy); font-weight: 800; text-transform: uppercase; font-size: 18px; }
.inv-due b { color: #16a34a; font-size: 32px; font-weight: 900; }
.inv-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.inv-photos a { display: block; }
/* Photo pages after the invoice (PDF / print only): one photo per page, large, with a link back to the invoice */
.inv-photo-pages { display: none; }
@media print {
  .inv-photo-pages { display: block; color-scheme: light; color: #1f2937; }
  .inv-photo-page { break-before: page; page-break-before: always; display: grid; gap: 10px; }
  .inv-photo-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13px; color: #64748b; }
  .inv-photo-head b { color: #1e3a8a; font-size: 15px; }
  .inv-photo-head a { color: #2f6bf2; font-weight: 700; text-decoration: none; }
  .inv-photo-page img { display: block; width: 100%; max-height: 235mm; object-fit: contain; border-radius: 10px; }
}
.inv-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 14px; display: block; break-inside: avoid; }
/* The invoice with its editing column on the right (screen only) */
.inv-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.inv-wrap.with-tools { grid-template-columns: minmax(0, 1fr) auto 340px; }
/* the owner's look buttons between the invoice and the side column */
.inv-tools { display: grid; gap: 10px; position: sticky; top: calc(var(--topbar-h, 80px) + 12px); }
.inv-tool { width: 46px; height: 46px; border-radius: 14px; border: 1px solid #dbe5f4; background: #ffffff; color: #2563eb; display: grid; place-items: center;
  padding: 0; cursor: pointer; box-shadow: 0 4px 12px rgba(30, 58, 138, .08); }
.inv-tool:hover { border-color: #93c5fd; background: #f5f8fe; }
.inv-tool svg { width: 24px; height: 24px; }
/* invoice look: .plain = no color fill (white boxes with outlines, outlined band); .sharp = square corners */
.inv.plain .inv-card { background: #ffffff; }
.inv.plain .inv-band { background: #ffffff; border: 2px solid var(--inv-line); color: var(--inv-navy); }
.inv.plain .inv-band div + div { border-left-color: var(--inv-line); }
.inv.plain .inv-band span { color: var(--inv-muted); }
.inv.plain .inv-due { background: #ffffff; border: 2px solid var(--inv-line); }
.inv.sharp .inv-card, .inv.sharp .inv-band, .inv.sharp .inv-due, .inv.sharp .inv-photos img, .inv.sharp .inv-logo { border-radius: 0 !important; }
.inv-wrap .inv { width: 100%; }
.inv-side { display: grid; gap: 18px; position: sticky; top: calc(var(--topbar-h, 80px) + 12px); }
.inv-side .card { padding: 18px; }
.inv-side h3 { margin: 0 0 4px; }
.inv-side .muted.small { margin: 0 0 10px; }
.inv-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 8px 0; border-top: 1px solid var(--line, #e5e7eb); }
.inv-opts b { flex: 0 0 100%; }
.inv-opts label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.inv-msg { width: 100%; box-sizing: border-box; resize: vertical; margin-bottom: 10px; }
.inv-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.inv-pick button { position: relative; padding: 0 !important; aspect-ratio: 1; overflow: hidden; border: 3px solid transparent !important; border-radius: 14px !important; background: #f1f5f9 !important; }
.inv-pick button.on { border-color: #2f6bf2 !important; }
.inv-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inv-pick-mark { position: absolute; top: 5px; right: 5px; min-width: 22px; height: 22px; border-radius: 99px; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; background: rgba(255, 255, 255, .9); color: #334155; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.inv-pick button.on .inv-pick-mark { background: #2f6bf2; color: white; }
@media (max-width: 1100px) {
  .inv-wrap, .inv-wrap.with-tools { grid-template-columns: 1fr; }
  .inv-tools { position: static; display: flex; order: -1; } /* small screens: the buttons sit in a row above the invoice */
  .inv-side { position: static; grid-template-columns: 1fr 1fr; align-items: start; order: -1; } /* editing tools above the invoice */
}
@media (max-width: 700px) { .inv-side { grid-template-columns: 1fr; } }
@media screen and (max-width: 760px) { /* phones only — a printed page is narrow too but keeps the full layout */
  .inv:not(.compact) .inv-head { grid-template-columns: auto 1fr; }
  .inv:not(.compact) .inv-title { grid-column: 1 / -1; text-align: left; }
  .inv:not(.compact) .inv-logo { width: 90px; height: 90px; }
  .inv:not(.compact) .inv-card { padding: 18px; }
  .inv:not(.compact) .inv-two, .inv:not(.compact) .inv-foot { grid-template-columns: 1fr; gap: 18px; }
  .inv:not(.compact) .inv-band { flex-wrap: wrap; row-gap: 10px; }
  .inv:not(.compact) .inv-band div { flex: 1 1 40%; padding: 0 12px; }
  .inv:not(.compact) .inv-band div:nth-child(odd) { border-left: 0; padding-left: 0; }
  .inv:not(.compact) .inv-band b { font-size: 21px; }
  .inv:not(.compact) .inv-line-top { font-size: 17px; }
  .inv:not(.compact) .inv-lines { --w-qty: 44px; --w-price: 84px; --w-amt: 84px; }
  .inv:not(.compact) .inv-line-top, .inv:not(.compact) .inv-cols { gap: 8px; }
  .inv:not(.compact) .inv-cols { font-size: 11px; }
  .inv:not(.compact) .inv-bullets.two { columns: 1; }
  .inv:not(.compact) .inv-photos { grid-template-columns: 1fr 1fr; }
}
/* Settings → Email password row; send-invoice error */
.email-pw { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.email-pw button { margin-bottom: 12px; }
.send-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 12px; padding: 10px 12px; margin: 6px 0; }
/* Settings → Database & Backups: Google Drive status */
.backup-ok { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; border-radius: 12px; padding: 10px 12px; }
.backup-warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; }
.backup-warn ol { margin: 6px 0 0; padding-left: 20px; }
.backup-ok code, .backup-warn code { word-break: break-all; }
/* Settings → Company logo */
.logo-field { display: flex; gap: 18px; align-items: center; margin-top: 18px; padding-top: 18px; border-top: 1px solid #e2e8f0; }
/* Analytics, dispatchers: invoices to send & collect */
.an-work-filters { margin: 4px 0 14px; }
/* Analytics, technicians: "your jobs only" note */
.an-mine { margin: 0 0 14px; padding: 10px 14px; border-radius: 14px; background: #eff6ff; color: #1e3a8a; border: 1px solid #bfdbfe; font-weight: 600; }
/* Settings → Team: one row per person */
.team-list { display: grid; gap: 8px; margin-top: 10px; }
.team-row { display: grid; grid-template-columns: minmax(220px, 1.6fr) 1fr 1fr 210px; gap: 14px; align-items: center; padding: 10px 14px;
  border: 1px solid #e2e8f0; border-radius: 16px; background: #ffffff; }
.team-row.inactive { opacity: .55; }
.team-who { display: flex; align-items: center; gap: 12px; text-align: left; border: none !important; background: none !important; padding: 0 !important; cursor: pointer; min-width: 0; }
.team-who .badge { margin: 0; flex: none; font-size: 14px; }
.team-who > span { display: grid; min-width: 0; }
.team-who b, .team-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-who:hover b { text-decoration: underline; }
.team-info { display: grid; gap: 2px; font-size: 14px; }
.team-ok { color: #15803d; font-weight: 600; }
.team-off { color: #b91c1c; font-weight: 600; }
.team-wait { color: #b45309; font-weight: 600; }
.team-toggle { display: flex; align-items: center; gap: 8px; margin-top: 14px; border: none !important; background: none !important;
  padding: 6px 4px !important; color: #64748b !important; font-weight: 700; cursor: pointer; }
.team-toggle:hover { color: #0f172a !important; }
.team-arrow { display: inline-block; transition: transform .15s; }
.team-arrow.open { transform: rotate(90deg); }
.team-role { display: grid; gap: 2px; }
.team-role select { width: 100%; }
@media (max-width: 900px) {
  .team-row { grid-template-columns: 1fr 1fr; }
  .team-who { grid-column: 1 / -1; }
}
/* Settings → Online Booking: working days as toggle pills */
.day-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.day-pills button { min-width: 56px; padding: 9px 12px !important; border-radius: 999px !important; font-weight: 700; }
.day-pills button.on { background: #2563eb !important; border-color: #2563eb !important; color: #ffffff !important; }
/* Client form: "＋ Add second phone / email" and the second box with its ✕ */
.modal-card .add-second { justify-self: start; align-self: start; border: 1px dashed #93c5fd; background: none; color: #2563eb; font-weight: 800;
  padding: 8px 12px; border-radius: 12px; margin-bottom: 12px; }
.second-field { position: relative; }
.modal-card .second-remove { position: absolute; top: 0; right: 0; padding: 0 4px; border: none; background: none; color: #94a3b8; font-size: 13px; line-height: 17px; }
.modal-card .second-remove:hover { color: #b91c1c; }
/* Invoice: "Pay online" button under the totals (prints too, as a clickable link in the PDF) and the side card's link box */
.inv-pay { display: block; text-align: center; margin-top: 4px; padding: 12px 16px; border-radius: 14px; background: #16a34a; color: #ffffff !important;
  font-weight: 800; text-decoration: none; }
.inv.compact .inv-pay { padding: 6px 10px; font-size: 12.5px; border-radius: 10px; }
.inv.sharp .inv-pay { border-radius: 0; }
.inv-link { width: 100%; box-sizing: border-box; }
/* Customer tags and the client page's "Notes from jobs" */
.tag-edit { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -4px 0 12px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: #eef2ff; color: #3730a3; font-size: 13px; font-weight: 700; }
.card .tag button { border: none; background: none; padding: 0 2px; color: #6366f1; font-size: 11px; }
.card .tag-input { width: 120px; min-height: 30px; padding: 4px 10px; border-radius: 999px; border: 1px dashed #a5b4fc; font-size: 13px; }
.tag-list { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 8px; vertical-align: middle; font-weight: 400; }
.tag-list .tag { font-size: 11px; padding: 1px 8px; }
.job-note { display: grid; gap: 4px; padding: 10px 12px; border-radius: 14px; background: #fffbeb; border: 1px solid #fde68a; color: inherit; text-decoration: none; margin-bottom: 8px; }
.job-note:hover { border-color: #f59e0b; }
.job-note-text { white-space: pre-wrap; overflow-wrap: anywhere; }
/* Payment window (PayModal): remaining / total, big amount, method tabs, signature */
.modal-card.pay-modal { max-width: 520px; }
.pay-modal h2:empty { display: none; }
.pay-top { display: flex; justify-content: space-between; gap: 12px; font-weight: 800; font-size: 17px; }
.pay-remaining { color: #dc2626; }
.pay-total { color: #16a34a; }
.pay-amount { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 22px 0 18px; color: #94a3b8; font-size: 52px; font-weight: 300; }
.pay-amount input { max-width: 100%; min-width: 0; font-size: 52px; font-weight: 400; text-align: center; color: #0f172a; border: none; border-bottom: 2px solid #e2e8f0;
  border-radius: 0; background: none; padding: 0 4px 6px; font-variant-numeric: tabular-nums; outline: none; }
.pay-amount input:focus { border-bottom-color: #2563eb; }
.pay-remaining.zero { color: #16a34a; }
.pay-hint { text-align: center; color: #64748b; font-size: 14px; margin: -6px 0 16px; }
.pay-note { text-align: center; color: #b45309; font-size: 14px; margin: -8px 0 14px; }
.pay-methods { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1.5px solid #cbd5e1; border-radius: 14px; overflow: hidden; margin-bottom: 16px; }
.modal-card .pay-methods button { border: none; border-radius: 0; border-left: 1.5px solid #cbd5e1; background: #ffffff; color: #334155; padding: 13px 6px; font-weight: 800; }
.modal-card .pay-methods button:first-child { border-left: none; }
.modal-card .pay-methods button.on { background: #020617; color: #ffffff; }
.pay-sign { display: grid; gap: 8px; margin: 4px 0 8px; }
.pay-btns { justify-content: flex-end; margin-top: 14px; }
.cal-head select.filter-on { border-color: #2563eb; color: #1d4ed8; font-weight: 700; } /* the calendar is showing only some jobs */
.pay-finish-title { margin: 4px 0 8px; font-size: 20px; }
.modal-card .pay-discard { color: #dc2626; border: 1.5px solid #fca5a5; background: #ffffff; min-width: 120px; }
.modal-card .pay-now { min-width: 140px; }
@media (max-width: 420px) { .pay-amount, .pay-amount input { font-size: 42px; } }
/* the header total is a button now (opens the payment window) */
.job-actions button.job-total { background: #020617; color: #ffffff; border: none; cursor: pointer; }
/* paid in full: green and not clickable (nothing left to pay) */
.job-actions button.job-total.paid { background: #dcfce7; color: #166534; cursor: default; opacity: 1; }
/* Refunds: red pill on the Payments page, a refund line in the work summary */
.pill.Refund { background: #fee2e2; color: #b91c1c; }
.work-line.refund span:last-child { color: #b91c1c; }
/* Technicians on a job (TechPicker): chips, the first is the lead */
.tp-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tp-chip { display: inline-flex; align-items: center; gap: 4px; padding: 6px 6px 6px 10px; border: 1px solid #e2e8f0; border-radius: 999px; background: #f8fafc; }
.tp-chip .dot { margin-right: 2px; }
.tp-chip em { font-style: normal; font-size: 11px; font-weight: 800; color: #2563eb; background: #eff6ff; border-radius: 999px; padding: 1px 7px; margin-left: 2px; }
:is(.card, .modal-card) .tp-chip button { border: none; background: none; padding: 2px 6px; border-radius: 999px; }
:is(.card, .modal-card) .tp-chip .tp-name { color: inherit; font: inherit; cursor: pointer; text-decoration: underline dotted #94a3b8; }
:is(.card, .modal-card) .tp-chip .tp-x { color: #94a3b8; font-size: 12px; }
:is(.card, .modal-card) .tp-chip .tp-x:hover { color: #b91c1c; background: #fee2e2; }
.tp-none { color: #94a3b8; font-weight: 700; }
.need-tech .tech-pick .tp-chips { outline: 2px solid #ef4444; outline-offset: 3px; border-radius: 12px; } /* New job: nobody assigned yet */
.need-tech-note { color: #b91c1c; font-weight: 700; font-size: 13px; margin: 6px 0 0; }
.field .tp-add { width: auto; min-height: 36px; padding: 6px 10px; border-radius: 999px; border: 1px dashed #93c5fd; color: #2563eb; font-weight: 800; background: #ffffff; }
/* "The CRM was updated — Refresh" (UpdateNotice in App.jsx): a pill at the bottom of the screen */
.update-notice { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 200; display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 10px 18px; border-radius: 999px; background: #ffffff; border: 1px solid #e2e8f0; box-shadow: 0 16px 40px rgba(15, 23, 42, .22);
  font-weight: 700; color: #0f172a; white-space: nowrap; max-width: calc(100vw - 24px); }
.update-notice button { border-radius: 999px; padding: 8px 16px; border: 1px solid #e2e8f0; background: #ffffff; color: #334155; font-weight: 800; cursor: pointer; }
.update-notice button.primary { border-color: #020617; }
.update-notice .update-later { border: none; background: none; color: #64748b; padding: 8px 10px; }
@media (max-width: 420px) { .update-notice { bottom: 12px; padding-left: 14px; gap: 6px; font-size: 14px; } }
/* Settings → Archive */
.arch-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 4px 0 12px; }
.arch-tools input { flex: 1 1 200px; min-width: 0; }
.arch-list { display: grid; gap: 10px; }
.arch-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px;
  border: 1px solid #e2e8f0; border-radius: 18px; background: #f8fafc; }
.arch-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: #ffffff; border: 1px solid #e2e8f0; font-size: 20px; }
.arch-text { display: grid; gap: 2px; min-width: 0; }
.arch-text b { overflow-wrap: anywhere; }
@media (max-width: 640px) { .arch-row { grid-template-columns: 40px minmax(0, 1fr); } .arch-row .btns { grid-column: 1 / -1; } }
/* Client page: job history 10 at a time */
/* Customer page job history pages: ‹ 1 2 3 4 5 … 17 › */
.pg { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; }
.card .pg button { min-width: 34px; height: 34px; padding: 0 8px; border-radius: 10px; border: 1px solid #e2e8f0; background: #ffffff; color: #334155; font-weight: 700; }
.card .pg button:hover:not(:disabled):not(.on) { border-color: #93c5fd; color: #1d4ed8; }
.card .pg button.on { background: #020617; border-color: #020617; color: #ffffff; }
.card .pg .pg-arrow { font-size: 20px; line-height: 1; }
.card .pg button:disabled { opacity: .35; cursor: default; }
.pg-gap { color: #94a3b8; padding: 0 2px; }
.history-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid #e2e8f0; }
.terms-field { margin-top: 18px; padding-top: 18px; border-top: 1px solid #e2e8f0; }
.terms-field textarea { width: 100%; box-sizing: border-box; resize: vertical; }
.logo-preview { width: 96px; height: 96px; flex: none; border: 1px dashed #cbd5e1; border-radius: 20px; display: grid; place-items: center; background: #f8fafc; overflow: hidden; }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.file-btn { display: inline-block; border-radius: 16px; border: 1px solid #e2e8f0; background: white; padding: 10px 14px; color: #334155; cursor: pointer; }
.file-btn:hover { border-color: #94a3b8; }

.summary { max-width: 420px; margin: 22px 22px 22px auto; background: #f8fafc; border-radius: 22px; padding: 18px; }
.summary p, .summary h2 { display: flex; justify-content: space-between; }

.badge { height: 56px; width: 56px; border-radius: 999px; display: grid; place-items: center; color: white; font-weight: 900; margin-bottom: 12px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 99px; margin-right: 6px; }

/* ---- Messages ---- */
.messages { display: grid; grid-template-columns: 340px 1fr; background: white; border: 1px solid #e2e8f0; border-radius: 28px; overflow: hidden; }
.messages aside { border-right: 1px solid #e2e8f0; padding: 12px; background: #f8fafc; max-height: 640px; overflow: auto; }
.messages aside button { display: block; width: 100%; text-align: left; border: 1px solid #e2e8f0; margin: 8px 0; border-radius: 18px; padding: 14px; background: white; color: inherit; }
.messages aside button p { margin: 4px 0 0; font-size: 13px; color: #64748b; }
.messages aside .selected { background: #020617; color: white; }
.messages aside .selected p { color: #cbd5e1; }
.unread-dot { float: right; width: 10px; height: 10px; border-radius: 99px; background: #dc2626; } /* red = unread customer conversation (owner, 2026-11-17) */
.message-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; border-bottom: 1px solid #e2e8f0; padding: 18px; flex-wrap: wrap; }
.message-head button { border-radius: 14px; border: 1px solid #e2e8f0; background: white; padding: 8px 12px; }
.thread { height: 380px; overflow: auto; background: #f8fafc; padding: 18px; }
.bubble { max-width: 75%; padding: 12px 14px; border-radius: 20px; background: white; margin: 8px 0; }
.bubble small { opacity: .7; }
.bubble.outbound { margin-left: auto; background: #020617; color: white; }
.bubble.system { background: #fff7ed; color: #9a3412; }
/* Messages: Quo call button (CRM line icon, soft blue like the job page) and call cards in the conversation */
.message-head .msg-call { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 14px; border: 1px solid #dbeafe; background: #eff6ff; color: #2563eb; font-weight: 600; text-decoration: none; }
.message-head .msg-call:hover { background: #dbeafe; border-color: #bfdbfe; }
.msg-call-wrap { position: relative; display: inline-block; }
.msg-call-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 270px; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 14px; box-shadow: 0 12px 30px rgba(15, 23, 42, .14); padding: 6px; display: grid; gap: 2px; }
.message-head .msg-call-menu :is(a, button) { display: grid; gap: 2px; text-align: left; padding: 9px 10px; border: 0; border-radius: 10px; background: transparent; color: inherit; text-decoration: none; width: 100%; }
.message-head .msg-call-menu :is(a, button):hover { background: #eff6ff; }
.msg-call-menu small { color: #64748b; font-weight: 400; }
.call-card { max-width: 80%; margin: 10px 0; padding: 12px 14px; border-radius: 16px; background: #ffffff; border: 1px solid #dbeafe; }
.call-card.outbound { margin-left: auto; }
.call-by { color: #475569; }
.bubble .msg-by { font-weight: 700; opacity: 1; }
html[data-theme="dark"] .call-by { color: #94a3b8; }
.call-card.missed { border-color: #fecaca; }
.call-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.call-head small { margin-left: auto; }
.call-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: #eff6ff; color: #2563eb; }
.call-card.missed .call-ico { background: #fef2f2; color: #dc2626; }
.call-part { margin-top: 8px; }
.call-part ul { margin: 4px 0 0; padding-left: 18px; }
.call-part p { margin: 4px 0; }
.call-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #64748b; }
.call-card .link-btn { margin-top: 8px; }
.call-transcript { margin-top: 8px; padding: 10px; border-radius: 12px; background: #f8fafc; max-height: 260px; overflow: auto; font-size: 14px; }
.call-transcript p { margin: 0 0 6px; }
.call-transcript p.us b { color: #2563eb; }
html[data-theme="dark"] .message-head .msg-call { background: rgba(59, 130, 246, .14); border-color: rgba(59, 130, 246, .3); color: #93c5fd; }
html[data-theme="dark"] .msg-call-menu { background: #111827; border-color: #1f2a3b; }
html[data-theme="dark"] .message-head .msg-call-menu :is(a, button):hover { background: #1e293b; }
html[data-theme="dark"] .call-card { background: #111827; border-color: #1e3a8a; }
html[data-theme="dark"] .call-card.missed { border-color: #7f1d1d; }
html[data-theme="dark"] .call-ico { background: rgba(59, 130, 246, .14); color: #93c5fd; }
html[data-theme="dark"] .call-card.missed .call-ico { background: rgba(239, 68, 68, .14); color: #fca5a5; }
html[data-theme="dark"] .call-transcript { background: #0b1220; }
html[data-theme="dark"] .call-transcript p.us b { color: #93c5fd; }
.composer { display: flex; gap: 10px; padding: 12px; align-items: flex-end; }
.composer textarea { min-height: 52px; }
.composer button { border-radius: 16px; padding: 12px 18px; border: none; }

/* ---- Settings ---- */
.settings { grid-template-columns: 280px minmax(0, 1fr); align-items: start; }
.settings > div { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.settings aside { background: white; border: 1px solid #e2e8f0; border-radius: 24px; padding: 12px; height: max-content; }
.settings aside button { display: block; width: 100%; text-align: left; margin: 6px 0; padding: 14px; border-radius: 16px; background: #f8fafc; border: none; color: #334155; }
.settings aside button.settings-logout { display: flex; align-items: center; gap: 10px; margin-top: 14px; background: #fef2f2; color: #dc2626; font-weight: 700; box-shadow: inset 0 0 0 1px #fecaca; }
.settings aside button.settings-logout:hover { background: #fee2e2; }
html[data-theme="dark"] .settings aside button.settings-logout { background: rgba(239, 68, 68, .12); color: #fca5a5; box-shadow: inset 0 0 0 1px rgba(239, 68, 68, .35); }
html[data-theme="dark"] .settings aside button.settings-logout:hover { background: rgba(239, 68, 68, .2); }
.perm-table { width: 100%; border-collapse: collapse; }
.perm-table th, .perm-table td { padding: 8px; border-bottom: 1px solid #e2e8f0; text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }

/* ---- Modal / menu / toast ---- */
.modal { position: fixed; inset: 0; background: rgba(2, 6, 23, .45); display: grid; place-items: center; z-index: 100; padding: 12px; }
.modal-card { background: white; border-radius: 28px; padding: 24px; max-width: 560px; width: 100%; max-height: 92vh; overflow: auto;
}
.modal-card .btns { justify-content: flex-end; margin-top: 8px; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: 52px; background: white; border: 1px solid #e2e8f0; border-radius: 18px; box-shadow: 0 20px 60px rgba(15, 23, 42, .15); padding: 8px; z-index: 60; min-width: 200px; }
.menu button { display: block; width: 100%; text-align: left; border: none !important; background: none; padding: 10px 12px; border-radius: 12px; }
.menu button:hover { background: #f1f5f9; }
.pay-row-btn { border-radius: 14px; border: none; padding: 10px 14px; }

/* ---- Job page: service / material line items ---- */
.li { display: grid; grid-template-columns: minmax(0, 1fr) 110px 130px 96px 34px; grid-template-areas: "name qty price total x" "desc desc desc tax ."; gap: 10px 12px; align-items: center; margin: 14px 0 22px; }
/* per-line Tax switch, under the line total */
.card .li-tax { grid-area: tax; align-self: start; justify-self: end; padding: 4px 10px; border-radius: 999px; border: 1px dashed #cbd5e1; background: none;
  color: #94a3b8; font-size: 12px; font-weight: 800; white-space: nowrap; }
.card .li-tax:hover { border-color: #93c5fd; color: #2563eb; }
.card .li-tax.on { border: 1px solid #2563eb; background: #eff6ff; color: #1d4ed8; }
.li-name { grid-area: name; position: relative; min-width: 0; }
.li-draft .li-box { border-style: dashed; }
.card .add-line { border: 1.5px dashed #94a3b8; background: none; color: #1565c0; font-weight: 700; padding: 10px 16px; border-radius: 12px; margin-top: 4px; }
.card .add-line:hover { background: #f8fafc; border-color: #1565c0; }
.li-draft .li-qty, .li-draft .li-price { opacity: .6; }
.li-draft .li-qty:focus-within, .li-draft .li-price:focus-within { opacity: 1; }
.li .li-box input::placeholder { color: #94a3b8; }
.li-suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; background: white; border: 1px solid #e2e8f0; border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .15); padding: 4px; max-height: 300px; overflow: auto; }
.card .li-suggest button { display: flex; justify-content: space-between; gap: 12px; width: 100%; text-align: left; border: none; background: none; padding: 9px 10px; border-radius: 8px; }
.card .li-suggest button.hi { background: #f1f5f9; }
.li-suggest b { font-weight: 600; color: #475569; white-space: nowrap; } .li-qty { grid-area: qty; } .li-price { grid-area: price; } .li-total { grid-area: total; } .li-remove { grid-area: x; } .li-desc { grid-area: desc; }
.li-box { display: block; border: 1px solid #cbd5e1; border-radius: 10px; padding: 7px 12px 6px; background: white; cursor: text; }
.li-box:focus-within { border-color: #0f172a; background: #f8fafc; }
.li-box > span { display: block; font-size: 13px; font-weight: 600; color: #64748b; }
.li .li-box input, .li .li-money input { display: block; width: 100%; border: none; background: transparent; padding: 2px 0 0; min-height: 0; border-radius: 0; font-size: 17px; color: #0f172a; outline: none; }
.li-money { display: flex; align-items: baseline; font-size: 17px; color: #0f172a; }
.li .li-money input { padding-left: 1px; }
.li .li-box input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.li .li-box input::-webkit-inner-spin-button, .li .li-box input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.li-total { text-align: right; font-size: 17px; }
.card .li-remove { width: 30px; height: 30px; padding: 0; border: none; border-radius: 50%; background: #4b5563; color: white; display: grid; place-items: center; justify-self: center; }
.card .li-remove:hover { background: #b91c1c; }
.li .li-desc { min-height: 64px; font-size: 16px; padding: 12px; resize: vertical; border-radius: 10px; border: 1px solid #cbd5e1; }
.li .li-desc:focus { outline: none; border-color: #0f172a; background: #f8fafc; }
@media (max-width: 640px) {
  .li { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto 34px; grid-template-areas: "name name name x" "qty price total total" "desc desc desc desc" ". . tax tax"; }
}

/* Job page totals: "＋ Discount" and the tax checkbox + rate live inside the summary */
.summary p { align-items: center; }
.card .sum-link { border: none; background: none; padding: 2px 4px; color: #1565c0; font-weight: 700; border-radius: 8px; }
.card .sum-link:hover { background: #e8f1fc; }
.card .sum-link.has { color: #0f172a; font-weight: 800; }
.sum-tax { display: inline-flex; align-items: center; gap: 8px; }
.sum-tax input[type=checkbox] { width: 18px; height: 18px; min-height: 0; margin: 0; cursor: pointer; }
.sum-rate { display: inline-flex; align-items: center; gap: 2px; border: 1px solid #cbd5e1; border-radius: 8px; padding: 2px 8px; background: white; color: #475569; font-size: 14px; }
.sum-rate:focus-within { border-color: #0f172a; }
.summary .sum-rate input { width: 46px; border: none; background: transparent; padding: 0; min-height: 0; border-radius: 0; font-size: 14px; text-align: right; outline: none; color: inherit; }
.sum-off > b { color: #94a3b8; font-weight: 600; }
.dt-seg { display: flex; margin-bottom: 14px; }
.dt-seg button { flex: 1; }
.dt-amount { margin-bottom: 8px; }
.dt-amount input { display: block; width: 100%; border: none; background: transparent; padding: 2px 0 0; min-height: 0; border-radius: 0; font-size: 17px; color: inherit; outline: none; }

/* ---- New job: client search ---- */
.picker { position: relative; }
.picker-list { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; background: white; border: 1px solid #e2e8f0; border-radius: 16px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .15); padding: 6px; z-index: 5; max-height: 300px; overflow: auto; }
.modal-card .picker-list button { display: block; width: 100%; text-align: left; border: none; background: none; padding: 10px 12px; border-radius: 12px; }
.modal-card .picker-list button.hi { background: #f1f5f9; }
.modal-card .picker-list .picker-add { color: #1565c0; font-weight: 700; border-top: 1px solid #e2e8f0; border-radius: 0 0 12px 12px; }
.picker-empty { margin: 6px 12px; }
.picker-list { max-height: min(60vh, 420px); overflow-y: auto; }
.modal-card .picker-list .picker-item { padding: 8px 12px; }
.picker-detail { display: block; font-weight: 400; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-tags { margin-left: 8px; }
.picker-credit { margin: 4px 12px 6px; font-size: 11px; }
.picker-tags i { font-style: normal; font-size: 11px; font-weight: 700; background: #e0e7ff; color: #3730a3; border-radius: 999px; padding: 1px 7px; margin-right: 4px; }

/* ---- Signature box (credit card payments) ---- */
.sig { margin: 4px 0 12px; }
.sig-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 13px; font-weight: 800; color: #334155; }
.modal-card .sig-head button { padding: 4px 12px; border-radius: 10px; font-size: 13px; }
.sig-pad { display: block; width: 100%; height: 170px; border: 2px dashed #cbd5e1; border-radius: 16px; background: #f8fafc; touch-action: none; object-fit: contain; }
.sig-hint { margin: 6px 0 0; text-align: center; }
/* Signing box: the frame carries the border; the canvas is always white with dark ink (that's what gets saved) */
.sig-frame { border: 2px dashed #cbd5e1; border-radius: 16px; overflow: hidden; background: #ffffff; }
.sig-canvas { display: block; width: 100%; height: 170px; touch-action: none; cursor: crosshair; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #020617; color: white; padding: 12px 18px; border-radius: 16px; z-index: 200; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: 90vw; }
.toast.bad { background: #b91c1c; }

/* ---- Photos ---- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 10px; }
.photo-grid button { padding: 0 !important; border: none !important; border-radius: 14px !important; overflow: hidden; aspect-ratio: 1; background: #f1f5f9 !important; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-view { background: white; border-radius: 20px; padding: 12px; max-width: 1000px; width: 100%; max-height: 94vh; display: grid; gap: 10px; }
.photo-view img { max-width: 100%; max-height: 78vh; object-fit: contain; margin: auto; border-radius: 12px; }
.photo-view button { border-radius: 14px; border: 1px solid #e2e8f0; background: white; padding: 8px 12px; }
/* PhotoViewer: arrows over the photo and a strip of small photos to jump between them */
.pv-stage { position: relative; display: grid; place-items: center; min-height: 0; }
.photo-view .pv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; padding: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .92); border: 1px solid #e2e8f0; font-size: 28px; line-height: 1; color: #0f172a; box-shadow: 0 6px 18px rgba(15, 23, 42, .18); }
.photo-view .pv-nav:hover { background: #ffffff; }
.photo-view .pv-nav.prev { left: 10px; }
.photo-view .pv-nav.next { right: 10px; }
.pv-details { font-size: 14px; color: #475569; overflow-wrap: anywhere; }
.pv-details a { font-weight: 700; color: #2563eb; text-decoration: none; }
.pv-details a:hover { text-decoration: underline; }
.pv-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px; }
.photo-view .pv-strip button { flex: none; width: 68px; height: 50px; padding: 0; border-radius: 10px; overflow: hidden; opacity: .55; border: 2px solid transparent; }
.photo-view .pv-strip button.on { opacity: 1; border-color: #2563eb; }
.pv-strip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-view .pv-stage img { max-height: 72vh; }

/* ---- Notifications bell ---- */
.bell { position: relative; }
.bell .count { position: absolute; top: -6px; right: -6px; background: #dc2626; color: white; border-radius: 99px; font-size: 11px; font-weight: 900; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 5px; }
.notif-menu { position: absolute; right: 0; top: 48px; width: min(380px, 92vw); max-height: 70vh; overflow-y: auto; overflow-x: hidden; background: white; border: 1px solid #e2e8f0; border-radius: 18px; box-shadow: 0 20px 60px rgba(15, 23, 42, .18); padding: 8px; z-index: 70; text-align: left; }
.notif-menu .item { display: block; width: 100%; box-sizing: border-box; text-align: left; border: none !important; background: none; padding: 10px 12px; border-radius: 12px;
  white-space: normal; overflow-wrap: anywhere; } /* text wraps to the width: no sideways scrolling */
.notif-menu .item.unread { background: #eff6ff; }
.notif-menu .item small { color: #64748b; }
.top-right { display: flex; gap: 8px; align-items: center; }

/* ---- Reports ---- */
.report-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.report-table th, .report-table td { padding: 8px 10px; border-bottom: 1px solid #e2e8f0; text-align: right; white-space: nowrap; }
.report-table th:first-child, .report-table td:first-child { text-align: left; }
.report-table th { color: #64748b; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.table-wrap { overflow-x: auto; }
.seg { display: inline-flex; background: #f1f5f9; border-radius: 16px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { border: none !important; background: transparent !important; padding: 8px 12px; border-radius: 12px !important; }
.seg button.on { background: #020617 !important; color: white !important; }

/* ---- Work summary (job history) ---- */
.work { display: grid; gap: 2px; }
.work-line { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed #e2e8f0; }
.work-line > span:first-child { min-width: 0; }
.work-line small { display: block; margin-top: 2px; }
.work-line.total { border-bottom: 1px solid #0f172a; font-weight: 800; }
.work-line.paid { color: #166534; }
.work-line.balance { border-bottom: none; font-weight: 800; }
.work-line.balance.due { color: #b91c1c; }
.work-line.balance.ok { color: #166534; }
.work.compact .work-line { padding: 3px 0; font-size: 14px; }
.history-job { border: 1px solid #e2e8f0; border-radius: 18px; padding: 14px 16px; background: white; }
.history-job + .history-job { margin-top: 10px; }
.history-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.history-head a { text-decoration: none; }
.history-head .muted { font-size: 13px; }

/* ---- Job status colors (Jobs list, legend, calendar) ---- */
.job-row.look-upcoming { border-left: 6px solid #2563eb; background: #f5f9ff; }
.job-row.look-active { border-left: 6px solid #f59e0b; background: #fffbeb; }
.job-row.look-overdue { border-left: 6px solid #94a3b8; background: #f8fafc; }
.job-row.look-done { border-left: 6px solid #16a34a; background: #f0fdf4; }
.job-row.look-unpaid { border-left: 6px solid #dc2626; background: #fef2f2; }
.job-row.look-lost { border-left: 6px solid #cbd5e1; background: #f8fafc; opacity: .7; }
.flag-unpaid { display: inline-block; background: #dc2626; color: white; font-weight: 900; font-size: 12px; border-radius: 999px; padding: 5px 10px; white-space: nowrap; letter-spacing: .02em; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-top: 12px; font-size: 13px; color: #475569; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.swatch.look-upcoming { background: #2563eb; } .swatch.look-active { background: #f59e0b; } .swatch.look-overdue { background: #94a3b8; }
.swatch.look-done { background: #16a34a; } .swatch.look-unpaid { background: #dc2626; } .swatch.look-lost { background: #cbd5e1; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.pager button, .pager select { border-radius: 12px; border: 1px solid #e2e8f0; background: white; padding: 8px 12px; color: #334155; }
.appt.paid-done { background: #dcfce7 !important; color: #166534 !important; border: 1px solid #86efac !important; }
.appt.unpaid-flag { background: #fef2f2 !important; color: #991b1b !important; border: 2px solid #dc2626 !important; }

/* ---- Job map ---- */
.job-map { width: 100%; height: 260px; border: 0; border-radius: 18px; background: #e2e8f0; display: block; margin-bottom: 16px; }
@media (max-width: 900px) { .job-map { height: 220px; } }

/* ---- Customer card on the job page ---- */
.cust { margin-bottom: 16px; font-size: 18px; color: #1f2937; line-height: 1.45; }
.cust-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.cust-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.cust-name { font-size: 20px; }
.card .cust-details { display: inline-flex; align-items: center; gap: 6px; border: none; color: #1565c0; background: #e8f1fc; border-radius: 999px;
  padding: 8px 16px 8px 12px; font-size: 15px; font-weight: 700; white-space: nowrap; }
.card .cust-details:hover { background: #d6e6fa; }
.card a.cust-details { text-decoration: none; }
/* Name left (wraps onto two rows when long, centered vertically against the buttons), Details / Profile always in the same place on the right */
.cust-top { flex-wrap: nowrap; }
.cust-top .cust-name { flex: 1 1 0; min-width: 0; line-height: 1.25; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.cust-buttons { display: flex; gap: 8px; flex-wrap: nowrap; flex: none; justify-content: flex-end; margin-left: auto; }
.card .cust-details:active { transform: scale(.97); }
/* Action buttons: soft blue rounded squares with the CRM's own line icons */
.cust-icons { display: flex; gap: 8px; flex-shrink: 0; }
.cust-icons a, .card .cust-icons button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid #dbeafe; border-radius: 12px;
  background: #eff6ff; color: #2563eb; transition: background .15s, color .15s, border-color .15s; }
.cust-icons a:hover, .card .cust-icons button:hover { background: #dbeafe; border-color: #bfdbfe; }
.card .cust-icons button.on { background: #2563eb; border-color: #2563eb; color: #ffffff; }
.nav-menu { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: -8px 0 18px; }
.nav-menu a { text-align: center; padding: 10px 4px; border: 1px solid #e2e8f0; border-radius: 14px; text-decoration: none; font-size: 14px; font-weight: 700; white-space: nowrap; }
.nav-menu a:hover { background: #f8fafc; }
.cust-profile { display: inline-flex; align-items: center; gap: 6px; color: #1565c0; font-weight: 700; text-decoration: none; }
@media (max-width: 420px) { .cust { font-size: 16px; } .cust-name { font-size: 18px; } }

/* ---- Customer quick card (read-only) ---- */
.qc { max-width: 460px; padding: 22px; }
.qc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.qc-avatar { width: 52px; height: 52px; border-radius: 50%; background: #1565c0; color: white; display: grid; place-items: center; font-weight: 800; font-size: 18px; flex-shrink: 0; }
.qc-title { flex: 1; min-width: 0; }
.qc-title h2 { margin: 0; font-size: 20px; }
.modal-card .qc-close { border: none; background: #f1f5f9; width: 36px; height: 36px; padding: 0; border-radius: 50%; color: #475569; flex-shrink: 0; }
.qc-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.qc-stats div { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 14px; padding: 10px; text-align: center; }
.qc-stats b { display: block; font-size: 17px; }
.qc-stats span { font-size: 12px; color: #64748b; }
.qc-stats .owed { background: #fef2f2; border-color: #fecaca; }
.qc-stats .owed b { color: #b91c1c; }
.qc-info { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0 0 16px; }
.qc-info dt { color: #64748b; font-size: 13px; padding-top: 2px; }
.qc-info dd { margin: 0; overflow-wrap: anywhere; }
.qc-info a { color: #1565c0; text-decoration: none; }
.qc-notes { white-space: pre-wrap; background: #fffbeb; border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.qc-jobnotes { display: grid; gap: 6px; margin-bottom: 16px; max-height: 260px; overflow-y: auto; overflow-x: hidden; }
.qc { overflow-x: hidden; }
.modal-card .qc-jobnotes button { display: grid; gap: 4px; width: 100%; text-align: left; border: none; border-left: 3px solid #f59e0b; border-radius: 10px; background: #fffbeb; padding: 9px 12px; color: inherit; }
.modal-card .qc-jobnotes button:hover { background: #fef3c7; }
.qc-jobnote { white-space: pre-wrap; font-size: 14px; overflow-wrap: anywhere; }
.qc-sub {font-size: 14px; color: #64748b; text-transform: uppercase; letter-spacing: .05em; margin: 0 0 8px; }
.qc-jobs { display: grid; gap: 6px; margin-bottom: 16px; }
.modal-card .qc-jobs button { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left; border-radius: 12px; padding: 10px 12px; }
.modal-card .qc-jobs button:hover { background: #f8fafc; }
.qc-job-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.modal-card .qc-profile { width: 100%; padding: 12px; border: none; }

/* ---- Chart ---- */
.chart { height: 240px; display: flex; align-items: flex-end; gap: 6px; padding-top: 12px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.chart .bar { width: 100%; max-width: 44px; background: #2563eb; border-radius: 8px 8px 0 0; min-height: 2px; }
.chart .bar.current { background: #0f172a; }
.chart .lbl { font-size: 11px; color: #64748b; }
.chart .col { position: relative; cursor: default; outline: none; min-width: 0; }
.chart .lbl { white-space: nowrap; }
.chart.dense { gap: 2px; }
.chart.dense .bar { border-radius: 4px 4px 0 0; }
.chart .col.hi .bar { filter: brightness(1.18); }
.chart .col.hi .lbl { color: #0f172a; font-weight: 700; }
.chart .col:focus-visible .bar { outline: 2px solid #0f172a; outline-offset: 2px; }
.chart-tip { position: absolute; left: 50%; transform: translateX(-50%); z-index: 5; display: grid; gap: 1px; white-space: nowrap; pointer-events: none;
  background: #0f172a; color: white; border-radius: 10px; padding: 7px 10px; font-size: 12px; box-shadow: 0 8px 20px rgba(15, 23, 42, .25); }
.chart-tip b { font-size: 15px; }
.chart-tip span { color: #cbd5e1; }
.chart-tip.start { left: 0; transform: none; }
.chart-tip.end { left: auto; right: 0; transform: none; }
/* Stacked bars (Revenue earned): completed jobs at the bottom, scheduled-not-finished on top. Colors checked for color-blind safety. */
.chart, .chart-legend { --c-done: #2563eb; --c-sched: #38b2f0; }
.bar-stack { width: 100%; max-width: 44px; display: flex; flex-direction: column-reverse; gap: 2px; border-radius: 8px 8px 0 0; overflow: hidden; min-height: 2px; }
.bar-stack .bar-seg { min-height: 2px; }
.chart.dense .bar-stack { border-radius: 4px 4px 0 0; }
.chart .col.hi .bar-stack { filter: brightness(1.12); }
.bar-seg.done, .chart-legend i.done, .tip-part i.done { background: var(--c-done); }
.bar-seg.sched, .chart-legend i.sched, .tip-part i.sched { background: var(--c-sched); }
/* Invoices due: past due (red) and not sent (purple) — checked with the dataviz palette validator in both modes */
.chart, .chart-legend, .due-list { --c-pastdue: #dc2626; --c-unsent: #7c3aed; }
.bar-seg.pastdue, .chart-legend i.pastdue, .tip-part i.pastdue { background: var(--c-pastdue); }
.bar-seg.unsent, .chart-legend i.unsent, .tip-part i.unsent { background: var(--c-unsent); }
.due-tag { display: inline-block; font-size: 12px; font-weight: 800; color: white; border-radius: 999px; padding: 2px 9px; }
.due-tag.pastdue { background: var(--c-pastdue); } .due-tag.unsent { background: var(--c-unsent); }
.due-list td { vertical-align: top; }
.due-list th, .due-list td { white-space: normal; padding: 8px 6px; }
.due-list td:nth-child(n+6) { white-space: nowrap; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: #475569; margin: 6px 0 2px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.an-title { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; }
.chart-legend.inline { display: inline-flex; margin: 0; gap: 12px; font-weight: 500; }
.tip-part { display: flex; align-items: center; gap: 6px; }
.tip-part i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }

/* ---- Analytics: the three chart cards in one row (Revenue earned, Average job size, Invoices due) ---- */
.an-charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.an-charts > .card { display: flex; flex-direction: column; min-width: 0; }
.an-charts .an-head { min-height: 64px; }
.an-charts .chart { margin-top: auto; }
.an-charts .an-title { gap: 4px 10px; }
.an-charts .chart-legend.inline { gap: 8px; font-size: 11px; }
.chart.an-empty { align-items: center; justify-content: center; color: #64748b; font-weight: 600; }
@media (max-width: 1150px) { .an-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Analytics main area (owner's sample): 2×2 cards on the left, the map down the right; map goes under them on smaller screens */
.an-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.an-left { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.an-map { display: flex; flex-direction: column; min-width: 0; padding: 18px; }
.wm { display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; }
.wm-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px 10px; flex-wrap: wrap; }
.wm-head h3 { margin-top: 0; }
.wm-seg { flex: none; }
.wm-seg button { padding: 6px 10px; font-size: 13px; }
.wm-map { position: relative; flex: 1; min-height: 420px; border-radius: 18px; overflow: hidden; border: 1px solid #e2e8f0; background: #f1f5f9; z-index: 0;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .02); }
/* calm, muted streets so the heat colors stand out (only the street tiles are toned down, not the heat or the dots) */
.wm-map .leaflet-tile-pane { filter: grayscale(.9) brightness(1.06) contrast(.92); }
.wm-map .leaflet-control-zoom { border: none; box-shadow: 0 6px 16px rgba(15, 23, 42, .15); border-radius: 12px; overflow: hidden; }
.wm-map .leaflet-control-zoom a { width: 32px; height: 32px; line-height: 30px; color: #0f172a; border-color: #e2e8f0; }
.wm-map .leaflet-control-attribution { background: rgba(255, 255, 255, .75); border-radius: 8px 0 0 0; font-size: 10px; }
.wm-key { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: rgba(255, 255, 255, .92);
  box-shadow: 0 6px 16px rgba(15, 23, 42, .12); font-size: 11px; font-weight: 700; color: #475569; }
.wm-key i { display: block; width: 70px; height: 8px; border-radius: 999px; background: linear-gradient(90deg, #22c55e, #facc15, #f97316, #dc2626); }
.wm-pop .leaflet-popup-content-wrapper { border-radius: 14px; box-shadow: 0 10px 28px rgba(15, 23, 42, .25); padding: 0; }
.wm-pop .leaflet-popup-content { margin: 0; padding: 10px 10px 8px; font-size: 13px; color: #0f172a; line-height: 1.35; }
.wm-pop-head { padding: 0 4px 6px; border-bottom: 1px solid #e2e8f0; margin-bottom: 4px; }
.wm-pop-head b { font-size: 14px; }
.wm-pop .wm-job { display: block; padding: 6px 6px; border-radius: 10px; color: inherit; text-decoration: none; }
.wm-pop .wm-job:hover { background: #f1f5f9; }
.wm-job-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.wm-job-top b { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-job-sub { display: block; color: #64748b; font-size: 12px; margin-top: 1px; }
.wm-s { font-style: normal; font-size: 11px; font-weight: 800; border-radius: 999px; padding: 1px 8px; white-space: nowrap; background: #e0e7ff; color: #3730a3; }
.wm-s.paid { background: #dcfce7; color: #166534; }
.wm-s.owes { background: #fee2e2; color: #b91c1c; }
.wm-more { padding: 4px 6px; color: #64748b; font-size: 12px; }
.wm-hint { padding: 4px 6px 0; color: #94a3b8; font-size: 11px; }
.wm-tip { border: none; border-radius: 10px; box-shadow: 0 8px 20px rgba(15, 23, 42, .18); font-size: 12px; padding: 5px 9px; color: #0f172a; }
.wm-empty { position: absolute; inset: 0; display: grid; place-items: center; z-index: 500; color: #64748b; font-weight: 700; background: rgba(255, 255, 255, .6); pointer-events: none; }
.wm-finding { position: absolute; top: 10px; left: 10px; z-index: 500; padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .95);
  box-shadow: 0 6px 16px rgba(15, 23, 42, .12); font-size: 12px; font-weight: 700; color: #334155; pointer-events: none; }
.wm-areas { display: grid; gap: 6px; padding: 10px 12px; border-radius: 14px; background: #f8fafc; border: 1px solid #e2e8f0; }
.wm-areas-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: #94a3b8; }
.wm-area { display: grid; grid-template-columns: minmax(0, 7.5em) minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: 13px; }
.wm-area span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.wm-area i { display: block; height: 8px; border-radius: 999px; background: linear-gradient(90deg, #22c55e, #facc15 60%, #f97316); }
.wm-area b { min-width: 1.5em; text-align: right; }
.wm-note { margin: 0; }
/* Customer page: address map with red pins (ClientMap.jsx) */
.cm-map { position: relative; height: 270px; margin: 4px 0 12px; border-radius: 16px; overflow: hidden; border: 1px solid #e2e8f0; background: #f1f5f9; z-index: 0; }
.cm-map.cm-none { display: none; }
.cm-map .leaflet-control-zoom { border: none; box-shadow: 0 6px 16px rgba(15, 23, 42, .15); border-radius: 12px; overflow: hidden; }
.cm-map .leaflet-control-zoom a { width: 30px; height: 30px; line-height: 28px; color: #0f172a; border-color: #e2e8f0; }
.cm-map .leaflet-control-attribution { background: rgba(255, 255, 255, .75); border-radius: 8px 0 0 0; font-size: 10px; }
.cm-map .cm-pin { background: none !important; border: none !important; border-radius: 0 !important; padding: 0 !important; line-height: 0; box-shadow: none;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .3)); cursor: pointer; } /* the pins are buttons: keep the page's button look off them */
.cm-map .maplibregl-ctrl-group { border-radius: 12px; overflow: hidden; box-shadow: 0 6px 16px rgba(15, 23, 42, .15); }
.cm-tip .maplibregl-popup-content { border-radius: 10px; padding: 6px 10px; font-size: 12px; box-shadow: 0 8px 20px rgba(15, 23, 42, .18); color: #0f172a; }
.cm-map .cm-pin:hover { filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .4)) brightness(1.08); }
.line.flash { animation: addr-flash 1.8s ease-out; border-radius: 12px; }
@keyframes addr-flash { 0%, 35% { background: #fef3c7; } 100% { background: transparent; } }
@media (max-width: 1150px) { .an-main { grid-template-columns: minmax(0, 1fr); } .wm-map { min-height: 380px; } }
@media (max-width: 900px) { .an-charts, .an-left { grid-template-columns: minmax(0, 1fr); } }
/* ---- Analytics: "Details ›" buttons and the pop-up behind them ---- */
.an-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.an-head h3 { margin-top: 0; }
.card .an-more { border: none; background: #e8f1fc; color: #1565c0; font-weight: 700; font-size: 13px; padding: 6px 12px; border-radius: 999px; white-space: nowrap; flex-shrink: 0; }
.card .an-more:hover { background: #d6e6fa; }
.modal-card.an-modal { max-width: 900px; }
.an-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.an-filters select, .an-filters input { min-height: 40px; padding: 8px 12px; }
.an-period { margin: 8px 0 14px; }
.an-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.an-stats div { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 14px; padding: 12px 14px; }
.an-stats b { display: block; font-size: 22px; }
.an-stats span { font-size: 13px; color: #64748b; }
.an-stats .bad b { color: #b91c1c; }
.an-sub { margin: 4px 0 8px; }
.an-breakdown { margin-bottom: 8px; }
.an-breakdown > p { margin: 0 0 4px; }
.an-breakdown .chart { height: 180px; }
.an-list { margin-top: 12px; max-height: 420px; overflow: auto; }
.an-list tbody tr { cursor: pointer; }
.an-list tr:hover td { background: #f8fafc; }
.an-list th { position: sticky; top: 0; background: white; }
.an-static tbody tr { cursor: default; }
/* Price suggestions table */
.ps-table { max-height: 55vh; }
.ps-table td, .ps-table th { vertical-align: middle; padding: 8px 6px; }
.ps-table td:nth-child(2), .ps-table th:nth-child(2) { text-align: left; white-space: normal; min-width: 180px; }
.ps-table td:first-child, .ps-table th:first-child { width: 28px; }
.ps-table tr.on td { background: #f0f7ff; }
.ps-table input[type=checkbox] { width: 18px; height: 18px; min-height: 0; margin: 0; }
.ps-price { display: inline-flex; align-items: center; gap: 2px; border: 1px solid #cbd5e1; border-radius: 8px; padding: 2px 8px; background: white; }
.ps-price input { width: 64px; border: none; padding: 2px 0; min-height: 0; border-radius: 0; text-align: right; outline: none; background: transparent; }
.ps-price:focus-within { border-color: #0f172a; }
.an-static tr:hover td { background: none; }
.an-actions { margin-top: 16px; padding-top: 14px; border-top: 1px solid #e2e8f0; }
.an-label { margin: 4px 0 0; }
.an-label.saved { color: #1565c0; font-weight: 600; }
.card .an-more.saved { background: #1565c0; color: white; }
.card .an-more.saved:hover { background: #0d47a1; }

/* ---- Login ---- */
/* ---- Sign-in page (Login.jsx): the owner's design as background (login-bg.svg on computers, login-bg-mobile.svg on phones:
   soft blue circles + the Call → Customer → Schedule → Job → Invoice workflow; phones use PhoneGraph instead), product name top-left, the sign-in box with a
   tilted blue card behind it, centered; on phones the workflow graph sits below the box. No company branding until an email. ---- */
.login-page { min-height: 100vh; position: relative; overflow: hidden; display: flex; flex-direction: column;
  background: #ffffff url(/login-bg.svg?v=4) center / cover no-repeat; } /* ?v=… makes browsers fetch a changed picture: raise it after editing login-bg.svg */
.login-top { display: flex; align-items: center; gap: 10px; padding: 22px 28px; font-size: 20px; font-weight: 900; color: #0f172a; position: relative; z-index: 2; }
.login-top img { width: 36px; height: 36px; border-radius: 10px; }
.login-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 16px 64px; position: relative; z-index: 2; }
.login-card-wrap { position: relative; width: 100%; max-width: 420px; }
.login-card-wrap::before { content: ""; position: absolute; inset: 10px -14px -14px 14px; border-radius: 26px; transform: rotate(-3deg);
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%); box-shadow: 0 24px 60px rgba(37, 99, 235, .25); z-index: -1; }
.login-box { background: white; border: 1px solid #e2e8f0; border-radius: 24px; padding: 30px 30px 24px; box-shadow: 0 20px 50px rgba(15, 23, 42, .08); }
.login-box h2 { font-size: 26px; margin: 0 0 6px; color: #0f172a; }
.login-box > .muted { margin: 0 0 18px; }
.login-box .field input { width: 100%; box-sizing: border-box; padding: 12px 14px; border-radius: 14px; border: 1px solid #cbd5e1; background: white; font-size: 16px; }
.login-box .field input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .18); }
.login-tag { margin: 26px 0 0; color: #64748b; font-size: 14px; text-align: center; max-width: 420px; }
/* the checked email: company logo (or envelope) on the left, the email, "Change" */
.email-chip { display: flex; align-items: center; gap: 10px; border: 1px solid #e2e8f0; background: #f8fafc; border-radius: 999px; padding: 6px 14px 6px 6px; margin: 6px 0 14px; }
.email-chip img { width: 34px; height: 34px; border-radius: 999px; object-fit: contain; background: white; border: 1px solid #e2e8f0; flex: none; }
.email-chip-icon { width: 34px; height: 34px; border-radius: 999px; display: grid; place-items: center; background: #eff6ff; flex: none; font-size: 16px; }
.email-chip-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: #0f172a; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 70px !important; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: none !important; background: transparent !important;
  color: #2563eb !important; font-weight: 700; padding: 6px 10px !important; border-radius: 10px !important; cursor: pointer; }
.code-input { font-size: 24px !important; letter-spacing: 8px; text-align: center; font-weight: 700; }
.login-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 8px; }
.link-btn { background: none !important; border: none !important; padding: 0 !important; color: #2563eb !important; font-weight: 700; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.login-submit { width: 100%; padding: 14px !important; border-radius: 14px; border: none; margin-top: 8px; font-size: 16px; font-weight: 800;
  background: #2563eb !important; color: white !important; }
.login-submit:hover { background: #1d4ed8 !important; }
.login-submit:disabled { opacity: .55; }
.login-register { width: 100%; padding: 13px !important; border-radius: 14px !important; border: 1.5px solid #cbd5e1 !important; margin-top: 10px;
  background: white !important; color: #0f172a !important; font-size: 16px; font-weight: 700; cursor: pointer; }
.login-register:hover { background: #f1f5f9 !important; }
.login-note { background: #eff6ff; color: #1e3a8a; border: 1px solid #bfdbfe; border-radius: 12px; padding: 10px 12px; }
.login-alt { text-align: center; margin: 16px 0 0; color: #64748b; }
.login-alt:empty { display: none; }
/* phones: the flexible workflow graph (PhoneGraph in Login.jsx) under the box; hidden on bigger screens */
.phone-graph { display: none; }
@media (max-width: 760px) {
  .phone-graph { display: block; position: relative; height: 250px; margin: 0 16px 10px; opacity: .6; z-index: 1; }
  .pg-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
  .pg-lines path { fill: none; stroke: #3b82f6; stroke-width: 2; stroke-dasharray: 5 5; stroke-linecap: round; }
  .pg-dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: #2563eb; }
  .pg-dot.pg-end { width: 10px; height: 10px; margin: -5px 0 0 -5px; }
  .pg-card { position: absolute; width: 56px; height: 60px; transform: translate(-50%, -50%); background: #ffffff; border-radius: 12px;
    box-shadow: 0 6px 16px rgba(30, 58, 138, .1); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
  .pg-card svg { width: 22px; height: 22px; fill: #2563eb; }
  .pg-card span { font-size: 10px; font-weight: 600; color: #1e293b; }
}
@media (max-width: 760px) {
  .login-top { padding: 16px; font-size: 18px; }
  /* phones: soft blue corners instead of the computer picture; the workflow graph comes after the box */
  .login-page { background: radial-gradient(260px 220px at 100% 100%, rgba(147, 197, 253, .35), rgba(147, 197, 253, 0)),
    radial-gradient(240px 200px at 0% 0%, rgba(191, 219, 254, .4), rgba(191, 219, 254, 0)), #ffffff; }
  .login-tag { display: none; }
  .login-center { justify-content: flex-start; padding: 8px 16px 20px; }
  .login-box { padding: 24px 18px 20px; }
  .login-card-wrap::before { inset: 8px -6px -8px 6px; }
}

/* ---- Phones ---- */
@media (max-width: 900px) {
  .app { padding: 12px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; }
  .tabs button { white-space: nowrap; }
  .grid2, .job-grid, .settings, .messages { grid-template-columns: minmax(0, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-grid h2 { font-size: 22px; }
  .client-row, .job-row { grid-template-columns: 1fr; gap: 6px; }
  .toolbar input { min-width: 0; }
  .messages aside { max-height: 220px; border-right: none; border-bottom: 1px solid #e2e8f0; }
  .bubble { max-width: 90%; }
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Phones: the job header buttons go below the job info, two per row */
@media (max-width: 640px) {
  .job-header { display: block; }
  .job-actions { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; }
  .job-actions .separator { display: none; }
  .job-actions button, .job-total { min-width: 0; width: 100%; height: 46px; font-size: 16px; }
}

/* ---- Text colors used from components ---- */
.txt-bad { color: #b91c1c; }
.txt-good { color: #166534; }

/* ---- Top bar: one line, tabs left, actions right; stays pinned at the top while scrolling ---- */
.top { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 22px;
  position: sticky; top: 8px; z-index: 50; }
/* A solid, page-colored strip across the full width behind the pinned bars, so scrolled content never shows around them
   (above, between them, or at their rounded corners). Calendar pages make it tall enough to cover the calendar header too. */
.top-backdrop { position: fixed; top: 0; left: 0; right: 0; height: calc(var(--topbar-h, 66px) + 14px); background: #f8fafc; z-index: 40; pointer-events: none; }
@media (min-width: 700px) {
  body:has(.cal-head) .top-backdrop { height: calc(var(--topbar-h, 66px) + var(--calhead-h, 110px) + 28px); }
}
/* tabs + search share one grey strip: the tabs take what they need (scrolling sideways if short of room), the search fills the rest */
.top-nav { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; background: #f1f5f9; border-radius: 17px; }
.top .tabs { margin-top: 0; flex: 0 1 auto; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 5px; gap: 4px; border-radius: 17px; }
.gsearch { position: relative; flex: 1 1 180px; min-width: 150px; margin-right: 5px; }
.gsearch input { width: 100%; box-sizing: border-box; height: 38px; padding: 0 12px 0 34px !important; border-radius: 13px !important; border: 1px solid #e2e8f0; background: #ffffff; }
.gsearch input:focus { outline: none; border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.gsearch-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: .55; pointer-events: none; }
.gsearch-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; min-width: 300px; max-height: min(70vh, 520px); overflow-y: auto; z-index: 60;
  background: #ffffff; border: 1px solid #e2e8f0; border-radius: 16px; box-shadow: 0 18px 40px rgba(15, 23, 42, .16); padding: 6px; }
.gsearch-group { margin: 8px 10px 4px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; }
.gsearch-results button { display: grid; gap: 2px; width: 100%; text-align: left; border: none !important; background: none !important; padding: 8px 10px !important; border-radius: 10px !important; cursor: pointer; }
.gsearch-results button.on { background: #eff6ff !important; }
.gsearch-results button b { font-weight: 700; color: #0f172a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gsearch-results button span { font-size: 13px; color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gsearch-empty { margin: 10px; color: #64748b; }
.top .tabs::-webkit-scrollbar { display: none; }
.top .top-nav .tabs { background: none; }
.top .tabs button { white-space: nowrap; padding: 8px 12px; border-radius: 13px; }
.top .top-right { flex-shrink: 0; gap: 6px; }
.top .top-right > button, .top .top-right > span > button { white-space: nowrap; } /* the bar's own buttons only, not the drop-down lists */
.top .icon-btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; font-size: 17px; line-height: 1; display: grid; place-items: center; }
.top .bell .count { top: -4px; right: -4px; }
@media (max-width: 1100px) { .user-name { display: none; } }
@media (max-width: 900px) {
  .top { flex-wrap: wrap; gap: 8px; padding: 8px; }
  .top .top-right { order: -1; width: 100%; justify-content: flex-end; }
}
/* Any width: the tabs never shrink or scroll; when the search no longer fits beside them it drops to its own row under them */
.top-nav { flex-wrap: wrap; }
.top .tabs { flex: 0 0 auto; overflow: visible; }
.top .top-nav .gsearch { flex: 1 1 180px; }
@media (min-width: 701px) and (max-width: 1250px) { /* not enough room for tabs + search + buttons on one line: the tabs get a full row (all visible, wrapping if needed) and the search the next one */
  .top-nav { flex-wrap: wrap; }
  .top .top-nav .tabs { flex: 1 1 100%; flex-wrap: wrap; overflow: visible; }
  .gsearch { flex: 1 1 100%; margin: 0 5px 5px; }
}
@media (max-width: 700px) { /* phones: every tab visible in a compact grid (no sideways scrolling); the search gets its own line */
  .top-nav { flex-wrap: wrap; }
  .top .top-nav .tabs { flex: 1 1 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(74px, 1fr)); overflow: visible; gap: 4px; }
  .top .top-nav .tabs button { padding: 8px 4px; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .gsearch { flex: 1 1 100%; margin: 0 5px 5px; }
  .gsearch-results { min-width: 0; }
}

/* ---- Phones: the top bar is just ☰ + search; ☰ opens a list with everything else (PhoneMenu in App.jsx) ---- */
.top.top-phone { flex-wrap: nowrap; gap: 8px; padding: 8px; }
.top-phone .gsearch { flex: 1 1 auto; min-width: 0; margin: 0; }
.phone-menu-wrap { position: relative; flex: none; }
.burger { position: relative; width: 44px; height: 44px; padding: 0 !important; border-radius: 14px !important; display: grid; place-content: center; gap: 4px;
  background: #f1f5f9 !important; border: 1px solid #e2e8f0 !important; }
.burger > span { display: block; width: 20px; height: 2.5px; border-radius: 2px; background: #0f172a; }
.burger-dot { position: absolute; top: 6px; right: 6px; width: 10px; height: 10px; border-radius: 50%; background: #ef4444; border: 2px solid #ffffff; }
.phone-menu { position: absolute; top: calc(100% + 8px); left: 0; width: min(320px, calc(100vw - 32px)); max-height: calc(100vh - 110px); overflow-y: auto;
  background: #ffffff; border: 1px solid #e2e8f0; border-radius: 18px; box-shadow: 0 20px 50px rgba(15, 23, 42, .2); padding: 6px; z-index: 70; }
.phone-menu > button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: none !important; background: none !important;
  padding: 12px 14px !important; border-radius: 12px !important; font-size: 16px; color: #0f172a; }
.phone-menu > button.on { background: #0f172a !important; color: #ffffff !important; }
.phone-menu > button:active { background: #f1f5f9 !important; }
.phone-menu hr { border: none; border-top: 1px solid #e2e8f0; margin: 6px 8px; }
.pm-count { background: #ef4444; color: #ffffff; border-radius: 999px; font-size: 12px; font-weight: 800; padding: 1px 7px; }
.pm-arrow { margin-left: auto; color: #94a3b8; }
.notif-menu.pm-notifs { position: static; width: auto; max-height: 45vh; box-shadow: none; margin: 0 4px 6px; background: #f8fafc; }

/* ---- Dark mode (html[data-theme="dark"], set in index.html). Screen only: invoices always print light. ---- */
@media screen {
  html[data-theme="dark"] { color-scheme: dark; color: #e5e7eb; background: #0b1220; }
  html[data-theme="dark"] body { background: #0b1220; }
  html[data-theme="dark"] .muted, html[data-theme="dark"] .log small, html[data-theme="dark"] .notif-menu .item small,
  html[data-theme="dark"] .report-table th, html[data-theme="dark"] .chart .lbl, html[data-theme="dark"] .qc-stats span,
  html[data-theme="dark"] .qc-info dt, html[data-theme="dark"] .qc-sub, html[data-theme="dark"] .dow,
  html[data-theme="dark"] .messages aside button p { color: #94a3b8; }
  html[data-theme="dark"] .field span, html[data-theme="dark"] .sig-head, html[data-theme="dark"] .legend { color: #cbd5e1; }

  /* Surfaces */
  html[data-theme="dark"] :is(.top, .card, .job-header, .hovercard, .client-row, .job-row, .media, .member, .invoice, .messages,
    .settings aside, .modal-card, .menu, .photo-view, .notif-menu, .history-job, .day, .bubble) { background: #111827; border-color: #1f2a3b; box-shadow: none; }
  html[data-theme="dark"] :is(.tabs, .log, .line, .summary, .messages aside, .thread, .seg, .qc-stats div) { background: #172033; border-color: #1f2a3b; }

  /* Buttons and inputs */
  html[data-theme="dark"] :is(.top button, .tabs button, .card button, .job-header button, .modal-card button, .field input, .field select,
    select, input, textarea, .messages aside button, .message-head button, .photo-view button, .pager button, .pager select, .settings aside button) {
    background: #172033; border-color: #2b3a52; color: #e5e7eb; }
  html[data-theme="dark"] :is(.menu button, .notif-menu .item):hover, html[data-theme="dark"] .modal-card .qc-jobs button:hover { background: #22304a; }
  html[data-theme="dark"] .active, html[data-theme="dark"] .primary, html[data-theme="dark"] .seg button.on { background: #e5e7eb !important; color: #0b1220 !important; }
  html[data-theme="dark"] .job-total { background: #e5e7eb; color: #0b1220; }
  html[data-theme="dark"] .danger { color: #f87171 !important; border-color: #7f1d1d !important; }
  html[data-theme="dark"] .photo-grid button { background: #172033 !important; }
  html[data-theme="dark"] .menu button { background: none; }
  html[data-theme="dark"] .notif-menu .item.unread { background: #172554; }

  /* Lines and borders */
  html[data-theme="dark"] :is(.invoice th, .invoice td, .perm-table th, .perm-table td, .report-table th, .report-table td, .message-head,
    .work-line, .cust-profile) { border-color: #1f2a3b; }
  html[data-theme="dark"] .messages aside { border-color: #1f2a3b; }  html[data-theme="dark"] .work-line.total { border-bottom-color: #cbd5e1; }
  html[data-theme="dark"] .separator { border-color: #2b3a52; }

  /* Calendar */
  html[data-theme="dark"] .day.today { border-color: #e5e7eb; box-shadow: 0 0 0 1px #e5e7eb; }
  html[data-theme="dark"] .day.drop { background: #172554; }
  html[data-theme="dark"] .finished { background: #172033 !important; color: #cbd5e1 !important; border-color: #2b3a52 !important; }
  html[data-theme="dark"] .lost { background: #172033 !important; color: #64748b !important; }
  html[data-theme="dark"] .more, html[data-theme="dark"] .day-head button { color: #94a3b8; }
  html[data-theme="dark"] .day-head .day-num { color: #e5e7eb; }
  html[data-theme="dark"] .confirm-msg { color: #cbd5e1; }
  html[data-theme="dark"] .card .log-undo { background: #172033; border-color: #2b3a52; color: #93c5fd; }
  html[data-theme="dark"] .card .log-undo:hover { border-color: #93c5fd; background: #1c2840; }
  html[data-theme="dark"] .reopen-note { background: rgba(245, 158, 11, .12); }
  html[data-theme="dark"] .job-header .done-btn:hover { background: rgba(245, 158, 11, .18); }
  html[data-theme="dark"] .day-head .day-num:hover { background: #22304a; }
  html[data-theme="dark"] .dv-hour { border-color: #1f2a3b; }
  html[data-theme="dark"] .add-pop { background: #111827; border-color: #2b3a52; }
  html[data-theme="dark"] .card .list-date { background: #172033; }
  html[data-theme="dark"] .card .list-date:hover { background: #22304a; }
  html[data-theme="dark"] .list-date span { color: #94a3b8; }
  html[data-theme="dark"] .list-day.is-today { border-color: #3b82f6; }
  html[data-theme="dark"] .card.list-day.is-today .list-date { background: #172554; }
  html[data-theme="dark"] .wv-col, html[data-theme="dark"] .wv-col:last-child { border-color: #1f2a3b; }
  html[data-theme="dark"] .wv-col.today { background: rgba(96, 165, 250, .06); }
  html[data-theme="dark"] .wv-col.drop { background: #172554; }
  html[data-theme="dark"] .card .wv-day { background: none; }
  html[data-theme="dark"] .card .wv-day:hover { background: #22304a; }
  html[data-theme="dark"] .card .wv-day.today b { background: #e5e7eb; color: #0b1220; }
  html[data-theme="dark"] .wv-drop-line span { background: #111827; color: #93c5fd; }
  html[data-theme="dark"] .dv-hour span { color: #94a3b8; }
  html[data-theme="dark"] .card .day-link { background: none; }
  html[data-theme="dark"] .chart .bar.current { background: #e5e7eb; }
  html[data-theme="dark"] .chart, html[data-theme="dark"] .chart-legend { --c-done: #4062e6; --c-sched: #0f9fdc; }
  html[data-theme="dark"] .mix-rows, html[data-theme="dark"] .mix-split, html[data-theme="dark"] .mix-lp, html[data-theme="dark"] .cust-health { --c-done: #4062e6; --c-sched: #0f9fdc; }
  html[data-theme="dark"] .mix-track, html[data-theme="dark"] .mix-split { background: #1f2a3b; }
  html[data-theme="dark"] .mix-row em { color: #94a3b8; }
  html[data-theme="dark"] .sq-box { background: #0f172a; border-color: #1e3a8a; }
  html[data-theme="dark"] .sq-badge { background: #78350f; color: #fde68a; }
  html[data-theme="dark"] .sq-warn { color: #fbbf24; }
  html[data-theme="dark"] .sq-ok { color: #4ade80; }
  html[data-theme="dark"] .card .ch-person:hover { background: #1e293b; }
  html[data-theme="dark"] :is(.chart, .chart-legend, .due-list) { --c-pastdue: #ef4444; --c-unsent: #8b5cf6; }
  html[data-theme="dark"] .chart-legend { color: #cbd5e1; }
  html[data-theme="dark"] .chart-tip { background: #e5e7eb; color: #0b1220; }
  html[data-theme="dark"] .chart-tip span { color: #475569; }
  html[data-theme="dark"] .chart .col.hi .lbl { color: #e5e7eb; }
  html[data-theme="dark"] .chart .col:focus-visible .bar { outline-color: #e5e7eb; }
  html[data-theme="dark"] .an-list tr:hover td { background: #172033; }
  html[data-theme="dark"] .an-list th { background: #111827; }
  html[data-theme="dark"] .ps-table tr.on td { background: #172554; }
  html[data-theme="dark"] .ps-price { background: #172033; border-color: #2b3a52; }
  html[data-theme="dark"] .ps-price input { background: transparent; color: #e5e7eb; }
  html[data-theme="dark"] .an-actions { border-color: #1f2a3b; }
  html[data-theme="dark"] .an-label.saved { color: #93c5fd; }
  html[data-theme="dark"] .card .an-more.saved { background: #3b82f6; color: white; }
  html[data-theme="dark"] .card .an-more { background: rgba(96, 165, 250, .14); color: #93c5fd; }
  html[data-theme="dark"] .an-stats div { background: #172033; border-color: #1f2a3b; }
  html[data-theme="dark"] .an-stats span { color: #94a3b8; }
  html[data-theme="dark"] .an-stats .bad b { color: #f87171; }
  /* Very dark technician colors would vanish on the dark background */
  html[data-theme="dark"] :is(.slate, .black), html[data-theme="dark"] .card .appt:is(.slate, .black) { background: #475569; }

  /* Tinted states */
  /* Status colors (Jobs list, Calendar list): a strong left stripe + a tint. Border colors are repeated here because the
     dark surfaces rule above repaints card borders. */
  html[data-theme="dark"] .job-row.look-upcoming { background: rgba(59, 130, 246, .10); border-left-color: #3b82f6; }
  html[data-theme="dark"] .job-row.look-active { background: rgba(245, 158, 11, .12); border-left-color: #f59e0b; }
  html[data-theme="dark"] .job-row.look-done { background: rgba(22, 163, 74, .12); border-left-color: #22c55e; }
  html[data-theme="dark"] .job-row.look-unpaid { background: rgba(220, 38, 38, .15); border-left-color: #ef4444; }
  html[data-theme="dark"] .job-row.look-overdue { background: #111827; border-left-color: #64748b; }
  html[data-theme="dark"] .job-row.look-lost { background: #111827; border-left-color: #334155; }
  html[data-theme="dark"] .swatch.look-lost { background: #334155; }
  html[data-theme="dark"] .error, html[data-theme="dark"] .qc-stats .owed { background: rgba(220, 38, 38, .15); border-color: #7f1d1d; color: #fca5a5; }
  html[data-theme="dark"] .qc-stats .owed b { color: #fca5a5; }
  html[data-theme="dark"] .qc-notes, html[data-theme="dark"] .modal-card .qc-jobnotes button { background: rgba(245, 158, 11, .12); }
  html[data-theme="dark"] .modal-card .qc-jobnotes button:hover { background: rgba(245, 158, 11, .2); }
  html[data-theme="dark"] .bubble.outbound, html[data-theme="dark"] .messages aside .selected { background: #2563eb; color: white; }
  html[data-theme="dark"] .bubble.system { background: rgba(249, 115, 22, .12); color: #fdba74; }
  html[data-theme="dark"] .txt-bad, html[data-theme="dark"] .work-line.balance.due { color: #f87171; }
  html[data-theme="dark"] .txt-good, html[data-theme="dark"] .work-line.paid, html[data-theme="dark"] .work-line.balance.ok { color: #4ade80; }

  /* Job page customer card and quick card */
  html[data-theme="dark"] .cust { color: #e5e7eb; }
  html[data-theme="dark"] .cust-icons a, html[data-theme="dark"] .card .cust-icons button { background: rgba(59, 130, 246, .14); border-color: rgba(59, 130, 246, .3); color: #93c5fd; }
  html[data-theme="dark"] .cust-icons a:hover, html[data-theme="dark"] .card .cust-icons button:hover { background: rgba(59, 130, 246, .26); }
  html[data-theme="dark"] .card .cust-icons button.on { background: #2563eb; border-color: #2563eb; color: #ffffff; }
  html[data-theme="dark"] .card .cust-details { background: rgba(96, 165, 250, .14); color: #93c5fd; }
  html[data-theme="dark"] .card .cust-details:hover { background: rgba(96, 165, 250, .24); }
  html[data-theme="dark"] .cust-profile, html[data-theme="dark"] .qc-info a { color: #93c5fd; }
  html[data-theme="dark"] .nav-menu a { border-color: #2b3a52; }
  html[data-theme="dark"] .nav-menu a:hover { background: #22304a; }
  html[data-theme="dark"] .modal-card .qc-close { background: #172033; color: #cbd5e1; }
  html[data-theme="dark"] .li-box, html[data-theme="dark"] .li .li-desc { background: #172033; border-color: #2b3a52; color: #e5e7eb; }
  html[data-theme="dark"] .li-box:focus-within, html[data-theme="dark"] .li .li-desc:focus { border-color: #94a3b8; background: #1c2840; }
  html[data-theme="dark"] .li-box > span { color: #94a3b8; }
  html[data-theme="dark"] .li .li-box input, html[data-theme="dark"] .li-money { color: #e5e7eb; background: transparent; }
  html[data-theme="dark"] .card .li-remove { background: #64748b; color: #0b1220; }
  html[data-theme="dark"] .card .li-remove:hover { background: #f87171; }
  html[data-theme="dark"] .card .sum-link { background: none; color: #93c5fd; }
  html[data-theme="dark"] .card .sum-link:hover { background: rgba(96, 165, 250, .14); }
  html[data-theme="dark"] .card .sum-link.has { color: #e5e7eb; }
  html[data-theme="dark"] .sum-rate { background: #172033; border-color: #2b3a52; color: #cbd5e1; }
  html[data-theme="dark"] .summary .sum-rate input, html[data-theme="dark"] .dt-amount input { background: transparent; }
  html[data-theme="dark"] .sum-off > b { color: #64748b; }
  html[data-theme="dark"] .card .add-line { background: none; color: #93c5fd; border-color: #475569; }
  html[data-theme="dark"] .card .add-line:hover { background: #172033; border-color: #93c5fd; }
  html[data-theme="dark"] .li-suggest { background: #111827; border-color: #2b3a52; }
  html[data-theme="dark"] .card .li-suggest button { background: none; }
  html[data-theme="dark"] .card .li-suggest button.hi { background: #22304a; }
  html[data-theme="dark"] .li-suggest b { color: #94a3b8; }
  html[data-theme="dark"] .picker-list { background: #111827; border-color: #2b3a52; }
  html[data-theme="dark"] .modal-card .picker-list button { background: none; }
  html[data-theme="dark"] .modal-card .picker-list button.hi { background: #22304a; }
  html[data-theme="dark"] .need-tech-note { color: #f87171; }
  html[data-theme="dark"] .picker-tags i { background: #312e81; color: #c7d2fe; }
  html[data-theme="dark"] .modal-card .picker-list .picker-add { color: #93c5fd; border-color: #2b3a52; }  html[data-theme="dark"] .job-map { filter: brightness(.85); }
  /* The signature box stays light so the dark ink is readable (it's saved on a white background). */
  html[data-theme="dark"] .sig-pad { background: #f8fafc; border-color: #475569; }
  html[data-theme="dark"] .top-backdrop { background: #0b1220; }
  html[data-theme="dark"] .inv-pick button { background: #172033 !important; }
  html[data-theme="dark"] .inv-pick-mark { background: rgba(15, 23, 42, .85); color: #e2e8f0; }
  html[data-theme="dark"] .backup-ok { background: #052e16; color: #bbf7d0; border-color: #166534; }
  html[data-theme="dark"] .backup-warn { background: #2a1d05; color: #fde68a; border-color: #92400e; }
  html[data-theme="dark"] .day-pills button.on { background: #3b82f6 !important; border-color: #3b82f6 !important; }
  html[data-theme="dark"] .team-row { background: #111827; border-color: #1f2937; }
  html[data-theme="dark"] .team-ok { color: #4ade80; }
  html[data-theme="dark"] .an-mine { background: #0f1d3a; color: #bfdbfe; border-color: #1e3a8a; }
  html[data-theme="dark"] .top-nav { background: #172033; }
  html[data-theme="dark"] .gsearch input { background: #111827; border-color: #334155; color: #e2e8f0; }
  html[data-theme="dark"] .gsearch-results { background: #111827; border-color: #1f2937; }
  html[data-theme="dark"] .gsearch-results button b { color: #f1f5f9; }
  html[data-theme="dark"] .gsearch-results button.on { background: #1e293b !important; }
  html[data-theme="dark"] .burger { background: #172033 !important; border-color: #1f2a3b !important; }
  html[data-theme="dark"] .burger > span { background: #e2e8f0; }
  html[data-theme="dark"] .burger-dot { border-color: #111827; }
  html[data-theme="dark"] .phone-menu { background: #111827; border-color: #1f2937; }
  html[data-theme="dark"] .phone-menu > button { color: #e2e8f0; }
  html[data-theme="dark"] .phone-menu > button.on { background: #2563eb !important; }
  html[data-theme="dark"] .phone-menu hr { border-top-color: #1f2937; }
  html[data-theme="dark"] .notif-menu.pm-notifs { background: #0b1220; }
  html[data-theme="dark"] :is(.card, .modal-card) .appt-sum { background: #0f172a; border-color: #1f2a3b; color: #e5e7eb; }
  html[data-theme="dark"] .as-time, html[data-theme="dark"] .when-title { color: #cbd5e1; }
  html[data-theme="dark"] .as-edit { background: rgba(37, 99, 235, .18); color: #93c5fd; }
  html[data-theme="dark"] .wheel { background: #0f172a; border-color: #2b3a52; }
  html[data-theme="dark"] .wheel::before { background: #1e293b; }
  html[data-theme="dark"] .wheel-row { color: #94a3b8; }
  html[data-theme="dark"] .wheel-row[data-d]:hover { color: #e2e8f0; }
  html[data-theme="dark"] .wheel-cur { color: #f8fafc; }
  html[data-theme="dark"] .modal-card .when-cal { background: rgba(37, 99, 235, .18); border-color: #1e3a8a; color: #93c5fd; }
  html[data-theme="dark"] .modal-card .when-cal.on { background: #2563eb; border-color: #2563eb; color: #ffffff; }
  html[data-theme="dark"] .mp { background: #0f172a; border-color: #2b3a52; }
  html[data-theme="dark"] :is(.mp .mp-nav, .mp .mp-today) { background: #172033; border-color: #2b3a52; color: #e5e7eb; }
  html[data-theme="dark"] .mp .mp-day { background: none; color: #e5e7eb; }
  html[data-theme="dark"] .mp .mp-day.off { color: #475569; }
  html[data-theme="dark"] .mp .mp-day.in { background: rgba(37, 99, 235, .2); color: #bfdbfe; }
  html[data-theme="dark"] .mp .mp-day:not(.on):hover:not(:disabled) { background: #1e293b; }
  html[data-theme="dark"] .mp .mp-day.on { background: #e5e7eb; color: #0b1220; }
  html[data-theme="dark"] .mp .mp-day:disabled { color: #334155; }
  html[data-theme="dark"] .mp .mp-today { color: #93c5fd; }
  html[data-theme="dark"] .date-field .df-btn { background: #172033; border-color: #2b3a52; color: #e5e7eb; }
  html[data-theme="dark"] .date-field .df-btn svg { color: #93c5fd; }
  html[data-theme="dark"] .modal-card .add-second { background: none; border-color: #1e40af; color: #93c5fd; }
  html[data-theme="dark"] .modal-card .second-remove { background: none; }
  html[data-theme="dark"] .history-foot { border-top-color: #1f2937; }
  html[data-theme="dark"] .card .pg button.on { background: #e5e7eb; border-color: #e5e7eb; color: #0b1220; }
  html[data-theme="dark"] .arch-row { background: #0f172a; border-color: #1f2a3b; }
  html[data-theme="dark"] .arch-icon { background: #172033; border-color: #2b3a52; }
  html[data-theme="dark"] .pill.Refund { background: rgba(239, 68, 68, .18); color: #fca5a5; }
  html[data-theme="dark"] .tp-chip { background: #0f172a; border-color: #2b3a52; }
  html[data-theme="dark"] .tp-chip em { background: rgba(37, 99, 235, .2); color: #93c5fd; }
  html[data-theme="dark"] :is(.card, .modal-card) .tp-chip button { background: none; }
  html[data-theme="dark"] .field .tp-add { background: #172033; border-color: #1e40af; color: #93c5fd; }
  html[data-theme="dark"] .tag { background: rgba(99, 102, 241, .2); color: #c7d2fe; }
  html[data-theme="dark"] .card .tag button { background: none; color: #a5b4fc; }
  html[data-theme="dark"] .card .tag-input { background: #172033; border-color: #4f46e5; }
  html[data-theme="dark"] .job-note { background: rgba(245, 158, 11, .1); border-color: rgba(245, 158, 11, .35); }
  html[data-theme="dark"] .pay-modal .pay-amount input { color: #f8fafc; border-bottom-color: #2b3a52; background: none; }
  html[data-theme="dark"] .modal-card .pay-methods button { background: #172033; border-color: #2b3a52; color: #e5e7eb; }
  html[data-theme="dark"] .pay-methods { border-color: #2b3a52; }
  html[data-theme="dark"] .modal-card .pay-methods button.on { background: #e5e7eb; border-color: #e5e7eb; color: #0b1220; }
  html[data-theme="dark"] .modal-card .pay-discard { background: none; border-color: rgba(239, 68, 68, .5); color: #f87171; }
  html[data-theme="dark"] .pay-remaining { color: #f87171; }
  html[data-theme="dark"] .pay-remaining.zero { color: #4ade80; }
  html[data-theme="dark"] .pay-hint { color: #94a3b8; }
  /* dark signing box: shown inverted (dark paper, light ink); the saved picture stays dark ink on white */
  html[data-theme="dark"] .sig-frame { border: 2px solid #475569; background: #0b1220; }
  html[data-theme="dark"] .sig-canvas { filter: invert(.93) hue-rotate(180deg); }
  html[data-theme="dark"] .pay-total { color: #4ade80; }
  html[data-theme="dark"] .job-actions button.job-total { background: #e5e7eb; color: #0b1220; }
  html[data-theme="dark"] .job-actions button.job-total.paid { background: #14532d; color: #bbf7d0; }
  html[data-theme="dark"] .card .li-tax { background: none; border-color: #334155; color: #64748b; }
  html[data-theme="dark"] .card .li-tax.on { background: rgba(37, 99, 235, .18); border-color: #3b82f6; color: #93c5fd; }
  html[data-theme="dark"] .update-notice { background: #111827; border-color: #1f2937; color: #e5e7eb; }
  html[data-theme="dark"] .update-notice .update-later { background: none; color: #94a3b8; }
  html[data-theme="dark"] .photo-view .pv-nav { background: rgba(17, 24, 39, .9); border-color: #334155; color: #e5e7eb; }
  html[data-theme="dark"] .photo-view .pv-strip button { background: none; border-color: transparent; }
  html[data-theme="dark"] .photo-view .pv-strip button.on { border-color: #3b82f6; }
  html[data-theme="dark"] :is(.card, .modal-card) .swatch { background: none; border-color: transparent; }
  html[data-theme="dark"] :is(.card, .modal-card) .swatch.on { border-color: #e5e7eb; }
  html[data-theme="dark"] .wm-map { border-color: #1f2937; background: #0b1220; }
  html[data-theme="dark"] .wm-map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) grayscale(.75) brightness(.8) contrast(.9); }
  html[data-theme="dark"] .wm-map .leaflet-control-zoom a { background: #111827; color: #e5e7eb; border-color: #1f2937; }
  html[data-theme="dark"] .wm-map .leaflet-control-attribution { background: rgba(17, 24, 39, .8); color: #94a3b8; }
  html[data-theme="dark"] .wm-map .leaflet-control-attribution a { color: #93c5fd; }
  html[data-theme="dark"] :is(.wm-key, .wm-finding) { background: rgba(17, 24, 39, .92); color: #cbd5e1; }
  html[data-theme="dark"] .wm-tip { background: #111827; color: #e5e7eb; }
  html[data-theme="dark"] .wm-pop .leaflet-popup-content-wrapper, html[data-theme="dark"] .wm-pop .leaflet-popup-tip { background: #111827; color: #e5e7eb; }
  html[data-theme="dark"] .wm-pop .leaflet-popup-content { color: #e5e7eb; }
  html[data-theme="dark"] .wm-pop-head { border-bottom-color: #2b3a52; }
  html[data-theme="dark"] .wm-pop .wm-job:hover { background: #1e293b; }
  html[data-theme="dark"] .wm-job-sub { color: #94a3b8; }
  html[data-theme="dark"] .wm-s { background: #312e81; color: #c7d2fe; }
  html[data-theme="dark"] .wm-s.paid { background: #14532d; color: #bbf7d0; }
  html[data-theme="dark"] .wm-s.owes { background: #7f1d1d; color: #fecaca; }
  html[data-theme="dark"] .wm-tip::before { border-top-color: #111827; }
  html[data-theme="dark"] .wm-areas { background: #0f172a; border-color: #1f2937; }
  html[data-theme="dark"] .wm-empty { background: rgba(11, 18, 32, .6); color: #cbd5e1; }
  html[data-theme="dark"] .cm-map { border-color: #1f2937; background: #0b1220; }
  html[data-theme="dark"] .cm-map canvas { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9); } /* dark map; the pins are separate, so they stay red */
  html[data-theme="dark"] .cm-map .leaflet-control-zoom a { background: #111827; color: #e5e7eb; border-color: #1f2937; }
  html[data-theme="dark"] .cm-map .leaflet-control-attribution { background: rgba(17, 24, 39, .8); color: #94a3b8; }
  @keyframes addr-flash-dark { 0%, 35% { background: rgba(245, 158, 11, .2); } 100% { background: transparent; } }
  html[data-theme="dark"] .line.flash { animation-name: addr-flash-dark; }
  html[data-theme="dark"] .pv-details { color: #cbd5e1; }
  html[data-theme="dark"] .pv-details a { color: #93c5fd; }
  html[data-theme="dark"] .inv-tool { background: #111827; border-color: #334155; color: #93c5fd; }
  html[data-theme="dark"] .file-btn { background: #1e293b; border-color: #334155; color: #e2e8f0; }
  html[data-theme="dark"] :is(.logo-preview, .logo-field) { border-color: #334155; }
}

/* ---- Printing an invoice ---- */
/* .compact = the one-page print layout. Invoice.jsx adds it just before printing (beforeprint), lays the invoice out at the
   printable width of a Letter page and, if it's still taller than one page, shrinks it with zoom so it fits. */
.inv.compact { max-width: none; margin: 0; gap: 9px; font-size: 12px; }
.inv.compact .inv-card { padding: 10px 16px; border-radius: 14px; border-width: 1.5px; }
.inv.compact .inv-head { gap: 16px; }
.inv.compact .inv-logo { width: 82px; height: 82px; }
.inv.compact :is(.inv-co h1, .inv-title h1) { font-size: 17px; } /* = .inv-num in print */
.inv.compact .inv-co h1 { margin-bottom: 6px; }
.inv.compact .inv-co p { line-height: 1.45; }
.inv.compact .inv-title .inv-num { font-size: 17px; margin: 4px 0 8px; }
.inv.compact .inv-two { gap: 12px; }
.inv.compact .inv-label { font-size: 11px; margin-bottom: 4px !important; }
.inv.compact .inv-two h2 { font-size: 16px; margin-bottom: 3px; }
.inv.compact .inv-two p { line-height: 1.4; }
.inv.compact .inv-two .inv-muted { margin-top: 5px; }
.inv.compact .inv-two .inv-muted[style] { margin-top: 6px !important; }
.inv.compact .inv-big { font-size: 13px; }
.inv.compact .inv-band { padding: 8px 14px; border-radius: 14px; }
.inv.compact .inv-band div { padding: 0 14px; }
.inv.compact .inv-band div:first-child { padding-left: 0; }
.inv.compact .inv-band span { font-size: 11px; }
.inv.compact .inv-band b { font-size: 19px; }
.inv.compact .inv-lines h3 { font-size: 16px; padding-bottom: 6px; border-bottom-width: 1.5px; }
.inv.compact .inv-line { padding: 6px 0; }
.inv.compact .inv-line + .inv-line { border-top-width: 1.5px; }
.inv.compact .inv-line-top { font-size: 14px; }
.inv.compact .inv-lines { --w-qty: 44px; --w-price: 84px; --w-amt: 84px; }
.inv.compact .inv-cols { font-size: 10.5px; padding-top: 5px; }
.inv.compact .inv-desc { font-size: 11.5px; margin-top: 3px !important; line-height: 1.35; }
.inv.compact .inv-bullets { font-size: 11.5px; margin-top: 4px; line-height: 1.3; }
.inv.compact .inv-bullets.two { column-gap: 28px; }
.inv.compact .inv-photos { grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 8px; }
.inv.compact .inv-photos img { border-radius: 10px; }
.inv.compact .inv-foot { gap: 14px; }
.inv.compact .inv-thanks { padding: 10px 4px; gap: 3px; border-top-width: 1.5px; }
.inv.compact .inv-thanks .inv-thanks-msg { font-size: 14px; }
.inv.compact .inv-totals { padding: 10px 16px; gap: 5px; }
.inv.compact .inv-totals p { font-size: 12.5px; }
.inv.compact .inv-totals .inv-sep { padding-top: 5px; border-top-width: 1.5px; }
.inv.compact .inv-due { padding: 7px 14px; border-radius: 12px; margin-top: 3px; }
.inv.compact .inv-due span { font-size: 12.5px; }
.inv.compact .inv-due b { font-size: 21px; }
@media print {
  @page { size: letter; margin: 10mm; }
  .no-print { display: none !important; }
  .detail { margin-top: 0; }
  .app { padding: 0; }
  body { background: white !important; }
  .inv-wrap { display: block; }
  .inv { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .inv * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .inv-card, .inv-line, .inv-foot, .inv-photos img { break-inside: avoid; }
  .inv-lines { break-inside: auto; }
}

/* Analytics: Service mix + Customer health (a row of two cards under the charts and the map) */
.an-extra { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
@media (max-width: 900px) { .an-extra { grid-template-columns: minmax(0, 1fr); } }
/* Team activity (owner only) */
.modal-card.tp-modal { max-width: 1000px; }
.tp-modal h4 { margin: 18px 0 8px; }
.tp-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.tp-tiles > div { display: grid; gap: 2px; padding: 10px 12px; border-radius: 14px; background: #f8fafc; }
.tp-tiles span { font-size: 12px; color: #64748b; font-weight: 700; }
.tp-tiles b { font-size: 20px; }
.tp-tiles small { color: #64748b; }
.tp-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 760px) { .tp-two { grid-template-columns: minmax(0, 1fr); } }
.tp-list { display: grid; gap: 4px; max-height: 260px; overflow: auto; }
.tp-list .line { display: flex; justify-content: space-between; gap: 10px; text-align: left; padding: 8px 10px; border-radius: 10px; border: 1px solid #e2e8f0; background: transparent; width: 100%; }
.tp-list .line:hover { background: #eff6ff; }
.tp-success { padding: 12px 14px; border-radius: 14px; background: #f8fafc; }
.tp-rate { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.tp-rate b { font-size: 30px; color: #16a34a; }
.tp-rate span { color: #334155; }
.tp-bar { height: 10px; border-radius: 99px; background: #e2e8f0; margin: 8px 0; overflow: hidden; }
.tp-bar span { display: block; height: 100%; background: #16a34a; border-radius: 99px; }
.tp-conv { margin-top: 8px; gap: 0; border: 1px solid #e2e8f0; border-radius: 14px; max-height: 300px; }
.tp-conv-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) minmax(0, 1fr); gap: 10px; padding: 8px 12px; border-bottom: 1px solid #f1f5f9; font-size: 14px; align-items: start; }
.tp-conv-row.won { background: #f0fdf4; }
.tp-conv-row.skip { opacity: .7; }
.tp-conv-row a { color: #2563eb; cursor: pointer; font-weight: 600; }
.tp-conv-row.won .tp-result a { color: #15803d; }
@media (max-width: 760px) { .tp-conv-row { grid-template-columns: minmax(0, 1fr); gap: 2px; } }
html[data-theme="dark"] .tp-success { background: #0b1220; }
html[data-theme="dark"] .tp-rate span { color: #cbd5e1; }
html[data-theme="dark"] .tp-bar { background: #1f2a3b; }
html[data-theme="dark"] .tp-conv, html[data-theme="dark"] .tp-conv-row { border-color: #1f2a3b; }
html[data-theme="dark"] .tp-conv-row.won { background: rgba(22, 163, 74, .12); }
html[data-theme="dark"] .tp-conv-row a { color: #93c5fd; }
html[data-theme="dark"] .tp-conv-row.won .tp-result a { color: #86efac; }
.tp-timeline { display: grid; max-height: 420px; overflow: auto; border: 1px solid #e2e8f0; border-radius: 14px; }
.tp-item { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; padding: 8px 12px; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
.tp-when { color: #64748b; white-space: nowrap; }
.tp-item a { color: #2563eb; cursor: pointer; font-weight: 600; }
html[data-theme="dark"] .tp-tiles > div { background: #0b1220; }
html[data-theme="dark"] .tp-list .line, html[data-theme="dark"] .tp-timeline { border-color: #1f2a3b; }
html[data-theme="dark"] .tp-list .line:hover { background: #172036; }
html[data-theme="dark"] .tp-item { border-color: #1f2a3b; }
html[data-theme="dark"] .tp-item a { color: #93c5fd; }
.an-team { margin-top: 18px; }
.an-private { margin-left: 8px; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: #eff6ff; color: #2563eb; vertical-align: middle; }
.team-office { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.team-office > div { display: flex; gap: 10px; align-items: baseline; padding: 12px 14px; border-radius: 16px; background: #f8fafc; }
.team-office > div > b { font-size: 22px; }
.team-office > div.bad > b { color: #dc2626; }
.team-office span { color: #475569; font-size: 14px; }
@media (max-width: 900px) { .team-office { grid-template-columns: minmax(0, 1fr); } }
.team-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.team-table th { text-align: left; font-size: 12px; color: #64748b; font-weight: 700; padding: 8px; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
.team-table td { padding: 10px 8px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.team-table tbody tr { cursor: pointer; }
.team-table tbody tr:hover, .team-table tbody tr.on { background: #eff6ff; }
html[data-theme="dark"] .an-private { background: rgba(59, 130, 246, .14); color: #93c5fd; }
html[data-theme="dark"] .team-office > div { background: #0b1220; }
html[data-theme="dark"] .team-office span { color: #94a3b8; }
html[data-theme="dark"] .team-table th { border-color: #1f2a3b; color: #94a3b8; }
html[data-theme="dark"] .team-table td { border-color: #1f2a3b; }
html[data-theme="dark"] .team-table tbody tr:hover, html[data-theme="dark"] .team-table tbody tr.on { background: #172036; }
.mix-rows, .mix-split, .mix-lp, .cust-health { --c-done: #2563eb; --c-sched: #38b2f0; }
.mix-rows { display: grid; gap: 8px; margin-top: 12px; }
.mix-row { display: grid; grid-template-columns: minmax(0, 11.5em) minmax(0, 1fr) 5.8em 2.8em; align-items: center; gap: 10px; font-size: 13px; }
.mix-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.mix-track { display: block; height: 9px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.mix-fill { display: block; height: 100%; border-radius: 999px; background: var(--c-done); }
.mix-row b { text-align: right; font-variant-numeric: tabular-nums; }
.mix-row em { text-align: right; font-style: normal; color: #64748b; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .mix-row { grid-template-columns: minmax(0, 7.5em) minmax(0, 1fr) auto auto; gap: 6px; } }
.mix-split { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: #e2e8f0; margin: 6px 0 4px; }
.mix-split .done { background: var(--c-done); } .mix-split .sched { background: var(--c-sched); }
.mix-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin: 0 5px 0 12px; vertical-align: baseline; }
.mix-lp p, .cust-health > p { margin: 0 0 8px; }
.mix-dot:first-child { margin-left: 0; }
.mix-dot.done { background: var(--c-done); } .mix-dot.sched { background: var(--c-sched); }
.mix-toggle { margin-top: 10px; }
.ch-top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.ch-big { font-size: 34px; line-height: 1; }

.ch-sub { margin: 14px 0 4px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: #94a3b8; }
.card .ch-person { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: baseline; width: 100%; text-align: left; border: none; background: none; padding: 7px 8px; border-radius: 10px; font-size: 14px; }
.card .ch-person:hover { background: #f1f5f9; }
.ch-person span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ch-person em { font-style: normal; color: #64748b; font-size: 12px; }
/* Analytics: the Filter card in the top row (where Close rate used to be) */
.an-filter { display: flex; flex-direction: column; }
.an-filter .an-head { margin-bottom: 8px; align-items: center; }
.an-filter .an-head h3 { margin: 0; }
.an-filter-fields { display: grid; gap: 8px; }
.an-filter-fields select { width: 100%; max-width: none; height: 38px; font-size: 14px; }
.an-filter-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.an-filter .an-label { margin: 10px 0 0; }
.an-filter.on { box-shadow: inset 0 0 0 2px #2563eb; }
.an-info { display: inline-block; margin-left: 2px; color: #94a3b8; font-weight: 400; cursor: help; }

/* Price Book: "Suggested for your Price Book" box at the top of the services */
.pb-suggest-title { margin: 0 0 2px; }
.pb-sug { flex-wrap: wrap; gap: 10px 16px; }
.pb-sug .btns { margin-left: auto; }

/* Calendar Month view: a multi-day job is one bar lying across its days (and the gaps between them) */
.ms-bar { position: absolute; z-index: 2; height: 28px; margin: 0; padding: 5px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 1px 2px rgba(15, 23, 42, .2); }
.ms-bar small { display: inline; margin-left: 2px; }
.ms-bar.cont-left { border-top-left-radius: 4px; border-bottom-left-radius: 4px; }
.ms-bar.cont-right { border-top-right-radius: 4px; border-bottom-right-radius: 4px; }
.ms-bar.drag-source { pointer-events: none; }
.calendar .ms-bar { cursor: pointer; }
.calendar .ms-bar.movable { cursor: grab; }

/* Invoice page: "Create Square link" */
.sq-box { display: grid; gap: 8px; justify-items: start; margin: 10px 0 12px; padding: 12px; border: 1px dashed #bfdbfe; background: #f8fbff; border-radius: 14px; }
.sq-head { display: flex; align-items: center; gap: 8px; }
.sq-badge { font-size: 11px; font-weight: 800; background: #fef3c7; color: #92400e; border-radius: 999px; padding: 2px 9px; }
.sq-box p { margin: 0; }
.sq-warn { color: #b45309; font-weight: 600; font-size: 13px; }
.sq-ok { color: #15803d; font-weight: 700; font-size: 14px; }

/* ---- Price Book: one table per category (Service | Price | Description), click a row to edit ---- */
.pb-table { padding: 6px 8px; margin-bottom: 18px; }
.pb-table .pb-row { display: grid; grid-template-columns: minmax(150px, 1.2fr) minmax(110px, .8fr) 100px minmax(0, 2.2fr); gap: 16px; align-items: baseline; width: 100%; text-align: left;
  padding: 11px 14px; border: none; border-radius: 12px; background: none; font: inherit; color: inherit; }
.pb-table .pb-row + .pb-row { border-top: 1px solid #eef2f7; }
.pb-table .pb-edit { cursor: pointer; }
.pb-table .pb-edit:hover { background: #f1f5f9; }
.pb-table .pb-row:has(.pb-del), .pb-table .pb-head:has(span:nth-child(5)) { grid-template-columns: minmax(150px, 1.2fr) minmax(110px, .8fr) 100px minmax(0, 2.2fr) 78px; }
.pb-table .pb-del { padding: 5px 10px; font-size: 13px; justify-self: end; align-self: center; }
.pb-table .pb-head { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #94a3b8; padding-bottom: 6px; }
.pb-table .pb-name { font-weight: 700; }
.pb-table .pb-price { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.pb-table .pb-head span:nth-child(3) { text-align: right; }
.pb-table .pb-cat { color: #475569; font-size: 14px; }
.pb-table .pb-desc { font-size: 14px; line-height: 1.4; }
@media (max-width: 700px) {
  .pb-table .pb-row { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; }
  .pb-table .pb-cat { grid-row: 2; }
  .pb-table .pb-price { grid-row: 1; grid-column: 2; }
  .pb-table .pb-desc { grid-column: 1 / -1; }
  .pb-table .pb-row:has(.pb-del) { grid-template-columns: minmax(0, 1fr) auto; }
  .pb-table .pb-del { grid-column: 1 / -1; justify-self: start; }
  .pb-table .pb-head span:nth-child(n+2) { display: none; }
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .pb-table .pb-row + .pb-row { border-top-color: #1f2a3b; }
  html:not([data-theme="light"]) .pb-table .pb-edit:hover { background: #1b2740; }
}
html[data-theme="dark"] .pb-table .pb-row + .pb-row { border-top-color: #1f2a3b; }
html[data-theme="dark"] .pb-table .pb-edit:hover { background: #1b2740; }

/* ---- "What kind of work do you do?" chips (sign-up form and Settings → General Information) ---- */
.trade-picker .day-pills { margin: 6px 0 4px; }
.trade-picker .day-pills button { background: #ffffff; border: 1px solid #cbd5e1; color: #0f172a; font-size: 14px; min-width: 0; padding: 7px 14px !important; cursor: pointer; }
.trade-picker .day-pills button:hover:not(.on) { background: #f1f5f9; }
.trade-picker .btns { margin-bottom: 4px; }
.trade-picker .btns input { flex: 1; min-width: 0; }
.trade-picker .btns > button { white-space: nowrap; padding: 10px 14px; border-radius: 12px; border: 1px solid #cbd5e1; background: #ffffff; color: #0f172a; font-weight: 700; cursor: pointer; }
.trade-picker .btns > button:disabled { opacity: .5; cursor: default; }
html[data-theme="dark"] .trade-picker .day-pills button:not(.on), html[data-theme="dark"] .trade-picker .btns > button { background: #172033; border-color: #2a3649; color: #e5e7eb; }

/* Sign-up: the invitation code box is highlighted so it isn't missed (the sign-in page is always light) */
.login-box .invite-field { background: #eff6ff; border: 1.5px solid #93c5fd; border-radius: 16px; padding: 12px 14px 10px; margin-bottom: 14px; }
.login-box .invite-field .field { margin-bottom: 4px; }
.login-box .invite-field .field > span { color: #1d4ed8; font-weight: 800; }
.login-box .invite-field .field input { border-color: #2563eb; }
.login-box .invite-field small { color: #1e40af; }

/* Top bar round buttons (bell, gear, moon/sun): line drawings in the CRM blue instead of emoji; white on the dark "open page" circle.
   The bell's red unread count stays. */
.top .icon-btn .top-icon { color: #2563eb; display: block; }
.top .icon-btn.active .top-icon { color: #ffffff; }
html[data-theme="dark"] .top .icon-btn .top-icon { color: #93c5fd; }
html[data-theme="dark"] .top .icon-btn.active .top-icon { color: #0b1220; }

/* Team member page / Settings → Profile: photo instead of initials, photo buttons, Log out on the right */
img.avatar-photo { object-fit: cover; padding: 0; display: inline-block; }
.member-head { justify-content: flex-start; align-items: center; gap: 16px; flex-wrap: wrap; }
.member-head .photo-btns { margin: 8px 0 0; gap: 8px; }
.member-head .photo-btns button { padding: 6px 12px; font-size: 14px; }
.member-head .member-logout { margin-left: auto; }

/* Messages: linking an unknown number to a customer; choosing which of a customer's numbers to text */
.messages .not-linked { margin-left: 8px; font-size: 11px; font-weight: 800; color: #b45309; background: #fef3c7; border-radius: 99px; padding: 2px 8px; }
.link-panel { border: 1.5px solid #93c5fd; background: #eff6ff; border-radius: 16px; padding: 12px 14px; margin: 10px 0; }
.link-panel .list button.line { width: 100%; text-align: left; background: #ffffff; }
.link-panel .link-why { color: #1d4ed8; font-weight: 700; font-size: 13px; }
.link-panel .link-go { color: #2563eb; font-weight: 800; white-space: nowrap; }
.composer .to-pick { align-self: stretch; max-width: 190px; }
html[data-theme="dark"] .link-panel { background: #172033; border-color: #1e3a8a; }
html[data-theme="dark"] .link-panel .list button.line { background: #0f172a; }
html[data-theme="dark"] .messages .not-linked { background: rgba(245, 158, 11, .18); color: #fbbf24; }
/* Service mix: labor income on top, materials set aside as an expense at the bottom (owner, 2026-11-14) */
.mix-income { margin: 4px 0 10px; color: #334155; }
.mix-income b { font-size: 18px; color: #0f172a; }
.mix-expense { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: #fef2f2; border: 1px dashed #fecaca; color: #7f1d1d; }
.mix-expense em { font-style: normal; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-left: 6px; color: #dc2626; }
.mix-expense b { color: #dc2626; }
html[data-theme="dark"] .mix-income { color: #cbd5e1; }
html[data-theme="dark"] .mix-income b { color: #f1f5f9; }
html[data-theme="dark"] .mix-expense { background: rgba(239, 68, 68, .1); border-color: rgba(239, 68, 68, .35); color: #fecaca; }
html[data-theme="dark"] .mix-expense em, html[data-theme="dark"] .mix-expense b { color: #fca5a5; }

/* Settings → Security */
.sec-table td { vertical-align: top; }
.sec-table .nowrap { white-space: nowrap; }
.sec-new { margin-left: 6px; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 99px; background: #fef3c7; color: #92400e; }
.small-btn { padding: 6px 10px; font-size: 13px; white-space: nowrap; }
html[data-theme="dark"] .sec-new { background: rgba(245, 158, 11, .18); color: #fcd34d; }
/* Price Book → 📦 Starter services */
.ss-group { margin-top: 14px; }
.ss-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.ss-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 10px; border-radius: 12px; border: 1px solid #e2e8f0; margin-bottom: 4px; cursor: pointer; }
.ss-row.on { background: #eff6ff; border-color: #bfdbfe; }
.ss-row input { margin-top: 3px; }
.ss-price { white-space: nowrap; }
html[data-theme="dark"] .ss-row { border-color: #1f2a3b; }
html[data-theme="dark"] .ss-row.on { background: #172036; border-color: #1e3a8a; }
/* First window after sign-up: what kind of work do you do (Welcome.jsx) */
.modal.welcome { z-index: 120; }
.modal-card.welcome-card { max-width: 560px; }
.welcome-card h2 { margin-top: 0; }
.ss-list { max-height: max(220px, calc(100vh - 330px)); overflow-y: auto; margin-top: 8px; padding-right: 4px; border-top: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; }
.ss-list .ss-group:first-child { margin-top: 10px; }
.ss-foot { margin-top: 12px; }
html[data-theme="dark"] .ss-list { border-color: #1f2a3b; }
@media (max-width: 640px) {
  .ss-list { max-height: max(200px, calc(100vh - 440px)); }
  .ss-foot { flex-wrap: nowrap; gap: 8px; }
  .ss-foot button { padding: 9px 12px; font-size: 14px; white-space: nowrap; }
  .ss-foot .spacer { display: none; }
  .ss-foot .ss-skip { flex: 1; }
}

/* Price Book: possible duplicates (owner, 2026-11-14) */
.pb-dups { border-color: #fde68a; background: #fffbeb; }
.pb-dup { padding: 8px 0 10px; border-top: 1px solid #fde68a; }
.pb-dup:first-of-type { border-top: 0; }
.pb-dup-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 4px 0; }
.pb-dup-btns { display: flex; gap: 6px; }
.pb-dup-btns button { padding: 6px 12px; font-size: 13px; }
.pb-dup .link-btn { margin-top: 4px; font-size: 13px; }
html[data-theme="dark"] .pb-dups { background: rgba(245, 158, 11, .08); border-color: rgba(245, 158, 11, .3); }
html[data-theme="dark"] .pb-dup { border-color: rgba(245, 158, 11, .25); }
@media (max-width: 640px) { .pb-dup-row { grid-template-columns: minmax(0, 1fr) auto; } .pb-dup-btns { grid-column: 1 / -1; } }
/* the bottom message with an Undo countdown */
.toast.has-undo { display: flex; align-items: center; gap: 14px; }
.toast-undo { background: #ffffff; color: #0f172a; border: 0; border-radius: 10px; padding: 7px 12px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.toast-undo:hover { background: #e2e8f0; }

.pb-dup-name { display: flex; align-items: center; gap: 8px; cursor: pointer; min-width: 0; }
.pb-dup-row.picked { background: #fee2e2; border-radius: 10px; }
.pb-dup-foot { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.pb-dup-foot .danger { padding: 6px 12px; font-size: 13px; }
.pb-keep { white-space: nowrap; }
html[data-theme="dark"] .pb-dup-row.picked { background: rgba(239, 68, 68, .15); }

/* CRM line icons (components/Icon.jsx; owner 2026-11-14: icons match the site — no emoji) */
.ic { display: inline-block; vertical-align: -0.2em; flex-shrink: 0; color: #2563eb; margin-right: .38em; }
.ic.solo { margin-right: 0; vertical-align: middle; }
button.primary .ic, button.danger .ic, .primary .ic, .danger .ic, .toast .ic, .on > .ic, .active > .ic { color: inherit; }
.txt-bad .ic, .flag-unpaid .ic, .reopen-note .ic { color: inherit; }
.ic.call-missed { color: #dc2626; }
.ic.call-in { color: #16a34a; }
.ic.call-out { color: #2563eb; }
.call-ico.k-missed { background: #fef2f2; }
.call-ico.k-in { background: #f0fdf4; }
.call-ico.k-out { background: #eff6ff; }
.call-ico .ic { margin: 0; }
.an-private .ic { margin-right: .25em; color: inherit; }
.gsearch-icon { opacity: 1; display: grid; }
.gsearch-icon .ic { color: #64748b; }
.email-chip-icon .ic { color: #2563eb; }
.arch-icon .ic { color: #2563eb; }
.wm-finding .ic { color: inherit; }
html[data-theme="dark"] .ic { color: #93c5fd; }
html[data-theme="dark"] button.primary .ic, html[data-theme="dark"] .primary .ic, html[data-theme="dark"] .danger .ic, html[data-theme="dark"] .toast .ic { color: inherit; }
html[data-theme="dark"] .ic.call-missed { color: #f87171; }
html[data-theme="dark"] .ic.call-in { color: #4ade80; }
html[data-theme="dark"] .ic.call-out { color: #93c5fd; }
html[data-theme="dark"] .call-ico.k-missed { background: rgba(239, 68, 68, .14); }
html[data-theme="dark"] .call-ico.k-in { background: rgba(34, 197, 94, .14); }
html[data-theme="dark"] .call-ico.k-out { background: rgba(59, 130, 246, .14); }

/* Team activity → slow replies to review (owner, 2026-11-14) */
.rv-list { display: grid; gap: 6px; max-height: 360px; overflow: auto; }
.rv-row { border: 1px solid #e2e8f0; border-radius: 12px; padding: 8px 12px; }
.rv-row.rv-ok { background: #f0fdf4; border-color: #bbf7d0; }
.rv-row.rv-slow { background: #fef2f2; border-color: #fecaca; }
.rv-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rv-top a { cursor: pointer; color: inherit; }
.rv-btns, .rv-reasons, .rv-done { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.rv-btns button, .rv-reasons button { padding: 5px 10px; font-size: 13px; }
.rv-btns .rv-ok { color: #15803d; border-color: #bbf7d0; } .rv-btns .rv-ok .ic { color: #16a34a; }
.rv-btns .rv-slow { color: #b91c1c; border-color: #fecaca; } .rv-btns .rv-slow .ic { color: #dc2626; }
.rv-reasons .chip { border-radius: 999px; background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.rv-own { display: flex; gap: 6px; align-items: center; flex: 1 1 260px; }
.rv-own input { flex: 1; min-width: 120px; padding: 6px 10px; }
.rv-pill { display: inline-flex; align-items: center; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.rv-pill.ok { background: #dcfce7; color: #166534; } .rv-pill.ok .ic { color: inherit; }
.rv-pill.slow { background: #fee2e2; color: #991b1b; } .rv-pill.slow .ic { color: inherit; }
html[data-theme="dark"] .rv-row { border-color: #1f2a3b; }
html[data-theme="dark"] .rv-row.rv-ok { background: rgba(34, 197, 94, .1); border-color: rgba(34, 197, 94, .3); }
html[data-theme="dark"] .rv-row.rv-slow { background: rgba(239, 68, 68, .1); border-color: rgba(239, 68, 68, .3); }
html[data-theme="dark"] .rv-reasons .chip { background: rgba(34, 197, 94, .12); border-color: rgba(34, 197, 94, .3); color: #86efac; }
html[data-theme="dark"] .rv-pill.ok { background: rgba(34, 197, 94, .18); color: #86efac; }
html[data-theme="dark"] .rv-pill.slow { background: rgba(239, 68, 68, .18); color: #fca5a5; }
/* Messages tab: red count of unread conversations (the bell no longer shows texts/calls — owner 2026-11-16) */
.tab-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 800; line-height: 1; vertical-align: 1px; }
/* Booked, but not in the calendar: the red bar under the top bar (MissedBookings.jsx) */
.missed-bookings { position: relative; z-index: 41; /* above .top-backdrop (40), which covered it on the Calendar page; under the pinned bars (45/50) */ margin: 0 0 14px; padding: 10px 14px; border-radius: 16px; background: #dc2626; color: #fff; box-shadow: 0 8px 24px rgba(220, 38, 38, .35); }
.missed-bookings .ic { color: #fff; }
.mb-head { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.mb-pulse { width: 10px; height: 10px; border-radius: 999px; background: #fff; animation: mb-pulse 1.2s ease-in-out infinite; flex: none; }
@keyframes mb-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }
@media (prefers-reduced-motion: reduce) { .mb-pulse { animation: none; } }
.mb-more { margin-left: auto; background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.mb-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.25); }
.mb-text { min-width: 0; flex: 1 1 360px; }
.mb-quote { opacity: .88; font-size: 14px; }
.mb-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.missed-bookings .mb-go { background: #fff; color: #b91c1c; border: 0; border-radius: 12px; padding: 8px 14px; font-weight: 800; }
.missed-bookings .mb-go .ic { color: #b91c1c; }
.missed-bookings .mb-skip { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.55); border-radius: 12px; padding: 8px 12px; }
html[data-theme="dark"] .missed-bookings { background: #b91c1c; }
.mb-note { padding: 10px 12px; border-radius: 12px; background: #fef2f2; border: 1px solid #fecaca; margin-bottom: 12px; font-size: 14px; }
.mb-note .ic { color: #dc2626; }
html[data-theme="dark"] .mb-note { background: rgba(239, 68, 68, .12); border-color: rgba(239, 68, 68, .35); }

/* Clients page map (ClientsMap.jsx) */
.cmx-wrap { margin-top: 14px; }
.cm-map.cmx-map { height: 380px; margin: 0; }
.cmx-note { margin: 6px 2px 0; }
.cm-tip .cmx-open { display: inline-block; margin-top: 4px; font-weight: 700; color: #2563eb; }
@media (max-width: 640px) { .cm-map.cmx-map { height: 300px; } }

/* Analytics: Top customers card */
.tc-list { display: grid; gap: 6px; }
.tc-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; padding: 8px 10px; border-radius: 12px; border: 1px solid #e2e8f0; background: transparent; width: 100%; }
.tc-row:hover { background: #eff6ff; }
.tc-rank { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 999px; background: #eff6ff; color: #2563eb; font-weight: 800; font-size: 12px; }
.tc-name { display: grid; gap: 2px; min-width: 0; }
.tc-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-bar { display: block; height: 5px; border-radius: 99px; background: #e2e8f0; overflow: hidden; }
.tc-bar span { display: block; height: 100%; background: #2563eb; border-radius: 99px; }
.tc-amt { white-space: nowrap; }
html[data-theme="dark"] .tc-row { border-color: #1f2a3b; }
html[data-theme="dark"] .tc-row:hover { background: #172036; }
html[data-theme="dark"] .tc-rank { background: rgba(59,130,246,.15); color: #93c5fd; }
html[data-theme="dark"] .tc-bar { background: #1f2a3b; }
html[data-theme="dark"] .tc-bar span { background: #4062e6; }

/* Team member page: Work time & overtime (owner only, WorkTimeCard.jsx) */
.wt-card h2 .ic { margin-right: .4em; }
.wt-hours { margin-top: 12px; padding: 12px; border-radius: 14px; background: #f8fafc; display: grid; gap: 10px; }
.wt-days { display: flex; gap: 6px; flex-wrap: wrap; }
.wt-times { display: flex; gap: 18px; flex-wrap: wrap; }
.wt-times label { display: grid; gap: 4px; }
.wt-week { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; }
.wt-week button { padding: 4px 12px; }
.wt-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.wt-totals > div { display: grid; gap: 2px; padding: 10px 12px; border-radius: 14px; background: #f8fafc; }
.wt-totals span { font-size: 12px; color: #64748b; font-weight: 700; }
.wt-totals b { font-size: 20px; }
.wt-totals .bad b { color: #dc2626; }
.wt-table tr.wt-off td { color: #94a3b8; }
html[data-theme="dark"] .wt-hours, html[data-theme="dark"] .wt-totals > div { background: #0b1220; }

/* Settings → All companies (product owner only; ProductOwner.jsx) */
.po-totals { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.po-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.po-tools input { flex: 1 1 240px; min-width: 0; }
.po-list { display: grid; gap: 12px; }
.po-co { border: 1px solid #e2e8f0; border-radius: 14px; padding: 14px; display: grid; gap: 12px; }
.po-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.po-name { font-size: 17px; margin-right: 8px; }
.po-head .pill { margin-right: 8px; }
.po-owner { text-align: right; overflow-wrap: anywhere; }
.po-health { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.po-health.ok { background: #dcfce7; color: #15803d; }
.po-health.warn { background: #fef3c7; color: #b45309; }
.po-health.bad { background: #fee2e2; color: #b91c1c; }
.po-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.po-stats > div { display: grid; gap: 1px; padding: 8px 10px; border-radius: 10px; background: #f8fafc; }
.po-stats span { font-size: 12px; color: #64748b; font-weight: 700; }
.po-stats b { font-size: 16px; }
.po-stats em { font-style: normal; font-size: 12px; color: #64748b; }
.po-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.po-chips > * { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: #f1f5f9; color: #94a3b8; text-decoration: none; }
.po-chips .on { background: #eff6ff; color: #1d4ed8; }
.po-chips .po-flag { background: #fee2e2; color: #b91c1c; }
@media (max-width: 640px) { .po-owner { text-align: left; } }
html[data-theme="dark"] .po-co { border-color: #1e293b; }
html[data-theme="dark"] .po-stats > div { background: #0b1220; }
html[data-theme="dark"] .po-chips > * { background: #0b1220; color: #64748b; }
html[data-theme="dark"] .po-chips .on { background: rgba(59, 130, 246, .14); color: #93c5fd; }
html[data-theme="dark"] .po-chips .po-flag { background: rgba(239, 68, 68, .15); color: #fca5a5; }
html[data-theme="dark"] .po-health.ok { background: rgba(34, 197, 94, .15); color: #86efac; }
html[data-theme="dark"] .po-health.warn { background: rgba(245, 158, 11, .15); color: #fcd34d; }
html[data-theme="dark"] .po-health.bad { background: rgba(239, 68, 68, .15); color: #fca5a5; }

/* Material cost (private; owner 2026-11-16): a small "Your cost" box under the Tax switch on material lines */
.li.li-mat { grid-template-areas: "name qty price total x" "desc desc desc tax ." "desc desc desc cost ."; }
.li-cost { grid-area: cost; align-self: start; display: grid; gap: 2px; justify-items: end; }
.li-cost > span { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; color: #64748b; }
.li-cost .li-money { display: flex; align-items: center; gap: 2px; padding: 2px 8px; border: 1px dashed #cbd5e1; border-radius: 8px; background: #f8fafc; color: #475569; }
.li-cost input { width: 64px; border: 0; background: none; padding: 2px 0; font-size: 14px; text-align: right; }
.li-cost input:focus { outline: none; }
.li-cost .li-money:focus-within { border-style: solid; border-color: #2563eb; }
.job-private { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 10px 0 0; padding: 8px 10px; border-radius: 10px; background: #f8fafc; border: 1px dashed #cbd5e1; font-size: 13px; color: #475569; }
@media (max-width: 640px) { .li.li-mat { grid-template-areas: "name name name x" "qty price total total" "desc desc desc desc" ". . tax tax" ". . cost cost"; } }
html[data-theme="dark"] .li-cost .li-money, html[data-theme="dark"] .job-private { background: #0b1220; border-color: #2b3a52; color: #cbd5e1; }
.mix-profit { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 8px 0 0; padding: 10px 12px; border-radius: 12px; background: #f0fdf4; border: 1px solid #bbf7d0; color: #14532d; }
.mix-profit > b { color: #15803d; font-size: 17px; }
html[data-theme="dark"] .mix-profit { background: rgba(34, 197, 94, .1); border-color: rgba(34, 197, 94, .3); color: #bbf7d0; }
html[data-theme="dark"] .mix-profit > b { color: #86efac; }

/* Review requests (owner, 2026-11-16): settings preview, job page answer, Analytics card */
.rv-preview { margin: 4px 0 12px; padding: 10px 12px; border-radius: 12px; background: #f8fafc; border: 1px dashed #cbd5e1; }
.rv-preview p { margin: 4px 0 0; white-space: pre-wrap; }
.fb-face { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.fb-face .ic { color: inherit; }
.fb-happy .fb-face, .fb-face.fb-happy { background: #dcfce7; color: #15803d; }
.fb-face.fb-neutral { background: #fef3c7; color: #b45309; }
.fb-face.fb-sad { background: #fee2e2; color: #b91c1c; }
.fb-answer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; }
.fb-answer p { flex-basis: 100%; margin: 0; }
.fb-comment { display: block; margin: 4px 0 0; padding: 8px 10px; border-left: 3px solid #cbd5e1; background: #f8fafc; border-radius: 0 8px 8px 0; font-style: italic; color: #334155; white-space: pre-wrap; text-align: left; }
.fb-totals { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); margin-top: 12px; }
.fb-totals span { display: inline-flex; align-items: center; gap: 4px; }
.fb-totals .fb-happy b { color: #15803d; } .fb-totals .fb-neutral b { color: #b45309; } .fb-totals .fb-sad b { color: #b91c1c; }
.fb-totals .fb-happy .ic { color: #15803d; } .fb-totals .fb-neutral .ic { color: #b45309; } .fb-totals .fb-sad .ic { color: #b91c1c; }
.fb-list { display: grid; gap: 6px; margin: 4px 0 8px; }
.card .fb-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; width: 100%; text-align: left; padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 12px; background: none; }
.card .fb-row:hover { border-color: #93c5fd; background: #f8fbff; }
.fb-row .fb-comment { flex-basis: 100%; }
html[data-theme="dark"] .rv-preview, html[data-theme="dark"] .fb-comment { background: #0b1220; border-color: #2b3a52; color: #cbd5e1; }
html[data-theme="dark"] .card .fb-row { border-color: #1e293b; }
html[data-theme="dark"] .card .fb-row:hover { background: #0f1a2e; border-color: #2b3a52; }
html[data-theme="dark"] .fb-face.fb-happy { background: rgba(34, 197, 94, .15); color: #86efac; }
html[data-theme="dark"] .fb-face.fb-neutral { background: rgba(245, 158, 11, .15); color: #fcd34d; }
html[data-theme="dark"] .fb-face.fb-sad { background: rgba(239, 68, 68, .15); color: #fca5a5; }

/* Estimates (owner, 2026-11-16) */
.est-pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #f1f5f9; color: #475569; }
.est-pill.est-sent { background: #eff6ff; color: #1d4ed8; } .est-pill.est-ok { background: #dcfce7; color: #15803d; } .est-pill.est-job { background: #e0e7ff; color: #3730a3; }
.est-pill.est-no { background: #fee2e2; color: #b91c1c; } .est-pill.est-exp { background: #fef3c7; color: #b45309; }
.client-row.est-row { grid-template-columns: 120px minmax(0, 2fr) minmax(0, 1.4fr) 110px; }
.est-banner { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; padding: 8px 12px; border-radius: 12px; background: #f0fdf4; color: #14532d; }
.card.est-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.est-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.est-title h1 { margin: 0; font-size: 22px; }
.est-actions { align-items: center; flex-wrap: wrap; }
.est-total { font-size: 20px; font-weight: 800; padding: 0 6px; }
.est-approved, .est-declined { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; padding: 10px 14px; border-radius: 14px; }
.est-approved { background: #dcfce7; color: #14532d; } .est-declined { background: #f1f5f9; color: #334155; }
.est-activity { margin: 6px 0 10px; padding-left: 18px; font-size: 14px; } .est-activity li { margin: 3px 0; }
.txt-ok { color: #15803d; }
.est-read p { display: flex; justify-content: space-between; gap: 10px; margin: 6px 0; padding-bottom: 6px; border-bottom: 1px solid #f1f5f9; }
.est-note { background: #f0fdf4; }
.est-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: #f1f5f9; margin: 8px 0 6px; }
.est-bar .ok, .est-legend .ok { background: #16a34a; } .est-bar .wait, .est-legend .wait { background: #93c5fd; } .est-bar .no, .est-legend .no { background: #f87171; }
.est-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: #475569; }
.est-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
@media (max-width: 700px) { .client-row.est-row { grid-template-columns: 1fr auto; } .client-row.est-row > span:nth-child(3) { display: none; } }
html[data-theme="dark"] .est-pill { background: #1e293b; color: #cbd5e1; }
html[data-theme="dark"] .est-pill.est-sent { background: rgba(59, 130, 246, .15); color: #93c5fd; } html[data-theme="dark"] .est-pill.est-ok { background: rgba(34, 197, 94, .15); color: #86efac; }
html[data-theme="dark"] .est-pill.est-no { background: rgba(239, 68, 68, .15); color: #fca5a5; } html[data-theme="dark"] .est-pill.est-exp { background: rgba(245, 158, 11, .15); color: #fcd34d; }
html[data-theme="dark"] .est-pill.est-job { background: rgba(99, 102, 241, .18); color: #c7d2fe; }
html[data-theme="dark"] .est-banner, html[data-theme="dark"] .est-approved, html[data-theme="dark"] .est-note { background: rgba(34, 197, 94, .1); color: #bbf7d0; }
html[data-theme="dark"] .est-declined, html[data-theme="dark"] .est-bar { background: #0b1220; color: #cbd5e1; }
html[data-theme="dark"] .est-read p { border-color: #1e293b; } html[data-theme="dark"] .est-legend { color: #94a3b8; }

/* Private material cost (one amount per job / estimate, in Private notes; owner 2026-11-16) */
.private-cost { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #cbd5e1; }
.private-cost label { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.private-cost label > span:first-child { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; color: #475569; }
.private-cost .li-money { display: inline-flex; align-items: center; gap: 2px; padding: 4px 10px; border: 1px solid #cbd5e1; border-radius: 10px; background: #f8fafc; }
.private-cost input { width: 96px; border: 0; background: none; font-size: 15px; text-align: right; padding: 2px 0; }
.private-cost input:focus { outline: none; }
.private-cost .li-money:focus-within { border-color: #2563eb; }
.private-cost p { margin: 6px 0 0; }
html[data-theme="dark"] .private-cost { border-color: #2b3a52; }
html[data-theme="dark"] .private-cost .li-money { background: #0b1220; border-color: #2b3a52; }
html[data-theme="dark"] .private-cost label > span:first-child { color: #cbd5e1; }

.rv-via { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin: 4px 0 8px; }
.rv-via .check { margin: 0; }

/* New estimate window: wider, with its own "New customer" button (owner 2026-11-16: "small and hard to find add customer") */
.modal-card.est-new { width: min(640px, calc(100vw - 32px)); max-width: 640px; min-height: 440px; }
.est-new .picker input { font-size: 17px; padding: 14px; }
.est-new-or { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: #94a3b8; font-size: 13px; }
.est-new-or::before, .est-new-or::after { content: ""; flex: 1; border-top: 1px solid #e2e8f0; }
.est-new-client { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 13px; font-size: 16px; font-weight: 700; border: 2px dashed #93c5fd; border-radius: 14px; background: #eff6ff; color: #1d4ed8; }
.est-new-client:hover { background: #dbeafe; }
html[data-theme="dark"] .est-new-client { background: rgba(59, 130, 246, .12); border-color: #2b4a7a; color: #93c5fd; }
html[data-theme="dark"] .est-new-or::before, html[data-theme="dark"] .est-new-or::after { border-color: #1e293b; }

.est-sig { display: block; margin-top: 6px; max-width: 240px; width: 100%; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; }
html[data-theme="dark"] .est-sig { filter: invert(1) hue-rotate(180deg); border-color: #2b3a52; }

/* Do Not Service (owner, 2026-11-16) */
.dns-tag { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 2px 9px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; vertical-align: middle; white-space: nowrap; }
.dns-tag.small { font-size: 10px; padding: 1px 7px; }
.dns-tag .ic { color: #fff; }
.dns-banner { display: flex; align-items: center; gap: 12px; margin: 12px 0 0; padding: 12px 14px; border-radius: 14px; background: #fef2f2; border: 2px solid #dc2626; color: #7f1d1d; }
.dns-banner .ic { color: #dc2626; flex: none; }
.dns-banner > div { flex: 1; } .dns-banner b { text-transform: uppercase; color: #b91c1c; }
.card .dns-open { margin-top: 10px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 5px 10px; color: #b91c1c; border: 1px dashed #fca5a5; background: none; }
.dns-form { margin-top: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid #fecaca; background: #fff7f7; }
.dns-note { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; background: #fef2f2; color: #7f1d1d; border: 1px solid #fecaca; }
html[data-theme="dark"] .dns-banner, html[data-theme="dark"] .dns-form, html[data-theme="dark"] .dns-note { background: rgba(239, 68, 68, .1); color: #fecaca; border-color: rgba(239, 68, 68, .5); }
html[data-theme="dark"] .dns-banner b { color: #fca5a5; }

/* Customer page: "Mark as Do Not Service" sits next to the name (owner 2026-11-16); the red banner / the form wrap under it */
.client-title { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; }
.client-title h1 { margin: 0; }
.client-title .dns-banner, .client-title .dns-form { flex-basis: 100%; }
.card .client-title .dns-open { margin-top: 0; }

/* Analytics: Estimates + a compact Customer feedback stacked next to Top customers (owner, 2026-11-16) */
.an-stack { display: grid; gap: 18px; grid-template-rows: 1fr 1fr; align-content: stretch; } /* two equal halves, as tall as Top customers */
.an-stack > .card { margin: 0; }
.fb-compact .wt-totals.fb-totals { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 8px 0 6px; }
.fb-compact .wt-totals > div { padding: 6px 8px; border-radius: 10px; }
.fb-compact .wt-totals span { font-size: 11px; }
.fb-compact .wt-totals b { font-size: 16px; }
.fb-compact .fb-list { gap: 4px; margin: 2px 0 4px; }
.card.fb-compact .fb-row { padding: 5px 8px; }
.fb-compact .fb-comment { margin-top: 2px; padding: 4px 8px; font-size: 13px; }
.fb-compact .fb-private { margin: 4px 0 0; }
@media (max-width: 560px) { .fb-compact .wt-totals.fb-totals { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Company spendings (private list on the job / estimate, owner 2026-11-16) */
.spend { margin-top: 10px; padding-top: 8px; border-top: 1px dashed #cbd5e1; }
.card .spend-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 2px; border: 0; background: none; text-align: left; font-size: 14px; }
.spend-head > span:nth-child(2) { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: #334155; flex: 1; }
.spend-arrow { display: inline-block; transition: transform .15s; color: #2563eb; font-size: 13px; }
.spend-arrow.open { transform: rotate(90deg); }
.spend-body { display: grid; gap: 8px; margin: 6px 0 0; }
.spend-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 30px; gap: 8px; align-items: center; }
.spend-row input[list] { padding: 9px 10px; border: 1px solid #cbd5e1; border-radius: 10px; font-size: 14px; min-width: 0; }
.spend-row .li-money { display: flex; align-items: center; gap: 2px; padding: 4px 8px; border: 1px solid #cbd5e1; border-radius: 10px; background: #f8fafc; }
.spend-row .li-money input { width: 100%; border: 0; background: none; text-align: right; font-size: 14px; padding: 4px 0; }
.spend-row .li-money input:focus { outline: none; }
.spend-body .add-line { justify-self: start; }
.spend-profit { margin: 6px 0 0; }
html[data-theme="dark"] .spend { border-color: #2b3a52; }
html[data-theme="dark"] .spend-head > span:nth-child(2) { color: #cbd5e1; }
html[data-theme="dark"] .spend-row input[list], html[data-theme="dark"] .spend-row .li-money { background: #0b1220; border-color: #2b3a52; color: #e5e7eb; }
.spend-row { grid-template-columns: minmax(0, 1fr) 96px 26px; gap: 6px; }
.spend-row .li-remove { grid-area: auto; width: 26px; height: 26px; }
.spend-row .li-money { padding: 4px 6px; }

/* Month view: earlier jobs drawn above a multi-day bar that starts that day (flow-root: its height includes the cards' margins) */
.ms-before { display: flow-root; }

/* Messages: Customers | Team tabs + the team chat (owner, 2026-11-17) */
.messages aside .msg-tabs { display: flex; margin: 0 0 8px; }
.messages aside .msg-tabs button { flex: 1; margin: 0; border: 0; border-radius: 12px; padding: 8px; text-align: center; background: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; }
.messages aside .msg-tabs button.on { background: white; color: inherit; box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.tc-name { display: flex; align-items: center; gap: 8px; }
.tc-name .badge { flex: none; font-size: 10px; }
.tc-group { display: inline-flex; width: 22px; height: 22px; border-radius: 11px; align-items: center; justify-content: center; background: #eff6ff; }
.tc-count { margin-left: auto; min-width: 20px; height: 20px; border-radius: 10px; background: #dc2626; color: #fff; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
.tc-sub { display: flex; align-items: center; gap: 5px; margin: 14px 4px 4px; font-size: 12px; font-weight: 700; color: #64748b; }
.tc-from { display: block; font-size: 12px; margin-bottom: 2px; }
html[data-theme="dark"] .messages aside .msg-tabs button.on { background: #1e293b; }
html[data-theme="dark"] .tc-group { background: rgba(59, 130, 246, .15); }

/* Team chat groups (owner, 2026-11-17) */
.messages aside button.tc-new { text-align: center; width: 100%; margin: 0 0 8px; border: 1px dashed #93c5fd; background: #eff6ff; color: #2563eb; font-weight: 700; border-radius: 10px; padding: 8px; cursor: pointer; }
.messages aside button.tc-new:hover { background: #dbeafe; }
.tc-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.message-head .tc-actions button { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; padding: 6px 10px; }
.message-head .tc-actions .tc-del, .message-head .tc-actions .tc-del .ic { color: #dc2626; }
.tc-modal { width: min(460px, calc(100vw - 32px)); }
.tc-people { display: grid; gap: 6px; max-height: 340px; overflow-y: auto; padding: 2px; margin-bottom: 12px; }
.tc-person { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 10px; cursor: pointer; }
.tc-person.on { border-color: #93c5fd; background: #eff6ff; }
.tc-person input { width: 16px; height: 16px; margin: 0; flex: none; }
.tc-person .badge { flex: none; font-size: 10px; }
.tc-person span { display: grid; min-width: 0; }
.tc-person small { font-size: 12px; }
html[data-theme="dark"] .messages aside button.tc-new { background: rgba(59, 130, 246, .12); border-color: #1e40af; color: #93c5fd; }
html[data-theme="dark"] .tc-person { border-color: #1f2a3b; }
html[data-theme="dark"] .tc-person.on { border-color: #1e40af; background: rgba(59, 130, 246, .12); }

/* Messages tab: blue = team chats, red = customers (owner, 2026-11-17) */
.tab-count, .pm-count { position: relative; }
.tab-count:not(.team), .pm-count:not(.team) { z-index: 1; } /* red in front */
.tab-count + .tab-count.team { margin-left: -6px; } /* blue tucked behind the red one (owner, 2026-11-17) */
.tab-count.team, .pm-count.team { background: #2563eb; }
.pm-count + .pm-count.team { margin-left: -6px; }
html[data-theme="dark"] .tab-count.team, html[data-theme="dark"] .pm-count.team { background: #3b82f6; }

/* A job that has STARTED (owner, 2026-11-20: "brighter with a border of the technician color"): a light fill of the technician's
   colour, a solid border in it and dark text, on every calendar view. --tc = the technician's colour. */
.appt.blue { --tc: #2563eb; } .appt.green { --tc: #059669; } .appt.slate { --tc: #0f172a; } .appt.gray { --tc: #4b5563; }
.appt.black { --tc: #000; } .appt.sky { --tc: #0ea5e9; } .appt.cyan { --tc: #06b6d4; } .appt.teal { --tc: #0d9488; }
.appt.lime { --tc: #84cc16; } .appt.yellow { --tc: #eab308; } .appt.amber { --tc: #f59e0b; } .appt.orange { --tc: #f97316; }
.appt.red { --tc: #dc2626; } .appt.rose { --tc: #f43f5e; } .appt.pink { --tc: #ec4899; } .appt:is(.purple, .violet) { --tc: #7c3aed; }
.appt.indigo { --tc: #4f46e5; } .appt.unassigned { --tc: #94a3b8; }
.appt.started, .card .appt.started { background: color-mix(in srgb, var(--tc, #2563eb) 16%, #ffffff) !important; color: #0f172a !important; box-shadow: inset 0 0 0 2px var(--tc, #2563eb); }
html[data-theme="dark"] .appt.started, html[data-theme="dark"] .card .appt.started { background: color-mix(in srgb, var(--tc, #2563eb) 30%, #111a2e) !important; color: #e5e7eb !important; }

/* Month view: compact job cards so 5 fit in a day before "+N more" (owner, 2026-11-21) */
.calendar .day .appt:not(.ms-bar) { margin: 3px 0; padding: 3px 7px; border-radius: 8px; font-size: 12px; line-height: 1.25; }
.calendar .day .appt:not(.ms-bar) small { font-size: 11px; }
.calendar .day .more { margin-top: 2px; }

/* Month view: EVERY day box the same size, however many jobs it has (owner, 2026-11-21). 226px = 4 compact jobs + "+N more" (MONTH_SHOW in Calendar.jsx);
   a day that needs more room ("+N more" opened, several multi-day bars) scrolls inside its box instead of growing the week. */
.calendar .week-row .day { height: 186px; min-height: 0; overflow: hidden; } /* never a scroll box: the mouse wheel always scrolls the page */
.calendar .week-row .day.open { height: auto; min-height: 186px; } /* "+N more" opened: the day grows */

/* ---- Vuzelok HQ, the Control Center (web/hq/main.jsx, server/hq.js) ---- */
.hq-body { background: #f1f5f9; }
.hq { max-width: 1400px; margin: auto; padding: 16px; }
.hq-center { text-align: center; margin-top: 30vh; }
.hq-brand { display: flex; align-items: center; gap: 10px; }
.hq-brand img { width: 36px; height: 36px; border-radius: 10px; background: #2563eb; padding: 4px; }
.hq-brand b { display: block; font-size: 17px; line-height: 1.1; }
.hq-brand span { font-size: 12px; color: #64748b; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.hq-top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: #0f172a; color: #f8fafc; border-radius: 20px; padding: 10px 14px; position: sticky; top: 8px; z-index: 20; }
.hq-top .hq-brand span { color: #93c5fd; }
.hq-nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.hq-nav a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; color: #cbd5e1; text-decoration: none; font-weight: 600; font-size: 14px; }
.hq-nav a .ic { color: inherit; }
.hq-nav a:hover { background: #1e293b; color: #fff; }
.hq-nav a.on { background: #2563eb; color: #fff; }
.hq-me { display: flex; align-items: center; gap: 10px; }
.hq-me .muted { color: #94a3b8; }
.hq-me button { display: inline-flex; align-items: center; gap: 6px; background: #1e293b; color: #e2e8f0; border: 1px solid #334155; border-radius: 12px; padding: 7px 11px; }
.hq-me button .ic { color: inherit; }
.hq-main { display: grid; gap: 14px; margin-top: 14px; }
.hq-status { display: flex; align-items: flex-start; gap: 12px; border-radius: 18px; padding: 14px 18px; border: 1px solid; }
.hq-status.ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.hq-status.bad { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.hq-status .ic { color: inherit; flex: none; margin-top: 1px; }
.hq-status b { font-size: 16px; }
.hq-status ul { margin: 6px 0 0; padding-left: 18px; }
.hq-status > div { flex: 1; }
.hq-upd { white-space: nowrap; }
.linklike { background: none !important; border: 0 !important; padding: 0 !important; color: #2563eb !important; text-decoration: underline; cursor: pointer; }
.hq-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.hq-grid.three { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.card.hq-tile { padding: 16px 18px; border-radius: 20px; }
.card.hq-tile.bad { border-color: #fca5a5; box-shadow: 0 0 0 2px #fee2e2; }
.hq-tile h3 { display: flex; align-items: center; gap: 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: #475569; margin: 0 0 10px; }
.hq-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
.hq-row:last-of-type { border-bottom: 0; }
.hq-row span { color: #475569; }
.hq-big { font-size: 30px; font-weight: 800; margin: 2px 0 8px; }
.hq-bar { height: 8px; border-radius: 6px; background: #e2e8f0; overflow: hidden; margin: 4px 0 8px; }
.hq-bar i { display: block; height: 100%; background: #2563eb; border-radius: 6px; }
.hq-err { margin: 6px 0 0; border-left: 3px solid #fca5a5; padding-left: 8px; }
.hq-costs input, .hq-costs select { width: 100%; min-width: 90px; padding: 8px 10px !important; border-radius: 10px !important; }
.hq-costs .hq-amt { max-width: 110px; }
.hq-gate { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 20% 10%, #dbeafe, transparent 50%), #f1f5f9; }
.card.hq-gate-card { width: min(420px, 100%); display: grid; gap: 10px; }
.card.hq-gate-card.wide { width: min(560px, 100%); }
.hq-gate-card h2 { margin: 10px 0 0; }
.hq-steps { padding-left: 20px; display: grid; gap: 10px; margin: 0; }
.hq-qr { width: 200px; height: 200px; margin: 10px 0 6px; background: #fff; border-radius: 12px; padding: 6px; border: 1px solid #e2e8f0; }
.hq-qr svg { width: 100%; height: 100%; display: block; }
.hq-key { font-size: 13px; letter-spacing: .05em; word-break: break-all; }
@media screen and (max-width: 640px) {
  .hq { padding: 8px; }
  .hq-top { top: 0; border-radius: 16px; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "brand me" "nav nav"; gap: 8px; padding: 8px 10px; }
  .hq-top .hq-brand { grid-area: brand; }
  .hq-me { grid-area: me; }
  .hq-me .muted { display: none; }
  .hq-nav { grid-area: nav; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .hq-nav a { padding: 6px 9px; font-size: 13px; white-space: nowrap; }
  .hq-status { flex-wrap: wrap; padding: 12px 14px; }
  .hq-upd { width: 100%; }
}
@media screen {
  html[data-theme="dark"] .hq-body { background: #0b1220; }
  html[data-theme="dark"] .hq-top { background: #020617; border: 1px solid #1e293b; }
  html[data-theme="dark"] .hq-status.ok { background: #052e22; border-color: #065f46; color: #6ee7b7; }
  html[data-theme="dark"] .hq-status.bad { background: #3b0d0d; border-color: #7f1d1d; color: #fca5a5; }
  html[data-theme="dark"] .hq-tile h3, html[data-theme="dark"] .hq-row span { color: #94a3b8; }
  html[data-theme="dark"] .hq-row { border-color: #1e293b; }
  html[data-theme="dark"] .hq-bar { background: #1e293b; }
  html[data-theme="dark"] .hq-bar i { background: #3b82f6; }
  html[data-theme="dark"] .card.hq-tile.bad { border-color: #7f1d1d; box-shadow: 0 0 0 2px #3b0d0d; }
  html[data-theme="dark"] .hq-gate { background: radial-gradient(circle at 20% 10%, #172554, transparent 50%), #0b1220; }
  html[data-theme="dark"] .linklike { color: #93c5fd !important; }
}

/* "Open the conversation" in the Schedule-this-booking box (modals.jsx) */
.mb-open { display: inline-flex; align-items: center; gap: 5px; margin-left: 6px; font-weight: 700; color: #2563eb; text-decoration: none; white-space: nowrap; }
.mb-open:hover { text-decoration: underline; }
@media screen { html[data-theme="dark"] .mb-open { color: #93c5fd; } }

/* Month view: each job on ONE line — time, name (cut with …), job # (Calendar.jsx lineContent; owner 2026-11-29) */
.calendar .day .appt.al { display: flex !important; align-items: baseline; gap: 5px; width: 100%; white-space: nowrap; overflow: hidden; text-align: left; padding: 3px 7px; margin: 3px 0; line-height: 1.3; font-size: 12px; }
.calendar .day .appt.al .al-time { flex: none; font-weight: 800; }
.calendar .day .appt.al .al-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.calendar .day .appt.al .al-no { flex: none; font-size: 11px; opacity: .7; font-weight: 600; }

/* "View as" (components/ViewAs.jsx): a round top-bar button like the bell; while viewing it takes the role's colour */
.viewas-btn.on, .viewas-btn.on:hover { color: #fff !important; }
.viewas-btn.on .ic { color: #fff; }
.viewas-menu { right: 0; left: auto; min-width: 230px; max-height: 70vh; overflow: auto; padding: 6px; }
.viewas-title { margin: 4px 8px 6px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; }
.viewas-menu > button { display: flex !important; align-items: center; gap: 8px; }
.viewas-menu > button .muted { margin-left: auto; }
.viewas-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.viewas-group { display: flex; align-items: center; gap: 8px; margin: 8px 8px 2px; font-size: 12px; font-weight: 800; color: #334155; }
.viewas-menu .viewas-person { padding-left: 26px !important; border-left: 3px solid transparent !important; }
.viewas-menu .viewas-person.on, .viewas-menu > button.on { background: #eff6ff; font-weight: 700; }
.viewas-menu .viewas-person.on { border-left-color: var(--rc) !important; }
.viewas-note { margin: 8px; font-size: 12px; color: #92400e; }
@media screen {
  html[data-theme="dark"] .viewas-group { color: #cbd5e1; }
  html[data-theme="dark"] .viewas-menu .viewas-person.on, html[data-theme="dark"] .viewas-menu > button.on { background: #172033; }
  html[data-theme="dark"] .viewas-note { color: #fcd34d; }
}

/* Pop-up windows: a slim rounded scrollbar with no arrow buttons that starts and ends inside the rounded corners (owner, 2026-11-29: the right
   side "seems off, square"). Edge/Chrome draw it from these rules; Firefox gets its own thin bar. */
.modal-card::-webkit-scrollbar { width: 12px; }
.modal-card::-webkit-scrollbar-track { background: transparent; margin: 24px 0; }
.modal-card::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
.modal-card::-webkit-scrollbar-thumb:hover { background-color: #94a3b8; }
.modal-card::-webkit-scrollbar-button { display: none; height: 0; }
@supports (-moz-appearance: none) { .modal-card { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; } }
@media screen {
  html[data-theme="dark"] .modal-card::-webkit-scrollbar-thumb { background-color: #334155; }
  html[data-theme="dark"] .modal-card::-webkit-scrollbar-thumb:hover { background-color: #475569; }
}

/* Follow-up needed (amber) — same bar as "Booked, but not in the calendar" (MissedBookings.jsx) */
.missed-bookings.follow-ups { background: #d97706; box-shadow: 0 8px 24px rgba(217, 119, 6, .32); }
.missed-bookings.follow-ups .mb-go { color: #92400e; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.missed-bookings.follow-ups .mb-go .ic { color: #92400e; }
.missed-bookings .mb-go { text-decoration: none; }
@media screen { html[data-theme="dark"] .missed-bookings.follow-ups { background: #b45309; } }

/* Messages → Dismissed alerts (MissedBookings.jsx DismissedAlerts) */
.da-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid #e2e8f0; }
.da-kind { flex: none; font-size: 11px; font-weight: 800; border-radius: 999px; padding: 3px 8px; color: #fff; }
.da-kind.b { background: #dc2626; } .da-kind.f { background: #d97706; }
.da-text { flex: 1; min-width: 0; }
.da-row button { display: inline-flex; align-items: center; gap: 6px; flex: none; }
@media screen { html[data-theme="dark"] .da-row { border-color: #1e293b; } }

/* Control Center → Invites (web/hq/main.jsx) and the code tag on company cards (ProductOwner.jsx) */
.hq-code { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid #e2e8f0; }
.hq-code-main { flex: 1 1 300px; min-width: 0; }
.hq-code-text { font-size: 15px; font-weight: 800; letter-spacing: .04em; background: #eff6ff; color: #1d4ed8; padding: 3px 8px; border-radius: 8px; }
.po-code { margin-left: 6px; font-size: 11px; font-weight: 800; color: #7c3aed; background: #f5f3ff; border: 1px solid #ddd6fe; border-radius: 999px; padding: 2px 8px; }
@media screen {
  html[data-theme="dark"] .hq-code { border-color: #1e293b; }
  html[data-theme="dark"] .hq-code-text { background: #172554; color: #93c5fd; }
  html[data-theme="dark"] .po-code { background: #2e1065; border-color: #4c1d95; color: #c4b5fd; }
}
