/* Route Planner Teams (2026-10-15). Uses the site tokens from global.css, so
   light and dark both follow the header's theme switch. */
.tm-app { max-width: 1240px; margin: 0 auto; padding: 16px; color: var(--text); }
.tm-app [hidden], .tm-dialog [hidden] { display: none !important; }
.tm-loading { padding: 48px 0; text-align: center; color: var(--text-muted); }

.tm-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 24px; box-shadow: var(--shadow); }
.tm-narrow { max-width: 560px; margin: 24px auto; }
.tm-card h1 { font-size: 1.5rem; margin: 0 0 8px; }
.tm-card p { margin: 0 0 12px; line-height: 1.5; }
.tm-muted { color: var(--text-muted); font-weight: normal; }
/* After Delete team (Dan, 13 Nov 2026): "Only one van?" note above the set-up form */
.tm-card p.tm-pro-offer { margin: 0 0 16px; padding: 10px 12px; border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: var(--radius-md); background: var(--hover-bg); line-height: 1.45; }
.tm-pro-offer a { font-weight: 600; white-space: nowrap; }
.tm-points { margin: 0 0 20px; padding-left: 20px; line-height: 1.6; }

.tm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card); color: var(--text);
  font: inherit; font-weight: 600; font-size: 0.92rem; cursor: pointer; text-decoration: none; white-space: nowrap; }
.tm-btn:hover { background: var(--hover-bg); }
.tm-btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.tm-btn-primary:hover { background: var(--primary); filter: brightness(1.08); }
.tm-btn-danger { color: var(--danger); }
.tm-btn-small { min-height: 32px; padding: 4px 10px; font-size: 0.85rem; }
.tm-btn:disabled { opacity: 0.55; cursor: default; }

.tm-form { display: flex; flex-direction: column; gap: 6px; }
.tm-form label { font-weight: 600; font-size: 0.9rem; margin-top: 8px; }
.tm-form input[type="text"], .tm-form input[type="email"], .tm-form input[type="tel"], .tm-form input[type="password"],
.tm-form input[type="time"], .tm-form select {
  width: 100%; box-sizing: border-box; min-height: 42px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-md); background: var(--bg); color: var(--text); font: inherit; font-size: 16px; }
