
:root {
  --deep: #052B49; --icy: #DAE3ED; --tech: #215782; --graphite: #1E2722; --steel: #748491;
  --paper: #FFFFFF; --wash: #F3F6F9; --line: #D5DDE5; --ok: #1F6B3A; --ok-bg: #E4F2E8;
  --warn: #8A5A00; --warn-bg: #FBF1DC; --err: #9B1C1C; --err-bg: #FBE7E7;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--wash); color: var(--graphite); font: 15px/1.5 Roboto, Arial, sans-serif; }
a { color: var(--tech); }
h1, h2, h3 { font-family: "Roboto Condensed", "Arial Narrow", Arial, sans-serif; color: var(--deep); margin: 0 0 .5em; }
h1 { font-size: 30px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 21px; font-weight: 500; }
h3 { font-family: Roboto, Arial, sans-serif; font-size: 15px; font-weight: 700; }
.eyebrow { font: 500 12px/1.2 Roboto, Arial, sans-serif; text-transform: uppercase; letter-spacing: .08em; color: var(--steel); margin-bottom: 6px; }
header.top { background: var(--deep); color: var(--icy); }
/* Two rows: brand and the signed-in user on top, the section tabs below.
   The tab row never wraps; if it is wider than the screen it scrolls. */
header.top .bar { max-width: 1180px; margin: 0 auto; padding: 0 20px; height: 84px; display: flex; align-items: center; gap: 22px; }
header.top .brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--icy); }
header.top .brand img { height: 62px; width: auto; display: block; } /* 170px wide: brand minimum for digital is 168px */
header.top .brand span { white-space: nowrap; font: 500 17px/1 "Roboto Condensed", Arial, sans-serif; letter-spacing: .04em; text-transform: uppercase; border-left: 1px solid rgba(218,227,237,.35); padding-left: 14px; }
header.top nav.tabs { border-top: 1px solid rgba(218,227,237,.16); background: rgba(0,0,0,.14); }
header.top nav.tabs .inner { max-width: 1180px; margin: 0 auto; padding: 0 20px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin; }
header.top nav a { color: var(--icy); text-decoration: none; padding: 12px 14px 10px; border-bottom: 3px solid transparent; font-weight: 500; font-size: 14px; white-space: nowrap; flex: none; }
header.top nav a:hover { background: rgba(218,227,237,.08); }
header.top nav a.active { color: #fff; border-bottom-color: var(--icy); }
header.top .who { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; white-space: nowrap; }
header.top .who .pill { margin: 0; }
header.top .who form { margin: 0; }
.badge-count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--icy); color: var(--deep); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
main { max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 22px 24px; margin-bottom: 20px; }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.muted { color: var(--steel); }
.small { font-size: 13px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font: 500 12px/1.2 Roboto, Arial, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--steel); padding: 10px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
/* Long lists (audit log, admin activity, metadata history) scroll inside the
   card instead of stretching the page; the header row stays visible. */
