/* Sign-in, consent and account pages. Same system as the audit console: hairlines, one accent, quiet surfaces. */
/* Self-hosted so the pages look the same on every device. Both fonts are SIL OFL 1.1; the licences sit beside the files. */
@font-face { font-family: "Inter"; src: url("fonts/inter-var.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono-var.woff2") format("woff2"); font-weight: 100 800; font-style: normal; font-display: swap; }

:root {
  --app: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #fafafb;
  --hover: rgb(15 18 25 / 0.045);
  --ink: #1a1b1e;
  --ink-2: #3b3f47;
  --muted: #6c717b;
  --faint: #9a9ea8;
  --line: #ececef;
  --line-strong: #dcdde2;
  --accent: #5261d4;
  --accent-soft: #eef0fc;
  --btn: #5261d4;
  --btn-hover: #4654c2;
  --btn-ink: #ffffff;
  --ok: #1f8f55;
  --ok-soft: #edf8f1;
  --danger: #cf3f36;
  --danger-soft: #fdf1f0;
  --danger-line: #f5cfcb;
  --warn: #a96500;
  --warn-soft: #fff7e8;
  --shadow-sm: 0 1px 1px rgb(15 18 25 / 0.04);
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --font: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
/* Dark is the default. Light applies only when the person picks it; theme.js sets data-theme before first paint. */
:root:not([data-theme="light"]) {
  --app: #08090a; --panel: #0f1011; --panel-2: #141517; --hover: rgb(255 255 255 / 0.05);
  --ink: #f2f3f5; --ink-2: #c9ccd2; --muted: #8b8f98; --faint: #62666f;
  --line: #1e2024; --line-strong: #2b2e34;
  --accent: #8a95f2; --accent-soft: #1a1d38;
  --btn: #5e6ad8; --btn-hover: #6b77e2; --btn-ink: #ffffff;
  --ok: #4cc38a; --ok-soft: #0f211a;
  --danger: #f0706a; --danger-soft: #271414; --danger-line: #4c2422;
  --warn: #e5b548; --warn-soft: #221b0a;
  --shadow-sm: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--app); color: var(--ink); font: 14px/1.55 var(--font); letter-spacing: -0.006em; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
code { font: 0.86em var(--mono); letter-spacing: 0; background: var(--hover); padding: 1px 5px; border-radius: 4px; color: var(--ink-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 5px; }

/* ---------- Header: brand on the left, the signed-in person on the right, nothing else ---------- */
.top-inner { max-width: 1080px; margin: 0 auto; padding: 0 20px; height: 52px; display: flex; align-items: center; gap: 9px; }
.mark { width: 20px; height: 20px; border-radius: 5px; background: var(--ink); position: relative; flex: none; }
/* A neutral keyhole: the pages belong to MAP, not to any one kind of custodian. */
.mark::before, .mark::after { content: ""; position: absolute; background: var(--app); left: 50%; transform: translateX(-50%); }
.mark::before { width: 6px; height: 6px; border-radius: 50%; top: 5px; }
.mark::after { width: 3px; height: 6px; top: 9px; border-radius: 0 0 1px 1px; }
.custodian { font-weight: 600; font-size: 13.5px; letter-spacing: -0.01em; }
.product { color: var(--muted); font-size: 13px; }
.product::before { content: "/"; color: var(--faint); margin-right: 9px; }
.who { margin-left: auto; display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.who .avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; color: var(--accent); font-size: 10px; font-weight: 600; letter-spacing: 0; }
.who .name { color: var(--ink-2); margin-right: 4px; font-weight: 500; }

/* Overrides the generic button rules above it in specificity, not order, so it is safe to keep here with the header. */
.top .theme-toggle { margin-left: auto; width: 28px; height: 28px; padding: 0; background: none; border: 0; color: var(--muted); border-radius: 6px; }
.top .theme-toggle:hover { background: var(--hover); color: var(--ink); }
.top .who + .theme-toggle { margin-left: 2px; }
/* Theme toggle: shows the sun in dark mode and the moon in light mode, i.e. the theme a click switches to. */
.theme-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .moon { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .moon { display: block; }

/* ---------- Page ---------- */
.page { max-width: 680px; margin: 32px auto 80px; padding: 0 20px; }
.page.center { max-width: 380px; margin-top: 11vh; }
.panel { background: var(--panel); border: 1px solid var(--line-strong); border-radius: 12px; padding: 28px; }
/* Sign-in and message pages are a bare centered column, not a card. */
.page.center .panel { background: none; border: 0; padding: 0; }
.page.center h1, .page.center .lede { text-align: center; }
.page-head { margin-bottom: 20px; }
h1 { font-size: 20px; line-height: 1.3; margin: 0 0 6px; letter-spacing: -0.022em; font-weight: 600; text-wrap: balance; }
h2 { font-size: 14px; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.lede { color: var(--muted); margin: 0 0 24px; text-wrap: pretty; }
.panel > .lede:last-child { margin-bottom: 0; }
.lede strong { color: var(--ink-2); font-weight: 500; }
.fine { color: var(--muted); font-size: 12.5px; margin: 0; }
.page.center .fine { text-align: center; }
.stack { display: grid; gap: 14px; }
.section-label { font-size: 12.5px; font-weight: 500; color: var(--muted); margin: 0 0 8px; }

/* ---------- Forms ---------- */
label { display: grid; gap: 6px; font-weight: 500; font-size: 12.5px; color: var(--ink-2); }
input[type="text"], input:not([type]), input[type="password"] {
  font: inherit; font-size: 14px; font-weight: 400; height: 36px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 7px;
  background: var(--panel); color: var(--ink); transition: border-color 100ms, box-shadow 100ms;
}
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
button, .button {
  font: inherit; font-size: 13.5px; font-weight: 500; letter-spacing: inherit; border-radius: 7px; height: 34px; padding: 0 14px; cursor: pointer;
  border: 1px solid transparent; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background-color 100ms, border-color 100ms, color 100ms; white-space: nowrap;
}
.button:hover { text-decoration: none; }
.primary { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }
.primary:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
.secondary { background: var(--panel); border-color: var(--line-strong); color: var(--ink-2); box-shadow: var(--shadow-sm); }
.secondary:hover { background: var(--panel-2); color: var(--ink); }
.danger { background: var(--panel); color: var(--danger); border-color: var(--line-strong); height: 28px; padding: 0 10px; font-size: 12.5px; box-shadow: var(--shadow-sm); }
.danger:hover { background: var(--danger-soft); border-color: var(--danger-line); }
.subtle { background: var(--panel); border-color: var(--line-strong); height: 26px; padding: 0 9px; font-size: 12.5px; color: var(--ink-2); box-shadow: var(--shadow-sm); border-radius: 6px; }
.subtle:hover { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.link { background: none; border: 0; padding: 0 8px; height: 28px; color: var(--muted); font-weight: 500; font-size: 13px; border-radius: 6px; }
.link:hover { background: var(--hover); color: var(--ink); }
.block { width: 100%; height: 36px; }
.alert { background: var(--danger-soft); color: var(--danger); padding: 9px 12px; border-radius: 7px; margin: 0; font-size: 13px; font-weight: 400; }
.notice { background: var(--ok-soft); color: var(--ok); padding: 9px 12px; border-radius: 7px; margin: 0 0 16px; font-size: 13px; }
.empty { color: var(--muted); text-align: center; padding: 48px 16px; border: 1px dashed var(--line-strong); border-radius: 10px; }
.empty strong { display: block; color: var(--ink); font-weight: 500; margin-bottom: 2px; }

/* ---------- Request banner on sign-in ---------- */
.request { display: flex; gap: 11px; align-items: center; padding: 10px 12px; margin: 0 0 20px; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 9px; font-size: 13px; color: var(--muted); text-align: left; }
.app-icon { width: 30px; height: 30px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 600; font-size: 13px; letter-spacing: 0; flex: none; }
.request strong { color: var(--ink); font-weight: 500; }

/* ---------- Consent ---------- */
.consent-head { display: flex; gap: 14px; align-items: center; margin-bottom: 24px; }
.consent-head .app-icon { width: 40px; height: 40px; border-radius: 10px; font-size: 16px; }
.consent-head h1 { font-size: 18px; margin-bottom: 2px; }
.consent-head .lede { margin: 0; font-size: 13.5px; }

.categories { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; }
.category + .category { border-top: 1px solid var(--line); }
.cat-head { display: grid; grid-template-columns: 16px 1fr; gap: 12px; padding: 14px 16px; font-weight: 400; font-size: 14px; color: var(--ink); cursor: pointer; transition: background-color 100ms; }
.category:not(.fixed) .cat-head:hover { background: var(--hover); }
.category.fixed .cat-head { cursor: default; }
.cat-head input { width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--btn); cursor: pointer; }
.check-fixed { width: 16px; height: 16px; margin-top: 3px; border-radius: 4px; background: var(--faint); position: relative; }
.check-fixed::after { content: ""; position: absolute; left: 5.5px; top: 2.5px; width: 3.5px; height: 8px; border: solid var(--panel); border-width: 0 1.75px 1.75px 0; transform: rotate(45deg); }
.cat-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cat-name { font-weight: 500; }
.cat-desc { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; text-wrap: pretty; }
.cat-meta { display: block; color: var(--faint); font-size: 12px; margin-top: 6px; }
.tag { display: inline-flex; align-items: center; height: 20px; font-size: 11.5px; font-weight: 500; padding: 0 7px; border-radius: 5px; background: var(--hover); color: var(--muted); white-space: nowrap; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.state { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--faint); }
.state.on { color: var(--ink-2); }
.state.on::before { background: var(--ok); box-shadow: none; }
.purpose-note { display: block; margin-top: 12px; padding: 11px 13px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; color: var(--muted); }
.purpose-note .lead { display: block; font-weight: 500; color: var(--ink); margin-bottom: 1px; }
.purposes { display: grid; gap: 6px; margin: 9px 0; color: var(--ink-2); }
.purposes span { display: block; }
.purposes b { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: 0; color: var(--ink); background: var(--hover); border-radius: 4px; padding: 1px 5px; margin-right: 4px; }
.purpose-note .after { display: block; font-size: 12.5px; }

.assurance { display: flex; gap: 9px; align-items: flex-start; margin: 18px 0 0; color: var(--muted); font-size: 12.5px; }
.assurance svg { flex: none; margin-top: 2px; color: var(--faint); width: 14px; height: 14px; }
/* Allow stays first in the DOM so it remains the form's default button; row-reverse puts it on the right. */
.decision { display: flex; flex-direction: row-reverse; justify-content: flex-start; gap: 8px; margin-top: 22px; }

/* ---------- Account ---------- */
.consent { background: var(--panel); border: 1px solid var(--line-strong); border-radius: 10px; margin-top: 12px; overflow: hidden; }
.consent.ended .consent-title h2, .consent.ended table { opacity: 0.6; }
.consent header { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line); }
.consent-title { display: flex; gap: 11px; align-items: center; min-width: 0; }
.consent-title .fine { font-size: 12px; }
/* Fixed columns so the rows of every card line up with each other. */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; table-layout: fixed; }
thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
td { text-align: left; height: 42px; padding: 0 16px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr:first-child td { border-top: 0; }
col.c-what { width: 24%; }
col.c-status { width: 14%; }
col.c-act { width: 112px; }
td.what { font-weight: 500; }
td.when { color: var(--muted); white-space: nowrap; font-size: 13px; }
td.act { text-align: right; padding-right: 12px; }
td .fine { font-size: 12px; color: var(--faint); font-weight: 400; margin-left: 4px; }

/* ---------- Home ---------- */
.endpoints { border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel); margin-bottom: 12px; }
.endpoint { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 0 16px; min-height: 42px; font-size: 13.5px; }
.endpoint + .endpoint { border-top: 1px solid var(--line); }
.endpoint span { color: var(--muted); }
.endpoint code { background: none; padding: 0; color: var(--ink); font-size: 12.5px; }
.home-links { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.home-link { display: grid; gap: 2px; align-content: start; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--ink); background: var(--panel); transition: border-color 100ms, background-color 100ms; }
.home-link:hover { text-decoration: none; background: var(--panel-2); }
.home-link strong { font-weight: 500; display: flex; justify-content: space-between; }
.home-link strong::after { content: "→"; color: var(--faint); font-weight: 400; }
.home-link span { color: var(--muted); font-size: 13px; }

@media (max-width: 600px) {
  .top-inner { padding: 0 16px; }
  .product { display: none; }
  .who .name { display: none; }
  .page { padding: 0 12px; margin-top: 12px; }
  .page.center { padding: 0 20px; margin-top: 7vh; }
  .panel { padding: 20px 16px; border-radius: 10px; }
  .consent-head { align-items: flex-start; }
  .cat-head { padding: 13px 14px; }
  .decision { flex-direction: column; }
  .decision button { width: 100%; height: 38px; }
  .consent header { flex-wrap: wrap; }
  td { padding: 8px 12px; height: auto; }
  col.c-what { width: 32%; }
  col.c-status { width: 0; }
  col.c-act { width: 104px; }
  td.when { white-space: normal; }
  td.status { padding: 0; overflow: hidden; font-size: 0; }
  td.status .state { display: none; }
  .home-links { grid-template-columns: 1fr; }
  .endpoint { flex-direction: column; align-items: flex-start; gap: 0; padding: 10px 14px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
