/* SURA web design system.
   Straight lines only: border-radius is 0 everywhere. No shadows, no gradients. 1px lines.
   Colours: black, straw, white, surface, line, muted. Functional red/green only with a text label. */

@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("fonts/IBMPlexSans-Static-400.ttf") format("truetype"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("fonts/IBMPlexSans-Static-500.ttf") format("truetype"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("fonts/IBMPlexSans-600.ttf") format("truetype"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url("fonts/JetBrainsMono-VF-Static-400.ttf") format("truetype"); }
@font-face { font-family: "Cormorant Garamond"; font-weight: 300 700; font-display: swap; src: url("fonts/CormorantGaramond[wght].ttf") format("truetype"); }

:root {
  --black: #000000;
  --straw: #E6D9A6;
  --white: #FFFFFF;
  --surface: #F5F4EF;
  --line: #D5D5D5;
  --muted: #666666;
  --ok: #4A6B50;     /* functional, desaturated green */
  --bad: #9A4A42;    /* functional, desaturated red */
  --font-sans: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --topbar-h: 48px;
  --nav-w: 200px;
}

*, *::before, *::after { box-sizing: border-box; border-radius: 0; box-shadow: none; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--white);
  color: var(--black);
  font: 400 13px/1.45 var(--font-sans);
  font-feature-settings: "tnum" 1;
}
img { display: block; max-width: 100%; border-radius: 0; }
a { color: var(--black); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--black); }
:focus-visible { outline: 1px solid var(--black); outline-offset: 1px; border-radius: 0; }
::selection { background: var(--straw); color: var(--black); }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
code, kbd, samp, pre, .mono { font-family: var(--font-mono); font-size: 12px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.display { font-family: var(--font-display); font-weight: 500; font-size: 44px; line-height: 1.05; letter-spacing: 0; }

/* ---------- Shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px;
  background: var(--black); color: var(--white);
  border-bottom: 1px solid var(--black);
}
.topbar a { color: var(--white); text-decoration: none; }
.lockup { display: flex; align-items: center; gap: 12px; height: 100%; }
.lockup .mark { height: 30px; width: auto; }
.lockup .wordmark { height: 11px; width: auto; }
.topbar .app-name {
  padding-left: 14px; border-left: 1px solid var(--muted);
  font-size: 13px; font-weight: 500; color: var(--straw);
}
.topbar .spacer { flex: 1; }
.topbar .who { font-family: var(--font-mono); font-size: 12px; color: var(--line); }
.topbar form { margin: 0; }
.topbar .btn { background: transparent; color: var(--white); border-color: var(--muted); height: 28px; }
.topbar .btn:hover { background: var(--white); color: var(--black); border-color: var(--white); }

.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: calc(100vh - var(--topbar-h)); }
.nav { background: var(--surface); border-right: 1px solid var(--line); padding: 12px 0; }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav a {
  display: block; padding: 7px 16px;
  color: var(--black); text-decoration: none; font-weight: 500;
  border-left: 3px solid transparent;
}
.nav a:hover { background: var(--white); }
.nav a[aria-current="page"] { background: var(--white); border-left-color: var(--black); }
.nav .nav-sep { margin: 12px 16px; border-top: 1px solid var(--line); }
.nav .nav-meta { padding: 0 16px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

.content { padding: 24px 32px 48px; max-width: 1280px; }
.content--narrow { max-width: 760px; }

.page-head { display: flex; align-items: flex-end; gap: 16px; padding-bottom: 12px; margin-bottom: 20px; border-bottom: 1px solid var(--black); }
.page-head h1 { flex: 1; }
.page-head .actions { display: flex; gap: 8px; }
.page-head .count { font-size: 13px; font-weight: 400; margin-left: 6px; }
.page-head .h1-sub { font-size: 13px; font-weight: 400; margin-left: 8px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin: 28px 0 10px; }
.section-head h2 { margin: 0; flex: 1; }
.bad-text { color: var(--bad); }
.kv { display: inline-block; margin-right: 12px; }
.nav .nav-meta-title { color: var(--black); margin-bottom: 6px; }
.nav .nav-meta-row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; }
.crumbs { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: 0; }
h1 { font-size: 22px; line-height: 1.2; }
h2 { font-size: 15px; line-height: 1.3; margin: 28px 0 10px; }
h3 { font-size: 13px; margin: 18px 0 8px; }
p { margin: 0 0 10px; }

.section { margin-bottom: 28px; }
.section > h2:first-child { margin-top: 0; }
.panel { border: 1px solid var(--line); background: var(--white); padding: 16px; }
.panel--surface { background: var(--surface); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.grid-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 7px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.table thead th {
  position: sticky; top: 0;
  background: var(--surface);
  font-family: var(--font-mono); font-size: 11px; font-weight: 400; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
  border-bottom: 1px solid var(--black);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface); }
.table td.mono, .table .mono { font-family: var(--font-mono); font-size: 12px; }
.table td.num { text-align: right; font-family: var(--font-mono); font-size: 12px; }
.table .primary { font-weight: 500; }
.table a { text-decoration: none; }
.table a:hover { text-decoration: underline; }
.table--compact th, .table--compact td { padding: 5px 8px; }

/* Definition list for record details */
dl.props { display: grid; grid-template-columns: 160px minmax(0, 1fr); margin: 0; border-top: 1px solid var(--line); }
dl.props dt, dl.props dd { margin: 0; padding: 7px 0; border-bottom: 1px solid var(--line); }
dl.props dt { font-family: var(--font-mono); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; padding-top: 9px; }
dl.props dd { word-break: break-word; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 14px;
  font: 500 13px/1 var(--font-sans);
  color: var(--white); background: var(--black);
  border: 1px solid var(--black); border-radius: 0;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--straw); color: var(--black); }
