:root,
:root[data-theme="green"] {
  --ink: #132238;
  --muted: #66768b;
  --line: #d8e3ee;
  --paper: rgba(255, 255, 255, .9);
  --canvas: #eef4f9;
  --green: #2563eb;
  --green2: #e8f0ff;
  --amber: #b7670d;
  --red: #c33f51;
  --blue: #315fdb;
  --accent: #4f8cff;
  --accent-rgb: 59, 130, 246;
  --sidebar-bg: #071226;
  --sidebar-active: rgba(59, 130, 246, .17);
  --topbar-bg: rgba(245, 249, 253, .76);
  --glow: rgba(37, 99, 235, .2);
  --grid: rgba(59, 130, 246, .065);
  --shadow: 0 18px 48px rgba(22, 52, 78, .1);
}

:root[data-theme="blue"] {
  --green: #3867e8;
  --green2: #e7edff;
  --accent: #6b8cff;
  --accent-rgb: 83, 121, 237;
  --canvas: #f0f3fa;
  --sidebar-bg: #08152e;
  --sidebar-active: rgba(93, 132, 255, .15);
  --glow: rgba(65, 105, 225, .17);
  --grid: rgba(66, 103, 200, .055);
}

:root[data-theme="purple"] {
  --green: #7658d8;
  --green2: #eee9ff;
  --accent: #a48aff;
  --accent-rgb: 126, 92, 218;
  --canvas: #f4f2fa;
  --sidebar-bg: #17112d;
  --sidebar-active: rgba(163, 126, 255, .15);
  --glow: rgba(124, 87, 218, .16);
  --grid: rgba(116, 83, 190, .05);
}

:root[data-theme="orange"] {
  --green: #bd6528;
  --green2: #fff0e4;
  --accent: #ef9251;
  --accent-rgb: 194, 103, 41;
  --canvas: #f8f3ef;
  --sidebar-bg: #24150e;
  --sidebar-active: rgba(239, 146, 81, .15);
  --glow: rgba(207, 108, 44, .15);
  --grid: rgba(168, 91, 39, .05);
}

html { background: var(--canvas); }

body {
  background-color: var(--canvas);
  background-image:
    radial-gradient(circle at 78% -10%, var(--glow), transparent 30rem),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: auto, 36px 36px, 36px 36px;
  background-attachment: fixed;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(118deg, rgba(255, 255, 255, .68), transparent 46%),
    radial-gradient(circle at 45% 115%, rgba(var(--accent-rgb), .08), transparent 34rem);
  content: "";
}

::selection { background: rgba(var(--accent-rgb), .22); }
* { scrollbar-color: rgba(var(--accent-rgb), .38) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 10px;
  background: rgba(var(--accent-rgb), .42);
  background-clip: padding-box;
}

.sidebar {
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 2%, rgba(var(--accent-rgb), .24), transparent 17rem),
    linear-gradient(180deg, #0d2138 0%, var(--sidebar-bg) 52%, #050d19 100%) !important;
  border-right: 1px solid rgba(96, 165, 250, .2);
  box-shadow: 18px 0 60px rgba(4, 13, 26, .15);
}

.sidebar::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .32;
  background-image:
    linear-gradient(rgba(96, 165, 250, .09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 165, 250, .09) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, #000, transparent 74%);
  content: "";
}

.sidebar::after {
  position: absolute;
  right: -70px;
  bottom: 10%;
  width: 150px;
  height: 150px;
  border: 1px solid rgba(var(--accent-rgb), .13);
  border-radius: 50%;
  box-shadow: 0 0 0 30px rgba(var(--accent-rgb), .025), 0 0 0 60px rgba(var(--accent-rgb), .018);
  content: "";
}

.sidebar > * { position: relative; z-index: 1; }

