:root {
  color-scheme: light; /* light only, whatever the system setting */
  /* A soft grey-green ground, off-white cards and quiet rules, so long
     sessions are easy on the eye. */
  --shell: #1D5650;
  --shell-text: #CFE3DE;
  --accent: #237A67;
  --accent-2: #1C6656;
  --accent-soft: #E3F0EB;
  --link: #22685A;
  --bg: #F3F5F4;
  --card: #FCFDFC;
  --card-2: #EFF2F1;
  --rule: #E1E6E4;
  --rule-2: #C6CFCC;
  --text: #25312F;
  --muted: #6B7874;
  --hover: #F4F7F6;
  --green: #2F7D57;
  --green-soft: #E4F1EA;
  --amber: #93630F;
  --amber-soft: #F7EEDC;
  --red: #B4443F;
  --red-soft: #F8E8E6;
  --seg-fin: #4677A0;
  --seg-rsv: #A8C5DA;
  --seg-plg: #3F8C68;
  --seg-hdg: #C4913A;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--ui);
  font-variant-numeric: tabular-nums;
}
button, input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--link); }
.pad { padding: 24px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; }
.hidden { display: none !important; }

/* ------------------------------------------------------------ sign-in */
/* Same console as the rest of the app: a list of participants to sign in
   as, with Demo mode and the workspace beside it. */
.signin { width: 100%; max-width: 1120px; margin: 0 auto; }
.rule-line {
  font-weight: 600; border-left: 3px solid var(--accent); padding: 4px 12px;
  margin: 0 0 18px; max-width: 62ch;
}
.side { display: grid; gap: 18px; }
.panel p { margin: 0 0 12px; max-width: 62ch; }
.panel p:last-child { margin-bottom: 0; }
tr.group th { background: var(--card-2); color: var(--text); font-size: 13px; white-space: normal; }
tr.group th span { font-weight: 400; color: var(--muted); margin-left: 8px; }
td .who { display: block; font-weight: 600; }
.meter {
  height: 8px; background: var(--card-2); border: 1px solid var(--rule); border-radius: 4px;
  overflow: hidden; margin: 12px 0;
}
.meter > div { height: 100%; background: var(--accent); width: 0; transition: width .4s; }
.seedlist { margin: 0; padding-left: 20px; font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------ console */
.btn {
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  padding: 7px 16px; cursor: pointer; border-radius: 6px; font-weight: 600; white-space: nowrap;
}
.btn:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: var(--card); color: var(--text); border-color: var(--rule-2); font-weight: 400; }
.btn.ghost:hover { background: var(--card-2); border-color: var(--rule-2); }
.btn.danger { background: var(--card); color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: var(--red-soft); }
a.btn { display: inline-block; text-decoration: none; }
.btn[disabled] { opacity: .55; cursor: progress; }
td .btn { padding: 2px 8px; font-size: 13px; white-space: normal; }
td.nw .btn { white-space: nowrap; }

.shell {
  display: grid; grid-template-columns: 208px minmax(0, 1fr); grid-template-rows: auto 1fr;
  min-height: 100vh;
}
.shell.solo { grid-template-columns: minmax(0, 1fr); }
.top {
  grid-column: 1 / -1; background: var(--shell); color: #fff;
  display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap; padding: 0 20px; min-height: 56px;
}
.top :focus-visible { outline-color: #A8E3CF; }
.top .brand { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; color: #fff; text-decoration: none; }
.top .brand::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 9px;
  background: #6FCBAE; border-radius: 3px;
}
.top .me { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--shell-text); }
.top .switch { display: flex; align-items: center; gap: 8px; color: var(--shell-text); font-size: 13px; }
.top select {
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.35);
  border-radius: 6px; padding: 4px 8px; max-width: 240px;
}
.top select option, .top select optgroup { color: var(--text); background: #fff; }
.top button {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.45); border-radius: 6px;
  padding: 4px 12px; cursor: pointer; font-size: 13px;
}
.top button:hover { background: rgba(255,255,255,.14); }

.rail { background: var(--bg); border-right: 1px solid var(--rule); padding: 18px 0; }
.rail-group + .rail-group { margin-top: 16px; }
.rail-h { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 16px 4px; }
.rail a {
  display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none;
  padding: 7px 16px 7px 13px; border-left: 3px solid transparent;
}
.rail a:hover { background: var(--card-2); }
.rail a[aria-current="page"] { background: var(--accent-soft); border-left-color: var(--accent); color: var(--accent-2); font-weight: 600; }
.count {
  margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--amber); color: #fff; font-size: 12px; font-weight: 600; line-height: 20px; text-align: center;
}

