:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-soft: #eef5f4;
  --line: #d9e2e4;
  --line-strong: #b8c7cb;
  --text: #1d2b31;
  --muted: #64747b;
  --faint: #8a989e;
  --teal: #0f8f83;
  --teal-dark: #0a6f68;
  --green: #2f9d68;
  --blue: #2f6fbd;
  --amber: #b97916;
  --red: #c4463d;
  --radius: 8px;
  --shadow: 0 16px 38px rgba(29, 43, 49, 0.08);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 16px;
  background: #10252a;
  color: #e8f3f3;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #0f8f83;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand span,
.sidebar-note strong,
.sidebar-note span {
  display: block;
}

.brand span,
.sidebar-note span {
  margin-top: 2px;
  color: #a9bec2;
  font-size: 12px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #c8d8db;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
  background: #e9f5f3;
  color: #0d3f3c;
  font-weight: 700;
}

.nav-icon {
  width: 20px;
  text-align: center;
  color: currentColor;
}

.sidebar-note {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 999px;
}

.dot-green {
  background: #50d195;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyeline {
  margin: 0 0 4px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 700;
}

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

h1 {
  font-size: 26px;
  letter-spacing: 0;
}

h2 {
  font-size: 16px;
  letter-spacing: 0;
}

h3 {
  font-size: 14px;
}

.topbar p:not(.eyeline),
.panel-heading p,
.empty-note,
.muted {
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 300px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--faint);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.icon-button,
.quiet-button,
.primary-button,
.ghost-button {
  min-height: 36px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

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

.quiet-button,
.ghost-button {
  padding: 0 12px;
}

.primary-button {
  padding: 0 14px;
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
  font-weight: 700;
}

.user-chip {
  padding: 8px 10px;
  border-radius: 7px;
  background: #20363c;
  color: #fff;
  font-weight: 700;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 342px;
  gap: 16px;
  align-items: start;
}

.primary-column,
.right-rail {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}

.kpi {
  min-height: 84px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.kpi small {
  color: var(--faint);
}

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

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 10px;
}

.panel-heading.compact {
  padding-bottom: 6px;
}

.workflow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 8px;
  padding: 0 16px 16px;
}

.flow-step {
  position: relative;
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  text-align: left;
}

.flow-step.active {
  border-color: var(--teal);
  background: var(--surface-soft);
}

.flow-step strong {
  display: block;
  margin: 6px 0 4px;
}

.flow-step small {
  color: var(--muted);
}

.step-index {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: #dfe9eb;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.flow-step.active .step-index {
  background: var(--teal);
  color: #fff;
}

.module-surface {
  min-height: 390px;
  padding: 16px;
}

.module-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2f3;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chip.green {
  background: #e4f5ed;
  color: var(--green);
}

.chip.blue {
  background: #e7effb;
  color: var(--blue);
}

.chip.amber {
  background: #fff3df;
  color: var(--amber);
}

.chip.red {
  background: #fdecea;
  color: var(--red);
}

.split-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 14px;
}

.subpanel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.subpanel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px 8px;
  border-bottom: 1px solid var(--line);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

tr.selectable {
  cursor: pointer;
}

tr.selectable:hover,
tr.selectable.active {
  background: #f2f8f7;
}

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

.metric-box {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.metric-box strong {
  display: block;
  margin-top: 6px;
  font-size: 21px;
}

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

.timeline-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 10px;
  align-items: start;
}

.timeline-row time {
  color: var(--muted);
  font-size: 12px;
}

.timeline-card {
  padding: 10px 12px;
  border-left: 3px solid var(--teal);
  background: #f7fbfb;
}

.detail-panel {
  padding-bottom: 14px;
}

.detail-body {
  display: grid;
  gap: 12px;
  padding: 0 16px;
}

.kv {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.kv span:first-child {
  color: var(--muted);
}

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

.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.phone-preview {
  padding: 0 16px 16px;
}

.phone-frame {
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: #f7fafb;
  overflow: hidden;
}

.phone-status {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.phone-screen {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.phone-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.phone-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 10px 12px 12px;
}

.phone-tabs button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.phone-tabs button.active {
  border-color: var(--teal);
  background: var(--surface-soft);
  color: var(--teal-dark);
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  transform: translateY(24px);
  opacity: 0;
  padding: 11px 14px;
  border-radius: 8px;
  background: #10252a;
  color: #fff;
  box-shadow: var(--shadow);
  transition: 180ms ease;
}

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

.empty-note {
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  text-align: center;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .brand div:not(.brand-mark),
  .nav-item span:not(.nav-icon),
  .sidebar-note div {
    display: none;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .right-rail {
    grid-template-columns: minmax(0, 1fr) 342px;
  }

  .kpi-strip {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    flex-direction: row;
    overflow-x: auto;
    padding: 10px;
  }

  .brand,
  .sidebar-note {
    display: none;
  }

  .nav-list {
    display: flex;
  }

  .nav-item {
    white-space: nowrap;
  }

  .workspace {
    padding: 14px;
  }

  .topbar,
  .topbar-actions,
  .module-header {
    align-items: stretch;
    flex-direction: column;
  }

  .search {
    min-width: 0;
    width: 100%;
  }

  .kpi-strip,
  .workflow,
  .split-grid,
  .metric-grid,
  .right-rail {
    grid-template-columns: 1fr;
  }
}
