/* Fonts are served from this app (the page's security policy allows no outside fonts). Licence: fonts/OFL.txt */
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 500; font-display: swap;
  src: url("/static/fonts/jetbrains-mono-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 500; font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 500; font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("/static/fonts/onest-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("/static/fonts/onest-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("/static/fonts/onest-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Cognexa brand (Brand Book v1.0): Ink for weight, Lapis for action, Signal as a spark.
   Square corners, flat surfaces, one 45° chamfer on large surfaces, Onest + JetBrains Mono. */
:root {
  --ink: #0b1324;
  --graphite: #1c2433;
  --graphite-2: #2a3550;
  --lapis: #2747e8;
  --lapis-hover: #1f3bc9;
  --lapis-300: #7d93ff;
  --lapis-50: #eef1fe;
  --signal: #2ed3b7;
  --white: #fff;
  --paper: #f4f6f9;
  --canvas: #fbfcfd;
  --text: #0b1324;
  --text-2: #3a4458;
  --slate: #5b6475;
  --mist: #8a93a3;
  --mist-on-dark: #c9cfda;
  --fog: #dde1e8;
  --ok: #11804a;      --ok-bg: #e7f4ec;
  --warn: #8a5300;    --warn-bg: #fdf1d8;  --warn-fill: #f5b841;
  --bad: #a9221f;     --bad-bg: #fbe6e5;   --bad-fill: #c9302c;
  --info: #2747e8;    --info-bg: #eef1fe;
  /* old names, kept so nothing that refers to them breaks */
  --navy: var(--ink);
  --muted: var(--slate);
  --line: var(--fog);
  --bg: var(--paper);
  --panel: var(--white);

  --sans: "Onest", "Segoe UI", Arial, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --control: 44px;
  --focus: 0 0 0 2px var(--white), 0 0 0 4px var(--lapis);
  --sidebar: 252px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  display: flex;
  min-height: 100vh;
  font: 400 15px/1.55 var(--sans);
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  font-synthesis: none;
}
::selection { background: var(--lapis-50); color: var(--ink); }

a { color: var(--lapis); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
:focus-visible { outline: none; box-shadow: var(--focus); }
strong, b { font-weight: 600; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--ink);
  color: var(--white);
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 24px 22px 20px; color: var(--white); }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 33px; display: block; }
.brand-name { display: block; font-weight: 600; font-size: 17px; letter-spacing: .12em; line-height: 1.1; }
.brand-sub { display: block; font: 500 10.5px/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase;
  color: var(--signal); margin-top: 4px; }
.nav-toggle { display: none; }

.sidebar nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; scrollbar-width: thin; scrollbar-color: var(--graphite-2) transparent; }
.nav-label { font: 500 10.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--mist);
  padding: 16px 10px 6px; }
.sidebar nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 33px;
  padding: 5px 10px;
  color: var(--mist-on-dark);
  font-size: 14.5px;
}
.sidebar nav a:hover { background: var(--graphite); color: var(--white); text-decoration: none; }
.sidebar nav a.active { background: var(--graphite); color: var(--white); font-weight: 500; }
.sidebar nav a.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; background: var(--signal); }
.sidebar nav a:focus-visible { box-shadow: inset 0 0 0 2px var(--lapis-300); }
.nav-count { margin-left: auto; min-width: 22px; padding: 1px 6px; font: 500 11.5px/1.5 var(--mono); text-align: center;
  background: var(--lapis); color: var(--white); }
.nav-count[hidden] { display: none; }

