/* ============================================================
   主题层 · 亮色（macOS 液态玻璃亮面）
   暗色为默认（见 styles.css / glass.css）；JS 把解析后的有效主题
   写到 <html data-theme-effective="light">（自动模式跟随系统）。
   本文件载入顺序在所有样式之后，同特异性覆盖暗色镀层。
   ============================================================ */

html[data-theme-effective='light'] {
  --bg: #e9edf6;
  --bg-2: #e2e8f3;
  --panel: rgba(255, 255, 255, 0.55);
  --panel-2: rgba(255, 255, 255, 0.72);
  --panel-solid: #f4f7fc;
  --border: rgba(20, 30, 55, 0.1);
  --border-strong: rgba(20, 30, 55, 0.18);
  --text: #1d2536;
  --text-2: #515c74;
  --text-3: #8b94a8;
  --shadow: 0 18px 50px -22px rgba(35, 52, 90, 0.32);
  --glass-edge: rgba(255, 255, 255, 0.75);
}

html[data-theme-effective='light'] body {
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(124, 139, 255, 0.20), transparent 60%),
    radial-gradient(900px 520px at -8% 112%, rgba(77, 227, 255, 0.18), transparent 55%),
    linear-gradient(180deg, #eef2fa 0%, #e3e8f3 100%);
}
html[data-theme-effective='light'] ::selection { background: rgba(124, 139, 255, 0.28); }
html[data-theme-effective='light'] ::-webkit-scrollbar-thumb { background: rgba(55, 70, 105, 0.22); background-clip: content-box; }
html[data-theme-effective='light'] ::-webkit-scrollbar-thumb:hover { background: rgba(55, 70, 105, 0.34); background-clip: content-box; }

/* ---------------- 结构玻璃：侧栏 / 顶栏 ---------------- */
html[data-theme-effective='light'] #sidebar,
html[data-theme-effective='light'] .admin-side {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.3));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 10px 0 40px -26px rgba(35, 52, 90, 0.45);
}
html[data-theme-effective='light'] #topbar,
html[data-theme-effective='light'] .admin-topbar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.28));
}
html[data-theme-effective='light'] .admin-topbar { border-bottom-color: var(--border); }

html[data-theme-effective='light'] .nav-item:hover { background: rgba(28, 37, 58, 0.05); }
html[data-theme-effective='light'] .nav-item.active {
  background: linear-gradient(90deg, rgba(124, 139, 255, 0.2), rgba(77, 227, 255, 0.12));
  border-color: rgba(124, 139, 255, 0.38);
}
html[data-theme-effective='light'] .nav-item.active,
html[data-theme-effective='light'] .admin-nav-item.active {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 0 18px rgba(124, 139, 255, 0.16);
}

/* ---------------- 卡片玻璃：亮面白玻 ---------------- */
html[data-theme-effective='light'] .card,
html[data-theme-effective='light'] .panel,
html[data-theme-effective='light'] .bill-card,
html[data-theme-effective='light'] .stat-card,
html[data-theme-effective='light'] .sel-card,
html[data-theme-effective='light'] .mon-card,
html[data-theme-effective='light'] .chat-card,
html[data-theme-effective='light'] .ipr-card,
html[data-theme-effective='light'] .plan-card,
html[data-theme-effective='light'] .device-row {
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.42) 45%, rgba(124, 139, 255, 0.05)),
    rgba(255, 255, 255, 0.55);
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(20, 30, 55, 0.03),
    0 14px 42px -20px rgba(35, 52, 90, 0.35);
}
html[data-theme-effective='light'] .card::after,
html[data-theme-effective='light'] .panel::after,
html[data-theme-effective='light'] .bill-card::after {
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.7), transparent 42%);
  opacity: 0.8;
}
html[data-theme-effective='light'] .card:hover,
html[data-theme-effective='light'] .panel:hover,
html[data-theme-effective='light'] .bill-card:hover,
html[data-theme-effective='light'] .plan-card:hover {
  border-color: rgba(124, 139, 255, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 22px 54px -20px rgba(94, 109, 224, 0.32),
    0 10px 30px -18px rgba(35, 52, 90, 0.3);
}

/* ---------------- 按钮 / 徽章 / 芯片 ---------------- */
html[data-theme-effective='light'] .btn {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.45));
  border-color: rgba(20, 30, 55, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 2px 8px -3px rgba(35, 52, 90, 0.18);
  color: var(--text);
}
html[data-theme-effective='light'] .btn:hover {
  border-color: rgba(124, 139, 255, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 1), 0 10px 26px -14px rgba(124, 139, 255, 0.6);
}
html[data-theme-effective='light'] .btn.ghost { background: rgba(255, 255, 255, 0.35); }
html[data-theme-effective='light'] .btn.ghost .spinner,
html[data-theme-effective='light'] .btn .spinner.light {
  border-color: rgba(20, 30, 55, 0.22);
  border-top-color: var(--text);
}

