:root {
  --bg: #f6f6ef;
  --surface: #ffffff;
  --surface-alt: #fafaf5;
  --line: #d9d9d1;
  --line-strong: #bdbdb2;
  --text: #222222;
  --muted: #6a6a6a;
  --accent: #ff6600;
  --success: #2f6f3e;
  --error: #b00020;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

body.drawer-open {
  overflow: hidden;
}

button, input, textarea, select {
  font: inherit;
}

a { color: var(--accent); }

/* ── Layout ── */

.workspace {
  max-width: 1480px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
}

.sidebar,
.page-header,
.metric-card,
.panel,
.module {
  background: var(--surface);
  border: 1px solid var(--line);
}

.sidebar {
  position: sticky;
  top: 16px;
  align-self: start;
  padding: 16px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
}

.sidebar h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.field-label,
.metric-label,
.message,
.chart-empty,
.panel-title,
.json-details summary {
  color: var(--muted);
}

.dev-only-hidden {
  display: none !important;
}

.nav {
  display: grid;
  gap: 2px;
  margin: 16px 0;
}

.nav a {
  text-decoration: none;
  color: var(--text);
  padding: 6px 0;
}

.nav a:hover {
  color: var(--accent);
}

.nav a.active {
  color: var(--accent);
  font-weight: 700;
}

.sidebar-tools,
.content,
.module-body,
.form-panel,
.stack-panel {
  display: grid;
  gap: 12px;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.auth-shell-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.auth-user-badge {
  font-weight: 700;
  color: var(--text);
}

.auth-logout-btn {
  white-space: nowrap;
}

.check-repair {
  margin-top: 4px;
  color: var(--text);
  font-size: 13px;
}

/* ── Page Header ── */

.page-header {
  padding: 14px 16px;
  border-left: 3px solid var(--accent);
}

.page-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
}

/* ── Metrics ── */

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

.compact-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card {
  padding: 12px 16px;
}

.metric-value {
  margin-top: 2px;
  font-size: 26px;
  font-weight: 700;
}

/* ── Module ── */

.module {
  padding: 16px;
}

.module-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.module-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.two-column {
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
}

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

.execution-layout,
.replay-layout {
  grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.22fr);
}

.execution-workflow {
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
}

body[data-page="stress"] .content {
  background:
    radial-gradient(circle at top right, rgba(255, 102, 0, 0.11), transparent 30%),
    radial-gradient(circle at 20% 10%, rgba(34, 34, 34, 0.08), transparent 26%),
    linear-gradient(180deg, rgba(255, 252, 248, 0.92), rgba(255, 255, 255, 0.98));
}

.stress-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 102, 0, 0.16);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 246, 238, 0.9)),
    linear-gradient(180deg, #ffffff, #fff7ef);
  box-shadow: 0 24px 80px rgba(255, 102, 0, 0.08);
}

.stress-hero::before,
.stress-hero::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0.85;
}

.stress-hero::before {
  width: 220px;
  height: 220px;
  right: -88px;
  top: -70px;
  background: radial-gradient(circle, rgba(255, 102, 0, 0.18), rgba(255, 102, 0, 0));
}

.stress-hero::after {
  width: 160px;
  height: 160px;
  right: 92px;
  bottom: -72px;
  background: radial-gradient(circle, rgba(34, 34, 34, 0.1), rgba(34, 34, 34, 0));
}

.stress-hero-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  position: relative;
  z-index: 1;
}

.stress-hero-copy {
  max-width: 820px;
}

.stress-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 102, 0, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.stress-hero-title {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

.stress-hero-text {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  max-width: 74ch;
}

.stress-hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.stress-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stress-panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(320px, 0.82fr);
  gap: 16px;
  align-items: start;
}

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

.stress-control-grid .form-field {
  min-width: 0;
}

.stress-control-grid .wizard-actions {
  margin-top: 0;
  align-self: end;
  grid-column: 1 / -1;
}

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

.service-control-grid .card-copy {
  word-break: break-all;
}

.stress-alert {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 102, 0, 0.18);
  background: rgba(255, 246, 238, 0.92);
  color: #91572c;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.6;
}