.sidebar-foot { padding: 14px 22px 20px; border-top: 1px solid var(--graphite-2); font-size: 13px; display: grid; gap: 6px; }
.sidebar-foot .muted, .sidebar-foot a.muted { color: var(--mist); }
.sidebar-foot a { color: var(--mist-on-dark); }
.sidebar-foot a:hover { color: var(--white); }
.health { display: flex; align-items: center; gap: 8px; color: var(--mist-on-dark); }
.health::before { content: ""; width: 8px; height: 8px; flex-shrink: 0; transform: rotate(45deg); background: var(--mist); }
.health.ok::before { background: var(--signal); }
.health.bad::before { background: #ff6b66; }
.health.bad { color: #ffb3b0; }

/* ---------- Main ---------- */
main { flex: 1; min-width: 0; padding: 40px 48px 72px; max-width: 1280px; }
h1 { font-size: 30px; line-height: 1.15; font-weight: 600; letter-spacing: -.02em; margin: 0 0 6px; }
h2 { font-size: 18px; line-height: 1.3; font-weight: 600; letter-spacing: -.01em; margin: 0 0 14px; }
h3 { font-size: 16px; font-weight: 600; margin: 0 0 10px; }
h4 { font: 500 11.5px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--slate); margin: 18px 0 8px; }
h4:first-child { margin-top: 0; }
.subtitle { color: var(--slate); margin: 0 0 28px; max-width: 72ch; }
.muted { color: var(--slate); }
.small { font-size: 13px; }
p { margin: 0 0 12px; }

/* Panels are flat and square. */
.panel {
  background: var(--white);
  border: 1px solid var(--fog);
  padding: 22px 24px;
  margin-bottom: 20px;
}
.panel > h2:first-child, .panel > .row:first-child h2 { margin-bottom: 14px; }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); align-items: start; }

/* KPI tiles carry the Cognexa Corner: one 45° chamfer, top-right. */
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 24px; }
.tile {
  position: relative;
  background: var(--white);
  border: 1px solid var(--fog);
  padding: 16px 18px 18px;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
}
.tile::after {
  content: ""; position: absolute; top: -1px; right: -1px; width: 17px; height: 17px; pointer-events: none;
  background: linear-gradient(to bottom left, transparent calc(50% - .75px), var(--fog) calc(50% - .75px),
    var(--fog) calc(50% + .75px), transparent calc(50% + .75px));
}
a.tile { display: block; color: inherit; text-decoration: none; transition: border-color .12s; }
a.tile:hover { border-color: var(--mist); }
a.tile:hover::after { background: linear-gradient(to bottom left, transparent calc(50% - .75px), var(--mist) calc(50% - .75px),
    var(--mist) calc(50% + .75px), transparent calc(50% + .75px)); }
a.tile:focus-visible { box-shadow: inset 0 0 0 2px var(--lapis); }
.tile .num { font-size: 32px; line-height: 1.15; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile .label { font: 500 11px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--slate); margin-top: 6px; }
.tile.attention .num { color: var(--warn); }
.tile.attention::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--warn-fill); }
.tile .num.small-num { font-size: 18px; line-height: 1.9; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--fog); vertical-align: top; }
th { font: 500 11px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--slate);
  border-bottom-color: var(--ink); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--paper); }
/* Takes the remaining width and cuts long text with an ellipsis instead of widening the table. */
.truncate { max-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--slate); padding: 12px 0; }
th.num, td.num { text-align: right; white-space: nowrap; font-family: var(--mono); font-size: 13.5px; font-variant-numeric: tabular-nums; }
th.num { font-size: 11px; }

/* ---------- Status badges: a diamond plus the word, never colour alone ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  font: 500 11.5px/1.5 var(--mono);
  letter-spacing: .02em;
  background: var(--paper);
  color: var(--slate);
  white-space: nowrap;
  vertical-align: 1px;
}
.badge::before { content: ""; width: 6px; height: 6px; transform: rotate(45deg); background: currentColor; flex-shrink: 0; }
.badge.completed, .badge.approved, .badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.planning, .badge.delegating, .badge.running, .badge.consolidating, .badge.in_progress, .badge.queued { background: var(--info-bg); color: var(--info); }
.badge.blocked, .badge.pending, .badge.needs_migration, .badge.partially_failed { background: var(--warn-bg); color: var(--warn); }
.badge.failed, .badge.rejected, .badge.error, .badge.cancelled, .badge.expired { background: var(--bad-bg); color: var(--bad); }

/* ---------- Forms ---------- */
textarea, select, input, button { font: inherit; color: inherit; }
textarea, select, input:not([type="checkbox"]):not([type="radio"]) {
  min-height: var(--control);
  border: 1px solid #c4cad5;
  border-radius: 0;
  padding: 10px 12px;
  background: var(--white);
  color: var(--text);
  transition: border-color .12s;
}
select { padding-right: 34px; appearance: none; cursor: pointer;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235B6475' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center; }
textarea:hover, select:hover, input:hover { border-color: var(--mist); }
textarea:focus, select:focus, input:focus { outline: none; border-color: var(--lapis); box-shadow: 0 0 0 1px var(--lapis); }
::placeholder { color: var(--mist); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--lapis); margin: 0; }
textarea { width: 100%; min-height: 120px; resize: vertical; line-height: 1.5; }

