/* HC Platform — shared styles for the portal and every app. Apps add their own file for app-specific parts. */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --text: #1b2230;
  --muted: #5d6676;
  --line: #dde1e7;
  --accent: #1f6f78;
  --accent-ink: #ffffff;
  --accent-soft: #e3f1f2;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --warn: #8a5a00;
  --warn-soft: #fff4dc;
  --ok: #1e7a3c;
  --ok-soft: #e5f4ea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121519;
    --surface: #1b1f25;
    --surface-2: #20252c;
    --text: #e8eaee;
    --muted: #a0a8b5;
    --line: #2f3540;
    --accent: #5fb3bb;
    --accent-ink: #0c1a1c;
    --accent-soft: #1c3134;
    --danger: #f2a49c;
    --danger-soft: #3a1f1c;
    --warn: #f0c46b;
    --warn-soft: #3a2f17;
    --ok: #8fd4a5;
    --ok-soft: #1a3324;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 var(--font); background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.hc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hc-muted { color: var(--muted); }
.hc-small { font-size: .875rem; }
[hidden] { display: none !important; }

/* ---- header ---- */
.hc-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.hc-header-in { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.hc-brand { font-weight: 650; color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc-site select, .hc-site-code { font: inherit; font-size: .875rem; padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--text); }
.hc-nav { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: .9375rem; }
.hc-user { color: var(--text); text-decoration: none; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hc-user:hover { text-decoration: underline; }

/* ---- layout ---- */
.hc-main { width: 100%; max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; flex: 1; }
.hc-main.hc-wide { max-width: 1100px; }
.hc-bare .hc-main { display: grid; place-items: start center; padding-top: 8vh; }
.hc-footer { text-align: center; color: var(--muted); font-size: .75rem; padding: 12px; }
.hc-title { margin-bottom: 18px; }
.hc-stack > * + * { margin-top: 16px; }
.hc-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hc-spread { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.hc-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }

/* ---- cards ---- */
.hc-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.hc-bare .hc-card { width: 100%; max-width: 400px; }
.hc-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.hc-section > h2 { margin-bottom: 12px; }

/* ---- banners / messages ---- */
.hc-banner { padding: 10px 16px; font-size: .9375rem; border-bottom: 1px solid var(--line); }
.hc-banner a { color: inherit; font-weight: 600; }
.hc-banner-warn { background: var(--warn-soft); color: var(--warn); }
.hc-banner-danger { background: var(--danger-soft); color: var(--danger); }
.hc-msg { padding: 10px 12px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: .9375rem; }
.hc-msg.ok { background: var(--ok-soft); color: var(--ok); }
.hc-msg.info { background: var(--accent-soft); color: var(--text); }
.hc-empty { color: var(--muted); padding: 24px 0; }

/* ---- forms ---- */
.hc-field { display: block; margin-bottom: 14px; }
.hc-field > span { display: block; font-size: .875rem; font-weight: 600; margin-bottom: 4px; }
.hc-field small { display: block; color: var(--muted); font-size: .8125rem; margin-top: 4px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); }
.hc-field input, .hc-field select, .hc-field textarea, .hc-input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; min-height: 44px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px;
}
.hc-check { display: flex; gap: 8px; align-items: center; margin: 4px 0; }
.hc-check input { width: 18px; height: 18px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0 0 14px; }
legend { font-size: .875rem; font-weight: 600; padding: 0 4px; }

/* ---- buttons ---- */
.hc-btn { font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; }
.hc-btn:hover { background: var(--surface-2); }
.hc-btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.hc-btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.hc-btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.hc-btn-small { min-height: 34px; padding: 4px 10px; font-size: .875rem; }
.hc-btn-block { width: 100%; }
.hc-btn[disabled], .hc-btn[aria-busy="true"] { opacity: .6; cursor: progress; }
.hc-link { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; }

