/**
 * ER电竞 — 全站统一主题（电竞风 · 深色玻璃拟态）
 * 子页 body 加 class="erp-page"，主框架见 shell.css
 */
:root {
  --bg: #04050a;
  --bg-elevated: #070b14;
  --panel: rgba(10, 14, 24, 0.78);
  --panel-solid: rgba(15, 23, 42, 0.92);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(56, 189, 248, 0.16);
  --txt: #e8f0fc;
  --muted: #7d8aa6;
  --acc: #f59e0b;
  --acc2: #38bdf8;
  --blue: #38bdf8;
  --cyan: #22d3ee;
  --green: #22c55e;
  --red: #ef4444;
  --purple: #a78bfa;
  --sidebar-width: 260px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 11px;
  --shadow-panel: 0 20px 50px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

/* —— 子页背景 —— */
body.erp-page {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--txt);
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(245, 158, 11, 0.1), transparent 22%),
    radial-gradient(circle at 88% 12%, rgba(56, 189, 248, 0.12), transparent 26%),
    radial-gradient(circle at 50% 100%, rgba(167, 139, 250, 0.08), transparent 32%),
    linear-gradient(180deg, #04050a 0%, #070b14 45%, #05070c 100%);
}

body.erp-page::before {
  content: "";
  position: fixed;
  inset: -40%;
  background: conic-gradient(
    from 180deg at 50% 50%,
    rgba(245, 158, 11, 0.07),
    rgba(56, 189, 248, 0.05),
    rgba(167, 139, 250, 0.07),
    rgba(239, 68, 68, 0.04),
    rgba(245, 158, 11, 0.07)
  );
  filter: blur(80px);
  opacity: 0.32;
  animation: erp-glow-spin 20s linear infinite;
  pointer-events: none;
  z-index: 0;
}

body.erp-page::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at center, black 32%, transparent 100%);
  opacity: 0.24;
  pointer-events: none;
  z-index: 0;
}

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

@keyframes erp-toast-in {
  0% { opacity: 0; transform: translateY(-16px); }
  15% { opacity: 1; transform: translateY(0); }
  85% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-8px); }
}

@keyframes erp-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.wrap,
.login-wrap,
.admin-page {
  position: relative;
  z-index: 1;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* —— 面板 —— */
.panel,
.admin-panel,
.login-box {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.82), rgba(4, 8, 18, 0.68));
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-panel);
}

.panel {
  max-width: min(1880px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 24px;
}

.login-box {
  width: min(100%, 460px);
  padding: 40px 36px;
}

/* —— 表单 —— */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="tel"],
textarea,
select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  background: rgba(4, 8, 18, 0.75);
  color: var(--txt);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
  background: rgba(8, 14, 28, 0.92);
}

input::placeholder,
textarea::placeholder {
  color: rgba(125, 138, 166, 0.8);
}

select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2338bdf8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-color: rgba(4, 8, 18, 0.75);
}

select option,
select optgroup {
  background: #0f172a;
  color: #e5eefb;
}

/* —— 按钮 —— */
.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.btn-sm { padding: 6px 14px; font-size: 12px; }

.btn-primary,
.btn-blue {
  background: linear-gradient(135deg, var(--blue), #0ea5e9);
  color: #fff;
  box-shadow: 0 6px 18px rgba(14, 165, 233, 0.28);
}

.btn-primary:hover,
.btn-blue:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(14, 165, 233, 0.38);
}

.btn-outline,
.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--txt);
}

.btn-outline:hover,
.btn-secondary:hover {
  border-color: rgba(56, 189, 248, 0.35);
  color: var(--blue);
}

.btn-red {
  background: linear-gradient(135deg, var(--red), #dc2626);
  color: #fff;
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.28);
}

.btn-gold {
  background: linear-gradient(135deg, var(--acc), #f97316);
  color: #fff;
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.28);
}

.btn-green {
  background: linear-gradient(135deg, #22c55e, #059669);
  color: #fff;
  box-shadow: 0 6px 16px rgba(34, 197, 94, 0.28);
}

.btn-cyan {
  background: linear-gradient(135deg, var(--cyan), #0891b2);
  color: #fff;
  box-shadow: 0 6px 16px rgba(34, 211, 238, 0.28);
}

.btn-purple {
  background: linear-gradient(135deg, var(--purple), #7c3aed);
  color: #fff;
  box-shadow: 0 6px 16px rgba(167, 139, 250, 0.28);
}

.input-unit {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-unit input {
  flex: 1;
  min-width: 0;
}

.input-unit span {
  flex-shrink: 0;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.desc-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

/* —— 统计卡 —— */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card,
.mini-stat,
.owner-stat {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.stat-card:hover,
.owner-stat:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.2);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
}

.stat-label,
.mini-stat-label,
.owner-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.45px;
}

.stat-value,
.mini-stat-value {
  font-size: 26px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--txt), var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-card.gold .stat-value,
.mini-stat-value.gold { background: linear-gradient(135deg, var(--acc), #fbbf24); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-card.green .stat-value,
.mini-stat-value.green,
.mini-stat-value.blue { background: linear-gradient(135deg, var(--green), #4ade80); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.mini-stat-value.blue { background: linear-gradient(135deg, #7dd3fc, var(--blue)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.mini-stat-value.purple { color: var(--purple); -webkit-text-fill-color: var(--purple); background: none; }

/* —— 控制区 / 筛选 —— */
.controls,
.filter-panel {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.55), rgba(4, 8, 18, 0.42));
  border: 1px solid rgba(56, 189, 248, 0.12);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.ctrl-row,
.ctrl-toolbar,
.ctrl-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ctrl-toolbar { justify-content: space-between; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: var(--muted);
}

/* —— 页内 Tab —— */
.finance-tabs,
.erp-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.finance-tabs button,
.erp-tabs button,
.erp-tabs .tab {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.finance-tabs button.active,
.erp-tabs button.active,
.erp-tabs .tab.active {
  background: rgba(56, 189, 248, 0.15);
  color: var(--blue);
  border-color: rgba(56, 189, 248, 0.35);
  font-weight: 600;
}

/* —— 标题 —— */
.logo {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--acc), #ffb86b 35%, var(--blue) 75%, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 18px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 12px;
}

.header .logo { font-size: 22px; }

.section-title,
.panel-head h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0;
}

.section-title::before,
.panel-head h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 14px;
  margin-right: 10px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--acc), var(--blue));
  vertical-align: middle;
}

/* —— Toast —— */
.toast,
#toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  background: rgba(8, 14, 28, 0.96);
  border: 1px solid rgba(56, 189, 248, 0.28);
  color: var(--txt);
  font-size: 13px;
  font-weight: 500;
  backdrop-filter: blur(12px);
  z-index: 10000;
  display: none;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  animation: erp-toast-in 1.2s ease forwards;
}

/* —— 弹窗 —— */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 16, 0.78);
  backdrop-filter: blur(6px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.show { display: flex; }

.modal-box,
.modal-content {
  width: min(100%, 440px);
  padding: 26px;
  border-radius: var(--radius-lg);
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.98));
  border: 1px solid rgba(56, 189, 248, 0.22);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.55);
}

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.35px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* —— 表格容器 —— */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}