.stress-chart {
  width: 100%;
  height: 330px;
}

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

.stress-analysis-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
}

.stress-analysis-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.stress-analysis-value {
  margin-top: 4px;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stress-sample-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 620px;
  overflow: auto;
}

.stress-sample-item {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.stress-sample-item:hover {
  border-color: rgba(255, 102, 0, 0.35);
  transform: translateY(-1px);
  background: #fffaf5;
}

.stress-sample-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.stress-sample-title {
  font-weight: 700;
  font-size: 13px;
}

.stress-sample-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.stress-sample-duration {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
}

.stress-session-list {
  display: grid;
  gap: 8px;
}

.stress-session-card {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.stress-session-card.active {
  border-color: rgba(255, 102, 0, 0.45);
  box-shadow: 0 10px 24px rgba(255, 102, 0, 0.08);
}

.stress-session-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.stress-session-title {
  font-size: 13px;
  font-weight: 700;
}

.stress-session-copy {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.stress-session-pill {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 102, 0, 0.08);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

/* ── Wizard ── */

.wizard-nav {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.2s ease;
  user-select: none;
}

.wizard-step.active {
  opacity: 1;
}

.wizard-step.completed {
  opacity: 0.75;
}

.wizard-step.completed .wizard-dot {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
}

.wizard-dot {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line-strong);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.wizard-step.active .wizard-dot {
  border-color: var(--accent);
  color: var(--accent);
}

.wizard-label {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.wizard-connector {
  flex: 1;
  height: 1px;
  background: var(--line);
  margin: 0 12px;
}

.wizard-connector.completed {
  background: var(--success);
}

.wizard-panel {
  display: none;
}

.wizard-panel.active {
  display: block;
}

.wizard-form {
  display: grid;
  gap: 12px;
  max-width: 480px;
}

.form-row {
  display: grid;
}

.form-field {
  display: grid;
  gap: 4px;
}

.wizard-preview {
  padding: 14px;
  margin-top: 16px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  min-height: 60px;
}

.wizard-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

.wizard-actions-inline {
  display: flex;
  gap: 8px;
}

.wizard-mini-summary {
  font-size: 13px;
  color: var(--muted);
  max-width: 320px;
  text-align: right;
}

/* ── Result Sections ── */

.result-section {
  margin-top: 16px;
}

.result-section-title {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}

/* ── Cards ── */

.card-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-grid.single {
  grid-template-columns: 1fr;
}

.asset-card,
.run-card {
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  cursor: default;
}

.interactive {
  cursor: pointer;
}

.interactive:hover,
.interactive.active {
  border-color: var(--line-strong);
  background: #fff7ef;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
}

.card-copy {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.badge {
  flex-shrink: 0;
  padding: 2px 6px;
  background: #eeeeea;
  color: var(--muted);
  font-size: 12px;
}

/* ── Lists ── */

.panel {
  padding: 12px;
}

.list-shell {
  border: 1px solid var(--line);
  background: var(--surface-alt);
}

.list-header,
.list-row {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) repeat(var(--cols, 1), minmax(0, 1fr));
  gap: 16px;
  align-items: center;
}

.list-header {
  padding: 10px 14px;
  background: #f1f1ea;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.list-row {
  width: 100%;
  padding: 14px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.18s ease;
}

.list-row:hover,
.list-row.active {
  background: #fff7ef;
}

.list-main {
  min-width: 0;
}

.list-title {
  font-size: 14px;
  font-weight: 700;
}

.list-meta,
.list-cell {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.list-meta {
  margin-top: 4px;
}

.list-cell {
  min-width: 0;
}

.list-empty {
  padding: 18px 14px;
  color: var(--muted);
}

/* ── Modal ── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23, 22, 19, 0.24);
  z-index: 30;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 48px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #fffdf8;
  border: 1px solid var(--line);
  box-shadow: 0 20px 48px rgba(34, 34, 34, 0.18);
  z-index: 31;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.modal-body {
  overflow: auto;
  padding: 18px 20px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Drawer ── */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23, 22, 19, 0.24);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 20;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(560px, 100vw);
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #fffdf8;
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 48px rgba(34, 34, 34, 0.12);
  transform: translateX(100%);
  transition: transform 0.22s ease;
  z-index: 21;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.drawer-headline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.drawer-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
}

.drawer-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.drawer-body {
  overflow: auto;
  padding: 18px 20px 24px;
}

.drawer-stack {
  display: grid;
  gap: 16px;
}

.drawer-section {
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 14px;
}

.drawer-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  background: #ffffff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

/* ── Steps ── */

.step-panel {
  background: var(--surface);
}

.step-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.step-index {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.step-copy,
.minor-note,
.check-detail {
  color: var(--muted);
  font-size: 13px;
}

/* ── Status & Checks ── */

.status-banner {
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  font-size: 13px;
}

.status-banner.success {
  border-color: rgba(47, 111, 62, 0.3);
  color: var(--success);
}

.status-banner.error {
  border-color: rgba(176, 0, 32, 0.25);
  color: var(--error);
}

.checklist {
  display: grid;
  gap: 8px;
}

.check-item {
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: #fcfcfc;
}

.check-item.success { border-left: 3px solid var(--success); }
.check-item.error { border-left: 3px solid var(--error); }
.check-item.warning { border-left: 3px solid var(--accent); }
.check-item.neutral { border-left: 3px solid var(--line-strong); }

.check-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 2px;
}

/* ── Form Controls ── */

.input,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  padding: 8px 10px;
  background: #ffffff;
  color: var(--text);
}

.textarea {
  min-height: 92px;
  resize: vertical;
}

.split,
.button-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.filter-panel {
  display: grid;
  gap: 12px;
}

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

.button,
.link-button {
  border: 1px solid var(--line-strong);
  padding: 8px 12px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
}

.action-link {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
  color: var(--text);
}

.button:hover,
.link-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.button.secondary {
  background: var(--surface-alt);
}

.button:disabled {
  cursor: not-allowed;
  color: #9a9a9a;
  border-color: var(--line);
  background: #f3f3ef;
}

.button-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.button-primary:hover {
  background: #e85c00;
  color: #ffffff;
}

.button-primary:disabled {
  background: #f3f3ef;
  color: #9a9a9a;
  border-color: var(--line);
}

.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
}

/* ── Messages ── */

.message {
  min-height: 20px;
  font-size: 13px;
}

.message.success { color: var(--success); }
.message.error { color: var(--error); }

/* ── Login Page ── */

body.login-page {
  --bg: #141414;
  --surface: rgba(24, 24, 24, 0.88);
  --surface-alt: rgba(33, 33, 33, 0.88);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --text: #f4f1ea;
  --muted: #b8b0a4;
  --accent: #ff8a3d;
  --success: #72d082;
  --error: #ff6b72;
  background:
    radial-gradient(circle at top left, rgba(255, 138, 61, 0.22), transparent 28%),
    radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.08), transparent 32%),
    linear-gradient(180deg, #0f0f10 0%, #171717 100%);
  color: var(--text);
}