/* ---- sign-in ---- */
.hc-signin h1 { text-align: center; }
.hc-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .875rem; margin: 18px 0; }
.hc-or::before, .hc-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.hc-qr-box { margin-top: 18px; text-align: center; }
.hc-qr { display: inline-block; background: #fff; padding: 10px; border-radius: 8px; margin: 12px 0 8px; line-height: 0; }
.hc-qr img, .hc-qr svg { width: 200px; height: 200px; image-rendering: pixelated; }
.hc-code { display: inline-block; font-size: 1.6rem; letter-spacing: .08em; padding: 0 8px; border-radius: 6px; background: var(--accent-soft); color: var(--text); }
.hc-big-code { font-size: 2.5rem; font-weight: 700; letter-spacing: .15em; text-align: center; padding: 12px; background: var(--accent-soft); border-radius: 10px; margin: 12px 0; }
.hc-recovery { margin-top: 20px; font-size: .875rem; color: var(--muted); }
.hc-recovery summary { cursor: pointer; }
.hc-recovery form { margin-top: 12px; }
.hc-choices { display: flex; gap: 12px; justify-content: center; margin: 16px 0; }
.hc-choices .hc-btn { font-size: 1.6rem; min-width: 76px; min-height: 64px; }

/* ---- portal tiles ---- */
.hc-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.hc-tile { display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; box-shadow: var(--shadow); min-height: 76px; }
.hc-tile:hover { border-color: var(--accent); }
.hc-tile img, .hc-tile-mono { grid-row: 1 / span 2; width: 40px; height: 40px; border-radius: 10px; }
.hc-tile-mono { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 1.15rem; }
.hc-tile-name { font-weight: 650; }
.hc-tile-desc { color: var(--muted); font-size: .8125rem; grid-column: 2; }

/* ---- tables / lists ---- */
.hc-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.hc-table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.hc-table th, .hc-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.hc-table th { font-size: .8125rem; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.hc-table tr:last-child td { border-bottom: 0; }
.hc-table tr.hc-clickable { cursor: pointer; }
.hc-table tr.hc-clickable:hover td { background: var(--surface-2); }
.hc-list { list-style: none; margin: 0; padding: 0; }
.hc-list > li { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.hc-list > li:last-child { border-bottom: 0; }
.hc-pill { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.hc-pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.hc-pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.hc-pill.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.hc-pill.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.hc-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.hc-tabs button { font: inherit; background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 12px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.hc-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.hc-pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; font-size: .875rem; color: var(--muted); }

/* ---- dialog ---- */
dialog.hc-dialog { border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(440px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog.hc-dialog::backdrop { background: rgba(10, 14, 20, .45); }
.hc-dialog-body { padding: 20px; }
.hc-dialog-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px 20px; flex-wrap: wrap; }
.hc-summary { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 10px 0; white-space: pre-wrap; }

/* ---- toast ---- */
.hc-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; z-index: 50; max-width: calc(100vw - 32px); font-size: .9375rem; }
.hc-stepup-note { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; z-index: 60; max-width: calc(100vw - 32px); font-size: .9375rem; }

@media (max-width: 560px) {
  .hc-main { padding: 16px 12px 40px; }
  .hc-card, .hc-section { padding: 16px; }
  .hc-hide-sm { display: none; }
}

/* ---- small layout helpers used by apps ---- */
.hc-grow { flex: 1 1 220px; min-width: 0; }
.hc-row > .hc-input { width: auto; flex: 0 1 auto; }
.hc-row > .hc-grow > .hc-input { width: 100%; }
.hc-section h3 { margin-top: 18px; }
.hc-section .hc-list + .hc-row, .hc-section .hc-msg + .hc-row { margin-top: 12px; }

/* ---- print register: check page ---- */
.hc-banner-ok { background: var(--ok-soft); color: var(--ok); }
.hc-main .hc-banner { border: 0; border-radius: var(--radius); }
.hc-right { text-align: right !important; }
.hc-center { text-align: center; }
.hc-strong { font-weight: 600; }
.hc-kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
.hc-kv dt { color: var(--muted); }
.hc-kv dd { margin: 0; overflow-wrap: anywhere; }
.hc-record { border: 1px dashed var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface); }
.hc-record p { margin: 0 0 6px; overflow-wrap: anywhere; white-space: pre-line; }
.hc-record-blocks > * + * { margin-top: 6px; }
.hc-record-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.hc-record-box { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.hc-record-part { border-bottom: 1px dotted var(--line); padding-bottom: 8px; margin-bottom: 8px; }
.hc-record-part:last-child { border-bottom: 0; border-top: 1px dotted var(--line); padding-top: 8px; margin: 8px 0 0; }
@media (max-width: 560px) { .hc-kv { grid-template-columns: 1fr; } .hc-kv dt { margin-top: 6px; } }

.hc-dialog.hc-dialog-wide { width: min(960px, calc(100vw - 32px)); max-width: none; }

/* ---- hc.dateField: DD/MM/YYYY date box with calendar button and the date read back in words ---- */
.hc-date { display: block; }
.hc-date-row { display: flex; gap: 6px; align-items: center; position: relative; }
.hc-date .hc-date-text { flex: 1 1 auto; min-width: 0; letter-spacing: .02em; }
.hc-date-btn { flex: 0 0 auto; }
.hc-date .hc-date-native { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.hc-date-said { display: block; min-height: 1.2em; margin-top: 2px; color: var(--muted, #555); }
.hc-date-bad .hc-date-text { border-color: var(--danger, #b3261e); }
.hc-date-bad .hc-date-said { color: var(--danger, #b3261e); }

/* ---- hc.qr: on-screen QR codes (white quiet zone, sharp squares) ---- */
.hc-qr { display: block; max-width: 100%; height: auto; background: #fff; image-rendering: pixelated; border-radius: 4px; }

/* ---- People app: HR tab ---- */
.hr-thumb { display: inline-block; width: 32px; height: 32px; border-radius: 50%; object-fit: cover; vertical-align: middle; background: var(--surface-2); }
.hr-thumb-empty { border: 1px dashed var(--line); }
.hr-photo { display: inline-block; width: 72px; height: 72px; border-radius: 12px; object-fit: cover; background: var(--surface-2); }
.dept-roles { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.dept-roles > summary { cursor: pointer; padding: 6px 0; }
.dept-roles .hc-table { margin: 8px 0; }
.dept-check { width: 84px; text-align: center; }
.dept-check input { width: 20px; height: 20px; }
.dept-site th { background: var(--surface-2); font-weight: 600; text-align: left; }
.hc-code-sm { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.hr-crop { display: flex; justify-content: center; }
.hr-crop-canvas { border-radius: 10px; cursor: grab; touch-action: none; background: #ddd; box-shadow: 0 0 0 1px var(--line); }
.hr-crop-canvas:active { cursor: grabbing; }
.hr-crop-zoom { width: 100%; }
.hr-doc-progress { display: block; width: 100%; height: 10px; margin-top: 4px; accent-color: var(--accent, #2563eb); }
.hr-photo { aspect-ratio: 3 / 4; height: auto; width: 60px; }