.brand {
  margin: 0 2px 18px;
  padding: 5px 5px 26px;
  border-bottom: 1px solid rgba(151, 207, 218, .1);
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(145deg, #93c5fd 0%, var(--accent) 48%, var(--green) 100%) !important;
  color: #05142b !important;
  box-shadow: 0 0 0 1px rgba(191, 219, 254, .5), 0 12px 30px rgba(var(--accent-rgb), .3), inset 0 1px rgba(255, 255, 255, .7);
}

.brand-mark::before {
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(255, 255, 255, .42);
  border-radius: 7px;
  content: "";
}

.brand-mark i { position: relative; font: 900 18px/1 ui-sans-serif, system-ui; font-style: normal; }
.brand strong { color: #f4fcff; letter-spacing: .7px; }
.brand small { margin-top: 3px; color: rgba(194, 221, 228, .56); font-size: 9px; letter-spacing: .55px; }

.sidebar nav a {
  position: relative;
  border: 1px solid transparent;
  color: rgba(207, 225, 231, .68);
  transition: color .18s ease, background .18s ease, border-color .18s ease, transform .18s ease;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: var(--sidebar-active) !important;
  border-color: rgba(var(--accent-rgb), .24);
  color: #f5fdff;
  transform: translateX(2px);
}

.sidebar nav a.active::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: -1px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
  content: "";
}

.sidebar nav a > span { color: rgba(147, 197, 253, .86); }
.nav-group { border-color: rgba(96, 165, 250, .18) !important; }
.nav-group-title { color: rgba(219, 235, 239, .78); }

.sidebar-foot {
  gap: 10px;
  border-color: rgba(96, 165, 250, .18) !important;
  color: rgba(204, 225, 230, .7);
}

.sidebar-foot > span:last-child { display: grid; gap: 2px; }
.sidebar-foot b { color: rgba(232, 246, 248, .86); font-size: 11px; }
.sidebar-foot small { color: rgba(176, 204, 212, .46); font-size: 9px; letter-spacing: .45px; }
.status-dot { background: #60a5fa !important; box-shadow: 0 0 0 4px rgba(96, 165, 250, .14), 0 0 16px rgba(59, 130, 246, .82) !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  background: var(--topbar-bg) !important;
  border-bottom-color: rgba(var(--accent-rgb), .13);
  box-shadow: 0 10px 30px rgba(31, 60, 84, .035);
  backdrop-filter: none;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 1.7px;
}

.eyebrow span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 9px var(--accent);
}

h1, h2 { color: var(--ink); font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif !important; }
h1 { font-weight: 750; letter-spacing: -.45px; }
h2 { font-weight: 720; letter-spacing: -.25px; }

.top-actions {
  padding: 5px 6px 5px 14px;
  border: 1px solid rgba(139, 163, 185, .2);
  border-radius: 14px;
  background: rgba(255, 255, 255, .62);
  box-shadow: 0 8px 22px rgba(31, 61, 84, .045);
}

