/* ============================================
   SoundSeeker Account Portal - Dark Theme
   ============================================ */

:root {
  --bg: #06080D;
  --bg-alt: #0D1117;
  --surface: #10141C;
  --surface-elev: #181D27;
  --surface-hover: #1C222E;
  --text: #EAF0FA;
  --text-muted: #9BA7BE;
  --text-dim: #7C879B;  /* WCAG AA: ~5.4:1 on 深色底（旧 #5E6A80 不达标，用于 CDK 提示等真文本） */
  --border: #232A36;
  --border-strong: #323A48;
  --border-hover: #3A4454;
  --accent: #5E9EFF;
  --accent-bright: #7FB3FF;
  --accent-soft: rgba(94, 158, 255, 0.12);
  --accent-dim: rgba(94, 158, 255, 0.04);
  --accent-2: #00D4FF;
  --accent-2-soft: rgba(0, 212, 255, 0.12);

  /* RGB helpers for rgba() */
  --bg-rgb: 6, 8, 13;
  --text-rgb: 234, 240, 250;
  --accent-rgb: 94, 158, 255;
  --accent-2-rgb: 0, 212, 255;

  /* HSL 别名层：三站统一导航 site-nav.js 已迁到 web 主题系统的 hsla(var(--accent-primary-hsl),…) 语法。
     account 是固定暗色门户（无主题切换器），但仍须定义此别名，site-nav.js 的按钮边框/阴影色才不落到未定义变量而失效。
     取值与 web themes.css 默认蓝主题（--accent-primary-hsl: 217,100%,68%）一致，使 account nav 与 web 默认主题逐像素同渲染；
     约等于 --accent #5E9EFF（HSL 整数取整有 ~2/255 级肉眼不可辨偏移：解析为 rgba(92,154,255,a) vs 旧 rgba(94,158,255,a)）。 */
  --accent-primary-hsl: 217, 100%, 68%;

  /* AI glow + gradient (克制使用) */
  --ai-glow-cyan: #00D4FF;
  --ai-glow-violet: #6C4EFE;
  --ai-gradient: linear-gradient(110deg, #00D4FF 0%, #5E9EFF 55%, #6C4EFE 100%);
  --gradient-signal: linear-gradient(135deg, #5E9EFF 0%, #00D4FF 100%);

  /* Semantic aliases */
  --success: var(--green);
  --warning: var(--yellow);
  --error: var(--red);
  --green: #30D158;
  --orange: #FF9F0A;
  --yellow: #FFD60A;
  --red: #FF453A;
  --warn: #FFD60A;
  --danger: #FF453A;
  --font-display: 'Bricolage Grotesque Variable', 'Noto Sans SC', -apple-system, 'PingFang SC', sans-serif;
  --font-body: 'Noto Sans SC', 'Bricolage Grotesque Variable', -apple-system, 'PingFang SC', sans-serif;
  --font-mono: 'JetBrains Mono Variable', 'SF Mono', Menlo, Consolas, monospace;

  /* 品牌字重 + 阴影 token（与 landing global.css 统一，CI check_design_tokens.sh 守护） */
  --brand-weight: 600;
  --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.45);

  /* spacing tokens */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --space-10: 128px;

  /* layout tokens */
  --max-content: 1280px;
  --max-prose: 720px;
  --max-narrow: 560px;
  --nav-height: 64px;
  --sidebar-w: 240px;
  --radius: 6px;
  --radius-md: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --transition: 0.2s ease;
}

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

html {
  color-scheme: dark;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  background-image:
    linear-gradient(rgba(48, 54, 61, 0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(48, 54, 61, 0.15) 1px, transparent 1px);
  background-size: 60px 60px;
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  min-height: 100dvh;  /* iOS Safari 地址栏伸缩自适应（对齐 landing global.css）；上行作 fallback */
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--text); }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  bottom: 0;
  z-index: 100;
}


.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
}

.nav-item:hover {
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-item svg {
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--text-dim);
}

/* Mobile */
.mobile-topbar {
  display: none;
}