.work { padding: 28px 32px 64px; min-width: 0; background: var(--bg); color: var(--text); }
.work h1 { font-size: 24px; font-weight: 600; margin: 0 0 6px; letter-spacing: -0.015em; }
.work h2 { font-size: 16px; font-weight: 600; margin: 32px 0 12px; }
.lede { color: var(--muted); margin: 0 0 24px; max-width: 65ch; }
.note { font-size: 13px; color: var(--muted); border-left: 3px solid var(--rule-2); padding: 2px 10px; max-width: 80ch; }

.panel { background: var(--card); border: 1px solid var(--rule); border-radius: 8px; padding: 20px; }
.panel > h2:first-child { margin-top: 0; }
.grid2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; align-items: start; }
.grid2 > div > h2:first-child { margin-top: 0; }
.stats { display: flex; gap: 12px 32px; flex-wrap: wrap; align-items: end; margin: 6px 0 18px; }
.stats div b { display: block; font-size: 22px; font-weight: 600; line-height: 1.25; }
.stats div span { font-size: 13px; color: var(--muted); }

table { border-collapse: separate; border-spacing: 0; width: 100%; background: var(--card); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-size: 12.5px; color: var(--muted); font-weight: 500; background: var(--card); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
td.nw { white-space: nowrap; }
.tscroll { overflow-x: auto; border-radius: 8px; }
tr.pick { cursor: pointer; }
tr.pick:hover td { background: var(--hover); }
tr.pick:focus-visible { outline-offset: -2px; }
tr.sel td { background: var(--accent-soft); }
tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

.status {
  display: inline-block; font-size: 12px; font-weight: 600; line-height: 18px; padding: 0 8px;
  border-radius: 9px; white-space: nowrap; background: var(--card-2); color: var(--muted);
}
.s-ACCEPTED, .s-ACTIVE, .s-CONFIRMED { color: var(--green); background: var(--green-soft); }
.s-REGISTERED, .s-RESERVED, .s-PENDING { color: var(--amber); background: var(--amber-soft); }
.s-DISPUTED, .s-REJECTED, .s-CANCELLED, .s-EXPIRED { color: var(--red); background: var(--red-soft); }

/* the capacity bar: an invoice, and every claim on it */
.cap {
  position: relative; height: 12px; border: 1px solid var(--rule-2); border-radius: 6px;
  background: var(--card); display: flex; overflow: hidden; min-width: 100px; margin-top: 3px;
}
.cap > i { display: block; height: 100%; }
.cap .fin { background: var(--seg-fin); }
.cap .rsv { background: var(--seg-rsv); }
.cap .plg { background: var(--seg-plg); }
.cap .hdg { background: var(--seg-hdg); }
.cap .oth { background: repeating-linear-gradient(135deg, #9aa6a2 0 4px, #d3dad7 4px 8px); }
.cap.big { height: 24px; border-radius: 8px; margin: 0 0 16px; }
.legend { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 6px 0 10px; }
.legend i { display: inline-block; width: 11px; height: 11px; margin-right: 5px; vertical-align: -1px; border-radius: 2px; }

/* the outcome of a write */
.stamp {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .03em; line-height: 20px;
  padding: 0 10px; border-radius: 10px; color: #fff; background: var(--muted);
}
.stamp.COMMITTED { background: var(--green); }
.stamp.REJECTED { background: var(--red); }
.stamp.INVALID { background: var(--amber); }
.outcome { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 8px; background: var(--card-2); }
.outcome p { margin: 8px 0 0; }
.outcome .stamp { animation: land .2s ease-out; }
@keyframes land { from { transform: translateY(-4px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .outcome .stamp { animation: none; } .meter > div { transition: none; } }
.code { font-weight: 600; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.timing { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* forms */
.actions { border: 1px solid var(--rule); border-radius: 8px; background: var(--card); overflow: hidden; }
details.act { border-bottom: 1px solid var(--rule); }
details.act:last-child { border-bottom: 0; }
details.act summary { padding: 11px 14px; cursor: pointer; font-weight: 600; }
details.act summary:hover { background: var(--hover); }
details.act.undo summary { color: var(--red); font-weight: 400; }
details.act[open] summary { border-bottom: 1px solid var(--rule); background: var(--card-2); }
details.act form { padding: 14px 14px 16px; display: grid; gap: 12px; }
details.act form p { margin: 0; }
label { display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
input, select { padding: 7px 10px; border: 1px solid var(--rule-2); border-radius: 6px; background: var(--card); color: var(--text); }
input:focus-visible, select:focus-visible { outline-offset: 0; border-color: var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.checks { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--text); }
.checks label { display: flex; gap: 6px; align-items: center; color: var(--text); }
.row .checks { padding-bottom: 6px; }

/* work queue */
.todo { list-style: none; margin: 0; padding: 0; }
.todo li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.todo li:first-child { padding-top: 0; }
.todo li:last-child { border-bottom: 0; padding-bottom: 0; }

/* feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 8px 0; border-bottom: 1px solid var(--rule); }
.feed li:first-child { padding-top: 0; }
.feed li:last-child { border-bottom: 0; padding-bottom: 0; }
.feed li .timing { display: block; margin-top: 2px; }

/* waterfall */
.wf { display: grid; gap: 4px; }
.wf .ln { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 3fr) 120px; gap: 10px; align-items: center; }
.wf .bar { height: 14px; position: relative; }
.wf .bar i { position: absolute; top: 0; height: 100%; border-radius: 1px; }
.wf .neg i { background: var(--red); }
.wf .pos i { background: var(--green); }
.wf .tot i { background: var(--seg-fin); }
.wf .tot { font-weight: 600; }
.wf .amt { text-align: right; }
.est { font-size: 34px; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; margin: 4px 0 8px; }

/* demo: each scenario is a card with the invoice drawn as a bar */
.demo-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.demo-head h1 { margin: 0; }
.scen { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 16px 0 24px; }
.scard { display: grid; gap: 14px; align-content: start; }
.scard-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.scard-head h2 { margin: 0; font-size: 18px; }
.dbar { position: relative; height: 16px; margin: 6px 0 2px; }
.dbar .inv { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 8px; background: var(--card-2); box-shadow: inset 0 0 0 1px var(--rule); }
.dbar i { position: absolute; top: 0; bottom: 0; }
.dbar .held { border-radius: 8px 0 0 8px; }
.dbar .fits { border-radius: 0 8px 8px 0; }
.dbar .end { width: 2px; top: -5px; bottom: -5px; background: var(--text); border-radius: 1px; }
.dbar .spill { border-radius: 0 8px 8px 0; background: repeating-linear-gradient(135deg, var(--red) 0 4px, #E6A9A5 4px 8px); }
.held { background: var(--seg-fin); }
.fits { background: var(--green); }
.over { background: var(--red); }
.dkey { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--muted); }
.dkey .of { margin-left: auto; }
.dkey i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.moves { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.moves li { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.verdict { font-size: 12.5px; font-weight: 600; padding: 1px 10px; border-radius: 10px; }
.verdict.yes { color: var(--green); background: var(--green-soft); }
.verdict.no { color: var(--red); background: var(--red-soft); }
.scard-go { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 14px; border-top: 1px solid var(--rule); }

.nodes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; background: var(--red); }
.dot.up { background: var(--green); }

@media (max-width: 900px) {
  .nodes, .scen { grid-template-columns: 1fr 1fr; }
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
  .top { padding: 8px 16px; }
  .rail { padding: 0 8px; border-right: 0; border-bottom: 1px solid var(--rule); }
  .rail nav, .rail-group { display: flex; }
  .rail nav { overflow-x: auto; }
  .rail-group + .rail-group { margin-top: 0; }
  .rail-h { display: none; }
  .rail a { border-left: 0; border-bottom: 3px solid transparent; padding: 8px 10px; white-space: nowrap; }
  .rail a[aria-current="page"] { border-bottom-color: var(--accent); }
  .top .org, .top .switch > span { display: none; }
  .top .me { margin-left: 0; width: 100%; justify-content: space-between; }
  .top select { max-width: none; flex: 1; }
  .top .switch { flex: 1; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .work { padding: 16px; }
  .wf .ln { grid-template-columns: 1fr 90px; }
  .wf .bar { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 560px) {
  .nodes, .scen { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; }
}
