/* Yeniu Console — 深色玻璃 + 霓虹点缀，H5 / 桌面自适应 */
:root {
  --bg-deep: #070a12;
  --bg-mid: #0c1222;
  --text: #e8edf7;
  --text-muted: #8b95a8;
  --primary: #22d3ee;
  --primary-dim: rgba(34, 211, 238, 0.15);
  --accent: #a78bfa;
  --accent-dim: rgba(167, 139, 250, 0.12);
  --border: rgba(148, 163, 184, 0.12);
  --glass: rgba(15, 23, 42, 0.55);
  --glass-strong: rgba(15, 23, 42, 0.72);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font);
  position: relative;
  overflow-x: hidden;
}

/* 背景：光球 + 网格 */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
}

.bg-orb-a {
  width: min(85vw, 420px);
  height: min(85vw, 420px);
  top: -12%;
  left: -10%;
  background: radial-gradient(circle, #22d3ee 0%, transparent 70%);
  animation: float-a 18s ease-in-out infinite;
}

.bg-orb-b {
  width: min(90vw, 480px);
  height: min(90vw, 480px);
  bottom: -15%;
  right: -12%;
  background: radial-gradient(circle, #a78bfa 0%, transparent 70%);
  animation: float-b 22s ease-in-out infinite;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 20%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

@keyframes float-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(8%, 6%) scale(1.05); }
}

@keyframes float-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-6%, -8%) scale(1.08); }
}

.hidden {
  display: none !important;
}

/* 玻璃面板 */
.glass {
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* 登录 */
.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  position: relative;
  z-index: 1;
}

.login-card {
  width: 100%;
  max-width: 400px;
  border-radius: calc(var(--radius) + 4px);
  padding: 28px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  color: #0a0f1a;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 0 28px rgba(34, 211, 238, 0.35);
}

.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #fff, #c4c9d4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  height: 44px;
  padding: 0 14px;
  background: rgba(2, 6, 23, 0.45);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(34, 211, 238, 0.45);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

input::placeholder {
  color: rgba(139, 149, 168, 0.55);
}

textarea {
  height: auto;
  min-height: 100px;
  padding: 10px 14px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.45;
}

/* 按钮 */
.btn {
  border: 0;
  border-radius: 11px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

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

.btn-primary {
  color: #041016;
  background: linear-gradient(135deg, #22d3ee, #4ae8ff 45%, #a78bfa);
  box-shadow: 0 4px 24px rgba(34, 211, 238, 0.35);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 32px rgba(34, 211, 238, 0.45);
}

.btn-light {
  background: rgba(34, 211, 238, 0.12);
  color: #a5f3fc;
  border: 1px solid rgba(34, 211, 238, 0.25);
}

.btn-light:hover:not(:disabled) {
  background: rgba(34, 211, 238, 0.2);
}

.btn-muted {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-block {
  width: 100%;
  padding: 12px 16px;
  margin-top: 4px;
}

/* Toast */
.toast {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: var(--glass-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-width: min(92vw, 400px);
  text-align: center;
}

/* 主布局：侧栏 + 内容 */
.shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: row;
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
}

.sidebar {
  display: none;
  flex-direction: column;
  width: 220px;
  flex-shrink: 0;
  margin: 12px 0 12px 12px;
  border-radius: var(--radius);
  padding: 16px 12px;
  align-self: flex-start;
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.side-brand .brand-logo {
  width: 40px;
  height: 40px;
  font-size: 17px;
}

.side-brand strong {
  display: block;
  font-size: 15px;
  color: var(--text);
}

.side-brand span {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.side-nav .tab {
  text-align: left;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.side-nav .tab:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.08);
}

.side-nav .tab.active {
  color: var(--text);
  background: var(--primary-dim);
  border-color: rgba(34, 211, 238, 0.25);
  box-shadow: inset 0 0 20px rgba(34, 211, 238, 0.06);
}

.side-footer {
  margin-top: auto;
  padding: 12px 8px 4px;
  border-top: 1px solid var(--border);
}

.side-footer small {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
  word-break: break-all;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  margin: 12px 12px 0;
  border-radius: var(--radius);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.content {
  flex: 1;
  padding: 12px 12px 88px;
  padding-bottom: max(88px, calc(72px + env(safe-area-inset-bottom)));
}

.view {
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.section-title {
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* KPI */
.kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kpi {
  position: relative;
  border-radius: 12px;
  padding: 14px 12px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.5));
  border: 1px solid var(--border);
  overflow: hidden;
}

.kpi::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary-dim), var(--accent-dim));
  opacity: 0.5;
  pointer-events: none;
}

.kpi .name {
  position: relative;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi .value {
  position: relative;
  font-size: 1.6rem;
  font-weight: 800;
  margin-top: 6px;
  background: linear-gradient(90deg, #fff, #a5b4fc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  align-items: center;
}

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

/* 表格 */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  -webkit-overflow-scrolling: touch;
  background: rgba(2, 6, 23, 0.35);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

th {
  background: rgba(34, 211, 238, 0.06);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

th,
td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 10px 10px;
  font-size: 13px;
  white-space: nowrap;
  color: var(--text);
}

tbody tr:hover td {
  background: rgba(167, 139, 250, 0.05);
}

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

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

.pager span {
  color: var(--text-muted);
  font-size: 12px;
}

.card-lite {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: rgba(2, 6, 23, 0.4);
  margin-top: 4px;
}

.card-lite h4 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

.field-inline {
  margin-bottom: 10px;
}

.field-inline label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

/* 底部 H5 导航 */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  height: 64px;
  height: calc(64px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: stretch;
  max-width: 100%;
  margin: 0;
  border-radius: 0;
  border-top: 1px solid var(--border);
  background: var(--glass-strong) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.tabbar .tab {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  padding: 6px 2px;
  transition: color 0.2s;
}

.tabbar .tab::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: transparent;
  margin-bottom: 2px;
  box-shadow: 0 0 0 0 rgba(34, 211, 238, 0);
  transition: box-shadow 0.25s, background 0.2s;
}

.tabbar .tab.active {
  color: var(--primary);
  font-weight: 700;
}

.tabbar .tab.active::before {
  background: var(--primary);
  box-shadow: 0 0 12px var(--primary);
}

/* 桌面：侧栏 + 隐藏底栏、加大内容区 */
@media (min-width: 900px) {
  .sidebar {
    display: flex;
  }

  .tabbar {
    display: none;
  }

  .content {
    padding: 16px 16px 20px;
    padding-bottom: 20px;
  }

  .header {
    margin: 16px 16px 0;
  }

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