/* 好运属性面板 · 本地零外网依赖静态样式（国内网络 / 阿里云直连就绪） */
:root {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-main: #0f172a;
  --text-sub: #475569;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --indigo: #4f46e5;
  --indigo-bg: #eef2ff;
  --emerald: #059669;
  --emerald-bg: #ecfdf5;
  --blue: #2563eb;
  --blue-bg: #eff6ff;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --rose: #e11d48;
  --rose-bg: #fff1f2;
  --sidebar-w: 240px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px -6px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 20px 45px -12px rgba(15, 23, 42, 0.22);
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg-page);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.tabular-nums { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

button { cursor: pointer; }
button:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------------- 登录页 ---------------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 20% 20%, #eef2ff 0%, #f8fafc 45%, #ecfdf5 100%);
}

.login-card {
  width: 100%;
  max-width: 410px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px 28px 28px;
  box-shadow: var(--shadow-lg);
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #4f46e5, #0ea5e9);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: 0 6px 16px -4px rgba(79, 70, 229, 0.45);
}

.brand-mark-sm {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 14px;
}

.login-title { font-size: 20px; font-weight: 700; margin: 0; color: var(--text-main); }
.login-sub { font-size: 12px; color: var(--text-muted); margin: 2px 0 0; }

.form-field { margin-bottom: 14px; }
.form-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-main);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text-sub);
  font-weight: 600;
  font-size: 12.5px;
  transition: all .15s ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--bg-subtle); border-color: #94a3b8; color: var(--text-main); }