/* Content Area */
.content-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: calc(var(--nav-height) + 32px) 40px 32px;
  max-width: calc(var(--sidebar-w) + 960px + 80px);
}

.section {
  display: none;
  animation: fadeIn 0.2s ease;
}

.section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Section header */
.section-header {
  margin-bottom: 28px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================
   Cards
   ============================================ */

.card {
  background: var(--surface);
  transition: border-color .25s;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.card:hover {
  border-color: var(--border-strong);
}

.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.card-row:last-child {
  border-bottom: none;
}

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

.card-value {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

/* ============================================
   Status Badge
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-green {
  background: rgba(48, 209, 88, 0.15);
  color: var(--green);
}

.badge-yellow {
  background: rgba(255, 159, 10, 0.15);
  color: var(--orange);
}

.badge-red {
  background: rgba(255, 69, 58, 0.15);
  color: var(--red);
}

.badge-blue {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-dim {
  background: rgba(110, 118, 129, 0.15);
  color: var(--text-dim);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ============================================
   Progress Bar
   ============================================ */

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.progress-fill.green { background: var(--green); }
.progress-fill.yellow { background: var(--orange); }
.progress-fill.red { background: var(--red); }
.progress-fill.blue { background: var(--accent); }

/* ============================================
   Table
   ============================================ */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--surface);
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--surface);
}

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

/* ============================================
   Toast
   ============================================ */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--surface-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 14px;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(var(--bg-rgb), 0.4);
  pointer-events: auto;
  animation: toastIn 0.3s ease;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--accent); }

.toast-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

/* ============================================
   Modal
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(var(--bg-rgb), 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

.modal-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 420px;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.modal-message {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================================
   Dashboard Specific
   ============================================ */

.welcome-banner {
  background: linear-gradient(135deg, rgba(94, 158, 255, 0.08), rgba(0, 212, 255, 0.05));
  border: 1px solid rgba(94, 158, 255, 0.2);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
}

.welcome-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.welcome-sub {
  font-size: 14px;
  color: var(--text-muted);
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.info-item {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.info-item-label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.info-item-value {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* ============================================
   License Page Specific
   ============================================ */

.license-status-panel {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

.license-status-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.license-status-icon.active {
  background: rgba(48, 209, 88, 0.12);
  color: var(--green);
}

.license-status-icon.trial {
  background: rgba(255, 159, 10, 0.12);
  color: var(--orange);
}

.license-status-icon.inactive {
  background: rgba(255, 69, 58, 0.12);
  color: var(--red);
}

.license-status-info {
  flex: 1;
  min-width: 0;
}

.license-status-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.license-status-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.cdk-form {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.cdk-form input {
  flex: 1;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}

.cdk-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.cdk-form input::placeholder {
  color: var(--text-dim);
}

.cdk-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
}

/* ============================================
   Sessions Page
   ============================================ */

.session-row.current {
  background: var(--accent-soft);
}

.session-badge-current {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
}

/* ============================================
   Inline edit form
   ============================================ */

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.password-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(255, 159, 10, 0.08);
  border: 1px solid rgba(255, 159, 10, 0.2);
  border-radius: var(--radius-sm);
  margin-top: 16px;
  font-size: 13px;
  color: var(--orange);
}

.password-warning svg {
  flex-shrink: 0;
  margin-top: 1px;
}

/* ============================================
   Loading skeleton
   ============================================ */

.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-elev) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-line {
  height: 16px;
  margin-bottom: 10px;
}

.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-80 { width: 80%; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================
   Empty state
   ============================================ */

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-dim);
}

.empty-state svg {
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state-text {
  font-size: 14px;
}

/* ============================================
   Responsive: Mobile (< 768px)
   ============================================ */

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }


  .mobile-topbar {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
  }

  .mobile-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
  }

  .mobile-brand-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    flex: 1;
    margin-left: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;  /* 长用户名/品牌名不折行撑高顶栏 */
  }

  .mobile-tabs {
    display: flex;
    border-top: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-tab {
    flex: 1;
    min-width: 0;
    min-height: 44px;        /* 触摸目标（WCAG 2.1） */
    padding: 12px 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    white-space: nowrap;
  }

  .mobile-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
  }

  .content-area {
    margin-left: 0;
    /* 顶部留白须容下固定头：mobile-topbar(48) + mobile-tabs(44) + site-nav ≈ 125px，
       原 96px 会被导航遮挡内容顶部。 */
    padding: 128px 16px 32px;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .license-status-panel {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .cdk-form {
    flex-direction: column;
  }

  .welcome-banner {
    padding: 20px;
  }

  .card {
    padding: 18px;
  }

  .modal-card {
    padding: 20px;
  }

  .toast-container {
    top: auto;
    bottom: 20px;
    left: 16px;
    right: 16px;
  }

  .toast {
    max-width: 100%;
  }
}

/* Desktop: hide mobile topbar */
@media (min-width: 769px) {
  .mobile-topbar {
    display: none !important;
  }

  .mobile-tabs {
    display: none !important;
  }
}

/* ============================================
   Scrollbar (webkit)
   ============================================ */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--surface-elev);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface-elev) transparent;
}

