/* ============================================================
   客户管理系统 - 全局样式
   现代商务风 · 浅色/深色主题 · 主题色定制
   ============================================================ */

/* ---------- 主题变量 ---------- */
:root {
  --primary: #4f6bf6;
  --primary-hover: #3d56d9;
  --primary-soft: rgba(79, 107, 246, .1);
  --primary-soft-2: rgba(79, 107, 246, .16);

  --bg: #f3f5fa;
  --bg-card: #ffffff;
  --bg-hover: #f6f8fc;
  --bg-sidebar: #111a2e;
  --bg-sidebar-hover: rgba(255, 255, 255, .06);
  --bg-sidebar-active: rgba(255, 255, 255, .1);
  --bg-input: #ffffff;
  --bg-popover: #ffffff;
  --bg-mask: rgba(15, 23, 42, .5);

  --border: #e5e9f2;
  --border-strong: #d4dae8;

  --text: #1a2233;
  --text-secondary: #5a6478;
  --text-muted: #8a93a8;
  --text-invert: #ffffff;
  --text-sidebar: #aab4cc;
  --text-sidebar-active: #ffffff;

  --success: #10a05f;
  --warning: #d98a12;
  --danger: #e5484d;
  --info: #2f7ff9;
  --violet: #8156e8;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18);
  --shadow-primary: 0 6px 16px -4px rgba(79, 107, 246, .4);

  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 236px;
  --sidebar-w-collapsed: 64px;
  --topbar-h: 60px;
}

html[data-theme="dark"] {
  --bg: #0c1220;
  --bg-card: #131b2e;
  --bg-hover: #1a2439;
  --bg-sidebar: #0a101d;
  --bg-sidebar-hover: rgba(255, 255, 255, .05);
  --bg-sidebar-active: rgba(255, 255, 255, .09);
  --bg-input: #0f1729;
  --bg-popover: #161f35;
  --bg-mask: rgba(2, 6, 16, .66);

  --border: #232e47;
  --border-strong: #31405f;

  --text: #e6eaf4;
  --text-secondary: #a3adc4;
  --text-muted: #6b7590;
  --text-invert: #ffffff;
  --text-sidebar: #8d97b1;
  --text-sidebar-active: #ffffff;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 2px 8px rgba(0, 0, 0, .45);
  --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, .6);
}

