:root {
  --ink: #1b2430;
  --muted: #5b6676;
  --line: #d9dee5;
  --bg: #f5f7fa;
  --card: #ffffff;
  --brand: #0b4f8a;
  --ok: #1f7a3d;
  --hold: #7a5200;
  --bad: #b42318;
  --review: #4b3aa8;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; }
.banner { background: #fff4d6; border-bottom: 1px solid #e8c766; padding: 8px 16px; font-weight: 600; font-size: 13px; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: var(--brand); color: #fff; }
.brand { font-size: 18px; font-weight: 700; }
.tag { font-size: 11px; font-weight: 600; background: rgba(255,255,255,.18); padding: 2px 8px; border-radius: 10px; margin-left: 8px; }
.who { font-size: 13px; display: flex; gap: 10px; align-items: center; }
.who button { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.6); }
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 90px); }
.nav { border-right: 1px solid var(--line); background: var(--card); padding: 8px 0; }
.nav button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 16px; font-size: 14px; color: var(--ink); cursor: pointer; border-radius: 0; }
.nav button:hover { background: #eef3f8; }
.nav button[aria-current="page"] { background: #e3edf7; font-weight: 700; border-left: 3px solid var(--brand); }
.nav button:disabled { color: #a0a8b3; cursor: not-allowed; }
.main { padding: 18px 22px; overflow-x: auto; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 20px 0 8px; }
.sub { color: var(--muted); margin: 0 0 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.card .k { color: var(--muted); font-size: 12px; }
.card .v { font-size: 24px; font-weight: 700; margin-top: 2px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 14px; }
table { border-collapse: collapse; width: 100%; background: var(--card); }
th, td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfc; }
tr.click { cursor: pointer; }
tr.click:hover { background: #f2f6fb; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: #eef1f4; }
.pill.Review, .pill.ok { background: #ece9fb; color: var(--review); }
.pill.Hold, .pill.warn { background: #fff4d6; color: var(--hold); }
.pill.Excluded, .pill.bad { background: #fde8e7; color: var(--bad); }
.pill.good { background: #e3f4e8; color: var(--ok); }
.gate { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); }
form.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; }
label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
input, select, textarea { font: inherit; padding: 6px 8px; border: 1px solid #b9c2cd; border-radius: 6px; color: var(--ink); background: #fff; }
textarea { min-height: 120px; resize: vertical; }
label.wide { grid-column: 1 / -1; }
label.check { flex-direction: row; align-items: center; gap: 6px; }
button { font: inherit; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--brand); background: var(--brand); color: var(--btn-ink, #fff); cursor: pointer; }
button.secondary { background: #fff; color: var(--brand); }
button.danger { background: #fff; color: var(--bad); border-color: var(--bad); }
button:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.msg { padding: 8px 12px; border-radius: 6px; margin: 8px 0; }
.msg.err { background: #fde8e7; color: var(--bad); }
.msg.ok { background: #e3f4e8; color: var(--ok); }
.msg.info { background: #eef3f8; color: var(--brand); }
pre { white-space: pre-wrap; background: #fafbfc; border: 1px solid var(--line); border-radius: 6px; padding: 10px; font-size: 13px; }
.muted { color: var(--muted); }
.login { max-width: 460px; margin: 40px auto; }
.finding.HIGH { color: var(--bad); }
.finding.MEDIUM { color: var(--hold); }
.finding.INFO { color: var(--muted); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } .split { grid-template-columns: 1fr; } }

/* charts */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; margin-bottom: 8px; }
.chartbox { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px 6px; min-width: 0; }
.chartbox h3 { margin: 4px 0 4px; font-size: 14px; }
.chart { width: 100%; height: auto; display: block; }
.chart .ct { font-size: 12px; fill: #46515f; }
.chart .cv { font-size: 12px; font-weight: 700; fill: #1d2733; }
.chart .bar { fill: #0b5189; }
.chart .bar.good { fill: #1f8a4c; } .chart .bar.warn { fill: #c98a00; } .chart .bar.bad { fill: #c0392b; } .chart .bar.info { fill: #2f6bff; }
.card .v.sm { font-size: 18px; }
/* mobile menu */
.menu { display: none; }
@media (max-width: 900px) {
  .menu { display: inline-block; margin-right: 10px; padding: 6px 12px; }
  .nav { display: none; }
  body.navopen .nav { display: block; }
  .charts { grid-template-columns: 1fr; }
}

/* phones: header and stacked table cards */
.who .name { overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .top { flex-wrap: wrap; gap: 8px; }
  .brand { flex: 1 1 60%; min-width: 0; }
  .who { flex: 1 1 100%; justify-content: space-between; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tr { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; padding: 6px 10px; background: var(--card); }
  td { border: 0; padding: 4px 0; overflow-wrap: anywhere; }
  td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #5b6673; }
}

/* project status */
.kv { display: grid; grid-template-columns: minmax(130px, 220px) 1fr; gap: 4px 14px; margin: 6px 0 0; }
.kv dt { color: var(--muted); font-size: 12px; padding-top: 2px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
h2.tight { margin: 0 0 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.src { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.src.live { background: #e3f4e8; color: var(--ok); }
.src.known { background: #eef3f8; color: var(--brand); }
.src.plan { background: #fff4d6; color: var(--hold); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; }
.pill.info { background: #e8eef5; color: #3a4a5d; }
@media (max-width: 700px) { .kv { grid-template-columns: 1fr; } }

/* enterprise shell */
.top { gap: 12px; flex-wrap: wrap; justify-content: flex-start; position: sticky; top: 0; z-index: 20; }
.brand { white-space: nowrap; }
.env { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 10px; background: #fff4d6; color: #6b4a00; border: 1px solid #e8c766; }
.env.local { background: #e3f4e8; color: #14532d; border-color: #9bd3ad; }
.env.production { background: #fde8e7; color: #7a1a12; border-color: #e3a29c; }
.gsearch { position: relative; flex: 1 1 220px; max-width: 420px; }
.gsearch input { width: 100%; }
.results, .popmenu { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.18); z-index: 30; }
.results button, .popmenu button { display: block; width: 100%; text-align: left; background: none; color: var(--ink); border: 0; border-radius: 0; padding: 8px 12px; }
.results button:hover, .popmenu button:hover { background: #eef3f8; }
.results small { display: block; color: var(--muted); }
.pad { padding: 8px 12px; margin: 0; }
.topactions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.popwrap { position: relative; }
.popmenu { left: auto; right: 0; min-width: 220px; }
.popmenu.right { width: 280px; }
button.ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.6); }
.badge { display: inline-block; margin-left: 6px; min-width: 18px; padding: 0 5px; border-radius: 9px; background: #fff; color: var(--brand); font-size: 12px; font-weight: 700; text-align: center; }
.top :focus-visible, .nav :focus-visible { outline: 3px solid #ffbf47; outline-offset: 2px; }
:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; }
.navsec { border-bottom: 1px solid var(--line); padding: 4px 0; }
button.navhead { text-transform: uppercase; font-size: 11px; letter-spacing: .06em; color: var(--muted); font-weight: 700; display: flex; justify-content: space-between; }
button.navhead::after { content: "\25BE"; }
button.navhead[aria-expanded="false"]::after { content: "\25B8"; }
.navfuture { display: flex; justify-content: space-between; align-items: center; padding: 9px 16px; color: #6b7480; cursor: not-allowed; }
.navfuture small { font-size: 10px; background: #eef1f4; border-radius: 8px; padding: 1px 6px; }
.layout { min-height: calc(100vh - 100px); }
.nav { width: 230px; }
.layout { grid-template-columns: 230px 1fr; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } .gsearch { flex-basis: 100%; max-width: none; order: 5; } .topactions { margin-left: 0; flex-wrap: wrap; } }
@media (max-width: 700px) { .who { flex: 1 1 100%; } .top .brand { flex: 0 1 auto; } }

/* lists and dashboard */
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 14px; }
button.card.metric { text-align: left; display: flex; flex-direction: column; gap: 2px; color: var(--ink); cursor: pointer; font: inherit; }
button.card.metric:hover:not(:disabled) { border-color: var(--brand); background: #f2f6fb; }
button.card.metric:disabled { opacity: .6; cursor: not-allowed; }
.metric .hint { font-size: 12px; color: var(--muted); }
.cmd { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; align-items: start; }
.cmd .panel { margin-bottom: 0; min-width: 0; }
.tasklist { padding-left: 18px; margin: 0; line-height: 1.9; }
.small { font-size: 12px; }
.views { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
button.tab { background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 16px; padding: 4px 12px; }
button.tab.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.count { font-size: 11px; opacity: .85; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.toolbar input[type=search] { min-width: 220px; }
label.inline { flex-direction: row; align-items: center; gap: 6px; }
button.sortbtn { background: none; border: 0; color: inherit; font: inherit; font-weight: 600; padding: 0; cursor: pointer; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: flex-end; margin: 10px 0; }
td.empty { text-align: center; padding: 24px; color: var(--muted); }

/* record page */
.recgrid { display: grid; grid-template-columns: 240px minmax(0, 1fr) 240px; gap: 14px; align-items: start; }
.recgrid .panel { margin-bottom: 0; }
.rechead { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.kv.narrow { grid-template-columns: 1fr; gap: 0; }
.kv.narrow dd { margin-bottom: 8px; }
.timeline { padding-left: 18px; }
.timeline li { margin-bottom: 8px; }
@media (max-width: 1100px) { .recgrid { grid-template-columns: 220px minmax(0, 1fr); } .recright { grid-column: 1 / -1; } }
@media (max-width: 760px) { .recgrid { grid-template-columns: 1fr; } }

.mobsort { display: none; }
@media (max-width: 700px) { .mobsort { display: flex; } }

/* accessibility, states, dialogs */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: #fff; color: var(--brand); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: #12351f; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.toast.err { background: #7a1a12; }
dialog.modal { border: 0; border-radius: 10px; padding: 20px; max-width: min(440px, calc(100vw - 32px)); box-shadow: 0 10px 40px rgba(0,0,0,.35); }
dialog.modal::backdrop { background: rgba(10,20,35,.5); }
.skeleton { padding: 8px 0; }
.sk { height: 16px; border-radius: 6px; background: linear-gradient(90deg, #e8edf2, #f6f8fa, #e8edf2); background-size: 200% 100%; animation: sk 1.2s infinite; margin: 12px 0; }
.sk.w40 { width: 40%; height: 24px; } .sk.w70 { width: 70%; } .sk.w100 { width: 100%; height: 72px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }
.errstate { max-width: 520px; margin: 40px auto; padding: 20px; background: #fde8e7; border: 1px solid #e3a29c; border-radius: 10px; }
.empty { text-align: center; color: var(--muted); padding: 24px; }
details.probe { margin-top: 14px; } details.probe summary { cursor: pointer; color: var(--muted); }
/* kanban */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kcol { background: #eef2f6; border-radius: 10px; padding: 10px; min-height: 160px; }
.kcol.restricted { background: #fbeceb; }
.kcol header { display: flex; justify-content: space-between; align-items: center; }
.kcard { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-top: 8px; cursor: grab; }
.klink { background: none; border: 0; color: var(--brand); font-weight: 700; text-align: left; padding: 0; text-decoration: underline; }
.kmeta { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.kscore { font-size: 12px; color: var(--muted); }
.kmove select { width: 100%; margin-top: 6px; }
.kempty { color: var(--muted); font-size: 12px; text-align: center; padding: 14px 0; }
/* calendar */
.calnav { display: inline-flex; gap: 8px; align-items: center; }
.calgrid.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.calgrid.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.calhead { background: #fafbfc; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px; text-align: center; }
.calday { background: var(--card); min-height: 96px; padding: 4px; }
.calday.out { background: #f3f5f8; color: #8793a1; }
.calday.today .daynum { background: var(--brand); color: #fff; border-radius: 10px; padding: 0 6px; display: inline-block; }
.daynum { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
button.calitem, .calitem { display: block; width: 100%; text-align: left; font-size: 12px; padding: 3px 6px; margin: 2px 0; border-radius: 4px; border: 0; border-left: 4px solid; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; color: var(--ink); }
.calitem.review { background: #fff4d6; border-color: #c98a00; }
.calitem.changes { background: #fde8e7; border-color: #b42318; }
.calitem.reviewed { background: #e3edf7; border-color: #0b4f8a; }
.calitem.rejected { background: #eceff3; border-color: #5b6676; text-decoration: line-through; }
.calitem .ch { font-weight: 700; font-size: 10px; background: rgba(0,0,0,.1); border-radius: 3px; padding: 0 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; } .legendi { width: auto; cursor: default; }
.calprev { margin-top: 14px; }
@media (max-width: 760px) { .calgrid.month { grid-template-columns: 1fr; } .calgrid.month .calhead, .calgrid.month .calday.out { display: none; } .calday { min-height: 0; } .calgrid.week { grid-template-columns: 1fr; } .calday:empty, .calgrid.month .calday:not(:has(.calitem)) { display: none; } }
/* audit timeline */
.tday h3 { margin: 16px 0 4px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 3px solid var(--line); }
.timeline li { position: relative; padding: 4px 0 10px 12px; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 10px; width: 11px; height: 11px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; }
.timeline li.bad::before { background: var(--bad); }
button.tab[aria-pressed="true"] { background: var(--brand); color: #fff; }

.layout > * { min-width: 0; }
.board { max-width: 100%; }
.board, .kcard, .toolbar label { position: relative; }
@media (min-width: 901px) { .nav { position: sticky; top: 50px; align-self: start; max-height: calc(100vh - 50px); overflow-y: auto; } }
@media (max-width: 700px) {
  .banner { font-size: 11px; padding: 6px 12px; }
  .board { grid-auto-flow: row; grid-auto-columns: auto; overflow-x: visible; }
  .topactions button, .top .who button { font-size: 13px; padding: 5px 9px; }
  .top { padding: 8px 12px; gap: 6px; }
}
.calday.out, .calday.out .daynum { color: #566272; }
.recgrid .panel .panel { margin-bottom: 10px; }

/* Touch screens: make controls at least 44 by 44 pixels so they are easy to tap. */
@media (pointer: coarse) {
  button, select, summary, .tab, input:not([type=checkbox]):not([type=radio]) { min-height: 44px; }
  .top button, .top a { min-height: 44px; display: inline-flex; align-items: center; }
  input[type=checkbox], input[type=radio] { width: 24px; height: 24px; }
  .kmove select { min-height: 44px; }
  .nav button { min-height: 44px; }
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.results [role=option].active, .results [role=option]:hover { background: #e3eefb; outline: 2px solid #1b6bb8; outline-offset: -2px; }

/* Prospect Discovery */
button.linkbtn { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; font: inherit; text-align: left; }
fieldset.checks { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 16px; }
fieldset.checks legend { font-weight: 600; padding: 0 4px; }
pre.draftbody { white-space: pre-wrap; word-break: break-word; background: #f6f8fa; border: 1px solid var(--line); border-radius: 6px; padding: 10px; font: inherit; }
@media (pointer: coarse) { button.linkbtn { min-height: 44px; } }
fieldset.checks input[type=checkbox], form.grid label.check input[type=checkbox] { width: 24px; height: 24px; margin: 0 6px 0 0; }
fieldset.checks label.check { display: inline-flex; align-items: center; min-height: 32px; }
.report { width: 100%; margin-top: 8px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
