/* Shared by index.html (form) and dashboard.html. Same style as the organigram and the landing page. */
/* Amazon Ember (text) + Ember Display (headings), from Amazon_Typefaces_Complete_Font_Set_Mar2020.zip. */
/* Latin-subset WOFF2 (~72 KB total), made with pyftsubset. */
@font-face { font-family: "Amazon Ember"; src: url("fonts/AmazonEmber_Rg.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Amazon Ember"; src: url("fonts/Amazon-Ember-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Amazon Ember"; src: url("fonts/AmazonEmber_Bd.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Amazon Ember Display"; src: url("fonts/AmazonEmberDisplay_Bd.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }
/* AWS palette only (same as the landing page): dark, orange, and the light tone; surfaces and lines are see-through light. */
:root {
  --bg: #151D26;
  --surface: rgba(246, 250, 255, .04);
  --surface-2: rgba(246, 250, 255, .08);
  --fg: #F6FAFF;
  --muted: rgba(246, 250, 255, .66);
  --line: rgba(246, 250, 255, .28);
  --line-soft: rgba(246, 250, 255, .12);
  --accent: #F7981D;
  --accent-fg: #151D26;
  --accent-text: #F7981D;
  --warn: #F7981D;
  --warn-soft: rgba(247, 152, 29, .12);
  --bad: #FF8A80;
  --bad-soft: rgba(255, 138, 128, .12);
  --font-display: "Amazon Ember Display", "Segoe UI", system-ui, sans-serif;
  --font-body: "Amazon Ember", "Segoe UI", system-ui, sans-serif;
  --font-mono: "Amazon Ember", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }
img, svg, canvas { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
ul, ol { list-style: none; }
/* The landing page's square tile grid, as a still background. */
body { background: linear-gradient(rgba(246,250,255,.03) 1px, transparent 1px) 0 0 / 64px 64px, linear-gradient(90deg, rgba(246,250,255,.03) 1px, transparent 1px) 0 0 / 64px 64px, var(--bg) !important; background-attachment: fixed !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  padding-block: 28px 56px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.page { max-width: 1140px; margin: 0 auto; }
.page--narrow { max-width: 760px; }
[hidden] { display: none !important; }

/* Header */
.top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 32px; margin-bottom: 32px; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-logo { width: 44px; height: 44px; flex: none; display: block; }
h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 5vw, 42px); line-height: 1.05; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
.tally { display: flex; align-items: center; gap: 14px; }
.tally-num { font-family: var(--font-mono); font-weight: 500; font-size: 44px; line-height: 1; font-variant-numeric: tabular-nums; }
.tally-text { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* Cards */
.card {
  position: relative; z-index: 1;
  display: block; width: 100%; min-width: 0;
  text-align: left; font: inherit; color: inherit;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  padding: 9px 12px;
}
button.card { cursor: pointer; padding-right: 28px; }
.card:hover { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
div.card:not([data-tip]):hover, .card.row:hover { border-color: var(--line-soft); box-shadow: none; }
.card.is-dashed:hover { border-color: var(--accent); box-shadow: none; }
.card.is-head:hover { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }
.card.is-head { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.card.is-head .card-meta, .card.is-head .card-desc { color: inherit; opacity: .85; }
.card.is-dashed { border-style: dashed; border-color: var(--line); }
.card-title { font-family: var(--font-display); font-weight: 600; font-size: 14px; line-height: 1.25; overflow-wrap: break-word; }
.card-meta { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.card-desc { font-size: 13px; color: var(--muted); margin-top: 4px; }
.go { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 18px; line-height: 1; }
.is-head .go { color: inherit; }
button.card:focus-visible, .linkbtn:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Motion: colour changes only; the loading spinner is the one animation. */
@media (prefers-reduced-motion: no-preference) {
  .card, .linkbtn, .btn { transition: border-color .15s, background-color .15s, color .15s; }
  .spin { animation: spin .8s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }
}

/* Views */
h2 { font-family: var(--font-display); font-weight: 700; font-size: clamp(24px, 4vw, 34px); line-height: 1.1; letter-spacing: -0.015em; margin: 0; text-wrap: balance; }
h2:focus { outline: none; }
.lead { max-width: 65ch; margin: 8px 0 0; font-size: 15px; }
.sub { margin: 6px 0 0; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.hint { color: var(--muted); font-size: 13px; margin: 20px 0 0; }
.note { max-width: 65ch; margin: 20px 0 0; color: var(--muted); font-size: 14px; }
.linkbtn { font: inherit; font-size: 14px; font-weight: 500; background: none; border: 0; padding: 0; color: var(--accent-text); cursor: pointer; text-decoration: none; }
.linkbtn:hover { text-decoration: underline; }
.choices { margin-top: 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.choices .card { padding: 14px 32px 14px 14px; }

/* Forms */
form { margin: 0; }
.section { margin-top: 28px; padding-top: 20px; border-top: 1px dashed var(--line-soft); }
.section:first-of-type { margin-top: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--wide { grid-column: 1 / -1; }
.field > label, .field > .field-label { font-size: 13px; font-weight: 500; }
.field small { color: var(--muted); font-size: 12px; }
.input {
  width: 100%; min-width: 0;
  font: inherit; font-size: 15px; color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  padding: 9px 12px;
}
select.input option { background: var(--bg); color: var(--fg); }
select.input { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input::placeholder { color: var(--line); }
.input:hover { border-color: var(--line); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.input[aria-invalid="true"] { border-color: var(--bad); }
.input[readonly] { color: var(--muted); background: transparent; border-style: dashed; }

/* File pickers: a dashed card that turns solid once a file is chosen. */
.file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
label.card.file { cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 12px; }
.file:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-thumb { width: 44px; height: 44px; flex: none; border-radius: 2px; background: var(--surface-2) center / cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 11px; font-weight: 600; }
.file.has-file { border-style: solid; border-color: var(--line); }
.file[aria-invalid="true"] { border-color: var(--bad); }

.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; max-width: 70ch; }
.consent input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.consent ul { list-style: disc; margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 24px; }
.btn { font: inherit; font-weight: 600; font-size: 15px; line-height: 1.3; padding: 10px 18px; border-radius: 2px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-fg); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.btn:hover { background: var(--fg); border-color: var(--fg); }
.btn.ghost { background: var(--surface); color: var(--fg); border-color: var(--line-soft); }
.btn.ghost:hover { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.btn.small { font-size: 13px; padding: 5px 11px; }
.btn:disabled { opacity: .55; cursor: progress; transform: none; }
.spin { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; }
.err { color: var(--bad); font-size: 13px; margin: 0; }
.alert { margin: 20px 0 0; padding: 10px 12px; border-radius: 2px; font-size: 14px; background: var(--warn-soft); color: var(--warn); max-width: 70ch; }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.status-msg { font-size: 14px; color: var(--muted); }

/* Dashboard */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin: 0 0 16px; }
.toolbar .input { max-width: 300px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.row { padding: 12px 14px; }
.row-head { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; justify-content: space-between; }
.row details { margin-top: 8px; }
.row summary { cursor: pointer; font-size: 13px; color: var(--accent-text); width: max-content; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 14px; margin: 10px 0 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.empty { padding: 28px 14px; text-align: center; color: var(--muted); }
.export .field { width: 140px; }
.export { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.login { max-width: 400px; }
.login .field { margin-top: 14px; }

/* Dashboard: view tabs and the small inline forms for HC and superadmins. */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.tabs [aria-current] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.inline { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; margin-top: 12px; }
.inline .field { min-width: 140px; flex: 1 1 140px; }
.inline .consent { flex-basis: 100%; }

/* App shell: a left sidebar once signed in, the login card alone before. */
.page { max-width: none; }
body { padding: 0; }
.shell { min-height: 100vh; display: block; padding: 28px 16px 56px; max-width: 520px; margin: 0 auto; }
.shell .side { margin-bottom: 24px; }
.shell--in { max-width: none; display: grid; grid-template-columns: 232px minmax(0, 1fr); padding: 0; }
.side .brand { gap: 12px; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; line-height: 1.15; }
.shell--in .side { position: sticky; top: 0; height: 100vh; margin: 0; padding: 24px 16px; border-right: 1px solid var(--line-soft); background: rgba(21, 29, 38, .86); display: flex; flex-direction: column; gap: 28px; }
.shell--in .main { padding: 32px clamp(16px, 3vw, 40px) 64px; min-width: 0; max-width: 1180px; }
.brand-logo { width: 36px; height: 36px; }
.nav { display: grid; gap: 2px; }
.nav-item { text-align: left; font: inherit; font-size: 14px; font-weight: 500; color: var(--muted); background: none; border: 0; border-left: 3px solid transparent; padding: 9px 12px; cursor: pointer; }
.nav-item:hover { color: var(--fg); background: var(--surface); }
.nav-item[aria-current=page] { color: var(--fg); background: var(--surface-2); border-left-color: var(--accent); }
.nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.who { margin-top: auto; display: grid; gap: 4px; justify-items: start; word-break: break-all; }
@media (max-width: 760px) {
  .shell--in { display: block; }
  .shell--in .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .nav { display: flex; }
  .nav-item { border-left: 0; border-bottom: 3px solid transparent; }
  .nav-item[aria-current=page] { border-bottom-color: var(--accent); }
  .who { margin: 0 0 0 auto; }
  .hide-sm { display: none; }
}

.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.page-head .sub { max-width: 70ch; }

/* Counts that double as the review filter */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { text-align: left; font: inherit; color: inherit; cursor: pointer; display: grid; gap: 2px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line-soft); border-top: 3px solid var(--line); }
.stat--pending { border-top-color: var(--accent); }
.stat--approved { border-top-color: #7bd88f; }
.stat--invalid { border-top-color: var(--bad); }
.stat:hover { border-color: var(--line); }
.stat[aria-pressed=true] { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--fg); }
.stat:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stat-num { font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13px; color: var(--muted); }
.toolbar { margin-bottom: 12px; max-width: 420px; }

/* Table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tr { cursor: pointer; }
.tr:hover td { background: var(--surface-2); }
.tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.table tbody tr:last-child td { border-bottom: 0; }
.cell-main { display: block; font-weight: 600; }
.cell-sub { display: block; font-size: 12px; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.dots { display: flex; gap: 4px; }
.dot { font-size: 11px; font-weight: 600; padding: 1px 6px; border: 1px dashed var(--line); color: var(--line); }
.dot--on { border: 1px solid var(--line); color: var(--fg); background: var(--surface-2); }
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border: 1px solid var(--line); white-space: nowrap; }
.chip--pending { color: var(--accent-text); border-color: var(--accent); background: var(--warn-soft); }
.chip--approved { color: #7bd88f; border-color: #7bd88f; background: rgba(123, 216, 143, .1); }
.chip--invalid { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); }
.empty-state { padding: 40px 16px; text-align: center; color: var(--muted); }

/* Dialogs: a right-hand panel for a person, a centered one for adding */
dialog { margin: auto; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; padding: 0; border: 1px solid var(--line); background: var(--bg); color: var(--fg); }
dialog::backdrop { background: rgba(10, 14, 19, .72); }
dialog.drawer { margin: 0 0 0 auto; width: min(480px, 100vw); height: 100vh; max-height: none; border-width: 0 0 0 1px; }
.drawer-head { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 20px 24px; background: var(--bg); border-bottom: 1px solid var(--line-soft); }
.drawer-head h3, .dlg-body h3 { margin: 0; font-family: var(--font-display); font-size: 20px; line-height: 1.2; }
.drawer-body { padding: 8px 24px 32px; }
.panel { padding: 20px 0; border-bottom: 1px dashed var(--line-soft); }
.panel:last-child { border-bottom: 0; }
.dlg-body { padding: 24px; display: grid; gap: 16px; }
.choices { margin-top: 0; display: grid; gap: 8px; grid-template-columns: 1fr; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line-soft); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--warn-soft); }
.choice:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice input, .reasons input { accent-color: var(--accent); margin-top: 3px; }
.reasons { border: 0; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.reasons[hidden] { display: none; }
.panel .actions { margin-top: 16px; }

.page-head { flex-wrap: nowrap; align-items: center; }
.page-head > div { min-width: 0; }
.page-head .btn { flex: none; }
.cell-main { white-space: nowrap; }
@media (max-width: 1100px) { .hide-md { display: none; } }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .page-head { flex-wrap: wrap; } }

.meter { display: block; width: 100%; min-width: 120px; height: 8px; background: var(--surface-2); }
.meter > span { display: block; height: 100%; background: var(--accent); }
.role-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel .grid { margin-top: 12px; }

/* The open list of a select is painted from these: solid colours, because the translucent field colour shows the browser's white behind it. */
select.input { background-color: #1a222c; color: #F6FAFF; color-scheme: dark; }
select.input option, select.input optgroup { background-color: #1a222c; color: #F6FAFF; }
select.input option:checked { background-color: #F7981D; color: #151D26; }

/* Notifications: count on the bell, list in a side panel */
.badge { display: inline-block; min-width: 20px; margin-left: 6px; padding: 1px 6px; border-radius: 10px; background: var(--accent); color: var(--accent-fg); font-size: 12px; font-weight: 700; line-height: 18px; text-align: center; }
.badge[hidden] { display: none; }
.notif-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.notif-item { display: grid; gap: 2px; width: 100%; text-align: left; font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line); padding: 12px 14px; cursor: pointer; }
.notif-item:hover { border-color: var(--accent); }
.notif-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.install { margin: 0; }
.update { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px); padding: 10px 12px 10px 16px; background: var(--bg); border: 1px solid var(--accent); font-size: 14px; }
