:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #0f172a;
  --text: #1e293b;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e2e8f0;
  --line-soft: #eef2f7;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff4ff;
  --primary-ink: #1e40af;
  --success: #16a34a;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --info: #0891b2;
  --info-soft: #ecfeff;
  --accent: #0f766e;
  --accent-soft: #ecfdf5;
  --violet: #7c3aed;
  --violet-soft: #f5f3ff;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.04);
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

select {
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  min-height: 38px;
  padding: 0 36px 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

select:hover {
  border-color: var(--muted-2);
}

select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

select:disabled {
  background-color: var(--surface-soft);
  color: var(--muted);
  cursor: not-allowed;
}

button {
  cursor: pointer;
}

.login-page {
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) 440px;
  gap: 28px;
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.9), rgba(243,246,251,0.96));
}

.login-visual,
.login-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.login-visual {
  position: relative;
  overflow: hidden;
  padding: 30px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  min-height: 680px;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.97), rgba(20, 83, 45, 0.92)),
    #0f172a;
  color: white;
}

.login-visual::after {
  content: "";
  position: absolute;
  inset: auto 28px 170px 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.42), transparent);
}

.login-brand,
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.login-brand span,
.brand span {
  color: var(--muted);
  font-size: 12px;
}

.login-brand span {
  color: rgba(226, 232, 240, 0.74);
}

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

.brand-mark.premium {
  background: #f8fafc;
  color: #111827;
}

.login-hero {
  align-self: center;
  max-width: 680px;
}

.login-hero h1 {
  margin: 0 0 18px;
  font-size: 52px;
  line-height: 1.12;
  letter-spacing: 0;
  text-wrap: balance;
}

.login-hero p {
  max-width: 620px;
  color: rgba(226, 232, 240, 0.78);
  font-size: 17px;
  line-height: 1.75;
}

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

.login-metric {
  min-height: 118px;
  border: 1px solid rgba(226, 232, 240, 0.22);
  border-radius: 10px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.07);
}

.login-metric span,
.login-metric small {
  display: block;
  color: rgba(226, 232, 240, 0.68);
}

.login-metric strong {
  display: block;
  margin: 12px 0 8px;
  font-size: 30px;
  font-variant-numeric: tabular-nums;
}

.login-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.login-proof span {
  border: 1px solid rgba(226, 232, 240, 0.22);
  border-radius: 999px;
  padding: 8px 12px;
  color: rgba(255,255,255,0.8);
  font-size: 13px;
}

.login-card {
  align-self: center;
  padding: 28px;
}

