/**
 * E· 软件 · 统一买家页主题
 * 源自 A股数据分析报告 · 深色 + 青绿强调
 * 各产品 static/style.css 只写布局与特例
 */
:root {
  --bg: #0b1220;
  --panel: rgba(17, 24, 39, 0.88);
  --card: var(--panel);
  --card-solid: #111827;
  --border: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #14b8a6;
  --accent2: #0ea5e9;
  --accent-hover: #0d9488;
  --primary: var(--accent);
  --primary-hover: var(--accent-hover);
  --pass: #10b981;
  --fail: #f43f5e;
  --err: #fb7185;
  --danger: var(--fail);
  --input-bg: #0f172a;
  --input-h: 2.75rem;
  --radius: 12px;
  --radius-sm: 10px;
  --shadow: none;
  --shadow-sm: none;
  --lock-bg: rgba(244, 63, 94, 0.12);
  --lock-border: rgba(244, 63, 94, 0.35);
  --lock-text: #fecdd3;
  --accent-soft: rgba(20, 184, 166, 0.14);
  /* 流体布局：手机满宽 · 桌面随屏宽放大（上限 1680px） */
  --page-max: 1680px;
  --page-width: min(98vw, var(--page-max));
  --page-gutter: clamp(16px, 2.5vw, 40px);
  --page-pad-bottom: clamp(36px, 4vw, 56px);
  --fs-body: clamp(15px, 0.875rem + 0.35vw, 18px);
  --fs-h1: clamp(1.5rem, 1.15rem + 1.5vw, 2.35rem);
  --input-h-fluid: clamp(42px, 40px + 0.45vw, 50px);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #ecfdf5;
  --panel: rgba(255, 255, 255, 0.94);
  --card: var(--panel);
  --card-solid: #ffffff;
  --border: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0d9488;
  --accent2: #0284c7;
  --accent-hover: #0f766e;
  --input-bg: #ffffff;
  --lock-bg: #fef2f2;
  --lock-border: #fecaca;
  --lock-text: #be123c;
  --accent-soft: rgba(20, 184, 166, 0.1);
}

html[data-theme="light"] .bg,
html[data-theme="light"] .ambient {
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(20, 184, 166, 0.14), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(14, 165, 233, 0.1), transparent),
    var(--bg);
}

html[data-theme="light"] .btn.secondary {
  background: #f1f5f9;
  color: var(--text);
  border-color: var(--border);
}

html[data-theme="light"] .btn.secondary:hover:not(:disabled) {
  background: #e2e8f0;
}

html[data-theme="light"] .quota-brief,
html[data-theme="light"] .quota {
  color: #0d9488;
}

html[data-theme="light"] .trial-bar {
  background: rgba(14, 165, 233, 0.1);
  color: #0369a1;
}

html[data-theme="light"] .formula-tip {
  background: rgba(20, 184, 166, 0.08);
  color: #0f766e;
  border-color: rgba(20, 184, 166, 0.2);
}

html[data-theme="light"] .progress-track {
  background: #e2e8f0;
}

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

html {
  font-size: clamp(15px, 12px + 0.55vw, 20px);
  -webkit-text-size-adjust: 100%;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "PingFang SC", "Helvetica Neue", "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.55;
}

.bg,
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(20, 184, 166, 0.18), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(14, 165, 233, 0.12), transparent),
    var(--bg);
}

.ambient::before {
  opacity: 0.12;
  background-image:
    linear-gradient(rgba(20, 184, 166, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 184, 166, 0.08) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.4), transparent 85%);
}

.wrap,
.top {
  position: relative;
  z-index: 1;
  width: var(--page-width);
  max-width: 100%;
  margin-inline: auto;
  box-sizing: border-box;
}

.wrap {
  padding: var(--page-gutter) var(--page-gutter) var(--page-pad-bottom);
}

.kicker,
.brand-kicker {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.05em;
  font-weight: 500;
  color: var(--muted);
  display: flex;
  align-items: baseline;
  line-height: 1.2;
}

