:root {
  color-scheme: light;
  --bg: #f4f7ff;
  --card: rgba(255, 255, 255, 0.9);
  --text: #132238;
  --muted: #71809a;
  --line: rgba(118, 136, 178, 0.18);
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-soft: #edf5ff;
  --cyan: #14b8a6;
  --pink: #f472b6;
  --violet: #6366f1;
  --green: #10b981;
  --orange: #f59e0b;
  --red: #ef4444;
  --shadow: 0 22px 56px rgba(47, 70, 128, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 8%, rgba(96, 165, 250, 0.26), transparent 30%),
    radial-gradient(circle at 86% 10%, rgba(99, 102, 241, 0.16), transparent 28%),
    radial-gradient(circle at 78% 78%, rgba(20, 184, 166, 0.14), transparent 30%),
    linear-gradient(135deg, #f8fbff 0%, #f1f5ff 52%, #f8fafc 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(59, 130, 246, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 184, 166, 0.03) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.72), transparent 82%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px;
}

.sidebar {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 48px);
  padding: 22px;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 14%, rgba(96, 165, 250, 0.28), transparent 30%),
    radial-gradient(circle at 88% 12%, rgba(20, 184, 166, 0.2), transparent 30%),
    linear-gradient(160deg, #111827 0%, #172554 54%, #0f3b55 100%);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.sidebar::before,
.sidebar::after {
  position: absolute;
  content: "";
  border-radius: 999px;
  filter: blur(4px);
  opacity: 0.78;
}

.sidebar::before {
  right: -72px;
  bottom: 88px;
  width: 170px;
  height: 170px;
  background: rgba(96, 165, 250, 0.18);
}

.sidebar::after {
  left: -54px;
  bottom: -46px;
  width: 160px;
  height: 160px;
  background: rgba(20, 184, 166, 0.14);
}

.brand-block {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.brand-logo {
  display: grid;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #38bdf8 0%, #3b82f6 52%, #14b8a6 100%);
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(59, 130, 246, 0.22);
  font-size: 22px;
  font-weight: 900;
}

.brand-block h1,
.brand-block .eyebrow,
.sidebar-footer {
  color: #fff;
}

.brand-block .eyebrow {
  color: #bfdbfe;
}

.brand-block h1 {
  font-size: 24px;
}

.workspace {
  min-width: 0;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.54)),
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.08), transparent 34%),
    radial-gradient(circle at bottom left, rgba(20, 184, 166, 0.08), transparent 32%);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 32px;
  backdrop-filter: blur(18px);
  font-family: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  box-shadow: 0 24px 64px rgba(47, 70, 128, 0.12);
}

.sidebar-footer {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding: 16px;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  font-size: 13px;
  line-height: 1.6;
  backdrop-filter: blur(10px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.page {
  display: grid;
  gap: 18px;
}

.card {
  position: relative;
  padding: 22px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.97), rgba(248, 250, 255, 0.88)),
    radial-gradient(circle at top right, rgba(147, 197, 253, 0.14), transparent 34%);
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 22px;
  box-shadow: 0 14px 32px rgba(47, 70, 128, 0.08);
}

.card::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.hero-card {
  color: #fff;
  background:
    radial-gradient(circle at 88% 18%, rgba(255, 255, 255, 0.18), transparent 22%),
    radial-gradient(circle at 18% 82%, rgba(45, 212, 191, 0.2), transparent 30%),
    linear-gradient(135deg, #2563eb 0%, #4f46e5 58%, #0f766e 100%);
  border: 0;
  overflow: hidden;
  position: relative;
}

.hero-card::after {
  position: absolute;
  right: -58px;
  bottom: -78px;
  width: 220px;
  height: 220px;
  content: "";
  background: rgba(255, 255, 255, 0.16);
  border-radius: 50%;
}

.hero-card p {
  color: rgba(255, 255, 255, 0.78);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.compact-stats {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 14px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.84));
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(83, 96, 181, 0.08);
}

.stat-card::after {
  position: absolute;
  top: -36px;
  right: -32px;
  width: 88px;
  height: 88px;
  content: "";
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.18), rgba(20, 184, 166, 0.16));
  border-radius: 50%;
}

.stat-value {
  position: relative;
  z-index: 1;
  display: block;
  margin-bottom: 4px;
  color: #1e3a8a;
  font-size: 24px;
  font-weight: 800;
}

.stat-label,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 10px;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.chip-button {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  font-weight: 700;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 58%, #14b8a6 100%);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.22);
}