button, a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control);
  border: 1px solid var(--lapis);
  border-radius: 0;
  padding: 0 20px;
  background: var(--lapis);
  color: var(--white);
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .12s, border-color .12s, color .12s;
}
button:hover, a.button:hover { background: var(--lapis-hover); border-color: var(--lapis-hover); text-decoration: none; }
button.secondary, a.button.secondary { background: var(--white); color: var(--ink); border-color: var(--ink); font-weight: 500; }
button.secondary:hover, a.button.secondary:hover { background: var(--paper); }
button.danger { background: var(--white); color: var(--bad-fill); border-color: var(--bad-fill); font-weight: 500; }
button.danger:hover { background: var(--bad-fill); color: var(--white); }
button:disabled { opacity: .5; cursor: wait; }
button.small, a.button.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
/* Beside a form field, a small button takes the field's height so the row lines up. */
:has(> select, > input:not([type="checkbox"]):not([type="radio"])) > button.small { min-height: var(--control); padding: 0 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.row > h2, .row > h1 { margin-bottom: 0; }
.error { color: var(--bad); }

.form { display: grid; gap: 16px; }
.form label, .form .field { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); min-width: 0; }
.form label input, .form label select, .form label textarea { font-weight: 400; color: var(--text); font-size: 15px; }
.form-row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form-row > label { min-width: 0; }
.form label select { width: 100%; }
.hint { font-weight: 400; font-size: 12.5px; color: var(--slate); }
fieldset { border: 1px solid var(--fog); padding: 12px 16px; margin: 0; }
legend { font: 500 11px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--slate); padding: 0 6px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 8px; font-weight: 400; color: var(--text); }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--text); font-size: 14px; }
label.inline { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; }
input[type="search"] { min-width: 0; }

/* ---------- Run detail ---------- */
.meta { display: flex; gap: 8px 20px; flex-wrap: wrap; color: var(--slate); font: 400 12.5px/1.6 var(--mono); margin-bottom: 10px; }
.request { white-space: pre-wrap; background: var(--paper); border-left: 3px solid var(--lapis); padding: 14px 18px; margin-bottom: 20px; }
details.task { border: 1px solid var(--fog); margin-bottom: 8px; background: var(--white); }
details.task > summary { cursor: pointer; padding: 12px 16px; display: flex; gap: 12px; align-items: center; list-style: none; }
details.task > summary:hover { background: var(--paper); }
details.task > summary::-webkit-details-marker { display: none; }
details.task > summary::before { content: ""; width: 7px; height: 7px; flex-shrink: 0; border: solid var(--slate);
  border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); transition: transform .12s; }
details.task[open] > summary::before { transform: rotate(45deg); }
details.task > .doc { padding: 6px 20px 16px; border-top: 1px solid var(--fog); }