.btn:disabled, .btn[aria-disabled="true"],
.btn:disabled:hover { color: var(--muted); background: var(--surface); border-color: var(--line); cursor: not-allowed; }
.btn--secondary { color: var(--black); background: var(--white); border-color: var(--black); }
.btn--secondary:hover { background: var(--surface); }
.btn--straw { color: var(--black); background: var(--straw); border-color: var(--black); }
.btn--straw:hover { background: var(--white); }
.btn--danger { color: var(--white); background: var(--bad); border-color: var(--bad); }
.btn--danger:hover { background: var(--black); border-color: var(--black); color: var(--white); }
.btn--ghost { color: var(--black); background: transparent; border-color: transparent; text-decoration: underline; text-decoration-color: var(--line); padding: 0 4px; }
.btn--ghost:hover { background: transparent; text-decoration-color: var(--black); }
.btn--sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; margin: 0; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 4px; align-content: start; }
.field > label, .field > .label-text {
  font-family: var(--font-mono); font-size: 11px; color: var(--black);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.field .hint { font-size: 12px; color: var(--muted); }
.field .error { font-size: 12px; color: var(--bad); }
.field--error input, .field--error textarea, .field--error select { border-color: var(--bad); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], input[type="url"],
textarea, select {
  width: 100%; height: 32px; padding: 0 9px;
  font: 400 13px/1.3 var(--font-sans); color: var(--black);
  background: var(--white); border: 1px solid var(--line); border-radius: 0;
  -webkit-appearance: none; appearance: none;
}
textarea { height: auto; min-height: 76px; padding: 7px 9px; resize: vertical; }
textarea.mono, input.mono { font-family: var(--font-mono); font-size: 12px; }
select {
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0h10L5 6z' fill='%23000'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
input:hover, textarea:hover, select:hover { border-color: var(--muted); }
input:focus, textarea:focus, select:focus { outline: 1px solid var(--black); outline-offset: -1px; border-color: var(--black); }

.checks { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line); }
.checks label {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 10px; border-right: 1px solid var(--line); cursor: pointer;
  font-size: 13px;
}
.checks label:last-child { border-right: 0; }
.checks--column { flex-direction: column; }
.checks--column label { border-right: 0; border-bottom: 1px solid var(--line); }
.checks--column label:last-child { border-bottom: 0; }
input[type="checkbox"], input[type="radio"] {
  -webkit-appearance: none; appearance: none; margin: 0;
  width: 13px; height: 13px; border: 1px solid var(--black); border-radius: 0; background: var(--white);
  display: inline-grid; place-content: center; flex: none;
}
input[type="checkbox"]::before, input[type="radio"]::before { content: ""; width: 7px; height: 7px; background: transparent; }
input[type="checkbox"]:checked::before, input[type="radio"]:checked::before { background: var(--black); }

.form-actions { display: flex; gap: 8px; padding-top: 4px; }

/* ---------- Status labels ---------- */
.label {
  display: inline-block;
  padding: 1px 6px;
  font: 400 11px/16px var(--font-mono); text-transform: uppercase; letter-spacing: 0.04em;
  border: 1px solid var(--line); border-radius: 0; color: var(--black); background: var(--white);
  white-space: nowrap; vertical-align: 1px;
}
.label--ok { color: var(--ok); border-color: var(--ok); }
.label--bad { color: var(--white); background: var(--bad); border-color: var(--bad); }
.label--warn { color: var(--bad); border-color: var(--bad); }
.label--straw { background: var(--straw); border-color: var(--straw); }
.label--black { color: var(--white); background: var(--black); border-color: var(--black); }
.label--muted { color: var(--muted); }
.tag {
  display: inline-block; padding: 0 5px; margin: 0 3px 3px 0;
  font: 400 11px/18px var(--font-mono); border: 1px solid var(--line); border-radius: 0; background: var(--surface);
}

/* ---------- Flash messages ---------- */
.flashes { display: grid; gap: 8px; margin-bottom: 20px; }
.flash {
  display: flex; gap: 12px; align-items: baseline;
  padding: 9px 12px; border: 1px solid var(--line); border-left: 3px solid var(--black); background: var(--surface);
}
.flash .flash-kind { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; flex: none; }
.flash--ok { border-left-color: var(--ok); }
.flash--ok .flash-kind { color: var(--ok); }
.flash--error { border-left-color: var(--bad); }
.flash--error .flash-kind { color: var(--bad); }
.flash--info { border-left-color: var(--straw); }

/* ---------- Empty state ---------- */
.empty {
  padding: 36px 24px; text-align: center;
  border: 1px dashed var(--line); background: var(--surface);
}
.empty .empty-title { font-weight: 600; margin-bottom: 4px; }
.empty .empty-text { color: var(--muted); margin-bottom: 14px; }
.table-wrap .empty { border: 0; }

/* ---------- Code and secrets ---------- */
pre.code, .code-block {
  margin: 0; padding: 10px 12px; overflow-x: auto;
  font: 400 12px/1.6 var(--font-mono);
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--black);
  white-space: pre;
}
.secret {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--black); background: var(--straw);
  font: 400 13px/1.4 var(--font-mono); word-break: break-all;
}
.secret code { flex: 1; font-size: 13px; }
.notice { padding: 10px 12px; border: 1px solid var(--black); background: var(--white); }
.notice--straw { background: var(--straw); }
.danger-zone { border: 1px solid var(--bad); padding: 16px; }
.danger-zone h2 { color: var(--bad); margin-top: 0; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; background: var(--surface); padding: 24px; }
.auth-card { width: 100%; max-width: 360px; background: var(--white); border: 1px solid var(--line); }
.auth-card .auth-head { background: var(--black); padding: 28px 24px 22px; display: grid; justify-items: center; gap: 14px; }
.auth-card .auth-head .mark { height: 64px; width: auto; }
.auth-card .auth-head .wordmark { height: 12px; width: auto; }
.auth-card .auth-body { padding: 24px; }
.auth-card h1 { font-size: 18px; margin-bottom: 16px; }

/* ---------- Print ---------- */
@media print {
  .topbar, .nav, .no-print, .flashes { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  body { font-size: 11pt; }
  pre.code, .secret { border-color: #000; }
  a { text-decoration: none; }
}
.print-sheet { max-width: 760px; }
.print-sheet .sheet-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--black); }
.print-sheet .sheet-head .mark { height: 44px; width: auto; }
.print-sheet ol.steps { padding-left: 20px; margin: 0; }
.print-sheet ol.steps li { margin-bottom: 8px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .nav { border-right: 0; border-bottom: 1px solid var(--line); padding: 0; }
  .nav ul { display: flex; overflow-x: auto; }
  .nav a { border-left: 0; border-bottom: 3px solid transparent; }
  .nav a[aria-current="page"] { border-bottom-color: var(--black); }
  .nav .nav-sep, .nav .nav-meta { display: none; }
  .content { padding: 16px; }
  .grid-2, .grid-sidebar { grid-template-columns: 1fr; }
  .topbar .wordmark, .topbar .who { display: none; }
}