body.login-page .workspace {
  max-width: 760px;
  min-height: 100vh;
  align-items: center;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding: 24px;
}

body.login-page .module {
  backdrop-filter: blur(14px);
  background: var(--surface);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.28);
}

body.login-page .content {
  display: grid;
  align-items: center;
}

.login-shell {
  display: grid;
  gap: 16px;
}

.login-header {
  justify-content: center;
  padding: 0 4px;
}

body.login-page .brand-mark {
  background: linear-gradient(135deg, #ff8a3d, #ffb36a);
  color: #171717;
}

.login-title {
  margin: 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.05;
}

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

.login-status {
  min-height: 22px;
}

.login-panel {
  display: grid;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.login-panel .field-label {
  color: #d8d0c3;
}

.login-panel .input {
  background: rgba(10, 10, 10, 0.55);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.login-panel .button {
  min-width: 160px;
}

.detail-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.detail-line:last-child {
  border-bottom: 0;
}

.panel-title {
  font-size: 13px;
}

/* ── JSON & Charts ── */

.json-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.chart {
  width: 100%;
  min-height: 320px;
}

.manual-point-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 16px;
  align-items: stretch;
}

.manual-point-chart-wrap {
  min-width: 0;
}

.manual-point-svg {
  display: block;
  width: 100%;
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.manual-point-hitbox {
  cursor: crosshair;
}

.manual-point-svg {
  user-select: none;
  touch-action: none;
}

.manual-point-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.manual-point-count {
  font-weight: 700;
}

.manual-point-list {
  display: grid;
  gap: 8px;
}

.manual-point-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-alt);
}

.manual-point-title {
  font-weight: 700;
  margin-bottom: 6px;
}

@media (max-width: 900px) {
  .manual-point-layout {
    grid-template-columns: 1fr;
  }
}

.chart-empty {
  min-height: 24px;
  font-size: 13px;
}

.json-details summary {
  cursor: pointer;
  font-size: 13px;
}

.json-details[open] summary {
  margin-bottom: 8px;
}

.json-block {
  margin: 0;
  min-height: 220px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fcfcfc;
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.6;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.compact-json {
  min-height: 140px;
}

/* ── Log Viewer ── */

.log-viewer {
  max-height: 360px;
  min-height: 120px;
  overflow-y: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #1a1a18;
  color: #d4d4c8;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.7;
}

.log-entry { padding: 1px 0; }

.log-entry .log-time { color: #6a6a60; margin-right: 8px; }
.log-entry .log-status { font-weight: 700; margin-right: 6px; }
.log-entry .log-status.info { color: #7eb8da; }
.log-entry .log-status.success { color: #7ec87e; }
.log-entry .log-status.error { color: #e07070; }
.log-entry .log-status.warn { color: #d4a843; }
.log-entry .log-detail { color: #a0a098; }

.log-viewer::-webkit-scrollbar { width: 6px; }
.log-viewer::-webkit-scrollbar-track { background: transparent; }
.log-viewer::-webkit-scrollbar-thumb { background: #3a3a36; border-radius: 3px; }

.log-viewer-shell {
  padding-top: 8px;
}

.api-call-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
}

.api-call-note {
  font-size: 12px;
  color: var(--muted);
}

.api-call-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding: 2px 2px 4px;
}

.api-call-list::-webkit-scrollbar { width: 6px; }
.api-call-list::-webkit-scrollbar-track { background: transparent; }
.api-call-list::-webkit-scrollbar-thumb { background: #d0d0c7; border-radius: 3px; }

.api-call-row {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  padding: 10px 12px;
}

.api-call-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.api-call-method {
  padding: 2px 8px;
  border-radius: 999px;
  background: #1f1f1d;
  color: #f8f8f2;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.api-call-path {
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

.api-call-status {
  font-size: 12px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
}

.api-call-status.success { color: #2f8f2f; background: #ecf8ec; }
.api-call-status.error { color: #b94c4c; background: #fdecec; }
.api-call-status.info { color: #1e6fa8; background: #e8f4fc; }

.api-call-meta {
  margin-top: 4px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.api-call-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.api-call-detail {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

/* ── Loading ── */

.loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 14px;
  color: var(--muted);
  font-size: 13px;
}

.loading::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-alt) 25%, #eee 50%, var(--surface-alt) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 3px;
  min-height: 18px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Empty State ── */

.empty-state {
  padding: 28px 16px;
  text-align: center;
}

.empty-state-text {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 12px;
}

.empty-state .button {
  display: inline-block;
}

/* ── Metric Accent ── */

.metric-card.accent-success { border-left: 3px solid var(--success); }
.metric-card.accent-error { border-left: 3px solid var(--error); }
.metric-card.accent-muted { border-left: 3px solid var(--line-strong); opacity: 0.6; }
.metric-card.accent-accent { border-left: 3px solid var(--accent); }

/* ── Collapsible Filter ── */

.filter-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 13px;
}

.filter-toggle::after {
  content: "▾";
  transition: transform 0.2s ease;
}

.filter-toggle.collapsed::after {
  transform: rotate(-90deg);
}

.filter-body {
  display: grid;
  gap: 12px;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease;
  max-height: 300px;
  opacity: 1;
}

.filter-body.collapsed {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

/* ── Pagination ── */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
}

.pagination .page-btn {
  min-width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.pagination .page-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination .page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.pagination .page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination .page-info {
  font-size: 13px;
  color: var(--muted);
  padding: 0 8px;
}

/* ── Trend Mini Chart ── */

.trend-chart {
  width: 100%;
  height: 160px;
}

/* ── Drawer Actions ── */

.drawer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 8px;
}

.result-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.result-summary-card {
  border: 1px solid var(--line);
  background: var(--surface-alt);
  padding: 10px;
}

.result-summary-card.success {
  border-left: 3px solid var(--success);
}

.result-summary-card.warning {
  border-left: 3px solid var(--warning);
}

.result-summary-card.error {
  border-left: 3px solid var(--error);
}

.result-summary-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.result-summary-value {
  margin-top: 4px;
  font-size: 20px;
  font-weight: 800;
}

.explanation-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.explanation-item {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 9px 10px;
  font-size: 13px;
}

.explanation-item.warning {
  border-left: 3px solid var(--warning);
}

.explanation-item.error {
  border-left: 3px solid var(--error);
}

.explanation-item.success {
  border-left: 3px solid var(--success);
}

.annotation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.textarea {
  min-height: 76px;
  resize: vertical;
}

/* ── Simulation ── */

.simulation-controls {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
}

.sim-control-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.sim-progress-bar {
  width: 100%;
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}

.sim-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.sim-progress-text {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.sim-speed-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.sim-speed-btn {
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.sim-speed-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.sim-speed-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.sim-speed-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Simulation Step Inspector ── */

.sim-step-table {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sim-step-row {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  overflow: hidden;
}

.sim-step-row.has-error {
  border-color: var(--error);
}

.sim-step-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sim-step-summary:hover {
  background: #fff8f0;
}

.sim-step-main {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sim-step-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.sim-step-num {
  font-weight: 600;
  font-size: 13px;
  min-width: 40px;
}

.sim-step-ms {
  color: var(--muted);
  font-size: 12px;
}

.sim-step-pred {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.sim-step-expand {
  font-size: 12px;
  color: var(--accent);
}

.sim-step-return-btn {
  padding: 0;
  font-size: 12px;
}

.sim-step-detail {
  border-top: 1px solid var(--line);
  background: var(--surface-alt);
  padding: 12px;
}

.sim-step-detail-pre {
  max-height: 500px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-all;
}

.sim-step-detail-section {
  margin-bottom: 12px;
}

.sim-step-detail-section:last-child {
  margin-bottom: 0;
}

.sim-step-detail-label {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--muted);
}

.sim-chart-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

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

.latency-stat-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
}

.latency-stat-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.latency-stat-value {
  margin-top: 4px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

/* ── Replay Config ── */

.replay-config-details {
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
}

.replay-config-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 10px;
}

.replay-config-grid .form-field {
  min-width: 0;
}

/* ── Resource Monitor ── */

.resource-monitor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.rm-card {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}

.rm-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.rm-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.rm-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ── Responsive ── */

@media (max-width: 1180px) {
  .workspace,
  .metrics,
  .dashboard-grid,
  .two-column,
  .execution-layout,
  .execution-workflow,
  .stress-panel-grid,
  .replay-layout,
  .card-grid {
    grid-template-columns: 1fr;
  }

  .log-viewer { max-height: 240px; }
  .sidebar { position: static; }

  .list-header,
  .list-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .drawer { width: 100vw; }

  .wizard-nav {
    flex-wrap: wrap;
    gap: 4px;
  }

  .wizard-connector { display: none; }
  .wizard-label { font-size: 12px; }

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

  .stress-control-grid,
  .service-control-grid,
  .stress-analysis-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .workspace { padding: 8px; }

  .split,
  .button-row,
  .filter-grid {
    grid-template-columns: 1fr;
  }

  .replay-config-grid {
    grid-template-columns: 1fr;
  }

  .latency-stats-grid {
    grid-template-columns: 1fr;
  }

  .stress-hero-inner {
    flex-direction: column;
  }

  .stress-hero-title {
    font-size: 24px;
  }
}