/* ---------- Rendered agent output ---------- */
.doc { line-height: 1.65; overflow-wrap: anywhere; color: var(--text); }
.doc h2, .doc h3, .doc h4, .doc h5, .doc h6 { margin: 22px 0 8px; font: 600 16px/1.3 var(--sans); letter-spacing: 0; text-transform: none; color: var(--ink); }
.doc h2 { font-size: 19px; letter-spacing: -.01em; }
.doc h4 { font-size: 14px; color: var(--text-2); }
.doc table { margin: 12px 0; font-size: 14px; }
.doc td, .doc th { border: 1px solid var(--fog); }
.doc th { background: var(--paper); font: 600 13px/1.4 var(--sans); letter-spacing: 0; text-transform: none; color: var(--ink); }
.doc code { background: var(--paper); padding: 1px 5px; font: 13px var(--mono); }
.doc hr { border: 0; border-top: 1px solid var(--fog); margin: 18px 0; }
.doc blockquote { margin: 12px 0; padding: 4px 16px; border-left: 3px solid var(--fog); color: var(--text-2); }
.pre { white-space: pre-wrap; }

/* ---------- Approvals: the full record and the exact content being decided on ---------- */
.approval { border: 1px solid var(--fog); border-left: 3px solid var(--warn-fill); background: var(--white); padding: 18px 20px; margin-bottom: 12px; }
.approval .details { white-space: pre-wrap; margin: 8px 0 12px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 12px 0; font-size: 14px; }
.facts dt { font: 500 11px/1.9 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--slate); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.approval h4 { margin: 16px 0 8px; }
.approval .content { background: var(--paper); border: 1px solid var(--fog); padding: 14px 16px;
  max-height: 420px; overflow: auto; overflow-wrap: anywhere; line-height: 1.55; margin-bottom: 14px; }
.approval label { display: block; margin-bottom: 8px; color: var(--text-2); font-size: 13px; }
.approval textarea { min-height: 56px; margin-top: 6px; }
.approval input.note { flex: 1; min-width: 200px; }

/* ---------- Reports ---------- */
a.active-filter { font-weight: 600; color: var(--ink); text-decoration: none; border-bottom: 2px solid var(--lapis); }

/* ---------- Pipeline ---------- */
.board { display: grid; grid-template-columns: repeat(5, minmax(190px, 1fr)); gap: 12px; margin-bottom: 8px; overflow-x: auto; }
.stage-col { background: #e9edf3; padding: 10px; min-height: 120px; }
.stage-head { display: flex; flex-direction: column; margin: 2px 4px 10px; text-transform: capitalize; font-weight: 600; }
.stage-head .small { font: 400 12px/1.5 var(--mono); color: var(--slate); text-transform: none; }
.opp { display: flex; flex-direction: column; gap: 2px; background: var(--white); border: 1px solid var(--fog);
  padding: 12px 14px; margin-bottom: 8px; color: inherit; text-decoration: none; transition: border-color .12s; }
.opp:hover { border-color: var(--lapis); text-decoration: none; }
.late { color: var(--warn); }
.timeline { list-style: none; padding: 0; margin: 0 0 6px; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--fog); }
.timeline li:last-child { border-bottom: 0; }
.workflows { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 12px; }
.workflows button { margin-bottom: 4px; }
.truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Engineering ---------- */
.file-list { max-height: 260px; overflow: auto; display: flex; flex-direction: column; gap: 2px; font: 13px/1.6 var(--mono); }
pre, code { font-family: var(--mono); }
pre.code { background: var(--ink); color: #e3e8f0; padding: 16px 18px; overflow: auto; max-height: 520px; font-size: 13px; line-height: 1.55; }
pre.diff { background: var(--canvas); border: 1px solid var(--fog); padding: 12px 14px; overflow: auto; max-height: 640px;
  font: 12.5px/1.5 var(--mono); }
pre.diff .add { color: var(--ok); background: var(--ok-bg); display: inline-block; width: 100%; }
pre.diff .del { color: var(--bad); background: var(--bad-bg); display: inline-block; width: 100%; }
pre.diff .hunk { color: var(--lapis); }
pre.diff .meta { color: var(--slate); font-weight: 600; }

/* ---------- AI budget meter ---------- */
.meter { height: 8px; background: var(--fog); overflow: hidden; margin: 8px 0 12px; }
.meter > div { height: 100%; background: var(--lapis); }
.meter > div.near { background: var(--warn-fill); }
.meter > div.over { background: var(--bad-fill); }
.cost-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }

