/* =========================================================
   OPC Operator Console — Editorial / Terminal aesthetic
   独立后台样式，不复用主站 styles.css
   ========================================================= */

:root {
  /* Brand */
  --c-bg: #f5f6fa;
  --c-surface: #ffffff;
  --c-surface-2: #fbfbfd;
  --c-ink: #0e1320;
  --c-ink-2: #2b3243;
  --c-muted: #6b7280;
  --c-muted-2: #9aa1ad;
  --c-line: #e5e7eb;
  --c-line-2: #eef0f4;

  /* Sidebar (deep navy w/ warm amber accent) */
  --c-side-bg: #1a1f2e;
  --c-side-bg-2: #131826;
  --c-side-line: #262c3d;
  --c-side-text: #c9cfdc;
  --c-side-text-2: #7e8699;
  --c-side-text-3: #545c70;

  /* Accents */
  --c-primary: #0f766e;
  --c-primary-hover: #115e59;
  --c-primary-soft: #d4f1ec;
  --c-amber: #d97706;
  --c-amber-soft: #fef3c7;
  --c-amber-glow: #f59e0b;
  --c-danger: #dc3545;
  --c-danger-soft: #fde2e4;
  --c-success: #16a34a;
  --c-success-soft: #dcfce7;
  --c-info: #1f6feb;
  --c-info-soft: #dbeafe;

  /* Type */
  --f-display: 'Noto Serif SC', 'Manrope', 'PingFang SC', serif;
  --f-sans: 'Manrope', 'PingFang SC', 'Helvetica Neue', system-ui, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;

  /* Geometry */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  --shadow-sm: 0 1px 0 rgba(15, 19, 29, 0.04), 0 1px 2px rgba(15, 19, 29, 0.04);
  --shadow-md: 0 4px 14px -6px rgba(15, 19, 29, 0.12), 0 1px 0 rgba(15, 19, 29, 0.04);
  --shadow-lg: 0 24px 64px -32px rgba(10, 16, 32, 0.35);

  --side-w: 240px;
}

/* ----- Reset ----- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--f-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body {
  /* 极细网格底纹 */
  background-image:
    linear-gradient(transparent 31px, rgba(15, 19, 29, 0.025) 32px),
    linear-gradient(90deg, transparent 31px, rgba(15, 19, 29, 0.025) 32px);
  background-size: 32px 32px;
}
button {
  font-family: inherit;
  cursor: pointer;
}
input,
select,
textarea {
  font-family: inherit;
  font-size: 14px;
  color: inherit;
}
a {
  color: inherit;
  text-decoration: none;
}
::selection {
  background: var(--c-primary);
  color: #fff;
}

/* ----- App shell ----- */
#app {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  min-height: 100vh;
}

/* ============== Sidebar ============== */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, var(--c-side-bg) 0%, var(--c-side-bg-2) 100%);
  color: var(--c-side-text);
  display: flex;
  flex-direction: column;
  border-right: 1px solid #0a0e18;
  overflow: hidden;
}
.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 4px 4px;
  opacity: 0.4;
}
.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--c-amber-glow), transparent);
  opacity: 0.45;
}

