/* CRM colour tokens match the Blue staging theme. All navigation works without JS. */
:root {
  color-scheme: dark;
  --bg: #10151d;
  --surface: #1a2230;
  --line: #3f4e62;
  --accent: #90b8ff;
  --muted: #aeb9cb;
  --text: #f5f7fb;
  background: var(--bg);
  color: var(--text);
  font: 100%/1.55 system-ui, "Segoe UI", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; overflow-wrap: anywhere; }
header { background: #121923; border-bottom: 1px solid var(--line); }
.mast, nav, main { max-width: 66rem; margin-inline: auto; padding-inline: clamp(1rem, 4vw, 3rem); }
.mast { display: flex; gap: .9rem; align-items: center; flex-wrap: wrap; padding-block: 1rem; }
.mast small { margin-inline-start: auto; }
.mast form, .mast button { margin: 0; }
.mast button { color: var(--accent); background: transparent; border: 1px solid var(--line); }
.mark { font-size: 1.6rem; font-weight: 800; letter-spacing: .07em; line-height: 1; }
.mark span { font-size: .85rem; letter-spacing: .12em; color: var(--accent); }
main { padding-block: clamp(1.4rem, 4vw, 3rem) 4rem; }
h1, h2, h3 { line-height: 1.2; }
h1 { font-size: clamp(1.9rem, 5vw, 3rem); margin: 0 0 1.5rem; letter-spacing: -.035em; }
h2 { margin: 1.6rem 0 .8rem; font-size: 1.35rem; }
h3 { margin: .5rem 0; }
.panel h2, .panel h3 { margin-block: .35rem; }
small, .mono, .metric span, dt { color: var(--muted); }
small, .mono { font-size: .875rem; }
.mono { font-family: ui-monospace, Consolas, monospace; }
nav { display: flex; gap: .2rem; }
a { color: var(--accent); text-underline-offset: .18em; }
nav a, .subnav a, .page-links a, .actions a {
  display: inline-flex; min-height: 44px; align-items: center;
  padding: .55rem .8rem; border-radius: .45rem; text-decoration: none;
}
nav a { color: var(--muted); border-bottom: 3px solid transparent; border-radius: 0; }
nav a[aria-current] { color: var(--text); border-bottom-color: var(--accent); }
nav a:hover, .subnav a:hover, .actions a:hover { background: var(--surface); }
.subnav, .page-links, .actions { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.subnav { margin: .75rem 0 1.25rem; border-bottom: 1px solid var(--line); }
.panel, .metric, .filters, .empty {
  padding: clamp(1rem, 2.8vw, 1.6rem); border: 1px solid var(--line);
  border-radius: .95rem; margin: .75rem 0; background: var(--surface);
}
.gate, main > form { max-width: 35rem; }
.gate p:first-child { margin-top: 0; }
.gate input[name=code] { max-width: 14rem; font-variant-numeric: tabular-nums; letter-spacing: .16em; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(12rem,100%),1fr)); gap: .7rem; margin-block: 1.5rem; }
.metric { display: flex; flex-direction: column; justify-content: space-between; gap: .8rem; min-height: 7rem; margin: 0; text-decoration: none; background: linear-gradient(135deg, #202d40, var(--surface)); }
.metric:first-child { border-color: #587cae; background: linear-gradient(135deg, #273d5c, var(--surface)); }
.metric strong { font-size: clamp(1.4rem, 4vw, 2.25rem); letter-spacing: -.03em; color: var(--text); }
.metric:hover { border-color: var(--accent); }
.person { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.person small { display: block; }
.empty { border-style: dashed; color: var(--muted); }
label { display: grid; gap: .35rem; font-size: .95rem; margin-bottom: .8rem; }
input, textarea, select, button { font: inherit; }
input, select, textarea {
  width: 100%; min-width: 0; min-height: 44px; padding: .65rem .75rem;
  color: var(--text); background: var(--bg); border: 1px solid #718199; border-radius: .55rem;
}
textarea { resize: vertical; }
button { min-height: 44px; border: 0; border-radius: .55rem; cursor: pointer; padding: .65rem 1rem; font-weight: 650; color: #101c30; background: var(--accent); }
button:hover { filter: brightness(1.12); }
summary { cursor: pointer; padding: .6rem 0; min-height: 44px; color: var(--accent); }
details[open] summary { margin-bottom: .6rem; }
.fields { display: grid; gap: .1rem .8rem; grid-template-columns: repeat(auto-fit, minmax(min(13rem,100%),1fr)); }
.filters { background: transparent; margin-bottom: 1.2rem; }
dl { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.4fr); }
dd, dt { margin: 0; padding: .6rem .2rem; border-bottom: 1px solid var(--line); }
dd { font-weight: 600; }
[role=alert] { color: #ffb4b4; }
.skip { position: absolute; left: .5rem; top: -10rem; padding: .6rem; background: var(--surface); z-index: 10; }
.skip:focus { top: .25rem; }
:focus-visible { outline: 3px solid #b8d5ff; outline-offset: 3px; }
@media (max-width: 44rem) {
  html { scroll-padding-bottom: 5rem; }
  main { max-width: 42.5rem; padding-bottom: calc(6.5rem + env(safe-area-inset-bottom)); }
  nav {
    position: fixed; inset: auto 0 0; z-index: 2; justify-content: space-around; gap: 0;
    padding: .25rem .1rem calc(.25rem + env(safe-area-inset-bottom)); background: #121923;
    border-top: 1px solid var(--line); box-shadow: 0 -4px 16px #0003;
  }
  nav a { justify-content: center; text-align: center; flex: 1; font-size: .875rem; padding: .45rem .15rem; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .metric { padding: .9rem; min-height: 6.5rem; }
  .mast small { flex: 1; text-align: right; }
  .panel, .filters { padding: 1rem; }
}
@media (max-width: 24rem) { nav a { font-size: .8rem; } .mast { gap: .55rem; } }
@media (forced-colors: active) { a, button, summary, .metric { border: 1px solid LinkText; } }
