/* 全局样式 */
:root {
  --ink: #172033;
  --muted: #6f7c91;
  --paper: #fffaf1;
  --paper-2: #f5efe4;
  --line: #ded5c7;
  --brand: #111827;
  --accent: #ff6b35;
  --accent-2: #2ec4b6;
  --accent-3: #6c63ff;
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --blue: #3b82f6;
  --shadow: 8px 8px 0 rgba(17, 24, 39, 0.12);
  --shadow-sm: 4px 4px 0 rgba(17, 24, 39, 0.1);
  --radius: 22px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: ui-rounded, 'SF Pro Rounded', 'HarmonyOS Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at 10% 12%, rgba(255, 107, 53, 0.18), transparent 22rem),
    radial-gradient(circle at 86% 8%, rgba(46, 196, 182, 0.18), transparent 24rem),
    linear-gradient(135deg, #fff7e8 0%, #f5efe4 46%, #edf4f2 100%);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(17, 24, 39, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 24, 39, 0.06) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), transparent 78%);
}

/* 加载动画 */
#loading {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  background: rgba(255, 250, 241, 0.7);
  backdrop-filter: blur(12px);
}

.spinner-border {
  width: 3rem;
  height: 3rem;
  border-width: 0.35rem;
}

/* 登录页面 */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.32), transparent 18rem),
    linear-gradient(135deg, #111827 0%, #293241 54%, #ff6b35 100%);
}

.login-card {
  width: 100%;
  max-width: 430px;
  padding: 2.4rem;
  background: var(--paper);
  border: 2px solid var(--brand);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.login-title {
  color: var(--brand);
  font-size: 2rem;
  font-weight: 950;
  letter-spacing: -0.06em;
}

.login-subtitle {
  color: var(--muted);
  margin-bottom: 2rem;
}

/* 顶部栏 */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  min-height: 72px;
  background: rgba(255, 250, 241, 0.88) !important;
  border-bottom: 2px solid rgba(17, 24, 39, 0.12);
  backdrop-filter: blur(18px);
}

.navbar .container-fluid {
  padding-inline: clamp(1rem, 3vw, 2rem);
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--brand) !important;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.navbar-brand::before {
  content: "L";
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #fff;
  font-weight: 950;
  border: 2px solid var(--brand);
  border-radius: 14px;
  background: var(--accent);
  box-shadow: 4px 4px 0 var(--brand);
}

#userInfo {
  max-width: 42vw;
  overflow: hidden;
  color: #394153;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-shell {
  padding: clamp(1rem, 2.6vw, 2rem);
}

/* 新交互：顶部工作台 + 模块卡片入口 */
.command-center {
  display: grid;
  grid-template-columns: minmax(280px, 0.86fr) minmax(320px, 1.7fr);
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1.25rem;
}

.command-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.3rem;
  min-height: 235px;
  padding: clamp(1.25rem, 2.2vw, 2rem);
  color: #fff;
  border: 2px solid var(--brand);
  border-radius: 30px;
  background:
    radial-gradient(circle at 86% 20%, rgba(255, 255, 255, 0.24), transparent 9rem),
    linear-gradient(135deg, #111827 0%, #263143 52%, #ff6b35 100%);
  box-shadow: var(--shadow);
}

.command-hero::after {
  content: "";
  position: absolute;
  right: -62px;
  bottom: -74px;
  width: 190px;
  height: 190px;
  border: 22px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
  color: inherit;
  font-size: 0.75rem;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.72;
}

.eyebrow::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: currentColor;
}

.command-hero h1 {
  margin: 0;
  max-width: 11em;
  font-size: clamp(2rem, 4vw, 3.6rem);
  font-weight: 950;
  line-height: 0.95;
  letter-spacing: -0.08em;
}

.command-hero p {
  max-width: 34rem;
  margin: 1rem 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 700;
}

.hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.module-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.module-card {
  min-height: 112px;
  padding: 0.72rem;
  border: 2px solid var(--brand);
  border-radius: 24px;
  background: rgba(255, 250, 241, 0.82);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.module-card:hover,
.module-card.active {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 rgba(17, 24, 39, 0.2);
  background: #fffdf7;
}

.module-card.active {
  outline: 4px solid rgba(255, 107, 53, 0.22);
}

.module-primary {
  width: 100%;
  display: block;
  text-align: left;
  border: 0;
  border-radius: 18px;
  padding: 0.85rem 0.9rem;
  color: var(--brand);
  background: transparent;
}

.module-primary.active {
  background: var(--accent);
  color: #fff;
  box-shadow: inset 0 0 0 2px rgba(17, 24, 39, 0.16);
}

.module-kicker,
.module-title {
  display: block;
}

.module-kicker {
  margin-bottom: 0.34rem;
  color: inherit;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  opacity: 0.62;
  text-transform: uppercase;
}

.module-title {
  font-size: 1.15rem;
  font-weight: 950;
  letter-spacing: -0.04em;
}

.module-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  padding: 0 0.2rem 0.18rem;
}

