:root {
  color-scheme: light dark;
  --bg: #edf1f4; --fg: #172b3a; --muted: #506371; --accent: #165c9c;
  --card: #fff; --line: #c8d2da; --on-accent: #fff;
  --rail: #233746; --rail-fg: #f4f7fa; --rail-active: #395365;
  --pass: #166443; --amber: #875000; --fail: #ad292f;
  --pass-bg: #e6f3eb; --amber-bg: #fff1d4; --fail-bg: #fce9ea;
  --erp: #246caa; --hr: #278055; --ops: #a4690b; --rv: #7956af; --neutral: #71808a;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18232c; --fg: #edf3f7; --muted: #b1c1cd; --accent: #99caff;
    --card: #22323e; --line: #506370; --on-accent: #142a3c;
    --rail: #1c2e3b; --rail-active: #3b5669;
    --pass: #8cddb1; --amber: #ffd085; --fail: #ffadb1;
    --pass-bg: #254536; --amber-bg: #493b25; --fail-bg: #4a2d34;
    --erp: #73b6ef; --hr: #78c99a; --ops: #edbb64; --rv: #b99ae8; --neutral: #a2b3bf;
  }
}
* { box-sizing: border-box; }
html { scrollbar-color: var(--muted) var(--bg); }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
::selection { background: var(--accent); color: var(--on-accent); }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
button, input, select { font: inherit; }
input, select { accent-color: var(--accent); caret-color: var(--accent); }
input::placeholder { color: var(--muted); opacity: 1; }
code, pre { font-family: var(--mono); }
h1 { font-size: clamp(1.8rem, 3vw, 2.4rem); line-height: 1.15; letter-spacing: -.025em; margin: 1.5rem 0 .75rem; text-wrap: balance; }
h2 { font-size: 1.25rem; line-height: 1.3; margin: 2rem 0 .75rem; }
h3 { margin: .5rem 0; }
p { margin: .75rem 0; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .75rem 2rem; background: var(--rail); color: var(--rail-fg); }
.brand { max-width: 24ch; font-size: 1.05rem; font-weight: 750; line-height: 1.25; color: var(--rail-fg); text-decoration: none; display: flex; align-items: center; min-height: 44px; }
.lang { display: flex; gap: .75rem; flex-shrink: 0; }
.lang a { display: flex; align-items: center; min-width: 44px; min-height: 44px; color: var(--rail-fg); justify-content: center; }
.lang a[aria-current="true"] { font-weight: 750; text-decoration-thickness: 3px; }
.top :focus-visible, .side :focus-visible { outline-color: var(--rail-fg); }
main { max-width: 1000px; margin: 0 auto; padding: 3rem 2rem; }
.hero { text-align: center; padding: 3rem 0; }
.tagline { color: var(--muted); margin-bottom: 2rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 2rem; max-width: 460px; margin: 1rem auto; }
.card h1 { margin-top: 0; margin-bottom: 1.5rem; }
.card.wide { max-width: 760px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .65rem 1.25rem; border: 1px solid transparent; border-radius: 6px; background: var(--accent); color: var(--on-accent); text-decoration: none; font-weight: 700; cursor: pointer; }
.button:hover { text-decoration: underline; text-underline-offset: .2em; }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .6; cursor: not-allowed; }
.button.secondary { background: transparent; color: var(--accent); border-color: var(--accent); }
.button.small { padding: .4rem 1rem; font-size: .95rem; }
.button.danger { background: var(--fail-bg); color: var(--fail); border-color: var(--fail); }
.stack { display: grid; gap: .5rem; }
.stack label { font-weight: 650; margin-top: .75rem; }
.stack input, .inline input, .filters select { min-width: 0; max-width: 100%; min-height: 44px; padding: .6rem .75rem; border: 1px solid var(--muted); border-radius: 6px; background: var(--card); color: var(--fg); }
.stack .button { margin-top: 1rem; }
.login .passkey { display: flex; gap: .6rem; width: 100%; font-size: 1.05rem; min-height: 52px; }
.hint { color: var(--muted); font-size: .9rem; min-height: 1.2em; margin: .5rem 0 0; }
.error, .ok, .warn { font-weight: 650; }
.error { color: var(--fail); }
.ok { color: var(--pass); }
.warn { color: var(--amber); }
.error[role="alert"] { background: var(--fail-bg); padding: .75rem; border: 1px solid var(--fail); border-radius: 6px; }
.divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); margin: 1.5rem 0 .5rem; font-size: .9rem; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.password-field { position: relative; }
.password-field input { width: 100%; padding-right: 3.25rem; }
.eye { position: absolute; top: 0; right: 0; width: 48px; height: 100%; min-height: 44px; display: flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 6px; }
.eye:hover { color: var(--fg); }
.eye .icon-hide, .eye.is-visible .icon-show { display: none; }
.eye.is-visible .icon-hide { display: block; }
main:has(.app) { max-width: none; padding: 0; }
.app { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: calc(100dvh - 68px); }
.side { background: var(--rail); display: flex; flex-direction: column; gap: .5rem; padding: 2rem 1rem; }
.side a { display: flex; align-items: center; min-height: 48px; padding: .65rem 1rem; color: var(--rail-fg); text-decoration: none; border-radius: 4px; }
.side a:hover { background: var(--rail-active); }
.side a[aria-current="page"] { background: var(--rail-active); font-weight: 750; text-decoration: underline; text-decoration-thickness: 2px; }
.content { min-width: 0; width: 100%; max-width: 1200px; padding: 1.5rem 3rem 3rem; }
.userbar { display: flex; justify-content: flex-end; align-items: center; gap: .75rem; flex-wrap: wrap; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.userbar .hint { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 1.5rem 0 2rem; border-block: 1px solid var(--line); }
.kpi { padding: 1rem; display: flex; flex-direction: column; justify-content: space-between; gap: .5rem; border-inline-end: 1px solid var(--line); }
.kpi:first-child { padding-inline-start: 0; }
.kpi:last-child { border: 0; }
.kpi-label { color: var(--muted); font-size: .9rem; }
.kpi-value { font-size: 2rem; font-weight: 750; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-value.small { font-size: 1.1rem; }
.panel { min-width: 0; margin: 2rem 0; }
.panel h2 { margin-top: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 1.5rem; }
.cards .panel { padding: 1.25rem; background: var(--card); border: 1px solid var(--line); border-radius: 8px; margin: 0; }
.list { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .75rem; }
.item { border: 1px solid var(--line); background: var(--card); border-radius: 6px; padding: 1rem 1.25rem; display: grid; gap: .5rem; min-width: 0; }
.item .hint { display: block; margin: 0; }
.inline { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.inline input { flex: 1 1 10rem; }
.stepup { border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: 1rem; }
.state { margin: .5rem 0; }
.muted { color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; margin: 1.5rem 0; }
.filters label { display: grid; gap: .35rem; font-weight: 650; font-size: .9rem; }
.filters select { min-width: 140px; }
.badge { display: inline-block; padding: .15rem .5rem; border-radius: 4px; border: 1px solid var(--muted); font-size: .8rem; font-weight: 650; }
.b-pass { color: var(--pass); background: var(--pass-bg); border-color: var(--pass); }
.b-hold { color: var(--amber); background: var(--amber-bg); border-color: var(--amber); }
.b-needs_fix { color: var(--fail); background: var(--fail-bg); border-color: var(--fail); }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .6rem 1.5rem; padding-block: 1.25rem; border-block: 1px solid var(--line); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; }
.wrap, pre.text { overflow-wrap: anywhere; white-space: pre-wrap; }
pre.text { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 1rem; font-size: .9rem; max-height: 28rem; overflow: auto; }
.content, .card { overflow-wrap: anywhere; }
[class*="zone-"] { --zone: var(--neutral); border-inline-start: 6px solid var(--zone); }
.zone-erp { --zone: var(--erp); }
.zone-hr { --zone: var(--hr); }
.zone-ops { --zone: var(--ops); }
.zone-rv { --zone: var(--rv); }
.cards .project { border-inline-start: 6px solid var(--zone); }
.signage-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2em .4em; font-size: clamp(1.2rem, 2vw, 1.65rem); font-weight: 750; line-height: 1.3; letter-spacing: -.02em; }
.signage-line a { color: var(--fg); }
.signage-line .scope { font-size: .8em; font-weight: 600; }
.signal { padding: .05em .25em; border-radius: 3px; }
.signal-pass { color: var(--pass); background: var(--pass-bg); }
.signal-pending, .signal-hold { color: var(--amber); background: var(--amber-bg); }
.signal-needs_fix { color: var(--fail); background: var(--fail-bg); }
.candidate { display: block; margin-top: .6rem; font-size: .85rem; color: var(--muted); letter-spacing: .01em; }
.detail-plate { background: var(--card); padding: 1.5rem; margin: 1rem 0 1.5rem; }
.detail-plate .signage-line { font-size: clamp(1.5rem, 3vw, 2.4rem); }
.alert { color: var(--amber); background: var(--amber-bg); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 760px) {
  .top { padding: .75rem 1rem; gap: .5rem; }
  .brand { font-size: .95rem; max-width: 19ch; }
  .lang { gap: .25rem; }
  main { padding: 1.5rem 1rem; }
  .app { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .side { flex-direction: row; flex-wrap: wrap; gap: .25rem; padding: .5rem 1rem 1rem; }
  .side a { padding: .5rem .75rem; min-height: 44px; font-size: .9rem; }
  .content { padding: 1rem 1rem 2rem; }
  .userbar { justify-content: space-between; gap: .5rem; }
  .userbar .hint { flex: 1 1 180px; font-size: .8rem; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: .75rem; }
  .kpi:nth-child(2) { border: 0; }
  .kpi:nth-child(3) { padding-inline-start: 0; }
  .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .facts { grid-template-columns: minmax(0, 1fr); gap: .25rem; }
  .facts dt:not(:first-child) { margin-top: .75rem; }
  .item { padding: 1rem; }
  .filters label { flex: 1 1 140px; }
  .card { padding: 1.5rem; margin: .5rem auto; }
  .detail-plate { padding: 1rem; }
}
/* Standalone links keep the same touch target as form and navigation controls. */
.signage-line a, .card p > a, .content p > a, .facts dd > a {
  display: inline-flex; align-items: center; min-height: 44px;
}
.setup-copy { margin-block: 2rem; min-width: 0; }
.setup-copy h3 { overflow-wrap: anywhere; }
.setup-copy pre { max-width: 100%; }
.setup-pages { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; }
.setup-pages a { display: inline-flex; align-items: center; min-height: 44px; }