.sidebar-brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--c-side-line);
}
.brand-mark {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: #fff;
  background: var(--c-amber-glow);
  padding: 4px 10px;
  border-radius: 3px;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
  color: #1a1f2e;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand-text-cn {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  letter-spacing: 0.02em;
}
.brand-text-en {
  font-family: var(--f-mono);
  font-size: 10.5px;
  color: var(--c-side-text-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 18px 6px;
  padding: 8px 10px;
  border: 1px dashed var(--c-side-line);
  border-radius: var(--r-sm);
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--c-side-text-2);
  letter-spacing: 0.06em;
}
.kbd {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--c-side-line);
  border-radius: 3px;
  color: var(--c-side-text);
  font-size: 10.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 12px 16px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--c-side-line);
  border-radius: 2px;
}
.nav-section {
  display: block;
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--c-side-text-3);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 14px 12px 6px;
}
.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--c-side-text-2);
  transition: color 0.18s ease, background 0.18s ease;
}
.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
}
.nav-num {
  font-family: var(--f-mono);
  font-size: 10.5px;
  color: var(--c-side-text-3);
  letter-spacing: 0.05em;
}
.nav-label {
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.nav-en {
  font-family: var(--f-mono);
  font-size: 9.5px;
  color: var(--c-side-text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.nav-item:hover .nav-en {
  opacity: 1;
  transform: translateX(0);
}
.nav-item.is-active {
  color: #fff;
  background: rgba(245, 158, 11, 0.08);
}
.nav-item.is-active .nav-num,
.nav-item.is-active .nav-en {
  color: var(--c-amber-glow);
  opacity: 1;
}
.nav-item.is-active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--c-amber-glow);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.sidebar-footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--c-side-line);
  background: rgba(0, 0, 0, 0.2);
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-amber-glow), var(--c-amber));
  color: #1a1f2e;
  display: grid;
  place-items: center;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 16px;
}
.user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.user-name {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-family: var(--f-mono);
  font-size: 10.5px;
  color: var(--c-side-text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.user-logout {
  background: transparent;
  border: 1px solid var(--c-side-line);
  color: var(--c-side-text-2);
  border-radius: var(--r-xs);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.user-logout:hover {
  color: var(--c-amber-glow);
  border-color: var(--c-amber-glow);
}

/* ============== Main ============== */
.main-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 32px;
  background: rgba(245, 246, 250, 0.85);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--c-line);
}
.topbar-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--c-line);
  color: var(--c-ink);
  border-radius: var(--r-xs);
  width: 32px;
  height: 32px;
  font-size: 18px;
  line-height: 1;
}
.topbar-title {
  flex: 1;
  min-width: 0;
}
.topbar-eyebrow {
  display: block;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--c-muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.topbar-title h1 {
  margin: 2px 0 0;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.01em;
  color: var(--c-ink);
}
.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.page-content {
  position: relative;
  padding: 28px 32px 60px;
  outline: none;
  animation: pageIn 0.32s ease both;
}
@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(6px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}
.page-loader {
  display: flex;
  gap: 6px;
  padding: 32px;
}
.page-loader span {
  width: 6px;
  height: 6px;
  background: var(--c-primary);
  border-radius: 50%;
  animation: pulse 1.1s infinite ease-in-out;
}
.page-loader span:nth-child(2) {
  animation-delay: 0.15s;
}
.page-loader span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes pulse {
  0%, 80%, 100% {
    opacity: 0.25;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ============== Cards / sections ============== */
.section {
  margin-bottom: 28px;
}
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.section-head h2 {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.005em;
  color: var(--c-ink);
}
.section-head h2::before {
  content: '— ';
  color: var(--c-amber);
  font-family: var(--f-mono);
}
.section-sub {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--c-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.card {
  position: relative;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}
.card-tight {
  padding: 0;
}

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  position: relative;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  padding: 18px 20px 20px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #d8dde6;
}
.stat-card::after {
  content: '';
  position: absolute;
  left: 20px;
  bottom: 0;
  width: 28px;
  height: 2px;
  background: var(--c-primary);
  transform-origin: left;
  transform: scaleX(0.4);
  transition: transform 0.3s ease;
}
.stat-card:hover::after {
  transform: scaleX(1);
}
.stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--c-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.stat-label .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-primary);
}
.stat-card[data-tone='amber'] .stat-label .dot { background: var(--c-amber); }
.stat-card[data-tone='danger'] .stat-label .dot { background: var(--c-danger); }
.stat-card[data-tone='info'] .stat-label .dot { background: var(--c-info); }
.stat-value {
  margin-top: 10px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 38px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--c-ink);
  font-variant-numeric: tabular-nums;
}
.stat-foot {
  margin-top: 8px;
  font-size: 12px;
  color: var(--c-muted);
}
.stat-foot .delta-up { color: var(--c-success); font-family: var(--f-mono); }
.stat-foot .delta-down { color: var(--c-danger); font-family: var(--f-mono); }

