/* InfoSec Hub — brand palette: red #C8102E, near-black #1A1A1A, mid grey #6E6E6E, light grey #F2F2F2. */
:root {
  --red: #C8102E; --red-dark: #A00D25; --red-tint: #FBEAED;
  --ink: #1A1A1A; --grey: #6E6E6E; --line: #DADADA; --paper: #F2F2F2; --white: #FFFFFF;
  --amber: #9A5B00; --amber-tint: #FFF4E0; --green: #1F6F43; --green-tint: #E6F3EC;
  --font: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --radius: 4px;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--paper); line-height: 1.5; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: .88em; }
code { background: var(--paper); padding: .05em .35em; border-radius: 3px; }
h1 { font-size: 1.65rem; font-weight: 600; margin: .1rem 0 .3rem; letter-spacing: -.01em; }
h2 { font-size: 1.02rem; font-weight: 600; margin: 0 0 .8rem; }
.muted { color: var(--grey); }
.small { font-size: .85em; }

/* ---------- shell */
body.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.nav { background: var(--ink); color: #fff; padding: 1.2rem 0 1rem; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; font-weight: 600; padding: 0 1.2rem .4rem; }
.brand:hover { text-decoration: none; }
.brand-mark, .login-mark { background: var(--red); color: #fff; font-weight: 700; width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: var(--radius); font-size: .85rem; letter-spacing: .02em; }
.env { margin: .2rem 1.2rem .4rem; align-self: flex-start; font-family: var(--mono); font-size: .72rem; text-transform: uppercase; border: 1px solid var(--red); color: #fff; padding: 0 .4rem; border-radius: 3px; }
.nav nav { display: flex; flex-direction: column; flex: 1; }
.nav-h { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #9A9A9A; margin: 1.1rem 1.2rem .3rem; font-weight: 600; }
.nav nav a { color: #E6E6E6; padding: .38rem 1.2rem; border-left: 3px solid transparent; display: flex; justify-content: space-between; align-items: center; }
.nav nav a:hover { background: #262626; text-decoration: none; }
.nav nav a.on { border-left-color: var(--red); background: #262626; color: #fff; font-weight: 500; }
.nav nav a.subtle { color: #A8A8A8; font-size: .9em; }
.nav-empty { color: #8A8A8A; padding: .3rem 1.2rem; font-size: .88em; }
.pill { background: var(--red); color: #fff; font-size: .72rem; font-weight: 600; padding: 0 .45rem; border-radius: 999px; min-width: 1.4rem; text-align: center; }
.me { border-top: 1px solid #333; padding: .9rem 1.2rem 0; margin-top: 1rem; font-size: .85rem; display: flex; flex-direction: column; gap: .1rem; }
.me span { color: #9A9A9A; font-size: .78rem; }
.me a { color: #fff; margin-top: .3rem; }
.main { padding: 1.8rem 2.2rem 3rem; min-width: 0; max-width: 1400px; }
body.bare .main { padding: 0; max-width: none; }

/* ---------- page furniture */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.eyebrow { margin: 0; font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--grey); font-weight: 600; }
.eyebrow a { color: var(--grey); }
.meta { margin: .2rem 0 0; color: var(--grey); max-width: 70ch; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 1.8rem 0 .7rem; }
.section-head h2 { margin: 0; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; margin-bottom: 1.2rem; }
.panel.flush { padding: 0; overflow-x: auto; }
.panel.narrow, .form.narrow { max-width: 760px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; }
.panel-head a { font-size: .85rem; }
.panel-head.pad { padding: 1rem 1.3rem 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.2rem; align-items: start; }
.empty { color: var(--grey); padding: 1.1rem 1.3rem; margin: 0; }
.panel:not(.flush) .empty { padding: .2rem 0; }
.note { background: var(--paper); padding: .5rem .8rem; border-radius: var(--radius); font-size: .9rem; }
.panel.guide summary { cursor: pointer; font-weight: 600; }
.panel.guide ul { margin: .6rem 0 0; padding-left: 1.2rem; }
.panel.guide li { margin: .25rem 0; }
.panel.guide[open] summary { margin-bottom: .2rem; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }

/* reference ids are the thing people remember and quote */
.ref { font-family: var(--mono); font-weight: 700; color: var(--ink); letter-spacing: .02em; white-space: nowrap; }
a.ref:hover { color: var(--red); }
.ref.big { color: var(--red); margin-right: .35rem; }

/* ---------- stats & tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.stat { background: var(--white); border: 1px solid var(--line); border-top: 3px solid var(--ink); border-radius: var(--radius); padding: .9rem 1.1rem; color: var(--ink); display: flex; flex-direction: column; }
a.stat:hover { text-decoration: none; border-color: var(--grey); }
.stat .num { font-size: 2rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .num.small { font-size: 1rem; padding: .55rem 0 .3rem; }
.stat span:last-child { color: var(--grey); font-size: .85rem; }
.stat.alert { border-top-color: var(--red); }
.stat.alert .num { color: var(--red); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.tile { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; color: var(--ink); display: flex; flex-direction: column; gap: .2rem; background: var(--white); }
.tile:hover { border-color: var(--red); text-decoration: none; }
.tile-prefix { font-family: var(--mono); font-weight: 700; color: var(--red); font-size: .85rem; }
.tile span { color: var(--grey); font-size: .85rem; }
.tile .desc { color: var(--ink); }
.warn { color: var(--red); font-style: normal; font-weight: 500; }

/* ---------- tables & lists */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--grey); font-weight: 600; padding: .65rem .9rem; border-bottom: 1px solid var(--line); background: #FAFAFA; white-space: nowrap; }
.table td { padding: .6rem .9rem; border-bottom: 1px solid #EDEDED; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FAFAFA; }
.panel:not(.flush) .table th, .panel:not(.flush) .table td { padding-left: 0; }
.table.dense td { padding: .45rem .9rem; font-size: .9rem; }
.table tr.archived td { color: var(--grey); }
.table td.summary, .table td.changes { max-width: 420px; font-size: .85rem; overflow-wrap: anywhere; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid #EDEDED; }
.list li:last-child { border-bottom: 0; }
.list .muted { white-space: nowrap; font-size: .82rem; }
.list.roomy li { padding: .75rem 1.3rem; align-items: center; }
.list.compact li { padding: .35rem 0; font-size: .88rem; }
.list li.unread { border-left: 3px solid var(--red); background: #FFFCFC; }
.row-end { display: flex; gap: .8rem; align-items: center; }
.kind { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--grey); font-weight: 600; margin-right: .3rem; }

.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: .05rem .5rem; border-radius: 999px; background: var(--paper); color: var(--ink); border: 1px solid var(--line); white-space: nowrap; }
.b-new, .b-pending, .b-open, .b-draft, .b-running { background: #fff; }
.b-assigned, .b-in-progress, .b-under-review, .b-retry { background: var(--amber-tint); color: var(--amber); border-color: #F0D9B0; }
.b-blocked, .b-failed, .b-dead, .b-noncompliant, .b-error { background: var(--red-tint); color: var(--red-dark); border-color: #F2C3CB; }
.b-resolved, .b-closed, .b-active, .b-ok, .b-success, .b-compliant, .b-completed { background: var(--green-tint); color: var(--green); border-color: #C3E1D0; }
.b-retired, .b-archived, .b-disabled, .b-dismissed, .b-accepted, .b-unknown, .b-cancelled { color: var(--grey); }
.prio { font-size: .82rem; font-weight: 500; }
.prio.p-high { color: var(--red); }
.prio.p-critical { color: #fff; background: var(--red); padding: 0 .4rem; border-radius: 3px; font-weight: 600; }
.prio.p-low { color: var(--grey); }
.sev { font-weight: 600; font-size: .82rem; }
.sev.s-high { color: var(--red); } .sev.s-medium { color: var(--amber); } .sev.s-low, .sev.s-info { color: var(--grey); }
.due.late { color: var(--red); font-weight: 600; }
.due.late::after { content: " · overdue"; font-weight: 500; font-size: .8em; }
.due.soon { color: var(--amber); font-weight: 500; }

/* ---------- forms */
.form .field, .field { margin-bottom: 1rem; }
label { display: block; font-weight: 500; font-size: .88rem; margin-bottom: .3rem; }
label.check, label.inline { display: inline-flex; gap: .4rem; align-items: center; font-weight: 400; margin: 0; }
fieldset.checklist { border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .3rem .8rem; }
.taglist { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem; }
.taglist li { background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: .05rem .6rem;
  font-size: .82rem; }
input[type=text], input[type=search], input[type=url], input[type=date], input[type=number], input:not([type]), select, textarea {
  font: inherit; font-size: .93rem; width: 100%; padding: .5rem .65rem; border: 1px solid #C8C8C8; border-radius: var(--radius); background: #fff; color: var(--ink);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; border-color: var(--red); }
.help { color: var(--grey); font-size: .82rem; margin: .3rem 0 0; }
.error { color: var(--red-dark); font-size: .85rem; margin: .3rem 0 0; font-weight: 500; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--red); background: #FFFAFA; }
.req { color: var(--red); }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.actions { display: flex; gap: .6rem; align-items: center; margin-top: .4rem; }
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1rem; }
.filters input, .filters select { width: auto; min-width: 150px; }
.filters input[type=search] { min-width: 260px; }
.filters.inline-filters { margin: 0; }
.dl { display: grid; grid-template-columns: 110px 1fr; gap: .45rem .8rem; margin: 0 0 .6rem; font-size: .9rem; }
.dl.wide { grid-template-columns: 190px 1fr; font-size: .95rem; }
.dl dt { color: var(--grey); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.review input { margin-bottom: .4rem; font-size: .85rem; padding: .35rem .5rem; }
.row-actions { display: flex; gap: .35rem; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; font: inherit; font-size: .9rem; font-weight: 500; padding: .5rem 1rem; border-radius: var(--radius); border: 1px solid #BDBDBD; background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink); text-decoration: none; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn-danger { color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--grey); }
.btn-ghost:hover { color: var(--ink); border-color: var(--line); }
.btn-small { padding: .22rem .6rem; font-size: .8rem; }
.btn-wide { width: 100%; padding: .75rem 1rem; }

.flash { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid var(--line); border-left: 4px solid var(--ink); background: #fff; }
.flash-ok { border-left-color: var(--green); }
.flash-error { border-left-color: var(--red); background: #FFFAFA; color: var(--red-dark); }
body.bare .flash { max-width: 420px; margin: 1.5rem auto 0; }
.secret { border-color: var(--red); border-left: 4px solid var(--red); }
.secret pre { background: var(--ink); color: #fff; padding: .8rem 1rem; border-radius: var(--radius); overflow-x: auto; user-select: all; }

/* history */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 2px solid var(--line); padding: 0 0 1rem 1rem; position: relative; }
.timeline li::before { content: ""; width: 8px; height: 8px; background: var(--ink); border-radius: 50%; position: absolute; left: -5px; top: .45rem; }
.timeline li:first-child::before { background: var(--red); }
.tl-head { font-size: .9rem; }
.diff { margin-top: .35rem; font-size: .83rem; border-collapse: collapse; }
.diff th { text-align: left; color: var(--grey); font-weight: 500; padding: .1rem .8rem .1rem 0; vertical-align: top; }
.diff td { padding: .1rem .3rem; vertical-align: top; overflow-wrap: anywhere; max-width: 280px; }
.diff .old { color: var(--grey); text-decoration: line-through; }
.diff .arrow { color: var(--grey); }
.note-item { border-bottom: 1px solid #EDEDED; padding: .6rem 0; }
.note-item header { font-size: .85rem; margin-bottom: .2rem; }

/* pager */
.pager { display: flex; gap: 1rem; align-items: center; justify-content: flex-end; font-size: .88rem; color: var(--grey); margin: -.4rem 0 1rem; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; background: var(--paper);
  background-image: linear-gradient(90deg, var(--red) 0 6px, transparent 6px); }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); width: 100%; max-width: 420px; padding: 2.2rem 2.2rem 1.8rem; }
.login-card h1 { margin-top: 1rem; }
.lede { color: var(--grey); margin: 0 0 1.6rem; }
.fine { color: var(--grey); font-size: .8rem; margin: .9rem 0 0; }
.dev-login { margin-top: 1.6rem; border-top: 1px dashed var(--line); padding-top: .2rem; }
.dev-login .nav-h { margin: 1rem 0 0; color: var(--red); }
.role-picks { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; margin: .8rem 0 1rem; font-size: .85rem; }

@media (max-width: 1100px) { .grid-main, .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 800px) {
  body.shell { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; }
  .main { padding: 1.2rem; }
  .row-3 { grid-template-columns: 1fr; }
  .dl.wide { grid-template-columns: 1fr; }
}
@media print { .nav, .filters, .head-actions, .actions, form { display: none !important; } body.shell { display: block; } .panel { border: 0; } }

/* related records */
.links .verb { color: var(--grey); white-space: nowrap; width: 1%; font-size: .85rem; }
.links .row-end-cell { width: 1%; text-align: right; }
.link-form { margin-top: 1rem; border-top: 1px solid #EDEDED; padding-top: 1rem; }
.link-row { display: grid; grid-template-columns: 200px 1fr; gap: 1rem; }
@media (max-width: 800px) { .link-row { grid-template-columns: 1fr; } }
