:root {
  --bg: #d8dee6;
  --chrome: #e8edf3;
  --chrome-2: #eef2f7;
  --chrome-3: #f7f9fc;
  --chrome-line: #c5ced8;
  --chrome-hover: #dce5ef;
  --ink-on-dark: #1a222c;
  --muted-on-dark: #5c6776;
  --panel: #f7f8fa;
  --panel-2: #eef1f5;
  --line: #d0d7e0;
  --line-strong: #b8c2ce;
  --text: #1a222c;
  --muted: #5c6776;
  --accent: #1f6f9f;
  --accent-2: #185a82;
  --accent-soft: #e2f0f8;
  --on-fill: #d9ebf5;
  --ok: #2f8a5a;
  --warn: #b8860b;
  --sch: #f0f3f7;
  --sheet: #fcfdff;
  --font: "Segoe UI", "Candara", Tahoma, sans-serif;
  --shadow-card: 0 1px 2px rgba(26, 34, 44, .05), 0 6px 16px rgba(26, 34, 44, .06);
  --focus: 0 0 0 2px #fff, 0 0 0 4px var(--accent);
  --radius: 8px;
  --ease: 140ms ease;
  --steel: #4a5d6e;
  --teal: #2a7a7a;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  font: 13px/1.45 var(--font); color: var(--text); background: var(--bg);
}
button, a { font: inherit; }
#app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) 28px;
  height: 100%;
  min-width: 960px;
}
.top {
  background: linear-gradient(180deg, #f4f7fb 0%, var(--chrome) 100%);
  color: var(--text);
  border-bottom: 1px solid var(--chrome-line);
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset;
}
.brand-row { display: flex; align-items: center; gap: 12px; padding: 6px 12px 6px 14px; min-height: 40px; }
.brand {
  color: var(--accent-2); text-decoration: none; font-weight: 800;
  letter-spacing: .06em; font-size: 14px; flex-shrink: 0;
}
.brand:hover { color: var(--accent); }
.menubar {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}
.menu-cmd {
  background: transparent;
  color: var(--text);
  border: 0;
  height: 28px;
  padding: 0 11px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
}
.menu-cmd:hover, .menu-cmd:focus-visible {
  background: var(--chrome-hover);
  outline: none;
}
.sep { color: var(--muted); }
h1 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text); }
.spacer { flex: 1; }
.svc-header {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  max-width: min(520px, 42vw);
  overflow: hidden;
  cursor: pointer;
}
.svc-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  margin: 0;
  border: 1px solid transparent;
  background: var(--sheet);
  border-radius: 999px;
  padding: 3px 8px 3px 6px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0;
  text-transform: none;
}
.svc-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.svc-pill.ok { background: #e5f5ec; color: #1f7a45; border-color: #b6dfc4; }
.svc-pill.demo { background: #fff4dc; color: #8a6a12; border-color: #e8d08a; }
.svc-pill.off { background: #eef1f5; color: #5c6776; border-color: #c5ced8; }
.svc-pill:hover { filter: brightness(0.97); }
.svc-pill:focus-visible { outline: none; box-shadow: var(--focus); }
.identity-status {
  display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0;
  max-width: 190px; padding: 3px 7px; border: 1px solid var(--chrome-line);
  border-radius: 999px; background: var(--chrome-3); color: var(--muted);
  white-space: nowrap; overflow: hidden; font-size: 11px;
}
.identity-name { overflow: hidden; text-overflow: ellipsis; }
.identity-action { color: var(--accent-2); font-weight: 700; text-decoration: none; }
.identity-action:hover { text-decoration: underline; }
.src-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  margin: 0 2px 2px 0;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-2);
  border: 1px solid #c5dcec;
}
.pick-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}
.pick-search {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font: inherit;
  background: var(--sheet);
}
.pick-search:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.pick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(56vh, 520px);
  overflow: auto;
}
.pick-card {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  grid-template-areas: "num name src" "num desig src";
  column-gap: 12px;
  row-gap: 2px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--sheet);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.pick-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.pick-card.on { border-color: var(--accent); background: var(--on-fill); box-shadow: 0 0 0 1px var(--accent) inset; }
