/* V16 shared visual system */

:root {
  --bg-1: #f8fafc;
  --bg-2: #eef4ff;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-strong: rgba(255, 255, 255, 0.98);
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --surface-muted: #eef4fb;
  --line: rgba(37, 99, 235, 0.12);
  --line-strong: rgba(30, 64, 175, 0.18);
  --text: #1e293b;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-soft: rgba(37, 99, 235, 0.08);
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --accent-alt: #3b82f6;
  --warn: #f97316;
  --warn-soft: rgba(249, 115, 22, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.12);
  --shadow-lg: 0 24px 54px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 14px 30px rgba(15, 23, 42, 0.07);
  --shadow-sm: 0 8px 16px rgba(15, 23, 42, 0.05);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 12px;
  --sans:
    "Fira Sans", "HarmonyOS Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI",
    "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  --mono:
    "Fira Code", "Cascadia Mono", "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono",
    monospace;
}

html {
  scroll-behavior: smooth;
}

body {
  color: var(--text);
  background:
    radial-gradient(circle at 0% 0%, rgba(59, 130, 246, 0.14), transparent 30%),
    radial-gradient(circle at 100% 0%, rgba(249, 115, 22, 0.12), transparent 24%),
    radial-gradient(circle at 50% 18%, rgba(148, 163, 184, 0.1), transparent 28%),
    linear-gradient(180deg, #f8fafc 0%, #eef4ff 100%);
}

body::before {
  top: -12vw;
  right: -8vw;
  width: 32vw;
  height: 32vw;
  opacity: 0.24;
  filter: blur(72px);
  background: rgba(37, 99, 235, 0.16);
}

body::after {
  bottom: -16vw;
  left: -10vw;
  width: 28vw;
  height: 28vw;
  opacity: 0.18;
  filter: blur(72px);
  background: rgba(249, 115, 22, 0.12);
}

code,
pre,
.api-docs-code,
.stat-value,
.selection-pill,
.list-meta-pill,
.toolbar-create-badge,
.v16-kpi-card strong {
  font-family: var(--mono);
}

.page-shell {
  width: min(1720px, calc(100% - 24px));
  padding: 16px 0 28px;
}

.app-shell {
  gap: 16px;
}

.page-header-card,
.workspace-card,
.table-tools-card,
.modal-dialog {
  border-color: rgba(37, 99, 235, 0.1);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-lg);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.95fr);
  gap: 18px 22px;
  align-items: start;
  padding: 22px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 249, 255, 0.96) 58%, rgba(236, 244, 255, 0.95) 100%);
  backdrop-filter: blur(18px);
}

.hero-panel::before {
  content: "";
  position: absolute;
  right: 11%;
  bottom: -120px;
  width: 260px;
  height: 260px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.18) 0%, rgba(37, 99, 235, 0) 72%);
  pointer-events: none;
}

.hero-copy,
.hero-actions,
.v16-hero-sidecar {
  position: relative;
  z-index: 1;
}

.hero-copy {
  display: grid;
  gap: 14px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-self: start;
  min-width: 0;
}

.page-heading h1 {
  font-size: clamp(32px, 4.2vw, 56px);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.page-subtitle {
  max-width: 72ch;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.72;
}

.eyebrow,
.section-label,
.support-item-label,
.stat-label,
.v16-kicker,
.v16-card-kicker {
  margin: 0;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.channel-legend {
  gap: 10px;
}

.legend-pill {
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.06);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
}

.legend-pill-link:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.26);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.12);
}

.header-note {
  max-width: 72ch;
  padding: 14px 16px;
  border: 1px solid rgba(37, 99, 235, 0.1);
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.92);
  color: #475569;
  line-height: 1.7;
}

.v16-hero-sidecar {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: grid;
  gap: 14px;
  align-self: stretch;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.96) 0%, rgba(30, 64, 175, 0.94) 100%);
  box-shadow: 0 20px 40px rgba(30, 64, 175, 0.16);
  color: #e2e8f0;
}

.v16-hero-sidecar-head {
  display: grid;
  gap: 10px;
}

