/* Tradexo — clean-room field-service SPA */
* { box-sizing: border-box; margin: 0; padding: 0; }
/* Theme "Navy + blue" (2026-11-05): blue is for actions only, green only for success,
   so a "Create invoice" button never looks like a "Paid" badge. Light only. */
:root {
  --sidebar-bg: #182638;
  --sidebar-fg: #c3cede;
  --sidebar-line: #26374d;
  --sidebar-hover: #22344b;
  --nav-on: #eaf0ff;           /* the active menu item: a pale blue pill with navy text */
  --accent: #245ddb;           /* primary buttons, active tabs, links */
  --accent-dark: #1c4bb5;      /* hover / pressed */
  --accent-soft: #eaf0ff;      /* selected rows and items */
  --accent-ring: rgba(36, 93, 219, .28);
  --success: #18734a;
  --success-soft: #e6f4ec;
  --danger: #ba3342;           /* errors and overdue */
  --danger-soft: #fcebed;
  --warn: #935c00;             /* warning text */
  --warn-mid: #d99a24;         /* warning bars and dots */
  --warn-soft: #fff3db;
  --info: #245ddb;
  --info-soft: #e8effc;
  --bg: #f4f6fa;
  --card: #ffffff;
  --border: #dce2eb;
  --border-strong: #c9d2de;    /* secondary button outlines */
  --line-soft: #edf0f5;        /* row separators */
  --hover: #f5f8fc;
  --fg: #202d3d;
  --label: #3e4b5c;
  --muted: #59677a;
  --focus: #245ddb;
  font-size: 14px;
}
body { font-family: "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--fg); }
.hidden { display: none !important; }
/* a clear focus ring for keyboard users on every control */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible, summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 0; border-color: var(--accent); }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
.linklike { background: none; border: none; color: var(--sidebar-fg); text-decoration: underline; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 210px; background: var(--sidebar-bg); color: var(--sidebar-fg); display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 20; }
.org-switcher { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--sidebar-line); cursor: pointer; }
.org-avatar { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.org-name { font-weight: 600; color: #fff; font-size: 14px; }
/* Business logo: on a white tile, so a JPG's white background doesn't show as a block. */
.org-avatar { flex: none; font-size: 13px; overflow: hidden; }
.org-avatar.has-logo { background: #fff; padding: 3px; }
.org-avatar img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.org-switcher.logo-wide .org-avatar { flex: 1; width: auto; height: 40px; border-radius: 7px; padding: 4px 8px; }
.org-switcher.logo-wide .org-name { display: none; }
.nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav a { display: flex; align-items: center; gap: 10px; margin: 1px 8px; padding: 8px 8px; border-radius: 6px; color: var(--sidebar-fg); font-size: 13.5px; text-decoration: none; position: relative; }
.nav a:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.nav a.active { background: var(--nav-on); color: var(--sidebar-bg); font-weight: 600; }
.nav a:focus-visible, .nav-group-btn:focus-visible { outline-color: #8fb0ff; }
.nav-ico { width: 18px; text-align: center; }
.nav-quickadd { margin-left: auto; background: var(--sidebar-line); color: #fff; border: none; border-radius: 4px; width: 20px; height: 20px; line-height: 1; }
.nav-quickadd:hover { background: var(--accent); }
.nav a.active .nav-quickadd { background: #d3defb; color: var(--sidebar-bg); }
.nav-group-btn { width: calc(100% - 16px); margin: 1px 8px; border-radius: 6px; text-align: left; background: none; border: none; color: var(--sidebar-fg); padding: 8px 8px; font-size: 13.5px; display: flex; gap: 10px; align-items: center; }
.nav-group-btn:hover { background: var(--sidebar-hover); color: #fff; }
.nav-group .chev { margin-left: auto; font-size: 10px; transition: transform .15s; }
.nav-group.open .chev { transform: rotate(180deg); }
.nav-sub { display: none; }
.nav-group.open .nav-sub { display: block; }
.nav-sub a { padding-left: 36px; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--sidebar-line); font-size: 12px; }

.content-wrap { flex: 1; margin-left: 210px; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { height: 52px; background: var(--card); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 24px; position: sticky; top: 0; z-index: 10; }
.breadcrumb { font-weight: 600; font-size: 15px; }
.breadcrumb .crumb-sep { color: var(--muted); margin: 0 6px; }
.breadcrumb a { color: var(--muted); }
.topbar-right { margin-left: auto; color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--info); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.main { flex: 1; padding: 20px 24px 80px; }

.fab { position: fixed; right: 28px; bottom: 28px; width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 26px; border: none; box-shadow: 0 4px 12px rgba(0,0,0,.25); z-index: 15; }
.fab:hover { background: var(--accent-dark); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #182638, #23395a); }
.login-card { background: #fff; border-radius: 10px; padding: 36px; width: 380px; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.login-card h1 { font-size: 22px; margin-bottom: 4px; color: var(--sidebar-bg); }
.login-card .sub { color: var(--muted); margin-bottom: 22px; font-size: 13px; }
.login-card label { display: block; font-size: 12.5px; font-weight: 600; margin: 12px 0 4px; }
.login-card input { width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 6px; font: inherit; }
.login-card .btn { width: 100%; margin-top: 20px; }
.login-err { color: var(--danger); font-size: 12.5px; margin-top: 10px; min-height: 16px; }
.mfa-hint { background: var(--info-soft); border: 1px solid #c9d8f7; color: #1f4fae; border-radius: 6px; padding: 10px; font-size: 12.5px; margin-top: 14px; }

/* ---------- Buttons / badges / tabs ---------- */
/* One strong (blue) button per section; everything else is .secondary. */
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; border: none; border-radius: 6px; padding: 8px 14px; font-weight: 600; font-size: 13px; }
.btn:hover { background: var(--accent-dark); }
.btn.secondary { background: #fff; color: var(--fg); border: 1px solid var(--border-strong); }
.btn.secondary:hover { background: var(--hover); border-color: #b4c0d0; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #9c2a37; }
.btn:disabled { cursor: not-allowed; opacity: .55; }
.btn:disabled:hover { filter: none; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn-split { display: inline-flex; }
.btn-split .btn:first-child { border-radius: 6px 0 0 6px; }
.btn-split .btn:last-child { border-radius: 0 6px 6px 0; border-left: 1px solid rgba(255,255,255,.35); padding: 8px 8px; }

/* status badges: pale tone, dark text (tones are picked in js/ui.js) */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11.5px; font-weight: 700; white-space: nowrap; background: #eef1f5; color: #4a5768; }
.badge.clickable { cursor: pointer; }
.badge.clickable:hover { filter: brightness(.96); }
.badge-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: #8a96a6; }
.badge.tone-grey   { background: #eef1f5; color: #4a5768; } .badge-dot.tone-grey   { background: #8a96a6; }
.badge.tone-purple { background: #f0ebfc; color: #5b3fb0; } .badge-dot.tone-purple { background: #7c5fd6; }
.badge.tone-blue   { background: #e8effc; color: #1f4fae; } .badge-dot.tone-blue   { background: #3d72e0; }
.badge.tone-amber  { background: #fff3db; color: #935c00; } .badge-dot.tone-amber  { background: #d99a24; }
.badge.tone-brown  { background: #fbede3; color: #8f4a17; } .badge-dot.tone-brown  { background: #b8672c; }
.badge.tone-pink   { background: #fceaf2; color: #9a2d5e; } .badge-dot.tone-pink   { background: #cf5c8e; }
.badge.tone-green  { background: #e6f4ec; color: #18734a; } .badge-dot.tone-green  { background: #239060; }
.badge.tone-red    { background: #fcebed; color: #ba3342; } .badge-dot.tone-red    { background: #d24453; }
/* an overdue amount stands out; ordinary amounts stay plain */
.amt-overdue { color: var(--danger); font-weight: 800; }

.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { background: none; border: none; padding: 9px 16px; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; font-weight: 600; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs button:hover { color: var(--fg); }
.tab-count { background: #e3e9f2; border-radius: 10px; padding: 1px 7px; font-size: 11px; margin-left: 5px; color: var(--fg); }
.tabs button.active .tab-count { background: var(--accent-soft); color: var(--accent-dark); }

/* ---------- Page header / toolbar ---------- */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 19px; }
.page-head .spacer { flex: 1; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input[type=search], .toolbar input[type=text] { padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; width: 220px; font: inherit; }
.toolbar select { padding: 8px; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: #fff; }

/* ---------- Tables ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; background: var(--card); }
table.data th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 10px 12px; border-bottom: 2px solid var(--border); white-space: nowrap; cursor: pointer; user-select: none; }
table.data th.nosort { cursor: default; }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); font-size: 13px; vertical-align: middle; }
table.data tbody tr:hover { background: var(--hover); }
table.data tbody tr.rowlink { cursor: pointer; }
table.data .num { text-align: right; }
.empty-state { padding: 48px; text-align: center; color: var(--muted); }
.empty-state .big { font-size: 17px; margin-bottom: 6px; color: var(--fg); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px 20px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 600; color: var(--label); }
.field label .req { color: var(--danger); }
.field input, .field select, .field textarea { padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 6px; font: inherit; background: #fff; }
.field textarea { min-height: 70px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid var(--accent-ring); outline-offset: 0; border-color: var(--accent); }
.field .hint { font-size: 11px; color: var(--muted); }
.field.invalid input, .field.invalid select { border-color: var(--danger); }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.toggle input { display: none; }
.toggle .track { width: 36px; height: 20px; background: #c3ccd8; border-radius: 10px; position: relative; transition: background .15s; flex: none; }
.toggle .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: left .15s; }
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track::after { left: 18px; }

/* rich-text-ish */
.rte { border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.rte-toolbar { display: flex; gap: 2px; padding: 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.rte-toolbar button { background: none; border: none; border-radius: 4px; padding: 4px 8px; font-size: 12px; color: var(--label); }
.rte-toolbar button:hover { background: #eef1f5; }
.rte-body { min-height: 80px; padding: 10px; outline: none; font-size: 13px; }

/* ---------- Detail layout ---------- */
.detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.detail-head h2 { font-size: 20px; }
.detail-head .sub { color: var(--muted); }
.section { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 18px; margin-bottom: 16px; }
/* "How it works": one card per tour */
.tour-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; align-items: stretch; }
.tour-cards .section { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.tour-cards .section h3 { margin: 0; font-size: 16px; text-transform: none; letter-spacing: 0; color: var(--fg); }
.tour-cards p { margin: 0; color: var(--muted); font-size: 13px; }
.tour-cards .tour-act { margin-top: auto; padding-top: 8px; }
.tour-k { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.section h3 { font-size: 14px; margin-bottom: 14px; text-transform: uppercase; letter-spacing: .5px; color: var(--label); }
.section h3 .sect-action { float: right; }
.section h3 .sect-action + .sect-action { margin-right: 6px; }
.sticky-footer { position: fixed; left: 210px; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--border); padding: 10px 24px; display: flex; gap: 10px; align-items: center; z-index: 12; box-shadow: 0 -2px 8px rgba(0,0,0,.05); }
.sticky-footer .spacer { flex: 1; }

/* ---------- Dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
@media (max-width: 1100px){ .dash-grid { grid-template-columns: 1fr; } }
.onboard-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.onboard-item:last-child { border-bottom: none; }
.onboard-check { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; flex: none; border: 2px solid var(--border-strong); color: transparent; }
.onboard-item.done .onboard-check { background: var(--success); border-color: var(--success); color: #fff; }
.onboard-item.done span { color: var(--muted); text-decoration: line-through; }
.progress-ring { font-weight: 700; color: var(--accent); }
.today-job { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; align-items: center; cursor: pointer; }
.today-job:hover { background: var(--hover); }

/* ---------- Scheduler ---------- */
.sched-grid { display: grid; background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; position: relative; }
.sched-col-head { padding: 8px; text-align: center; font-size: 12px; font-weight: 700; border-bottom: 1px solid var(--border); border-left: 1px solid var(--line-soft); background: #fafbfd; }
.sched-col-head.today { color: var(--accent); }
.sched-time { font-size: 10.5px; color: var(--muted); text-align: right; padding: 2px 6px 0 0; border-top: 1px solid var(--line-soft); }
.sched-cell { border-left: 1px solid var(--line-soft); border-top: 1px solid var(--line-soft); position: relative; cursor: pointer; }
.sched-cell:hover { background: #f3f6fd; }
.appt { position: absolute; left: 3px; right: 3px; background: #e5edfc; color: var(--fg); border-left: 3px solid var(--accent); border-radius: 4px; padding: 4px 6px; font-size: 11px; overflow: hidden; cursor: pointer; z-index: 2; }
.appt:hover { box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.appt .t { font-weight: 700; }
.appt.unassigned { background: #fdf0d9; border-left-color: var(--warn-mid); }
.appt .appt-warn { margin-top: 2px; font-size: 10.5px; font-weight: 700; color: var(--warn); }
.sched-cell.off { background: #e9edf2; }
.sched-cell.closed { background: #f6f7f9; }
.sched-offlbl, .sched-addoff { display: block; margin: 2px auto 0; padding: 1px 6px; border: 0; border-radius: 4px; background: none;
  font: inherit; font-size: 10.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.sched-offlbl { text-decoration: underline dotted; text-underline-offset: 2px; }
.sched-offlbl.working { font-weight: 500; font-style: italic; }
.holiday-list td:first-child { white-space: nowrap; }
.sched-offlbl:hover, .sched-offlbl:focus-visible, .sched-addoff:hover, .sched-addoff:focus-visible { background: var(--accent-soft); color: var(--accent); }
.appt-dayoff { color: var(--warn); font-weight: 600; }

/* ---------- Timesheets grid ---------- */
.ts-grid table.data td { vertical-align: top; min-width: 120px; }
.ts-entry { background: var(--info-soft); border-left: 3px solid var(--info); border-radius: 4px; padding: 4px 6px; font-size: 11.5px; margin-bottom: 4px; cursor: pointer; }
.ts-total { font-weight: 700; font-size: 11px; color: var(--muted); }

/* ---------- Line items ---------- */
table.lines { width: 100%; border-collapse: collapse; }
table.lines th { font-size: 11px; text-transform: uppercase; color: var(--muted); text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
table.lines td { padding: 4px 6px; }
table.lines input, table.lines select { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; font: inherit; font-size: 12.5px; }
table.lines .num input { text-align: right; }
table.lines .rm { background: none; border: none; color: var(--danger); font-size: 15px; }
.totals { margin-left: auto; width: 300px; font-size: 13px; }
.totals .row { display: flex; justify-content: space-between; padding: 5px 0; }
.totals .row.grand { font-weight: 700; font-size: 15px; border-top: 2px solid var(--border); margin-top: 4px; padding-top: 8px; }
.totals .row.due { color: var(--danger); font-weight: 700; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(16,26,40,.5); display: flex; align-items: flex-start; justify-content: center; padding: 60px 20px; z-index: 100; overflow-y: auto; }
.modal { background: #fff; border-radius: 10px; width: 560px; max-width: 100%; box-shadow: 0 12px 48px rgba(0,0,0,.3); }
.modal.wide { width: 760px; }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-close { margin-left: auto; background: none; border: none; font-size: 20px; color: var(--muted); }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--fg); color: #fff; padding: 10px 18px; border-radius: 6px; font-size: 13px; box-shadow: 0 4px 16px rgba(0,0,0,.3); animation: toast-in .2s ease; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warn { background: var(--warn); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: none; } }

/* ---------- Settings ---------- */
.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.settings-nav { background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; position: sticky; top: 70px; max-height: calc(100vh - 140px); overflow-y: auto; }
.settings-nav a { display: block; padding: 9px 14px; font-size: 13px; color: var(--fg); border-bottom: 1px solid var(--line-soft); }
.settings-nav a:hover { background: var(--hover); text-decoration: none; }
.settings-nav a.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; box-shadow: inset 3px 0 0 var(--accent); }

/* ---------- Xero integration ---------- */
.integration-card { padding: 0; overflow: hidden; }
.integration-hero { display: flex; align-items: center; gap: 16px; padding: 20px; background: linear-gradient(135deg, #f4fbfe, #fff); border-bottom: 1px solid var(--border); }
.xero-mark { width: 58px; height: 58px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; background: #13b5ea; color: #fff; font-size: 17px; font-weight: 700; letter-spacing: -.8px; box-shadow: 0 5px 14px rgba(19,181,234,.24); }
.integration-title { min-width: 0; }
.integration-title h3 { margin: 1px 0 4px; color: var(--fg); font-size: 20px; letter-spacing: 0; text-transform: none; }
.integration-title p { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.integration-eyebrow { color: #647586; font-size: 10.5px; font-weight: 800; letter-spacing: .7px; text-transform: uppercase; }
.connection-pill { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; flex: none; border: 1px solid var(--border); border-radius: 999px; padding: 6px 10px; background: #fff; color: #62707e; font-size: 11.5px; font-weight: 700; }
.connection-pill > span { width: 8px; height: 8px; border-radius: 50%; background: #9aa6b2; }
.connection-pill.is-connected { color: var(--success); border-color: #bfe0cc; background: #eef8f2; }
.connection-pill.is-connected > span { background: var(--success); box-shadow: 0 0 0 3px rgba(24,115,74,.14); }
.connection-pill.is-reconnect { color: var(--warn); border-color: #f0d7a6; background: #fff8eb; }
.connection-pill.is-reconnect > span { background: var(--warn-mid); }
.connection-pill.is-error { color: #9d3431; border-color: #efc2c0; background: #fff3f2; }
.connection-pill.is-error > span { background: var(--danger); }
.connection-pill.is-connecting > span { background: var(--info); }
.integration-alert { display: grid; grid-template-columns: 140px 1fr; gap: 10px; margin: 16px 20px 0; padding: 10px 12px; border: 1px solid #cfe3f8; border-radius: 7px; background: #f1f7fe; color: #315f8e; font-size: 12px; line-height: 1.45; }
.integration-alert.error { border-color: #efc2c0; background: #fff3f2; color: #8f3633; }
.integration-alert.warning { border-color: #efd7a9; background: #fff8eb; color: #7c5b1c; }
.integration-alert.demo { border-color: #c7dfe9; background: #f3fafc; color: #3d6576; }
.integration-loading, .integration-empty { padding: 42px 24px; text-align: center; color: var(--muted); }
.integration-loading { display: flex; justify-content: center; align-items: center; gap: 10px; }
.integration-empty h4 { margin-bottom: 6px; color: var(--fg); font-size: 16px; }
.integration-empty p { max-width: 570px; margin: 0 auto 16px; line-height: 1.5; }
.spinner { width: 18px; height: 18px; border: 2px solid #cdd7e0; border-top-color: var(--info); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.integration-setup-grid { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(280px,.9fr); gap: 34px; padding: 28px 24px; align-items: center; }
.integration-setup-grid h4 { margin: 4px 0 8px; font-size: 18px; }
.integration-setup-grid p { color: var(--muted); line-height: 1.55; margin-bottom: 16px; }
.xero-connect-btn { background: #13a9db; }
.xero-connect-btn:hover { background: #0c92c0; }
.integration-steps { list-style: none; }
.integration-steps li { display: flex; gap: 11px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid #edf0f4; }
.integration-steps li:last-child { border-bottom: none; }
.integration-steps li > span { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%; background: #e9f7fc; color: #087fa9; font-size: 11px; font-weight: 800; }
.integration-steps b, .integration-steps small { display: block; }
.integration-steps b { margin: 1px 0 2px; font-size: 12.5px; }
.integration-steps small { color: var(--muted); line-height: 1.35; }
.integration-direction { display: flex; align-items: center; gap: 9px; margin: 0 24px 22px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 7px; background: #fafbfc; font-size: 12px; }
.integration-direction > b { margin-right: auto; }
.integration-direction > span { padding: 4px 8px; border-radius: 4px; background: #fff; border: 1px solid var(--border); font-weight: 700; }
.integration-direction > strong { color: var(--accent); font-size: 17px; }
.integration-direction > small { margin-left: 8px; color: var(--muted); }
.connection-overview { display: grid; grid-template-columns: repeat(3, minmax(150px,1fr)); gap: 0; }
.connection-overview > div:not(.connection-actions) { padding: 16px 20px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.connection-overview span, .connection-overview b { display: block; }
.connection-overview span { margin-bottom: 4px; color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .35px; text-transform: uppercase; }
.connection-overview b { overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11.5px !important; }
.connection-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; background: #fafbfc; }
.section-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 5px; }
.section-heading h3 { margin: 1px 0 0; }
.section-copy { margin: 0 0 15px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.integration-toggle-grid { display: grid; grid-template-columns: repeat(2,minmax(220px,1fr)); gap: 2px 20px; }
.integration-toggle-grid > .field { display: block; padding: 10px 0; border-bottom: 1px solid #edf0f4; }
.integration-toggle-grid > .field > label:first-child { display: none; }
.settings-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; padding-right: 58px; }

/* Settings > Company: business logo */
.logo-setting { max-width: 560px; margin-bottom: 18px; }
.logo-head { margin-bottom: 6px; color: var(--label); font-size: 13px; }
.logo-setting .hint { font-size: 11px; color: var(--muted); }
.logo-setting > .hint { margin: 8px 0 0; }
.logo-drop { border: 2px dashed var(--border-strong); border-radius: 10px; padding: 18px; text-align: center; background: var(--hover); }
.logo-drop p { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.logo-drop .hint { margin: 10px 0 0; }
.logo-drop.dragging { border-color: var(--accent); background: var(--accent-soft); }
.logo-drop.is-off p { margin: 0; }
.logo-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.logo-previews { display: flex; gap: 10px; }
.logo-prev-light { flex: 1; min-width: 0; height: 96px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: #fff;
  display: flex; align-items: center; justify-content: center; }
.logo-prev-light img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-prev-dark { flex: none; width: 110px; border-radius: 10px; background: var(--sidebar-bg); display: flex; align-items: center; justify-content: center; }
.logo-tile { width: 40px; height: 40px; padding: 3px; border-radius: 7px; background: #fff; display: flex; align-items: center; justify-content: center; }
.logo-tile.wide { width: 92px; height: 32px; padding: 3px 6px; }
.logo-tile img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-actions { display: flex; gap: 8px; margin-top: 10px; }
.logo-remove { color: var(--danger); }
.logo-msg { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.logo-msg:empty { display: none; }
.logo-msg.error { color: var(--danger); }
.logo-msg.warn { color: var(--warn); }

@media (max-width: 820px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; max-height: none; }
  .settings-nav a { flex: none; border-right: 1px solid #f0f3f6; border-bottom: none; }
  .integration-setup-grid { grid-template-columns: 1fr; }
  .integration-direction { flex-wrap: wrap; }
  .integration-direction > b, .integration-direction > small { width: 100%; margin: 0; }
  .connection-overview { grid-template-columns: 1fr; }
  .connection-overview > div:not(.connection-actions) { border-right: none; }
}
@media (max-width: 580px) {
  .main { padding-left: 14px; padding-right: 14px; }
  .integration-hero { align-items: flex-start; flex-wrap: wrap; }
  .connection-pill { margin-left: 74px; }
  .integration-alert { grid-template-columns: 1fr; }
  .integration-toggle-grid { grid-template-columns: 1fr; }
  .connection-actions { justify-content: stretch; flex-wrap: wrap; }
  .connection-actions .btn { flex: 1; justify-content: center; }
}

/* ---------- Misc ---------- */
.banner { background: var(--info-soft); border: 1px solid #c9d8f7; color: #1f4fae; border-radius: 8px; padding: 12px 16px; margin-bottom: 14px; font-size: 13px; display: flex; align-items: center; gap: 12px; }
.banner.upsell { background: #fff8ec; border-color: #f2ddb3; color: #7c5b1c; }
.activity { font-size: 12.5px; }
.activity li { list-style: none; padding: 7px 0 7px 18px; border-left: 2px solid var(--border); position: relative; margin-left: 6px; }
.activity li::before { content: ""; position: absolute; left: -5px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.activity .when { color: var(--muted); }
.map-box { background: #e6ebf2; border: 1px solid var(--border); border-radius: 8px; position: relative; overflow: hidden; }
.map-pin { position: absolute; transform: translate(-50%, -100%); cursor: pointer; font-size: 20px; }
.map-pin .pin-label { display: none; position: absolute; bottom: 110%; left: 50%; transform: translateX(-50%); background: #fff; border: 1px solid var(--border); padding: 4px 8px; border-radius: 4px; font-size: 11px; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.map-pin:hover .pin-label { display: block; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #eef1f5; border-radius: 14px; padding: 3px 10px; font-size: 12px; margin: 2px; }
.chip button { border: none; background: none; color: var(--muted); font-size: 13px; }
.kv { font-size: 13px; }
.kv div { padding: 4px 0; }
.kv b { display: inline-block; min-width: 130px; color: var(--label); font-weight: 600; }
.note-item { border-bottom: 1px solid var(--line-soft); padding: 10px 0; font-size: 13px; }
.note-item .meta { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row code { background: var(--bg); padding: 6px 10px; border-radius: 6px; font-size: 12px; }

/* ---------- Popup menu ---------- */
.popmenu { position: absolute; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.18); z-index: 150; min-width: 190px; padding: 4px; }
.popmenu button { display: block; width: 100%; text-align: left; background: none; border: none; padding: 8px 12px; font-size: 13px; border-radius: 5px; color: var(--fg); }
.popmenu button:hover { background: #f1f5fc; }
.popmenu button.danger { color: var(--danger); }

/* ---------- Scheduler sizing ---------- */
.sched-cell { height: 46px; }
.sched-time { height: 46px; }

/* appointment overlay: sits above the time-cell grid so blocks can be dragged across cells */
.sched-appts { position: absolute; inset: 0; pointer-events: none; }
.sched-appts .appt { position: absolute; pointer-events: auto; touch-action: none; }
.appt .appt-time { opacity: .75; margin-top: 2px; }
.appt .appt-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; cursor: ns-resize; }
.appt .appt-resize:hover { background: rgba(0,0,0,.08); }
.appt { cursor: grab; }
/* visit status light / billing tag: small visual, >=24px touch target via padding + background-clip */
.visit-light, .visit-tag { font: inherit; cursor: pointer; line-height: 1; color: #fff; }
.visit-light { box-sizing: border-box; width: 28px; height: 28px; padding: 7px; border: 0; background: transparent; }
.visit-light::before { content: ""; display: block; width: 14px; height: 14px; box-sizing: border-box; border-radius: 50%; background: var(--vc, #98a4b0); border: 2px solid var(--vc, #98a4b0); }
.visit-light.outline::before { background: #fff; }
.visit-tag { min-width: 24px; min-height: 24px; padding: 4px 6px; border: 0; border-radius: 10px; font-size: 11px; font-weight: 700; }
.appt .visit-light, .appt .visit-tag { position: absolute; top: 0; right: 0; z-index: 3; }
.appt { padding-right: 30px; }
span.visit-light, span.visit-tag { display: inline-block; cursor: default; vertical-align: middle; }
span.visit-light { width: 24px; height: 24px; padding: 5px; }
/* Deposit tag on a visit not done yet: in the text flow, before the job number, so it never covers text. */
.visit-dep { display: inline-block; min-width: 18px; padding: 1px 4px; margin-right: 4px; border-radius: 6px; color: #fff; font-size: 10px; font-weight: 700; line-height: 14px; vertical-align: middle; text-align: center; }
.job-deposit { margin: -4px 0 10px; font-size: 13px; color: var(--muted); }
.appt.dragging { cursor: grabbing; z-index: 30; opacity: .92; box-shadow: 0 6px 18px rgba(0,0,0,.28); }
body.sched-dragging { user-select: none; cursor: grabbing; }

/* Day / Week view toggle */
.viewtoggle { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.viewtoggle button { background: #fff; border: none; padding: 6px 14px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.viewtoggle button + button { border-left: 1px solid var(--border); }

/* Settings: working-day ticks and the Days Off list */
.day-ticks { display: flex; flex-wrap: wrap; gap: 6px 14px; padding-top: 4px; }
.day-ticks label { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--fg); }
.dayoff-past { margin-top: 14px; }
.dayoff-past summary { cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
#do-visits { color: var(--warn); font-weight: 600; }
#do-visits .do-clashes { margin: 4px 0 0; padding-left: 18px; font-weight: 400; color: var(--fg); }
.asoff-link { padding: 0; border: 0; background: none; font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

/* Scheduler colour key: one line under the toolbar; on a phone it swipes sideways. */
.sched-key { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: -4px 0 10px; padding: 6px 10px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; font-size: 11px; color: var(--fg); }
.key-group { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.key-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.key-dot { width: 12px; height: 12px; box-sizing: border-box; border-radius: 50%; background: var(--vc); border: 2px solid var(--vc); }
.key-dot.outline { background: #fff; }
.key-tag { min-width: 18px; padding: 1px 4px; border-radius: 6px; color: #fff; font-size: 10px; font-weight: 700; text-align: center; line-height: 14px; }
.key-sw { width: 14px; height: 12px; border-radius: 3px; }
.key-unassigned { background: #fdf0d9; border-left: 3px solid var(--warn-mid); }
.key-closed { background: #e9edf2; border: 1px solid var(--border); }
.key-over { background: #fff; box-shadow: inset 0 0 0 2px var(--danger); }
.key-warn { color: var(--warn); font-weight: 700; }
.key-heat { display: inline-flex; border-radius: 3px; overflow: hidden; border: 1px solid var(--border); }
.key-heat i { width: 12px; height: 12px; }
.key-heat .mh-1 { background: #f1f2f3; } .key-heat .mh-2 { background: #dcdee1; } .key-heat .mh-3 { background: #babec3; }
.key-heat .mh-4 { background: #59636f; } .key-heat .mh-5 { background: #2f3b4c; }
@media (max-width: 599px) {
  .sched-key { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; box-sizing: border-box; contain: inline-size; }
}

/* Scheduler month view: a heat map of how booked each day is. Navy shades, never the
   action blue; text turns white only where it keeps 4.5:1 contrast. */
.mon { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.mon-head { padding: 7px 8px; font-size: 12px; font-weight: 700; color: var(--muted); background: #fafbfd; border-bottom: 1px solid var(--border); border-left: 1px solid var(--line-soft); }
.mon-head:first-child { border-left: 0; }
.mon-day { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 92px; min-width: 0; padding: 6px 7px; text-align: left; font: inherit; color: var(--fg); background: #fff; border: 0; border-left: 1px solid var(--line-soft); border-top: 1px solid var(--line-soft); cursor: pointer; overflow: hidden; }
.mon-day:nth-of-type(7n + 1) { border-left: 0; }
.mon-day:hover { box-shadow: inset 0 0 0 2px var(--border-strong); }
.mon-day:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mon-dn { font-size: 12px; font-weight: 700; line-height: 18px; }
.mon-day.today .mon-dn { background: var(--sidebar-bg); color: #fff; border-radius: 999px; padding: 0 7px; }
.mon-pct { font-size: 17px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.mon-status, .mon-gap, .mon-off { font-size: 11px; line-height: 1.3; max-width: 100%; }
.mon-status { font-weight: 700; }
.mon-warn { font-size: 10.5px; font-weight: 700; line-height: 1.3; background: var(--warn-soft); color: var(--warn); border-radius: 4px; padding: 1px 5px; max-width: 100%; }
.mon-mark, .mon-short { display: none; }
.mon-day.mh-0 { background: #fff; }
.mon-day.mh-1 { background: #f1f2f3; }
.mon-day.mh-2 { background: #dcdee1; }
.mon-day.mh-3 { background: #babec3; }
.mon-day.mh-4 { background: #59636f; color: #fff; }
.mon-day.mh-5 { background: #2f3b4c; color: #fff; }
.mon-day.closed { background: #eef1f5; }
.mon-day.past { background: #f3f4f6; color: var(--muted); }
.mon-day.out { background: #fafbfc; color: var(--muted); cursor: default; }
.mon-day.over { box-shadow: inset 0 0 0 2px var(--danger); }
.mon-day.over .mon-pct, .mon-day.over .mon-short { background: var(--danger-soft); color: var(--danger); border-radius: 4px; padding: 0 5px; }
.mon-day.over .mon-pct { font-size: 14px; }
.mon-day.picked { box-shadow: inset 0 0 0 3px var(--sidebar-bg); }
.mon-details { margin-top: 10px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.mon-details h4 { margin: 0 0 4px; font-size: 14px; }
.mon-details p { margin: 2px 0; font-size: 13px; }
.mon-details .btn { margin-top: 8px; }
@media (max-width: 599px) {
  .mon-head { padding: 5px 2px; text-align: center; font-size: 11px; }
  .mon-day { min-height: 52px; padding: 4px 3px; align-items: center; gap: 1px; }
  .mon-dn { font-size: 11px; }
  .mon-short { display: block; font-size: 12px; font-weight: 800; line-height: 1.15; }
  .mon-day.over .mon-short { padding: 0 2px; }
  .mon-pct, .mon-status, .mon-gap, .mon-off, .mon-warn { display: none; }
  .mon-mark { display: block; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn-mid); box-shadow: 0 0 0 1.5px #fff; }
}
.viewtoggle button.active { background: var(--accent); color: #fff; }
.sched-staffbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.staff-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: #fff; border-radius: 16px; padding: 4px 12px 4px 6px; font-size: 12.5px; cursor: pointer; opacity: .45; }
.staff-chip.on { opacity: 1; border-color: var(--accent); background: var(--accent-soft); }
.staff-chip .avatar { width: 22px; height: 22px; font-size: 10px; }

/* ---------- Document preview (quote/invoice) ---------- */
.doc-preview { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 40px 48px; max-width: 820px; margin: 0 auto; box-shadow: 0 2px 10px rgba(0,0,0,.06); font-size: 13px; }
.doc-preview .doc-head { display: flex; justify-content: space-between; margin-bottom: 28px; }
.doc-preview h1 { font-size: 26px; letter-spacing: 1px; color: var(--sidebar-bg); }
.doc-preview table { width: 100%; border-collapse: collapse; margin: 18px 0; }
.doc-preview th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--muted); border-bottom: 2px solid var(--border); padding: 6px 8px; }
.doc-preview td { padding: 7px 8px; border-bottom: 1px solid var(--line-soft); }
.doc-preview .num { text-align: right; }
.doc-terms { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--label); font-size: 12px; }

/* ---------- Settings extras ---------- */
.rate-input { width: 90px; }
.plan-box { border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; margin-bottom: 12px; }
.plan-box b.price { font-size: 18px; color: var(--accent-dark); }

/* ---------- Billing ---------- */
.bill-tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 14px; }
.bill-tile { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; min-width: 0; }
.bill-tile.bad .bt-big { color: var(--danger); }
.bt-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.bt-big { font-size: 20px; font-weight: 700; margin: 2px 0; overflow-wrap: anywhere; }
.bt-sub { font-size: 12px; color: var(--muted); }
.bill-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.bill-row:last-child { border-bottom: none; }
.bill-row.highlight { background: #fff6df; box-shadow: inset 3px 0 0 var(--warn-mid); }
.bill-main { flex: 1; min-width: 0; }
.bill-title { font-weight: 600; overflow-wrap: anywhere; }
.bill-sub { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.bill-amt { font-weight: 700; white-space: nowrap; }
.bill-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.bill-btn { min-height: 36px; justify-content: center; }
.bill-btn:disabled { opacity: .5; }
.bill-tag { display: inline-block; color: #fff; border-radius: 10px; padding: 1px 8px; font-size: 11px; font-weight: 600; vertical-align: middle; }
@media (max-width: 820px) { .bill-tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 580px) {
  .bill-tiles { grid-template-columns: repeat(2, 1fr); }
  .bill-row { flex-wrap: wrap; }
  .bill-main { flex-basis: 60%; }
  .bill-actions { flex-basis: 100%; justify-content: flex-start; }
  .bill-actions .bill-btn { flex: 1 1 auto; }
}

/* ---------- How it works ---------- */
.hiw {
  --hiw-bg: #eef2f8; --hiw-surface: #ffffff; --hiw-fg: #202d3d; --hiw-muted: #59677a; --hiw-line: #d6dee9;
  --hiw-accent: #245ddb; --hiw-accent-ink: #ffffff; --hiw-chip: #e4eaf3;
  --hiw-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  position: fixed; inset: 0; z-index: 2000; touch-action: manipulation; overscroll-behavior: contain; display: flex; flex-direction: column;
  background: var(--hiw-bg); color: var(--hiw-fg); font-family: var(--hiw-font);
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
.hiw [hidden] { display: none !important; }
.hiw button { font-family: var(--hiw-font); cursor: pointer; }

/* top bar */
.hiw .hiw-bar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 16px; border-bottom: 1px solid var(--hiw-line); background: var(--hiw-surface); }
.hiw .hiw-bar-l { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.hiw .hiw-bar h2 { margin: 0; font: 800 19px/1.2 var(--hiw-font); letter-spacing: -.01em; max-width: 100%; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hiw .hiw-tname { font-weight: 700; color: #3e4b5c; }
.hiw .hiw-eg { color: var(--hiw-muted); font-size: 12.5px; }
.hiw .hiw-ctls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hiw .hiw-ctl { font: 600 13px/1 var(--hiw-font); min-height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--hiw-line); background: var(--hiw-surface); color: var(--hiw-fg); }
.hiw .hiw-close { font-weight: 700; }
.hiw .hiw-seg-ctl { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--hiw-line); border-radius: 11px; background: var(--hiw-surface); }
.hiw .hiw-seg-ctl button { font: 600 13px/1 var(--hiw-font); min-height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--hiw-muted); }
.hiw .hiw-seg-ctl button[aria-pressed="true"] { background: var(--hiw-accent); color: var(--hiw-accent-ink); }
.hiw .hiw-ctl:focus-visible, .hiw .hiw-seg-ctl button:focus-visible, .hiw .hiw-chip:focus-visible { outline: 2px solid var(--hiw-accent); outline-offset: 2px; }
@media (max-width: 599px) {
  .hiw .hiw-viewctl { display: none; }
  .hiw .hiw-bar { padding: 8px 12px; gap: 6px 8px; }
  .hiw .hiw-bar-l { order: 1; flex-direction: column; gap: 0; }
  .hiw .hiw-close { order: 2; min-height: 34px; padding: 0 12px; }
  .hiw .hiw-ctls { order: 3; width: 100%; gap: 6px; }
  .hiw .hiw-ctl { min-height: 32px; padding: 0 10px; }
  .hiw .hiw-seg-ctl button { min-height: 28px; padding: 0 8px; font-size: 12.5px; }
  .hiw .hiw-bar h2 { font-size: 17px; }
  .hiw .hiw-eg { font-size: 12px; }
}

/* stage */
.hiw .hiw-area { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.hiw .hiw-stage { position: absolute; top: 0; left: 0; transform-origin: 0 0; overflow: hidden; border-radius: 14px; background: #f4f6fa; box-shadow: 0 0 0 1px var(--hiw-line), 0 26px 50px -30px rgba(0,0,0,.45); }
.hiw .hiw-stage.hiw-phone { border-radius: 30px; box-shadow: 0 0 0 9px #1b232b, 0 26px 50px -24px rgba(0,0,0,.5); }

/* stand-in Tradexo (always light, like the real app) */
.hiw .hiw-app { position: absolute; inset: 0; display: flex; background: #f4f6fa; color: #202d3d; font: 13px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; pointer-events: none; text-align: left; }
.hiw .hiw-app button { font-family: inherit; cursor: default; }
.hiw .hiw-sb { width: 190px; flex: none; background: #182638; color: #c3cede; display: flex; flex-direction: column; }
.hiw .hiw-brand { display: flex; align-items: center; gap: 9px; padding: 15px 14px; font-weight: 700; color: #fff; border-bottom: 1px solid #26374d; min-width: 0; }
.hiw .hiw-brand-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hiw .hiw-logo { width: 28px; height: 28px; flex: none; border-radius: 7px; background: #245ddb; display: grid; place-items: center; font-size: 11px; letter-spacing: .04em; }
.hiw .hiw-logo.has-logo { background: #fff; padding: 2px; overflow: hidden; }
.hiw .hiw-logo img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.hiw .hiw-brand-wide .hiw-logo { flex: 1; width: auto; height: 34px; padding: 3px 8px; }
.hiw .hiw-side { display: flex; flex-direction: column; padding: 8px 0; }
.hiw .hiw-nv { display: flex; align-items: center; gap: 10px; margin: 1px 8px; padding: 9px 8px; border-radius: 6px; position: relative; }
.hiw .hiw-nv.hiw-on { background: #eaf0ff; color: #182638; font-weight: 600; }
.hiw .hiw-ic { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.hiw .hiw-col { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.hiw .hiw-top { height: 48px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 20px; background: #fff; border-bottom: 1px solid #dce2eb; }
.hiw .hiw-crumb { font-weight: 600; white-space: nowrap; }
.hiw .hiw-who { display: flex; align-items: center; gap: 8px; color: #59677a; min-width: 0; }
.hiw .hiw-who-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hiw .hiw-av { width: 26px; height: 26px; flex: none; border-radius: 50%; background: #3b7dd8; color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 700; }
.hiw .hiw-main { flex: 1; min-height: 0; position: relative; padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; overflow: hidden; }
.hiw .hiw-ph { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hiw .hiw-h { margin: 0; font-size: 19px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.hiw .hiw-h4 { margin: 0 0 10px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: #59677a; }
.hiw .hiw-muted { color: #59677a; }
.hiw .hiw-card { background: #fff; border: 1px solid #dce2eb; border-radius: 10px; padding: 14px 16px; }
.hiw .hiw-btn { display: inline-flex; align-items: center; gap: 6px; background: #245ddb; color: #fff; border: 0; border-radius: 7px; padding: 9px 13px; font-size: 13px; font-weight: 600; line-height: 1; white-space: nowrap; transition: transform .12s ease; }
.hiw .hiw-btn.hiw-sec { background: #fff; color: #202d3d; border: 1px solid #c9d2de; }
.hiw .hiw-pressed { transform: scale(.93); }
.hiw .hiw-app label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: #3e4b5c; }
.hiw .hiw-app input { font: 14px/1.3 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; padding: 9px 10px; border: 1px solid #c9d2de; border-radius: 7px; background: #fff; color: #202d3d; min-width: 0; width: 100%; }
.hiw .hiw-app input.hiw-typing { border-color: #245ddb; box-shadow: 0 0 0 3px rgba(36,93,219,.22); }
.hiw .hiw-acts { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.hiw .hiw-empty { margin: 0; color: #8a96a3; }
.hiw .hiw-g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hiw .hiw-check { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.hiw .hiw-check li { display: flex; align-items: center; gap: 9px; }
.hiw .hiw-check li::before { content: ""; width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid #c9d2de; flex: none; }
.hiw .hiw-check li.hiw-ok { color: #8a96a3; text-decoration: line-through; }
.hiw .hiw-check li.hiw-ok::before { background: #18734a; border-color: #18734a; }
.hiw .hiw-form { display: grid; gap: 12px; max-width: 440px; }
.hiw .hiw-lrow { display: flex; align-items: center; gap: 14px; }
.hiw .hiw-grow { flex: 1; min-width: 0; }
.hiw .hiw-st { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; color: var(--c); background: var(--b, color-mix(in srgb, var(--c) 13%, #fff)); white-space: nowrap; }
.hiw .hiw-kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.hiw .hiw-kv span { display: block; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: #59677a; }
.hiw .hiw-vrow { display: flex; align-items: center; gap: 12px; }
.hiw .hiw-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }

.hiw .hiw-cal { padding: 0; overflow: visible; }
.hiw .hiw-cal-g { --hr: 56px; display: grid; grid-template-columns: 46px repeat(var(--days), minmax(0, 1fr)); grid-template-rows: 30px calc(var(--hr) * 7); }
.hiw .hiw-cal-h { display: grid; place-items: center; font-size: 12px; font-weight: 600; color: #3e4b5c; border-bottom: 1px solid #dce2eb; }
.hiw .hiw-cal-h.hiw-today { color: #245ddb; }
.hiw .hiw-cal-t { display: flex; flex-direction: column; }
.hiw .hiw-cal-t span { height: var(--hr); font-size: 10.5px; color: #8a96a3; text-align: right; padding: 3px 6px 0 0; }
.hiw .hiw-cal-c { position: relative; border-left: 1px solid #edf0f4; background-image: repeating-linear-gradient(to bottom, transparent 0 calc(var(--hr) - 1px), #edf0f4 calc(var(--hr) - 1px) var(--hr)); }
.hiw .hiw-visit { position: absolute; left: 4px; right: 4px; background: #e5edfc; border-left: 4px solid #245ddb; border-radius: 6px; padding: 6px 30px 6px 8px; font-size: 12px; line-height: 1.35; }
.hiw .hiw-visit.hiw-other { border-left-color: var(--sc); background: color-mix(in srgb, var(--sc) 10%, #fff); }
.hiw .hiw-vs { color: #59677a; }
/* the bottom edge a drag stretches */
.hiw .hiw-vend { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; border-radius: 0 0 6px 6px; box-shadow: inset 0 -3px 0 rgba(36,93,219,.28); }
.hiw .hiw-light { position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.14); padding: 0; }
.hiw .hiw-tag { position: absolute; top: 5px; right: 5px; min-width: 24px; height: 21px; border: 0; border-radius: 5px; background: #64748b; color: #fff; font-weight: 800; font-size: 12px; padding: 0 6px; line-height: 21px; text-align: center; }
.hiw .hiw-vmenu { position: absolute; top: 28px; right: 4px; z-index: 5; min-width: 180px; display: flex; flex-direction: column; padding: 4px; background: #fff; border: 1px solid #dce2eb; border-radius: 9px; box-shadow: 0 12px 26px -12px rgba(0,0,0,.35); }
.hiw .hiw-vmenu.hiw-from-l { right: auto; left: 4px; }
.hiw .hiw-vmenu.hiw-up { top: auto; bottom: calc(100% + 4px); }
.hiw .hiw-mi { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 6px; font-size: 13px; white-space: nowrap; }
.hiw .hiw-mi.hiw-danger { color: #ba3342; }
.hiw .hiw-sms { position: absolute; top: 0; right: calc(100% + 14px); width: 250px; z-index: 4; background: #fff; border-radius: 14px 14px 4px 14px; padding: 10px 12px; box-shadow: 0 12px 28px -12px rgba(0,0,0,.35); border: 1px solid #dce2eb; }
.hiw .hiw-sms.hiw-from-l { right: auto; left: calc(100% + 14px); border-radius: 14px 14px 14px 4px; }
.hiw .hiw-sms-h { font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: #59677a; margin-bottom: 4px; font-weight: 700; }
.hiw .hiw-sms p { margin: 0; font-size: 12.5px; line-height: 1.45; }

.hiw .hiw-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.hiw .hiw-tile { background: #fff; border: 1px solid #dce2eb; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.hiw .hiw-tile span { font-size: 11px; color: #59677a; }
.hiw .hiw-tile b { font-size: 18px; font-variant-numeric: tabular-nums; }
.hiw .hiw-tile small { font-size: 11px; color: #59677a; }
.hiw .hiw-tabs { display: flex; gap: 18px; border-bottom: 1px solid #dce2eb; }
.hiw .hiw-tabs span { padding: 0 0 8px; font-weight: 600; color: #59677a; display: flex; gap: 6px; align-items: center; }
.hiw .hiw-tabs span.hiw-on { color: #245ddb; box-shadow: inset 0 -2px 0 #245ddb; }
.hiw .hiw-tabs i { font-style: normal; font-size: 11px; background: #eef1f4; color: #59677a; border-radius: 999px; padding: 1px 7px; }
.hiw .hiw-list { padding: 6px 14px; }
.hiw .hiw-brow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; }
.hiw .hiw-brow.hiw-hl { background: #fff6df; box-shadow: 0 0 0 2px #e8b44a; border-radius: 8px; padding: 10px; }
.hiw .hiw-bm { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 2px; }
.hiw .hiw-ba { display: flex; gap: 6px; flex-wrap: wrap; }
.hiw .hiw-tagg { font-size: 11px; font-weight: 800; color: #fff; background: #64748b; border-radius: 5px; padding: 2px 6px; margin-left: 6px; }
.hiw .hiw-amt { font-weight: 700; font-variant-numeric: tabular-nums; }

.hiw .hiw-modal-back { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; background: rgba(17,24,39,.32); }
.hiw .hiw-modal { width: 360px; max-width: calc(100% - 28px); display: grid; gap: 12px; background: #fff; border-radius: 12px; padding: 18px; box-shadow: 0 24px 50px -20px rgba(0,0,0,.45); }
.hiw .hiw-mt { margin: 0; font-size: 15px; font-weight: 700; color: #202d3d; }
.hiw .hiw-money { display: flex; align-items: center; border: 1px solid #c9d2de; border-radius: 7px; padding-left: 10px; background: #fff; }
.hiw .hiw-money input { border: 0; flex: 1; }
.hiw .hiw-money:has(input.hiw-typing) { border-color: #245ddb; box-shadow: 0 0 0 3px rgba(36,93,219,.22); }
.hiw .hiw-money input.hiw-typing { box-shadow: none; }
.hiw .hiw-chk { flex-direction: row !important; align-items: center; gap: 8px; }
.hiw .hiw-box { width: 17px; height: 17px; border-radius: 4px; background: #245ddb; color: #fff; display: grid; place-items: center; font-size: 11px; }
/* an "on" toggle, like the app's .toggle */
.hiw .hiw-track { position: relative; width: 34px; height: 20px; flex: none; border-radius: 999px; background: #245ddb; }
.hiw .hiw-track i { position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; }
.hiw .hiw-app textarea { font: 14px/1.3 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; padding: 8px 10px; border: 1px solid #c9d2de; border-radius: 7px; background: #fff; resize: none; width: 100%; }
.hiw .hiw-hint { font-size: 11px; font-weight: 400; color: #59677a; }
/* a select that picks itself: the field, then its option list */
.hiw .hiw-pickf { position: relative; }
.hiw .hiw-sel { display: block; position: relative; padding: 9px 30px 9px 10px; border: 1px solid #c9d2de; border-radius: 7px; background: #fff; font: 400 14px/1.3 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #202d3d; }
.hiw .hiw-sel::after { content: ""; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; margin-top: -6px; border: solid #59677a; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.hiw .hiw-sel.hiw-blank { color: #8a96a3; }
.hiw .hiw-opts { position: absolute; left: 0; right: 0; top: 100%; z-index: 2; margin-top: 4px; display: flex; flex-direction: column; padding: 4px; background: #fff; border: 1px solid #dce2eb; border-radius: 8px; box-shadow: 0 12px 26px -12px rgba(0,0,0,.35); font-weight: 400; }
.hiw .hiw-opts span { padding: 7px 9px; border-radius: 6px; font-size: 13px; color: #202d3d; }
.hiw .hiw-opts span.hiw-on { background: #eaf0ff; color: #1c4bb5; font-weight: 600; }
/* a draft invoice */
.hiw .hiw-inv { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.hiw .hiw-inv th { text-align: left; font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; color: #59677a; padding: 0 6px 6px 0; border-bottom: 1px solid #dce2eb; }
.hiw .hiw-inv td { padding: 8px 6px 8px 0; border-bottom: 1px solid #edf0f5; }
.hiw .hiw-inv th:not(:first-child), .hiw .hiw-inv td:not(:first-child) { text-align: right; white-space: nowrap; }
.hiw .hiw-inv-tot { display: grid; gap: 4px; margin: 10px 0 0 auto; width: min(240px, 100%); font-variant-numeric: tabular-nums; }
.hiw .hiw-inv-tot div { display: flex; justify-content: space-between; }
.hiw .hiw-inv-tot span { color: #59677a; }
.hiw .hiw-inv-total { border-top: 1px solid #dce2eb; padding-top: 6px; font-size: 14px; }
.hiw .hiw-inv-total span { color: #202d3d; font-weight: 600; }
/* the visit being dragged rides above the others */
.hiw .hiw-visit.hiw-dragging { z-index: 3; box-shadow: 0 12px 24px -10px rgba(16,32,64,.4); }

/* phone layout of the stand-in */
.hiw .hiw-app.hiw-phone { flex-direction: column; }
.hiw .hiw-phone .hiw-top { padding: 0 14px; }
.hiw .hiw-phone .hiw-main { padding: 14px; }
.hiw .hiw-phone .hiw-g2 { grid-template-columns: 1fr; }
.hiw .hiw-phone .hiw-kv { grid-template-columns: 1fr; gap: 8px; }
.hiw .hiw-phone .hiw-lrow { flex-wrap: wrap; gap: 6px 12px; }
/* phone Scheduler: three narrow days; the menu and the text bubble open towards the room */
.hiw .hiw-phone .hiw-visit { font-size: 11px; padding: 5px 24px 5px 6px; }
.hiw .hiw-phone .hiw-light { width: 16px; height: 16px; top: 5px; right: 4px; }
.hiw .hiw-phone .hiw-tag { right: 3px; }
.hiw .hiw-phone .hiw-sms { top: calc(100% + 10px); right: 0; left: auto; width: 250px; border-radius: 14px 4px 14px 14px; }
.hiw .hiw-phone .hiw-sms.hiw-from-l { left: 0; right: auto; border-radius: 4px 14px 14px 14px; }
/* phone Billing: five compact tiles in three columns, the tabs on one line, row buttons under the text,
   so three To invoice rows fit the phone frame */
.hiw .hiw-phone .hiw-main { gap: 8px; }
.hiw .hiw-phone .hiw-h { font-size: 17px; }
.hiw .hiw-phone .hiw-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.hiw .hiw-phone .hiw-tile { padding: 5px 7px; border-radius: 8px; gap: 0; }
.hiw .hiw-phone .hiw-tile span, .hiw .hiw-phone .hiw-tile small { font-size: 9.5px; line-height: 1.25; }
.hiw .hiw-phone .hiw-tile b { font-size: 14px; }
.hiw .hiw-phone .hiw-tabs { flex-wrap: nowrap; gap: 8px; font-size: 11px; }
.hiw .hiw-phone .hiw-tabs span { padding-bottom: 5px; gap: 3px; white-space: nowrap; }
.hiw .hiw-phone .hiw-tabs i { font-size: 9.5px; padding: 0 5px; }
.hiw .hiw-phone .hiw-list { padding: 0 10px; }
.hiw .hiw-phone .hiw-brow { padding: 5px 0; gap: 3px 10px; }
.hiw .hiw-phone .hiw-brow.hiw-hl { padding: 6px; }
.hiw .hiw-phone .hiw-bm { min-width: 60%; gap: 0; font-size: 12px; line-height: 1.3; }
.hiw .hiw-phone .hiw-ba .hiw-btn { font-size: 11px; padding: 4px 8px; }
.hiw .hiw-tabbar { height: 62px; flex: none; display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; border-top: 1px solid #dce2eb; }
.hiw .hiw-tb { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: #59677a; }
.hiw .hiw-tb.hiw-on { color: #245ddb; font-weight: 600; }

/* tour layers */
.hiw .hiw-spot { position: absolute; z-index: 2; border-radius: 10px; pointer-events: none; box-shadow: 0 0 0 2600px rgba(10,18,28,.40); transition: left .35s ease, top .35s ease, width .35s ease, height .35s ease; }
.hiw .hiw-lines { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: visible; }
.hiw .hiw-seg { transition: opacity .45s ease; }
.hiw .hiw-seg.hiw-old { opacity: .28; }
.hiw .hiw-halo { fill: none; stroke: rgba(255,255,255,.95); stroke-width: 6; stroke-dasharray: 8 7; stroke-linecap: round; }
.hiw .hiw-dash { fill: none; stroke: #245ddb; stroke-width: 2.8; stroke-dasharray: 8 7; stroke-linecap: round; }
.hiw .hiw-maskp { fill: none; stroke: #fff; stroke-width: 16; stroke-linecap: round; }
.hiw .hiw-seg.hiw-now .hiw-halo, .hiw .hiw-seg.hiw-now .hiw-dash { animation: hiw-march 1.1s linear infinite; }
@keyframes hiw-march { to { stroke-dashoffset: -30; } }
.hiw .hiw-fx { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.hiw .hiw-badge { position: absolute; width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 50%; background: #245ddb; color: #fff; border: 2px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.28); display: grid; place-items: center; font: 800 11px/1 var(--hiw-font); transition: opacity .45s ease; animation: hiw-pop .3s ease-out; }
.hiw .hiw-badge.hiw-old { opacity: .42; }
@keyframes hiw-pop { from { transform: scale(.3); } to { transform: scale(1); } }
.hiw .hiw-ripple { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; border: 2.5px solid #245ddb; animation: hiw-rip .6s ease-out forwards; }
@keyframes hiw-rip { from { transform: scale(.4); opacity: .95; } to { transform: scale(3); opacity: 0; } }
.hiw .hiw-touch { position: absolute; left: 0; top: 0; z-index: 5; width: 30px; height: 30px; border-radius: 50%; pointer-events: none; background: rgba(255,255,255,.6); border: 3px solid #245ddb; box-shadow: 0 5px 16px rgba(0,0,0,.28); transition: background .15s ease; }
.hiw .hiw-touch.hiw-down { background: rgba(36,93,219,.45); }
/* toasts stack in order, like the app's #toast-root */
.hiw .hiw-toasts { position: absolute; top: 60px; left: 12px; right: 12px; z-index: 6; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.hiw .hiw-toast { max-width: 100%; opacity: 0; transform: translateY(-8px); text-align: center; background: #1e2a38; color: #fff; padding: 9px 14px; border-radius: 9px; font-size: 13px; line-height: 1.4; transition: opacity .25s ease, transform .25s ease; }
.hiw .hiw-toast.hiw-show { opacity: 1; transform: none; }
.hiw .hiw-tip { position: absolute; z-index: 7; width: 300px; background: #fff; color: #202d3d; border-radius: 13px; padding: 14px 16px 13px; box-shadow: 0 20px 44px -14px rgba(10,18,28,.5), 0 0 0 1px rgba(10,18,28,.07); text-align: left; }
/* phone view: the tip is an unscaled full-width band between the stage and the path strip.
   Its height is set by the player (the tallest tip at this width); the cap is a fallback.
   The step count sits on the title's line to save a row. */
.hiw .hiw-tip.hiw-band { position: static; flex: none; width: auto; max-height: 45%; overflow-y: auto; border-radius: 0; box-shadow: none; border-top: 1px solid var(--hiw-line); padding: 10px 14px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-content: start; }
.hiw .hiw-tip.hiw-band > * { grid-column: 1 / -1; }
.hiw .hiw-tip.hiw-band .hiw-tip-h { grid-column: 1; grid-row: 1; align-self: baseline; margin: 0 0 4px; font-size: 17px; }
.hiw .hiw-tip.hiw-band .hiw-tip-k { grid-column: 2; grid-row: 1; align-self: baseline; white-space: nowrap; }
.hiw .hiw-tip.hiw-band p { font-size: 14px; margin: 0 0 8px; }
.hiw .hiw-tip.hiw-band .hiw-tip-bar { display: none; }
.hiw .hiw-tip.hiw-band button { font-size: 14px; min-height: 40px; }
.hiw .hiw-tip-k { font: 700 11px/1 var(--hiw-font); letter-spacing: .09em; text-transform: uppercase; color: #245ddb; }
.hiw .hiw-tip-h { margin: 7px 0 4px; font: 800 18px/1.2 var(--hiw-font); color: #202d3d; text-wrap: balance; }
.hiw .hiw-tip p { margin: 0 0 11px; font-size: 13.5px; line-height: 1.45; color: #3e4b5c; }
.hiw .hiw-tip-bar { height: 4px; border-radius: 2px; overflow: hidden; background: #e4eaf3; margin-bottom: 11px; }
.hiw .hiw-tip-bar span { display: block; height: 100%; background: #245ddb; transition: width .3s ease; }
.hiw .hiw-tip-act { display: flex; flex-wrap: wrap; gap: 8px; }
.hiw .hiw-sp { flex: 1; }
.hiw .hiw-tip button { font: 600 13px/1 var(--hiw-font); min-height: 36px; padding: 0 13px; border-radius: 9px; border: 1px solid #c9d2de; background: #fff; color: #202d3d; }
.hiw .hiw-tip button.hiw-pri { background: #245ddb; border-color: #245ddb; color: #fff; }
.hiw .hiw-tip button:disabled { opacity: .4; cursor: default; }
.hiw .hiw-tip button:focus-visible { outline: 2px solid #245ddb; outline-offset: 2px; }
/* the finish's "Next: …" suggestion, a link line so the finish still fits a 360 px band */
.hiw .hiw-tip .hiw-next { margin: -4px 0 10px; }
.hiw .hiw-tip button.hiw-link { min-height: 28px; padding: 0; border: 0; background: none; color: #245ddb; text-decoration: underline; text-underline-offset: 3px; text-align: left; line-height: 1.3; }

/* short windows (a phone in landscape): drop the strip so the stand-in and tip have room */
@media (max-height: 559px) { .hiw .hiw-path { display: none; } }

/* a phone held sideways: the controls and the tip share a column beside the stand-in, so the
   stand-in keeps the full height. Keep this query in step with SIDEWAYS in js/how-it-works.js. */
@media (orientation: landscape) and (max-height: 559px) {
  .hiw { display: grid; grid-template-columns: minmax(0, 1fr) clamp(290px, 40vw, 360px); grid-template-rows: auto minmax(0, 1fr); }
  .hiw .hiw-area { grid-column: 1; grid-row: 1 / 3; }
  .hiw .hiw-bar { grid-column: 2; grid-row: 1; border-left: 1px solid var(--hiw-line); padding: 8px 12px; gap: 6px 8px; }
  .hiw .hiw-bar-l { order: 1; flex-direction: column; gap: 0; }
  .hiw .hiw-close { order: 2; min-height: 34px; padding: 0 12px; }
  .hiw .hiw-ctls { order: 3; width: 100%; gap: 6px; }
  .hiw .hiw-ctl { min-height: 32px; padding: 0 10px; }
  .hiw .hiw-seg-ctl button { min-height: 28px; padding: 0 8px; font-size: 12.5px; }
  .hiw .hiw-bar h2 { font-size: 17px; }
  .hiw .hiw-eg { font-size: 12px; }
  .hiw .hiw-viewctl { display: none; } /* always the phone view here: it is the larger stand-in */
  .hiw .hiw-tip.hiw-band { grid-column: 2; grid-row: 2; max-height: none; border-top: 0; border-left: 1px solid var(--hiw-line); }
}

/* path strip: its own band, scrolls sideways */
.hiw .hiw-path { flex: none; min-width: 0; border-top: 1px solid var(--hiw-line); background: var(--hiw-surface); padding: 8px 16px 0; }
.hiw .hiw-path-h { margin: 0; color: var(--hiw-muted); font-size: 12.5px; }
.hiw .hiw-path-h b { color: var(--hiw-fg); font-weight: 800; margin-right: 8px; }
.hiw .hiw-strip { position: relative; display: flex; align-items: center; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; list-style: none; margin: 0; padding: 6px 4px 10px; scrollbar-width: thin; }
.hiw .hiw-strip li { display: flex; align-items: center; flex: none; }
.hiw .hiw-strip li + li::before { content: ""; width: 18px; margin: 0 4px; border-top: 2px dashed var(--hiw-line); }
.hiw .hiw-strip li.hiw-reached + li.hiw-reached::before { border-top-color: var(--hiw-accent); }
.hiw .hiw-chip { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; padding: 5px 11px 5px 5px; border-radius: 999px; border: 1.5px solid var(--hiw-line); background: var(--hiw-surface); color: var(--hiw-muted); font: 600 12.5px/1 var(--hiw-font); }
.hiw .hiw-chip .hiw-n { width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; background: var(--hiw-chip); color: var(--hiw-muted); font: 800 11px/1 var(--hiw-font); }
.hiw .hiw-chip.hiw-done { color: var(--hiw-fg); }
.hiw .hiw-chip.hiw-done .hiw-n, .hiw .hiw-chip.hiw-now .hiw-n { background: var(--hiw-accent); color: var(--hiw-accent-ink); }
.hiw .hiw-chip.hiw-now { color: var(--hiw-fg); border-color: var(--hiw-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hiw-accent) 22%, transparent); }

@media (prefers-reduced-motion: reduce) {
  .hiw .hiw-spot, .hiw .hiw-seg, .hiw .hiw-badge, .hiw .hiw-toast, .hiw .hiw-tip-bar span { transition: none; }
  .hiw .hiw-badge, .hiw .hiw-ripple { animation: none; }
  .hiw .hiw-seg.hiw-now .hiw-halo, .hiw .hiw-seg.hiw-now .hiw-dash { animation: none; }
  .hiw .hiw-ripple { display: none; }
}

/* the first sign-in offer (outside the player) */
.hiw-offer { touch-action: manipulation; position: fixed; z-index: 1900; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(360px, calc(100vw - 32px)); background: #fff; color: #202d3d; border-radius: 14px; padding: 20px 20px 16px; box-shadow: 0 24px 60px -16px rgba(10,18,28,.55), 0 0 0 1px rgba(10,18,28,.08); font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hiw-offer .hiw-offer-h { margin: 0 0 6px; font-size: 18px; font-weight: 800; line-height: 1.2; }
.hiw-offer .hiw-offer-p { margin: 0 0 14px; font-size: 14px; line-height: 1.5; color: #3e4b5c; }
.hiw-offer .hiw-offer-act { display: flex; justify-content: flex-end; gap: 8px; }
.hiw-offer button { font: 600 14px/1 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 38px; padding: 0 16px; border-radius: 9px; border: 1px solid #c9d2de; background: #fff; color: #202d3d; }
.hiw-offer button.hiw-offer-yes { background: #245ddb; border-color: #245ddb; color: #fff; }
.hiw-offer button:focus-visible { outline: 2px solid #245ddb; outline-offset: 2px; }

/* paused: stop the marching dashes too */
.hiw.hiw-paused .hiw-seg.hiw-now .hiw-halo, .hiw.hiw-paused .hiw-seg.hiw-now .hiw-dash { animation-play-state: paused; }

/* hover states */
@media (hover: hover) {
  .hiw .hiw-ctl:hover, .hiw .hiw-chip:hover { border-color: var(--hiw-accent); background: #eef3fd; }
  .hiw .hiw-seg-ctl button:not([aria-pressed="true"]):hover { background: var(--hiw-chip); color: var(--hiw-fg); }
  .hiw .hiw-seg-ctl button[aria-pressed="true"]:hover { background: #1c4bb5; }
  .hiw .hiw-tip button:not(:disabled):hover { background: #eef3fd; border-color: #245ddb; }
  .hiw .hiw-tip button.hiw-pri:not(:disabled):hover { background: #1c4bb5; border-color: #1c4bb5; }
  .hiw-offer button:hover { background: #eef3fd; border-color: #245ddb; }
  .hiw-offer button.hiw-offer-yes:hover { background: #1c4bb5; border-color: #1c4bb5; }
}

/* visually hidden live region for screen readers */
.hiw .hiw-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