/* ============================================
   Form Controls (shared by auth + app)
   ============================================ */

.form-group {
  margin-bottom: var(--space-4);
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: var(--space-1);
}
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-alt);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.25);
}
.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-dim);
}
/* 字段说明文案（公开/唯一/用途说明）：克制的次要信息，不抢字段焦点。 */
.form-help-text {
  margin: var(--space-1) 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}
/* 字段级校验错误提示（role="alert"）：与字段绑定，读屏即时读出；空时不占位。 */
.field-error {
  margin: var(--space-1) 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--red);
}
.field-error:empty {
  display: none;
}
/* 出错字段红边，给视觉用户即时反馈（与 aria-invalid 同步）。 */
.form-group input[aria-invalid="true"],
.form-group textarea[aria-invalid="true"] {
  border-color: var(--red);
}
/* 注册协议同意告知：PIPL 告知-同意 + 民法典 §496 格式条款须以显著方式提示，否则不成为合同内容。
   「显著」= 加链接可点 + 常驻可见即满足，用中性样式承载，不用警告色/弹窗（合规≠alarming，对齐克制美学）。
   默认不勾选（input 无 checked；默认勾选=同意无效且违规）。 */
.consent-group {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-2);
  margin: 0 0 var(--space-5);
}
.consent-check {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.consent-text {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-muted);
  cursor: pointer;
}
.consent-text a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.consent-text a:hover {
  color: var(--accent-bright);
}
/* 未勾选拦截提示：中性蓝（info 调）而非红色——这是「请完成必填项」而非危险告警。占满整行换行显示。 */
.consent-group .field-error {
  flex-basis: 100%;
  color: var(--accent);
}

/* 密码显示/隐藏切换（眼睛按钮叠在输入框右侧）*/
.password-field {
  position: relative;
}
.password-field input {
  padding-right: 46px;
}
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-dim);
  transition: color 150ms ease, background 150ms ease;
}
.password-toggle:hover {
  color: var(--text);
  background: var(--bg-alt);
}
.password-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
/* 眼睛图标显隐用 class 控制（不依赖 SVG hidden 属性——它对 inline SVG 初始不可靠，
   会致两个图标重叠）。默认显示睁眼；.revealed（密码明文态）显示闭眼。 */
.password-toggle .icon-eye-off { display: none; }
.password-toggle.revealed .icon-eye { display: none; }
.password-toggle.revealed .icon-eye-off { display: inline-block; }

/* 登录方式切换 tab（密码登录 / 验证码登录）*/
.login-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.login-tab {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}
.login-tab:hover { color: var(--text); }
.login-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
/* 验证码输入 + 发送按钮同行 */
.code-field { display: flex; gap: 8px; }
.code-field input { flex: 1; }
.code-send-btn { flex-shrink: 0; white-space: nowrap; padding: 0 14px; font-size: 13px; }
.code-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================
   Buttons (shared by auth + app)
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.01em;
  padding: 10px 20px;
  border-radius: var(--radius);
  transition: background 0.25s, border-color 0.25s, box-shadow 0.3s;
  cursor: pointer;
  user-select: none;
  border: none;
  background: none;
  color: inherit;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}
