/* AQUAffection Admin — Sales Tracker design language */
:root {
  --navy1: #142F5C;
  --navy2: #1b3e78;
  --cyan: #1CA3D6;
  --cyan-dark: #158ab8;
  --canvas: #eef2f7;
  --card: #ffffff;
  --ink: #16233b;
  --muted: #64748b;
  --line: #dbe3ee;
  --ok: #1a9e63;
  --warn: #d97706;
  --bad: #d64545;
  --shadow: 0 2px 10px rgba(20, 47, 92, .10);
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: clip; max-width: 100%; }
img { max-width: 100%; }
body { font: 15px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--canvas); color: var(--ink); }
h1, h2, h3 { line-height: 1.2; }
a { color: var(--cyan-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.app-header {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(100deg, var(--navy1), var(--navy2));
  color: #fff; padding: 10px 18px; position: sticky; top: 0; z-index: 50;
}
.header-logo { height: 36px; }
.header-sep { width: 1px; height: 26px; background: rgba(255,255,255,.35); }
.header-title { font-size: 18px; font-weight: 600; letter-spacing: .3px; }
.header-spacer { flex: 1; }
.header-user { font-size: 13px; opacity: .85; }
.off-badge { background: #fff3cd; color: #7a5d00; border: 1px solid #e6cc6a; border-radius: 999px; padding: 3px 11px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.nav-toggle { display: none; background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; padding: 2px 6px; }

/* ---------- layout ---------- */
.app-body { display: flex; min-height: calc(100vh - 54px); }
.sidebar {
  width: 216px; flex: 0 0 216px; background: #fff; border-right: 1px solid var(--line);
  padding: 14px 10px; position: sticky; top: 54px; height: calc(100vh - 54px); overflow-y: auto;
}
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 16px 8px 6px; }
.nav-group:first-child { margin-top: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px;
  color: var(--ink); font-weight: 500; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; font-size: 14.5px;
}
.nav-item:hover { background: #f1f6fb; text-decoration: none; }
.nav-item.active { background: #e2f3fb; color: #0d6d95; }
.nav-item .ico { width: 20px; text-align: center; }
.nav-badge { margin-left: auto; background: var(--bad); color: #fff; font-size: 11px; border-radius: 10px; padding: 1px 7px; font-weight: 600; }
.main { flex: 1; padding: 22px 26px 60px; min-width: 0; }

/* ---------- cards / page ---------- */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-head .spacer { flex: 1; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.card h2 { font-size: 15px; margin: 0 0 12px; color: var(--navy1); }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }

/* KPI tiles */
.kpi { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; cursor: pointer; }
.kpi .n { font-size: 26px; font-weight: 700; color: var(--navy1); }
.kpi .l { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi.accent .n { color: var(--cyan-dark); }
.kpi.bad .n { color: var(--bad); }

/* ---------- buttons / forms ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: 9px;
  padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer; background: #e8edf4; color: var(--ink);
}
.btn:hover { filter: brightness(.97); }
.btn-primary { background: var(--cyan); color: #fff; box-shadow: 0 2px 6px rgba(28,163,214,.35); }
.btn-primary:hover { background: var(--cyan-dark); filter: none; }
.btn-danger { background: #fbe9e9; color: var(--bad); }
.btn-ghost { background: rgba(255,255,255,.14); color: #fff; }
.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .5; cursor: default; }

label.f { display: block; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: #33415c; }
label.f > input, label.f > select, label.f > textarea, .login-card label > input {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px; font-size: 14.5px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-family: inherit;
}
label.f > textarea { min-height: 84px; resize: vertical; }
label.f > input:focus, label.f > select:focus, label.f > textarea:focus, .login-card input:focus {
  outline: 2px solid var(--cyan); outline-offset: 0; border-color: var(--cyan);
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 0 18px; }
.form-error { background: #fbe9e9; color: var(--bad); border-radius: 8px; padding: 9px 12px; font-size: 13.5px; margin-bottom: 12px; }
.hint { font-size: 12.5px; color: var(--muted); }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid #edf1f7; vertical-align: top; }
.tbl tr.rowlink { cursor: pointer; }
.tbl tr.rowlink:hover { background: #f4f8fc; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

/* badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-issued { background: #ede9fe; color: #6d28d9; }
.b-assigned { background: #e0f2fe; color: #0369a1; }
.b-inprogress { background: #fef3c7; color: #b45309; }
.b-completed { background: #d9f2e5; color: #157347; }
.b-deleted { background: #f1f5f9; color: #64748b; }
.b-ok { background: #d9f2e5; color: #157347; }
.b-warn { background: #fef3c7; color: #b45309; }
.b-bad { background: #fbe9e9; color: #c03535; }
.b-muted { background: #eef2f7; color: #5a6b85; }
/* planned = scheduled work we control · unplanned = reactive call-out */
.b-planned { background: #e2f3fb; color: #0e7fac; }
.b-unplanned { background: #fdf0e6; color: #b45309; }

/* ---------- search bar ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search], .toolbar select {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; background: #fff;
}
.toolbar input[type=search] { flex: 1 1 220px; min-width: 0; }
.toolbar input:focus, .toolbar select:focus { outline: 2px solid var(--cyan); border-color: var(--cyan); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(120deg, var(--navy1), var(--navy2)); padding: 20px; }
.login-card { background: #fff; border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.25); padding: 34px 34px 28px; width: 100%; max-width: 400px; text-align: center; }
.login-logo { height: 54px; margin-bottom: 8px; }
.login-card h1 { margin: 0; font-size: 24px; color: var(--navy1); }
.login-sub { color: var(--muted); margin: 4px 0 22px; font-size: 14px; }
.login-card form { text-align: left; }
.login-card label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: #33415c; }

/* ---------- modal / toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15,26,47,.55); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 100; }
.modal { background: #fff; border-radius: 14px; box-shadow: 0 16px 60px rgba(0,0,0,.3); width: 100%; max-width: 640px; padding: 22px 24px 0; max-height: calc(100vh - 80px); overflow-y: auto; overscroll-behavior: contain; }
.modal.wide { max-width: 900px; }
.modal h2 { margin: 0 0 16px; font-size: 18px; color: var(--navy1); }
/* action buttons stay pinned to the bottom of the (scrolling) modal, always visible */
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; position: sticky; bottom: 0; margin: 18px -24px 0; padding: 14px 24px; background: #fff; border-top: 1px solid var(--line); border-radius: 0 0 14px 14px; z-index: 2; }
.update-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 300; display: flex; align-items: center; gap: 12px; background: var(--navy1); color: #fff; padding: 10px 12px 10px 18px; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.28); font-size: 14px; max-width: calc(100vw - 24px); }
.update-bar .btn { background: #fff; color: var(--navy1); border: 0; }
.update-x { background: transparent; border: 0; color: rgba(255,255,255,.7); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy1); color: #fff; padding: 11px 20px; border-radius: 10px; box-shadow: var(--shadow); z-index: 200; font-size: 14px; animation: toastin .2s ease-out; }
.toast.err { background: var(--bad); }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- detail pages ---------- */
.dl { display: grid; grid-template-columns: 190px 1fr; gap: 6px 14px; font-size: 14px; }
.dl dt { color: var(--muted); font-size: 13px; padding-top: 1px; }
.dl dd { margin: 0; min-width: 0; word-wrap: break-word; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 120px), 1fr)); gap: 10px; }
.photo-grid img { width: 100%; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }
.sig-pad { border: 1.5px dashed var(--line); border-radius: 10px; background: #fff; touch-action: none; width: 100%; height: 160px; }

/* leave calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { font-size: 11px; text-transform: uppercase; color: var(--muted); text-align: center; padding: 4px 0; }
.cal .day { min-height: 74px; background: #fff; border: 1px solid #e8edf4; border-radius: 8px; padding: 4px 6px; font-size: 12px; }
.cal .day.dim { opacity: .4; }
.cal .day .d { font-weight: 600; color: var(--muted); font-size: 11px; }
.cal-nav { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 12px; }
.cal-people { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 12.5px; color: var(--ink); }
.cal-people span { display: inline-flex; align-items: center; }
.cal-people .dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 5px; }
.cal .day.clash { background: #3f4652; border-color: #2b313b; }
.cal .day.clash .d { color: #fff; }
.cal .clash-n { font-size: 9.5px; font-weight: 700; color: #fbbf24; float: right; }
.cal .ev { margin-top: 3px; border-radius: 5px; padding: 1px 5px; font-size: 11px; background: #e0f2fe; color: #0a5c80; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .ev.sick { background: #fbe9e9; color: #b23131; }

/* timeline */
.tline { border-left: 2px solid var(--line); margin-left: 8px; padding-left: 18px; }
.tline .ev { position: relative; margin-bottom: 12px; }
.tline .ev::before { content: ''; position: absolute; left: -24px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--cyan); }
.tline .t { font-size: 12px; color: var(--muted); }

/* ---------- print (jobcard PDF on letterhead) ---------- */
#print-root { display: none; }
@media print {
  @page { size: A4; margin: 6mm 10mm; }
  body.printing #app-shell, body.printing #login-screen, body.printing #invite-screen,
  body.printing #toast-root, body.printing #modal-root { display: none !important; }
  body.printing #print-root { display: block; }
  body { background: #fff; }
}
.print-table { width: 100%; border-collapse: collapse; }
.print-table thead td { padding: 0 0 4mm; }
.print-table tfoot td { padding: 4mm 0 0; }
.lh-img { width: 100%; display: block; }
.pjc { font: 11.5pt/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: #16233b; }
.pjc h1 { font-size: 17pt; color: #142F5C; margin: 0 0 2mm; }
.pjc .pjc-sub { color: #556; font-size: 10pt; margin-bottom: 5mm; }
.pjc-grid { display: grid; grid-template-columns: 42mm 1fr; gap: 1.2mm 5mm; font-size: 10.5pt; margin-bottom: 4mm; }
.pjc-grid dt { color: #667; }
.pjc-grid dd { margin: 0; font-weight: 500; }
.pjc h2 { font-size: 11.5pt; color: #142F5C; border-bottom: 1.5px solid #C9CED6; padding-bottom: 1mm; margin: 5mm 0 2mm; }
.pjc-notes { white-space: pre-wrap; font-size: 10.5pt; }
.pjc-sigrow { display: flex; gap: 14mm; flex-wrap: wrap; }
.pjc-sig { margin-top: 3mm; }
.pjc-sig img { max-height: 24mm; max-width: 62mm; display: block; }
.pjc-sigline { height: 18mm; width: 62mm; }
.pjc-sig .who { font-size: 10pt; color: #445; border-top: 1px solid #99a; padding-top: 1mm; min-width: 62mm; margin-top: 1mm; }
.pjc-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3mm; }
.pjc-photos img { width: 100%; height: 52mm; object-fit: cover; border: 0.3mm solid #C9CED6; border-radius: 2mm; page-break-inside: avoid; }
.pjc-badge { display: inline-block; border: 0.4mm solid #1CA3D6; color: #0d6d95; border-radius: 3mm; padding: 0.5mm 3mm; font-size: 10pt; font-weight: 600; vertical-align: middle; margin-left: 3mm; }

/* ---------- address autocomplete + trip stops ---------- */
.stop-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.stop-badge { flex: 0 0 42px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; }
.stop-wrap { position: relative; flex: 1; }
.stop-input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.stop-x { flex: 0 0 auto; border: 0; background: #fbe9e9; color: #b23131; border-radius: 6px; width: 28px; height: 28px; cursor: pointer; font-size: 16px; }
.ac-box { position: absolute; top: 100%; left: 0; right: 0; z-index: 200; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); max-height: 300px; overflow-y: auto; margin-top: 2px; }
/* inside a modal the results flow in-line so the box grows to fit them — nothing is clipped and there's no tiny inner scrollbar to fight */
.modal .ac-box { position: static; max-height: 52vh; box-shadow: none; margin-top: 6px; }
.ac-item { padding: 8px 11px; font-size: 13px; line-height: 1.35; cursor: pointer; border-bottom: 1px solid #f1f5f9; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.ac-item:hover { background: #e2f3fb; }
.ac-item > span[style*="float"] { float: none !important; margin-left: auto; white-space: nowrap; flex: 0 0 auto; }

.pick-photos { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.copy-btn { border: 1px solid var(--line); background: #f6f9fc; border-radius: 5px; padding: 1px 6px; font-size: 12px; cursor: pointer; color: var(--cyan-dark); vertical-align: 1px; }
.copy-btn:hover { background: #e2f3fb; }

/* SANS 241 verdict */
.sans-box { border-radius: 10px; padding: 10px 14px; margin: 0 0 14px; font-size: 13.5px; }
.sans-box ul { margin: 6px 0 0 18px; padding: 0; }
.sans-box.sans-ok { background: #ecfdf3; border: 1px solid #a7e3c0; color: #14713f; }
.sans-box.sans-bad { background: #fdf2f2; border: 1px solid #f0b8b8; color: #a12c2c; }
.sans-fail-row { background: #fdf2f2; }
.sans-fail-row td { font-weight: 600; }

/* ---------- design & costing ---------- */
.dtabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.dtab { border: 1px solid var(--line); background: #fff; border-radius: 8px 8px 0 0; padding: 8px 14px; font-size: 13.5px; font-weight: 500; cursor: pointer; color: var(--ink); }
.dtab:hover { background: #f1f6fb; }
.dtab.active { background: var(--navy1); color: #fff; border-color: var(--navy1); }
.dtab-n { background: rgba(28,163,214,.25); border-radius: 8px; padding: 0 6px; font-size: 11px; }
.dtab.active .dtab-n { background: rgba(255,255,255,.25); }
#wb-canvas { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; touch-action: none; display: block; }
.wb-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.wb-mode.active { background: var(--cyan); color: #fff; border-color: var(--cyan); }
.wb-colors { display: inline-flex; gap: 5px; }
.wb-color { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.wb-color.active { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }
.pin-badge { background: #fdf2f2; color: #d64545; border-radius: 6px; padding: 1px 6px; font-size: 11.5px; font-weight: 700; }

/* ---------- design packages ---------- */
.pkg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.pkg-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; cursor: pointer; transition: box-shadow .15s, transform .05s; }
.pkg-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.pkg-thumb { height: 130px; display: flex; align-items: center; justify-content: center; background: #f1f6fb; overflow: hidden; }
.pkg-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pkg-thumb span { font-size: 42px; opacity: .6; }
.pkg-thumb.lg { width: 150px; height: 150px; border-radius: 12px; border: 1px solid var(--line); flex: 0 0 auto; }
.pkg-meta { padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.pkg-detail { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.pkg-pic { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.pkg-fields { flex: 1; min-width: 240px; display: flex; flex-direction: column; gap: 10px; }

/* second row of design tabs (element sections) sits under the main views */
.dtabs-sub { margin-top: -8px; margin-bottom: 14px; padding-left: 6px; }
.dtabs-sub .dtab { font-size: 12.5px; padding: 6px 11px; background: #f8fafc; }
.dtabs-sub .dtab.active { background: var(--cyan); border-color: var(--cyan); }

/* whiteboard stage: canvas + quick-drop tray */
.wb-stage { display: flex; gap: 12px; align-items: flex-start; }
.wb-stage #wb-canvas { flex: 1; min-width: 0; }
.wb-snap { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
/* fitting symbol palette */
.wb-side { flex: 0 0 210px; display: flex; flex-direction: column; gap: 10px; }
.wb-side .wb-tray { flex: 0 0 auto; width: 100%; max-height: 340px; }
.sym-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.sym-tab { border: 1.5px solid var(--line); background: #fff; border-radius: 7px; padding: 3px 7px; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.sym-list { display: flex; flex-direction: column; gap: 4px; }
.sym-item { display: flex; align-items: center; justify-content: space-between; gap: 6px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; font-size: 12px; cursor: pointer; line-height: 1.25; }
.sym-item:hover { border-color: var(--cyan); background: #f1f6fb; }
.sym-item.sel { border-color: var(--cyan); background: #e2f3fb; box-shadow: 0 0 0 2px rgba(28,163,214,.25); }
.sym-back { background: none; border: 0; color: var(--cyan-dark); font-size: 12px; cursor: pointer; padding: 2px 0 6px; }
.wb-tray { flex: 0 0 190px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; padding: 10px; max-height: 640px; overflow-y: auto; }
.wb-tray-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.wb-tray-items { display: flex; flex-direction: column; gap: 6px; }
.tray-item { display: flex; align-items: center; gap: 7px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 7px; cursor: grab; user-select: none; }
.tray-item:hover { border-color: var(--cyan); }
.tray-item.sel { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(28,163,214,.25); }
.tray-item:active { cursor: grabbing; }
.tray-ic { font-size: 16px; flex: 0 0 auto; }
.tray-lbl { flex: 1; min-width: 0; font-size: 12.5px; line-height: 1.25; overflow: hidden; }
.tray-lbl small { display: block; color: var(--muted); font-size: 10.5px; }
.tray-x { flex: 0 0 auto; border: 0; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; padding: 0 2px; }
.tray-x:hover { color: var(--bad); }
.wb-tray-hint, .wb-tray-empty { font-size: 11px; color: var(--muted); margin-top: 8px; }
.wb-addtabs { display: flex; gap: 6px; }
.cat-aqf { transition: box-shadow .2s, border-color .2s; }
.cat-aqf.cat-saved { border-color: var(--ok); box-shadow: 0 0 0 2px rgba(26,158,99,.25); }
@media (max-width: 780px) { .wb-stage { flex-direction: column; } .wb-tray { flex: 1 1 auto; width: 100%; max-height: 220px; } }

/* ---------- employee onboarding ---------- */
.onb-progress { height: 10px; background: #eef2f7; border-radius: 6px; overflow: hidden; margin-top: 10px; }
.onb-progress-bar { height: 100%; background: var(--ok); transition: width .2s; }
.onb-step { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #eef2f7; }
.onb-step:last-child { border-bottom: 0; }
.onb-ico { flex: 0 0 24px; font-size: 17px; text-align: center; }
.onb-body { flex: 1; min-width: 0; }
.onb-label { font-weight: 500; font-size: 14.5px; }
.onb-tag { font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--cyan-dark); background: #e2f3fb; border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: 1px; }
.onb-act { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.onb-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.onb-active { background: #f2fbff; border-radius: 8px; padding: 12px 10px; }
.onb-active .onb-label { color: var(--navy1); }
.onb-locked { opacity: .5; }
.onb-done .onb-label, .onb-na .onb-label { color: var(--muted); }
.btn-xs { padding: 2px 8px; font-size: 12px; }

/* ---------- chips (multi-select) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #e2f3fb; color: #0d6d95; border-radius: 999px; padding: 3px 6px 3px 11px; font-size: 13px; font-weight: 500; }
.chip-x { border: 0; background: rgba(13,109,149,.15); color: #0d6d95; border-radius: 50%; width: 18px; height: 18px; cursor: pointer; font-size: 13px; line-height: 1; }
.audit-tick { color: var(--ok); font-weight: 700; }
.audit-flag { color: var(--warn); font-weight: 700; }

/* ---------- claim approval cards ---------- */
.claim-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.claim-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.claim-amt { font-size: 17px; font-weight: 700; color: var(--navy1); white-space: nowrap; }
.claim-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--muted); margin: 6px 0; }
.claim-route { font-size: 13px; margin: 4px 0; }
.claim-notes { font-size: 13.5px; margin: 6px 0; white-space: pre-wrap; }
.claim-files { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; font-size: 13px; }
.claim-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.claim-thumb { display: block; width: 96px; height: 96px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #f8fafc; }
.claim-thumb img { width: 100%; height: 100%; object-fit: cover; }
img.claim-thumb { object-fit: cover; }
.claim-thumb.pdf { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 22px; color: var(--muted); text-decoration: none; }
.claim-thumb.pdf span { font-size: 10px; padding: 0 4px; text-align: center; overflow: hidden; max-height: 24px; }
.claim-actions { display: flex; gap: 8px; margin-top: 8px; }
/* claim detail: info left, document pictures right */
.claim-detail { display: flex; gap: 18px; flex-wrap: wrap; }
.claim-detail-info { flex: 1 1 300px; min-width: 0; }
.claim-detail-docs { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.doc-thumb { width: 100%; max-height: 260px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.doc-pdf { display: inline-block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
/* claims analysis */
.an-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; }
.an-kpi { background: #f6f9fc; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.an-kpi .l { font-size: 12px; color: var(--muted); }
.an-kpi .n { font-size: 20px; font-weight: 700; color: var(--navy1); margin-top: 2px; }
.an-chart { margin-top: 8px; }
.an-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.an-bar-lbl { flex: 0 0 92px; font-size: 12.5px; color: var(--muted); }
.an-bar { flex: 1; display: flex; height: 20px; background: #eef2f7; border-radius: 5px; overflow: hidden; }
.an-seg { height: 100%; }
.an-seg.cash { background: #1CA3D6; }
.an-seg.fuel { background: #d97706; }
.an-bar-val { flex: 0 0 100px; text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.an-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.an-legend .k { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.an-legend .k.cash { background: #1CA3D6; }
.an-legend .k.fuel { background: #d97706; }
.an-seg { display: flex; align-items: center; overflow: hidden; }
.an-seg-lbl { color: #fff; font-size: 10.5px; font-weight: 600; padding: 0 5px; white-space: nowrap; }
.line-chart { width: 100%; max-width: 760px; height: auto; display: block; }
.an-decomp { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 12px; margin: 8px 0 4px; }
.an-dc { background: #f6f9fc; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.an-dc .l { font-size: 12px; color: var(--muted); }
.an-dc .n { font-size: 18px; font-weight: 700; color: var(--navy1); margin: 2px 0; }
.an-dc .s { font-size: 11.5px; color: var(--muted); }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--cyan-dark); }
.sort-ar { font-size: 10px; margin-left: 3px; opacity: .4; }
th.sortable:hover .sort-ar { opacity: .8; }
.claim-totals { margin-top: 14px; border-top: 2px solid var(--line); padding-top: 12px; }
.claim-totals .ct-grand { display: flex; flex-wrap: wrap; gap: 18px; font-size: 14px; margin-bottom: 10px; }
.claim-totals .ct-grand strong { color: var(--navy1); }
.claim-totals table { max-width: 380px; }

/* ---------- leave mini calendar ---------- */
.hl-bal { background: #eef6fb; border: 1px solid #cfe6f5; border-radius: 8px; padding: 9px 12px; font-size: 13.5px; margin: 4px 0 10px; }
/* leave date range picker */
.rp { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin: 4px 0 10px; max-width: 360px; }
.rp-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.rp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.rp-dow { text-align: center; font-size: 10.5px; text-transform: uppercase; color: var(--muted); padding-bottom: 2px; }
.rp-cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 13px; border-radius: 7px; cursor: pointer; user-select: none; }
.rp-cell:not(.rp-empty):hover { background: #e2f3fb; }
.rp-empty { cursor: default; }
.rp-we { color: #a2adba; }
.rp-hol { color: var(--warn); font-weight: 600; }
.rp-in { background: #d3ecfa; border-radius: 0; }
.rp-start, .rp-end { background: var(--cyan); color: #fff; font-weight: 700; }
.rp-start { border-radius: 7px 0 0 7px; }
.rp-end { border-radius: 0 7px 7px 0; }
.rp-start.rp-end { border-radius: 7px; }
.rp-readout { margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--navy1); text-align: center; }
.hl-cal { margin: 6px 0 4px; }
.hl-cal-key { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.hl-cal-key .k { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.hl-cal-key .k.work { background: #1CA3D6; }
.hl-cal-key .k.weekend { background: #e2e8f0; }
.hl-cal-key .k.holiday { background: #d97706; }
.hl-cal-m { margin-bottom: 8px; }
.hl-cal-mh { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 4px; }
.hl-cal-days { display: flex; flex-wrap: wrap; gap: 4px; }
.hl-d { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 6px; font-size: 12.5px; font-weight: 600; }
.hl-d.work { background: #1CA3D6; color: #fff; }
.hl-d.weekend { background: #eef2f7; color: #94a3b8; font-weight: 400; }
.hl-d.holiday { background: #d97706; color: #fff; }
.hl-cal-sum { font-size: 13px; margin-top: 6px; }
.hl-hol-note { color: var(--warn); }

/* ---------- sites map ---------- */
.map-split { display: flex; gap: 16px; align-items: stretch; }
.map-split > .card { margin-bottom: 16px; }
.map-detail { flex: 0 0 320px; max-width: 340px; overflow-y: auto; max-height: calc(100vh - 190px); }
.map-detail-h { font-size: 13px; color: var(--navy1); margin: 14px 0 6px; }
.map-detail .dl { grid-template-columns: 120px 1fr; font-size: 13.5px; }
@media (max-width: 860px) {
  .map-split { flex-direction: column; }
  .map-detail { flex: 1 1 auto; max-width: none; max-height: none; }
  .map-detail .dl { grid-template-columns: 110px 1fr; }
}
.map-wrap { height: calc(100vh - 210px); min-height: 420px; border-radius: var(--radius); overflow: hidden; }
.map-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.map-legend .dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .sidebar { position: fixed; left: 0; top: 54px; bottom: 0; z-index: 60; transform: translateX(-105%); transition: transform .18s ease; box-shadow: 4px 0 18px rgba(0,0,0,.15); height: auto; }
  .sidebar.open { transform: none; }
  .main { padding: 14px 12px 60px; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dt { margin-top: 8px; }
  .header-user { display: none; }
}

/* A read-only field is machine-set (e.g. the Google Maps route distance on a km claim) — it must
   look unavailable, or people try to type in it and think the app is broken. The first selector
   is there to out-specify `label.f > input`, which sets a white background on every form field. */
label.f > input[readonly], input[readonly] { background: #eef2f7; color: #41506b; cursor: not-allowed; }

/* duplicate warning when adding a catalogue part — the catalogue has been grown by import several
   times, so a near-duplicate is the likeliest way to corrupt a price list */
.dup-warn { border: 1px solid #f0c36d; background: #fff8e6; border-radius: 8px; padding: 9px 11px; margin: 4px 0 10px; font-size: 13px; color: #7a5d00; }
.dup-row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-top: 1px dashed #eadfba; }
.ac-newpart { border-top: 1px dashed var(--line); color: var(--navy1); }
.ac-vary { float: right; margin-left: 8px; padding: 1px 7px; font-size: 11px; }

/* trip map — numbered stops and small via points, matching the drag-to-reroute behaviour */
.tm-pin { width: 24px; height: 24px; border-radius: 50%; background: var(--cyan); color: #fff; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.35); font: 700 12px/20px Arial; text-align: center; cursor: grab; }
.tm-pin.via { width: 16px; height: 16px; background: #fff; border: 3px solid var(--cyan); }
#tm-map .leaflet-interactive { cursor: grab; }
.stop-site { max-width: 190px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; }

/* Searchable picker. A native <select> holding hundreds of options is unusable on a phone — iOS
   shows a wheel with no search — so these render as a text input that opens the keyboard.
   font-size MUST stay at 16px: iOS zooms the whole page when you focus anything smaller. */
.combo { position: relative; display: block; }
label.f > .combo > input.combo-q {
  display: block; width: 100%; margin-top: 5px; padding: 10px 34px 10px 11px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-family: inherit;
}
label.f > .combo > input.combo-q:focus { outline: 2px solid var(--cyan); border-color: var(--cyan); }
.combo-x {
  position: absolute; right: 4px; top: 22px; border: 0; background: none;
  font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px;
}
.combo-hits { top: 100%; }
.combo-hits .ac-item { padding: 12px; }        /* a comfortable tap target on a phone */

/* the fitting picker shows the same mark that lands on the board, beside its name */
.sym-item.sym-fit { display: flex; align-items: center; gap: 8px; }
.sym-glyph { flex: 0 0 24px; }
