/* Flare Portal UI. Self-hosted fonts (no third-party requests), no inline styles (strict CSP). */
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/IBMPlexSans-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/IBMPlexSans-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/IBMPlexSans-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/IBMPlexMono-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --ink: #17211F; --ink-2: #2E3A37; --muted: #5B6663; --line: #E3E7E4; --line-2: #EEF1EF; --field: #C9D1CD;
  --ground: #F4F6F4; --surface: #FFFFFF;
  --accent: #0E6B5C; --accent-ink: #0A4F44; --accent-soft: #E3F1EE;
  --crit: #8F1D14; --crit-bg: #FDECEA; --crit-line: #B42318;
  --high: #8A3A06; --high-bg: #FEF0E2;
  --med: #2D4760; --med-bg: #EAF0F6;
  --low: #3D4744; --low-bg: #EEF1EF;
  --radius: 12px; --radius-s: 8px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); } a:hover { color: var(--accent-ink); }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #5FB3A5; outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
.boot { padding: 48px; color: var(--muted); }
.mono { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-s { display: flex; flex-direction: column; gap: 6px; }
.stack-l { display: flex; flex-direction: column; gap: 24px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row-between { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.grid-wide { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.split > .main-col { flex: 999 1 420px; min-width: 0; }
.split > .side-col { flex: 1 1 280px; min-width: 0; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card.pad-l { padding: 24px; }
.card.soft { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.card.soft h3, .card.soft h2 { color: var(--accent-ink); }
.card.danger { border-color: #F2C3BE; }
.section-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--radius-s); border: 1px solid var(--field); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: #A9B3AF; color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #FFFFFF; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }
.btn.danger { border-color: var(--crit-line); color: var(--crit); }
.btn.danger.solid { background: var(--crit-line); color: #FFFFFF; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: none; background: transparent; border-radius: var(--radius-s); cursor: pointer; }
.icon-btn:hover { background: var(--line-2); }

/* Forms */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
.input, select.input, textarea.input { min-height: 44px; padding: 0 12px; border: 1px solid var(--field); border-radius: var(--radius-s); background: var(--surface); font-size: 15px; font-weight: 400; width: 100%; }
textarea.input { padding: 10px 12px; min-height: 88px; resize: vertical; }
.input.code { font-family: var(--mono); letter-spacing: 0.2em; font-size: 20px; text-align: center; max-width: 240px; }
.input.mono { font-family: var(--mono); font-size: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.5; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }
.hint { font-size: 13px; color: var(--muted); font-weight: 400; }
.error { padding: 12px 14px; border-radius: var(--radius-s); background: var(--crit-bg); color: var(--crit); font-size: 14px; }
.notice { padding: 12px 14px; border-radius: var(--radius-s); background: var(--accent-soft); color: var(--accent-ink); font-size: 14px; }
.warn { padding: 12px 14px; border-radius: var(--radius-s); background: var(--high-bg); color: var(--high); font-size: 14px; }

/* Pills */
.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; flex: none; }
.pill.critical { background: var(--crit-bg); color: var(--crit); }
.pill.high { background: var(--high-bg); color: var(--high); }
.pill.medium { background: var(--med-bg); color: var(--med); }
.pill.low, .pill.neutral { background: var(--low-bg); color: var(--low); font-weight: 500; }
.pill.ok { background: var(--accent-soft); color: var(--accent-ink); }

/* Auth pages */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-box { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; }
.brand svg { flex: none; }
.auth-foot { font-size: 13px; color: var(--muted); text-align: center; }

/* App shell */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side { flex: 1 1 220px; max-width: 260px; padding: 24px 16px; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.side .ws { display: flex; flex-direction: column; padding: 0 8px 18px; gap: 2px; }
.side .ws select { border: none; padding: 0; font-size: 12px; color: var(--muted); background: transparent; min-height: 24px; max-width: 200px; }
.nav-link { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: var(--radius-s); color: var(--ink-2); text-decoration: none; font-size: 14px; }
.nav-link:hover { background: var(--line-2); color: var(--ink); }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 500; }
.nav-sep { height: 1px; background: var(--line); margin: 12px 8px; }
.side-foot { margin-top: auto; padding: 16px 12px 0; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.content { flex: 999 1 560px; min-width: 0; padding: 32px clamp(16px, 4vw, 48px) 64px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; }
.narrow { max-width: 980px; width: 100%; }
@media (max-width: 760px) {
  .side { max-width: none; flex-basis: 100%; border-right: none; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; padding: 12px; }
  .side .ws { flex-basis: 100%; padding-bottom: 8px; }
  .side .nav-sep, .side-foot { display: none; }
  .nav-link { min-height: 40px; }
}

/* Overview */
.score { display: flex; align-items: center; gap: 20px; }
.score svg { flex: none; }
.finding { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 76px; padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; }
.finding:hover { border-color: #C9D1CD; }
.finding[aria-pressed="true"] { border: 2px solid var(--accent); padding: 15px 17px; }
.finding .body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.finding .title { font-size: 15px; font-weight: 500; }
.finding .accepted { opacity: 0.75; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--accent); }
.status-dot.off { background: transparent; border: 2px solid #A9B3AF; }
.status-dot.err { background: var(--crit-line); }
.status-dot.warn { background: #D9822B; padding: 0; border: 0; margin: 0; }
a.sys { text-decoration: none; color: inherit; }
a.sys:hover strong { text-decoration: underline; }
.sys { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.sys .body { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Steps */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.steps li { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border-radius: 999px; font-size: 13px; background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
.steps li.cur { background: var(--accent); color: #FFFFFF; border-color: var(--accent); font-weight: 500; }
.steps li.done { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.choice { text-align: left; min-height: 140px; padding: 20px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: flex; flex-direction: column; gap: 8px; }
.choice[aria-pressed="true"] { border: 2px solid var(--accent); padding: 19px; }
.choice .name { font-size: 17px; font-weight: 600; }

/* Tables and lists */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t thead th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; border-bottom-color: var(--line); }
table.t th:first-child, table.t td:first-child { padding-left: 0; }
.list-row { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 12px 0; border-top: 1px solid var(--line-2); align-items: center; }
.list-row:first-child { border-top: none; }
.list-row .grow { flex: 1 1 240px; min-width: 0; }
.kv { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px 16px; padding: 16px; border-radius: 10px; background: var(--ground); font-size: 13px; align-items: center; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; padding: 16px; background: var(--ground); border-radius: 10px; font-family: var(--mono); font-size: 15px; }
.qr { width: 184px; height: 184px; background: #FFFFFF; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
.toggle-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line-2); }
.toggle-row:first-of-type { border-top: none; }
.toggle-row .grow { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.toggle-row select { width: auto; min-width: 120px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #FFFFFF; padding: 12px 18px; border-radius: 10px; font-size: 14px; z-index: 20; max-width: calc(100vw - 32px); }
.empty { padding: 20px; border: 1px dashed var(--field); border-radius: var(--radius); color: var(--muted); font-size: 14px; }
.spark { display: block; }

.big { font-size: 28px; font-weight: 600; line-height: 1.1; }
a.card { text-decoration: none; color: var(--ink); display: flex; }
a.card:hover { border-color: #C9D1CD; color: var(--ink); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.toggle-row input[type=number] { width: 90px; }
fieldset { border: none; margin: 0; padding: 0; }
legend { padding: 0; margin-bottom: 6px; font-weight: 500; }
ul, ol { margin: 0; padding-left: 20px; }

/* AI assistants: setup snippets and one-time keys */
.code-block { margin: 0; padding: 12px 14px; border-radius: var(--radius-s); background: var(--ground); border: 1px solid var(--line); font: 13px/1.5 "IBM Plex Mono", ui-monospace, monospace; overflow-x: auto; white-space: pre; max-width: 100%; }
.token-text { word-break: break-all; font-size: 13px; padding: 8px 10px; background: var(--ground); border-radius: var(--radius-s); }
