/* HMC CRM: styles. The look follows the HMC Commerce Centre and the booking portals (Montserrat, HMC teal, the dark
   header, rounded buttons). Each business has its colour, taken from its own pages: INSPEKTA red, RITE4SITE lilac
   (#c7a0f0, not a darker purple: Harrison, 9 Oct 2026), HMC teal for Training and Safety, grey for General. */
:root {
  --teal: #02a0b0; --teal-d: #017f8c; --teal-l: #e5f6f7;
  --header: #333333; --ink: #111111; --muted: #5a5f63; --line: #dcdfe1; --bg: #f2f3f4; --card: #fff;
  --red: #b3261e; --red-l: #fdeceb; --amber: #8a5300; --amber-l: #fff3df; --green: #1f6b36; --green-l: #e6f4ea;
  --inspekta: #b31800; --rite4site: #c7a0f0; --training: #02a0b0; --safety: #017f8c; --general: #8a9196;
  --r: 10px; --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 14px -8px rgba(40, 60, 80, .35);
  color-scheme: light;
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 15px; line-height: 1.45; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; font-weight: 700; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.12rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .6em; }
a { color: var(--teal-d); }
small { font-size: .82rem; }
.muted { color: var(--muted); }
button { font: inherit; cursor: pointer; color: inherit; }
:focus-visible { outline: 3px solid #0a66b0; outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  background: var(--teal); color: #fff; border: 1px solid transparent; border-radius: 50px;
  padding: .5em 1.3em; min-height: 42px; font-size: 15px; text-decoration: none; box-shadow: 0 3px 11px rgba(0, 0, 0, .18); white-space: nowrap;
}
.btn:hover { background: var(--header); color: #fff; }
.btn:disabled { background: #c5ccd1; color: #fff; cursor: not-allowed; box-shadow: none; }
.btn.ghost { background: #fff; color: var(--teal-d); border-color: var(--teal); box-shadow: none; }
.btn.ghost:hover { background: var(--teal-l); }
.btn.danger { background: #fff; color: var(--red); border-color: var(--red); box-shadow: none; }
.btn.danger:hover { background: var(--red-l); }
.btn.small { min-height: 32px; padding: .25em .9em; font-size: .8rem; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--teal-d); text-decoration: underline; font-weight: 600; }
.iconbtn { background: none; border: 0; padding: 4px 6px; border-radius: 6px; color: var(--muted); }
.iconbtn:hover { background: #eef0f1; color: var(--ink); }

/* ---------- the top bar */
.topbar { background: var(--header); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar .bar { max-width: 1240px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; flex: none; }
.brand-logo { display: block; height: 28px; width: auto; }
.brand-name { border-left: 1px solid #6b6b6b; padding-left: 12px; font-weight: 600; letter-spacing: .02em; }
.topbar nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.topbar nav a { color: #e9eaeb; text-decoration: none; padding: 7px 11px; border-radius: 50px; font-size: .9rem; white-space: nowrap; }
.topbar nav a:hover { background: #474747; color: #fff; }
.topbar nav a[aria-current=page] { background: var(--teal); color: #fff; }
.topbar nav .n { display: inline-block; min-width: 1.5em; margin-left: 4px; padding: 0 .45em; border-radius: 50px; background: var(--amber-l); color: #5f3a00; font-size: .72rem; font-weight: 700; text-align: center; }
.topbar .find { flex: 1 1 200px; max-width: 340px; margin-left: auto; position: relative; }
.topbar .find input { width: 100%; border: 0; border-radius: 50px; padding: 9px 14px 9px 36px; font: inherit; font-size: .9rem; background: #4a4a4a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23c9cbcd' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center; color: #fff; }
.topbar .find input::placeholder { color: #c9cbcd; }
.topbar .find input:focus { background-color: #fff; color: var(--ink); outline: 2px solid var(--teal); }
.topbar .me { display: flex; align-items: center; gap: 10px; flex: none; font-size: .85rem; color: #d6d8da; }
.topbar .me .linkbtn { color: #fff; font-weight: 500; }
.menu-btn { display: none; background: none; border: 1px solid #6b6b6b; color: #fff; border-radius: 8px; padding: 5px 10px; }
@media (max-width: 980px) {
  .topbar .bar { flex-wrap: wrap; }
  .menu-btn { display: block; margin-left: auto; }
  .topbar nav, .topbar .me { display: none; width: 100%; }
  .topbar.open nav, .topbar.open .me { display: flex; }
  .topbar nav { flex-direction: column; align-items: stretch; }
  .topbar .find { order: 5; max-width: none; flex-basis: 100%; margin: 0; }
}

/* ---------- the page */
.wrap { max-width: 1240px; margin: 0 auto; padding: 20px 16px 60px; }
.pagehead { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; }
.pagehead h1 { margin: 0; }
.pagehead .spacer { flex: 1; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card > h2:first-child { margin-top: 0; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }
.empty { background: #fff; border: 1px dashed #c6cdd2; border-radius: var(--r); padding: 18px; text-align: center; color: var(--muted); }
.alert { border-radius: var(--r); padding: 10px 14px; margin-bottom: 14px; background: var(--amber-l); color: #5f3a00; }
.alert.err { background: var(--red-l); color: var(--red); }
.alert.ok { background: var(--green-l); color: var(--green); }
.pill { display: inline-block; border-radius: 50px; padding: .1em .65em; font-size: .74rem; font-weight: 600; background: #eceff1; color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--green-l); color: var(--green); }
.pill.warn { background: var(--amber-l); color: var(--amber); }
.pill.bad { background: var(--red-l); color: var(--red); }
.pill.lead { background: #e8f0fe; color: #1a4fa0; }
.tag { display: inline-block; border: 1px solid var(--line); border-radius: 6px; padding: 0 .5em; font-size: .78rem; color: var(--muted); background: #fafbfb; margin: 0 4px 4px 0; }
.svc { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.svc::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--dot, var(--general)); flex: none; }
.svc-inspekta { --dot: var(--inspekta); } .svc-rite4site { --dot: var(--rite4site); } .svc-training { --dot: var(--training); } .svc-safety { --dot: var(--safety); } .svc-general { --dot: var(--general); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--header); color: #fff; padding: 10px 18px; border-radius: 50px; z-index: 100; box-shadow: var(--shadow); max-width: 90vw; }

/* ---------- forms */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-weight: 600; font-size: .86rem; margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff; padding: .5em .7em; min-height: 42px; border: 1px solid #aeb8bf; border-radius: 8px;
}
.field textarea { min-height: 96px; resize: vertical; }
.field.has-err input, .field.has-err select, .field.has-err textarea { border-color: var(--red); background: var(--red-l); }
.err { display: block; color: var(--red); font-size: .82rem; margin-top: 3px; font-weight: 600; }
.hint { display: block; color: var(--muted); font-size: .8rem; margin-top: 3px; font-weight: 400; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--teal); }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 12px; }
.choices label { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #c6cdd2; background: #fff; border-radius: 50px; padding: .4em .95em; min-height: 40px; cursor: pointer; }
.choices label:has(input:checked) { background: var(--ink); border-color: var(--ink); color: #fff; }
.choices label:has(input:checked) .muted { color: #cfd6da; }
.choices input { position: absolute; opacity: 0; pointer-events: none; }
.choices label:has(input:focus-visible) { outline: 3px solid #0a66b0; outline-offset: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 6px; }
.formbox { margin-bottom: 12px; }
fieldset.followup:not(:has(#follow:checked)) { border-color: transparent; padding: 0 0 4px; }
fieldset.followup legend { padding: 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px 4px; margin: 0 0 14px; min-width: 0; }
legend { font-weight: 700; padding: 0 6px; }
.suggest { position: relative; }
.suggest ul { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); max-height: 300px; overflow: auto; }
.suggest li button { width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; }
.suggest li button:hover, .suggest li button.on { background: var(--teal-l); }
.chosen { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--teal); background: var(--teal-l); border-radius: 8px; padding: 8px 12px; min-height: 42px; }

/* ---------- dialogs */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
dialog::backdrop { background: rgba(20, 24, 28, .45); }
dialog form, dialog .dlg { padding: 18px 20px 20px; }
dialog h2 { margin-bottom: 12px; }
dialog .close { position: absolute; right: 10px; top: 10px; }

/* ---------- lists */
.rows { list-style: none; margin: 0; padding: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.rows > li { border-top: 1px solid var(--line); }
.rows > li:first-child { border-top: 0; }
.rows a.row, .rows .row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; text-decoration: none; color: inherit; }
.rows a.row:hover { background: #f7fafa; }
.row .main { flex: 1; min-width: 0; }
.row .main strong { display: block; }
.row .sub { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .side { flex: none; text-align: right; font-size: .82rem; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 12px; }
.filters .field { margin: 0; }
.filters .field input, .filters .field select { min-height: 38px; padding: .35em .6em; }
.pager { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }

/* ---------- tasks */
.taskgroup { margin-bottom: 18px; }
.taskgroup > h2 { display: flex; align-items: baseline; gap: 8px; font-size: 1rem; margin-bottom: 8px; }
.taskgroup.overdue > h2 { color: var(--red); }
details.taskgroup > summary { list-style: none; cursor: pointer; }
details.taskgroup > summary::-webkit-details-marker { display: none; }
details.taskgroup > summary h2::before { content: '▸'; color: var(--muted); }
details.taskgroup[open] > summary h2::before { content: '▾'; }
details.taskgroup > summary h2 { display: flex; align-items: baseline; gap: 8px; font-size: 1rem; margin-bottom: 8px; }
.task { display: flex; align-items: flex-start; gap: 12px; padding: 11px 14px; }
.task .tick { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #9aa4aa; background: #fff; margin-top: 1px; padding: 0; }
.task .tick:hover { border-color: var(--green); background: var(--green-l); }
.task.done .tick { background: var(--green); border-color: var(--green); }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.task .title { font-weight: 600; }
.task .meta { font-size: .83rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 2px; }
.task .due { font-weight: 600; }
.task .due.late { color: var(--red); }
.task .due.today { color: var(--amber); }
.task .tools { margin-left: auto; display: flex; gap: 4px; flex: none; }
.counts { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.count { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; min-width: 120px; box-shadow: var(--shadow); }
.count b { display: block; font-size: 1.5rem; line-height: 1.1; }
.count.bad b { color: var(--red); }
.count span { font-size: .8rem; color: var(--muted); }

/* ---------- the client page */
.clienthead { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.clienthead h1 { margin: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: .9rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.flag { border-radius: var(--r); padding: 8px 12px; margin: 10px 0 0; font-size: .88rem; font-weight: 600; }
.flag.noemail { background: var(--red-l); color: var(--red); }
.flag.nobulk { background: var(--amber-l); color: var(--amber); }
.flag.check { background: #e8f0fe; color: #1a4fa0; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.person { padding: 10px 0; border-top: 1px solid var(--line); }
.person:first-of-type { border-top: 0; padding-top: 4px; }
.person .name { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.person .lines { font-size: .87rem; color: var(--muted); }
.person .lines a { color: var(--ink); }
.sidehead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.sidehead h2 { margin: 0; }
.svctabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 2px solid var(--line); margin: 0 0 14px; scrollbar-width: thin; }
.svctabs button { border: 0; background: none; padding: 10px 14px; border-bottom: 3px solid transparent; margin-bottom: -2px; font-weight: 600; color: var(--muted); white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; }
.svctabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--dot, var(--teal)); }
.svctabs .n { background: #eceff1; border-radius: 50px; font-size: .72rem; padding: 0 .55em; color: var(--muted); }
.svctabs .n.open { background: var(--amber-l); color: var(--amber); }
.addbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.entry { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--dot, var(--general)); border-radius: var(--r); padding: 12px 14px; margin-bottom: 10px; }
.entry .top { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: .82rem; color: var(--muted); }
.entry .top .kind { font-weight: 700; color: var(--ink); }
.entry .top .tools { margin-left: auto; display: flex; gap: 2px; }
.entry .subject { font-weight: 700; margin: 6px 0 2px; }
.entry .body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 6px; }
.entry .body.clamp { max-height: 12em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.entry .more { margin-top: 4px; }
.entry .files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.file { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: .84rem; text-decoration: none; color: var(--ink); background: #fafbfb; }
.file:hover { border-color: var(--teal); }
.history li { padding: 8px 0; border-top: 1px solid var(--line); font-size: .88rem; }
.history li:first-child { border-top: 0; }

/* ---------- search */
.results h2 { font-size: 1rem; margin: 18px 0 8px; }
mark { background: #fff1a8; color: inherit; padding: 0 1px; border-radius: 2px; }

/* ---------- sign-in */
.signin { max-width: 460px; margin: 6vh auto; padding: 0 16px; }
.signin .card { padding: 24px 26px; }
.ms-btn { display: inline-flex; align-items: center; gap: 12px; background: #fff; color: #3a3a3a; border: 1px solid #8c8c8c; border-radius: 4px; padding: 0 16px; min-height: 44px; font-family: "Segoe UI", system-ui, sans-serif; font-weight: 600; font-size: 15px; text-decoration: none; }
.ms-btn:hover { background: #f3f3f3; }
.steps { padding-left: 1.2em; } .steps li { margin-bottom: 10px; }
.qr { margin: 10px 0; width: 220px; height: 220px; background: #fff; }
.qr svg { width: 100%; height: 100%; }
.setup-key { font-family: ui-monospace, Menlo, monospace; font-size: 1.05rem; letter-spacing: .05em; word-break: break-all; }
.code-input { font-size: 1.4rem !important; letter-spacing: .3em; text-align: center; max-width: 220px; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; font-family: ui-monospace, Menlo, monospace; font-size: 1.05rem; background: #fafbfb; border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin-bottom: 12px; }
.alt { margin: 10px 0 0; font-size: .9rem; }

/* ---------- the quick call form (a phone, in under a minute) */
.quick { max-width: 640px; }

/* ---------- import */
.stage { display: flex; gap: 10px; align-items: center; padding: 6px 0; }
.stage .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; background: #eceff1; color: var(--muted); flex: none; }
.stage.done .dot { background: var(--green); color: #fff; }
.stage.now .dot { background: var(--teal); color: #fff; }
.bar-out { height: 8px; background: #eceff1; border-radius: 50px; overflow: hidden; margin: 6px 0 10px; }
.bar-in { height: 100%; background: var(--teal); width: 0; transition: width .3s; }
table.plain { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.plain th, table.plain td { text-align: left; padding: 7px 8px; border-top: 1px solid var(--line); vertical-align: top; }
table.plain th { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; border-top: 0; }
table.plain select { font: inherit; padding: 4px 6px; border-radius: 6px; border: 1px solid #aeb8bf; }
.scroll { overflow-x: auto; }

@media print { .topbar, .addbar, .tools, .actions { display: none !important; } body { background: #fff; } .card, .entry { box-shadow: none; } }
