/* =========================================================================
   Requirements Atlas — Teconia design system
   Brand: red #D6404A · amber #E9A33C · lime #A9C93C on white
   ========================================================================= */

:root {
  --tec-red: #D6404A;
  --tec-red-dark: #B32E38;
  --tec-amber: #E9A33C;
  --tec-lime: #A9C93C;

  --ink: #16191D;
  --ink-2: #3A4149;
  --muted: #6B7480;
  --muted-2: #8D96A1;
  --line: #E4E7EB;
  --line-2: #EFF1F4;
  --paper: #FFFFFF;
  --canvas: #F6F7F9;
  --canvas-2: #FAFBFC;

  --ok: #2F7D32;
  --ok-bg: #E8F3E9;
  --warn: #B26A00;
  --warn-bg: #FDF1DF;
  --bad: #C0392B;
  --bad-bg: #FBEAE8;
  --neutral: #5B6470;
  --neutral-bg: #EEF0F3;
  --violet: #7A5AA8;
  --violet-bg: #F1ECF8;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(22,25,29,.05), 0 1px 3px rgba(22,25,29,.04);
  --shadow: 0 2px 4px rgba(22,25,29,.04), 0 8px 24px rgba(22,25,29,.07);
  --shadow-lg: 0 12px 48px rgba(22,25,29,.14);

  --sans: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Bitter", "Zilla Slab", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --header-h: 62px;
  --sidebar-w: 268px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 { font-family: var(--serif); font-weight: 700; line-height: 1.25; margin: 0 0 .5em; color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }
p { margin: 0 0 1em; }
a { color: var(--tec-red); text-decoration: none; }
a:hover { text-decoration: underline; }
small { font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
code, kbd { font-family: var(--mono); font-size: .88em; background: var(--canvas); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }

/* --- brand bar ---------------------------------------------------------- */
.brandbar { height: 4px; display: flex; }
.brandbar i { flex: 1; display: block; }
.brandbar i:nth-child(1) { background: var(--tec-red); }
.brandbar i:nth-child(2) { background: var(--tec-amber); }
.brandbar i:nth-child(3) { background: var(--tec-lime); }

/* --- layout ------------------------------------------------------------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 920px; margin-inline: auto; }
.wrap-wide { max-width: 1480px; }

.topbar {
  position: sticky; top: 0; z-index: 60;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { height: var(--header-h); display: flex; align-items: center; gap: 22px; }
.logo { display: flex; align-items: center; gap: 11px; flex-shrink: 0; text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo img { height: 26px; width: auto; display: block; }
.logo-fallback { font-family: var(--serif); font-size: 21px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; }
.logo-div { width: 1px; height: 24px; background: var(--line); }
.logo-app { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }

.topnav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.topnav a {
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  padding: 7px 12px; border-radius: var(--radius-sm); text-decoration: none;
}
.topnav a:hover { background: var(--canvas); text-decoration: none; }
.topnav a.active { color: var(--tec-red); background: #FDF0F1; }

.layout { display: flex; align-items: flex-start; gap: 32px; }
.sidebar { width: var(--sidebar-w); flex-shrink: 0; position: sticky; top: calc(var(--header-h) + 20px); max-height: calc(100vh - var(--header-h) - 40px); overflow-y: auto; }
.content { flex: 1; min-width: 0; }
.page { padding: 28px 0 72px; }

/* --- cards -------------------------------------------------------------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card-pad { padding: 20px 22px; }
.card-head {
  padding: 14px 22px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 12px;
}
.card-head h2, .card-head h3 { margin: 0; }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 20px 22px; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--line-2); background: var(--canvas-2); border-radius: 0 0 var(--radius) var(--radius); }

/* --- buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: var(--sans); font-size: 13.5px; font-weight: 700; line-height: 1;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-2);
  cursor: pointer; text-decoration: none; transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}
.btn:hover { background: var(--canvas); text-decoration: none; }
.btn-primary { background: var(--tec-red); border-color: var(--tec-red); color: #fff; }
.btn-primary:hover { background: var(--tec-red-dark); border-color: var(--tec-red-dark); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--canvas); }
.btn-danger { color: var(--bad); border-color: #F0CFCB; background: #FDF6F5; }
.btn-danger:hover { background: var(--bad-bg); }
.btn-sm { font-size: 12.5px; padding: 6px 11px; }
.btn-lg { font-size: 15px; padding: 12px 22px; }
.btn-block { width: 100%; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* --- forms -------------------------------------------------------------- */
label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 5px; letter-spacing: .01em; }
.field { margin-bottom: 16px; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; font-family: var(--sans); font-size: 14px; color: var(--ink);
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper); transition: border-color .12s, box-shadow .12s;
}
textarea { line-height: 1.6; resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus, [contenteditable]:focus {
  outline: none; border-color: var(--tec-red); box-shadow: 0 0 0 3px rgba(214,64,74,.12);
}
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7480' d='M6 8.5 2 4h8z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; font-weight: 500; color: var(--ink-2); margin-bottom: 9px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--tec-red); width: 15px; height: 15px; flex-shrink: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* --- badges ------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 800; letter-spacing: .02em;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--neutral-bg); color: var(--neutral);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-outline { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.badge-code { font-family: var(--mono); font-size: 11px; font-weight: 700; background: var(--canvas); color: var(--muted); border: 1px solid var(--line); letter-spacing: 0; }
.badge-opt { background: var(--warn-bg); color: var(--warn); }
.badge-prio { background: #FDECEE; color: var(--tec-red); }
.badge-doc { background: var(--canvas); color: var(--ink-2); border: 1px solid var(--line); }

/* --- tables ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--canvas-2);
  white-space: nowrap;
}
table.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: var(--canvas-2); }
table.tbl td.shrink { width: 1%; white-space: nowrap; }

/* --- stat tiles --------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 14px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat .k { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.stat .v { font-family: var(--serif); font-size: 28px; font-weight: 700; line-height: 1.15; margin-top: 4px; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.accent-red .v { color: var(--tec-red); }
.stat.accent-ok .v { color: var(--ok); }
.stat.accent-warn .v { color: var(--warn); }
.stat.accent-bad .v { color: var(--bad); }
.stat.accent-violet .v { color: var(--violet); }

/* --- coverage bar ------------------------------------------------------- */
.cov { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--line-2); }
.cov span { display: block; height: 100%; }
.cov-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.cov-legend b { color: var(--ink); font-weight: 700; }
.cov-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 6px; vertical-align: middle; }