.btn-primary:hover {
  background: var(--accent-bright);
  color: var(--bg);
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.3);
}
.btn-primary:active {
  box-shadow: inset 0 1px 3px rgba(var(--bg-rgb), 0.3);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-secondary:hover {
  background: var(--accent-soft);
  border-color: var(--accent-bright);
  color: var(--accent-bright);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 10px 12px;
}
.btn-ghost:hover {
  color: var(--text);
}

.btn-danger {
  background: var(--red);
  color: var(--bg);
}
.btn-danger:hover {
  background: #ff6b63;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.btn-icon:hover {
  color: var(--text);
  background: var(--surface-elev);
}

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

/* ============================================
   Auth Page — Two-Column Login/Register
   ============================================ */

.auth-page {
  display: grid;
  grid-template-columns: 45% 55%;
  min-height: 100vh;
}

/* Left panel: brand visual */
.auth-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-7);
  background:
    radial-gradient(ellipse at 50% 40%, rgba(var(--accent-rgb), 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 60%, rgba(var(--accent-2-rgb), 0.04) 0%, transparent 50%),
    var(--bg);
  position: relative;
  overflow: hidden;
}
.auth-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(48, 54, 61, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(48, 54, 61, 0.12) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.4;
}
.auth-hero-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 400px;
}
.auth-hero-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-7);
}
.auth-hero-brand {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.auth-hero-waveform {
  margin-bottom: var(--space-6);
  display: flex;
  justify-content: center;
}
/* 跳动声波 logo（与主页 hero-wave 一致）：13 根 flex bar，JS 实时 scaleY；中央 AI bar 三层辉光。
   适配登录页尺寸：height/width/gap 取主页 clamp 的中值固定化（登录页布局固定，不需 vw 响应）。 */
.auth-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  /* 响应式：登录页左侧 hero 占半屏、空间大 → 比主页更大更醒目；
     大屏 8vw 自适应放大（cap 156），小屏/窄窗 floor 110。 */
  gap: clamp(7px, 0.55vw, 10px);
  height: clamp(110px, 8vw, 156px);
}
/* bar 由 JS createElement 生成 → transform/filter 由 rAF 逐帧驱动（连续行波）。
   绝不挂 CSS animation：会覆盖 JS 的 inline transform。错落感来自每根 bar 不同相位/速度。 */
.auth-wave .bar {
  width: clamp(9px, 0.65vw, 12px);
  flex-shrink: 0;
  align-self: center;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--border-hover) 0%, var(--surface) 100%);
  transform-origin: center;
  will-change: transform;
}
.auth-wave .bar.ai {
  /* 品牌 logo 核心视觉：竖直渐变 + 三层辉光（与主页精确一致，刻意比品牌色变量更亮）。 */
  background: linear-gradient(180deg, #1FF7FF 0%, #1F7BFF 52%, #7C5DFF 100%);
  box-shadow:
    0 0 8px rgba(31, 247, 255, 0.9),
    0 0 22px rgba(31, 123, 255, 0.6),
    0 0 40px rgba(124, 93, 255, 0.4);
}
.auth-hero-tagline {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-6);
}
.auth-hero-features {
  list-style: none;
  display: grid;
  gap: var(--space-3);
  text-align: left;
}
.auth-hero-features li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 14px;
  color: var(--text-muted);
}
.auth-hero-features li svg {
  flex-shrink: 0;
  color: var(--accent-2);
  opacity: 0.7;
}

/* Right panel: forms */
.auth-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-7) var(--space-8);
  background: var(--bg);
  position: relative;
}
.auth-view {
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
}
.auth-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-2);
  letter-spacing: -0.02em;
}
.auth-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: var(--space-6);
  line-height: 1.6;
}

/* Form sections */
.auth-form .form-section {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}
.auth-form .form-section:last-of-type {
  border-bottom: none;
  margin-bottom: var(--space-4);
  padding-bottom: 0;
}
.form-section-label {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: var(--space-3);
}

