:root {
  --navy: #0b2354;
  --navy-2: #163a7a;
  --blue: #2f6fed;
  --blue-soft: #e8f0ff;
  --bg: #f4f7fb;
  --card: #ffffff;
  --line: #e1e8f2;
  --text: #1b2a44;
  --mut: #66758f;
  --red: #d93f4c;
  --red-soft: #fdecee;
  --green: #148a5c;
  --green-soft: #e4f6ee;
  --amber: #b9791a;
  --amber-soft: #fff4de;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(11, 35, 84, 0.06), 0 4px 14px rgba(11, 35, 84, 0.05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif; }
h1, h2, h3 { margin: 0; line-height: 1.25; color: var(--navy); }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 10px; }
.mut { color: var(--mut); }
.small { font-size: 13px; }
button { font: inherit; cursor: pointer; }
a { color: var(--blue); }

/* header */
.top { background: var(--navy); color: #fff; }
.top-in { max-width: 1120px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #3b82f6, #1f56d6); display: grid; place-items: center; font-weight: 800; }
.brand b { font-size: 17px; }
.brand span { display: block; font-size: 12px; opacity: 0.75; }
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 11px; font-size: 12.5px; background: rgba(255, 255, 255, 0.14); color: #fff; white-space: nowrap; }
.chip.warn { background: #f6c453; color: #3d2a00; }
.stop { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, 0.45); border-radius: 8px; padding: 7px 13px; font-weight: 600; }
.stop:hover { background: rgba(255, 255, 255, 0.12); }
.stop.on { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }

/* steps */
.steps { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.steps-in { max-width: 1120px; margin: 0 auto; padding: 0 16px; display: flex; gap: 4px; overflow-x: auto; }
.step { appearance: none; background: none; border: 0; border-bottom: 3px solid transparent; padding: 13px 14px; color: var(--mut); font-weight: 600; white-space: nowrap; }
.step[disabled] { opacity: 0.45; cursor: not-allowed; }
.step.on { color: var(--navy); border-bottom-color: var(--blue); }
.step .n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--line); color: var(--navy); font-size: 12px; margin-right: 7px; }
.step.on .n { background: var(--blue); color: #fff; }

main { max-width: 1120px; margin: 0 auto; padding: 20px 16px 60px; }
section[hidden] { display: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card h2 + .mut, .card h3 + .mut { margin-top: 3px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); gap: 16px; align-items: stretch; }
.card.plan.baseline { background: #f6f8fc; border-style: dashed; box-shadow: none; }
.card.plan.baseline .tag { background: #e4e9f2; color: var(--mut); }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); } }
.card { min-width: 0; }
.alert > div { min-width: 0; }

.btn { border: 0; border-radius: 9px; padding: 10px 18px; font-weight: 700; background: var(--blue); color: #fff; }
.btn:hover { background: #2559c9; }
.btn.ghost { background: var(--blue-soft); color: var(--blue); }
.btn.ghost:hover { background: #d9e6ff; }
.btn[disabled] { background: #b8c4da; color: #fff; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.badge { display: inline-block; border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 700; background: var(--blue-soft); color: var(--blue); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.grey { background: #eef1f6; color: var(--mut); }

/* data */
.dropzone { border: 2px dashed #bcd0f5; border-radius: var(--radius); background: #f8faff; padding: 18px; text-align: center; }
.errs { background: var(--red-soft); border: 1px solid #f3c1c6; border-radius: 10px; padding: 12px 14px; margin-top: 12px; color: #7a1d26; }
.errs ul { margin: 6px 0 0; padding-left: 20px; }
.files { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 10px; }
.files td { padding: 5px 6px; border-top: 1px solid var(--line); }
.progress { list-style: none; margin: 0; padding: 0; }
.progress li { padding: 7px 0; display: flex; gap: 10px; align-items: center; border-top: 1px solid var(--line); }
.progress li:first-child { border-top: 0; }
.building { position: fixed; inset: 0; z-index: 50; background: rgba(11, 35, 84, 0.45); display: grid; place-items: center; padding: 16px; }
.building[hidden] { display: none; }
.building-card { background: #fff; border-radius: 14px; padding: 22px 24px; width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(11, 35, 84, 0.3); max-height: 100%; overflow: auto; }
.building-card .progress { margin-top: 10px; }
.progress li { align-items: flex-start; }
.progress .dot { margin-top: 2px; }
.progress .bname { font-weight: 600; }
.progress li:not(.cur) .bname { font-weight: 400; }
.progress .bwhy { color: var(--mut); font-size: 13px; margin-top: 2px; }
.dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; font-size: 11px; color: #fff; }
.dot.run { border-color: var(--blue); border-top-color: transparent; animation: spin 0.8s linear infinite; }
.dot.ok { background: var(--green); border-color: var(--green); }
.dot.bad { background: var(--red); border-color: var(--red); }
@keyframes spin { to { transform: rotate(360deg); } }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.kv div { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.kv b { display: block; font-size: 17px; color: var(--navy); }
.kv span { font-size: 12.5px; color: var(--mut); }

/* forecast */
.alert { border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.alert.risk { background: var(--red-soft); border: 1px solid #f3c1c6; }
.alert.calm { background: var(--green-soft); border: 1px solid #b9e4d1; }
.alert h2 { font-size: 22px; }
.alert .big { font-size: 34px; font-weight: 800; color: var(--red); line-height: 1; }
.chart-wrap { position: relative; }
.chart-wrap svg { width: 100%; height: auto; display: block; }
.grid { stroke: #e8edf5; stroke-width: 1; }
.tick { fill: var(--mut); font-size: 11.5px; }
.hline { stroke: var(--red); stroke-width: 1.5; stroke-dasharray: 5 4; }
.hlabel { fill: var(--red); font-size: 11.5px; font-weight: 700; }
.shade { fill: rgba(217, 63, 76, 0.1); }
.split { stroke: #9fb1d1; stroke-dasharray: 3 3; }
.hover { stroke: #6b7c9a; stroke-width: 1; }
.marker { fill: var(--red); }
.mlabel { fill: var(--red); font-size: 11px; font-weight: 700; }
.tip { position: absolute; top: 8px; pointer-events: none; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 9px; padding: 8px 10px; font-size: 12.5px; width: 240px; z-index: 3; }
.tip .tdate { font-weight: 700; color: var(--navy); margin-bottom: 3px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--mut); margin-top: 6px; }
.lg i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.drivers { list-style: none; padding: 0; margin: 8px 0 0; }
.drivers li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.metric { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.metric:first-of-type { border-top: 0; }
.metric b { color: var(--navy); }

/* plans */
.plan { cursor: pointer; border: 2px solid var(--line); position: relative; display: flex; flex-direction: column; margin-bottom: 0; }
.plan.sel { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.15); }
.plan .tag { position: absolute; top: -11px; right: 14px; }
.plan .risk { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; }
.plan > .mut.small { min-height: 2.9em; }
.plan .risk b { font-size: 36px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.plan .risk span { font-size: 13px; color: var(--mut); }
.plan .costline { margin-top: 10px; font-size: 14px; color: var(--mut); }
.plan .costline b { font-size: 17px; color: var(--navy); font-variant-numeric: tabular-nums; }
.plan .pstatus { margin-top: 8px; font-size: 13px; font-weight: 600; }
.plan .pstatus.ok { color: var(--green); }
.plan .pstatus.bad { color: var(--red); }
.plan .was, .stickybar .was { color: var(--blue); font-size: 13px; }
.plan.rec { background: linear-gradient(180deg, #eef6ff 0, #fff 55%); border-color: #9dc0ff; }
.plan.rec.sel { border-color: var(--blue); }
.ribbon { position: absolute; top: -11px; right: 14px; background: var(--green); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 6px; }
.plans-grid.busy .plan { opacity: 0.5; transition: opacity 0.15s; }
.stickybar .upd { display: none; color: var(--blue); font-weight: 600; }
.stickybar.busy .upd { display: inline-flex; align-items: center; gap: 8px; }
.stickybar.busy .num, .stickybar.busy .was { display: none; }
.spin { width: 14px; height: 14px; border: 2px solid #c9d8f5; border-top-color: var(--blue); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.stickybar.flash { animation: barflash 1.4s ease-out; }
@keyframes barflash { from { background: #e3efff; } to { background: #fff; } }
.resultline { margin-top: 6px; font-size: 14px; color: var(--navy); }
@media (prefers-reduced-motion: reduce) { .spin, .stickybar.flash { animation: none; } }
.plan ul { margin: 10px 0 12px; padding-left: 18px; font-size: 14px; }
.plan li { margin-bottom: 3px; }
.meter { height: 8px; background: #eaeff7; border-radius: 6px; overflow: hidden; margin: 6px 0 4px; }
.meter i { display: block; height: 100%; border-radius: 6px; }
.plan .foot { margin-top: auto; }
table.cmp { width: 100%; border-collapse: collapse; font-size: 14px; }
table.cmp th, table.cmp td { text-align: left; padding: 9px 8px; border-top: 1px solid var(--line); }
table.cmp th { color: var(--mut); font-weight: 600; font-size: 12.5px; border-top: 0; }
table.cmp tr.me td { background: var(--blue-soft); font-weight: 600; }
.scroll { overflow-x: auto; }

/* approve */
.act { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); align-items: start; }
.act:first-child { border-top: 0; }
.act .t { font-weight: 700; color: var(--navy); }
.act .d { font-size: 13.5px; color: var(--mut); margin-top: 2px; }
.act .meta { text-align: right; font-size: 13px; white-space: nowrap; }
.act .meta b { display: block; font-size: 15px; color: var(--navy); }
.act input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; }
.banner { border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; background: var(--amber-soft); border: 1px solid #f1d9a6; color: #5c3d00; }
.banner.red { background: var(--red-soft); border-color: #f3c1c6; color: #7a1d26; }
.banner.green { background: var(--green-soft); border-color: #b9e4d1; color: #0d5a3b; }
.audit { font-size: 13px; max-height: 260px; overflow: auto; }
.audit div { padding: 5px 0; border-top: 1px solid var(--line); display: flex; gap: 10px; }
.audit time { color: var(--mut); flex: none; width: 88px; }
.confirm { display: flex; gap: 8px; align-items: center; margin-top: 8px; padding: 2px 0 2px 10px; border-left: 3px solid var(--amber); font-size: 13px; color: var(--navy); }
.perm { margin-top: 8px; padding: 8px 12px; background: var(--bg); border-radius: 8px; font-size: 13.5px; color: var(--navy); }
.agroup { padding-bottom: 6px; }
.ghead { margin-bottom: 4px; }
.ghead h3 { margin: 0; }
footer { max-width: 1120px; margin: 0 auto; padding: 0 16px 40px; color: var(--mut); font-size: 12.5px; }
.note { font-size: 12.5px; color: var(--mut); margin-top: 8px; }

@media (max-width: 600px) {
  .act { grid-template-columns: 26px minmax(0, 1fr); }
  .act .meta { grid-column: 2; text-align: left; }
  .alert h2 { font-size: 19px; }
  .tip { width: 200px; }
}
input[type="number"], select { font: inherit; padding: 6px 8px; border: 1px solid #c9d4e6; border-radius: 8px; background: #fff; color: var(--text); }
input[type="number"]:focus, select:focus { outline: 2px solid rgba(47, 111, 237, 0.35); border-color: var(--blue); }
input[type="number"]:disabled, select:disabled { background: #f0f3f8; color: var(--mut); }

.preset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: #fff; }
.preset:hover { border-color: #b8cbf0; }

/* the run */
.tl { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.tlc { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px; min-height: 120px; }
.tlc.past { background: #f7f9fc; }
.tlc.empty { min-height: 54px; background: transparent; border-style: dashed; }
.tlc.empty.today { background: #fff; border-style: solid; }
.tlc.today { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(47, 111, 237, 0.2); }
.tlh { font-weight: 700; color: var(--navy); font-size: 12.5px; margin-bottom: 6px; display: flex; justify-content: space-between; }
.tlh span { font-weight: 500; color: var(--mut); }
.pill { border-radius: 8px; padding: 5px 7px; margin-bottom: 5px; font-size: 12px; line-height: 1.25; border: 1px solid transparent; transition: background 0.3s, border-color 0.3s; }
.pill b { display: block; font-weight: 700; }
.pill span { color: inherit; opacity: 0.8; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill.waiting { background: #e4ecfb; color: #274a8c; }
.pill.confirmed { background: #d6f2e5; color: #0d5a3b; border-color: #8fd4b4; }
.pill.retrying { background: #fff1cf; color: #6b4a00; border-color: #efce7a; }
.pill.failed { background: #fcdfe2; color: #7a1d26; border-color: #f0a3ab; }
.pill.cancelled { background: #eceff4; color: #6b778c; text-decoration: line-through; }
.pill.replanned::before { content: "★ "; }
.pill.fresh { animation: pop 0.9s ease-out; }
@keyframes pop { 0% { transform: scale(0.85); box-shadow: 0 0 0 0 rgba(47, 111, 237, 0.5); } 40% { transform: scale(1.06); } 100% { transform: scale(1); box-shadow: 0 0 0 10px rgba(47, 111, 237, 0); } }
.dot.run { width: 14px; height: 14px; border: 2px solid var(--blue); border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; margin-right: 8px; }

.aboutbtn { background: rgba(255, 255, 255, 0.14); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; font-weight: 600; }
.aboutbtn:hover { background: rgba(255, 255, 255, 0.24); }
.info { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-size: 11px; font-weight: 700; cursor: help; vertical-align: middle; }
dialog#about { max-width: 640px; width: calc(100% - 32px); border: 0; border-radius: 14px; padding: 22px 24px; box-shadow: 0 20px 60px rgba(11, 35, 84, 0.3); }
dialog#about::backdrop { background: rgba(11, 35, 84, 0.45); }
dialog#about h3 { margin: 16px 0 4px; }
dialog#about ul { margin: 4px 0; padding-left: 20px; }
dialog#about li { margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip-btn { background: var(--blue-soft); color: var(--blue); border: 0; border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12.5px; cursor: pointer; text-align: left; }
.chip-btn:hover { background: #d9e6ff; }
.info.live { background: var(--green-soft); color: var(--green); }

.alert .big small { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0; opacity: 0.85; margin-top: 2px; }
.fold { margin-top: 22px; border-top: 1px solid var(--line, #dfe5f0); padding-top: 12px; }
.fold > summary { cursor: pointer; padding: 6px 0; font-size: 15px; }
.fold > summary .mut { margin-left: 6px; }
.adjust > summary.adjust-sum { display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
.adjust > summary.adjust-sum::-webkit-details-marker { display: none; }
.adjust > summary.adjust-sum::after { content: "\25BE"; color: var(--blue); margin-left: auto; padding-left: 10px; }
.adjust[open] > summary.adjust-sum::after { content: "\25B4"; }
.stickybar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid #dfe5f0; box-shadow: 0 -6px 20px rgba(11, 35, 84, 0.08); padding: 10px 16px; }
.stickybar-in { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
#s-plans { padding-bottom: 84px; }

/* ---- Round 2 visual refresh ---- */
.top { background: linear-gradient(120deg, var(--navy) 0%, #12306b 100%); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.cost, .kv b, .metric b, .mstats b, table.cmp td, .big, .stickybar b { font-variant-numeric: tabular-nums; }
.btn { transition: background 0.15s, transform 0.1s; }
.btn:active { transform: translateY(1px); }
.card.plan { transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s; }
.card.plan:not(.baseline):hover { box-shadow: 0 6px 22px rgba(11, 35, 84, 0.12); transform: translateY(-2px); }
.card.plan.sel .foot .btn { box-shadow: 0 2px 8px rgba(47, 111, 237, 0.35); }
summary.sumrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
summary.sumrow::-webkit-details-marker { display: none; }
summary.sumrow::after { content: "\25BE"; color: var(--blue); margin-left: auto; padding-left: 10px; }
details[open] > summary.sumrow::after { content: "\25B4"; }

/* merchant cards */
.merchant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; margin-top: 14px; }
.mcard { border: 1px solid var(--line); border-left: 4px solid #cbd5e6; border-radius: 12px; padding: 12px 14px; background: #fff; display: flex; flex-direction: column; gap: 8px; cursor: pointer; align-self: start; transition: box-shadow 0.15s, transform 0.15s; }
.mcard:hover { box-shadow: 0 6px 22px rgba(11, 35, 84, 0.1); transform: translateY(-1px); }
.mcard.high { border-left-color: var(--red); }
.mcard.mid { border-left-color: #d9a21b; }
.mcard.low { border-left-color: var(--green); }
.mtop { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.mtop b { font-size: 16px; color: var(--navy); display: block; }
.mtag { display: block; font-size: 12.5px; color: var(--blue); font-weight: 600; margin-top: 1px; }
.mgo { font-size: 12.5px; color: var(--blue); font-weight: 600; white-space: nowrap; opacity: 0.8; }
.mcard:hover .mgo { opacity: 1; }
.mmore { font-size: 12.5px; }
.mmore summary { cursor: pointer; color: var(--mut); list-style: none; }
.mmore summary::-webkit-details-marker { display: none; }
.mmore summary::before { content: "\25B8\00a0 "; }
.mmore[open] summary::before { content: "\25BE\00a0 "; }
.mdesc { font-size: 13px; color: var(--mut); margin: 6px 0 0; }
.mstats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.mstats div { background: var(--bg); border-radius: 8px; padding: 6px 8px; }
.mstats b { display: block; font-size: 15px; color: var(--navy); }
.mstats span { font-size: 11px; color: var(--mut); line-height: 1.25; display: block; }
.mstats .risk.high b { color: var(--red); }
.mstats .risk.mid b { color: var(--amber); }
.mstats .risk.low b { color: var(--green); }

/* Adjust the plan: vendor cards with switches */
.adjust-cols { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 20px; }
@media (max-width: 900px) { .adjust-cols { grid-template-columns: minmax(0, 1fr); } }
.vendor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 12px; }
.vcard { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; display: flex; flex-direction: column; gap: 8px; transition: border-color 0.15s, background 0.15s; }
.vcard.is-locked { border-color: var(--blue); background: #f8faff; }
.vtop { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.vtop b { color: var(--navy); }
.vprio { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #eef1f6; color: var(--mut); white-space: nowrap; }
.vprio.hi { background: var(--red-soft); color: var(--red); }
.vprio.mid { background: var(--amber-soft); color: var(--amber); }
.vchips { display: flex; flex-wrap: wrap; gap: 5px; }
.vchip { font-size: 11.5px; background: #f1f4f9; color: var(--mut); padding: 2px 8px; border-radius: 999px; }
.vchip.warn { background: var(--amber-soft); color: var(--amber); }
.vchip.good { background: var(--green-soft); color: var(--green); font-weight: 600; }
.vctl { display: flex; flex-direction: column; gap: 8px; margin-top: auto; padding-top: 9px; border-top: 1px solid var(--line); }
.sw { display: flex; align-items: center; gap: 9px; font-size: 13px; cursor: pointer; }
.sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw .knob { width: 34px; height: 20px; background: #cbd5e6; border-radius: 999px; position: relative; flex: none; transition: background 0.15s; }
.sw .knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.sw input:checked + .knob { background: var(--blue); }
.sw input:checked + .knob::after { transform: translateX(14px); }
.sw input:focus-visible + .knob { outline: 2px solid var(--blue); outline-offset: 2px; }
.sw input:disabled + .knob { opacity: 0.45; }
.vdelay { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.vdelay input { width: 64px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- Watch it run ---- */
.runhead { border-top: 4px solid var(--blue); }
.daybar-wrap { margin-top: 14px; }
.daybar { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; margin-top: 6px; }
.daybar i { height: 8px; border-radius: 3px; background: #e3e9f4; transition: background 0.3s; }
.daybar i.done { background: var(--green); }
.daybar i.low { background: #d9a21b; }
.daybar i.bad { background: var(--red); }
.daybar i.now { background: var(--blue); box-shadow: 0 0 0 2px rgba(47, 111, 237, 0.25); }
.seg { display: inline-flex; background: #eef2f9; border-radius: 9px; padding: 2px; }
.seg button { border: 0; background: none; padding: 4px 11px; border-radius: 7px; font-size: 12.5px; color: var(--mut); font-weight: 600; }
.seg button.on { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(11, 35, 84, 0.15); }
.narr { margin-top: 12px; padding: 10px 14px; background: var(--blue-soft); border-radius: 10px; color: var(--navy); font-weight: 600; }
.cashmeter { margin-top: 12px; }
.cm-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.cm-label { display: block; font-size: 12px; color: var(--mut); }
.cm-num { font-size: 32px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cm-num.ok { color: var(--green); }
.cm-num.warn { color: var(--amber); }
.cm-num.bad { color: var(--red); }
.cm-credit { text-align: right; min-width: 160px; }
.cm-credit b { font-size: 18px; color: var(--navy); }
.cm-cbar { height: 6px; background: #e3e9f4; border-radius: 4px; margin-top: 5px; overflow: hidden; }
.cm-cbar i { display: block; height: 100%; background: #7c4dff; border-radius: 4px; transition: width 0.5s; }
.cm-track { position: relative; height: 16px; background: #e8edf6; border-radius: 9px; margin: 10px 0 26px; }
.cm-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 9px; transition: width 0.6s ease; }
.cm-fill.ok { background: linear-gradient(90deg, #35b784, #148a5c); }
.cm-fill.warn { background: linear-gradient(90deg, #e9b94d, #d9a21b); }
.cm-fill.bad { background: var(--red); }
.cm-buffer { position: absolute; top: -5px; bottom: -5px; width: 0; border-left: 2px dashed var(--red); }
.cm-buffer em { position: absolute; top: 100%; left: 0; transform: translateX(-50%); margin-top: 6px; font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--red); white-space: nowrap; }
.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 800; flex: none; }
.feed { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.feed:first-of-type { border-top: 0; }
.feed.new { animation: slidein 0.45s ease-out both; }
.feed .fs { font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: #eef1f6; color: var(--mut); margin-left: 4px; }
.feed .fs.st-confirmed { background: var(--green-soft); color: var(--green); }
.feed .fs.st-retrying { background: var(--amber-soft); color: var(--amber); }
.feed .fs.st-failed { background: var(--red-soft); color: var(--red); }
.feed.st-failed { background: #fff7f8; margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 8px; }
.pill.fresh.failed, .pill.fresh.retrying { animation: shake 0.6s ease-out; }
.pulse-ring { transform-box: fill-box; transform-origin: center; animation: ring 1.5s ease-out infinite; opacity: 0.5; }
@keyframes slidein { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
@keyframes ring { from { transform: scale(1); opacity: 0.55; } to { transform: scale(3.4); opacity: 0; } }
.kv.tiles div { background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.cm-track { margin-bottom: 34px; }

/* outcome layout: chart left, a short stack of numbers right */
.oc-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(250px, 1fr); gap: 16px; align-items: start; margin-top: 16px; }
.oc-grid > .card { margin: 0; }
.oc-kv { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.oc-kv > div { background: none; padding: 0; }
.oc-kv .vs { font-size: 13px; font-weight: 500; color: var(--mut); }
.oc-side { position: sticky; top: 76px; }
@media (max-width: 900px) { .oc-grid { grid-template-columns: minmax(0, 1fr); } .oc-side { position: static; } }
#s-outcome .card, #s-outcome .fold { margin-top: 16px; }

/* approve: collapsible groups and the bottom bar */
.agroup > summary.ghead { margin-bottom: 4px; }
.agroup > summary .selgrp { flex: none; }
#s-approve { padding-bottom: 76px; }
.consq { font-size: 14px; flex: 1 1 320px; }

/* Adjust the plan, regrouped, and the vendor table */
.adjust-sec { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.adjust-sec h4 { margin: 0 0 8px; font-size: 14px; color: var(--navy); }
.adjust-row { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: flex-end; }
.afield { display: flex; flex-direction: column; gap: 4px; font-size: 13px; max-width: 260px; }
.afield input { width: 150px; }
.vblock { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; background: #fff; }
.vblock.is-locked { border-color: var(--blue); background: #f8faff; }
.vhead { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.vverdict { font-size: 12.5px; padding: 3px 10px; border-radius: 999px; background: var(--bg); color: var(--mut); font-weight: 600; white-space: nowrap; }
.vverdict.chg { background: var(--blue-soft); color: var(--blue); }
.vbills { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 8px; }
.vbills th { text-align: left; font-weight: 600; color: var(--mut); font-size: 12px; padding: 4px 6px; }
.vbills td { padding: 6px; border-top: 1px solid var(--line); vertical-align: top; }
.vplan { color: var(--mut); }
.vplan.chg { color: var(--navy); font-weight: 600; }
.vrules { margin-top: 8px; font-size: 13.5px; }
.vrules > summary { cursor: pointer; color: var(--blue); }
.vrules > summary b { color: var(--navy); }
.vctl { display: flex; flex-direction: column; gap: 10px; padding: 10px 0 2px; }
.vtiming { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.vtiming input[type=number] { width: 64px; }
.vfield { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.vfield input[type=number] { width: 70px; }
@media (max-width: 700px) {
  .vbills thead { display: none; }
  .vbills tr { display: block; border-top: 1px solid var(--line); padding: 4px 0; }
  .vbills td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 2px 0; }
  .vbills td::before { content: attr(data-l); color: var(--mut); font-size: 12px; }
}

/* contracts */
.ctpanel { border: 1px solid #cfe0ff; background: #f6f9ff; border-radius: 12px; padding: 10px 14px; }
.ctpanel > summary { cursor: pointer; color: var(--navy); }
.ct-cols { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(250px, 1fr); gap: 16px; margin-top: 10px; align-items: start; }
.ct-side { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }
.smp { border-top: 1px solid var(--line); padding: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.smp:first-of-type { border-top: 0; }
.smp-act { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ct-text { white-space: pre-wrap; font: 12.5px/1.45 ui-monospace, Consolas, monospace; background: var(--bg); border-radius: 8px; padding: 10px; max-height: 340px; overflow: auto; }
@media (max-width: 900px) { .ct-cols { grid-template-columns: minmax(0, 1fr); } }

/* the contract review gets the full width of the panel: the contract on the left, the terms table on the right */
.ct-review { margin-top: 12px; }
.ct-review .grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.1fr); gap: 16px; align-items: start; }
.ct-review table.cmp td:first-child { min-width: 240px; }
@media (max-width: 900px) { .ct-review .grid2 { grid-template-columns: minmax(0, 1fr); } }