.tm-form .tm-btn-primary { margin-top: 14px; }
.tm-check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.tm-hint { margin: 2px 0 0; font-size: 0.82rem; color: var(--text-muted); }
.tm-days { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.tm-form .tm-days label.tm-day { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; font-weight: 400; }
.tm-error { margin: 8px 0 0; padding: 8px 10px; border-radius: var(--radius-md); background: rgba(239, 68, 68, 0.1); color: var(--danger); font-size: 0.9rem; }
.tm-place { display: flex; gap: 8px; }
.tm-place input { flex: 1; }
.tm-place-result { margin: 2px 0 0; font-size: 0.85rem; color: var(--text-muted); min-height: 1.2em; }
.tm-place-result.is-ok { color: var(--success); }
.tm-place-result.is-bad { color: var(--danger); }
.tm-hours { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tm-hours label { display: block; }
.tm-colours { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.tm-colour { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; padding: 0; box-shadow: 0 0 0 1px var(--border); }
.tm-colour[aria-checked="true"] { border-color: var(--text); }

.tm-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 4px 0 12px; }
.tm-kicker { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.tm-title h1 { margin: 2px 0 0; font-size: 1.6rem; }
.tm-tabs { display: flex; gap: 4px; background: var(--bg-secondary); padding: 4px; border-radius: var(--radius-lg); }
.tm-tab { border: 0; background: transparent; color: var(--text-muted); font: inherit; font-weight: 600; padding: 8px 14px; border-radius: var(--radius-md); cursor: pointer; min-height: 40px; }
.tm-tab[aria-selected="true"] { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

.tm-seats { margin: 0 0 12px; }
.tm-seat-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 14px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--bg-secondary); font-size: 0.92rem; }
.tm-seat-banner.is-off { border-color: rgba(245, 158, 11, 0.5); background: rgba(245, 158, 11, 0.1); }
/* a failed payment (2026-10-17): red, with the last working day */
.tm-seat-banner.is-failed { border-color: rgba(220, 38, 38, 0.55); background: rgba(220, 38, 38, 0.1); }
.tm-seat-banner strong { font-weight: 700; }

.tm-split { display: grid; grid-template-columns: minmax(320px, 440px) 1fr; gap: 16px; align-items: start; }
.tm-list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tm-list-head h2 { margin: 0; font-size: 1.1rem; }
.tm-count { color: var(--text-muted); font-weight: 600; }
.tm-driver-list { display: flex; flex-direction: column; gap: 10px; }
.tm-driver { background: var(--card); border: 1px solid var(--border); border-left: 6px solid var(--driver-colour, #999);
  border-radius: var(--radius-lg); padding: 12px 14px; box-shadow: var(--shadow); }
.tm-driver-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
/* a long status ("their link works until 1 Nov 2026") drops under the name and wraps, instead of pushing the card past a
   phone's edge (2026-10-25: the Drivers tab scrolled sideways on a 390px phone) */
.tm-driver-top { flex-wrap: wrap; }
.tm-driver-top .tm-badge { white-space: normal; }
.tm-driver-name { font-weight: 700; font-size: 1rem; }
.tm-badge { font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg-secondary); color: var(--text-muted); white-space: nowrap; }
.tm-badge.is-active { background: rgba(16, 185, 129, 0.15); color: #047857; }
.tm-badge.is-invited { background: rgba(245, 158, 11, 0.15); color: #b45309; }
html[data-theme="dark"] .tm-badge.is-active { color: #6ee7b7; }
html[data-theme="dark"] .tm-badge.is-invited { color: #fcd34d; }
.tm-driver-meta { margin: 6px 0 0; font-size: 0.88rem; color: var(--text-muted); line-height: 1.5; }
.tm-driver-meta span { color: var(--text); }
.tm-driver-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tm-empty { padding: 20px; border: 1px dashed var(--border); border-radius: var(--radius-lg); color: var(--text-muted); }
.tm-empty p { margin: 0 0 6px; }

.tm-map-col { position: sticky; top: 12px; }
.tm-map { height: 560px; border-radius: var(--radius-lg); border: 1px solid var(--border); overflow: hidden; background: var(--bg-secondary); }
.tm-map-key { margin: 6px 0 0; font-size: 0.82rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.tm-key-start { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--text-muted); }
.tm-key-end { display: inline-block; width: 8px; height: 8px; border-radius: 50%; border: 3px solid var(--text-muted); background: var(--card); margin-left: 8px; }

.tm-dialog { border: 0; border-radius: var(--radius-xl); padding: 0; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  background: var(--card); color: var(--text); box-shadow: var(--shadow-lg); }
.tm-dialog::backdrop { background: rgba(15, 23, 42, 0.55); }
.tm-dialog form { padding: 20px; }
#tm-confirm-dialog, #tm-delete-dialog, #tm-importcheck-dialog { padding: 20px; }   /* built in JS without a <form> (walkthrough, 10 Nov 2026: text flush to the edge; Delete team and the import check, 11 Nov) */
.tm-dialog h2 { margin: 0 0 4px; font-size: 1.25rem; }
.tm-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.tm-dialog-actions .tm-btn-primary { margin-top: 0; }

.tm-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 2000; max-width: calc(100vw - 32px);
  padding: 10px 16px; border-radius: var(--radius-lg); background: #0f172a; color: #fff; box-shadow: var(--shadow-lg); font-size: 0.95rem; }

@media (max-width: 860px) {
  .tm-split { grid-template-columns: 1fr; }
  .tm-map-col { position: static; order: -1; }
  .tm-map { height: 300px; }
  .tm-header { align-items: stretch; }
  .tm-tabs { width: 100%; }
  .tm-tab { flex: 1; }
}

/* ---- Plan the day ---- */
.tm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tm-plan-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.tm-plan-date { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tm-plan-date label { font-weight: 600; }
.tm-plan-date input[type="date"] { min-height: 40px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg); color: var(--text); font: inherit; }
.tm-plan-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tm-plan-status { margin: 0 0 10px; font-size: 0.9rem; color: var(--text-muted); min-height: 1.3em; }
.tm-warn { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius-lg); border: 1px solid rgba(245, 158, 11, 0.5); background: rgba(245, 158, 11, 0.1); font-size: 0.92rem; }
.tm-warn ul { margin: 6px 0 0; padding-left: 20px; }
.tm-notsent { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius-lg); border: 1px solid #f59e0b; background: #fef3c7; color: #78350f; font-size: 0.95rem; }
.tm-notsent[hidden] { display: none; }
.tm-pastday { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius-lg); border: 1px solid #2563eb; background: #dbeafe; color: #1e3a8a; font-size: 0.95rem; font-weight: 600; }
.tm-pastday[hidden] { display: none; }
html[data-theme="dark"] .tm-pastday { background: rgba(37, 99, 235, 0.2); border-color: #60a5fa; color: #bfdbfe; }
.tm-window-note { margin: 0 0 10px; padding: 8px 12px; border-radius: var(--radius-lg); border: 1px solid #bfdbfe; background: #eff6ff; color: #1e3a8a; font-size: 0.92rem; }
.tm-window-note .tm-link-btn { margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
html[data-theme="dark"] .tm-window-note { background: rgba(59, 130, 246, 0.15); border-color: #3b82f6; color: #bfdbfe; }
html[data-theme="dark"] .tm-notsent { background: rgba(245, 158, 11, 0.18); border-color: #f59e0b; color: #fde68a; }
.tm-plan-drivers { display: flex; flex-direction: column; gap: 8px; }
.tm-driver-email { font-size: 0.85rem; margin: 2px 0 4px; overflow-wrap: anywhere; }
.tm-plan-driver { background: var(--card); border: 1px solid var(--border); border-left: 6px solid var(--driver-colour, #999); border-radius: var(--radius-lg); padding: 10px 12px; }
.tm-late { color: #b45309; font-weight: 600; }
html[data-theme="dark"] .tm-late { color: #fcd34d; }
.tm-link-btn { margin-top: 8px; }
.tm-settings { margin-top: 12px; font-size: 0.9rem; }
.tm-settings summary { cursor: pointer; font-weight: 600; color: var(--text-muted); }
.tm-settings label { display: block; margin: 8px 0 4px; }
.tm-settings input { width: 90px; min-height: 38px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg); color: var(--text); font: inherit; }
.tm-selbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 8px; border-radius: var(--radius-lg); background: var(--primary); color: #fff; }
.tm-selbar select { min-height: 32px; border-radius: var(--radius-sm); border: 0; padding: 4px 8px; font: inherit; }
.tm-selbar .tm-btn { border-color: rgba(255, 255, 255, 0.6); }
.tm-selbar .tm-btn-primary { background: #fff; color: var(--primary); }
.tm-jobs-wrap { margin-top: 18px; }
.tm-copy-recent { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 12px; }
.tm-copy-pick { justify-content: flex-start; text-align: left; }
.tm-copy-pick.is-picked { border-color: var(--primary); background: rgba(37, 99, 235, 0.08); }
.tm-jobs-wrap h2 { font-size: 1.1rem; margin: 0 0 8px; }
.tm-table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.tm-jobs { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tm-jobs th, .tm-jobs td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tm-jobs th { background: var(--bg-secondary); font-weight: 700; position: sticky; top: 0; }
/* T15 (Dan, 6 Nov): a long status ("No driver can reach it inside its time window.") pushed the table sideways, worst in
   dark mode on a laptop: the status wraps instead */
.tm-jobs td.tm-job-status { white-space: normal; min-width: 12em; max-width: 26em; overflow-wrap: anywhere; }
.tm-jobs td.tm-job-status .tm-btn { white-space: normal; text-align: left; }
.tm-jobs tr.is-selected td { background: rgba(37, 99, 235, 0.08); }
.tm-jobs tr.is-header td { font-weight: 700; color: var(--text-muted); }
.tm-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
/* T18: the column choices were cut to "Nam", "Ad", "Ea" in a narrow sheet: each keeps room for its longest word */
/* The import check shows every column without a sideways scroll on a computer (Dan, 11 Nov 2026: 7 columns in the
   860px dialog hid the last one at 1300px): the import dialog grows to 1180px, cells wrap instead of stretching, and the
   column pickers are narrower. The scroll stays only as a fallback for a very wide sheet or a small screen. */
#tm-import-dialog { width: min(1180px, calc(100vw - 32px)); }
.tm-map-table th, .tm-map-table td { padding: 6px 8px; }
.tm-map-table td { white-space: normal; overflow-wrap: anywhere; max-width: 16em; }
.tm-map-table select { min-width: 7em; min-height: 32px; font: inherit; font-size: 0.85rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); }
.tm-job-icon { background: none; border: 0; }
.tm-job-pin { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; box-sizing: border-box;
  border: 2px solid #fff; color: #fff; font-size: 11px; font-weight: 700; font-family: var(--font-sans); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45); cursor: pointer; }
.tm-job-pin.is-unassigned { border-style: dashed; border-color: #374151; color: #111827; }
.tm-job-pin.is-selected { outline: 3px solid #111827; outline-offset: 1px; transform: scale(1.15); }
html[data-theme="dark"] .tm-job-pin.is-selected { outline-color: #fff; }
.tm-job-pin.is-done { opacity: 0.55; }
.tm-dialog-wide { width: min(860px, calc(100vw - 32px)); }
.tm-dialog textarea { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg); color: var(--text); font-family: var(--font-mono); font-size: 14px; }
.tm-dialog input[type="file"] { font: inherit; }
@media (max-width: 860px) {
  .tm-plan-actions { width: 100%; }
  .tm-plan-actions .tm-btn { flex: 1; }
}
.tm-proof-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin: 8px 0 12px; }
.tm-proof-photos figure { margin: 0; }
/* T5: the doorstep signature; white behind it so dark ink on a transparent PNG stays readable in dark mode */
.tm-proof-signature { margin: 8px 0 12px; max-width: 320px; }
.tm-proof-signature img { display: block; width: 100%; height: auto; background: #fff; border-radius: var(--radius-md); border: 1px solid var(--border); }
.tm-proof-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg-secondary); }
.tm-my-route { display: inline-block; margin-top: 4px; font-weight: 600; color: var(--primary); text-decoration: none; }
.tm-start h2 { font-size: 1.1rem; margin: 18px 0 8px; }
.tm-steps { margin: 0 0 18px; padding-left: 22px; line-height: 1.6; }
.tm-steps li { margin-bottom: 6px; }
.tm-btn-wide { width: 100%; box-sizing: border-box; min-height: 46px; font-size: 1rem; white-space: normal; text-align: center; line-height: 1.3; }   /* wraps on a narrow phone (Dan, 12 Nov: cut off at 360px) */
.tm-small { font-size: 0.82rem; }
.tm-seat-banner a { color: var(--primary); font-weight: 600; }
.tm-guide { margin: 0 0 14px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); }
.tm-guide summary { cursor: pointer; font-weight: 700; }
.tm-guide .tm-steps { margin: 10px 0 6px; }
.tm-link { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--primary); cursor: pointer; text-decoration: underline; }
.tm-driver-actions { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.tm-driver-actions .tm-link-btn { margin-top: 8px; }
.tm-row-edit { margin-left: 6px; border: 0; background: transparent; cursor: pointer; font-size: 0.95rem; color: var(--text-muted); padding: 0 4px; }
.tm-row-edit:hover, .tm-row-edit:focus { color: var(--primary, #2563eb); }

/* Phone tap targets (bug hunt 2026-10-16, fam6-6): the row checkbox and the edit pencil were 13 px and 21 px. */
@media (pointer: coarse) {
  #tm-jobs-table tbody input[type="checkbox"] { width: 22px; height: 22px; margin: 4px; }
  .tm-row-edit { min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
}

.tm-example th, .tm-example td { font-size: 0.8rem; padding: 5px 8px; }
.tm-example th { position: static; }

/* Add jobs: a column nothing is read from reads "Not used" / "Choose…" in grey, never "Ignored" (Dan, 2026-10-16). */
.tm-col-unused { color: var(--text-muted, #6b7280) !important; font-weight: 400 !important; font-style: italic; }

/* Disabled main actions read as disabled: grey, not solid blue (Dan, 2026-10-16). The title says why. */
.tm-btn-primary:disabled, .tm-btn-primary[disabled] { background: var(--bg-secondary, #e5e7eb); border-color: var(--border, #d1d5db);
  color: var(--text-muted, #6b7280); filter: none; opacity: 1; cursor: not-allowed; }
/* Plan the day with no drivers: the next step, as a panel with its button. */
.tm-empty-panel { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px; border: 1px dashed var(--border, #d1d5db); border-radius: 10px; }
.tm-empty-panel p { margin: 0; }
/* After the first driver: add the rest? */
.tm-more-drivers { margin: 0 0 12px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--primary, #2563eb);
  background: var(--bg-secondary, #eff6ff); }
.tm-more-drivers p { margin: 0 0 8px; }
.tm-more-drivers-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Send to drivers when some haven't signed in yet (a dialog built in plan.js, so it has no form padding). */
#tm-notyet-dialog { padding: 20px; }
#tm-notyet-dialog p { margin: 8px 0 16px; }
.tm-dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.tm-badge-small { font-size: 0.72rem; padding: 1px 6px; }

/* in-page confirm (2026-10-17): a destructive OK is red */
.tm-btn-primary.tm-confirm-danger { background: var(--danger); border-color: var(--danger); color: #fff; }

/* import check (2026-10-17): postcodes not found, jobs with no street address */
.tm-importcheck-warn { color: var(--danger); font-weight: 600; }
.tm-importcheck-row { display: grid; grid-template-columns: 1fr 9em auto; gap: 8px; align-items: center; margin: 6px 0; }
.tm-importcheck-row input { min-width: 0; text-transform: uppercase; }
.tm-importcheck-state { font-size: 0.85rem; color: var(--danger); }
.tm-importcheck-row.is-ok .tm-importcheck-state { color: var(--success, #16a34a); }
.tm-import-bare-note { margin: 4px 0 0; font-size: 0.9rem; color: var(--muted, #64748b); }

/* long waits: one-click choices on a driver's card (3b, 2026-10-17) */
.tm-wait-choices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tm-wait-choices .tm-btn { white-space: normal; text-align: left; }
.tm-rounds { margin-top: 4px; padding: 6px 8px; border-radius: 8px; background: var(--surface-2, #f1f5f9); font-size: 0.9rem; }
.tm-wait-link { background: none; border-color: transparent; text-decoration: underline; color: var(--primary); }

/* Settings tab (customer messages step 1a, 2026-10-21) */
.tm-settings-page { display: grid; gap: 16px; max-width: 760px; margin: 0 auto; }
.tm-set-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 20px; }
.tm-set-card h2 { font-size: 1.2rem; margin: 0 0 8px; }
.tm-set-card > p { margin: 0 0 10px; line-height: 1.5; }
/* T21 Billing card: Delete team is a small danger-zone subheading under the billing part, not a heading bigger than the card's own (Dan, 9 Nov) */
.tm-set-card .tm-bill-delete-title { font-size: 1rem; font-weight: 600; color: var(--danger); margin: 24px 0 6px; padding-top: 16px; border-top: 1px solid var(--border); }
.tm-set-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tm-set-head h2 { margin: 0; }
.tm-soon-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: rgba(245, 158, 11, 0.15); color: #92400e; }
html[data-theme="dark"] .tm-soon-pill { color: #fcd34d; }
.tm-set-card .tm-link { margin: 0; padding: 0; border: 0; background: none; color: var(--primary); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.tm-cm-switch { margin: 12px 0 2px; opacity: 0.7; }
.tm-cm-form { margin-top: 14px; }
.tm-cm-form .tm-place .tm-btn { flex: none; }
.tm-set-card textarea { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg); color: var(--text); font: inherit; font-size: 16px; }
.tm-cm-logo-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tm-cm-logo-row input[type="file"] { max-width: 100%; font: inherit; font-size: 0.9rem; }
.tm-cm-logo-img { max-width: 160px; max-height: 64px; object-fit: contain; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 4px; }
.tm-cm-sub { font-size: 1rem; margin: 20px 0 4px; }
.tm-cm-subject { margin: 8px 0 6px; font-size: 0.9rem; }
.tm-cm-subject strong { font-weight: 600; }
.tm-cm-preview { display: block; width: 100%; height: 620px; border: 1px solid var(--border); border-radius: var(--radius-md); background: #fff; }
.tm-cm-test { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.tm-soon-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tm-soon-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg); }
.tm-soon-card h3 { font-size: 0.98rem; margin: 0; }
.tm-soon-card p { margin: 0; font-size: 0.88rem; line-height: 1.45; color: var(--text-muted); flex: 1; }
.tm-soon-card .tm-btn[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
@media (max-width: 640px) {
  .tm-set-card { padding: 16px; }
  .tm-cm-preview { height: 560px; }
}
.tm-cm-switch:has(input:not(:disabled)) { opacity: 1; }
.tm-soon-pill.is-on { background: rgba(16, 185, 129, 0.15); color: #065f46; }
html[data-theme="dark"] .tm-soon-pill.is-on { color: #6ee7b7; }
.tm-soon-pill.is-paused { background: rgba(239, 68, 68, 0.15); color: #991b1b; }
html[data-theme="dark"] .tm-soon-pill.is-paused { color: #fca5a5; }
.tm-cm-paused { margin: 10px 0; padding: 10px 12px; border-radius: var(--radius-md); background: rgba(239, 68, 68, 0.1); color: var(--danger); font-size: 0.9rem; }
.tm-cm-stats { margin-top: 8px; }
.tm-cm-capped { margin: 8px 0 0; padding: 10px 12px; border-radius: var(--radius-md); background: rgba(245, 158, 11, 0.12); color: var(--text); font-size: 0.9rem; }
.tm-proof-email { margin-top: 10px; font-size: 0.9rem; }
/* A sent day changed since (Dan, 2026-10-22): blue, with Send right there; Send stays highlighted until sent */
.tm-changed { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius-lg); border: 1px solid #3b82f6; background: #eff6ff; color: #1e3a8a; font-size: 0.95rem; }
.tm-changed[hidden] { display: none; }
html[data-theme="dark"] .tm-changed { background: rgba(59, 130, 246, 0.16); color: #bfdbfe; }
.tm-btn.tm-btn-attn { box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.45); }
/* Customer email hints (Dan, 2026-10-22) */
.tm-cm-hint { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--bg-secondary, #f4f7fb); font-size: 0.95rem; }
.tm-cm-hint[hidden], .tm-cm-missing[hidden] { display: none; }
.tm-cm-hint a { font-weight: 600; }
.tm-cm-hint-x { margin-left: auto; border: 0; background: none; color: var(--text-muted); font-size: 1.1rem; cursor: pointer; padding: 0 4px; }
.tm-cm-missing { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; }
.tm-cm-missing .tm-cm-hint-x { margin-left: 0; }

/* T3 (2026-11-06): unassigned jobs far from every driver, left out of the map's view and named here */
.tm-map-far-note { margin: 0 0 8px; padding: 8px 12px; border-radius: var(--radius-md, 8px); background: rgba(148, 163, 184, 0.16); color: var(--text); font-size: 14px; }
.tm-map-far-note .tm-linkbtn { background: none; border: 0; padding: 0; color: var(--accent, #2563eb); text-decoration: underline; cursor: pointer; font: inherit; }

/* Collections and deliveries (pairs step 3, 2026-11-06): the Collect / Deliver tag on a paired job, and the import note
   for pairs that couldn't be matched and sheet coordinates that couldn't be used */
.tm-pair-tag { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.7; white-space: nowrap; }
.tm-pair-collection { background: rgba(16, 185, 129, 0.14); color: #047857; }
.tm-pair-delivery { background: rgba(59, 130, 246, 0.14); color: #1d4ed8; }
[data-theme="dark"] .tm-pair-collection { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
[data-theme="dark"] .tm-pair-delivery { background: rgba(59, 130, 246, 0.22); color: #93c5fd; }
.tm-import-note { margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: rgba(245, 158, 11, 0.12); font-size: 14px; }
.tm-import-note p { margin: 0 0 6px; }
.tm-import-note ul { margin: 0 0 6px; padding-left: 18px; }

/* Undo in the toast after Remove (K4) */
.tm-toast-btn { margin-left: 10px; padding: 4px 12px; border: 1px solid #fff; border-radius: var(--radius-md, 6px); background: transparent; color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.tm-toast-btn:hover, .tm-toast-btn:focus-visible { background: #fff; color: #0f172a; }

/* A what3words address in a job's notes (///word.word.word -> what3words.com; Dan, 11 Nov 2026), under the notes box
   in the job dialog. Same rule as route-planner.css, so the manager and the driver see the same link. */
.tm-w3w-row { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 10px; }
.rp-w3w { display: inline-flex; align-items: center; gap: 4px; margin: 2px 2px 2px 0; padding: 1px 9px 1px 6px;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.15)); border-radius: 999px; background: var(--card, #fff);
  color: var(--primary, #2563eb); font-size: 12px; font-weight: 600; line-height: 1.6; text-decoration: none;
  white-space: nowrap; vertical-align: middle; }
.rp-w3w:hover { background: var(--hover-bg, rgba(0, 0, 0, 0.05)); }
.rp-w3w svg { flex: none; }
html[data-theme="dark"] .rp-w3w { color: #93c5fd; }

/* an invite that didn't send or bounced (batch C item 7, 12 Nov 2026) */
.tm-badge.is-problem { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
[data-theme="dark"] .tm-badge.is-problem { background: rgba(185, 28, 28, 0.2); color: #fca5a5; border-color: rgba(252, 165, 165, 0.35); }
.tm-job-delete { margin-right: auto; }

/* L11 (Dan, 16 Nov 2026): "Check what each column is" with many columns (11 in a luggage-transfer sheet) squashed: headings
   wrapped, an address took five lines, later columns needed sideways scrolling. The dialog widens to 1200px for this step,
   each cell is one line (full text on hover), and the column choosers stay at the top while the rows scroll. */
.tm-dialog-wide.tm-import-columns-step { width: min(1200px, calc(100vw - 32px)); }
.tm-import-preview-scroll { max-height: min(52vh, 460px); overflow: auto; }
.tm-import-preview-scroll .tm-map-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; }
.tm-import-preview-scroll .tm-map-table td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 11em; overflow-wrap: normal; }
.tm-import-preview-scroll .tm-map-table thead th { position: sticky; top: 0; z-index: 2; background: var(--card, #fff); box-shadow: 0 1px 0 var(--border); }
.tm-import-preview-scroll .tm-map-table select { max-width: 10em; }   /* 5A: grouped options indent; 10em keeps 7 columns in view */

/* 5A import screen (Dan, 16 Nov 2026): folded unused columns, the found line, guessed marks, coordinate checks */
.tm-col-folded { display: none; }
.tm-import-unused-chip { display: inline-flex; align-items: center; min-height: 32px; margin: 6px 0; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--border, #cbd5e1); background: var(--card, #fff); color: var(--text, #0f172a); font: inherit; font-size: 0.9rem; cursor: pointer; }
.tm-import-unused-chip:hover { border-color: var(--text-muted, #64748b); }
.tm-import-found { margin: 4px 0 6px; }
.tm-import-found-line { margin: 2px 0; font-size: 0.92rem; color: var(--text, #0f172a); }
.tm-import-found-undo { margin: 0; padding: 0; border: 0; background: none; color: var(--link, #1d4ed8); font: inherit; font-size: 0.9rem; font-weight: 600; text-decoration: underline; cursor: pointer; }
.tm-col-guessed { display: block; margin-top: 2px; font-size: 0.72rem; font-weight: 400; color: var(--text-muted, #64748b); }
.tm-importcheck-coords { margin: 0 0 12px; }
.tm-importcheck-coord-row .tm-muted { font-size: 0.88rem; }

/* "Have a code?" beside Set up payment (Dan, 23 Nov 2026; codeSlot in team.js) */
/* the site's own input rules (larger, for forms) win over the class above: pin the box to the buttons' size */
  margin: 0 !important; padding: 4px 8px !important; font-size: 0.9rem !important; line-height: 1.2 !important; flex: 0 0 auto !important; }

/* "Set up payment" (Dan, 24 Nov 2026; team.js openTeamPaySheet): the drivers, a code field that is always there, and
   what is paid when, before Stripe's page. The same sheet as the app's "Choose your plan". */
.tm-pay-dialog { padding: 22px 20px 18px; width: min(460px, calc(100vw - 24px)); }
.tm-pay-dialog h2 { padding-right: 28px; }
.tm-pay-close { position: absolute; top: 8px; right: 10px; background: none; border: 0; font-size: 28px; line-height: 1; color: var(--text-muted); cursor: pointer; padding: 4px 8px; }
.tm-pay-lead { margin: 0 0 12px; color: var(--text-muted); font-size: 0.95rem; line-height: 1.45; }
.tm-pay-drivers { font-weight: 700; font-size: 1.05rem; margin: 0 0 14px; padding: 12px 14px; border: 2px solid var(--primary); border-radius: 12px; }
.tm-pay-code { margin: 0 0 14px; padding: 0 !important; }
.tm-pay-code-label { display: block; font-weight: 600; font-size: 0.9rem; margin: 0 0 6px; }
.tm-pay-code-row { display: flex; gap: 8px; }
.tm-pay-dialog .tm-pay-code-row input { flex: 1 1 auto; min-width: 0; width: auto !important; max-width: none !important; height: 44px !important; min-height: 44px !important; margin: 0 !important;
  padding: 0 12px !important; font-size: 16px !important; text-transform: uppercase; letter-spacing: 0.04em; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text); }
.tm-pay-apply { flex: 0 0 auto; height: 44px; padding: 0 16px; font: inherit; font-weight: 600; border-radius: 10px; cursor: pointer; border: 1px solid var(--primary); background: transparent; color: var(--primary); }
.tm-pay-code-on { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(22, 163, 74, 0.10); border: 1px solid rgba(22, 163, 74, 0.45); }
.tm-pay-code-text { font-weight: 600; }
.tm-pay-remove { background: none; border: 0; padding: 4px 2px; font: inherit; color: var(--primary); text-decoration: underline; cursor: pointer; }
.tm-pay-error { margin: 6px 0 0; font-size: 0.88rem; color: #b91c1c; }
html[data-theme="dark"] .tm-pay-error { color: #fca5a5; }
.tm-pay-summary { border-top: 1px solid var(--border); padding-top: 10px; margin: 0 0 6px; }
.tm-pay-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 0; font-size: 0.98rem; }
.tm-pay-row.is-today { font-weight: 700; }
.tm-pay-was { margin-right: 6px; color: var(--text-muted); font-weight: 400; }
.tm-pay-amount { white-space: nowrap; }
.tm-pay-vat { margin: 0 0 14px; font-size: 0.84rem; color: var(--text-muted); }
.tm-pay-continue { display: block; width: 100%; min-height: 50px; font-size: 1.05rem; font-weight: 700; border-radius: 12px; }
.tm-pay-small { margin: 10px 0 0; font-size: 0.8rem; color: var(--text-muted); text-align: center; line-height: 1.45; }
.tm-pay-dialog.is-loading .tm-pay-summary { opacity: 0.5; }
@media (max-width: 600px) {
  .tm-pay-dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 94vh; }
}
.tm-pay-dialog [hidden] { display: none !important; }
#tm-pay-dialog { padding: 22px 20px 18px; }
@media (max-width: 600px) { #tm-pay-dialog { padding: 20px 16px calc(16px + env(safe-area-inset-bottom, 0px)); } }
