/* Concordium brand.
   Trust Blue #2667FF · Identity Blue #63A1FF · Smart Orange #FF4F4C
   Foundation Gray #1B2735 · Nova White #F2F2F2
   Plus Jakarta Sans for titles and headings, Inter for body and captions. */

:root {
  --trust-blue: #2667FF;
  --identity-blue: #63A1FF;
  --smart-orange: #FF4F4C;
  --foundation-gray: #1B2735;
  --nova-white: #F2F2F2;

  /* surfaces, stepped down from Foundation Gray */
  --bg: #0E151E;
  --panel: #16202C;
  --panel-2: #1B2735;
  --panel-3: #223141;
  --line: #2A3A4C;
  --line-soft: #202D3B;

  --text: var(--nova-white);
  --dim: #9FB0C4;
  --dimmer: #6E8298;

  --accent: var(--trust-blue);
  --accent-soft: rgba(38, 103, 255, 0.14);
  --pos: var(--identity-blue);
  --neg: var(--smart-orange);
  --eco: var(--identity-blue);
  --build: var(--trust-blue);

  --radius: 10px;
  --title: "Plus Jakarta Sans", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --body: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--title); font-weight: 700; letter-spacing: -0.015em; margin: 0; }
h1 { font-size: 19px; }
h2 { font-size: 16px; }
h3 { font-size: 12px; font-weight: 600; color: var(--dim); text-transform: uppercase; letter-spacing: 0.08em; }
a { color: var(--identity-blue); }

.wrap { max-width: 1500px; margin: 0 auto; padding: 0 20px 80px; }

/* ---------- gate ---------- */
#gate {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background:
    radial-gradient(1100px 620px at 50% -10%, rgba(38, 103, 255, 0.16), transparent 62%),
    var(--bg);
}
/* The hidden attribute hides via the UA rule [hidden]{display:none}, which an
   author display:grid outranks. Without this the gate stays painted over a
   working page after sign-in. */
#gate[hidden], #app[hidden] { display: none !important; }

#gate .box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 30px;
  width: 350px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
#gate h1 { margin-bottom: 6px; }
#gate p { color: var(--dim); margin: 0 0 20px; font-size: 13px; }
#gate input { width: 100%; margin-bottom: 10px; }
#gate button { width: 100%; }
#gateErr { color: var(--neg); font-size: 13px; min-height: 18px; margin: 10px 0 0; }

/* ---------- header ---------- */
header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(14, 21, 30, 0.93);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1500px; margin: 0 auto; padding: 12px 20px;
  display: flex; gap: 22px; align-items: center; flex-wrap: wrap;
}
.title-block { display: flex; flex-direction: column; gap: 1px; margin-right: auto; }
.title-block .sub { color: var(--dimmer); font-size: 12px; }

.slider-block { display: flex; align-items: center; gap: 12px; min-width: 340px; }
.slider-block input[type=range] { flex: 1; accent-color: var(--accent); }
.slider-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--dimmer); }
.wval { font-family: var(--mono); font-size: 13px; min-width: 118px; white-space: nowrap; }

.toggle { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--dim); cursor: pointer; }
.toggle input { accent-color: var(--accent); }

#saveState { font-size: 12px; color: var(--dimmer); min-width: 92px; text-align: right; }
#saveState.saving { color: var(--identity-blue); }
#saveState.saved  { color: var(--dimmer); }
#saveState.error  { color: var(--neg); }