.num-cell { font-variant-numeric: tabular-nums; }
.money-cell { font-weight: 700; color: #86efac; }

.hidden { display: none !important; }
.online { color: var(--green); }
.offline { color: var(--red); }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 0;
  flex-wrap: wrap;
}

.footer {
  padding: 16px 0;
  margin-top: 20px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* —— Admin 子模块 —— */
body.erp-page.admin-standalone {
  padding: 20px 24px 32px;
  background: var(--bg);
}

body.erp-page.admin-standalone::before,
body.erp-page.admin-standalone::after {
  display: none;
}

.admin-page {
  max-width: 1280px;
  margin: 0 auto;
}

.admin-panel {
  padding: 22px 24px;
  margin-bottom: 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-head h2 {
  background: linear-gradient(90deg, var(--txt) 0%, var(--blue) 120%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.panel-sub,
.field-hint,
p.muted {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px 16px;
  align-items: end;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.form-field-wide { grid-column: 1 / -1; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.toolbar input { flex: 1 1 160px; max-width: 220px; }
.toolbar select { flex: 0 1 160px; max-width: 200px; }

.subsection {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.subsection-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--acc);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.owner-stats {
  display: none;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.owner-stats.show { display: grid; }

.owner-stat::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  opacity: 0.95;
}

.owner-stat { position: relative; overflow: hidden; }

.owner-stat.tone-purple::before { background: linear-gradient(90deg, #a78bfa, #818cf8); }
.owner-stat.tone-purple .owner-stat-value { color: #ddd6fe; -webkit-text-fill-color: #ddd6fe; background: none; }
.owner-stat.tone-cyan::before { background: linear-gradient(90deg, #38bdf8, #22d3ee); }
.owner-stat.tone-cyan .owner-stat-value { color: #7dd3fc; -webkit-text-fill-color: #7dd3fc; background: none; }
.owner-stat.tone-green::before { background: linear-gradient(90deg, #22c55e, #4ade80); }
.owner-stat.tone-green .owner-stat-value { color: #86efac; -webkit-text-fill-color: #86efac; background: none; }
.owner-stat.tone-amber::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.owner-stat.tone-amber .owner-stat-value { color: #fcd34d; -webkit-text-fill-color: #fcd34d; background: none; }
.owner-stat.tone-sky::before { background: linear-gradient(90deg, #60a5fa, #93c5fd); }
.owner-stat.tone-sky .owner-stat-value { color: #93c5fd; -webkit-text-fill-color: #93c5fd; background: none; }
.owner-stat.tone-rose::before { background: linear-gradient(90deg, #fb7185, #f472b6); }
.owner-stat.tone-rose .owner-stat-value { color: #fda4af; -webkit-text-fill-color: #fda4af; background: none; }

.owner-balance-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 20px 22px;
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(34, 197, 94, 0.25);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.14), rgba(34, 197, 94, 0.04));
  box-shadow: 0 12px 36px rgba(34, 197, 94, 0.08);
}

.owner-balance-bar::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #4ade80, #22c55e);
}

.owner-balance-bar.show { display: flex; }

.owner-balance-bar .obl-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #86efac;
}

.owner-balance-bar .obl-hint {
  font-size: 12px;
  color: rgba(148, 163, 184, 0.85);
  margin-top: 5px;
}

.owner-balance-bar .obl-value {
  font-size: 34px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, #bbf7d0, #22c55e);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.role-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(167, 139, 250, 0.35);
  background: rgba(167, 139, 250, 0.12);
  color: #ddd6fe;
}

.rate-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* —— Embed 外壳 staff.html —— */
body.erp-embed {
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--txt);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

body.erp-embed::before,
body.erp-embed::after {
  display: none;
}

.embed-top {
  padding: 12px 20px 10px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  background: rgba(10, 14, 24, 0.92);
}

.embed-frame-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
}

.embed-frame-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: none;
  background: var(--bg);
}

.embed-frame-wrap iframe.show { display: block; }

/* 兼容旧类名（cloudmgmt 等聚合页） */
.frame-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
}

.frame-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: none;
  background: var(--bg);
}

.frame-wrap iframe.show { display: block; }

body.erp-embed > .top,
body.erp-embed > .embed-top {
  padding: 12px 20px 10px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  background: rgba(10, 14, 24, 0.92);
}