.brand-e {
  font-family: Georgia, "Times New Roman", "Songti SC", "STSong", serif;
  font-size: 1.55em;
  font-weight: 800;
  font-style: italic;
  letter-spacing: -0.06em;
  line-height: 1;
  background: linear-gradient(160deg, #fff3b0 0%, #ffe082 35%, #ffc4c4 70%, #ff9999 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 3px rgba(255, 140, 120, 0.45));
  transform: translateY(0.06em);
  padding-right: 0.02em;
}

.brand-dot {
  font-size: 1.08em;
  font-weight: 700;
  background: linear-gradient(90deg, #ffe082, #ffb4b4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0 0.1em 0 0.05em;
}

.brand-name {
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.06em;
}

html[data-theme="light"] .brand-e {
  filter: drop-shadow(0 1px 2px rgba(255, 120, 100, 0.35));
}

header h1,
.head h1,
.brand h1 {
  color: var(--text);
  font-size: var(--fs-h1);
}

.sub {
  color: var(--muted);
}

.datetime {
  color: var(--muted);
}

.card,
.panel,
.worksheet {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card,
.panel {
  padding: 14px 16px;
  margin-bottom: 12px;
}

.card h2,
.panel-title {
  color: var(--text);
}

.hint,
.note {
  color: var(--muted);
}

.btn.primary,
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #042f2e;
  font-weight: 700;
  border: none;
}

.btn.primary:hover:not(:disabled),
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn.secondary {
  background: #1e293b;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.secondary:hover:not(:disabled) {
  background: #334155;
}

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

input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(20, 184, 166, 0.55);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

input::placeholder {
  color: #64748b;
}

.lock-banner {
  background: var(--lock-bg);
  border: 1px solid var(--lock-border);
  color: var(--lock-text);
  border-radius: var(--radius-sm);
  font-weight: 600;
  line-height: 1.45;
}

.license-bar {
  background: transparent;
  border: none;
  box-shadow: none;
}

.quota-brief,
.quota {
  color: #99f6e4;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent2);
  cursor: pointer;
}

.device-id {
  color: var(--muted);
}

.device-id code {
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text);
}

.tab {
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--muted);
}

.tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #042f2e;
  border-color: transparent;
}

.upload-zone {
  background: rgba(14, 165, 233, 0.08);
  border-color: rgba(14, 165, 233, 0.35);
}

.upload-zone.dragover {
  border-color: var(--accent2);
  background: rgba(14, 165, 233, 0.15);
}

.upload-text {
  color: var(--accent2);
}

.file-row {
  background: var(--input-bg);
  border-color: var(--border);
}

.file-name {
  color: var(--text);
}

.trial-bar {
  background: rgba(14, 165, 233, 0.12);
  color: #7dd3fc;
}

.trial-bar.error {
  background: rgba(244, 63, 94, 0.12);
  color: #fecdd3;
}

.license-details summary {
  color: var(--accent2);
}

.formula-tip {
  background: rgba(20, 184, 166, 0.1);
  color: #99f6e4;
  border: 1px solid rgba(20, 184, 166, 0.2);
}

.result {
  background: var(--input-bg);
  border-color: var(--border);
  color: var(--text);
}

.opts {
  background: var(--input-bg);
  border: 1px solid var(--border);
}

.progress-track {
  background: #1e293b;
}

.progress-fill {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.status {
  color: var(--muted);
}

footer,
.foot-note {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

/* ── 顶栏设置菜单（设备码 · 激活码 · 5000–5012） ── */
.head-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* 中英切换 · 胶囊椭圆（对标 5000 · 见网页产品标配 §2a） */
.lang {
  display: flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--overlay);
  backdrop-filter: blur(8px);
}
.lang-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--muted);
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease;
}
.lang-btn.active {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #042f2e;
  font-weight: 700;
}
header.site-head .lang,
header.top.head-row .lang {
  padding: 2px;
  align-self: center;
}
header.site-head .lang-btn,
header.top.head-row .lang-btn {
  padding: 4px 10px;
  font-size: 0.78rem;
  line-height: 1;
}

