.wto-demo {
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --line: #cbd5e1;
  --brand: #005ea5;
  --ok: #15803d;
  --warn: #b91c1c;
  --amber: #d97706;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 1rem;
  line-height: 1.45;
}

.wto-demo * { box-sizing: border-box; }
.wto-demo .wto-sr-only { position: absolute; left: -9999px; }
.wto-demo h1, .wto-demo h2, .wto-demo h3, .wto-demo p { margin: 0 0 .6rem; }
.wto-demo .wto-small { font-size: .9rem; color: var(--muted); }

.wto-demo .wto-shell-header {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 1rem;
}

.wto-demo .wto-shell-header__inner {
  display: flex;
  gap: .8rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: .8rem 1rem;
}

.wto-demo .wto-shell-brand {
  font-weight: 800;
  text-decoration: none;
  color: var(--text);
}

.wto-demo .wto-shell-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .75rem;
}

.wto-demo .wto-shell-nav a {
  text-decoration: none;
  color: var(--brand);
  font-weight: 600;
}

.wto-demo .wto-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.wto-demo .wto-hero { border-left: 8px solid var(--brand); }

.wto-demo .wto-grid-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: .7rem;
}

.wto-demo label { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; }
.wto-demo .wto-inline-check { display: flex; flex-direction: row; align-items: center; gap: .45rem; }
.wto-demo input[type="range"], .wto-demo input[type="number"], .wto-demo select { width: 100%; }

.wto-demo .wto-actions, .wto-demo .wto-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .7rem;
}

.wto-demo button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: .45rem .75rem;
  cursor: pointer;
}

.wto-demo button:hover { border-color: var(--brand); }
.wto-demo button:focus, .wto-demo [tabindex]:focus, .wto-demo input:focus, .wto-demo select:focus {
  outline: 3px solid #ffdd00;
  outline-offset: 2px;
}

.wto-demo .wto-note {
  margin-top: .6rem;
  padding: .65rem;
  border-radius: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.wto-demo .wto-guided { margin-top: .6rem; padding: .7rem; border: 1px dashed var(--line); border-radius: 8px; }

.wto-demo .wto-cards-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .9rem;
}

.wto-demo .wto-scorecards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wto-demo .wto-big { font-size: 1.5rem; font-weight: 700; }

.wto-demo .wto-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: .75rem;
}

.wto-demo .wto-table {
  position: relative;
  border: 2px solid var(--line);
  border-radius: 14px;
  min-height: 185px;
  padding: .7rem;
  background: #fff;
}

.wto-demo .wto-table.wto-heat-low { background: #f0fdf4; }
.wto-demo .wto-table.wto-heat-mid { background: #fff7ed; }
.wto-demo .wto-table.wto-heat-high { background: #fef2f2; }
.wto-demo .wto-table.wto-kb-target { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,94,165,.2); }

.wto-demo .wto-table-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .4rem;
  margin-bottom: .4rem;
}

.wto-demo .wto-seats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .35rem;
}

.wto-demo .wto-seat {
  min-height: 34px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  padding: .14rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wto-demo .wto-seat.wto-drop-hover { border-color: var(--brand); background: #eff6ff; }

.wto-demo .wto-chip {
  border: 1px solid #9ca3af;
  border-radius: 999px;
  padding: .23rem .56rem;
  font-size: .83rem;
  font-weight: 700;
  background: #e2e8f0;
  width: 100%;
  text-align: center;
  cursor: grab;
}

.wto-demo .wto-chip[data-guest="0"] { background: #fee2e2; }
.wto-demo .wto-chip[data-guest="1"] { background: #ffedd5; }
.wto-demo .wto-chip[data-guest="2"] { background: #fef9c3; }
.wto-demo .wto-chip[data-guest="3"] { background: #dcfce7; }
.wto-demo .wto-chip[data-guest="4"] { background: #dbeafe; }
.wto-demo .wto-chip[data-guest="5"] { background: #e0e7ff; }
.wto-demo .wto-chip[data-guest="6"] { background: #fae8ff; }
.wto-demo .wto-chip[data-guest="7"] { background: #fce7f3; }

.wto-demo .wto-chip.wto-over-threshold { border: 2px solid var(--warn); }
.wto-demo .wto-chip.wto-selected { box-shadow: 0 0 0 3px rgba(0,94,165,.3); }
.wto-demo .wto-chip.wto-swap-flash { animation: wtoFlash .45s ease; }

@keyframes wtoFlash {
  0% { transform: scale(1); background: #fde68a; }
  100% { transform: scale(1); }
}

.wto-demo .wto-links {
  margin-top: .5rem;
  border-top: 1px solid #fecaca;
  padding-top: .35rem;
}

.wto-demo .wto-link-item {
  color: #7f1d1d;
  font-size: .75rem;
  margin-bottom: .15rem;
}

.wto-demo .wto-badges { min-height: 1.8rem; margin-bottom: .4rem; }
.wto-demo .wto-badge {
  display: inline-block;
  margin-right: .35rem;
  margin-bottom: .25rem;
  border-radius: 999px;
  padding: .2rem .55rem;
  font-size: .78rem;
  border: 1px solid;
}
.wto-demo .wto-badge-ok { color: var(--ok); border-color: #86efac; background: #f0fdf4; }
.wto-demo .wto-badge-bad { color: #7f1d1d; border-color: #fca5a5; background: #fef2f2; }

.wto-demo #scoreCanvas,
.wto-demo #networkCanvas {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.wto-demo .wto-log {
  margin-top: .6rem;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: .7rem;
  min-height: 110px;
  max-height: 220px;
  overflow: auto;
  font-size: .8rem;
}

.wto-demo .wto-insight {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .35rem .8rem;
  margin: 0;
}

.wto-demo .wto-matrix { overflow: auto; margin-top: .6rem; }
.wto-demo table { border-collapse: collapse; min-width: 520px; width: 100%; }
.wto-demo th, .wto-demo td { border: 1px solid var(--line); text-align: center; padding: .3rem; font-size: .85rem; }
.wto-demo td.wto-over-limit { background: #fee2e2; color: #7f1d1d; font-weight: 700; }

.wto-demo .wto-footnote { color: var(--muted); font-size: .78rem; }

.wto-demo .wto-shell-footer {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .8rem 1rem;
  margin-top: 1rem;
}

@media (max-width: 920px) {
  .wto-demo .wto-cards-row,
  .wto-demo .wto-scorecards { grid-template-columns: 1fr; }
}