.module-chip {
  border: 2px solid rgba(17, 24, 39, 0.12);
  border-radius: 999px;
  padding: 0.36rem 0.68rem;
  color: #354054;
  background: rgba(255, 255, 255, 0.64);
  font-size: 0.8rem;
  font-weight: 850;
  transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.module-chip:hover,
.module-chip.active {
  transform: translateY(-1px);
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1.25rem;
  align-items: start;
}

.main-content {
  min-width: 0;
}

.dashboard-panel {
  display: block;
  animation: panelIn 0.26s ease both;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dashboard-panel > h2,
.dashboard-panel > .d-flex h2 {
  margin-bottom: 1rem !important;
  color: var(--brand);
  font-size: clamp(1.55rem, 2.2vw, 2.4rem);
  font-weight: 950;
  letter-spacing: -0.07em;
}

.insight-rail {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 1rem;
}

.rail-card {
  padding: 1.15rem;
  border: 2px solid var(--brand);
  border-radius: 24px;
  background: #fffdf7;
  box-shadow: var(--shadow-sm);
}

.rail-card h3 {
  margin-bottom: 1rem;
  font-size: 1.25rem;
  font-weight: 950;
  letter-spacing: -0.05em;
}

.rail-action {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.55rem;
  border: 2px solid var(--brand);
  border-radius: 16px;
  padding: 0.72rem 0.86rem;
  color: var(--brand);
  background: var(--paper-2);
  font-weight: 900;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.rail-action::after {
  content: "→";
}

.rail-action:hover {
  transform: translate(-1px, -1px);
  background: var(--accent-2);
  box-shadow: 4px 4px 0 var(--brand);
}

.muted-card {
  color: #4b5565;
  background: #edf4f2;
}

.muted-card p {
  margin: 0;
  font-weight: 750;
  line-height: 1.65;
}

/* 信息卡片 */
.stat-card,
.table-card,
.profile-item {
  border: 2px solid var(--brand);
  background: #fffdf7;
  box-shadow: var(--shadow-sm);
}

.stat-card {
  position: relative;
  min-height: 126px;
  overflow: hidden;
  border-radius: 24px;
  padding: 1.2rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -2.4rem;
  bottom: -2.6rem;
  width: 6.5rem;
  height: 6.5rem;
  border: 18px solid rgba(255, 107, 53, 0.12);
  border-radius: 999px;
}

.stat-card:hover,
.table-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 rgba(17, 24, 39, 0.18);
}

.stat-icon {
  position: relative;
  z-index: 1;
  width: 3.25rem;
  height: 3.25rem;
  border: 2px solid var(--brand);
  border-radius: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  box-shadow: 3px 3px 0 rgba(17, 24, 39, 0.14);
}

.stat-value {
  position: relative;
  z-index: 1;
  color: var(--brand);
  font-size: clamp(1.45rem, 2vw, 2.05rem);
  font-weight: 950;
  letter-spacing: -0.06em;
}

.stat-label {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
}

.table-card {
  margin-bottom: 1.2rem;
  border-radius: 24px;
  padding: clamp(1rem, 1.8vw, 1.45rem);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.table-card h5 {
  color: var(--brand);
  font-weight: 950;
  letter-spacing: -0.04em;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.9rem;
}

.profile-item {
  padding: 1rem;
  border-radius: 18px;
}

.profile-item span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 0.42rem;
  font-weight: 800;
}

.profile-item strong {
  color: var(--brand);
  font-size: 1.05rem;
  font-weight: 950;
}

.detail-metric-card {
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.detail-metric-card:hover {
  transform: translate(-2px, -2px);
  background: #ecfeff;
  box-shadow: 6px 6px 0 rgba(17, 24, 39, 0.16);
}

.detail-metric-card small {
  display: block;
  color: #0f766e;
  margin-top: 0.35rem;
  font-weight: 850;
}

/* 表格 */
.table-responsive {
  border: 2px solid var(--brand);
  border-radius: 18px;
  background: #fff;
  box-shadow: inset 0 -1px 0 rgba(17, 24, 39, 0.06);
}

.table-responsive::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: #c8bfb2;
  border: 2px solid #fff;
  border-radius: 999px;
}

.table {
  margin-bottom: 0;
  vertical-align: middle;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0.95rem 1rem;
  color: var(--brand);
  background: #f3eadb;
  border-bottom: 2px solid var(--brand);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.02em;
  text-transform: none;
  white-space: nowrap;
}

.table tbody td {
  padding: 0.95rem 1rem;
  color: #374151;
  border-color: #eee4d6;
  font-weight: 650;
  white-space: nowrap;
}

.table tbody tr {
  transition: background 0.14s ease;
}

.table tbody tr:hover {
  background: #fff7ed;
}

/* 表单 */
.form-control,
.form-select {
  color: var(--brand);
  border: 2px solid rgba(17, 24, 39, 0.18);
  border-radius: 14px;
  background-color: #fffdf7;
  font-weight: 750;
  box-shadow: none;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--brand);
  box-shadow: 4px 4px 0 rgba(255, 107, 53, 0.22);
  background-color: #fff;
}

.form-label {
  color: #354054;
  font-weight: 900;
}

.input-group .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group .btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* 按钮与徽章 */
.btn {
  border-radius: 14px;
  padding: 0.58rem 1rem;
  font-weight: 900;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.btn:hover {
  transform: translate(-1px, -1px);
}

.btn-sm {
  padding: 0.42rem 0.76rem;
  border-radius: 12px;
}

.btn-primary {
  color: #fff;
  border: 2px solid var(--brand);
  background: var(--accent);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover,
.btn-primary:focus {
  color: #fff;
  border-color: var(--brand);
  background: #f05a28;
  box-shadow: 6px 6px 0 rgba(17, 24, 39, 0.2);
}

.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-danger,
.btn-light,
.btn-outline-light {
  border-width: 2px;
  font-weight: 900;
}

.btn-outline-primary {
  color: var(--brand);
  border-color: var(--brand);
  background: #fffdf7;
}

.btn-outline-primary:hover,
.btn-outline-primary.active {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
  box-shadow: var(--shadow-sm);
}

.btn-light {
  color: var(--brand);
  border-color: #fff;
  background: #fff;
}

.btn-outline-light:hover {
  color: var(--brand);
}

.badge {
  padding: 0.42rem 0.72rem;
  border-radius: 999px;
  font-weight: 900;
}

.alert {
  border: 2px solid var(--brand);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

/* 图表、弹窗与日历 */
.chart-container {
  position: relative;
  height: 320px;
  margin-top: 1rem;
  padding: 0.75rem;
  border: 2px solid var(--brand);
  border-radius: 18px;
  background: #fff;
}

.modal-content {
  border: 2px solid var(--brand);
  border-radius: 24px;
  background: #fffdf7;
  box-shadow: var(--shadow);
}

.modal-header {
  border-bottom: 2px solid var(--brand);
}

.recharge-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.5rem;
}

.recharge-calendar-weekday,
.recharge-calendar-day {
  border-radius: 15px;
  padding: 0.65rem;
}

.recharge-calendar-weekday {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-align: center;
  background: #f3eadb;
}

.recharge-calendar-day {
  min-height: 96px;
  border: 2px solid #d8cfc1;
  background: #fff;
  text-align: left;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.recharge-calendar-day.has-orders {
  border-color: var(--brand);
  background: #ecfeff;
}

.recharge-calendar-day.active,
.recharge-calendar-day:hover:not(.empty) {
  transform: translate(-1px, -1px);
  border-color: var(--brand);
  box-shadow: 4px 4px 0 rgba(17, 24, 39, 0.14);
}

.recharge-calendar-day.empty {
  background: transparent;
  border-color: transparent;
}

.placeholder-card {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* 响应式 */
@media (max-width: 1199.98px) {
  .command-center,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .insight-rail {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 991.98px) {
  .command-center {
    gap: 0.85rem;
  }

  .module-switcher {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .navbar .container-fluid,
  .navbar .d-flex,
  .hero-actions {
    gap: 0.7rem;
    flex-wrap: wrap;
  }

  #userInfo {
    max-width: 64vw;
  }

  .dashboard-shell {
    padding: 0.9rem;
  }

  .command-hero {
    min-height: 220px;
    border-radius: 24px;
  }

  .module-switcher,
  .insight-rail,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .chart-container {
    height: 260px;
  }

  .recharge-calendar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recharge-calendar-weekday {
    display: none;
  }
}