.v16-hero-sidecar h2 {
  margin: 0;
  color: #f8fafc;
  font-size: clamp(24px, 2.4vw, 30px);
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.v16-kicker {
  color: rgba(191, 219, 254, 0.82);
}

.v16-hero-sidecar-head p:not(.v16-kicker) {
  margin: 0;
  color: rgba(226, 232, 240, 0.84);
  line-height: 1.7;
}

.v16-hero-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.v16-kpi-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
}

.v16-kpi-label {
  color: rgba(191, 219, 254, 0.76);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.v16-kpi-card strong {
  color: #f8fafc;
  font-size: clamp(24px, 2.2vw, 32px);
  line-height: 1;
}

.v16-kpi-card small {
  color: rgba(226, 232, 240, 0.82);
  line-height: 1.55;
}

.v16-hero-anchor {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 16px;
  background: #ffffff;
  color: #1d4ed8;
  font-weight: 800;
  text-decoration: none;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
}

.v16-hero-anchor:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.18);
}

.v16-overview-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.25fr) repeat(2, minmax(0, 0.95fr)) minmax(0, 1.05fr);
}

.v16-overview-card {
  display: grid;
  gap: 12px;
  min-height: 184px;
  padding: 20px;
  border: 1px solid rgba(37, 99, 235, 0.1);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 250, 255, 0.96) 100%);
  box-shadow: var(--shadow-md);
}

.v16-overview-card h2 {
  margin: 0;
  font-size: clamp(24px, 2.2vw, 32px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.v16-overview-card p:not(.v16-card-kicker) {
  margin: 0;
  color: var(--muted);
  line-height: 1.68;
}

.v16-overview-primary {
  border-color: rgba(37, 99, 235, 0.32);
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.24);
}

.v16-overview-primary h2,
.v16-overview-primary p:not(.v16-card-kicker) {
  color: #eff6ff;
}

.v16-overview-primary .v16-card-kicker {
  color: rgba(219, 234, 254, 0.76);
}

.v16-overview-accent {
  background:
    linear-gradient(135deg, rgba(249, 115, 22, 0.12) 0%, rgba(255, 255, 255, 0.98) 38%, rgba(239, 246, 255, 0.98) 100%);
}

.v16-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.v16-tag-row span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.v16-overview-card:not(.v16-overview-primary) .v16-tag-row span {
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
}

.workspace-card {
  display: grid;
  gap: 16px;
  padding: 18px;
}

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

.stat-card {
  min-height: 118px;
  padding: 16px;
  border: 1px solid rgba(37, 99, 235, 0.08);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 255, 0.96) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.stat-value {
  font-size: clamp(28px, 3vw, 38px);
  letter-spacing: -0.05em;
}

.stat-value.success {
  color: #1d4ed8;
}

.stat-value.warn {
  color: #ea580c;
}

.stat-value.muted {
  color: #64748b;
}

.table-tools-card {
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
}

.table-tools-top,
.toolbar-block-head,
.toolbar-create-head {
  gap: 12px;
}

.table-tools-top h2,
.modal-top h2 {
  font-size: clamp(24px, 2.8vw, 34px);
  letter-spacing: -0.04em;
}

.selection-pill,
.toolbar-inline-meta,
.list-meta-pill,
.toolbar-create-badge,
.support-panel-tip {
  border: 1px solid rgba(37, 99, 235, 0.12);
  background: rgba(241, 245, 249, 0.96);
  color: #334155;
  box-shadow: none;
}

.table-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.95fr) minmax(280px, 0.9fr);
  gap: 14px;
}

.toolbar-block {
  padding: 16px;
  border: 1px solid rgba(37, 99, 235, 0.1);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 250, 255, 0.96) 100%);
}

.toolbar-inline-caption,
.toolbar-create-caption,
.toolbar-create-note,
.modal-subtitle {
  color: #64748b;
  line-height: 1.65;
}

.toolbar-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.channel-filter-list,
.toolbar-actions {
  gap: 10px;
}

.header-btn,
.ghost-btn,
.secondary-btn,
.primary-btn,
.danger-btn,
.filter-chip,
.mini-link-btn {
  min-height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  background: #ffffff;
  color: #1e293b;
  font-weight: 700;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease,
    color 180ms ease;
  touch-action: manipulation;
}