.login-card h2 {
  margin-bottom: 8px;
  font-size: 28px;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.login-hint {
  margin-top: 18px;
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

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

.sidebar {
  border-right: 1px solid var(--line);
  background: #fbfcfe;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  padding: 0 8px;
}

.brand strong,
.login-brand strong {
  display: block;
  font-size: 15px;
}

.nav {
  display: grid;
  gap: 18px;
}

.nav-group-title {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 800;
  padding: 0 10px 6px;
}

.nav-button {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background-color 150ms ease, color 150ms ease;
}

.nav-button:hover {
  background: var(--surface);
}

.nav-button.active {
  background: var(--primary-soft);
  color: var(--primary-ink);
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12px;
}

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

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

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

.user-chip {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  padding: 6px 10px;
}

.user-chip strong,
.user-chip span {
  display: block;
  font-size: 12px;
}

.user-chip span {
  color: var(--muted);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--primary);
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
  overflow: hidden;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.login-hero .eyebrow {
  color: rgba(226, 232, 240, 0.72);
}

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

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

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

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

.field {
  display: grid;
  gap: 6px;
}

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

.field input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  background: var(--surface);
  font-size: 14px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field select {
  min-height: 40px;
  padding: 0 36px 0 14px;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.icon-button,
.primary-button,
.secondary-button,
.danger-button {
  min-height: 38px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 0 16px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  transition: background-color 150ms ease, border-color 150ms ease, transform 120ms ease, box-shadow 150ms ease;
}

.icon-button:active,
.primary-button:active,
.secondary-button:active,
.danger-button:active {
  transform: scale(0.98);
}

.primary-button {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.primary-button:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

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

.secondary-button:hover {
  background: var(--surface-soft);
  border-color: var(--line);
}

.wide {
  width: 100%;
}

.alert {
  border: 1px solid #f4d7a1;
  background: #fff8eb;
  color: #7a3d05;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13px;
}

.alert.compact {
  margin: 14px 0 0;
}

.hidden {
  display: none;
}

.content {
  display: grid;
  gap: 16px;
}

.page-brief {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.page-brief h2 {
  margin-bottom: 8px;
  font-size: 24px;
}

.page-brief p {
  max-width: 820px;
  color: var(--muted);
  line-height: 1.65;
}

.command-hero {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  border: 1px solid #c8d7f4;
  border-radius: 12px;
  padding: 20px;
  background: linear-gradient(135deg, #ffffff, #f5f8ff);
  box-shadow: var(--shadow);
}

.command-hero h2 {
  margin-bottom: 8px;
  font-size: 24px;
}

.command-hero p {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.65;
}

.ops-hero {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  border: 1px solid #bfd5d2;
  border-radius: 12px;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(241, 252, 248, 0.96)),
    var(--surface);
  box-shadow: var(--shadow);
}

.ops-hero-main {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.ops-hero h2 {
  margin: 0;
  color: var(--ink);
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
  text-wrap: balance;
}

.ops-hero p {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  text-wrap: pretty;
}

.ops-status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.ops-status-line > span:not(.badge) {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 0 9px;
  background: rgba(255,255,255,0.72);
}

.ops-hero-actions {
  display: grid;
  gap: 10px;
  min-width: 190px;
}

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

.control-stat {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.control-stat span,
.control-stat small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.control-stat > span {
  font-weight: 800;
}

.control-stat strong {
  display: block;
  min-height: 34px;
  margin: 10px 0 7px;
  color: var(--ink);
  font-size: 25px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.control-stat.success {
  border-color: #bfe8ce;
  background: linear-gradient(180deg, #ffffff, var(--success-soft));
}

.control-stat.warning {
  border-color: #f2d49b;
  background: linear-gradient(180deg, #ffffff, var(--warning-soft));
}

.control-stat.danger {
  border-color: #f4c4c4;
  background: linear-gradient(180deg, #ffffff, var(--danger-soft));
}

.control-stat.info {
  border-color: #b6e6ee;
  background: linear-gradient(180deg, #ffffff, var(--info-soft));
}

.command-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  grid-template-areas:
    "flow queue"
    "insight insight";
  gap: 18px;
  align-items: stretch;
}

.command-panel {
  grid-area: flow;
  overflow: hidden;
}

.command-layout .insight-grid {
  grid-area: insight;
}

.command-layout .action-queue {
  grid-area: queue;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.command-layout .action-queue .queue-slider {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.command-layout .action-queue .queue-slider-nav {
  margin-top: auto;
}

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

.flow-step {
  position: relative;
  min-width: 0;
  min-height: 148px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface-soft);
}

.flow-step::after {
  content: "";
  position: absolute;
  top: 30px;
  right: -11px;
  width: 11px;
  height: 1px;
  background: var(--line);
}

.flow-step:last-child::after {
  display: none;
}

.flow-step > span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.flow-step small,
.flow-step p {
  display: block;
  color: var(--muted);
}

.flow-step small {
  margin-top: 12px;
  font-size: 11px;
  font-weight: 800;
}

.flow-step strong {
  display: block;
  margin: 7px 0 6px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.flow-step p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  text-wrap: pretty;
}

.action-queue {
  display: grid;
  gap: 12px;
}

.compact-toolbar {
  margin-bottom: 0;
}

.queue-list {
  display: grid;
  gap: 12px;
}

.queue-slider {
  display: grid;
  gap: 12px;
}

.queue-slider-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 2px;
}

.queue-arrow {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.queue-arrow:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.queue-arrow:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.queue-dots {
  display: flex;
  gap: 6px;
}

.queue-dot {
  width: 8px;
  height: 8px;
  border: none;
  border-radius: 50%;
  background: var(--line);
  cursor: pointer;
  padding: 0;
}

.queue-dot.active {
  background: var(--primary);
}

.queue-counter {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.queue-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface-soft);
}

.queue-item-head,
.queue-actions,
.queue-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.queue-item h3 {
  margin: 12px 0 8px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.queue-item p {
  margin-bottom: 10px;
  color: var(--muted);
  line-height: 1.5;
}

.queue-meta {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
}

.queue-actions .primary-button,
.queue-actions .secondary-button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.insight-grid {
  align-items: stretch;
}

.insight-card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.insight-kicker {
  width: max-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 800;
}

.insight-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.35;
  text-wrap: balance;
}

.insight-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  text-wrap: pretty;
}

.insight-card .secondary-button {
  width: max-content;
  margin-top: 2px;
}

.reliability-panel {
  overflow: hidden;
}

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

.ribbon-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.ribbon-item strong,
.ribbon-item span {
  display: block;
}

.ribbon-item strong {
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 13px;
}

.ribbon-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-wrap: pretty;
}

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

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

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

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.split.wide-split {
  grid-template-columns: minmax(0, 1fr) 340px;
}

.panel,
.metric,
.inspector {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.panel,
.inspector {
  padding: 20px;
}

.policy-card,
.sim-card,
.route-chain {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-xs);
}

.policy-card strong {
  display: block;
  margin: 12px 0 8px;
  font-size: 18px;
}

.metric {
  padding: 18px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 26px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  background: var(--surface-soft);
  color: var(--muted);
}

.badge.success {
  color: var(--success);
  background: #eaf7ee;
}

.badge.warning {
  color: var(--warning);
  background: #fff3df;
}

.badge.danger {
  color: var(--danger);
  background: #feecec;
}

.badge.info {
  color: var(--info);
  background: #e8f7fb;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot.success {
  background: var(--success);
}

.dot.warning {
  background: var(--warning);
}

.dot.danger {
  background: var(--danger);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

.table-wrap {
  width: 100%;
  overflow-x: visible;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.table-wrap::-webkit-scrollbar {
  height: 6px;
}

.table-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}

.table-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--muted-2);
}

th {
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--line);
  padding: 12px 12px;
  background: var(--surface-soft);
  white-space: nowrap;
}

td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  white-space: normal;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

th:last-child,
td:last-child {
  width: 150px;
}

td .mono {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

tbody tr {
  transition: background-color 120ms ease;
}

tbody tr:hover {
  background: var(--surface-soft);
}

.mono,
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
}

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

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

.timeline-item {
  border-left: 2px solid var(--line);
  padding-left: 12px;
}

.empty-state,
.permission-state {
  border: 1px dashed var(--line);
  border-radius: 9px;
  padding: 18px;
  background: #fbfcfe;
}

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

.form-grid.one-col {
  grid-template-columns: 1fr;
}

.full-span {
  grid-column: 1 / -1;
}

.key-wizard {
  position: sticky;
  top: 18px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

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

.resource-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  width: min(520px, calc(100vw - 32px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px rgba(15, 23, 42, 0.18);
  transform: translateX(105%);
  transition: transform 200ms ease;
  will-change: transform;
}

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

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.drawer-head h2 {
  margin: 2px 0 0;
  font-size: 20px;
}

.drawer-body {
  min-width: 0;
  overflow-y: auto;
  padding: 18px 22px 24px;
}

body.drawer-open {
  overflow: hidden;
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  counter-reset: wizard;
}

.wizard-steps li {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.check-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 4px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: var(--surface);
}

.check-card input {
  width: 18px;
  height: 18px;
}

.check-card small {
  grid-column: 2;
  color: var(--muted);
}

.review-box {
  border: 1px solid #c7ead2;
  background: #effaf3;
  border-radius: 8px;
  padding: 12px;
}

.review-box p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.action-list {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.row-actions,
.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.row-actions .secondary-button,
.row-actions .danger-button,
.card-actions .secondary-button,
.card-actions .danger-button {
  min-height: 34px;
  padding: 8px 12px;
  font-size: 12px;
}

.key-card-list {
  display: grid;
  gap: 12px;
}

.key-card {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 14px;
  background: var(--surface-soft);
}

.key-card-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.key-card h3 {
  margin-bottom: 6px;
  font-size: 16px;
}

.card-actions {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

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

.key-meta span {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}

.key-meta strong {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.model-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.model-chip-row span {
  border: 1px solid #bad1ff;
  border-radius: 999px;
  padding: 5px 9px;
  background: #f0f5ff;
  color: #174ea6;
  font-size: 12px;
  font-weight: 800;
}

.usage-bar {
  height: 7px;
  border-radius: 999px;
  margin-top: 12px;
  background: #e5eaf2;
  overflow: hidden;
}

.usage-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--success), var(--warning));
}

.usage-bar.success i {
  background: var(--success);
}

.usage-bar.warning i {
  background: var(--warning);
}

.usage-bar.danger i {
  background: var(--danger);
}

.quota-meter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.quota-meter .usage-bar {
  margin-top: 0;
}

.quota-meter .quota-label {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cost-delta {
  font-weight: 800;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.cost-delta.up {
  color: var(--success);
}

.cost-delta.down {
  color: var(--danger);
}

.cost-delta.flat {
  color: var(--muted);
}

/* 请求追踪：行可点击切换详情，选中行高亮 */
.trace-row {
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.trace-row:hover {
  background-color: var(--surface-hover, rgba(0, 0, 0, 0.03));
}

.trace-row.selected {
  background-color: var(--surface-selected, rgba(37, 99, 235, 0.08));
  box-shadow: inset 3px 0 0 var(--primary, #2563eb);
}

.trace-step {
  border-left: 3px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--surface-soft);
  display: grid;
  gap: 4px;
}

.trace-step.success {
  border-left-color: var(--success);
}

.trace-step.danger {
  border-left-color: var(--danger);
}

.trace-step-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.trace-step-main strong {
  font-size: 14px;
}

.trace-step-meta {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.policy-chip {
  cursor: help;
}

.route-chain-grid,
.simulation-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

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

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

.route-chain h3,
.sim-card h3 {
  margin-bottom: 10px;
}

.route-steps {
  display: grid;
  gap: 8px;
}

.route-step {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 9px;
  background: var(--surface-soft);
}

.route-step span {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #111827;
  color: #fff;
  font-weight: 800;
}

.route-step small {
  grid-column: 2;
  color: var(--muted);
}

.sim-card p {
  margin-bottom: 8px;
}

.sim-card small {
  color: var(--muted);
  line-height: 1.5;
}

.wide-split {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.one-time-key {
  border: 1px solid #bad1ff;
  background: #f0f5ff;
  border-radius: 8px;
  padding: 12px;
  word-break: break-all;
}

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

.skeleton {
  height: 112px;
  border-radius: 9px;
  background: linear-gradient(90deg, #edf1f6 0%, #f8fafc 45%, #edf1f6 90%);
  background-size: 220% 100%;
  animation: shimmer 1300ms ease-in-out infinite;
}

.skeleton.wide {
  grid-column: span 4;
  height: 260px;
}

@keyframes shimmer {
  from {
    background-position: 120% 0;
  }
  to {
    background-position: -120% 0;
  }
}

@media (max-width: 1100px) {
  .login-page,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .login-page {
    padding: 14px;
  }

  .login-visual {
    min-height: 540px;
  }

  .signal-board,
  .grid.cols-4,
  .grid.cols-3,
  .key-meta,
  .route-chain-grid,
  .simulation-grid,
  .control-strip,
  .command-layout,
  .gateway-flow,
  .experience-ribbon,
  .split,
  .form-grid,
  .skeleton-grid {
    grid-template-columns: 1fr;
  }

  .command-layout {
    grid-template-areas:
      "flow"
      "queue"
      "insight";
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .topbar,
  .command-hero,
  .ops-hero,
  .page-brief {
    align-items: stretch;
  }

  .command-hero,
  .page-brief {
    flex-direction: column;
  }

  .topbar {
    flex-direction: column;
  }

  .ops-hero {
    grid-template-columns: 1fr;
  }

  .ops-hero-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .flow-step {
    min-height: 0;
  }

  .flow-step::after {
    top: auto;
    right: auto;
    left: 28px;
    bottom: -11px;
    width: 1px;
    height: 11px;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .workspace {
    padding: 18px;
  }

  .resource-drawer {
    width: min(540px, 92vw);
  }

  .skeleton.wide {
    grid-column: span 1;
  }
}

@media (max-width: 620px) {
  .login-page {
    display: flex;
    flex-direction: column;
    padding: 10px;
  }

  .login-card {
    order: 1;
  }

  .login-visual {
    order: 2;
  }

  .login-visual,
  .login-card {
    width: 100%;
    max-width: 100%;
    border-radius: 10px;
    padding: 22px;
  }

  .login-visual {
    min-height: 0;
    grid-template-rows: auto auto auto;
  }

  .login-hero {
    max-width: 100%;
    margin: 22px 0;
  }

  .login-hero h1 {
    font-size: 28px;
    line-height: 1.16;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .login-hero p {
    font-size: 15px;
    max-width: 100%;
  }

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

  .login-proof span {
    text-align: center;
  }

  .nav {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .nav > div {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
  }

  .nav-group-title {
    display: none;
  }

  .nav-button {
    width: auto;
    min-width: max-content;
    padding: 8px 10px;
  }

  .sidebar {
    gap: 12px;
    padding: 14px 12px;
    max-width: 100vw;
    overflow: hidden;
  }

  .sidebar-footer {
    margin-top: 0;
  }

  .topbar-actions {
    display: grid;
  }

  .ops-hero h2 {
    font-size: 24px;
  }

  .ops-hero-actions {
    grid-template-columns: 1fr;
  }

  .control-stat strong {
    font-size: 22px;
  }

  .insight-card .secondary-button {
    width: 100%;
  }

  .resource-drawer {
    width: 100vw;
    max-width: 100vw;
  }

  .drawer-head {
    padding: 18px 16px 14px;
  }

  .drawer-body {
    padding: 16px;
  }

  .drawer-body .form-grid {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding: 10px 8px;
  }

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

  table {
    min-width: 640px;
  }

  th:last-child,
  td:last-child {
    width: 122px;
  }
}

/* 命令面板 */
.cmdk-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 18vh 16px 0;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: cmdk-fade-in 150ms ease;
}

.cmdk-overlay.open {
  display: flex;
}

@keyframes cmdk-fade-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.cmdk-panel {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.cmdk-input {
  width: 100%;
  min-height: 48px;
  border: 0;
  outline: 0;
  padding: 14px 16px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  border-bottom: 1px solid var(--line-soft);
}

.cmdk-input::placeholder {
  color: var(--muted-2);
}

.cmdk-results {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 320px;
  overflow-y: auto;
}

.cmdk-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 120ms ease;
}

.cmdk-item:hover {
  background: var(--surface-soft);
}

.cmdk-item.active {
  background: var(--primary-soft);
}

.cmdk-item-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.cmdk-item.active .cmdk-item-label {
  color: #174ea6;
}

.cmdk-item-group {
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}

.cmdk-empty {
  padding: 18px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