/* ---------- 主题色映射（服务端输出 data-theme-color 即可生效，无需依赖 JS） ---------- */
html[data-theme-color="indigo"]  { --primary: #4f6bf6; --primary-hover: rgb(67, 91, 209);  --primary-soft: rgba(79, 107, 246, .1);  --primary-soft-2: rgba(79, 107, 246, .16);  --shadow-primary: 0 6px 16px -4px rgba(79, 107, 246, .4); }
html[data-theme-color="blue"]    { --primary: #2f7ff9; --primary-hover: rgb(40, 108, 212); --primary-soft: rgba(47, 127, 249, .1);  --primary-soft-2: rgba(47, 127, 249, .16);  --shadow-primary: 0 6px 16px -4px rgba(47, 127, 249, .4); }
html[data-theme-color="cyan"]    { --primary: #0ea5b7; --primary-hover: rgb(12, 140, 156); --primary-soft: rgba(14, 165, 183, .1);  --primary-soft-2: rgba(14, 165, 183, .16);  --shadow-primary: 0 6px 16px -4px rgba(14, 165, 183, .4); }
html[data-theme-color="teal"]    { --primary: #0d9d8c; --primary-hover: rgb(11, 133, 119); --primary-soft: rgba(13, 157, 140, .1);  --primary-soft-2: rgba(13, 157, 140, .16);  --shadow-primary: 0 6px 16px -4px rgba(13, 157, 140, .4); }
html[data-theme-color="emerald"] { --primary: #10a05f; --primary-hover: rgb(14, 136, 81);  --primary-soft: rgba(16, 160, 95, .1);   --primary-soft-2: rgba(16, 160, 95, .16);   --shadow-primary: 0 6px 16px -4px rgba(16, 160, 95, .4); }
html[data-theme-color="violet"]  { --primary: #8156e8; --primary-hover: rgb(110, 73, 197); --primary-soft: rgba(129, 86, 232, .1);  --primary-soft-2: rgba(129, 86, 232, .16);  --shadow-primary: 0 6px 16px -4px rgba(129, 86, 232, .4); }
html[data-theme-color="rose"]    { --primary: #e34d70; --primary-hover: rgb(193, 65, 95);  --primary-soft: rgba(227, 77, 112, .1);  --primary-soft-2: rgba(227, 77, 112, .16);  --shadow-primary: 0 6px 16px -4px rgba(227, 77, 112, .4); }
html[data-theme-color="amber"]   { --primary: #d98a12; --primary-hover: rgb(184, 117, 15); --primary-soft: rgba(217, 138, 18, .1);  --primary-soft-2: rgba(217, 138, 18, .16);  --shadow-primary: 0 6px 16px -4px rgba(217, 138, 18, .4); }
html[data-theme-color="slate"]   { --primary: #47566e; --primary-hover: rgb(60, 73, 94);   --primary-soft: rgba(71, 86, 110, .1);   --primary-soft-2: rgba(71, 86, 110, .16);   --shadow-primary: 0 6px 16px -4px rgba(71, 86, 110, .4); }

/* ---------- Reset ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; }
::selection { background: var(--primary-soft-2); }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 图标 ---------- */
[data-icon] { display: inline-flex; width: 1em; height: 1em; vertical-align: -0.125em; }
[data-icon] svg { width: 100%; height: 100%; }
/* 直接插入（不经过 data-icon 容器）的图标按字号缩放，避免被撑大 */
svg.ic { width: 1em; height: 1em; flex-shrink: 0; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; stroke: currentColor; }

/* ============================================================
   布局
   ============================================================ */
.app-layout { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  transition: width .22s ease, transform .22s ease;
}
.app-layout.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }

.sidebar-brand {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h); padding: 0 16px; flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  overflow: hidden; white-space: nowrap;
}
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px; object-fit: cover; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff; background: linear-gradient(135deg, var(--primary), #7a5cf0);
}
.brand-logo svg.ic { width: 18px; height: 18px; }
.brand-name { font-weight: 600; font-size: 15px; color: #fff; opacity: 0; transition: opacity .18s; }
.app-layout:not(.sidebar-collapsed) .brand-name { opacity: 1; }
.sidebar-collapse-btn {
  margin-left: auto; background: none; border: none; color: var(--text-sidebar);
  width: 26px; height: 26px; border-radius: 6px; cursor: pointer; font-size: 15px;
  display: none; align-items: center; justify-content: center;
}
.app-layout:not(.sidebar-collapsed) .sidebar-collapse-btn { display: inline-flex; }
.sidebar-collapse-btn:hover { background: var(--bg-sidebar-hover); color: #fff; }
/* 折叠态：收起按钮转为悬浮在侧边栏右缘的展开手柄，始终可点击 */
.app-layout.sidebar-collapsed .sidebar-collapse-btn {
  display: inline-flex;
  position: absolute; right: -13px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg-sidebar); border: 1px solid var(--border-strong);
  color: #fff; box-shadow: var(--shadow-sm); z-index: 5;
}
.app-layout.sidebar-collapsed .sidebar-collapse-btn:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.app-layout.sidebar-collapsed .sidebar-collapse-btn [data-icon] { transform: rotate(180deg); }
/* 折叠态隐藏文字名称，让 Logo 居中显示 */
.app-layout.sidebar-collapsed .brand-name { display: none; }
.app-layout.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; overflow: visible; }

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 10px; }
.nav-group { margin-bottom: 4px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px; color: var(--text-sidebar);
  font-size: 13.5px; cursor: pointer; position: relative;
  transition: background .15s, color .15s;
  white-space: nowrap; overflow: hidden;
}
.nav-item:hover { background: var(--bg-sidebar-hover); color: var(--text-sidebar-active); }
.nav-item.active { background: var(--bg-sidebar-active); color: var(--text-sidebar-active); }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px; border-radius: 2px; background: var(--primary);
}
.nav-icon { font-size: 17px; display: inline-flex; width: 20px; justify-content: center; flex-shrink: 0; }
.nav-label { overflow: hidden; text-overflow: ellipsis; }
.nav-arrow { margin-left: auto; font-size: 13px; transition: transform .18s; opacity: .7; }
.nav-group-title { user-select: none; }
.nav-group-title.group-active > .nav-arrow { transform: rotate(180deg); }
.nav-group-title.group-active { color: var(--text-sidebar-active); }

.nav-sub { max-height: 0; overflow: hidden; transition: max-height .22s ease; }
.nav-group-title.group-active + .nav-sub,
.nav-group:has(> .nav-sub > .nav-item.active) > .nav-sub { max-height: 300px; }
.nav-sub .nav-item { padding-left: 42px; font-size: 13px; padding-top: 7px; padding-bottom: 7px; }
.nav-sub .nav-item.active::before { top: 25%; bottom: 25%; }

.app-layout.sidebar-collapsed .nav-label,
.app-layout.sidebar-collapsed .nav-arrow { display: none; }
.app-layout.sidebar-collapsed .nav-sub { display: none; }
.app-layout.sidebar-collapsed .nav-item { justify-content: center; padding: 11px 0; }
.app-layout.sidebar-collapsed .nav-sub .nav-item { display: none; }

.sidebar-footer { padding: 14px 16px; color: var(--text-sidebar); font-size: 11px; opacity: .55; border-top: 1px solid rgba(255,255,255,.06); white-space: nowrap; overflow: hidden; }

.sidebar-mask { display: none; }

/* ---------- 主区域 ---------- */
.main-area {
  flex: 1; margin-left: var(--sidebar-w);
  display: flex; flex-direction: column; min-width: 0;
  transition: margin-left .22s ease;
}
.app-layout.sidebar-collapsed .main-area { margin-left: var(--sidebar-w-collapsed); }

/* ---------- 顶栏 ---------- */
.topbar {
  height: var(--topbar-h); background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  position: sticky; top: 0; z-index: 90;
}
.topbar-title { font-size: 16px; font-weight: 600; margin-right: auto; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }

.topbar-btn {
  width: 38px; height: 38px; border-radius: 10px; border: none; background: transparent;
  color: var(--text-secondary); font-size: 18px; cursor: pointer; position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.topbar-btn:hover { background: var(--bg-hover); color: var(--text); }
#sidebarToggle { display: none; }
html[data-theme="dark"] .only-light { display: none; }
html:not([data-theme="dark"]) .only-dark { display: none; }

.notify-badge {
  position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px;
  border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 600; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1;
  border: 2px solid var(--bg-card);
}
/* display 覆盖了 UA 的 [hidden] 规则，需显式恢复隐藏 */
.notify-badge[hidden] { display: none; }

/* 用户按钮 */
.user-btn {
  display: flex; align-items: center; gap: 8px; border: none; background: transparent;
  padding: 4px 8px 4px 4px; border-radius: 999px; cursor: pointer; color: var(--text);
}
.user-btn:hover { background: var(--bg-hover); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #7a5cf0);
  color: #fff; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-avatar-lg { width: 42px; height: 42px; font-size: 16px; }
.user-name { font-size: 13px; font-weight: 500; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.user-arrow { font-size: 12px; color: var(--text-muted); }

/* 弹出层（通知/主题/用户） */
.topbar-popover-wrap { position: relative; }
.topbar-popover {
  position: absolute; top: calc(100% + 8px); right: 0; width: 340px;
  background: var(--bg-popover); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  overflow: hidden; animation: popIn .16s ease;
  z-index: 200;
}
@keyframes popIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
.popover-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13.5px;
}
.popover-body { max-height: 380px; overflow-y: auto; }
.popover-footer { padding: 8px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }

.notify-item { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; cursor: pointer; transition: background .15s, transform .18s ease; background: var(--bg-popover); position: relative; z-index: 1; touch-action: pan-y; }
.notify-item:hover { background: var(--bg-hover); }
.notify-swipe:last-child .notify-item { border-bottom: none; }
#dashNotifications .notify-item:last-child { border-bottom: none; }
/* 左滑删除 */
.notify-swipe { position: relative; overflow: hidden; }
.notify-del {
  position: absolute; inset: 0 0 0 auto; width: 64px; border: none; cursor: pointer;
  background: var(--danger); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.notify-del svg.ic { width: 16px; height: 16px; }
.notify-item.swiped { transform: translateX(-64px); }
.notify-item.unread .notify-title { color: var(--primary); }
.notify-icon-sm {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.notify-icon-sm svg.ic { width: 14px; height: 14px; }
.notify-icon-sm.t-follow { background: rgba(47, 127, 249, .14); color: var(--info); }
.notify-icon-sm.t-renew { background: rgba(217, 138, 18, .14); color: var(--warning); }
.notify-icon-sm.t-todo { background: rgba(129, 86, 232, .14); color: var(--violet); }
.notify-title { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.notify-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); flex-shrink: 0; }
.notify-content { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.notify-time { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }

/* 主题选择 */
.theme-popover { width: 280px; }
.theme-mode-row { display: flex; gap: 8px; padding: 14px 16px 6px; }
.theme-mode-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-secondary); cursor: pointer; font-size: 13px;
  transition: all .15s;
}
.theme-mode-btn:hover { border-color: var(--primary); color: var(--primary); }
.theme-mode-btn.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.theme-color-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; padding: 12px 16px 16px; }
/* 设置页主题色单行排列 */
#settingsColorGrid { display: flex; flex-wrap: wrap; gap: 10px; padding: 0; }
.theme-color-dot {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer;
  background: var(--dot); position: relative; transition: transform .15s;
  outline: 2px solid transparent; outline-offset: 2px;
}
.theme-color-dot:hover { transform: scale(1.12); }
.theme-color-dot.active { outline-color: var(--dot); }
.theme-color-dot.active::after {
  content: "✓"; position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; color: #fff; font-size: 13px; font-weight: 700;
}

/* 用户弹出菜单 */
.user-popover { width: 240px; }
.user-popover-info { display: flex; flex-direction: column; }
.user-popover-info b { font-size: 14px; }
.user-popover-info span { font-size: 12px; color: var(--text-muted); }
.popover-menu {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 16px; background: none; border: none; cursor: pointer;
  color: var(--text-secondary); font-size: 13.5px; transition: all .15s;
}
.popover-menu:hover { background: var(--bg-hover); color: var(--text); }
.popover-menu-danger:hover { color: var(--danger); background: rgba(229, 72, 77, .08); }

/* ---------- 内容区 ---------- */
.content { flex: 1; padding: 22px; max-width: 1600px; width: 100%; margin: 0 auto; }
.page { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ============================================================
   通用组件
   ============================================================ */

/* ---------- 面板/卡片 ---------- */
.panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 18px;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.panel-header h2 { font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.panel-header h2 [data-icon] { color: var(--primary); }
.panel-body { padding: 18px; }
.panel-badge { font-size: 12px; color: var(--primary); background: var(--primary-soft); padding: 2px 10px; border-radius: 999px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 9px; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 500; cursor: pointer; transition: all .15s;
  white-space: nowrap; line-height: 1.5;
}
.btn [data-icon] { font-size: 15px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-ghost { background: var(--bg-card); border-color: var(--border-strong); color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-danger-ghost:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); background: rgba(229, 72, 77, .07); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-text { background: none; border: none; color: var(--primary); font-size: 12.5px; cursor: pointer; padding: 2px 4px; }
.btn-text:hover { text-decoration: underline; }
.btn-text.danger { color: var(--danger); }

/* ---------- 表单 ---------- */
.input, .select, .textarea {
  width: 100%; padding: 8px 12px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--bg-input);
  color: var(--text); font-size: 13.5px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.input:disabled { background: var(--bg-hover); color: var(--text-muted); cursor: not-allowed; }
.textarea { min-height: 88px; resize: vertical; font-family: inherit; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a93a8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; cursor: pointer; }
.select-sm { padding: 4px 26px 4px 8px; font-size: 12.5px; border-radius: 7px; width: auto; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-grid-narrow { grid-template-columns: 300px 1fr; }
.form-item { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-item label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.form-item .required { color: var(--danger); }
.form-item.span-2 { grid-column: span 2; }
.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border); }
.hint-text { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.hint-text [data-icon] { font-size: 13px; flex-shrink: 0; }
.hint-block {
  font-size: 12.5px; color: var(--text-secondary); background: var(--primary-soft);
  border: 1px solid var(--primary-soft-2); padding: 10px 14px; border-radius: 9px;
  margin-bottom: 16px; display: flex; align-items: flex-start; gap: 8px;
}
.hint-block [data-icon] { color: var(--primary); flex-shrink: 0; margin-top: 2px; }
.text-danger { color: var(--danger); }

/* 密码强度条 */
.pwd-input-wrap { position: relative; }
.pwd-strength { display: flex; gap: 4px; margin-top: 6px; }
.pwd-strength i { flex: 1; height: 4px; border-radius: 2px; background: var(--border); transition: background .2s; }
.pwd-strength.s1 i:nth-child(1) { background: var(--danger); }
.pwd-strength.s2 i:nth-child(-n+2) { background: var(--warning); }
.pwd-strength.s3 i:nth-child(-n+3) { background: var(--info); }
.pwd-strength.s4 i { background: var(--success); }

/* 开关 */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; cursor: pointer; inset: 0; border-radius: 999px;
  background: var(--border-strong); transition: .2s;
}
.switch-slider::before {
  content: ""; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .switch-slider { background: var(--primary); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); }

/* 复选框 */
.checkbox { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13.5px; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.check-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding-top: 6px; }
.checkbox-hint { font-size: 12px; color: var(--text-muted); }

/* ---------- 分段选项卡 ---------- */
.seg-tabs { display: inline-flex; background: var(--bg-hover); border-radius: 10px; padding: 3px; gap: 2px; }
.form-item .seg-tabs { align-self: flex-start; }
.seg-tab {
  border: none; background: transparent; color: var(--text-secondary);
  padding: 5px 12px; border-radius: 8px; cursor: pointer; font-size: 12.5px;
  display: inline-flex; align-items: center; gap: 5px; transition: all .15s; white-space: nowrap;
}
.seg-tab:hover { color: var(--text); }
.seg-tab.active { background: var(--bg-card); color: var(--primary); font-weight: 500; box-shadow: var(--shadow-sm); }
.seg-tab [data-icon] { font-size: 14px; }

/* 分类页签 */
.cat-tabs {
  display: flex; gap: 6px; margin-bottom: 16px; background: var(--bg-card);
  border: 1px solid var(--border); padding: 5px; border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow-x: auto;
}
.cat-tab {
  padding: 8px 20px; border-radius: 9px; font-size: 13.5px; color: var(--text-secondary);
  white-space: nowrap; transition: all .15s;
}
.cat-tab:hover { color: var(--primary); background: var(--primary-soft); }
.cat-tab.active { background: var(--primary); color: #fff; font-weight: 500; box-shadow: var(--shadow-primary); }

/* ---------- 工具栏 ---------- */
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.search-box {
  position: relative; width: 280px; max-width: 100%;
}
.search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 15px; pointer-events: none;
}
.search-input {
  width: 100%; padding: 8px 12px 8px 34px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--text);
  font-size: 13.5px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* 下拉菜单 */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 170px;
  background: var(--bg-popover); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 5px; z-index: 150; animation: popIn .15s ease;
}
.dropdown-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 12px; border: none; background: none; border-radius: 7px;
  color: var(--text-secondary); font-size: 13px; cursor: pointer; transition: all .13s;
  text-align: left;
}
.dropdown-item:hover { background: var(--primary-soft); color: var(--primary); }
.dropdown-item [data-icon] { font-size: 15px; }

/* ============================================================
   表格
   ============================================================ */
.table-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden;
}
.table-scroll { overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 700px; }
.data-table th {
  text-align: left; padding: 11px 14px; background: var(--bg-hover);
  color: var(--text-secondary); font-weight: 600; font-size: 12.5px;
  white-space: nowrap; border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
.data-table td {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle; color: var(--text); max-width: 240px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }
.table-loading { text-align: center; color: var(--text-muted); padding: 40px 0 !important; }
/* 批量删除复选框列 */
.col-check { width: 34px; text-align: center; }
.col-check input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; vertical-align: middle; }

/* 圆点标记（弹窗填写项有内容时） */
.cell-modal-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; color: var(--primary); cursor: pointer;
  font-size: 13px; padding: 0; font-family: inherit;
}
.cell-modal-btn:hover { text-decoration: underline; }
.dot-mark {
  width: 8px; height: 8px; border-radius: 50%; background: var(--primary);
  display: inline-block; flex-shrink: 0; box-shadow: 0 0 0 3px var(--primary-soft);
}
.cell-count {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; color: var(--primary); cursor: pointer; font-size: 13px; padding: 0; font-family: inherit;
}
.cell-count:hover { text-decoration: underline; }
.cell-count .count-badge {
  background: var(--primary-soft); color: var(--primary);
  font-size: 11px; padding: 1px 7px; border-radius: 999px; font-weight: 600;
}

/* 标签徽章 */
.tag-badge {
  display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.tag-potential { background: rgba(47, 127, 249, .12); color: #2563c9; }
.tag-following { background: rgba(217, 138, 18, .14); color: #b47409; }
.tag-high { background: rgba(129, 86, 232, .13); color: #6d3fd4; }
.tag-reject { background: rgba(138, 147, 168, .16); color: #64748b; }
.tag-dealt { background: rgba(16, 160, 95, .13); color: #0b7d4a; }
html[data-theme="dark"] .tag-potential { color: #6ba3ff; }
html[data-theme="dark"] .tag-following { color: #f0b34e; }
html[data-theme="dark"] .tag-high { color: #a98df5; }
html[data-theme="dark"] .tag-reject { color: #9aa5bb; }
html[data-theme="dark"] .tag-dealt { color: #4ade80; }

.badge {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.badge-emerald { background: rgba(16, 160, 95, .13); color: #0b7d4a; }
.badge-red { background: rgba(229, 72, 77, .12); color: #d3363b; }
.badge-amber { background: rgba(217, 138, 18, .14); color: #b47409; }
.badge-slate { background: rgba(138, 147, 168, .16); color: #64748b; }
html[data-theme="dark"] .badge-emerald { color: #4ade80; }
html[data-theme="dark"] .badge-red { color: #ff8084; }
html[data-theme="dark"] .badge-amber { color: #f0b34e; }

/* 到期日高亮 */
.expire-soon { color: var(--warning); font-weight: 600; }
.expire-over { color: var(--danger); font-weight: 600; }

/* 行操作按钮 */
.row-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 26px; height: 26px; border-radius: 7px; border: none; background: transparent;
  color: var(--text-muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: all .13s;
}
.icon-btn svg.ic { width: 13px; height: 13px; }
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); }
.icon-btn.danger:hover { background: rgba(229, 72, 77, .1); color: var(--danger); }

/* 缩略图 */
.thumb-img {
  width: 42px; height: 42px; border-radius: 8px; object-fit: cover;
  border: 1px solid var(--border); cursor: pointer; transition: transform .15s;
  display: block; background: var(--bg-hover);
}
.thumb-img:hover { transform: scale(1.06); }
.file-link {
  display: inline-flex; align-items: center; gap: 5px; color: var(--primary); font-size: 12.5px;
}
.file-link:hover { text-decoration: underline; }

/* ---------- 表格底部/分页 ---------- */
.table-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap;
}
.table-info { font-size: 12.5px; color: var(--text-muted); }
.table-pagination { display: flex; align-items: center; gap: 14px; }
.perpage-wrap { font-size: 12.5px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 5px; }

.pager { display: flex; gap: 4px; }
.page-btn {
  min-width: 30px; height: 30px; padding: 0 6px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--bg-card);
  color: var(--text-secondary); font-size: 12.5px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; transition: all .13s;
}
.page-btn:hover:not(:disabled):not(.active) { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-ellipsis { color: var(--text-muted); padding: 0 2px; font-size: 12px; }

/* ============================================================
   模态框
   ============================================================ */
.modal-mask {
  position: fixed; inset: 0; background: var(--bg-mask);
  display: flex; align-items: center; justify-content: center; z-index: 500;
  padding: 20px; animation: maskIn .18s ease;
  backdrop-filter: blur(2px);
}
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-card); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 640px; max-width: 100%; max-height: 90vh; display: flex; flex-direction: column;
  animation: modalIn .2s cubic-bezier(.2, .9, .3, 1.2);
}
.modal.modal-lg { width: 900px; }
.modal.modal-sm { width: 440px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-title { font-size: 15.5px; font-weight: 600; }
.modal-close {
  width: 28px; height: 28px; border-radius: 8px; border: none; background: transparent;
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .13s;
}
.modal-close svg.ic { width: 13px; height: 13px; }
.modal-close:hover { background: var(--bg-hover); color: var(--danger); }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 22px; border-top: 1px solid var(--border); flex-shrink: 0;
}

/* 模态框内表单两列 */
.modal .form-grid { grid-template-columns: 1fr 1fr; }
.modal .form-item.span-2, .modal .form-item[data-span="2"] { grid-column: span 2; }

/* ---------- 官方店铺编辑器 ---------- */
.store-editor { display: flex; flex-direction: column; gap: 10px; }
.store-add-row { display: flex; gap: 8px; }
.store-add-row .select { flex-shrink: 0; width: 130px; }
.store-add-row .contact-type-select { width: 88px; }
.store-list { display: flex; flex-direction: column; gap: 7px; }
.store-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  background: var(--bg-hover); border-radius: 8px; font-size: 13px;
}
.store-item .store-type-tag {
  background: var(--primary-soft); color: var(--primary);
  padding: 1px 9px; border-radius: 999px; font-size: 12px; flex-shrink: 0; font-weight: 500;
}
.store-item .store-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-empty { font-size: 12.5px; color: var(--text-muted); }

/* ---------- 图片/文件上传组件 ---------- */
.upload-box {
  border: 1.5px dashed var(--border-strong); border-radius: 10px;
  padding: 14px; display: flex; align-items: center; gap: 14px; transition: border-color .15s;
  background: var(--bg-hover);
}
.upload-box:hover { border-color: var(--primary); }
.upload-thumb {
  width: 56px; height: 56px; border-radius: 9px; object-fit: cover;
  border: 1px solid var(--border); background: var(--bg-card); flex-shrink: 0;
}
.upload-thumb-placeholder {
  width: 56px; height: 56px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); background: var(--bg-card);
  border: 1px dashed var(--border-strong);
}
.upload-thumb-placeholder svg.ic { width: 19px; height: 19px; }
.upload-info { flex: 1; min-width: 0; }
.upload-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-hint { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.upload-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 9px; padding: 11px 18px;
  background: var(--bg-popover); color: var(--text); border-radius: 10px;
  box-shadow: var(--shadow-lg); font-size: 13.5px; border: 1px solid var(--border);
  animation: toastIn .25s ease; max-width: 90vw;
}
.toast > svg.ic { width: 15px; height: 15px; flex-shrink: 0; }
.toast [data-icon] { font-size: 15px; }
.toast.t-success [data-icon], .toast.t-success > svg.ic { color: var(--success); }
.toast.t-error [data-icon], .toast.t-error > svg.ic { color: var(--danger); }
.toast.t-info [data-icon], .toast.t-info > svg.ic { color: var(--primary); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
.toast.out { animation: toastOut .25s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* ---------- Spinner ---------- */
.spinner {
  width: 16px; height: 16px; border: 2px solid var(--primary-soft-2);
  border-top-color: var(--primary); border-radius: 50%;
  display: inline-block; animation: spin .7s linear infinite; vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 空状态 ---------- */
.empty-mini { padding: 32px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ============================================================
   登录页
   ============================================================ */
.login-body { background: #0e1526; overflow: hidden; }
.login-bg { position: fixed; inset: 0; background: linear-gradient(145deg, #101a30 0%, #0c1220 55%, #0e1526 100%); }
.login-orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; }
.login-orb-1 { width: 480px; height: 480px; background: rgba(79, 107, 246, .35); top: -140px; right: -100px; animation: float 9s ease-in-out infinite; }
.login-orb-2 { width: 420px; height: 420px; background: rgba(122, 92, 240, .25); bottom: -120px; left: -100px; animation: float 11s ease-in-out infinite reverse; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(26px); } }
.login-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

.login-wrap { position: relative; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 400px; max-width: 100%;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-radius: 20px; padding: 38px 36px 26px;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .5);
  animation: modalIn .35s cubic-bezier(.2, .9, .3, 1.15);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-logo {
  width: 56px; height: 56px; border-radius: 15px; object-fit: cover; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; color: #fff; background: linear-gradient(135deg, #4f6bf6, #7a5cf0);
  box-shadow: 0 10px 24px -6px rgba(79, 107, 246, .55);
}
.login-brand h1 { color: #fff; font-size: 21px; font-weight: 600; letter-spacing: 1px; }
.login-brand p { color: rgba(255, 255, 255, .45); font-size: 12.5px; margin-top: 5px; letter-spacing: 2px; }

.login-alert {
  background: rgba(229, 72, 77, .1); border: 1px solid rgba(229, 72, 77, .3);
  color: #ff9a9e; padding: 8px 12px; border-radius: 8px; font-size: 12.5px;
  margin-bottom: 16px; display: flex; align-items: center; gap: 7px;
}
.login-alert[hidden] { display: none; }
.login-alert > svg.ic { width: 14px; height: 14px; flex-shrink: 0; }
.login-field { margin-bottom: 18px; }
.login-field label { display: block; color: rgba(255, 255, 255, .65); font-size: 12.5px; margin-bottom: 7px; }
.login-input-wrap { position: relative; }
.login-input-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: rgba(255, 255, 255, .35); font-size: 16px; pointer-events: none;
}
.login-captcha-row { display: flex; gap: 10px; align-items: center; }
.login-captcha-row .login-input-wrap { flex: 1; }
.captcha-img {
  height: 46px; border-radius: 10px; cursor: pointer; flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, .14);
}
.captcha-img:hover { opacity: .85; }

.login-body .input, .login-body input {
  width: 100%; height: 46px; padding: 0 12px 0 40px; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .13);
  background: rgba(255, 255, 255, .07); color: #fff; font-size: 14px; outline: none;
  transition: all .18s; box-sizing: border-box;
}
.login-body input::placeholder { color: rgba(255, 255, 255, .3); }
.login-body input:focus { border-color: #4f6bf6; background: rgba(255, 255, 255, .1); box-shadow: 0 0 0 3px rgba(79, 107, 246, .25); }
.login-eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: rgba(255, 255, 255, .4); cursor: pointer;
  font-size: 15px; padding: 4px;
  display: inline-flex; align-items: center; justify-content: center;
}
.login-eye svg.ic { width: 15px; height: 15px; }
.login-eye:hover { color: #fff; }

.login-submit {
  width: 100%; padding: 12px; border: none; border-radius: 10px;
  background: linear-gradient(135deg, #4f6bf6, #6a55f0); color: #fff;
  font-size: 15px; font-weight: 600; letter-spacing: 6px; cursor: pointer;
  margin-top: 6px; transition: all .2s; box-shadow: 0 10px 24px -8px rgba(79, 107, 246, .7);
}
.login-submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 30px -8px rgba(79, 107, 246, .85); }
.login-submit:disabled { opacity: .65; cursor: not-allowed; }
.login-footer { text-align: center; color: rgba(255, 255, 255, .25); font-size: 11.5px; margin-top: 22px; letter-spacing: 1px; }

/* ============================================================
   仪表盘
   ============================================================ */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; align-items: center; gap: 15px;
  box-shadow: var(--shadow-sm); transition: transform .18s, box-shadow .18s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-icon {
  width: 38px; height: 38px; border-radius: 11px; font-size: 18px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
}
.stat-icon svg.ic { stroke-width: 1.8; }
.stat-icon-blue { background: rgba(47, 127, 249, .12); color: var(--info); }
.stat-icon-amber { background: rgba(217, 138, 18, .13); color: var(--warning); }
.stat-icon-violet { background: rgba(129, 86, 232, .12); color: var(--violet); }
.stat-icon-emerald { background: rgba(16, 160, 95, .12); color: var(--success); }
.stat-icon-rose { background: rgba(229, 72, 77, .11); color: var(--danger); }
.stat-icon-cyan { background: rgba(14, 165, 183, .12); color: #0e9db7; }
.stat-icon-slate { background: rgba(138, 147, 168, .14); color: #64748b; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }

.dashboard-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px 14px; }
.dashboard-grid > .panel { margin-bottom: 0; }
.dash-panel-row { display: contents; }
.panel-body .notify-item { padding: 11px 0; border-bottom: 1px solid var(--border); }
.panel-body .notify-item:hover { background: transparent; }
.panel-body .notify-item:last-child { border-bottom: none; }

/* 构成条 */
.comp-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.comp-label { width: 90px; font-size: 13px; color: var(--text-secondary); flex-shrink: 0; }
.comp-bar-wrap { flex: 1; height: 9px; border-radius: 5px; background: var(--bg-hover); overflow: hidden; }
.comp-bar { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--primary), #7a5cf0); transition: width .5s ease; min-width: 2px; }
.comp-value { width: 40px; text-align: right; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; flex-shrink: 0; }

/* 快捷入口 */
.quick-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick-link {
  display: flex; align-items: center; gap: 10px; padding: 13px 14px;
  border: 1px solid var(--border); border-radius: 10px; font-size: 13px;
  color: var(--text-secondary); transition: all .15s; background: var(--bg-card);
}
.quick-link:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); transform: translateY(-2px); }
.quick-link [data-icon] { font-size: 17px; color: var(--primary); }

/* ============================================================
   备忘录 / 待办
   ============================================================ */
.memo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.memo-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 14px; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s;
  display: flex; flex-direction: column; gap: 9px;
}
.memo-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.memo-card.pinned { border-color: var(--primary); background: linear-gradient(180deg, var(--primary-soft), transparent 40%), var(--bg-card); }
/* 头部行：时间 + 置顶（避免置顶图标与滚动条/删除按钮位置冲突） */
.memo-head { display: flex; align-items: center; gap: 8px; }
.memo-head .memo-time { flex: 1; }
.memo-pin {
  width: 22px; height: 22px; flex-shrink: 0;
  border-radius: 6px; border: none; background: transparent; color: var(--text-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .13s;
}
.memo-pin svg.ic { width: 12px; height: 12px; }
.memo-pin:hover { color: var(--warning); background: rgba(217, 138, 18, .12); }
.memo-card.pinned .memo-pin { color: var(--warning); }
.memo-content { font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; flex: 1; max-height: 180px; overflow-y: auto; }
.memo-time { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.memo-time svg.ic { width: 10.5px; height: 10.5px; }
.memo-actions { display: flex; gap: 6px; border-top: 1px dashed var(--border); padding-top: 9px; }
/* 列表视图：单列横向布局 */
.memo-grid.view-list { grid-template-columns: 1fr; gap: 8px; }
.memo-grid.view-list .memo-card {
  flex-direction: row; align-items: center; gap: 14px; padding: 10px 14px;
}
.memo-grid.view-list .memo-card:hover { transform: none; box-shadow: var(--shadow-sm); }
.memo-grid.view-list .memo-content { order: 1; max-height: none; overflow: visible; padding-right: 0; flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.memo-grid.view-list .memo-head { order: 2; flex-shrink: 0; gap: 10px; }
.memo-grid.view-list .memo-head .memo-time { flex: 0 0 auto; }
.memo-grid.view-list .memo-actions { order: 3; border-top: none; padding-top: 0; flex-shrink: 0; }

.todo-title-done { text-decoration: line-through; color: var(--text-muted); }
.todo-due { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.todo-due svg.ic { width: 11.5px; height: 11.5px; }
.todo-due.overdue { color: var(--danger); font-weight: 600; }
.todo-due.soon { color: var(--warning); font-weight: 600; }
.todo-check {
  width: 18px; height: 18px; accent-color: var(--success); cursor: pointer;
}

/* ============================================================
   设置页
   ============================================================ */
.settings-page .panel-body .form-grid { margin-bottom: 4px; }
.remind-panel .panel-header { cursor: default; }
.remind-options.disabled { opacity: .45; pointer-events: none; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg-card); z-index: 5; border-radius: var(--radius); padding: 12px 16px; margin: 0; border-top: none; box-shadow: var(--shadow); }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.info-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.info-table td { padding: 9px 4px; border-bottom: 1px dashed var(--border); }
.info-table tr:last-child td { border-bottom: none; }
.info-table td:first-child { color: var(--text-muted); width: 130px; }

.logo-uploader { display: flex; gap: 14px; align-items: flex-start; }
.logo-preview {
  width: 72px; height: 72px; border-radius: 12px; object-fit: cover; border: 1px solid var(--border);
  flex-shrink: 0; background: var(--bg-hover);
}
.logo-preview-empty {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); border-style: dashed;
}
.logo-preview-empty svg.ic { width: 20px; height: 20px; }
.logo-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

/* ---------- 主题预览 ---------- */
.theme-preview {
  --pv-primary: #4f6bf6;
  --pv-bg: #f3f5fa; --pv-card: #ffffff; --pv-line: #e3e8f1; --pv-sidebar: #111a2e;
  --pv-nav: rgba(255, 255, 255, .1);
  display: flex; width: 100%; max-width: 380px; height: 138px; border-radius: 10px;
  overflow: hidden; border: 1px solid var(--border); background: var(--pv-bg);
  transition: background .2s;
}
.theme-preview.pv-dark { --pv-bg: #0f1526; --pv-card: #182136; --pv-line: #2a3b58; --pv-sidebar: #0b1020; }
.tp-sidebar { width: 66px; background: var(--pv-sidebar); padding: 9px; display: flex; flex-direction: column; gap: 7px; flex-shrink: 0; }
.tp-brand { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.tp-brand-dot { width: 14px; height: 14px; border-radius: 4px; background: var(--pv-primary); flex-shrink: 0; }
.tp-brand-bar { width: 24px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .25); }
.tp-nav { height: 7px; border-radius: 4px; background: var(--pv-nav); }
.tp-nav-active { background: var(--pv-primary); }
.tp-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tp-topbar { height: 24px; background: var(--pv-card); display: flex; align-items: center; gap: 5px; padding: 0 9px; border-bottom: 1px solid var(--pv-line); }
.tp-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pv-line); }
.tp-avatar { width: 13px; height: 13px; border-radius: 50%; background: var(--pv-primary); margin-left: auto; }
.tp-body { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; padding: 9px; }
.tp-card { background: var(--pv-card); border-radius: 6px; padding: 7px; display: flex; flex-direction: column; gap: 5px; }
.tp-line { height: 5px; border-radius: 3px; background: var(--pv-line); width: 80%; }
.tp-line-sm { width: 55%; }
.tp-btn { height: 10px; border-radius: 5px; background: var(--pv-primary); width: 42%; margin-top: 3px; }
.tp-num { height: 12px; border-radius: 4px; background: var(--pv-line); width: 58%; }
.tp-num-accent { background: var(--pv-primary); opacity: .85; }

/* 错误页 */
.error-page { text-align: center; padding: 100px 20px; }
.error-code { font-size: 90px; font-weight: 800; color: var(--primary); opacity: .18; line-height: 1; }
.error-page p { color: var(--text-muted); margin: 12px 0 24px; }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-grid-narrow { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
  .app-layout.sidebar-open .sidebar { transform: none; }
  .app-layout.sidebar-open .sidebar-mask {
    display: block; position: fixed; inset: 0; background: var(--bg-mask); z-index: 99;
  }
  .main-area, .app-layout.sidebar-collapsed .main-area { margin-left: 0; }
  #sidebarToggle { display: inline-flex; }
  .sidebar-collapse-btn { display: none !important; }
  .app-layout.sidebar-collapsed .brand-name { opacity: 1; display: inline; }
  .app-layout.sidebar-collapsed .nav-label, .app-layout.sidebar-collapsed .nav-arrow { display: inline-flex; }
  .app-layout.sidebar-collapsed .nav-item { justify-content: flex-start; padding: 9px 12px; }
  .app-layout.sidebar-collapsed .nav-sub { display: block; }
  .content { padding: 14px; }
  .search-box { width: 100%; }
  .toolbar-left, .toolbar-right { width: 100%; }
  .user-name, .user-arrow { display: none; }
  .topbar-title { font-size: 14px; }
}
@media (max-width: 560px) {
  /* 手机端：统计卡片一行 2 个共 4 行 */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 13px 14px; gap: 12px; }
  .stat-icon { width: 32px; height: 32px; border-radius: 9px; font-size: 15px; }
  .stat-value { font-size: 21px; }
  .modal { max-height: 94vh; border-radius: 14px; }
  .modal .form-grid { grid-template-columns: 1fr; }
  .modal .form-item.span-2, .modal .form-item[data-span="2"] { grid-column: span 1; }
  .quick-links { grid-template-columns: 1fr; }
  .table-footer { flex-direction: column; align-items: flex-start; }
  .perpage-wrap { display: none; }
}