.scroll { max-height: max(320px, calc(100vh - 360px)); overflow: auto; border: 1px solid var(--line); border-radius: 4px; margin: 10px 0 14px; }
.scroll table { margin: 0; }
.scroll thead th { position: sticky; top: 0; z-index: 1; background: var(--paper); box-shadow: inset 0 -2px 0 var(--line); border-bottom: 0; }
/* Terms of use modal: covers the page until the user agrees. */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(5,43,73,.72); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--paper); border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.35); width: min(1100px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 22px 28px; }
.modal h2 { margin-top: 0; }
iframe.terms-pdf { display: block; width: 100%; height: max(420px, calc(100vh - 360px)); border: 1px solid var(--line); border-radius: 4px; background: #fff; margin: 6px 0 8px; }
button.link.dark { color: var(--tech); }
/* Metadata editor and diffs */
textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.5; min-height: 60vh; white-space: pre; overflow: auto; tab-size: 2; }
/* YAML editor (portal.js wraps textarea.code): highlighted <pre> under a transparent textarea. */
.yaml-editor { border: 1px solid #B9C5D1; border-radius: 4px; background: #fff; }
.yaml-editor:focus-within { outline: 2px solid var(--tech); outline-offset: 1px; }
.ye-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 6px 10px; border-bottom: 1px solid var(--line); background: var(--wash); font-size: 12px; color: var(--steel); }
.ye-toolbar label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; color: var(--graphite); font-size: 12px; }
.ye-toolbar select { width: auto; max-width: 320px; padding: 3px 6px; font-size: 12px; }
.ye-pos { font-family: ui-monospace, Consolas, monospace; }
.ye-help { margin-left: auto; }
.ye-body { display: flex; height: 65vh; min-height: 360px; }
.ye-gutter, .ye-hl, .yaml-editor textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.5; tab-size: 2; white-space: pre; margin: 0; padding: 10px 12px; }
.ye-gutter { flex: none; min-width: 3.2em; padding-left: 8px; padding-right: 8px; text-align: right; color: #9AA7B3; background: var(--wash); border-right: 1px solid var(--line); overflow: hidden; user-select: none; }
.ye-code { position: relative; flex: 1; min-width: 0; }
.ye-hl { position: absolute; inset: 0; overflow: hidden; pointer-events: none; color: var(--graphite); background: transparent; }
.yaml-editor textarea.code { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; border: 0; border-radius: 0; resize: none; overflow: auto; background: transparent; color: transparent; caret-color: var(--graphite); outline: none; }
.yaml-editor textarea.code::selection { background: rgba(33,87,130,.25); color: transparent; }
.y-key { color: #215782; font-weight: 600; }
.y-str { color: #2E7D4F; }
.y-block { color: #3F5E3A; }
.y-num, .y-bool { color: #9A5B00; }
.y-anchor, .y-flow { color: #6A4C93; }
.y-com { color: #748491; font-style: italic; }
.y-punct { color: #748491; }
.y-bad { background: var(--err-bg); outline: 1px solid var(--err); }
.y-errline { background: var(--err-bg); }
.y-errno { color: var(--err); font-weight: 700; }
pre.code-view { max-height: 70vh; white-space: pre; word-break: normal; overflow: auto; }
.flash.warn { background: var(--warn-bg); color: var(--warn); border-color: #E8D3A8; }
ul.tight { margin: 6px 0 0; padding-left: 20px; }
.diff { margin-bottom: 18px; border: 1px solid var(--line); border-radius: 4px; max-height: 60vh; overflow: auto; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.diff table { font-size: inherit; }
.diff td { padding: 1px 8px; border: 0; white-space: pre; vertical-align: top; }
.diff td.no { color: var(--steel); text-align: right; width: 1%; user-select: none; }
.diff td.sign { width: 1%; user-select: none; }
.diff tr.add td { background: var(--ok-bg); }
.diff tr.del td { background: var(--err-bg); }
.diff .gap { padding: 2px 8px; color: var(--steel); background: var(--wash); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
pre.sql { white-space: pre-wrap; word-break: break-word; max-height: 160px; overflow: auto; margin: 0; background: var(--wash); padding: 8px; border-radius: 4px; font-size: 12px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: 12px; font-weight: 500; background: var(--icy); color: var(--deep); margin: 0 4px 4px 0; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.err { background: var(--err-bg); color: var(--err); }
.pill.steel { background: #E8ECF0; color: #4E5B66; }
.flash { padding: 12px 16px; border-radius: 6px; margin-bottom: 20px; border: 1px solid; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: #B9DEC5; }
.flash.error { background: var(--err-bg); color: var(--err); border-color: #EDC0C0; }
form.inline { display: inline; margin: 0; }
label { display: block; font-weight: 500; font-size: 13px; margin: 0 0 4px; color: var(--graphite); }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #B9C5D1; border-radius: 4px; font: inherit; background: #fff; color: var(--graphite); }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--tech); outline-offset: 1px; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 180px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px 16px; margin: 6px 0 16px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; background: #fff; font-weight: 400; cursor: pointer; }
.check input { margin-top: 3px; }
.check b { display: block; color: var(--deep); font-size: 14px; }
.check small { color: var(--steel); font-size: 12px; line-height: 1.35; display: block; }
button, .btn { display: inline-block; font: 500 14px/1 Roboto, Arial, sans-serif; padding: 10px 16px; border-radius: 4px; border: 1px solid var(--deep); background: var(--deep); color: #fff; cursor: pointer; text-decoration: none; }
button.secondary, .btn.secondary { background: #fff; color: var(--deep); }
button.danger { background: var(--err); border-color: var(--err); }
button.link { background: none; border: 0; color: var(--icy); padding: 0; text-decoration: underline; font-size: 13px; white-space: nowrap; }
button.small, .btn.small { padding: 6px 10px; font-size: 13px; }
.hero { background: var(--deep); color: var(--icy); border-radius: 6px; padding: 40px; display: flex; gap: 36px; align-items: center; margin-bottom: 24px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -80px; top: -40px; width: 260px; height: 400px; background: rgba(218,227,237,.06); transform: skewX(-38deg); }
.hero img { width: 120px; height: 120px; background: #fff; border-radius: 16px; padding: 10px; flex: none; }
.hero h1 { color: #fff; font-size: 38px; }
.hero p { color: var(--icy); max-width: 620px; margin: 0 0 18px; }
.hero .btn { background: var(--icy); color: var(--deep); border-color: var(--icy); }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 16px; font-size: 14px; }
.kv div:nth-child(odd) { color: var(--steel); }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 0 0 14px 40px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 13px; background: var(--deep); color: #fff; font: 700 13px/26px Roboto, Arial, sans-serif; text-align: center; }
.secret { font-family: ui-monospace, Consolas, monospace; background: var(--wash); border: 1px dashed var(--tech); padding: 14px; border-radius: 4px; word-break: break-all; font-size: 14px; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
footer { max-width: 1180px; margin: 0 auto; padding: 0 20px 30px; color: var(--steel); font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px 24px; justify-content: space-between; }
footer a { color: var(--steel); white-space: nowrap; }
@media (max-width: 720px) {
  header.top .bar { height: 72px; padding: 0 16px; gap: 12px; }
  header.top .brand { gap: 10px; }
  header.top .brand span { font-size: 14px; padding-left: 10px; }
  header.top .who .name { display: none; }
  header.top nav.tabs .inner { padding: 0 8px; }
  main { padding: 20px 16px 40px; }
  .hero { flex-direction: column; align-items: flex-start; padding: 26px; }
  .kv { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; }
  .scroll { max-height: 70vh; }
  .scroll table { display: table; }
}
@media (max-width: 440px) {
  header.top .who .pill { display: none; }
}
