:root {
  --bg: #0d1117;
  --panel: #141a23;
  --panel2: #1a222d;
  --line: #24303d;
  --text: #dbe4ee;
  --dim: #8fa1b5;
  --faint: #64748b;
  --go: #2fbf71;
  --cond: #d9a13b;
  --hold: #6b7c93;
  --no: #d9534f;
  --accent: #4c8dff;
  --mono: ui-monospace, "SF Mono", "Iosevka", "Menlo", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: 40px; }

/* ---------------------------------------------------------------- header */

.top {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(150deg, #24405f, #16283d);
  border: 1px solid #2f4a68;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  color: #9dc0ea;
  letter-spacing: .5px;
}

.brandtext h1 { margin: 0; font-size: 15px; letter-spacing: .2px; }
.brandtext p { margin: 1px 0 0; font-size: 11.5px; color: var(--faint); }

.policy { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

.chip {
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--dim);
  white-space: nowrap;
}
.chip b { color: var(--text); font-weight: 600; }

.acts { display: flex; gap: 8px; }

.btn {
  font: inherit;
  font-size: 12.5px;
  padding: 7px 13px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: #212b38; border-color: #33455a; }
.btn.primary { background: #1d3a5c; border-color: #2c5580; color: #cfe3fb; }
.btn.primary:hover { background: #24476f; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* --------------------------------------------------------------- summary */

.summary {
  display: flex;
  gap: 0;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.summary .agg {
  padding: 12px 20px 12px 0;
  margin-right: 20px;
  border-right: 1px solid var(--line);
  min-width: 118px;
}
.summary .agg:last-child { border-right: 0; }
.summary .agg .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--faint); }
.summary .agg .v { font-family: var(--mono); font-size: 19px; font-weight: 600; margin-top: 2px; }
.summary .agg .s { font-size: 11px; color: var(--dim); }

/* ----------------------------------------------------------------- board */

.board { padding: 18px 22px 0; }

.stage { margin-bottom: 22px; }

.stagehead {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 9px;
}
.stagehead h2 { margin: 0; font-size: 12.5px; letter-spacing: .5px; text-transform: uppercase; color: var(--dim); }
.stagehead span { font-size: 11.5px; color: var(--faint); }

.cols {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(212px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.col {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px;
  min-height: 92px;
}

.colhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: var(--dim);
  margin-bottom: 7px;
  font-weight: 600;
}
.colhead .n {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 6px;
}

.card {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--hold);
  border-radius: 7px;
  padding: 8px 9px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color .12s, transform .06s;
}
.card:last-child { margin-bottom: 0; }
.card:hover { border-color: #3a5470; transform: translateY(-1px); }
.card .ref { font-family: var(--mono); font-size: 10px; color: var(--faint); }
.card .name { font-size: 12.5px; line-height: 1.35; margin: 2px 0 6px; }
.card .row { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }

.card[data-verdict="GO"] { border-left-color: var(--go); }
.card[data-verdict="GO_WITH_CONDITIONS"] { border-left-color: var(--cond); }
.card[data-verdict="HOLD"] { border-left-color: var(--hold); }
.card[data-verdict="NO_GO"] { border-left-color: var(--no); }

.tag {
  font-family: var(--mono);
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.tag.tier-A { color: #7ee0a8; border-color: #28523c; background: #12241a; }
.tag.tier-B { color: #9dc0ea; border-color: #26405e; background: #121c28; }
.tag.tier-C { color: #e8c37e; border-color: #5a4523; background: #221c10; }
.tag.tier-D { color: #f0918e; border-color: #5c2a29; background: #241212; }
.tag.warn { color: #e8c37e; border-color: #5a4523; }
.tag.money { color: #b9c6d6; }
.tag.blocked { color: #f0918e; border-color: #5c2a29; }

/* ---------------------------------------------------------------- drawer */

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(620px, 100vw);
  height: 100vh;
  background: var(--panel);
  border-left: 1px solid var(--line);
  transform: translateX(102%);
  transition: transform .22s ease;
  overflow-y: auto;
  z-index: 40;
  padding: 0 0 60px;
  box-shadow: -24px 0 60px rgba(0,0,0,.45);
}
.drawer.open { transform: translateX(0); }

.drawer .dhead {
  position: sticky;
  top: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 14px 18px 12px;
  z-index: 2;
}
.drawer .dhead .ref { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.drawer .dhead h2 { margin: 3px 0 0; font-size: 16px; line-height: 1.3; padding-right: 34px; }
.dclose {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--dim);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}

.verdictbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.vbadge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 5px;
  letter-spacing: .5px;
}
.vbadge.GO { background: #12301f; color: #6fe0a0; border: 1px solid #245239; }
.vbadge.GO_WITH_CONDITIONS { background: #2a2110; color: #e8c37e; border: 1px solid #5a4523; }
.vbadge.HOLD { background: #1a222c; color: #9fb0c4; border: 1px solid #33455a; }
.vbadge.NO_GO { background: #2a1214; color: #f0918e; border: 1px solid #5c2a29; }

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}
.metric { background: var(--panel); padding: 10px 12px; }
.metric .k { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); }
.metric .v { font-family: var(--mono); font-size: 14.5px; margin-top: 2px; }

.section { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.section h3 {
  margin: 0 0 9px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--faint);
  font-weight: 600;
}

.moves { display: flex; flex-direction: column; gap: 7px; }
.move {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: var(--panel2);
}
.move.ok { border-color: #2b4a37; }
.move.blocked { border-color: #4a2a29; background: #1c1414; }
.move .mhead { display: flex; align-items: center; gap: 9px; }
.move .mhead .label { font-size: 12.5px; font-weight: 500; }
.move .mhead .to { font-family: var(--mono); font-size: 10px; color: var(--faint); }
.move .why { font-size: 11.5px; color: var(--faint); margin-top: 3px; }
.move .blockers { margin: 7px 0 0; padding: 0; list-style: none; }
.move .blockers li {
  font-size: 11.5px;
  color: #e0a7a5;
  padding-left: 13px;
  position: relative;
  margin-top: 3px;
}
.move .blockers li::before { content: "×"; position: absolute; left: 2px; color: var(--no); }
.move .go { margin-left: auto; }

table.cost { width: 100%; border-collapse: collapse; font-size: 12px; }
table.cost td { padding: 4px 0; border-bottom: 1px dashed #1e2833; vertical-align: top; }
table.cost td.n { text-align: right; font-family: var(--mono); white-space: nowrap; padding-left: 10px; }
table.cost td .note { display: block; font-size: 10.5px; color: var(--faint); }
table.cost tr.total td { border-bottom: 0; border-top: 1px solid var(--line); font-weight: 600; padding-top: 6px; }

ul.warn { margin: 0; padding-left: 16px; font-size: 11.5px; color: #e8c37e; }
ul.warn li { margin-bottom: 4px; }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.field { display: flex; flex-direction: column; gap: 3px; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .5px; }
.field input, .field select, .field textarea {
  font: inherit;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #0f151d;
  color: var(--text);
  font-family: var(--mono);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.facts .check { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.facts .check input { width: 15px; height: 15px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 0 0 11px 18px;
  border-left: 1px solid var(--line);
  margin-left: 4px;
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hold);
  border: 1px solid var(--panel);
}
.timeline li.blocked::before { background: var(--no); }
.timeline .what { font-size: 12px; }
.timeline .what code { font-family: var(--mono); font-size: 11px; color: #9dc0ea; }
.timeline .when { font-size: 10.5px; color: var(--faint); font-family: var(--mono); }
.timeline .note { font-size: 11.5px; color: var(--dim); margin-top: 2px; }

/* ----------------------------------------------------------------- modal */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 12, .68);
  display: none;
  place-items: center;
  z-index: 60;
  padding: 20px;
}
.modal.open { display: grid; }
.modal .sheet {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 18px;
}
.modal h2 { margin: 0 0 4px; font-size: 15px; }
.modal p.sub { margin: 0 0 14px; font-size: 11.5px; color: var(--faint); }

.empty { font-size: 11.5px; color: var(--faint); padding: 6px 2px; }

.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1d2734;
  border: 1px solid #33455a;
  color: var(--text);
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 12.5px;
  z-index: 80;
  opacity: 0;
  transition: transform .2s, opacity .2s;
  max-width: min(620px, 92vw);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.err { border-color: #5c2a29; background: #241416; }

/* anchors styled as buttons (storefront link in the desk header) */
a.btn { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