/* ---------- Analytics bars: one hue, thin, 2px gaps, values on hover ---------- */
.bars { display: flex; align-items: flex-end; gap: 2px; height: 160px; border-bottom: 1px solid var(--ink); margin-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column-reverse; align-items: center; height: 100%; position: relative; }
.bar { width: 60%; max-width: 28px; background: var(--lapis); }
.bar-col:hover .bar { background: var(--ink); }
.bar-value { font: 11px var(--mono); color: var(--slate); margin-bottom: 4px; visibility: hidden; white-space: nowrap; }
.bar-col:hover .bar-value { visibility: visible; }
.bar-labels { display: flex; gap: 2px; margin-top: 6px; }
.bar-labels span { flex: 1; text-align: center; font: 11px var(--mono); color: var(--slate); }

/* ---------- Loading: the brand's pulsing node ---------- */
.loading { display: flex; align-items: center; gap: 12px; color: var(--slate); padding: 24px 0; }
.loading::before { content: ""; width: 10px; height: 10px; transform: rotate(45deg); background: var(--lapis);
  animation: cx-pulse 1.1s ease-in-out infinite; }
@keyframes cx-pulse { 50% { opacity: .25; transform: rotate(45deg) scale(.7); } }
@media (prefers-reduced-motion: reduce) {
  .loading::before { animation: none; }
  * { transition: none !important; }
}

/* ---------- Sign in ---------- */
body.signed-out .sidebar { display: none; }
body.signed-out main {
  max-width: none;
  min-height: 100vh;
  padding: 32px 20px;
  display: grid;
  place-items: center;
  background-color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cpath d='M28.1 0H67.9L96 28.1V67.9L67.9 96H28.1L0 67.9V28.1Z' fill='none' stroke='%237D93FF' stroke-opacity='.14' stroke-width='1'/%3E%3C/svg%3E");
}
.login { width: 100%; max-width: 420px; }
.login-card {
  position: relative;
  background: var(--white);
  padding: 36px 36px 30px;
  clip-path: polygon(0 0, calc(100% - 28px) 0, 100% 28px, 100% 100%, 0 100%);
}
.login-card::after { content: ""; position: absolute; top: 0; right: 0; width: 28px; height: 28px; background: var(--lapis);
  clip-path: polygon(0 0, 100% 100%, 100% 0); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.login-brand img { width: 40px; height: 38px; }
.login-brand .brand-name { color: var(--ink); font-size: 19px; }
.login-brand .brand-sub { color: var(--lapis); }
.login h1 { font-size: 26px; margin-bottom: 4px; }
.login .subtitle { margin-bottom: 24px; }
.login button { width: 100%; }
.login .error { margin: 0; }
.login .error:empty { display: none; }
.login-foot { text-align: center; margin-top: 20px; font: 400 12px/1.5 var(--mono); letter-spacing: .06em; color: var(--mist); }

/* ---------- Small screens: the sidebar becomes a top bar with a menu ---------- */
@media (max-width: 900px) {
  body { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: sticky; top: 0; z-index: 10; }
  .sidebar-head { display: flex; align-items: center; justify-content: space-between; }
  .brand { padding: 12px 16px; }
  .brand img { width: 28px; height: 27px; }
  .nav-toggle { display: inline-flex; margin-right: 12px; min-height: 40px; padding: 0 14px; background: transparent;
    border-color: var(--graphite-2); color: var(--white); font-weight: 500; }
  .nav-toggle:hover { background: var(--graphite); border-color: var(--graphite-2); }
  .sidebar nav, .sidebar-foot { display: none; }
  body.nav-open .sidebar nav { display: block; max-height: calc(100vh - 64px - 120px); }
  body.nav-open .sidebar-foot { display: grid; }
  main { padding: 24px 18px 56px; }
  h1 { font-size: 24px; }
  .panel { padding: 18px; }
  .grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 14px; }
  .tile .num { font-size: 26px; }
  .panel table { display: block; overflow-x: auto; }
}