/* ============== Buttons ============== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
  background: transparent;
  color: var(--c-ink);
}
.btn:active {
  transform: translateY(1px);
}
.btn-block {
  width: 100%;
  padding: 12px 14px;
}
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}
.btn-ghost {
  border-color: var(--c-line);
  background: var(--c-surface);
}
.btn-ghost:hover {
  border-color: var(--c-ink-2);
  background: #fff;
}
.btn-secondary {
  background: var(--c-ink);
  color: #fff;
}
.btn-secondary:hover {
  background: #000;
}
.btn-primary {
  background: var(--c-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--c-primary-hover);
}
.btn-danger {
  background: var(--c-danger);
  color: #fff;
}
.btn-danger:hover {
  background: #b9202d;
}
.btn-outline-primary {
  border-color: var(--c-primary);
  color: var(--c-primary);
  background: var(--c-primary-soft);
}
.btn-outline-primary:hover {
  background: #b8e6df;
}
.btn-outline-danger {
  border-color: var(--c-danger);
  color: var(--c-danger);
  background: var(--c-danger-soft);
}
.btn-outline-danger:hover {
  background: #fbcfd3;
}
.btn-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--r-xs);
}
.btn-arrow {
  font-family: var(--f-mono);
  transition: transform 0.2s ease;
}
.btn:hover .btn-arrow {
  transform: translateX(3px);
}

/* ============== Filter bar ============== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.filter-bar input,
.filter-bar select {
  padding: 7px 11px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-sm);
  background: #fff;
  min-width: 180px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.filter-bar input:focus,
.filter-bar select:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

/* ============== Tables ============== */
.table-wrap {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead th {
  text-align: left;
  padding: 12px 14px;
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-line);
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-muted);
  font-weight: 600;
  white-space: nowrap;
}
.table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--c-line-2);
  vertical-align: middle;
}
.table tbody tr:last-child td {
  border-bottom: none;
}
.table tbody tr {
  transition: background 0.15s ease;
}
.table tbody tr:hover {
  background: #fafbfd;
}
.table .col-num {
  font-family: var(--f-mono);
  color: var(--c-muted);
  width: 38px;
  font-size: 11.5px;
}
.table .col-id {
  font-family: var(--f-mono);
  color: var(--c-muted);
  font-size: 11.5px;
}
.table .col-actions {
  text-align: right;
  white-space: nowrap;
}
.table .col-actions .btn + .btn {
  margin-left: 4px;
}
.table .ellipsis {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell-strong {
  font-weight: 600;
  color: var(--c-ink);
}
.cell-sub {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--c-muted);
  font-family: var(--f-mono);
}