.header-settings,
.icon-settings {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(var(--accent-rgb), .18);
  border-radius: 10px;
  background: rgba(255, 255, 255, .82);
  color: var(--green);
  box-shadow: 0 4px 12px rgba(31, 64, 91, .04);
  cursor: pointer;
  font-size: 18px;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.icon-settings.small { width: 34px; height: 34px; font-size: 16px; }
.avatar { border: 1px solid rgba(var(--accent-rgb), .2); background: linear-gradient(145deg, var(--green2), #fff); color: var(--green); box-shadow: 0 6px 16px var(--glow); }
.page { position: relative; }

.card,
.stat {
  border-color: rgba(var(--accent-rgb), .13);
  background: linear-gradient(145deg, rgba(255, 255, 255, .96), rgba(247, 251, 253, .88));
  box-shadow: 0 10px 32px rgba(27, 59, 83, .055), inset 0 1px rgba(255, 255, 255, .82);
}

.card { overflow: hidden; }
.card-head { background: linear-gradient(90deg, rgba(var(--accent-rgb), .04), rgba(255, 255, 255, .88)); }
.stat { position: relative; overflow: hidden; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.stat::before { position: absolute; inset: 0 auto 0 0; width: 3px; background: linear-gradient(180deg, #93c5fd, var(--green)); content: ""; }
.stat::after { position: absolute; top: -42px; right: -38px; width: 86px; height: 86px; border: 1px solid var(--glow); border-radius: 50%; content: ""; }
.stat:hover { transform: translateY(-2px); border-color: rgba(var(--accent-rgb), .3); box-shadow: 0 15px 36px rgba(26, 60, 85, .085); }
.stat .value { color: var(--ink); font-family: Inter, "Microsoft YaHei", sans-serif; font-weight: 750; letter-spacing: -.8px; }

.button {
  border-color: rgba(var(--accent-rgb), .18);
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 4px 11px rgba(31, 64, 90, .035);
  transition: transform .15s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.button:hover,
.header-settings:hover,
.icon-settings:hover { transform: translateY(-1px); border-color: rgba(var(--accent-rgb), .4); background: #fff; box-shadow: 0 8px 19px var(--glow); }
.button.primary { border-color: transparent; background: linear-gradient(135deg, #4f8cff, var(--green)); color: #fff; box-shadow: 0 8px 19px rgba(var(--accent-rgb), .3), inset 0 1px rgba(255, 255, 255, .24); }
.button.primary:hover { background: linear-gradient(135deg, #60a5fa, #1d4ed8); box-shadow: 0 11px 25px rgba(var(--accent-rgb), .36); }
.button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.search,
input,
select,
textarea,
.editor { border-color: #ccd9e4; background-color: rgba(255, 255, 255, .9); }

.search:focus,
input:focus,
select:focus,
textarea:focus,
.editor:focus { border-color: #3b82f6 !important; outline-color: #3b82f6 !important; box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .14), 0 7px 18px rgba(30, 64, 175, .08) !important; }

.table th { background: linear-gradient(180deg, #f7fafc, #eff5f8); color: #60758a; }
.table tr:hover td { background: rgba(var(--accent-rgb), .035); }
.badge { border: 1px solid rgba(117, 142, 161, .11); }
.badge.active,
.badge.sent,
.badge.completed { border-color: rgba(var(--accent-rgb), .17); background: rgba(var(--accent-rgb), .1); color: var(--green); }
.progress span { background: linear-gradient(90deg, var(--green), var(--accent)); box-shadow: 0 0 9px var(--glow); }

.quick { border-color: rgba(var(--accent-rgb), .13); box-shadow: 0 6px 20px rgba(30, 63, 88, .035); transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.quick:hover { transform: translateY(-2px); border-color: rgba(var(--accent-rgb), .33); box-shadow: 0 12px 25px rgba(30, 63, 88, .075); }
.quick-icon { background: linear-gradient(145deg, var(--green2), #fff); }
.notice { border: 1px solid rgba(var(--accent-rgb), .16); border-left: 3px solid var(--green); background: linear-gradient(90deg, rgba(var(--accent-rgb), .065), rgba(255, 255, 255, .78)); }

.modal-backdrop { padding: clamp(20px, 5vw, 64px); background: rgba(3, 12, 25, .72); backdrop-filter: none; }
.modal { width: min(780px, 100%); max-height: 90vh; border: 1px solid rgba(96, 165, 250, .24); box-shadow: 0 28px 72px rgba(2, 11, 25, .42); }
.modal.wide { width: min(1120px, 100%); }
.modal-head,
.modal-foot { background: #f9fcfe; backdrop-filter: none; }
.toast:not(.error) { border: 1px solid rgba(96, 165, 250, .34) !important; background: linear-gradient(135deg, #123c7a, #0a2147) !important; box-shadow: 0 18px 45px rgba(3, 18, 45, .34) !important; }

/* 云端基础页面仍可能携带旧绿色硬编码；桌面注入此文件后统一覆盖为蓝色科技主题。 */
.avatar { background: linear-gradient(145deg, #e8f0ff, #fff) !important; }
.badge.active,
.badge.sent,
.badge.completed { background: #e6efff !important; color: #1d4ed8 !important; }
.quick-icon { background: linear-gradient(145deg, #e8f0ff, #fff) !important; color: #2563eb !important; }
.var { border-color: #b7cdfa !important; background: #edf3ff !important; color: #1d4ed8 !important; }
.notice:not(.warn) { background: linear-gradient(90deg, #eaf2ff, rgba(255, 255, 255, .84)) !important; color: #334e78 !important; }
.chart-bar .ok { background: #3b82f6 !important; }
.editor-toolbar button:hover,
.table tr:hover td,
[data-enter-matching-batch]:hover td { background: #f1f6ff !important; }
.column-resizer:hover::after,
.column-resizer.active::after { background: #3b82f6 !important; }
.operation-status::before { border-color: #bfdbfe; border-top-color: #2563eb; }

.theme-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.theme-option { border: 2px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; cursor: pointer; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.theme-option:hover { transform: translateY(-2px); }
.theme-option.active { border-color: var(--green); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .11), 0 8px 20px var(--glow); }
.theme-swatch { display: block; height: 34px; margin-bottom: 7px; border-radius: 8px; }
[data-theme-choice="green"] .theme-swatch { background: linear-gradient(135deg, #60a5fa, #2563eb) !important; }
[data-theme-choice="blue"] .theme-swatch { background: linear-gradient(135deg, #3b82f6, #1e40af) !important; }
.mailbox-link { border: 0; padding: 0; background: transparent; color: var(--green); cursor: pointer; font: inherit; text-align: left; }
.stat-link { display: block; width: 100%; color: inherit; text-decoration: none; cursor: pointer; text-align: left; font: inherit; }
.stat-link:focus-visible { outline: 3px solid rgba(var(--accent-rgb), .24); outline-offset: 2px; }
.task-progress-counts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.task-progress-counts .success { color: var(--green); }
.task-progress-counts .failure { color: var(--red); }
.table tr.smtp-binding-failed > td { border-bottom-color: #f3b8b3; background: #fff0ef !important; }
.table tr.smtp-binding-failed > td:first-child { box-shadow: inset 4px 0 0 var(--red); }
.table tr.smtp-binding-failed:hover > td { background: #ffe7e5 !important; }
.smtp-binding-error { color: var(--red); font-weight: 650; line-height: 1.5; }
.operation-status { display: inline-flex; align-items: center; gap: 8px; margin-right: auto; color: var(--green); font-size: 12px; }
.operation-status::before { width: 12px; height: 12px; border: 2px solid rgba(var(--accent-rgb), .22); border-top-color: var(--green); border-radius: 50%; animation: operation-spin .8s linear infinite; content: ""; }

@keyframes operation-spin { to { transform: rotate(360deg); } }

@media (max-width: 650px) {
  .top-actions { gap: 8px; padding-left: 8px; }
  .theme-options { grid-template-columns: repeat(2, 1fr); }
  .brand { border-bottom: 0; }
}

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