html[data-theme-effective='light'] .store-chip,
html[data-theme-effective='light'] .user-chip,
html[data-theme-effective='light'] .mode-pill,
html[data-theme-effective='light'] .dock-clock,
html[data-theme-effective='light'] .tab-mini,
html[data-theme-effective='light'] .badge {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(20, 30, 55, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* 彩色徽章在浅底上换成深色字 + 低饱和底，保证可读 */
html[data-theme-effective='light'] .badge.violet { color: #6d4fd6; background: rgba(109, 79, 214, 0.1); border-color: rgba(109, 79, 214, 0.28); }
html[data-theme-effective='light'] .badge.blue { color: #2563c9; background: rgba(37, 99, 201, 0.1); border-color: rgba(37, 99, 201, 0.26); }
html[data-theme-effective='light'] .badge.cyan { color: #0e7490; background: rgba(14, 116, 144, 0.1); border-color: rgba(14, 116, 144, 0.28); }
html[data-theme-effective='light'] .badge.emerald { color: #047857; background: rgba(4, 120, 87, 0.1); border-color: rgba(4, 120, 87, 0.26); }
html[data-theme-effective='light'] .badge.amber { color: #b45309; background: rgba(180, 83, 9, 0.1); border-color: rgba(180, 83, 9, 0.26); }
html[data-theme-effective='light'] .badge.rose { color: #be123c; background: rgba(190, 18, 60, 0.09); border-color: rgba(190, 18, 60, 0.26); }
html[data-theme-effective='light'] .risk-high { color: #be123c; }

/* ---------------- 输入控件 ---------------- */
html[data-theme-effective='light'] input,
html[data-theme-effective='light'] textarea,
html[data-theme-effective='light'] select {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(20, 30, 55, 0.12);
  box-shadow: inset 0 1px 3px rgba(31, 41, 62, 0.06);
  color: var(--text);
}
html[data-theme-effective='light'] input::placeholder,
html[data-theme-effective='light'] textarea::placeholder { color: #a0a8bb; }
html[data-theme-effective='light'] input:focus,
html[data-theme-effective='light'] textarea:focus,
html[data-theme-effective='light'] select:focus {
  background: rgba(124, 139, 255, 0.07);
  border-color: rgba(124, 139, 255, 0.6);
  box-shadow: inset 0 1px 3px rgba(31, 41, 62, 0.05), 0 0 0 4px rgba(124, 139, 255, 0.14);
}
html[data-theme-effective='light'] select option { background: #ffffff; color: #1d2536; }

/* ---------------- 浮层：菜单 / 模态 / 登录卡 ---------------- */
html[data-theme-effective='light'] .modal-panel,
html[data-theme-effective='light'] .user-menu,
html[data-theme-effective='light'] .login-card {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.92), rgba(244, 247, 252, 0.94));
  border-color: rgba(255, 255, 255, 0.95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 1), 0 28px 70px -26px rgba(35, 52, 90, 0.5);
  color: var(--text);
}
html[data-theme-effective='light'] .user-menu { background: rgba(252, 253, 255, 0.96); }
html[data-theme-effective='light'] .user-menu .menu-item:hover { background: rgba(124, 139, 255, 0.12); }
html[data-theme-effective='light'] .user-menu .menu-item.danger:hover { background: rgba(190, 18, 60, 0.1); }

/* 模块里少量写死的深色实底/深玻璃，亮主题下转浅 */
html[data-theme-effective='light'] .modal {
  background: var(--panel-solid);
  box-shadow: 0 36px 90px -24px rgba(35, 52, 90, 0.55);
}
html[data-theme-effective='light'] .letter-view,
html[data-theme-effective='light'] .attach-tile {
  background: rgba(20, 30, 55, 0.045);
  color: var(--text-2);
}
html[data-theme-effective='light'] .modal-url,
html[data-theme-effective='light'] .ts-json {
  background: rgba(20, 30, 55, 0.05);
  color: #334155;
}

/* 骨架屏 */
html[data-theme-effective='light'] .skeleton { background: rgba(55, 70, 105, 0.09); }
html[data-theme-effective='light'] .skeleton::after {
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.75) 50%, transparent 80%);
}

/* 涟漪在亮面上换成靛蓝 */
html[data-theme-effective='light'] .ripple { background: rgba(124, 139, 255, 0.22); }

/* ---------------- 主题切换器（侧栏底部） ---------------- */
.theme-switch {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 2px; padding: 3px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
}
html[data-theme-effective='light'] .theme-switch {
  background: rgba(20, 30, 55, 0.06);
  box-shadow: inset 0 1px 3px rgba(31, 41, 62, 0.08);
}
.theme-switch button {
  display: grid; place-items: center;
  height: 28px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-3);
  cursor: pointer; transition: all 0.2s var(--ease-out, ease);
}
.theme-switch button svg { width: 15px; height: 15px; }
.theme-switch button:hover { color: var(--text); }
.theme-switch button.active {
  color: var(--text);
  background: var(--accent-grad);
  box-shadow: 0 4px 14px -5px rgba(124, 139, 255, 0.7);
}
html[data-theme-effective='light'] .theme-switch button.active { color: #10142a; }

/* ---------------- 登录页亮色 ---------------- */
html[data-theme-effective='light'] .login-body { background: linear-gradient(180deg, #eef2fa, #e3e8f3); }
html[data-theme-effective='light'] .blob { opacity: 0.5; filter: saturate(0.85); }
html[data-theme-effective='light'] .bg-grid {
  background-image:
    linear-gradient(rgba(20, 30, 55, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 30, 55, 0.05) 1px, transparent 1px);
}
html[data-theme-effective='light'] .bg-noise {
  background: radial-gradient(1200px 700px at 50% 0%, transparent, rgba(226, 232, 244, 0.7));
}
html[data-theme-effective='light'] .login-tabs { background: rgba(20, 30, 55, 0.06); }
html[data-theme-effective='light'] .login-tab.active { color: #10142a; }
html[data-theme-effective='light'] .field input { background: rgba(255, 255, 255, 0.65); }

/* ---------------- 左下角用户坞 ---------------- */
.user-dock { display: flex; flex-direction: column; gap: 8px; }
.dock-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 11px; border-radius: 11px;
  border: 1px solid var(--border);
  font-size: 12px; color: var(--text-2);
}
.dock-clock { justify-content: space-between; font-variant-numeric: tabular-nums; }
.dock-clock b { color: var(--text); font-weight: 600; font-size: 12.5px; }
.dock-clock span { font-size: 11px; color: var(--text-3); }
.user-chip.dock-user {
  justify-content: flex-start; width: 100%;
  padding: 7px 10px; border-radius: 11px;
}
.user-chip.dock-user .user-email {
  flex: 1; text-align: left; min-width: 0;
}
/* 用户菜单在坞内向上展开 */
.user-menu.dock-menu {
  left: 8px; right: 8px; bottom: calc(100% + 8px); top: auto;
  min-width: 0; width: auto;
}