/* ---------- controls ---------- */
button {
  background: var(--panel-3); color: var(--text);
  border: 1px solid var(--line); border-radius: 7px;
  padding: 6px 12px; font: 500 13px var(--body); cursor: pointer;
  transition: background .12s, border-color .12s;
}
button:hover { background: #2B3D50; border-color: #3A4F66; }
button.primary { background: var(--trust-blue); border-color: var(--trust-blue); color: #fff; font-weight: 600; }
button.primary:hover { background: #3D79FF; border-color: #3D79FF; }
button.ghost { background: transparent; border-color: transparent; color: var(--dim); padding: 5px 8px; }
button.ghost:hover { color: var(--text); background: var(--panel-3); }
button.danger:hover { color: var(--neg); border-color: var(--neg); background: rgba(255, 79, 76, 0.08); }

input, select, textarea {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 7px;
  padding: 6px 9px; font: 400 13px var(--body);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--trust-blue);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input.num { width: 58px; text-align: right; font-family: var(--mono); }
input.score { width: 48px; text-align: center; font-family: var(--mono); }
input.invalid { border-color: var(--neg); box-shadow: 0 0 0 3px rgba(255, 79, 76, 0.16); }

/* ---------- sections ---------- */
section { margin-top: 36px; }
.sec-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.sec-head .hint { color: var(--dimmer); font-size: 12px; }
.sec-head .spacer { margin-left: auto; }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font: 600 11px var(--body);
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--dimmer);
  padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 7px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(99, 161, 255, 0.045); }
.num-cell { font-family: var(--mono); text-align: right; white-space: nowrap; }

.tag {
  display: inline-block; font: 600 10px var(--body); padding: 2px 6px;
  border-radius: 4px; letter-spacing: 0.05em; text-transform: uppercase;
}
.tag.build { background: rgba(38, 103, 255, 0.18); color: #8FB4FF; }
.tag.eco   { background: rgba(99, 161, 255, 0.15); color: var(--identity-blue); }

.id { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.muted { color: var(--dimmer); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; max-width: 460px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--panel-3); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 4px 1px 7px;
  font-family: var(--mono); font-size: 11px; color: var(--dim);
}
.chip b { font-weight: 600; color: var(--text); }
.chip button { border: none; background: none; color: var(--dimmer); padding: 0 2px; font-size: 13px; line-height: 1; }
.chip button:hover { color: var(--neg); background: none; }
.chip.implied { border-style: dashed; opacity: .72; }

/* ---------- matrix ---------- */
.matrix-scroll { overflow-x: auto; }
table.matrix th.uc { writing-mode: vertical-rl; transform: rotate(180deg); height: 132px; padding: 8px 4px; }
table.matrix th.uc span { font: 500 12px var(--body); text-transform: none; letter-spacing: 0; color: var(--text); }
table.matrix td.cell { text-align: center; width: 42px; font-family: var(--mono); font-size: 13px; cursor: pointer; user-select: none; }
table.matrix td.cell:hover { background: var(--accent-soft); }
.mark-direct  { color: var(--trust-blue); font-weight: 700; }
.mark-implied { color: var(--dim); }
.mark-none    { color: #2E3F52; }
.row-name { display: flex; align-items: center; gap: 7px; }
.twisty { width: 14px; text-align: center; color: var(--dimmer); cursor: pointer; font-size: 10px; }
.twisty.leaf { visibility: hidden; }
.heat { display: inline-block; padding: 1px 7px; border-radius: 5px; font-family: var(--mono); font-size: 12px; }
tr.parent-row > td { background: rgba(242, 242, 242, 0.022); }
tr.satisfied .row-name > .label { color: var(--identity-blue); }

.callout {
  margin-top: 12px; padding: 13px 15px; border-radius: var(--radius);
  border: 1px solid rgba(255, 79, 76, 0.35); background: rgba(255, 79, 76, 0.07);
  font-size: 13px; color: #FFC9C7;
}
.callout b { color: var(--smart-orange); }
.callout .ids { font-family: var(--mono); font-size: 12px; }

/* ---------- focus ---------- */
.focus-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1100px) { .focus-grid { grid-template-columns: 1fr; } }
.lede {
  padding: 13px 15px; border-bottom: 1px solid var(--line);
  font: 400 13px/1.5 var(--body); color: var(--dim); background: var(--panel-2);
}
.lede b { font-family: var(--title); font-weight: 700; color: var(--text); }
.bar { height: 5px; border-radius: 3px; background: var(--trust-blue); display: block; min-width: 2px; }
.missing { font-family: var(--mono); font-size: 11px; color: var(--dimmer); }

/* ---------- sensitivity ---------- */
#sensWrap { padding: 16px; }
#sens { width: 100%; height: 300px; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 0 16px 14px; font-size: 12px; }
.legend span { display: flex; align-items: center; gap: 6px; color: var(--dim); }
.swatch { width: 11px; height: 3px; border-radius: 2px; }

/* ---------- add row ---------- */
.addrow {
  display: flex; flex-wrap: wrap; gap: 9px; align-items: flex-end;
  padding: 12px; background: var(--panel-2); border-top: 1px solid var(--line);
}
.addrow label { font-size: 11px; color: var(--dimmer); display: flex; flex-direction: column; gap: 4px; }
.err { color: var(--neg); font-size: 12px; padding: 0 12px 10px; background: var(--panel-2); }
.err:empty { display: none; padding: 0; }

/* ---------- dialog + tree picker ---------- */
dialog {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 0; max-width: 940px; width: 94%;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
dialog::backdrop { background: rgba(8, 12, 18, 0.72); backdrop-filter: blur(3px); }
dialog h2 { padding: 18px 20px 0; }
dialog .sub { padding: 4px 20px 0; color: var(--dim); font-size: 12.5px; margin: 0; }
dialog .body { padding: 14px 20px 18px; max-height: 62vh; overflow: auto; }
dialog .foot {
  padding: 13px 20px; border-top: 1px solid var(--line);
  display: flex; gap: 9px; align-items: center; justify-content: flex-end;
  background: var(--panel-2);
}
dialog .foot .count { margin-right: auto; font-size: 12px; color: var(--dim); font-family: var(--mono); }

.dlg-tools { display: flex; gap: 9px; align-items: center; padding: 0 20px 4px; }
.dlg-tools input[type=search] { flex: 1; }

.tree-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 820px) { .tree-cols { grid-template-columns: 1fr; } }

.tree-col > header {
  position: static; background: none; border: none; backdrop-filter: none;
  display: flex; align-items: center; gap: 9px;
  padding: 0 0 8px; margin-bottom: 6px; border-bottom: 1px solid var(--line);
}
.tree-col > header h3 { margin: 0; }
.tree-col > header .allnone { margin-left: auto; display: flex; gap: 4px; }
.tree-col > header .allnone button { padding: 3px 8px; font-size: 11px; }

.tnode {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 7px; border-radius: 7px; cursor: pointer;
  padding-left: calc(7px + var(--depth) * 20px);
  position: relative;
}
.tnode:hover { background: var(--panel-3); }
.tnode.is-parent { font-weight: 500; }
.tnode.checked { background: var(--accent-soft); }
.tnode.filtered-out { display: none; }
/* guide rails make the nesting readable at a glance */
.tnode[style*="--depth: 1"]::before,
.tnode[style*="--depth: 2"]::before {
  content: ""; position: absolute; left: calc(13px + (var(--depth) - 1) * 20px);
  top: 0; bottom: 0; width: 1px; background: var(--line);
}
.tnode input[type=checkbox] { accent-color: var(--trust-blue); width: 15px; height: 15px; flex: none; margin: 0; }
.tnode .tid { font-family: var(--mono); font-size: 11.5px; color: var(--dim); flex: none; min-width: 46px; }
.tnode .tlabel { font-size: 13px; flex: 1; }
.tnode .tmeta { font-family: var(--mono); font-size: 11px; color: var(--dimmer); flex: none; }
.tnode .tmeta.avail { color: var(--identity-blue); }
.tnode .tdep { font-size: 10px; color: var(--dimmer); font-family: var(--mono); }
.tree-empty { color: var(--dimmer); font-size: 12.5px; padding: 8px 7px; }

/* "Committed" is the control that drives the whole Focus section, so it gets a
   real label rather than a bare tick, and a tinted row so the state is obvious. */
th.th-commit { width: 92px; color: var(--identity-blue); }
tr.is-committed > td { background: rgba(38, 103, 255, 0.07); }
tr.is-committed > td:first-child { box-shadow: inset 3px 0 0 var(--trust-blue); }
.sec-head .hint b { color: var(--identity-blue); font-weight: 600; }

/* ---------- tabs ---------- */
.tabs { border-top: 1px solid var(--line-soft); }
.tabs-inner {
  max-width: 1500px; margin: 0 auto; padding: 0 20px;
  display: flex; gap: 2px; align-items: stretch; overflow-x: auto;
}
.tabs-sep { width: 1px; background: var(--line); margin: 8px 10px; flex: none; }
.tab {
  background: none; border: none; border-radius: 0;
  border-bottom: 2px solid transparent;
  padding: 11px 14px; color: var(--dim);
  font: 500 13.5px var(--body); white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
}
.tab:hover { background: rgba(99, 161, 255, 0.06); color: var(--text); border-color: transparent; }
.tab.active {
  color: var(--text); border-bottom-color: var(--trust-blue);
  font-family: var(--title); font-weight: 600;
}
.tabcount {
  font: 600 10.5px var(--mono); color: var(--dimmer);
  background: var(--panel-3); border-radius: 999px; padding: 1px 7px;
}
.tab.active .tabcount { background: var(--accent-soft); color: var(--identity-blue); }
.tabcount:empty { display: none; }

section[data-panel] { margin-top: 26px; }
section[data-panel][hidden] { display: none !important; }

/* ---------- use case rank ---------- */
th.th-rank { width: 62px; }
td.rank { white-space: nowrap; }
.rank-n {
  display: inline-block; min-width: 17px; text-align: right;
  font: 600 13px var(--mono); color: var(--dim); margin-right: 6px;
}
.rank-top .rank-n { color: var(--trust-blue); }
.rank-bar {
  display: inline-block; height: 4px; border-radius: 2px;
  background: var(--trust-blue); vertical-align: middle; opacity: .5;
}
.rank-top .rank-bar { opacity: 1; }

/* ---------- deliverable trees ---------- */
table.deliv td { padding: 6px 10px; }
table.deliv .row-name { gap: 8px; }
table.deliv .rollup {
  font-family: var(--mono);
  border-bottom: 1px dotted var(--line);
  cursor: help;
}
.kidcount {
  font: 600 10px var(--mono); color: var(--dimmer);
  background: var(--panel-3); border-radius: 999px; padding: 1px 6px;
}
table.deliv tr.parent-row .row-name > input { font-weight: 600; }

/* ---------- eco-system risk ---------- */
th.th-like { width: 92px; }
input.like { width: 52px; }
input.like.risky { border-color: var(--smart-orange); color: #FFB3B1; }
.avail-warn {
  color: var(--smart-orange); font-family: var(--mono);
  border-bottom: 1px dotted rgba(255, 79, 76, .5); cursor: help;
}
.rawp { color: var(--dimmer); font-size: 11px; font-family: var(--mono); margin-left: 5px; }
.anyof {
  display: inline-flex; align-items: center; gap: 3px; margin-left: 6px;
  font: 600 9.5px var(--body); text-transform: uppercase; letter-spacing: .05em;
  color: var(--dimmer); cursor: pointer; padding: 1px 5px 1px 3px;
  border: 1px solid var(--line); border-radius: 4px;
}
.anyof input { accent-color: var(--trust-blue); width: 11px; height: 11px; margin: 0; }
.anyof.on { color: var(--identity-blue); border-color: var(--identity-blue); background: rgba(99,161,255,.10); }

/* ---------- sign-in ---------- */
.gbtn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 10px 14px; margin-bottom: 4px;
  background: #fff; color: #1f1f1f; text-decoration: none;
  border: 1px solid #dadce0; border-radius: 7px;
  font: 600 14px var(--body);
}
.gbtn:hover { background: #f7f8f8; border-color: #c9cdd2; }
.gate-note { color: var(--dimmer); font-size: 12px; margin: 8px 0 0; text-align: center; }
.gate-or {
  display: flex; align-items: center; gap: 10px;
  color: var(--dimmer); font-size: 11px; text-transform: uppercase;
  letter-spacing: .08em; margin: 16px 0 12px;
}
.gate-or::before, .gate-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#codeBlock.hidden { display: none; }
.whoami {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--dim); font-family: var(--mono);
}
.whoami img { width: 20px; height: 20px; border-radius: 50%; }