.primary-button:active {
  background: linear-gradient(135deg, #1d4ed8 0%, #4338ca 58%, #0f766e 100%);
}

.secondary-button {
  color: #2563eb;
  background: linear-gradient(135deg, #eff6ff, #f0fdfa);
  border: 1px solid rgba(37, 99, 235, 0.12);
}

.ghost-button,
.chip-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
}

.danger-button {
  color: #fff;
  background: linear-gradient(135deg, #f97316, #ef4444);
}

.icon-button {
  width: 38px;
  height: 38px;
  color: #2563eb;
  background: linear-gradient(135deg, #fff, #eef2ff);
  border: 1px solid rgba(37, 99, 235, 0.1);
  border-radius: 50%;
  font-size: 22px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.list {
  display: grid;
  gap: 12px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 12px 28px rgba(78, 91, 149, 0.06);
}

.data-table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
}

.stats-table {
  min-width: 720px;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.data-table td strong {
  font-size: 16px;
}

.data-table th {
  color: #1e3a8a;
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.96), rgba(240, 253, 250, 0.9));
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr {
  transition: background 0.18s ease;
}

.data-table tbody tr:hover {
  background: linear-gradient(90deg, rgba(239, 246, 255, 0.78), rgba(240, 253, 250, 0.62));
}

.table-empty {
  color: var(--muted);
  text-align: center !important;
}

.link-button {
  min-height: auto;
  margin-right: 10px;
  padding: 0;
  color: #2563eb;
  background: transparent;
  border: 0;
  font-weight: 800;
}

.link-button:disabled {
  color: #cbd5e1;
  cursor: not-allowed;
}

.danger-text {
  color: var(--red);
}

.status-list {
  display: grid;
  gap: 10px;
}

.rule-help {
  padding: 13px 14px;
  color: #475569;
  background: linear-gradient(135deg, rgba(255, 247, 237, 0.9), rgba(238, 242, 255, 0.88));
  border: 1px solid var(--line);
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
}

.status-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(240, 253, 250, 0.78));
  border: 1px solid var(--line);
  border-radius: 16px;
}

.customer-item,
.todo-item,
.follow-item {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 16px;
  text-align: left;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 255, 0.86));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(77, 87, 171, 0.06);
}

.customer-item {
  grid-template-columns: 1.3fr 1fr 1fr 1fr;
  align-items: center;
}

.customer-item .item-row,
.customer-item .badges {
  min-width: 0;
}

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.item-title {
  font-size: 16px;
  font-weight: 800;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  color: #4f46a5;
  background: linear-gradient(135deg, #eef2ff, #ecfeff);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge.green {
  color: #047857;
  background: linear-gradient(135deg, #dcfce7, #ccfbf1);
}

.badge.orange {
  color: #b45309;
  background: linear-gradient(135deg, #ffedd5, #fef3c7);
}

.badge.red {
  color: #991b1b;
  background: linear-gradient(135deg, #fee2e2, #ffe4e6);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 10px;
}

.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filters .chip-button.active {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #14b8a6);
  border-color: transparent;
  box-shadow: 0 10px 22px rgba(20, 184, 166, 0.16);
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 13px;
  color: var(--text);
  background: rgba(248, 250, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
  background: #fff;
  border-color: rgba(37, 99, 235, 0.48);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.09);
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 7px;
  color: #46536d;
  font-size: 13px;
  font-weight: 700;
}

label strong {
  color: var(--red);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.form-row-three {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.full-span {
  grid-column: 1 / -1;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.detail-cell {
  padding: 12px;
  background: linear-gradient(135deg, rgba(248, 250, 255, 0.92), rgba(240, 253, 250, 0.72));
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 16px;
}

.detail-cell span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.detail-cell b {
  font-size: 14px;
}

.empty-state {
  padding: 22px 16px;
  color: var(--muted);
  text-align: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(238, 242, 255, 0.7));
  border: 1px dashed rgba(37, 99, 235, 0.24);
  border-radius: 18px;
}

.side-nav {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  color: rgba(255, 255, 255, 0.76);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 700;
  padding: 13px 14px;
  text-align: left;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(2px);
}

.nav-item span {
  font-size: 18px;
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.92), rgba(79, 70, 229, 0.88), rgba(20, 184, 166, 0.78));
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 12px 28px rgba(59, 130, 246, 0.18);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(8px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(920px, 100%);
  max-height: 88vh;
  margin: 0 auto;
  padding: 24px;
  overflow: auto;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 255, 0.92)),
    radial-gradient(circle at top right, rgba(236, 72, 153, 0.1), transparent 30%);
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-header h2 {
  margin-bottom: 0;
}

.action-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.status-bars {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 72px 1fr 28px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  background: rgba(226, 232, 240, 0.82);
  border-radius: 999px;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #2563eb, #14b8a6);
  border-radius: inherit;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .side-nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .nav-item {
    justify-content: center;
    font-size: 13px;
  }

  .sidebar-footer {
    display: none;
  }

  .stats-grid,
  .detail-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .customer-item {
    grid-template-columns: 1fr;
  }

  .status-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding-inline: 12px;
  }

  .form-grid,
  .form-row-three,
  .detail-grid,
  .quick-actions,
  .stats-grid,
  .side-nav {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