/* 顶栏含语言切换时，为右上角 ☀️+⚙️ 浮动区留空 */
.site-head .head-actions,
header.head-row .head-actions,
header.head .head-actions {
  margin-right: 5.5rem;
}
.head-tools-floating {
  position: fixed;
  top: max(12px, env(safe-area-inset-top, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 8px;
}
.theme-toggle {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-solid);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.theme-toggle:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.head-tools-floating .theme-toggle-floating {
  position: static;
  top: auto;
  right: auto;
}
.head-menu-wrap {
  position: relative;
}
.head-menu-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.head-menu-btn:hover,
.head-menu-btn[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.head-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 120;
  min-width: min(280px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-solid);
  color: var(--text);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}
html[data-theme="light"] .head-menu-panel {
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}
.head-menu-section {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.head-menu-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.head-menu-device-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.head-menu-device-row .device-code-display {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
}
.head-menu-action {
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  color: var(--accent2);
  font-size: 14px;
  padding: 8px 0 4px;
  cursor: pointer;
}
.head-menu-action:hover {
  color: var(--accent);
}
.head-menu-hint {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: #cbd5e1;
  text-align: left;
}
html[data-theme="light"] .head-menu-hint {
  color: #475569;
}

/* 授权区折叠后整区隐藏（设备码已迁入 ⚙️ 菜单） */
.license-zone.lz-collapsed:not(.lz-pin-extra) {
  display: none;
  margin-bottom: 0;
}
.license-zone .license-key-row:first-child {
  margin-top: 0;
}

/* ── ⚙️ 菜单 MID/LK 单行（5000 定稿 · 5000–5012） ── */
.head-tools-floating .head-menu-panel {
  min-width: min(360px, calc(100vw - 24px));
}
.head-menu-inline-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  line-height: 1.35;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.head-menu-inline-label {
  flex-shrink: 0;
  width: 2.2em;
  font-size: inherit;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #b8c5d6;
  white-space: nowrap;
}
html[data-theme="light"] .head-menu-inline-label {
  color: #64748b;
}
.head-menu-inline-row .device-code-display {
  flex: 1;
  min-width: 0;
  font-size: inherit;
  letter-spacing: 0.03em;
  color: var(--text);
}
.head-menu-icon-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.head-menu-icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.head-tools-floating .head-menu-panel #licenseKey.head-menu-license-input {
  flex: 1;
  min-width: 0;
  width: auto;
  margin: 0;
  padding: 5px 8px;
  min-height: 0;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.03em;
  line-height: 1.35;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text);
}
.head-menu-section-last {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.head-menu-section-last .head-menu-hint {
  margin-top: 8px;
  padding-left: 0;
  font-size: 12px;
  line-height: 1.45;
}
/* 到期/额度用尽：红底提示（勿用 --lock-text，避免白天主题字色与底色冲突） */
.head-menu-hint-warn {
  display: block;
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
  color: #fff1f2;
  background: #9f1239;
  border: 1px solid #fb7185;
}
html[data-theme="light"] .head-menu-hint-warn {
  color: #7f1d1d;
  background: #ffe4e6;
  border: 1px solid #e11d48;
}
.head-menu-hint-ok {
  display: block;
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
  color: #ecfdf5;
  background: #047857;
  border: 1px solid #34d399;
}
html[data-theme="light"] .head-menu-hint-ok {
  color: #052e16;
  background: #bbf7d0;
  border: 1px solid #16a34a;
}
.head-menu-tier.lz-tier {
  flex-shrink: 0;
  font-size: 10px;
  padding: 1px 6px;
  margin: 0;
}

/* ? 客服弹窗与 ⚙️ 同右缘（相对顶栏工具区，非 ? 按钮） */
.head-help-wrap {
  position: static;
}
.head-help-panel {
  min-width: min(320px, calc(100vw - 24px));
}
.head-help-panel .head-menu-support-hint,
.head-help-panel .head-menu-support-intro {
  margin: 0 0 6px;
  font-size: 12px;
  line-height: 1.5;
  color: #cbd5e1;
  text-align: left;
}
html[data-theme="light"] .head-help-panel .head-menu-support-hint,
html[data-theme="light"] .head-help-panel .head-menu-support-intro {
  color: #475569;
}
.head-help-panel .head-menu-support-intro {
  margin-bottom: 10px;
}
.head-help-panel .head-menu-support-row {
  margin-top: 6px;
}
.head-help-panel .head-menu-support-value {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 500;
  color: #f1f5f9;
  text-decoration: none;
}
html[data-theme="light"] .head-help-panel .head-menu-support-value {
  color: #0f172a;
}
.head-help-panel .head-menu-support-value:hover {
  color: var(--accent);
}

/* ── 页面标题左对齐 + site-head 顶栏（5000 定稿 · 5000–5012） ── */
.wrap > header,
.wrap header.site-head,
.wrap header.head,
header.top.head-row,
header.site-head {
  text-align: left;
}
.wrap > header h1,
header.site-head h1,
header.site-head .brand h1,
header.head h1,
header.top h1,
.head-row h1 {
  text-align: left;
}
header.site-head {
  --site-head-h: 30px;
  position: relative;
  z-index: 50;
  overflow: visible;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: var(--site-head-h);
  text-align: left;
  margin-bottom: 18px;
}
header.site-head > h1,
header.site-head .brand {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  text-align: left;
}
header.site-head > h1,
header.site-head .brand h1 {
  height: auto;
  min-height: var(--site-head-h);
  display: flex;
  align-items: center;
  line-height: 1.15;
}
header.site-head .brand-kicker {
  display: none;
}
/* 全站顶栏不显示副标题（2026-06 统一） */
header.site-head .sub,
header.site-head .brand > .sub {
  display: none !important;
}
header.site-head .head-tools-floating {
  position: relative;
  top: auto;
  right: auto;
  z-index: 2;
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  align-self: center;
  height: var(--site-head-h);
  gap: 6px;
  margin: 0;
  padding: 0;
}
header.site-head .head-help-wrap,
header.site-head .head-menu-wrap {
  display: flex;
  align-items: center;
  height: var(--site-head-h);
}
header.site-head .theme-toggle,
header.site-head .head-menu-btn {
  width: var(--site-head-h);
  height: var(--site-head-h);
  margin: 0;
  padding: 0;
  font-size: 0.78rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
header.site-head .head-help-btn {
  font-size: 0.82rem;
  font-weight: 700;
}
/* 工具按钮已在 site-head 内时，取消为 fixed 区预留的右边距 */
header.site-head .head-actions {
  margin-right: 0;
  flex-wrap: nowrap;
  gap: 6px;
}
header.site-head .head-actions .head-tools-floating {
  position: relative;
  top: auto;
  right: auto;
  flex-shrink: 0;
}
header.top.head-row .head-tools-floating,
header.head .head-row .head-tools-floating {
  position: relative;
  top: auto;
  right: auto;
  flex-shrink: 0;
}

/* 5007–5012 中英文顶栏（head-row · 对齐 5003） */
header.top.head-row {
  --site-head-h: 30px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
header.top.head-row > div:first-child {
  flex: 1;
  min-width: 0;
}
header.top.head-row .head-actions {
  margin-right: 0;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}
header.top.head-row .head-actions .head-tools-floating {
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--site-head-h);
}
header.top.head-row .theme-toggle,
header.top.head-row .head-menu-btn {
  width: var(--site-head-h);
  height: var(--site-head-h);
  padding: 0;
  font-size: 0.78rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
header.top.head-row .head-help-btn {
  font-size: 0.82rem;
  font-weight: 700;
}
header.top.head-row #txtTitle,
header.top.head-row > div:first-child h1 {
  line-height: 1.15;
  max-width: 100%;
}

/* 手机顶栏：语言切换 + ☀️ ? ⚙️ 单行紧凑 */
@media (max-width: 520px) {
  header.site-head {
    --site-head-h: 26px;
    gap: 6px;
    align-items: center;
  }
  header.site-head .head-actions {
    gap: 4px;
  }
  header.site-head .head-tools-floating {
    gap: 4px;
  }
  header.site-head .theme-toggle,
  header.site-head .head-menu-btn {
    width: var(--site-head-h);
    height: var(--site-head-h);
    font-size: 0.65rem;
  }
  header.site-head .head-help-btn {
    font-size: 0.7rem;
  }
  header.site-head .lang {
    padding: 2px;
  }
  header.site-head .lang-btn {
    padding: 3px 7px;
    font-size: 0.65rem;
  }
  header.site-head > h1,
  header.site-head .brand h1 {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  header.top.head-row {
    --site-head-h: 26px;
    gap: 6px;
    align-items: center;
  }
  header.top.head-row .eyebrow,
  header.top.head-row .sub {
    display: none;
  }
  header.top.head-row .head-actions {
    gap: 4px;
  }
  header.top.head-row .head-actions .head-tools-floating {
    gap: 4px;
  }
  header.top.head-row .theme-toggle,
  header.top.head-row .head-menu-btn {
    width: var(--site-head-h);
    height: var(--site-head-h);
    font-size: 0.65rem;
  }
  header.top.head-row .head-help-btn {
    font-size: 0.7rem;
  }
  header.top.head-row .lang {
    padding: 2px;
  }
  header.top.head-row .lang-btn {
    padding: 3px 7px;
    font-size: 0.65rem;
  }
  header.top.head-row #txtTitle,
  header.top.head-row > div:first-child h1 {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