.pick-card-num { grid-area: num; font-weight: 800; font-size: 15px; color: var(--accent-2); align-self: center; }
.pick-card-name { grid-area: name; font-weight: 600; }
.pick-card-desig { grid-area: desig; font-size: 12px; color: var(--muted); }
.pick-card-src { grid-area: src; align-self: center; text-align: right; }
.ghost {
  color: var(--text); text-decoration: none;
  border: 1px solid var(--line-strong); padding: 5px 12px; border-radius: 6px;
  background: var(--sheet);
}
.ghost:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }

.greet-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 16px 12px;
  background: linear-gradient(90deg, #e8eef5 0%, #f2f5f8 55%, #e9f2ef 100%);
  border-top: 1px solid rgba(197, 206, 216, .6);
}
.order-hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  min-width: 0;
  max-width: min(640px, 72%);
  margin: 0;
  padding: 8px 14px 10px;
  border: 1px solid var(--line);
  background: var(--sheet);
  border-radius: 10px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.order-hero:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.order-hero:focus-visible { outline: none; box-shadow: var(--focus); }
.order-hero.is-empty { border-style: dashed; }
.order-hero-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.order-greet {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--text);
  line-height: 1.3;
}
.order-hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.pipe-mini {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.pipe-mini li { display: flex; align-items: center; }
.pipe-mini li + li::before {
  content: "›";
  margin: 0 8px;
  color: var(--line-strong);
  font-weight: 400;
}
.flow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.layout {
  display: flex;
  min-height: 0;
  background: var(--bg);
}
.sidebar {
  width: 280px;
  flex: 0 0 280px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
.side-head {
  flex: 0 0 auto;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.cad-tree {
  flex: 1;
  overflow: auto;
  padding: 8px 0 16px;
}
.cad-tree::-webkit-scrollbar { width: 10px; }
.cad-tree::-webkit-scrollbar-thumb { background: #b8c2ce; border-radius: 6px; }
.cad-tree::-webkit-scrollbar-track { background: transparent; }

.tree-node {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 12px 7px 8px;
  cursor: pointer;
  user-select: none;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  border-radius: 0 6px 6px 0;
  transition: background var(--ease), border-color var(--ease);
}
.tree-node:hover { background: #e8f0fc; }
.tree-node.on {
  background: var(--on-fill);
  border-left-color: var(--accent);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(31, 111, 159, .14);
}
.tree-node.section {
  margin-top: 6px;
  font-weight: 700;
  background: var(--panel-2);
  border-left-color: var(--steel);
}
.tree-node.section .mark {
  background: rgba(74, 93, 110, .14);
  color: var(--steel);
  font-size: 11px;
  font-weight: 800;
}
.tree-node.kind-service .mark { font-size: 10px; }
.tree-node.section.on {
  background: var(--on-fill);
  border-left-color: var(--accent);
}
.tree-node.stage.on {
  background: var(--on-fill);
  border-left-color: var(--accent);
}
.tree-node.dim { opacity: .48; }
.tree-node .chev {
  width: 16px;
  flex-shrink: 0;
  text-align: center;
  color: var(--muted);
  font-size: 9px;
}
.tree-node .mark {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--accent-2);
  flex-shrink: 0;
  font-size: 12px;
  border-radius: 5px;
  background: rgba(31, 111, 159, .1);
}
.tree-node.on .mark { background: rgba(31, 111, 159, .18); }
.tree-node .tree-lab {
  overflow: hidden;
  min-width: 0;
}
.tree-node .tree-lab b,
.tree-node .tree-lab span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tree-node .tree-lab span {
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
}
.tree-kids { display: none; }
.tree-kids.open { display: block; }

.workspace {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--sch);
}
.stepper {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0;
  background: var(--chrome-2);
  border-bottom: 1px solid var(--chrome-line);
  overflow-x: auto;
}
.step {
  flex: 1 1 0;
  min-width: 128px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 0;
  border-right: 1px solid var(--chrome-line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background var(--ease), color var(--ease);
}
.step:hover { background: var(--chrome-hover); color: var(--text); }
.step.on {
  background: var(--sheet);
  color: var(--text);
  box-shadow: inset 0 -3px 0 var(--accent);
}
.step .num {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  background: var(--panel);
}
.step.on .num { border-color: var(--accent); color: var(--accent-2); background: var(--accent-soft); }
.step .lab { font-size: 13px; line-height: 1.25; font-weight: 600; }

.bpm-strip {
  background: #e4ebf2;
  border-bottom: 1px solid var(--chrome-line);
}
.bpm-strip .step { min-width: 110px; padding: 10px 12px; }
.bpm-strip .step .lab { font-size: 12px; }
.bpm-strip .step.on {
  background: var(--sheet);
  box-shadow: inset 0 -3px 0 var(--teal);
}
.bpm-strip .step.on .num { border-color: var(--teal); color: var(--teal); background: #dff2f0; }

.stack-bar {
  display: flex;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: #e6eaef;
  margin: 12px 0 8px;
}
.stack-bar .seg { display: block; height: 100%; min-width: 0; }
.stack-bar .seg.buy { background: #1f6f9f; }
.stack-bar .seg.asm { background: #3d7a4a; }
.stack-bar .seg.det { background: #b8860b; }
.stack-bar .seg.mat { background: #5a6d82; }
.stack-bar .seg.labor { background: #8a6a4a; }
.stack-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 0 0 16px;
  font-size: 12px;
  color: var(--muted);
}
.stack-legend .dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.stack-legend .dot.buy { background: #1f6f9f; }
.stack-legend .dot.asm { background: #3d7a4a; }
.stack-legend .dot.det { background: #b8860b; }
.stack-legend .dot.mat { background: #5a6d82; }
.stack-legend .dot.labor { background: #8a6a4a; }
.hbars { margin: 0 0 18px; max-width: 720px; }
.hbar {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr 110px;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.hbar-lab { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track {
  height: 10px;
  background: #e6eaef;
  border-radius: 999px;
  overflow: hidden;
}
.hbar-track > i { display: block; height: 100%; background: var(--accent); }
.hbar-n { font-size: 12px; font-weight: 600; text-align: right; }
.analog-block { margin-bottom: 20px; }
.analog-block table.dash { margin-top: 10px; }

.kpi-row {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 18px 4px;
}
.kpi-row[data-cols="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-row[data-cols="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-row[data-cols="6"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stepper[hidden], .bpm-strip[hidden], .analytics-strip[hidden] { display: none !important; }
.kpi {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 14px 16px 12px;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  min-width: 0;
  transition: border-color var(--ease), transform var(--ease), box-shadow var(--ease);
}
.kpi:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(31, 111, 159, .12);
}
.kpi.on { background: var(--accent-soft); border-color: var(--accent); }
.kpi .n { display: block; font-size: 26px; font-weight: 700; color: var(--accent-2); line-height: 1.1; overflow-wrap: anywhere; }
.kpi .l { display: block; color: var(--text); font-size: 13px; font-weight: 600; margin-top: 6px; overflow-wrap: anywhere; }
.kpi .why { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.35; overflow-wrap: anywhere; }
.kpi .kpi-go {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}

.ws-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px 12px;
  background: linear-gradient(#fcfdff, #eef2f7);
  border-bottom: 1px solid var(--line);
  color: var(--text);
}
.ws-toolbar h2 { margin: 2px 0 0; font-size: 18px; font-weight: 700; color: var(--text); }
.ws-toolbar .hello { margin: 0; font-size: 13px; color: var(--muted); }
.ws-toolbar .meta { color: var(--muted); }
.ws-body {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
}
.ws-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 20px 22px 28px;
}
.ws-detail {
  width: 300px;
  flex: 0 0 300px;
  overflow: auto;
  background: var(--sheet);
  border-left: 1px solid var(--line);
  padding: 18px 18px 24px;
}
.ws-detail h3 {
  margin: 0 0 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.ws-detail .field { margin: 0 0 14px; }
.ws-detail .field b { display: block; font-size: 14px; }
.ws-detail .ids { font-family: Consolas, "Cascadia Mono", monospace; font-size: 11px; color: var(--muted); word-break: break-all; line-height: 1.5; }
.pause {
  background: #fff8e6;
  border: 1px solid #e0c56a;
  padding: 12px 14px;
  border-radius: var(--radius);
  margin: 10px 0;
}

.entry-title {
  margin: 0 0 14px;
  font-size: 15px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}
.entry-title .meta { font-weight: 400; display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 16px;
  max-width: 960px;
  margin-bottom: 20px;
}
.tile, .open-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--sheet);
  box-shadow: var(--shadow-card);
  transition: border-color var(--ease), background var(--ease), transform var(--ease);
}
.tile {
  padding: 22px 20px 18px;
  min-height: 148px;
}
.tile:hover, .open-btn:hover {
  border-color: var(--accent);
  background: #fff;
  transform: translateY(-1px);
}
.tile .kind, .open-btn .kind {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--accent-2);
}
.tile .sub, .open-btn .sub { color: var(--muted); font-size: 13px; line-height: 1.4; }
.tile .go { margin-top: auto; font-size: 12px; color: var(--accent); font-weight: 600; }

.preview-card, .id-card {
  background: var(--sheet);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.preview-card h3, .id-card h3 { margin: 0 0 6px; font-size: 20px; font-weight: 700; }
.preview-card .meta, .id-card .meta { color: var(--muted); margin-bottom: 12px; }
.id-card p { margin: 0 0 10px; color: var(--text); }
.open-row { display: flex; flex-wrap: wrap; gap: 12px; }
.open-btn { padding: 14px 18px; min-width: 180px; min-height: 72px; }
.open-btn .kind { font-size: 16px; }

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.dcard {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  box-shadow: var(--shadow-card);
  transition: border-color var(--ease), background var(--ease), box-shadow var(--ease);
}
.dcard:hover, .dcard.on { border-color: var(--accent); box-shadow: 0 4px 14px rgba(31, 111, 159, .1); }
.dcard.on { background: var(--accent-soft); }
.dcard b { display: block; font-size: 14px; color: var(--text); }
.dcard .st {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #eef4e8;
  color: #3d6b3a;
}

table.dash {
  width: 100%;
  border-collapse: collapse;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
table.dash th, table.dash td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  overflow-wrap: anywhere;
}
table.dash th {
  background: var(--panel-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  font-weight: 700;
}
table.dash { table-layout: fixed; }
table.dash tr { cursor: pointer; }
table.dash tr:hover td { background: #e8f0fc; }
table.dash tr.on td { background: var(--on-fill); }
table.dash .indent { padding-left: 28px; }

.bar, .cov-track {
  height: 8px;
  background: #e6eaef;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
  max-width: 160px;
}
.bar > i, .cov-track > i { display: block; height: 100%; background: var(--ok); }
.bar.warn > i, .cov.warn .cov-track > i { background: var(--warn); }
.cov.mid .cov-track > i { background: #b8860b; }
.cov {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.cov-lab { font-size: 12px; color: var(--muted); font-weight: 600; min-width: 2.4em; }
.kpi .cov { margin-top: 10px; }
.kpi .cov-track { max-width: none; flex: 1; }

.filters { display: flex; gap: 8px; margin: 0 0 16px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line-strong);
  background: var(--sheet);
  border-radius: 6px;
  padding: 7px 14px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background var(--ease), border-color var(--ease);
}
.chip:hover { border-color: var(--accent); background: #fff; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); font-weight: 600; }

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-2);
  margin-right: 4px;
}
.badge.d { background: var(--panel-2); color: var(--steel); }
.meta { color: var(--muted); font-size: 12px; }
.msg { color: var(--muted); line-height: 1.5; margin: 0 0 16px; max-width: 52em; }
button.build {
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  margin-bottom: 16px;
}
button.build:hover { background: var(--accent-2); }

.empty-state {
  background: var(--sheet);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 28px 24px;
  margin-bottom: 16px;
  max-width: 36em;
}
.empty-state.empty-hero {
  padding: 36px 28px;
  box-shadow: var(--shadow-card);
  border-style: solid;
  border-color: var(--line);
}
.empty-state.empty-hero .svc-actions { margin-top: 16px; }
.empty-state.empty-hero .build { margin-bottom: 0; }
.empty-title { margin: 0 0 6px; font-size: 16px; font-weight: 700; }
.empty-text { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.empty-inline { color: var(--muted); margin: 0 0 14px; }

.shop-lead {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
.shop-count { margin: 0 0 6px; font-size: 16px; font-weight: 700; color: var(--text); }

.shop-source {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 0 0 16px;
  padding: 12px 14px;
  background: linear-gradient(90deg, #eef5f8, #f7f9fc);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.shop-source .shop-title { font-weight: 700; color: var(--text); }
.shop-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
}
.shop-badge::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.shop-badge.ok { background: #e5f5ec; color: #1f7a45; border-color: #b6dfc4; }
.shop-badge.demo { background: #fff4dc; color: #8a6a12; border-color: #e8d08a; }
.shop-badge.off { background: #eef1f5; color: #5c6776; border-color: #c5ced8; }
.shop-source .hint { color: var(--muted); font-size: 12px; }
.shop-source .fact { font-weight: 600; color: var(--accent-2); margin-left: auto; }

.status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--chrome-2);
  color: var(--muted);
  padding: 0 14px;
  font-size: 12px;
  border-top: 1px solid var(--chrome-line);
}
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); }
.top :focus-visible, .ghost:focus-visible, .step:focus-visible { box-shadow: 0 0 0 2px rgba(31, 111, 159, .55); }

.stack-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e6eaef;
  margin: 8px 0 10px;
}
.stack-bar .seg { display: block; height: 100%; }
.stack-bar .seg.buy, .dot.buy { background: #3d7ea6; }
.stack-bar .seg.asm, .dot.asm, .stack-bar .seg.own, .dot.own { background: #8a6d3b; }
.stack-bar .seg.det, .dot.det, .stack-bar .seg.wage, .dot.wage { background: #5a8f5a; }
.stack-bar .seg.mat, .dot.mat { background: #b8860b; }
.stack-bar .seg.labor, .dot.labor, .stack-bar .seg.extra, .dot.extra { background: #5a6d82; }
.stack-bar .seg.tzr, .dot.tzr, .stack-bar .seg.social, .dot.social { background: #4a90a4; }
.stack-bar .seg.rseo, .dot.rseo, .stack-bar .seg.shop, .dot.shop,
.stack-bar .seg.admin, .dot.admin, .stack-bar .seg.comm, .dot.comm { background: #a65d4e; }
.stack-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
}
.stack-legend .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.hbars { display: flex; flex-direction: column; gap: 8px; margin: 0 0 18px; }
.hbar {
  display: grid;
  grid-template-columns: 160px 1fr 120px;
  gap: 10px;
  align-items: center;
}
.hbar-lab { font-size: 12px; color: var(--muted); }
.hbar-track { height: 8px; background: #e6eaef; border-radius: 999px; overflow: hidden; }
.hbar-track > i { display: block; height: 100%; background: var(--accent); }
.hbar-n { font-size: 12px; font-weight: 600; }
.kpi-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}
.kpi-tile {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-card);
}
.kpi-tile .n { display: block; font-size: 16px; font-weight: 700; color: var(--accent-2); }
.kpi-tile .l { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.coeff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}
.coeff-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.coeff-grid input, .coeff-grid select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  color: inherit;
  background: var(--sheet);
}

.menu { display: none; }
.menu-drop { position: relative; }
.menu-btn, .menu-pop button {
  background: transparent; color: var(--text); border: 0;
  padding: 4px 11px; cursor: pointer; font: inherit; text-align: left; width: 100%;
}
.menu-btn { width: auto; border-radius: 6px; height: 28px; padding: 0 11px; font-weight: 600; }
.menu-btn:hover, .menu-drop.open .menu-btn { background: var(--chrome-hover); }
.menu-pop {
  display: none; position: absolute; top: calc(100% + 2px); right: 0; left: auto; min-width: 280px; z-index: 40;
  background: var(--sheet); border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 6px 0; box-shadow: 0 8px 24px rgba(26, 34, 44, .12);
}
.menu-pop-start { left: 0; right: auto; }
.menu-drop.open .menu-pop { display: block; }
.menu-pop button { padding: 8px 14px; color: var(--text); }
.menu-pop button:hover, .menu-pop button:focus-visible { background: var(--accent-soft); outline: none; }
.menu-sep { height: 1px; margin: 4px 10px; background: var(--line); }
.menu-group-label {
  padding: 6px 14px 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

.settings-drop { margin-left: 4px; }
.settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--sheet);
  color: var(--steel);
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}
.settings-btn:hover, .settings-drop.open .settings-btn {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-2);
}
.settings-btn:focus-visible { box-shadow: var(--focus); }
.gear-icon { display: block; }
.settings-pop { min-width: 300px; margin-top: 6px; }

.svc-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid transparent;
}
.svc-badge.ok { background: #e5f5ec; color: #1f7a45; border-color: #b6dfc4; }
.svc-badge.off { background: #f0f0f2; color: #6a7380; border-color: #d0d5dc; }

.svc-pipe-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  padding: 10px 12px;
  background: linear-gradient(90deg, #eef5f8, #f7f9fc);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.open-btn.soft, .tile.soft { opacity: .92; border-style: dashed; }
.open-btn .go-row, .tile .go-row {
  display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap;
}
.tile .go { margin-top: 0; }

.svc-toast {
  position: fixed;
  right: 18px;
  bottom: 40px;
  z-index: 90;
  max-width: 420px;
  background: var(--sheet);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(26, 34, 44, .16);
  padding: 14px 16px;
  color: var(--text);
}
.svc-toast-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.svc-list { display: flex; flex-direction: column; gap: 12px; margin: 8px 0 16px; }
.svc-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px 14px;
  box-shadow: var(--shadow-card);
}
.svc-card-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px;
}
.svc-card-head b { font-size: 14px; }
.svc-card .coeff-grid { margin: 0; }
.svc-card .check-row { margin: 0 0 8px; }
.svc-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.bpm-modal[hidden] { display: none; }
.bpm-modal {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 48px 16px 24px;
  overflow-y: auto;
}
.bpm-modal-bg { position: absolute; inset: 0; background: rgba(40, 52, 64, .28); }
.bpm-dlg {
  position: relative; z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(880px, 100%);
  max-height: calc(100vh - 72px);
  min-height: 0;
  overflow: hidden;
  background: var(--sheet);
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(26, 34, 44, .18);
  color: var(--text);
  border: 1px solid var(--line);
}
.bpm-dlg-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: var(--panel-2); position: sticky; top: 0;
}
.bpm-dlg-head h2 { margin: 0; font-size: 16px; }
.bpm-dlg-x {
  border: 0; background: transparent; font-size: 22px; cursor: pointer; color: var(--muted);
}
.bpm-dlg.wide { width: min(1080px, 100%); }
.help-tabs {
  display: flex; gap: 6px; margin: 0 0 14px; flex-wrap: wrap;
}
.help-tab {
  border: 1px solid var(--line-strong);
  background: var(--sheet);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}
.help-tab.on, .help-tab:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 0 14px;
}
.chart-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px 8px;
}
.chart-card h3 { margin: 0 0 6px; font-size: 13px; }
.help-chart { width: 100%; height: auto; display: block; }
.help-chart .chart-n { font-size: 10px; font-weight: 700; fill: var(--text); }
.help-chart .chart-lab { font-size: 9px; fill: var(--muted); }
.chart-legend {
  display: flex; flex-wrap: wrap; gap: 10px 14px;
  margin: 6px 0 0; font-size: 12px; color: var(--muted);
}
.chart-legend.col { flex-direction: column; gap: 6px; }
.chart-legend .dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle;
}
.donut-wrap { display: flex; align-items: center; gap: 16px; }
.score-row { display: flex; gap: 14px; align-items: center; margin: 0 0 14px; }
.score-ring { display: flex; flex-direction: column; align-items: center; width: 96px; }
@media (max-width: 900px) {
  .chart-grid { grid-template-columns: 1fr; }
  .score-row { flex-wrap: wrap; }
}
.bpm-dlg-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overflow-wrap: anywhere;
  padding: 14px 16px 18px;
}
.bpm-dlg-body h3 { margin: 16px 0 8px; font-size: 13px; }
.src-list { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 16px; }
.src-list label { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; }
.src-shop-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 4px; padding: 8px 10px; background: var(--panel-2);
  border-radius: 6px; border: 1px solid var(--line);
}
.check-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; }

.causal { margin: 0 0 18px; }
.causal-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch;
}
.causal-node {
  flex: 1 1 140px;
  min-width: 120px;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: var(--shadow-card);
}
.causal-node b { display: block; font-size: 12px; }
.causal-node .n { display: block; font-weight: 700; color: var(--accent-2); margin: 4px 0 2px; }
.causal-node .from { display: block; font-size: 11px; color: var(--muted); line-height: 1.3; }
.causal-arrow {
  text-align: center; color: var(--muted); font-size: 12px; margin: 4px 0 8px; letter-spacing: .04em;
}

@media (max-width: 1200px) {
  .kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tiles { grid-template-columns: 1fr; }
  .ws-detail { width: 260px; flex-basis: 260px; }
  .flow { display: none; }
}


/* —— Analytics / tree tools / refresh —— */
.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tree-tools { display: inline-flex; gap: 4px; }
.ghost.tiny {
  border: 1px solid var(--line);
  background: var(--sheet);
  color: var(--muted);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
}
.ghost.tiny:hover { background: #e8f0fc; color: var(--text); }
.analytics-strip .step { background: #f3f7fb; }
.analytics-strip .step.on { background: var(--on-fill); }
.refresh-bar {
  margin: 0 0 14px;
  padding: 12px 14px;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-card);
}
.refresh-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.refresh-drop { position: relative; }
.refresh-drop summary {
  cursor: pointer;
  list-style: none;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  font-size: 13px;
}
.refresh-menu {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sheet);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 260px;
}
.sync-box { margin-top: 6px; }
.sync-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 6px; }
.sync-grid { display: flex; flex-direction: column; gap: 4px; }
.sync-row {
  display: grid;
  grid-template-columns: 160px auto 1fr;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}
.sync-row .badge.ok { background: #d9f2e3; color: #1a6b3c; }
.sync-row .badge.skip { background: #eee; color: #666; }
.sync-row .badge.err { background: #fde2e1; color: #8a1f1b; }
.feed-toggles {
  display: flex; flex-wrap: wrap; gap: 10px 16px;
  align-items: center; margin: 0 0 12px;
  padding: 8px 10px; background: var(--panel-2); border-radius: 8px;
}
.feed-tog { font-size: 12px; margin: 0; }
.warn-note { color: #8a5a00; }
.stage-card .stage-row {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 8px 0;
}
.stage-pill {
  display: inline-flex; align-items: center;
  padding: 6px 12px; border-radius: 999px;
  font-weight: 700; font-size: 13px;
  background: #e8eef5; color: var(--steel);
}
.stage-pill.ok { background: #d9f2e3; color: #1a6b3c; }
.stage-pill.mid { background: #fff3cd; color: #7a5b00; }
.stage-pill.warn { background: #fde2e1; color: #8a1f1b; }
.stage-pill.off { background: #eceff3; color: #667; }
.analytics-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.ghost {
  border: 1px solid var(--line);
  background: var(--sheet);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 12px;
  font: inherit;
  cursor: pointer;
}
.ghost:hover { background: #e8f0fc; }
.export-row { display: flex; gap: 8px; margin: 12px 0; }
.life-tiles .life-btn { cursor: pointer; border: 1px solid transparent; text-align: left; }
.life-tiles .life-btn.on { border-color: var(--accent); background: var(--on-fill); }
.analytics-table tr.on { background: var(--on-fill); }
.seg.shop { background: #5b8def; }
.dot.shop { background: #5b8def; }

.file-drop { margin-left: 0; }
.risk-banner {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--sheet);
  margin: 0 0 14px;
}
.risk-banner.warn { background: #fdecea; border-color: #e8b4ae; }
.risk-banner.mid { background: #fff6e0; border-color: #e8d08a; }
.risk-banner.ok { background: #eaf6ee; border-color: #b6dfc4; }
.risk-banner b { display: block; margin-bottom: 4px; }
.load-meter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
}
.load-track {
  flex: 1;
  height: 8px;
  background: #e4e9ef;
  border-radius: 99px;
  overflow: hidden;
}
.load-track i { display: block; height: 100%; background: var(--ok); }
.load-meter.mid .load-track i { background: var(--warn); }
.load-meter.idle .load-track i { background: #7aa0c4; }
.load-meter.warn .load-track i { background: #c4473a; }
.gap-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.gap-chip {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--sheet);
}
.gap-chip.short { background: #fdecea; border-color: #e8b4ae; }
.gap-chip.ok { background: #eaf6ee; border-color: #b6dfc4; }
.gap-chip.idle { background: #eef3f8; }
.dash tr.warn-row td { background: #fdecea; }
.dash tr.idle-row td { background: #eef5fb; }
.strategy-table th:nth-child(n+2), .strategy-table td:nth-child(n+2) { text-align: right; }