/* --- document cards ----------------------------------------------------- */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.doc-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden; display: flex; flex-direction: column;
  transition: box-shadow .15s, transform .15s; text-decoration: none; color: inherit;
}
.doc-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }
.doc-card .stripe { height: 4px; }
.doc-card .inner { padding: 18px 20px 16px; flex: 1; display: flex; flex-direction: column; }
.doc-card .meta { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.doc-card h3 { font-size: 17px; margin: 0 0 6px; }
.doc-card .sub { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.doc-card .sum { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; margin-bottom: 14px; }
.doc-card .foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-2); display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--muted); }

/* --- section tree / toc ------------------------------------------------- */
.toc { font-size: 13.5px; }
.toc-title { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 10px 8px; }
.toc a {
  display: block; padding: 6px 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); text-decoration: none; line-height: 1.4;
  border-left: 2px solid transparent;
}
.toc a:hover { background: var(--canvas); text-decoration: none; }
.toc a.active { background: #FDF0F1; color: var(--tec-red); font-weight: 700; border-left-color: var(--tec-red); }
.toc .lvl-2 { padding-left: 22px; font-size: 13px; }
.toc .lvl-3 { padding-left: 34px; font-size: 12.5px; color: var(--muted); }
.toc .num { font-family: var(--mono); font-size: 11px; color: var(--muted-2); margin-right: 6px; }

/* --- requirement item --------------------------------------------------- */
.sec-head { margin: 34px 0 14px; padding-bottom: 10px; border-bottom: 2px solid var(--line); }
.sec-head:first-child { margin-top: 0; }
.sec-head .n { font-family: var(--mono); font-size: 13px; color: var(--tec-red); font-weight: 700; }
.sec-head h2 { margin: 2px 0 0; font-size: 21px; }
.sec-head .intro { font-size: 13.5px; color: var(--muted); margin-top: 8px; line-height: 1.6; max-width: 76ch; }
.sec-head.lvl-2 h2 { font-size: 18px; }
.sec-head.lvl-3 h2 { font-size: 16px; }
.sec-head.lvl-2, .sec-head.lvl-3 { border-bottom-width: 1px; }

.req {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 12px; box-shadow: var(--shadow-sm); scroll-margin-top: 84px;
}
.req.is-highlight { border-left: 3px solid var(--tec-amber); }
.req-head { padding: 14px 18px; display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.req-head:hover { background: var(--canvas-2); }
.req-head .num { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--muted); padding-top: 2px; min-width: 62px; }
.req-head .ttl { flex: 1; min-width: 0; }
.req-head h4 { margin: 0; font-size: 15.5px; font-family: var(--sans); font-weight: 700; line-height: 1.45; }
.req-head .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.req-head .right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.req-chev { width: 18px; height: 18px; color: var(--muted-2); transition: transform .18s; flex-shrink: 0; margin-top: 2px; }
.req.open .req-chev { transform: rotate(90deg); }
.req-body { display: none; padding: 0 18px 18px; border-top: 1px solid var(--line-2); }
.req.open .req-body { display: block; }

.blk { margin-top: 16px; }
.blk-label {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin-bottom: 7px; display: flex; align-items: center; gap: 8px;
}
.blk-label::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }

.quote {
  border-left: 3px solid var(--line); padding: 10px 0 10px 14px;
  font-size: 14px; color: var(--ink-2); white-space: pre-wrap; line-height: 1.65;
}
.quote.original { border-left-color: var(--tec-amber); background: #FFFDF8; padding-right: 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-style: normal; }
.quote.original .lang { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--warn); display: block; margin-bottom: 6px; }

ul.acc { margin: 0; padding: 0; list-style: none; }
ul.acc li { position: relative; padding-left: 22px; font-size: 13.5px; color: var(--ink-2); margin-bottom: 5px; line-height: 1.55; }
ul.acc li::before {
  content: ""; position: absolute; left: 4px; top: 8px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--tec-lime);
}

.note {
  background: var(--warn-bg); border: 1px solid #F3DFBC; border-radius: var(--radius-sm);
  padding: 10px 13px; font-size: 13px; color: #7A4A00; line-height: 1.55;
}
.note.info { background: #EEF4FB; border-color: #D2E2F2; color: #274866; }
.note.plain { background: var(--canvas); border-color: var(--line); color: var(--ink-2); }

.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 20px; }
.meta-grid .k { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.meta-grid .v { font-size: 13.5px; color: var(--ink-2); overflow-wrap: anywhere; word-break: break-word; }

/* --- rich text rendering ------------------------------------------------ */
.rt { font-size: 14.5px; line-height: 1.7; color: var(--ink-2); }
.rt > *:first-child { margin-top: 0; }
.rt > *:last-child { margin-bottom: 0; }
.rt h2 { font-size: 18px; margin: 22px 0 8px; }
.rt h3 { font-size: 16px; margin: 18px 0 6px; }
.rt p { margin: 0 0 12px; }
.rt ul, .rt ol { margin: 0 0 12px; padding-left: 22px; }
.rt li { margin-bottom: 4px; }
.rt blockquote { margin: 0 0 12px; border-left: 3px solid var(--tec-lime); padding: 4px 0 4px 14px; color: var(--muted); }
.rt img { max-width: 100%; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); display: block; margin: 12px 0; }
.rt pre { background: var(--canvas); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; }
/* Tables inside rich text scroll on their own rather than pushing the page
   sideways: display:block turns the table into its own scroll container while
   the internal table layout (and therefore column alignment) is preserved. */
