:root {
  color-scheme: light;
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --line: #d9e0e8;
  --text: #17202a;
  --muted: #667487;
  --accent: #176b87;
  --accent-2: #2b8a7e;
  --warn: #b46a11;
  --danger: #b93b3b;
  --blue: #2d69b3;
  --shadow: 0 16px 36px rgba(28, 39, 54, 0.08);
  font-family: "Inter", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
}

button {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  background: #18232e;
  color: #eef5f6;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: #d7f0ea;
  color: #17323a;
  border-radius: 8px;
  font-weight: 800;
}

.brand span,
.sidebar-status span,
.eyebrow,
small,
.meta-list dt {
  color: var(--muted);
  font-size: 12px;
}

.sidebar .brand span,
.sidebar-status span {
  color: #a8b9c6;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  height: 42px;
  border: 0;
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  text-align: left;
  color: #cbd8e2;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  color: #ffffff;
  background: #263644;
}

.icon {
  text-align: center;
  font-weight: 700;
}

.sidebar-status {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  display: grid;
  gap: 8px;
}

meter {
  width: 100%;
  height: 8px;
}

.workspace {
  padding: 22px;
  min-width: 0;
}

.topbar,
.panel-header,
.topbar-actions {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 0;
  font-size: 17px;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.topbar-actions {
  gap: 8px;
}

.icon-button,
.primary-action,
.control-grid button,
.asset-tile {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
}

.icon-button {
  width: 38px;
  height: 38px;
  font-size: 18px;
}

.primary-action {
  min-height: 38px;
  padding: 0 16px;
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.status-strip article,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.status-strip article {
  padding: 14px;
  display: grid;
  gap: 4px;
}

.status-strip strong {
  font-size: 25px;
}

.warn {
  color: var(--warn);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.grid {
  display: grid;
  gap: 14px;
}

.overview-grid {
  grid-template-columns: 1.55fr 1fr;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wide {
  grid-row: span 2;
}

.panel {
  padding: 16px;
  min-width: 0;
}

.panel-header {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.tag {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.tag.green {
  background: #e3f4ed;
  color: #16634d;
}

.tag.amber {
  background: #fff0d7;
  color: #80500c;
}

.tag.blue {
  background: #e4eefb;
  color: #245c9d;
}

.tag.red {
  background: #ffe3e0;
  color: #99322f;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 76px 1fr 92px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.timeline-item strong {
  display: block;
  margin-bottom: 3px;
}

.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.checklist li,
.risk-row,
.pipeline-step,
.product-item,
.signal-list div,
.cost-stack div,
.meta-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.check-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-2);
  flex: 0 0 auto;
}

.check-dot.warn {
  background: var(--warn);
}

.cost-stack,
.signal-list,
.meta-list {
  display: grid;
  gap: 12px;
}

.workbench {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 14px;
}

.product-list,
.segment-tabs,
.pipeline,
.risk-table {
  display: grid;
  gap: 10px;
}

.product-item {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
}

.product-item.active {
  border-color: var(--accent);
  background: #e8f4f5;
}

.segment-tabs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
}

.segment-tab {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
}

.segment-tab.active {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.script-card {
  min-height: 280px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.script-card p {
  line-height: 1.7;
  margin-bottom: 14px;
}

.script-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.script-meta span {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 12px;
}

.pipeline-step {
  position: relative;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.progress {
  width: 170px;
  height: 8px;
  border-radius: 999px;
  background: #dde5ed;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--accent-2);
}

.avatar-card {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.avatar-preview {
  width: 132px;
  height: 168px;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(180deg, #e4eef4, #cfdbe5);
  border: 1px solid var(--line);
}

.face {
  width: 58px;
  height: 70px;
  border-radius: 50% 50% 46% 46%;
  background: #f2c9ac;
  position: absolute;
  left: 37px;
  top: 30px;
}

.shoulders {
  width: 120px;
  height: 76px;
  border-radius: 50% 50% 0 0;
  background: #24546b;
  position: absolute;
  left: 6px;
  bottom: -18px;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.asset-tile {
  aspect-ratio: 1.35;
  background: var(--surface-2);
}

.asset-tile.active {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.monitor-frame {
  height: 310px;
  border-radius: 8px;
  border: 1px solid #243744;
  background:
    linear-gradient(135deg, rgba(43, 138, 126, 0.2), transparent 40%),
    #15222c;
  color: #eef5f6;
  display: grid;
  place-items: center;
  text-align: center;
  align-content: center;
  gap: 10px;
}

.signal-bars {
  height: 38px;
  display: flex;
  align-items: end;
  gap: 5px;
}

.signal-bars span {
  width: 8px;
  background: #65c4a6;
  border-radius: 3px 3px 0 0;
}

.signal-bars span:nth-child(1) {
  height: 16px;
}

.signal-bars span:nth-child(2) {
  height: 26px;
}

.signal-bars span:nth-child(3) {
  height: 36px;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.control-grid button {
  min-height: 40px;
}

.risk-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.risk-row button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  min-width: 240px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #17202a;
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 74px 1fr;
  }

  .brand div:last-child,
  .nav-item span:last-child,
  .sidebar-status {
    display: none;
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .overview-grid,
  .two-col,
  .workbench,
  .status-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .workspace {
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .timeline-item,
  .avatar-card,
  .pipeline-step,
  .risk-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .control-grid,
  .asset-grid,
  .segment-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