.header-btn:hover,
.ghost-btn:hover,
.secondary-btn:hover,
.primary-btn:hover,
.danger-btn:hover,
.filter-chip:hover,
.mini-link-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.12);
}

.primary-btn {
  border-color: transparent;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
}

.secondary-btn {
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
}

.danger-btn {
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.16);
}

.availability-filter-btn.active,
.availability-filter-btn[aria-pressed="true"],
.filter-chip.active,
.filter-chip[aria-pressed="true"] {
  border-color: rgba(37, 99, 235, 0.28);
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.06);
}

.list-toolbar {
  gap: 12px;
  align-items: center;
}

.list-size-control select {
  min-height: 42px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text);
}

.table-wrap {
  border: 1px solid rgba(37, 99, 235, 0.1);
  border-radius: 22px;
  background: #ffffff;
  overflow: auto;
}

.mailbox-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.mailbox-table thead th {
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(37, 99, 235, 0.12);
}

.mailbox-table td,
.mailbox-table th {
  padding-top: 14px;
  padding-bottom: 14px;
}

.mailbox-table tbody td {
  border-bottom: 1px solid rgba(37, 99, 235, 0.08);
}

.mailbox-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.03);
}

.channel-badge {
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
}

.email-link {
  color: #1d4ed8;
}

.modal-dialog {
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.98);
}

.modal-top {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(37, 99, 235, 0.1);
}

.icon-btn {
  border: 1px solid rgba(37, 99, 235, 0.14);
  background: #ffffff;
  color: var(--text);
}

.detail-summary,
.support-grid,
.support-monitor-grid {
  gap: 12px;
}

.summary-card,
.support-item,
.support-stat,
.support-runtime-meta {
  border: 1px solid rgba(37, 99, 235, 0.1);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 250, 255, 0.96) 100%);
}

.code-strip,
.api-docs-code {
  border-radius: 14px;
}

.code-strip {
  background: #0f172a;
  color: #e2e8f0;
}

.api-docs-code {
  background: #eff6ff;
  color: #1d4ed8;
  white-space: pre-wrap;
}

.empty-state {
  padding: 22px;
  border: 1px dashed rgba(37, 99, 235, 0.2);
  border-radius: 20px;
  background: rgba(248, 250, 252, 0.92);
  color: #64748b;
}

:where(button, a, input, select, textarea, summary):focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 2px;
}

@media (max-width: 1280px) {
  .hero-panel,
  .table-toolbar,
  .v16-overview-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

  .v16-hero-sidecar {
    grid-column: 1;
    grid-row: auto;
  }

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

  .action-block {
    grid-column: 1 / -1;
  }

  .v16-overview-card:first-child,
  .v16-overview-card:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 780px) {
  .page-shell {
    width: min(100%, calc(100% - 16px));
    padding: 12px 0 24px;
  }

  .hero-panel,
  .workspace-card,
  .table-tools-card,
  .modal-dialog,
  .v16-overview-card,
  .v16-hero-sidecar {
    border-radius: 20px;
  }

  .hero-panel,
  .workspace-card,
  .table-tools-card {
    padding: 16px;
  }

  .page-heading h1,
  .v16-overview-card h2,
  .v16-hero-sidecar h2,
  .table-tools-top h2,
  .modal-top h2 {
    font-size: 28px;
  }

  .v16-overview-grid,
  .v16-hero-kpi-grid,
  .table-toolbar,
  .support-grid,
  .support-monitor-grid {
    grid-template-columns: 1fr;
  }

  .page-header-actions,
  .hero-actions,
  .toolbar-actions,
  .channel-filter-list,
  .v16-tag-row {
    width: 100%;
  }

  .toolbar-head-actions {
    justify-content: flex-start;
  }

  .header-btn,
  .ghost-btn,
  .secondary-btn,
  .primary-btn,
  .danger-btn,
  .filter-chip,
  .mini-link-btn,
  .v16-hero-anchor {
    width: 100%;
  }

  .mailbox-table {
    min-width: 860px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