/* Verification toggle */
.verification-toggle {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.verification-tab {
  padding: 6px 14px;
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}
.verification-tab.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}
.verification-tab:hover:not(.active) {
  border-color: var(--border-strong);
  color: var(--text-muted);
}

/* Inline form group (input + button) */
.form-group-inline {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
}
.form-group-inline input {
  flex: 1;
}
.form-group-inline .btn {
  flex-shrink: 0;
  white-space: nowrap;
  height: 42px;
}

/* Verification code boxes */
.code-inputs {
  display: flex;
  gap: var(--space-2);
}
.code-box {
  width: 48px;
  height: 56px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.code-box:focus {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.25);
}

/* Send code button states */
.btn-send-code:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Auth links */
.auth-links {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-5);
  font-size: 14px;
}
.auth-links a {
  color: var(--text-dim);
  transition: color 0.2s;
}
.auth-links a:hover {
  color: var(--accent-2);
}

/* Auth footer */
.auth-footer {
  position: absolute;
  bottom: var(--space-5);
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  padding: 0 var(--space-5);
}

/* btn-block */
.btn-block {
  width: 100%;
  height: 46px;
}

/* Required asterisk */
.required {
  color: var(--red);
  font-size: 12px;
}

/* ============================================
   Auth Page Responsive
   ============================================ */

@media (max-width: 768px) {
  .auth-page {
    grid-template-columns: 1fr;
  }
  .auth-hero {
    min-height: auto;
    padding: var(--space-5) var(--space-4);
  }
  .auth-hero-inner {
    max-width: 100%;
  }
  .auth-wave {
    height: 90px;
  }
  .auth-hero-waveform {
    margin-bottom: var(--space-4);
  }
  .auth-hero-features {
    display: none;
  }
  .auth-hero-tagline {
    font-size: 18px;
    margin-bottom: 0;
  }
  .auth-main {
    padding: var(--space-5) var(--space-4);
  }
  .auth-title {
    font-size: 22px;
  }
  .auth-footer {
    position: static;
    margin-top: var(--space-6);
    padding: 0;
  }
  .code-box {
    width: 42px;
    height: 48px;
    font-size: 18px;
  }
}

/* ============================================================
   诊断收件箱（feedback-admin.js）—— 个人版崩溃/Bug 反馈 Phase 3
   复用 .card / .badge / .btn / .modal-overlay；以下为该页专属补充。
   ============================================================ */
.fb-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.fb-tab {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px);
  padding: 8px 16px;
  cursor: pointer;
  transition: color .2s, border-color .2s, background .2s;
}
.fb-tab:hover { color: var(--text); border-color: var(--border-hover); }
.fb-tab.active {
  color: var(--accent-bright);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.fb-empty, .fb-error {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}
.fb-error { color: var(--red); }

.fb-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.fb-filter-bar code {
  font-family: var(--font-mono);
  color: var(--accent-bright);
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: 4px;
}

/* 聚类卡片 */
.fb-cluster { cursor: pointer; padding: 16px 20px; }
.fb-cluster:hover { border-color: var(--accent); }
.fb-cluster-head { display: flex; align-items: center; gap: 16px; }
.fb-count {
  flex: 0 0 auto;
  min-width: 40px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-bright);
}
.fb-cluster-title { min-width: 0; flex: 1; }
.fb-cluster-sample {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fb-cluster-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* 反馈流卡片 */
.fb-report { cursor: pointer; padding: 14px 18px; }
.fb-report:hover { border-color: var(--accent); }
.fb-report-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.fb-report-time {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-dim);
}
.fb-report-teaser {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fb-report-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
  font-family: var(--font-mono);
}

/* 详情 modal（覆盖 .modal-card 宽度，容纳日志） */
.fb-detail-card {
  max-width: 720px;
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  padding: 24px;
}
.fb-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.fb-detail-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
  font-family: var(--font-mono);
}
.fb-detail-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-muted);
  margin: 14px 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.fb-status-actions { display: flex; gap: 6px; margin-left: auto; }
.fb-detail-body { overflow-y: auto; }
.fb-field { margin-bottom: 16px; }
.fb-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.fb-pre {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px);
  padding: 12px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
}