.btn-primary {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: #4338ca; border-color: #4338ca; color: #fff; }

.btn-emerald {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #fff;
}
.btn-emerald:hover:not(:disabled) { background: #047857; border-color: #047857; color: #fff; }

.btn-rose-outline {
  background: #fff;
  border-color: #fecdd3;
  color: var(--rose);
}
.btn-rose-outline:hover:not(:disabled) { background: var(--rose-bg); border-color: #fda4af; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; padding: 10px 16px; font-size: 13.5px; }

.alert-error {
  margin-top: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--rose-bg);
  border: 1px solid #fecdd3;
  color: #be123c;
  font-size: 12px;
}

/* ---------------- 主工作台骨架（240px 左侧栏 + 右侧主区） ---------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: #ffffff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform .22s ease;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
  z-index: 35;
}

.sidebar-head {
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-brand-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sidebar-brand-title { font-size: 14px; font-weight: 700; color: var(--text-main); line-height: 1.25; }
.sidebar-brand-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.nav-section-label {
  padding: 6px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 2px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-sub);
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  transition: background .15s, color .15s, border-color .15s;
}
.nav-btn:hover { background: var(--bg-subtle); color: var(--text-main); }
.nav-btn.active {
  background: var(--indigo-bg);
  color: var(--indigo);
  border-color: #c7d2fe;
  font-weight: 600;
}
.nav-btn-left { display: flex; align-items: center; gap: 8px; min-width: 0; }

.nav-divider {
  margin: 10px 8px;
  border-top: 1px solid var(--border);
}

.collapse-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
}
.collapse-toggle:hover { background: var(--bg-subtle); color: var(--text-main); }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  background: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sim-box {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--border);
}
.sim-title { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.sim-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.sim-pill {
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text-sub);
  font-size: 11px;
  font-weight: 500;
}
.sim-pill.active {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #fff;
  font-weight: 600;
}

.main-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---------------- 顶部 Sticky Header ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  min-height: 56px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 6px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 220px; }
.topbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex-shrink: 0; max-width: 100%; }

.mobile-menu-btn {
  display: none;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-sub);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.badge-slate { background: var(--bg-subtle); color: var(--text-sub); }
.badge-indigo { background: var(--indigo-bg); color: var(--indigo); }
.badge-emerald { background: var(--emerald-bg); color: var(--emerald); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-rose { background: var(--rose-bg); color: var(--rose); }

.countdown-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-sub);
  font-size: 11.5px;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.16);
}

.sim-banner {
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  padding: 8px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: #92400e;
}

.content-wrap {
  padding: 20px 22px 40px;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
}

/* ---------------- 卡片与 Hero 6 桶进度条 ---------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.hero-card {
  padding: 20px 22px;
  margin-bottom: 16px;
}

.hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.hero-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: baseline;
}

.kpi-big {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.kpi-label { font-size: 11.5px; color: var(--text-muted); margin-bottom: 4px; }
.kpi-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }

.bucket-bar-wrap {
  margin-bottom: 14px;
}
.bucket-bar {
  height: 14px;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
  display: flex;
  border: 1px solid var(--border);
}
.bucket-seg {
  height: 100%;
  transition: width .35s ease;
}
.seg-onsale { background: #10b981; }
.seg-forsale { background: #34d399; }
.seg-running { background: #3b82f6; }
.seg-rescue { background: #f59e0b; }
.seg-hard {
  background-color: #fb7185;
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.25),
    rgba(255, 255, 255, 0.25) 4px,
    transparent 4px,
    transparent 8px
  );
}
.seg-unsched { background: #cbd5e1; }

.bucket-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--text-sub);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* 5 个可展开交互指标胶囊 */
.pills-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.metric-pill {
  text-align: left;
  padding: 11px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #f8fafc;
  transition: all .15s ease;
}
.metric-pill:hover { border-color: #94a3b8; background: #fff; transform: translateY(-1px); }
.metric-pill.active {
  background: #fff;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.metric-pill-title { font-size: 11.5px; color: var(--text-muted); display: flex; justify-content: space-between; align-items: center; }
.metric-pill-val { font-size: 19px; font-weight: 700; margin-top: 4px; color: var(--text-main); }
.metric-pill-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.pill-expand {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid #c7d2fe;
  background: #f8faff;
  animation: fadeSlideIn .18s ease;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------- 工具栏与宽表 ---------------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.filter-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-pill {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 500;
}
.filter-pill:hover { background: var(--bg-subtle); }
.filter-pill.active {
  background: var(--text-main);
  border-color: var(--text-main);
  color: #fff;
  font-weight: 600;
}

.toolbar-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar-controls .input { width: 210px; padding: 6px 10px; }
.select {
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-main);
  font-size: 12px;
}

.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  min-width: 920px;
}
table.data-table th {
  padding: 10px 14px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
table.data-table tbody tr { transition: background .12s; cursor: pointer; }
table.data-table tbody tr:hover { background: #f8faff; }
table.data-table tbody tr:last-child td { border-bottom: none; }

.mini-progress {
  width: 126px;
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin-top: 5px;
  display: flex;
}
.mini-progress-fill { height: 100%; transition: width .25s ease; }

.diag-cell { max-width: 245px; white-space: normal; }
.diag-reason { font-size: 11px; color: var(--text-sub); margin-top: 4px; line-height: 1.45; }

/* ---------------- 多格布局（运维 / 统计卡片） ---------------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }

.section-card { padding: 18px 20px; margin-bottom: 16px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.section-title { font-size: 15px; font-weight: 700; margin: 0; }
.section-sub { font-size: 12px; color: var(--text-muted); }

/* ---------------- 460px 右侧抽屉 ---------------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.32);
  z-index: 60;
}
.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 460px;
  max-width: 100vw;
  background: #fff;
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 65;
  display: flex;
  flex-direction: column;
  animation: slideLeft .18s ease;
}
@keyframes slideLeft {
  from { transform: translateX(24px); opacity: 0.7; }
  to { transform: translateX(0); opacity: 1; }
}
.drawer-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 28px;
}

.drawer-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}
.drawer-stat {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #f8fafc;
}

/* ---------------- 弹窗与 Toast ---------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-card {
  width: 100%;
  max-width: 500px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body { padding: 18px 20px; }
.modal-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}
.toast {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: #0f172a;
  color: #fff;
  font-size: 12.5px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast-ok { background: #065f46; }
.toast-err { background: #be123c; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1180px) {
  .pills-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .mobile-menu-btn { display: inline-flex; }
}

@media (max-width: 720px) {
  .pills-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .content-wrap { padding: 14px 14px 32px; }
}