.rt table {
  display: block; width: max-content; max-width: 100%; overflow-x: auto;
  border-collapse: collapse; margin: 0 0 12px; font-size: 13.5px;
}
.rt th, .rt td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; }
.rt th { background: var(--canvas-2); font-weight: 700; white-space: nowrap; }
.rt tbody tr:nth-child(even) { background: var(--canvas-2); }
.rt a.req-ref {
  display: inline-flex; align-items: baseline; gap: 5px;
  background: #FDF0F1; border: 1px solid #F5D5D8; border-radius: 4px;
  padding: 0 6px; font-size: 13px; font-weight: 700; color: var(--tec-red); text-decoration: none;
}
.rt a.req-ref:hover { background: #FBE4E6; text-decoration: none; }
.rt a.req-ref::before { content: "\2192"; font-weight: 400; opacity: .7; }

/* --- media -------------------------------------------------------------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.media-tile {
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
  background: var(--canvas-2); position: relative; text-decoration: none; color: inherit; display: block;
}
.media-tile:hover { border-color: var(--muted-2); text-decoration: none; }
.media-tile .thumb { aspect-ratio: 16/10; background: var(--canvas); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.media-tile .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-tile .thumb .ph { color: var(--muted-2); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.media-tile .cap { padding: 8px 10px; font-size: 12.5px; color: var(--ink-2); line-height: 1.45; background: var(--paper); }
.media-tile .cap .t { font-weight: 700; display: block; }
.media-tile .play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none;
}
.media-tile .play span {
  width: 42px; height: 42px; border-radius: 50%; background: rgba(22,25,29,.72);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 15px; padding-left: 3px;
}
.embed { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #000; }
.embed iframe, .embed video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
video.inline { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #000; display: block; }

/* --- lightbox ----------------------------------------------------------- */
.lb { position: fixed; inset: 0; z-index: 200; background: rgba(16,18,21,.9); display: none; align-items: center; justify-content: center; padding: 40px; }
.lb.open { display: flex; }
.lb img, .lb video { max-width: 100%; max-height: 100%; border-radius: var(--radius-sm); }
.lb .close { position: absolute; top: 18px; right: 22px; color: #fff; font-size: 26px; background: none; border: 0; cursor: pointer; line-height: 1; }
.lb .cap { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; color: #E8EAED; font-size: 13px; padding: 0 40px; }

/* --- links / cross references ------------------------------------------ */
.xref { display: flex; flex-wrap: wrap; gap: 8px; }
.xref a {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 5px;
  font-size: 12.5px; color: var(--ink-2); background: var(--paper); text-decoration: none;
}
.xref a:hover { border-color: var(--tec-red); color: var(--tec-red); text-decoration: none; }
.xref a .dc { font-family: var(--mono); font-size: 10.5px; font-weight: 800; background: var(--canvas); border-radius: 999px; padding: 3px 7px; color: var(--muted); }

/* --- filter bar --------------------------------------------------------- */
.filterbar {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; box-shadow: var(--shadow-sm);
}
.filterbar input[type=search], .filterbar select { width: auto; min-width: 150px; }
.filterbar .grow { flex: 1; min-width: 200px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  font-size: 12.5px; font-weight: 700; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-2);
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { background: var(--canvas); text-decoration: none; }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .c { font-size: 11px; opacity: .75; }

/* --- alerts ------------------------------------------------------------- */
.alert { border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13.5px; margin-bottom: 16px; border: 1px solid; }
.alert-ok { background: var(--ok-bg); border-color: #C6E2C8; color: #1E5C21; }
.alert-err { background: var(--bad-bg); border-color: #F0CFCB; color: #91291D; }
.alert-info { background: #EEF4FB; border-color: #D2E2F2; color: #274866; }

/* --- empty state -------------------------------------------------------- */
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty h3 { color: var(--ink-2); }

/* --- auth / unlock ------------------------------------------------------ */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: var(--canvas); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .card { overflow: hidden; }
.auth-head { text-align: center; padding: 30px 28px 6px; }
.auth-head img { height: 30px; margin-bottom: 16px; }
.auth-head h1 { font-size: 22px; margin-bottom: 6px; }
.auth-head p { font-size: 13.5px; color: var(--muted); margin: 0; }

/* --- footer ------------------------------------------------------------- */
.foot { border-top: 1px solid var(--line); background: var(--paper); margin-top: auto; }
.foot-inner { padding: 22px 0; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 12.5px; color: var(--muted); }
.foot-inner .spacer { margin-left: auto; }

/* --- editor ------------------------------------------------------------- */
.editor { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); }
.editor-toolbar {
  display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line-2);
  background: var(--canvas-2); border-radius: var(--radius-sm) var(--radius-sm) 0 0; position: sticky; top: var(--header-h); z-index: 20;
}
.editor-toolbar button {
  min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid transparent; background: transparent;
  border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: 700; color: var(--ink-2); line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; font-family: var(--sans);
}
.editor-toolbar button:hover { background: #fff; border-color: var(--line); }
.editor-toolbar button.on { background: var(--ink); color: #fff; }
.editor-toolbar .sep { width: 1px; background: var(--line); margin: 4px 5px; }
.editor-area { min-height: 260px; padding: 16px 18px; outline: none; }
.editor-area:empty::before { content: attr(data-placeholder); color: var(--muted-2); }
.editor-source { display: none; width: 100%; min-height: 300px; font-family: var(--mono); font-size: 12.5px; border: 0; border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.editor.src-mode .editor-area { display: none; }
.editor.src-mode .editor-source { display: block; }

/* --- modal -------------------------------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 150; background: rgba(16,18,21,.45); display: none; align-items: flex-start; justify-content: center; padding: 60px 20px; overflow-y: auto; }
.modal.open { display: flex; }
.modal-box { background: var(--paper); border-radius: var(--radius); width: 100%; max-width: 560px; box-shadow: var(--shadow-lg); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-head button { margin-left: auto; background: none; border: 0; font-size: 20px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; justify-content: flex-end; background: var(--canvas-2); border-radius: 0 0 var(--radius) var(--radius); }

.picker-results { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-top: 10px; }
.picker-results button {
  display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line-2);
  background: none; padding: 9px 12px; cursor: pointer; font-family: var(--sans); font-size: 13px; color: var(--ink-2);
}
.picker-results button:hover { background: var(--canvas); }
.picker-results button:last-child { border-bottom: 0; }
.picker-results .c { font-family: var(--mono); font-size: 10.5px; color: var(--muted); display: block; }

/* --- misc --------------------------------------------------------------- */
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.mono { font-family: var(--mono); overflow-wrap: anywhere; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; } .items-center { align-items: center; } .gap-1 { gap: 8px; } .gap-2 { gap: 16px; } .ml-auto { margin-left: auto; }
.hide { display: none !important; }
.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.page-head .spacer { margin-left: auto; }
.breadcrumb { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb span { margin: 0 6px; opacity: .6; }
.pagination { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 18px; }
.pagination a, .pagination span { padding: 6px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 13px; background: var(--paper); color: var(--ink-2); text-decoration: none; }
.pagination .active span, .pagination span[aria-current] { background: var(--ink); border-color: var(--ink); color: #fff; }
.pagination .disabled span { opacity: .4; }

@media (max-width: 980px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; position: static; max-height: none; }
  .topnav { gap: 0; }
  .topnav a { padding: 7px 9px; font-size: 12.5px; }
  .logo-app { display: none; }
}

/* --- print -------------------------------------------------------------- */
@media print {
  :root { --header-h: 0px; }
  body { background: #fff; font-size: 10.5pt; }
  .topbar, .sidebar, .foot, .no-print, .filterbar, .btn { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .card, .req { box-shadow: none; border-color: #CCD1D6; break-inside: avoid; page-break-inside: avoid; }
  .req-body { display: block !important; }
  .req { margin-bottom: 10px; }
  .sec-head { break-after: avoid; page-break-after: avoid; }
  .doc-print { break-before: page; page-break-before: always; }
  .doc-print:first-child { break-before: auto; page-break-before: auto; }
  a { color: inherit; text-decoration: none; }
  .media-grid { grid-template-columns: repeat(2, 1fr); }
}
