:root {
  /* Tribal / Wakpamni-inspired earth palette: red clay, warm sand, deep pine, sky */
  --bg: #f7f3ec; --panel: #fffdf9; --ink: #241c15; --muted: #7a6d5d;
  --line: #e7ddcd; --accent: #B3452C; --accent2: #2f6d5b; --sky: #315b7d;
  --gold: #C68A3E; --danger: #a5342a;
  --shadow: 0 1px 2px rgba(36,28,21,.05), 0 10px 30px rgba(36,28,21,.07);
  /* Semantic tints — every soft fill in the app draws from these four, which
     is what makes a second theme a block of variable overrides rather than a
     rewrite. */
  --tint: #f4ede2; --hair: #f2ebe0; --soft: #fbf8f2; --chip: #efe7da;
}
* { box-sizing: border-box; }
/* Elements styled with display:flex/grid would otherwise ignore the hidden
   attribute entirely — the class rule beats the user-agent [hidden] rule. */
[hidden] { display: none !important; }
/* Same trap for dialogs: a display:flex rule would render a closed dialog inline. */
dialog:not([open]) { display: none !important; }
body { margin: 0; font: 14px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--sky); }

.topbar { display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(100deg, #7a2e1c, var(--accent) 55%, #9c3a24);
  color: #fff; padding: 12px 22px;
  border-bottom: 3px solid var(--gold); }
.brand { font-size: 18px; font-weight: 700; letter-spacing: .01em; }
.brand span { font-weight: 300; opacity: .9; }
.brandLink { color: #fff; text-decoration: none; }
.userbox a { color: #f3e6d8; }

/* ---- Top navigation ---- */
.navLeft { display: flex; align-items: center; gap: 14px; }
.navLinks { display: flex; gap: 4px; flex: 1; justify-content: center; }
.navLink { color: #f6e8d9; text-decoration: none; padding: 7px 14px; border-radius: 8px;
  font-size: 14px; transition: background .15s ease; white-space: nowrap; }
.navLink:hover { background: rgba(255,255,255,.14); }
.navLink.active { background: rgba(0,0,0,.22); color: #fff; font-weight: 600; }
.hamburger { display: none; flex-direction: column; gap: 4px; background: none; border: none;
  cursor: pointer; padding: 6px; }
.hamburger span { display: block; width: 22px; height: 2px; background: #fff; border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease; }
.hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.mobileNav { display: none; flex-direction: column; background: #8d3421; padding: 8px 12px 14px; }
.mobileNav .navLink { padding: 10px 12px; }
.userName { font-size: 13px; }
.roleChip { background: rgba(255,255,255,.2); border-radius: 999px; padding: 2px 10px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
@media (max-width: 900px) {
  .navLinks { display: none; }
  .hamburger { display: flex; }
  .mobileNav:not([hidden]) { display: flex; }
  .userName { display: none; }
}

/* ---- Administration ---- */
.adminWrap { max-width: 1160px; margin: 0 auto; padding: 40px 24px 60px; }
.statRow { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px; margin: 24px 0 30px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; box-shadow: var(--shadow); }
.statNum { font-size: 26px; font-weight: 700; color: var(--accent); line-height: 1.1; }
.statLbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.adminTabs { padding: 0; margin-bottom: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 0 12px 12px 12px;
  padding: 22px 24px; box-shadow: var(--shadow); }
.panelHead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 16px; }
.panelHead h2 { font-size: 17px; margin: 0; }
.accentBtn { background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 9px 16px; cursor: pointer; font-size: 13px; }
.adminTable { width: 100%; border-collapse: collapse; border: none; }
.adminTable th { background: transparent; border-bottom: 2px solid var(--line); padding: 8px 10px; }
.adminTable td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.miniBtn { background: var(--tint); border: 1px solid var(--line); border-radius: 6px;
  padding: 4px 12px; cursor: pointer; font-size: 12px; }
.roleChip.role-admin { background: var(--accent); color: #fff; }
.roleChip.role-assigner { background: var(--accent2); color: #fff; }
.roleChip.role-viewer { background: #d9cfc2; color: var(--ink); }
.roleChip.role-client { background: var(--sky); color: #fff; }
.roleChip.role-cfo { background: var(--gold); color: #241c15; }
.roleChip.role-root { background: #241c15; color: #fff; }
.actionChip { background: var(--tint); border-radius: 6px; padding: 2px 8px; font-size: 12px; font-family: ui-monospace, monospace; }
.ok { color: #2f6d5b; font-weight: 600; }
.warn { color: var(--danger); font-weight: 600; }
.formGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 14px 0; }
.formGrid label, .wideField { display: block; font-size: 13px; color: var(--muted); }
.formGrid .wideField { grid-column: 1 / -1; }
.formGrid input, .formGrid select { display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 6px; font-size: 14px; }
.entityPick { margin: 10px 0 4px; }
.entChk { display: inline-flex; align-items: center; gap: 6px; margin: 0 12px 8px 0; }
.inlineChk { display: inline-flex; align-items: center; gap: 6px; margin: 4px 16px 4px 0; font-size: 13px; }

/* ---- Inline AI (Curated) search on the dashboard ---- */
.aiBar { margin: 12px 20px 0; }
.aiBarInner { display: flex; align-items: center; gap: 10px; background: var(--panel);
  border: 2px solid var(--gold); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow); }
.aiSpark { color: var(--gold); font-size: 18px; }
.aiBarInner input { flex: 1; border: none; outline: none; font: inherit; font-size: 14.5px;
  background: transparent; color: var(--ink); }
.aiHint { margin: 6px 4px 0; font-size: 12px; }
.aiPanel { margin: 16px 20px 0; }
.aiStatus { display: flex; align-items: center; gap: 16px; background: var(--panel);
  border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 10px;
  padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.aiSummaryLine { background: var(--soft); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 14px; margin-bottom: 14px; font-size: 13.5px; color: var(--muted); }
.resultActions { display: flex; gap: 8px; margin-top: 12px; }
/* These titles ARE links and have to look like it. Rendering them as plain ink
   made a whole page of results read as dead text — the click target was there,
   nobody could tell. */
.resultTitle a { color: var(--accent); text-decoration: none;
  border-bottom: 1px solid rgba(179,69,44,.35); }
.resultTitle a:hover { border-bottom-color: var(--accent); }
.resultTitle a::after { content: ' ›'; opacity: .55; font-weight: 400; }

.liveNote { margin: 10px 20px 0; padding: 8px 12px; background: #eef5f1;
  border: 1px solid var(--accent2); border-radius: 8px; color: #245c4c; font-size: 12.5px; }

/* ---- Shared search-syntax help ---- */
/* Specific enough to beat .toolbar button, which sets a much wider padding. */
.syntaxBtn, .toolbar button.syntaxBtn {
  flex: 0 0 auto; width: 24px; height: 24px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  font-size: 12px; font-weight: 700; cursor: pointer; line-height: 1; align-self: center; }
.syntaxBtn:hover { border-color: var(--accent); color: var(--accent); }
.syntaxPanel { position: absolute; z-index: 60; width: 380px; max-width: calc(100vw - 24px);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.16); padding: 14px 16px; }
.syntaxTitle { font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.syntaxPanel table { width: 100%; border-collapse: collapse; }
.syntaxPanel td { padding: 3px 0; font-size: 12.5px; vertical-align: top; }
.syntaxPanel td:first-child { padding-right: 12px; white-space: nowrap; }
.syntaxPanel code { background: var(--tint); border-radius: 4px; padding: 1px 6px;
  font-family: ui-monospace, monospace; font-size: 12px; }
.syntaxFoot { margin: 10px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }

/* ---- Help / FAQ ---- */
.helpWrap { max-width: 860px; margin: 0 auto; padding: 40px 24px 70px; }
.helpSearch { width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 14.5px; margin: 18px 0 14px; background: var(--panel); }
.helpJump { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.helpJump a { font-size: 12.5px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); text-decoration: none; color: var(--muted); }
.helpJump a:hover { border-color: var(--accent); color: var(--accent); }
.helpSection { margin-bottom: 26px; }
.helpSection .sectionTitle { margin-top: 0; }
.helpWrap details { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 0 16px; margin-bottom: 8px; box-shadow: var(--shadow); }
.helpWrap details[open] { padding-bottom: 6px; }
.helpWrap summary { cursor: pointer; padding: 13px 0; font-weight: 600; font-size: 14.5px; list-style: none; }
.helpWrap summary::-webkit-details-marker { display: none; }
.helpWrap summary::before { content: '▸'; color: var(--accent); margin-right: 10px; display: inline-block;
  transition: transform .15s ease; }
.helpWrap details[open] > summary::before { transform: rotate(90deg); }
.helpWrap details p, .helpWrap details ul, .helpWrap details ol { margin: 0 0 12px; font-size: 14px; }
.helpWrap details ul, .helpWrap details ol { padding-left: 22px; }
.helpWrap details li { margin-bottom: 5px; }
.helpWrap details table { margin-bottom: 12px; }
.helpCode { background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px;
  font-family: ui-monospace, monospace; font-size: 12.5px; line-height: 1.7; overflow-x: auto; margin: 0 0 12px; }
.helpWrap code { background: var(--tint); border-radius: 4px; padding: 1px 6px;
  font-family: ui-monospace, monospace; font-size: 12.5px; }
.helpTbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.helpTbl th, .helpTbl td { text-align: left; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line);
  vertical-align: top; }
/* The global th rule upper-cases headers, which would silently rewrite the one
   set-aside code that is genuinely mixed case (BICiv) on the very page warning
   about it. These cells carry literal values, so they keep their own casing. */
.helpTbl th { color: var(--muted); font-weight: 600; white-space: nowrap;
  text-transform: none; letter-spacing: normal; font-size: 13px; }
.helpTbl td code { white-space: nowrap; }
.offsite { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .3px;
  text-transform: uppercase; color: #8a5a1e; background: #fbf0dd; border: 1px solid #e8d3ac;
  border-radius: 999px; padding: 2px 9px; margin-left: 8px; vertical-align: middle; }

/* ---- Deep search ---- */
.deepBtn { background: var(--sky); color: #fff; border: none; border-radius: 8px;
  padding: 9px 16px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.deepBtn[disabled] { opacity: .7; cursor: wait; }
.deepReport { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--sky);
  border-radius: 10px; padding: 18px 20px; box-shadow: var(--shadow); }
.deepHead { font-size: 15px; margin-bottom: 14px; }
.deepGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.deepStat { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.deepNum { font-size: 28px; font-weight: 700; color: var(--sky); line-height: 1.1; }
.deepFoot { margin-top: 14px; }

.discBar { display: flex; align-items: center; gap: 12px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 14px 0 10px; }
.discBar .spacer { flex: 1; }
.discTable { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.discTable td, .discTable th { padding: 8px 10px; font-size: 13px; }
.discTable tbody tr:hover { background: var(--soft); }

/* ---- Opportunity detail modal ---- */
.detailDlg { border: 1px solid var(--line); border-radius: 14px; padding: 0;
  width: min(860px, 92vw); max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.detailDlg::backdrop { background: rgba(36,28,21,.42); }
.dtHead { background: linear-gradient(100deg, #7a2e1c, var(--accent) 60%); color: #fff;
  padding: 16px 22px; border-bottom: 3px solid var(--gold); }
.dtHead h3 { margin: 0; font-size: 17px; line-height: 1.35; }
.dtScroll { overflow-y: auto; padding: 20px 22px; flex: 1; }
.dtAssign { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.metaGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px 20px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 16px; }
.metaGrid > div { display: flex; flex-direction: column; }
.metaK { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.metaV { font-size: 13.5px; }
.dtH { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  margin: 20px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.dtText { white-space: pre-wrap; font-size: 13.5px; line-height: 1.6; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; max-height: 380px; overflow-y: auto; }
.dtLoading { display: flex; align-items: center; gap: 12px; padding: 18px 0; }
.dtFoot { display: flex; align-items: center; gap: 12px; margin: 0; padding: 14px 22px;
  border-top: 1px solid var(--line); background: var(--soft); }
.dtFoot button { padding: 8px 16px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); cursor: pointer; }
/* keep the primary action solid — the generic rule above would make it white on white */
.dtFoot button.accentBtn { background: var(--accent); border-color: var(--accent); color: #fff; }
.dtFoot button.accentBtn[disabled] { opacity: .7; cursor: wait; }
.dtOut { margin-left: auto; font-weight: 600; font-size: 13.5px; }
.cacheNote { background: #eef5f1; border: 1px solid var(--accent2); color: #245c4c;
  border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 0 0 10px; }
.sumPending { color: #b9ab98; cursor: default; }

/* ---- Curated Search ---- */
.searchWrap { max-width: 900px; margin: 0 auto; padding: 40px 24px 60px; }
.searchBox { background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px; box-shadow: var(--shadow); margin-bottom: 20px; }
.searchBox textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; font: inherit; resize: vertical; }
.searchFoot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; gap: 14px; }
.progressBox { display: flex; align-items: center; gap: 16px; background: var(--panel);
  border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px;
  padding: 18px 20px; margin-bottom: 22px; box-shadow: var(--shadow); }
.progTitle { font-weight: 600; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.resultCard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow); }
.resultHead { display: flex; align-items: flex-start; gap: 14px; }
.rankNum { background: var(--accent); color: #fff; width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none; }
.resultTitle { font-weight: 600; font-size: 15px; }
.resultHead > div { flex: 1; }
.typePill { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 3px 10px;
  border-radius: 999px; background: var(--tint); color: var(--muted); flex: none; }
.typePill.grant { background: #e6f0ea; color: var(--accent2); }
.typePill.contract { background: #e9eff5; color: var(--sky); }
.resultWhy { margin: 12px 0 10px; }
.resultFlags { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.flagOk { color: var(--accent2); font-weight: 600; }
.flagWarn { color: var(--muted); }
.flagNote { background: #fdf6e8; border: 1px solid var(--gold); color: #7a5a20;
  border-radius: 6px; padding: 1px 8px; }

/* ---- Sovereign Express ---- */
.sovexWrap { max-width: 1100px; margin: 0 auto; padding: 40px 24px 60px; }
.sovexHead { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 26px; }
.cartPill { background: var(--accent); color: #fff; border: none; border-radius: 999px;
  padding: 10px 20px; font-size: 14px; cursor: pointer; box-shadow: var(--shadow); }
.cartPill span { background: rgba(255,255,255,.25); border-radius: 999px; padding: 1px 8px; margin-left: 4px; }
.sectionTitle { font-size: 18px; margin: 38px 0 14px; }
.productCard { padding: 0; overflow: hidden; }
.prodImg { height: 150px; background-size: cover; background-position: center; position: relative; }
.badge2 { position: absolute; top: 10px; left: 10px; background: var(--gold); color: #241c15;
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.productCard h2 { font-size: 16px; margin: 14px 18px 6px; }
.productCard p { margin: 0 18px 14px; }
.prodRow { display: flex; justify-content: space-between; align-items: center; padding: 0 18px 18px; }
.price { font-size: 19px; font-weight: 700; color: var(--accent); }
.priceSub { font-size: 12px; color: var(--muted); }
.addBtn { background: var(--accent2); color: #fff; border: none; border-radius: 8px;
  padding: 8px 14px; cursor: pointer; font-size: 13px; }
.rmBtn { background: none; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; padding: 2px 8px; color: var(--danger); }
.mono, td.mono { font-family: ui-monospace, monospace; font-size: 12px; }

/* ---- Marketplace ---- */
.marketWrap { max-width: 1040px; margin: 0 auto; padding: 48px 24px; }
.marketTitle { font-size: 28px; margin: 0 0 6px; letter-spacing: -.01em; }
.marketSub { color: var(--muted); margin: 0 0 32px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 26px 24px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.card:hover { transform: translateY(-3px); border-color: var(--accent2);
  box-shadow: 0 4px 8px rgba(22,32,43,.06), 0 16px 40px rgba(31,78,121,.12); }
.card.disabled { opacity: .62; pointer-events: none; }
.cardIcon { font-size: 30px; margin-bottom: 10px; }
.card h2 { font-size: 18px; margin: 0 0 8px; }
.card p { color: var(--muted); font-size: 13.5px; margin: 0 0 16px; }
.cardCta { color: var(--accent2); font-weight: 600; font-size: 14px; }
.cardCta.muted { color: var(--muted); font-weight: 400; }
.adminRow { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 13px; display: flex; gap: 14px; }
.dlgSub { color: var(--muted); font-size: 13px; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }
.userbox { display: flex; gap: 14px; align-items: center; font-size: 13px; }
.userbox a { color: #cfe3f5; }

.tabs { display: flex; gap: 4px; padding: 10px 20px 0; }
.tab { border: 1px solid var(--line); border-bottom: none; background: #e8edf3;
  padding: 8px 22px; border-radius: 8px 8px 0 0; cursor: pointer; font-size: 14px; color: var(--muted); }
.tab.active { background: var(--panel); color: var(--ink); font-weight: 600; }

.toolbar { display: flex; gap: 8px; align-items: center; background: var(--panel);
  margin: 0 20px; padding: 12px; border: 1px solid var(--line); border-radius: 0 8px 8px 8px; }
.toolbar input, .toolbar select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; }
.toolbar input#fQ { flex: 1; min-width: 240px; }
.toolbar .narrow { width: 110px; }
.toolbar .spacer { flex: 1; }
.toolbar button { padding: 7px 16px; border: 1px solid var(--line); border-radius: 6px;
  background: #eef2f7; cursor: pointer; }
.toolbar button.accent, dialog button.accent { background: var(--accent); border-color: var(--accent); color: #fff; }

.legend { display: flex; gap: 14px; padding: 10px 22px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend .chip { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

main { padding: 0 20px 30px; }
table { width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); background: #f0f4f8; padding: 9px 12px; border-bottom: 1px solid var(--line); }
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:hover td { background: #f8fafc; }
td a { color: var(--accent); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; color: #fff; font-size: 12px; font-weight: 600; }
.badge.unassigned { background: #94a3b8; }
.status { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.status.in_use { color: #b45309; }
.status.available { color: #15803d; }
.status.inactive { color: #94a3b8; }

.assignBtn { padding: 4px 12px; border: 1px solid var(--line); background: #eef2f7;
  border-radius: 6px; cursor: pointer; font-size: 12px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

dialog { border: 1px solid var(--line); border-radius: 10px; padding: 20px 24px; min-width: 320px; }
dialog::backdrop { background: rgba(15, 23, 42, .35); }
dialog h3 { margin-top: 0; }
dialog label { display: block; margin: 12px 0; font-size: 13px; color: var(--muted); }
dialog select { display: block; width: 100%; margin-top: 4px; padding: 7px; border: 1px solid var(--line); border-radius: 6px; }
dialog menu { display: flex; gap: 8px; justify-content: flex-end; padding: 0; margin: 18px 0 0; }
dialog button { padding: 7px 16px; border: 1px solid var(--line); border-radius: 6px; background: #eef2f7; cursor: pointer; }
dialog button.danger { background: #fdf1ef; border-color: var(--danger); color: var(--danger); }
dialog.wide { min-width: 640px; max-width: 80vw; }
.sumPre { white-space: pre-wrap; max-height: 60vh; overflow-y: auto; background: #f8fafc;
  border: 1px solid var(--line); border-radius: 8px; padding: 14px; font-size: 13px; line-height: 1.5; }
.bidBtn { padding: 4px 12px; border: 1px solid var(--accent); background: #eaf2fa; color: var(--accent);
  border-radius: 6px; cursor: pointer; font-size: 12px; margin-left: 4px; }
.bidBtn[disabled] { opacity: .6; cursor: wait; }

/* Back to the organisation portal. Visually separated from the FedBidX nav,
   because it leaves this product rather than moving within it. */
.hubLink { border: 1px solid rgba(255,255,255,.35); border-radius: 7px;
  padding: 4px 10px; margin-right: 6px; white-space: nowrap; }
.hubLink:hover { background: rgba(255,255,255,.14); }

/* ================= theme: dark navy =================
   Monday-inspired night chrome on the same variables. Toggling is one
   attribute on <html>; nothing re-renders, the variables just change. */
[data-theme="dark"] {
  --bg: #10141f; --panel: #191f30; --ink: #e7eaf3; --muted: #98a2ba;
  --line: #2a3149; --accent: #e0654a; --accent2: #45b391; --sky: #79aede;
  --gold: #d9a45b; --danger: #ef7264;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  --tint: #232a41; --hair: #232a40; --soft: #1d2336; --chip: #2a3350;
}
[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
[data-theme="dark"] .topbar { background: linear-gradient(100deg, #151b2e, #1b2340 55%, #182036);
  border-bottom-color: var(--gold); }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea {
  background: #141927; color: var(--ink); border-color: var(--line); }
[data-theme="dark"] th { background: var(--soft); }
[data-theme="dark"] dialog { background: var(--panel); color: var(--ink); border-color: var(--line); }
[data-theme="dark"] #toastB { background: #e7eaf3; color: #10141f; }

/* ================= left icon rail ================= */
.rail { position: fixed; top: 52px; left: 0; bottom: 0; width: 74px; z-index: 40;
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: stretch; padding: 10px 0; gap: 2px; }
.rail a { display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 4px; margin: 0 8px; border-radius: 9px; text-decoration: none;
  color: var(--muted); font-size: 9.5px; font-weight: 600; letter-spacing: .02em; }
.rail a svg { width: 21px; height: 21px; stroke: currentColor; fill: none;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rail a:hover { background: var(--tint); color: var(--ink); }
.rail a.active { background: var(--tint); color: var(--accent); }
.rail .railSpacer { flex: 1; }
body.withRail { padding-left: 74px; }
body.withRail .topbar { position: sticky; top: 0; z-index: 41; margin-left: -74px; padding-left: 90px; }
@media (max-width: 860px) {
  .rail { display: none; }
  body.withRail { padding-left: 0; }
  body.withRail .topbar { margin-left: 0; padding-left: 16px; }
}
.themeBtn { background: none; border: 1px solid rgba(255,255,255,.35); color: #fff;
  border-radius: 7px; padding: 3px 9px; cursor: pointer; font-size: 13px; }
.themeBtn:hover { background: rgba(255,255,255,.12); }

/* ---- dark polish: every surface the first live test caught ---- */
/* The washed-out row: light hover paint under light text. */
[data-theme="dark"] tr:hover td { background: var(--soft); }
[data-theme="dark"] thead th, [data-theme="dark"] th { background: var(--soft); color: var(--muted); }
/* Tabs read as headings for the two catalogs — they must survive the flip. */
[data-theme="dark"] .tab { background: var(--chip); color: var(--muted); border-color: var(--line); }
[data-theme="dark"] .tab.active { background: var(--panel); color: var(--ink); }
/* The stealth Close button, and every dialog control with it. */
[data-theme="dark"] dialog button { background: var(--tint); color: var(--ink); border-color: var(--line); }
[data-theme="dark"] dialog button.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-theme="dark"] dialog button.danger { background: rgba(239,114,100,.14); color: var(--danger); border-color: var(--danger); }
[data-theme="dark"] .toolbar button, [data-theme="dark"] .assignBtn { background: var(--tint); color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .toolbar button.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
[data-theme="dark"] .bidBtn { background: rgba(224,101,74,.14); color: var(--accent); border-color: var(--accent); }
[data-theme="dark"] .miniBtn { background: var(--tint); color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .sumPre { background: var(--soft); color: var(--ink); }
/* Informational strips: translucent tints of their own accent, not daylight. */
[data-theme="dark"] .liveNote, [data-theme="dark"] .cacheNote { background: rgba(69,179,145,.12); color: var(--accent2); }
[data-theme="dark"] .flagNote { background: rgba(217,164,91,.12); color: var(--gold); }
[data-theme="dark"] .summaryTag { background: rgba(217,164,91,.14); color: var(--gold); border-color: rgba(217,164,91,.4); }
[data-theme="dark"] .typePill.grant { background: rgba(69,179,145,.16); color: var(--accent2); }
[data-theme="dark"] .typePill.contract { background: rgba(121,174,222,.16); color: var(--sky); }
[data-theme="dark"] .roleChip.role-viewer { background: var(--chip); color: var(--ink); }
[data-theme="dark"] .roleChip.role-root { background: var(--chip); color: var(--ink); }
[data-theme="dark"] .badge.unassigned { background: #55617c; }
/* Headings, everywhere, both themes: consistent hierarchy and full contrast. */
h1, h2, h3 { color: var(--ink); letter-spacing: -.01em; }
h1 { font-weight: 750; }
[data-theme="dark"] .dtHead h3 { color: #fff; }