/* ============== Badges / tags ============== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px 3px;
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  border: 1px solid transparent;
}
.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.badge-success { color: var(--c-success); background: var(--c-success-soft); border-color: #bbf7d0; }
.badge-danger { color: var(--c-danger); background: var(--c-danger-soft); border-color: #fecdd3; }
.badge-warn { color: var(--c-amber); background: var(--c-amber-soft); border-color: #fde68a; }
.badge-info { color: var(--c-info); background: var(--c-info-soft); border-color: #bfdbfe; }
.badge-muted { color: var(--c-muted); background: #eef0f4; border-color: #e5e7eb; }
.badge-primary { color: var(--c-primary); background: var(--c-primary-soft); border-color: #99e2d8; }

.tag {
  display: inline-block;
  padding: 1px 7px;
  margin: 0 3px 3px 0;
  border-radius: var(--r-xs);
  background: #f1f3f7;
  border: 1px solid var(--c-line);
  font-size: 11.5px;
  color: var(--c-ink-2);
  font-family: var(--f-mono);
}

/* ============== Forms ============== */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.field > span {
  font-family: var(--f-mono);
  font-size: 10.5px;
  color: var(--c-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.field input,
.field select,
.field textarea {
  padding: 9px 12px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-sm);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-size: 13.5px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}
.field textarea {
  resize: vertical;
  min-height: 88px;
  font-family: inherit;
}
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.field-grid .full {
  grid-column: 1 / -1;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px dashed var(--c-line);
}

/* ============== Empty / placeholder ============== */
.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--c-muted);
}
.empty-mark {
  font-family: var(--f-display);
  font-size: 36px;
  color: var(--c-line);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.empty-text {
  font-size: 13px;
}

/* ============== Funnel + bars ============== */
.bar-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bar-row {
  display: grid;
  grid-template-columns: 160px 1fr 60px;
  align-items: center;
  gap: 12px;
}
.bar-row .label {
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--c-ink-2);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.bar-track {
  height: 8px;
  background: var(--c-line-2);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-primary), #5eead4);
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.bar-row .num {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--c-ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ============== Two-col layouts ============== */
.grid-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
}
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* ============== Toast ============== */
.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 240px;
  max-width: 360px;
  padding: 12px 14px;
  background: var(--c-ink);
  color: #fff;
  border-radius: var(--r-sm);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-left: 3px solid var(--c-primary);
  animation: toastIn 0.22s ease both;
}
.toast.is-error { border-left-color: var(--c-danger); }
.toast.is-warn { border-left-color: var(--c-amber-glow); }
.toast .t-mark {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  color: var(--c-muted-2);
  text-transform: uppercase;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============== Modal ============== */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 19, 29, 0.45);
  backdrop-filter: blur(4px);
}
.modal-root.is-open {
  display: flex;
}
.modal {
  width: 100%;
  max-width: 560px;
  max-height: 86vh;
  overflow-y: auto;
  background: #fff;
  border-radius: var(--r-md);
  border: 1px solid var(--c-line);
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.24s ease both;
}
.modal-large { max-width: 760px; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--c-line);
}
.modal-head h3 {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.005em;
}
.modal-head .close {
  background: transparent;
  border: 1px solid var(--c-line);
  border-radius: var(--r-xs);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 16px;
  line-height: 1;
  color: var(--c-muted);
}
.modal-head .close:hover {
  border-color: var(--c-ink);
  color: var(--c-ink);
}
.modal-body {
  padding: 18px 22px 22px;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============== Login overlay ============== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: linear-gradient(135deg, #0e1320 0%, #1a1f2e 100%);
  display: none;
  align-items: stretch;
  justify-content: center;
  padding: 24px;
}
.login-overlay.is-open { display: flex; }
.login-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(transparent 31px, rgba(255, 255, 255, 0.025) 32px),
    linear-gradient(90deg, transparent 31px, rgba(255, 255, 255, 0.025) 32px);
  background-size: 32px 32px;
  pointer-events: none;
  mask-image: radial-gradient(circle at center, #000 30%, transparent 80%);
}
.login-shell {
  position: relative;
  width: 100%;
  max-width: 980px;
  margin: auto;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.login-art {
  position: relative;
  background: linear-gradient(150deg, #1a1f2e 0%, #0a0e18 100%);
  color: #fff;
  padding: 36px 32px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-art-tag {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--c-amber-glow);
}
.login-art-glyph {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 280px;
  line-height: 0.85;
  letter-spacing: -0.06em;
  color: rgba(255, 255, 255, 0.05);
  position: absolute;
  top: 30px;
  right: -30px;
  pointer-events: none;
}
.login-art-grid {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(rgba(245, 158, 11, 0.18) 1px, transparent 1px);
  background-size: 8px 8px;
  mask-image: radial-gradient(circle at 75% 30%, #000 0%, transparent 65%);
  pointer-events: none;
}
.login-art-stream {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.05em;
}
.login-art-stream li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.login-art-stream i {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--c-amber-glow);
  border-radius: 50%;
  animation: blink 1.6s infinite;
}
.login-art-stream li:nth-child(2) i { animation-delay: 0.2s; }
.login-art-stream li:nth-child(3) i { animation-delay: 0.4s; background: var(--c-primary); }
.login-art-stream li:nth-child(4) i { animation-delay: 0.6s; background: #5eead4; }
@keyframes blink {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
}

.login-box {
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-eyebrow {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-amber);
}
.login-box h2 {
  margin: 8px 0 6px;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 32px;
  letter-spacing: -0.015em;
}
.login-sub {
  margin: 0 0 22px;
  color: var(--c-muted);
  font-size: 13px;
  line-height: 1.55;
}
.login-error {
  margin: 8px 0 0;
  min-height: 18px;
  font-size: 12.5px;
  color: var(--c-danger);
  font-family: var(--f-mono);
  letter-spacing: 0.02em;
}
.login-foot {
  margin-top: 26px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 10.5px;
  color: var(--c-muted-2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.login-foot .dot { color: var(--c-line); }

/* ============== Misc ============== */
.kvs {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 16px;
  font-size: 13px;
}
.kvs dt {
  font-family: var(--f-mono);
  font-size: 10.5px;
  color: var(--c-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  align-self: center;
}
.kvs dd {
  margin: 0;
  color: var(--c-ink);
  word-break: break-word;
}
.callout {
  padding: 14px 16px;
  background: var(--c-amber-soft);
  border: 1px solid #fde68a;
  border-radius: var(--r-sm);
  color: #78350f;
  font-size: 13px;
  margin-bottom: 16px;
}
.callout-info {
  background: var(--c-info-soft);
  border-color: #bfdbfe;
  color: #1e3a8a;
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
}

/* ============== Responsive ============== */
@media (max-width: 960px) {
  :root { --side-w: 0px; }
  .sidebar {
    position: fixed;
    z-index: 50;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  #app[data-sidebar='open'] .sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  #app {
    grid-template-columns: 1fr;
  }
  .topbar-toggle { display: inline-grid; place-items: center; }
  .page-content { padding: 20px 18px 60px; }
  .topbar { padding: 14px 18px; }
  .topbar-title h1 { font-size: 22px; }
  .field-grid { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-box { padding: 36px 28px; }
  .bar-row { grid-template-columns: 110px 1fr 56px; }
}
@media (max-width: 560px) {
  .stat-value { font-size: 30px; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tbody tr { padding: 10px 12px; border-bottom: 1px solid var(--c-line); }
  .table tbody td {
    padding: 4px 0;
    border: none;
  }
  .table .col-actions { text-align: left; padding-top: 8px; }
}

/* ===== 进化事件时间线 ===== */
.evolution-timeline {
  padding: 8px 0;
}

.timeline-item {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--c-line-2);
}

.timeline-item:last-child { border-bottom: none; }

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c-primary);
  flex-shrink: 0;
  margin-top: 4px;
}

.timeline-dot.dot-positive { background: #10b981; }
.timeline-dot.dot-negative { background: var(--c-danger); }

.timeline-body { flex: 1; min-width: 0; }

.timeline-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.timeline-header strong { font-size: 13px; color: var(--c-ink); }

.timeline-entity {
  font-size: 11px;
  padding: 2px 6px;
  background: var(--c-primary-soft);
  border-radius: 3px;
  color: var(--c-primary);
  font-family: var(--f-mono);
}

.timeline-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.timeline-tag {
  font-size: 11px;
  padding: 2px 6px;
  background: #f1f3f7;
  border-radius: 3px;
  color: var(--c-ink-2);
  font-family: var(--f-mono);
}

.timeline-date {
  font-size: 11px;
  color: var(--c-muted);
  font-family: var(--f-mono);
}

/* ===== 策略市场 ===== */
.strategy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.strategy-card {
  padding: 18px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: var(--c-surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.strategy-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.strategy-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.strategy-type-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 700;
  font-family: var(--f-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.strategy-type-badge.type-gene {
  background: var(--c-primary-soft);
  color: var(--c-primary);
}

.strategy-type-badge.type-capsule {
  background: var(--c-amber-soft);
  color: var(--c-amber);
}

.strategy-version {
  font-size: 11px;
  color: var(--c-muted);
  font-family: var(--f-mono);
}

.strategy-card-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: var(--c-ink);
}

.strategy-card-author {
  font-size: 12px;
  color: var(--c-muted);
  margin: 0 0 8px 0;
}

.strategy-card-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--c-ink-2);
  margin: 0 0 10px 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.strategy-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
}

.tag-sm {
  font-size: 11px;
  padding: 2px 6px;
  background: #f1f3f7;
  border: 1px solid var(--c-line);
  border-radius: 3px;
  color: var(--c-primary);
  font-family: var(--f-mono);
}

.strategy-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--c-line-2);
}

.strategy-stats {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--c-muted);
  flex-wrap: wrap;
}

.strategy-price {
  font-size: 16px;
  font-weight: 800;
  color: var(--c-primary);
  font-family: var(--f-display);
}
