﻿:root {
  --bg: #fff6f6;
  --card: #ffffff;
  --ink: #2a1517;
  --muted: #7a5458;
  --line: #f2d7da;
  --primary: #c1121f;
  --primary-soft: #ffe9ec;
  --danger: #8f0f18;
  --ok: #b4232c;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at top right, #ffd9df 0%, #fff6f6 45%) fixed;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}
.wrap {
  max-width: 1220px;
  margin: 26px auto;
  padding: 0 16px;
  display: grid;
  gap: 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px;
}
h1 { margin: 0 0 6px; font-size: 24px; }
h2 { margin: 0 0 6px; }
h3 { margin: 0 0 10px; }
.muted { color: var(--muted); font-size: 13px; }
.row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.field { display: flex; flex-direction: column; gap: 6px; position: relative; }
label { font-size: 13px; color: #334155; }
input, select, textarea, button {
  font-family: inherit;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 14px;
  outline: none;
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  border-color: #e11d48;
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.18);
}
.input-unit-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
}
.input-unit-wrap > input {
  flex: 1 1 auto;
  min-width: 0;
}
.input-unit-wrap .unit-suffix {
  position: static;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  color: #dc2626;
  pointer-events: none;
  opacity: 0.9;
  white-space: nowrap;
}
/* Selector page: slightly smaller input height for denser layout */
.card[data-page="selector"] input,
.card[data-page="selector"] select {
  padding-top: 7px;
  padding-bottom: 7px;
}
textarea { min-height: 84px; resize: vertical; }
.btn {
  border: 0;
  background: linear-gradient(135deg, #b40f1a, #e11d48);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}
.btn-danger {
  background: #ffe4e8;
  color: var(--danger);
  border: 1px solid #f8b4bd;
  cursor: pointer;
}
.btn-ghost {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid #f4b9c0;
  cursor: pointer;
}
.table-wrap {
  max-height: 380px;
  overflow: auto;
  border: 1px solid #f2d7da;
  border-radius: 10px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  border-bottom: 1px solid #f2e1e3;
  padding: 8px 6px;
  text-align: left;
  white-space: nowrap;
}
.selector-runtime-table .runtime-summary-col {
  white-space: normal;
  word-break: break-word;
  min-width: 260px;
  max-width: 420px;
  line-height: 1.4;
}
.selector-runtime-table .runtime-metric-col {
  white-space: normal;
  word-break: break-word;
  min-width: 320px;
  max-width: 460px;
  line-height: 1.4;
}
th { color: #6b343a; background: #fff3f5; position: sticky; top: 0; }
.status { margin-top: 8px; font-size: 13px; }
.ok { color: var(--ok); }
.err { color: var(--danger); }
.full-width { grid-column: 1 / -1; }
.actions-row { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; }
.legacy-row { grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: end; }
.delete-row { grid-template-columns: 1fr 1fr 2fr 4fr; align-items: end; }
.title-row { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.title-actions { display: flex; align-items: center; gap: 10px; }
.nav-link { text-decoration: none; display: inline-flex; align-items: center; }
.nav-link.active { border-color: #e11d48; font-weight: 700; }
.selector-settings-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.selector-settings-buttons .btn-ghost.active {
  border-color: #e11d48;
  background: #ffe8ec;
  font-weight: 700;
}
.legacy-output-wrap {
  margin-top: 10px;
  border: 1px solid #f2d7da;
  border-radius: 10px;
  background: #fff3f5;
}
.legacy-output {
  margin: 0;
  padding: 10px;
  font-size: 12px;
  color: #4f2c30;
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.progress-wrap {
  margin-top: 8px;
  height: 10px;
  border-radius: 999px;
  background: #f2d7da;
  overflow: hidden;
}
.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #c1121f, #ef4444);
  transition: width 0.2s ease;
}
.suggest-box {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(2, 6, 23, 0.15);
  max-height: 260px;
  overflow: auto;
  display: none;
}
.suggest-item { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid #f1f5f9; }
.suggest-item:last-child { border-bottom: none; }
.suggest-item:hover { background: #ffecef; }
.app-hidden { display: none; }
.login-card { max-width: 740px; margin: 0 auto; }
.login-row { grid-template-columns: 1fr 1fr 160px; }
.login-btn-wrap { justify-content: end; }
.dashboard-metrics {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.metric-card {
  border: 1px solid #f2d7da;
  border-radius: 10px;
  background: #fff7f8;
  padding: 10px;
}
.metric-label {
  color: var(--muted);
  font-size: 12px;
}
.metric-value {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 700;
  color: #8f0f18;
}
.trend-canvas {
  width: 100%;
  max-width: 100%;
  border: 1px solid #f2d7da;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff8f9, #ffffff);
}
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.35);
  padding: 16px;
}
.modal-card {
  width: min(620px, 100%);
  background: #fff;
  border: 1px solid #f2d7da;
  border-radius: 14px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.2);
  padding: 16px;
}

@media (max-width: 980px) {
  .row, .actions-row, .legacy-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .delete-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .title-row { flex-direction: column; }
  .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .row, .actions-row, .legacy-row, .delete-row, .login-row { grid-template-columns: 1fr; }
  .dashboard-metrics { grid-template-columns: 1fr; }
}

