/* =====================================================================
   漠星科技 · 内容运营中台  样式表
   ===================================================================== */

:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eff6ff;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --sidebar-bg: #ffffff;
  --text: #1e293b;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --border: #e2e8f0;
  --border-2: #cbd5e1;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .10);
  --radius: 10px;
  --radius-sm: 7px;

  --green: #16a34a; --green-soft: #dcfce7;
  --red: #dc2626;   --red-soft: #fee2e2;
  --orange: #ea580c;--orange-soft: #ffedd5;
  --amber: #d97706; --amber-soft: #fef3c7;
  --blue: #2563eb;  --blue-soft: #dbeafe;
  --cyan: #0891b2;  --cyan-soft: #cffafe;
  --purple: #7c3aed;--purple-soft: #ede9fe;
  --slate: #475569; --slate-soft: #f1f5f9;

  --sidebar-w: 232px;
  --sidebar-w-collapsed: 64px;
  --topbar-h: 66px;
}

html[data-theme="dark"] {
  --brand: #3b82f6;
  --brand-dark: #2563eb;
  --brand-soft: #1e293b;
  --bg: #0f172a;
  --surface: #1a2332;
  --surface-2: #232f42;
  --sidebar-bg: #151e2e;
  --text: #e8eef7;
  --text-2: #9aa8bd;
  --text-3: #64748b;
  --border: #2a374b;
  --border-2: #3b4a63;
  --shadow: 0 1px 3px rgba(0, 0, 0, .35);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, .45);

  --green-soft: #14351f; --red-soft: #3d1717; --orange-soft: #3a2210;
  --amber-soft: #3a2d0d; --blue-soft: #14294a; --cyan-soft: #0d3038;
  --purple-soft: #271d47; --slate-soft: #24303f;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; cursor: pointer; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ===================== 登录页 ===================== */
.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; position: relative;
  background: linear-gradient(140deg, #0b1220 0%, #16233c 45%, #1c2f52 100%);
  overflow: hidden;
}
.login-bg { position: absolute; inset: 0; overflow: hidden; }
.login-bg span {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: .45;
}
.login-bg span:nth-child(1) { width: 420px; height: 420px; background: #2563eb; top: -110px; left: -80px; }
.login-bg span:nth-child(2) { width: 360px; height: 360px; background: #0891b2; bottom: -120px; right: -60px; }
.login-bg span:nth-child(3) { width: 300px; height: 300px; background: #7c3aed; top: 40%; left: 55%; opacity: .25; }

.login-card {
  position: relative; z-index: 2; width: 400px; max-width: calc(100vw - 32px);
  background: rgba(255, 255, 255, .97);
  border-radius: 18px; padding: 34px 34px 26px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .4);
  backdrop-filter: blur(10px);
}
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 26px; }
.login-brand .logo {
  width: 52px; height: 52px; border-radius: 14px; flex: 0 0 52px;
  background: linear-gradient(135deg, #2563eb, #0891b2);
  color: #fff; font-size: 24px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.login-brand h1 { font-size: 20px; color: #0f172a; letter-spacing: .5px; }
.login-brand p { font-size: 12px; color: #64748b; margin-top: 2px; }

.login-form label { display: block; margin-bottom: 15px; }
.login-form label > span { display: block; font-size: 12.5px; color: #475569; margin-bottom: 6px; font-weight: 500; }
.login-form input {
  width: 100%; height: 42px; padding: 0 13px; border-radius: 9px;
  border: 1px solid #cbd5e1; background: #f8fafc; color: #0f172a;
  outline: none; transition: .18s;
}
.login-form input:focus { border-color: #2563eb; background: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .13); }
.login-err {
  background: #fee2e2; color: #b91c1c; padding: 9px 12px;
  border-radius: 8px; font-size: 13px; margin-bottom: 12px;
}
.btn-block { width: 100%; height: 44px; font-size: 15px; letter-spacing: 3px; margin-top: 4px; }

.login-tips { margin-top: 22px; padding-top: 16px; border-top: 1px dashed #e2e8f0; }
.tips-title { font-size: 12px; color: #94a3b8; margin-bottom: 8px; }
.tips-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 11px; border-radius: 7px; cursor: pointer; transition: .15s;
  font-size: 12.5px;
}
.tips-row:hover { background: #eff6ff; }
.tips-row b { color: #2563eb; font-weight: 600; }
.tips-row span { color: #64748b; font-family: ui-monospace, Consolas, monospace; }
.login-footer { position: relative; z-index: 2; margin-top: 22px; color: rgba(255, 255, 255, .45); font-size: 12px; }

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

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--sidebar-bg); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  transition: width .2s, flex-basis .2s; z-index: 30;
}
.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); flex-basis: var(--sidebar-w-collapsed); }

.side-brand {
  height: var(--topbar-h); display: flex; align-items: center; gap: 11px;
  padding: 0 16px; border-bottom: 1px solid var(--border); flex: 0 0 var(--topbar-h);
}
.side-brand .logo {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), #0891b2);
  color: #fff; font-weight: 700; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
}
.side-brand-text { display: flex; flex-direction: column; overflow: hidden; }
.side-brand-text b { font-size: 14.5px; white-space: nowrap; }
.side-brand-text small { font-size: 11px; color: var(--text-3); white-space: nowrap; }

.side-nav { flex: 1; overflow-y: auto; padding: 10px 8px 20px; }
.nav-group-title {
  font-size: 11px; color: var(--text-3); padding: 13px 11px 6px;
  letter-spacing: .6px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border-radius: var(--radius-sm); color: var(--text-2); font-size: 13.5px;
  margin-bottom: 2px; transition: .15s; position: relative; white-space: nowrap;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--brand); color: #fff; font-weight: 500; box-shadow: 0 3px 10px rgba(37, 99, 235, .28); }
.nav-item.active .nav-icon svg { stroke: #fff; }
.nav-icon { width: 18px; height: 18px; flex: 0 0 18px; display: flex; align-items: center; justify-content: center; }
.nav-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff; font-size: 10.5px;
  padding: 1px 6px; border-radius: 9px; font-weight: 600;
}
.nav-item.active .nav-badge { background: rgba(255, 255, 255, .28); }
.sidebar-collapsed .nav-item { justify-content: center; padding: 9px 0; }

.side-foot { padding: 10px; border-top: 1px solid var(--border); }
.collapse-btn {
  display: flex; align-items: center; gap: 9px; padding: 8px 11px;
  border-radius: var(--radius-sm); color: var(--text-3); font-size: 12.5px; cursor: pointer;
}
.collapse-btn:hover { background: var(--surface-2); color: var(--text-2); }
.collapse-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }
.sidebar-collapsed .collapse-btn { justify-content: center; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h); background: var(--surface);
  border-bottom: 1px solid var(--border); display: flex; align-items: center;
  justify-content: space-between; padding: 0 22px; position: sticky; top: 0; z-index: 20;
}
.topbar-left h2 { font-size: 17px; font-weight: 600; }
.crumb { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.role-chip {
  font-size: 12px; padding: 4px 11px; border-radius: 20px; font-weight: 500;
  background: var(--slate-soft); color: var(--text-2);
}
.role-chip.role-admin { background: var(--purple-soft); color: var(--purple); }
.role-chip.role-manager { background: var(--blue-soft); color: var(--blue); }
.role-chip.role-staff { background: var(--green-soft); color: var(--green); }

.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); display: flex; align-items: center; justify-content: center;
  position: relative; color: var(--text-2); transition: .15s;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.icon-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--red); border: 1.5px solid var(--surface);
}

.user-menu {
  display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 5px;
  border-radius: 22px; cursor: pointer; position: relative; transition: .15s;
  border: 1px solid transparent;
}
.user-menu:hover { background: var(--surface-2); border-color: var(--border); }
.avatar {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #0891b2); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
}
.user-info { display: flex; flex-direction: column; line-height: 1.25; }
.user-info b { font-size: 13px; }
.user-info small { font-size: 11px; color: var(--text-3); }
.user-menu > span svg { width: 14px; height: 14px; stroke: var(--text-3); fill: none; }
.dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 148px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; z-index: 50;
}
.dropdown a { display: block; padding: 10px 15px; font-size: 13px; color: var(--text-2); }
.dropdown a:hover { background: var(--surface-2); color: var(--brand); }
.dropdown a:not(:last-child) { border-bottom: 1px solid var(--border); }

.content { flex: 1; padding: 20px 22px 40px; min-width: 0; }

/* ===================== 通用组件 ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  font-size: 13px; font-weight: 500; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--brand); border-color: transparent; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 40px; padding: 0 22px; font-size: 14px; }
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap;
}
.card-head h3 { font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-head .sub { font-size: 12px; color: var(--text-3); font-weight: 400; }
.card-body { padding: 16px 18px; }
.card-body.tight { padding: 12px 14px; }
.card-body.flush { padding: 0; }

.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.field > label .req { color: var(--red); margin-left: 2px; }
.input, .select, .textarea {
  height: 34px; padding: 0 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  outline: none; transition: .15s; width: 100%;
}
.textarea { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.65; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .11); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input[type="date"] { padding-right: 6px; }
.select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 14px; padding-right: 28px; }
.filter-bar { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.filter-bar .input, .filter-bar .select { width: auto; min-width: 130px; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }
.span-2 { grid-column: span 2; }

/* KPI 卡片 */
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::after {
  content: ''; position: absolute; right: -18px; top: -18px; width: 68px; height: 68px;
  border-radius: 50%; background: var(--brand-soft); opacity: .65;
}
.kpi .kpi-label { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; position: relative; z-index: 1; }
.kpi .kpi-label svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.kpi .kpi-value { font-size: 27px; font-weight: 700; margin: 7px 0 3px; letter-spacing: -.6px; position: relative; z-index: 1; line-height: 1.1; }
.kpi .kpi-value small { font-size: 13px; font-weight: 500; color: var(--text-2); margin-left: 3px; }
.kpi .kpi-foot { font-size: 11.5px; color: var(--text-3); position: relative; z-index: 1; display: flex; align-items: center; gap: 5px; }
.kpi.kpi-green .kpi-value { color: var(--green); } .kpi.kpi-green::after { background: var(--green-soft); }
.kpi.kpi-blue .kpi-value { color: var(--blue); }   .kpi.kpi-blue::after { background: var(--blue-soft); }
.kpi.kpi-orange .kpi-value { color: var(--orange); }.kpi.kpi-orange::after { background: var(--orange-soft); }
.kpi.kpi-red .kpi-value { color: var(--red); }     .kpi.kpi-red::after { background: var(--red-soft); }
.kpi.kpi-purple .kpi-value { color: var(--purple); }.kpi.kpi-purple::after { background: var(--purple-soft); }
.kpi.kpi-cyan .kpi-value { color: var(--cyan); }   .kpi.kpi-cyan::after { background: var(--cyan-soft); }

.up { color: var(--red); font-weight: 600; }
.down { color: var(--green); font-weight: 600; }
.muted { color: var(--text-3); }
.text-red { color: var(--red); } .text-green { color: var(--green); }
.text-orange { color: var(--orange); } .text-blue { color: var(--blue); }
.text-2 { color: var(--text-2); }

/* 徽标 */
.tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px;
  padding: 2px 8px; border-radius: 5px; background: var(--slate-soft); color: var(--text-2);
  font-weight: 500; white-space: nowrap; line-height: 1.7;
}
.tag-green { background: var(--green-soft); color: var(--green); }
.tag-red { background: var(--red-soft); color: var(--red); }
.tag-orange { background: var(--orange-soft); color: var(--orange); }
.tag-amber { background: var(--amber-soft); color: var(--amber); }
.tag-blue { background: var(--blue-soft); color: var(--blue); }
.tag-cyan { background: var(--cyan-soft); color: var(--cyan); }
.tag-purple { background: var(--purple-soft); color: var(--purple); }
.tag-slate { background: var(--slate-soft); color: var(--slate); }
.tag-solid { color: #fff; }
.tag-sm { font-size: 11px; padding: 1px 6px; }

.dot-tag::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; display: inline-block;
}

/* 表格 */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; padding: 11px 12px; background: var(--surface-2);
  color: var(--text-2); font-weight: 600; font-size: 12.5px;
  border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
table.tbl td {
  padding: 11px 12px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl td.nowrap, table.tbl th.nowrap { white-space: nowrap; }
table.tbl td .link { color: var(--brand); }
table.tbl td .link:hover { text-decoration: underline; }
.td-title { max-width: 340px; }
.td-title b { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-title small { color: var(--text-3); font-size: 11.5px; }
.empty { text-align: center; padding: 46px 20px; color: var(--text-3); }
.empty svg { width: 40px; height: 40px; stroke: var(--border-2); fill: none; stroke-width: 1.4; margin-bottom: 10px; }
.empty p { font-size: 13px; }

/* 分页 */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 13px 18px; font-size: 12.5px; color: var(--text-2); }
.pager .pages { display: flex; gap: 4px; }
.pager .pg {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  display: flex; align-items: center; justify-content: center; font-size: 12.5px;
}
.pager .pg:hover { border-color: var(--brand); color: var(--brand); }
.pager .pg.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager .pg:disabled { opacity: .4; cursor: not-allowed; }

/* 模态框 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .55);
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 100; padding: 40px 16px; overflow-y: auto; backdrop-filter: blur(2px);
}
.modal {
  background: var(--surface); border-radius: 13px; box-shadow: var(--shadow-lg);
  width: 620px; max-width: 100%; animation: modalIn .18s ease;
}
.modal.modal-lg { width: 880px; }
.modal.modal-xl { width: 1100px; }
.modal.modal-sm { width: 420px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-3); line-height: 1; padding: 2px 5px; border-radius: 5px; }
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 20px; max-height: calc(100vh - 220px); overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); }

/* 表单行 */
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 14px; }
.form-row.one { grid-template-columns: 1fr; }
.form-row.three { grid-template-columns: repeat(3, 1fr); }
.form-hint { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

/* 可点选的多选标签（所属品牌 / 共用员工） */
.pick-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.pick {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 11px; border-radius: 15px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 12.5px; color: var(--text-2);
  transition: all .12s ease; user-select: none;
}
.pick:hover { border-color: var(--border-2); color: var(--text); }
.pick.on {
  border-color: var(--brand); background: var(--brand-soft);
  color: var(--brand); font-weight: 500;
}
.pick small { font-size: 11px; opacity: .75; }
.pick.on small { opacity: .85; }
/* 只读态（无权限改多品牌时） */
.pick.pick-ro, .pick.pick-ro:hover { cursor: default; border-color: var(--border); }
.pick.pick-ro.on:hover { border-color: var(--brand); }

/* 提示条 */
.alert-box { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; border-left: 3px solid; }
.alert-info { background: var(--blue-soft); color: var(--blue); border-color: var(--blue); }
.alert-warn { background: var(--amber-soft); color: var(--amber); border-color: var(--amber); }
.alert-danger { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.alert-success { background: var(--green-soft); color: var(--green); border-color: var(--green); }

/* Toast */
.toast-wrap { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 9px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 9px; padding: 11px 18px;
  background: var(--surface); border-radius: 10px; box-shadow: var(--shadow-lg);
  font-size: 13.5px; border-left: 3px solid var(--brand); animation: toastIn .2s;
  max-width: 620px; color: var(--text);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
.toast-success { border-color: var(--green); } .toast-success .toast-icon { color: var(--green); }
.toast-error { border-color: var(--red); } .toast-error .toast-icon { color: var(--red); }
.toast-info { border-color: var(--blue); } .toast-info .toast-icon { color: var(--blue); }
.toast-icon svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; display: block; }

/* 加载 */
.loading-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .35);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 400; gap: 14px; color: #fff; font-size: 13.5px; backdrop-filter: blur(1px);
}
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .28); border-top-color: #fff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 图表容器 */
.chart { width: 100%; height: 280px; }
.chart-sm { height: 210px; }
.chart-lg { height: 340px; }

/* 进度条 */
.bar { height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--brand); transition: width .3s; }
.bar.bar-green > i { background: var(--green); }
.bar.bar-red > i { background: var(--red); }
.bar.bar-orange > i { background: var(--orange); }

/* 违规高亮 */
.risk-text { line-height: 2.1; font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.risk-text mark { padding: 1px 3px; border-radius: 3px; font-weight: 600; }
.risk-text mark.severe { background: var(--red-soft); color: var(--red); box-shadow: inset 0 -2px 0 var(--red); }
.risk-text mark.warn { background: var(--amber-soft); color: var(--amber); box-shadow: inset 0 -2px 0 var(--amber); }
.risk-text mark.info { background: var(--blue-soft); color: var(--blue); box-shadow: inset 0 -2px 0 var(--blue); }

/* 词云 */
.word-cloud { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.word-cloud span {
  padding: 4px 11px; border-radius: 16px; background: var(--surface-2);
  color: var(--text-2); font-size: 12.5px; border: 1px solid var(--border);
  transition: .15s;
}
.word-cloud span:hover { border-color: var(--brand); color: var(--brand); }
.word-cloud span.on { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
.word-cloud span.gap { background: var(--amber-soft); color: var(--amber); border-color: transparent; }

/* 日历热力 */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head { text-align: center; font-size: 11.5px; color: var(--text-3); padding: 4px 0; font-weight: 600; }
.cal-cell {
  border-radius: 7px; padding: 7px 6px; min-height: 62px; border: 1px solid var(--border);
  background: var(--surface-2); font-size: 11.5px; cursor: pointer; transition: .15s; position: relative;
}
.cal-cell:hover { border-color: var(--brand); transform: translateY(-1px); }
.cal-cell.empty-cell { background: transparent; border: none; cursor: default; }
.cal-cell .d { font-weight: 600; color: var(--text-2); }
.cal-cell .n { font-size: 15px; font-weight: 700; margin-top: 2px; }
.cal-cell.lv0 { background: var(--surface-2); }
.cal-cell.lv1 { background: rgba(37, 99, 235, .1); border-color: rgba(37, 99, 235, .2); }
.cal-cell.lv2 { background: rgba(37, 99, 235, .22); border-color: rgba(37, 99, 235, .3); }
.cal-cell.lv3 { background: rgba(37, 99, 235, .36); border-color: rgba(37, 99, 235, .42); }
.cal-cell.lv4 { background: rgba(37, 99, 235, .52); border-color: rgba(37, 99, 235, .55); }
.cal-cell.lv4 .d, .cal-cell.lv4 .n { color: #fff; }
.cal-cell .sub { color: var(--text-3); font-size: 10.5px; }
.cal-cell.lv3 .sub, .cal-cell.lv4 .sub { color: rgba(255, 255, 255, .8); }

/* 排行榜 */
.rank-list { display: flex; flex-direction: column; }
.rank-item { display: flex; align-items: center; gap: 11px; padding: 9px 4px; border-bottom: 1px solid var(--border); }
.rank-item:last-child { border-bottom: none; }
.rank-no {
  width: 24px; height: 24px; flex: 0 0 24px; border-radius: 7px; display: flex;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
  background: var(--slate-soft); color: var(--text-2);
}
.rank-no.no1 { background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; }
.rank-no.no2 { background: linear-gradient(135deg, #94a3b8, #64748b); color: #fff; }
.rank-no.no3 { background: linear-gradient(135deg, #d97706, #b45309); color: #fff; }
.rank-item .info { flex: 1; min-width: 0; }
.rank-item .info b { font-size: 13px; font-weight: 500; }
.rank-item .info small { display: block; font-size: 11.5px; color: var(--text-3); }
.rank-item .val { font-size: 15px; font-weight: 700; color: var(--brand); }
.rank-item .val small { font-size: 11px; font-weight: 400; color: var(--text-3); margin-left: 2px; }

/* 时间线 */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 15px; }
.timeline-item::before {
  content: ''; position: absolute; left: -19px; top: 5px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--brand); border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--brand-soft);
}
.timeline-item b { font-size: 13px; font-weight: 500; }
.timeline-item p { font-size: 12.5px; color: var(--text-2); }
.timeline-item small { font-size: 11.5px; color: var(--text-3); }

/* 描述列表 */
.desc { display: grid; grid-template-columns: 96px 1fr; gap: 10px 14px; font-size: 13px; align-items: baseline; }
.desc dt { color: var(--text-3); font-size: 12.5px; }
.desc dd { color: var(--text); word-break: break-word; }

/* Tab */
.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button {
  background: none; border: none; padding: 9px 15px; font-size: 13.5px; color: var(--text-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500;
}
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }

/* 复选框行 */
.check-row { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }

.chip-select { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-select button {
  padding: 5px 12px; border-radius: 16px; border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text-2); font-size: 12.5px; transition: .15s;
}
.chip-select button:hover { border-color: var(--brand); color: var(--brand); }
.chip-select button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* 响应式 */
@media (max-width: 1280px) {
  .grid-5, .grid-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1024px) {
  .sidebar { position: fixed; left: -260px; transition: left .22s; }
  .sidebar-collapsed .sidebar { left: 0; width: var(--sidebar-w); flex-basis: var(--sidebar-w); }
  .grid-4, .grid-5, .grid-6 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .content { padding: 14px; }
  .grid-2, .grid-3, .grid-4, .grid-5, .grid-6 { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .form-row, .form-row.three { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .user-info, .role-chip { display: none; }
  .modal { width: 100%; }
}

/* ===================== 品牌（多租户）===================== */
.brand-switch { position: relative; }
.brand-btn {
  display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px;
  border-radius: 9px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 13px; transition: .15s;
}
.brand-btn:hover { border-color: var(--brand); }
.brand-btn b { font-weight: 600; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; color: var(--text-3); }
.brand-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; display: inline-block;
  box-shadow: 0 0 0 2px rgba(127, 127, 127, .15);
}
.brand-dropdown { min-width: 218px; }
.brand-dropdown a { display: flex; align-items: center; gap: 9px; }
.brand-dropdown a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.brand-dropdown a span { display: flex; flex-direction: column; line-height: 1.35; }
.brand-dropdown a small { font-size: 11px; color: var(--text-3); font-weight: 400; }
.brand-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 4px 11px; border-radius: 20px; border: 1px solid var(--border);
}
.brand-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500;
  padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border); white-space: nowrap;
}
.brand-card {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 16px;
  background: var(--surface); position: relative; overflow: hidden; transition: .15s;
}
.brand-card:hover { border-color: var(--brand); }
.brand-card.active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.brand-card .bc-top { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.brand-card .bc-top b { font-size: 15px; }
.brand-card .bc-meta { font-size: 12px; color: var(--text-3); margin-bottom: 12px; line-height: 1.7; }
.brand-card .bc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.brand-card .bc-stat { text-align: center; }
.brand-card .bc-stat b { display: block; font-size: 17px; }
.brand-card .bc-stat small { font-size: 11px; color: var(--text-3); }
.rank-1 { color: #dc2626; font-weight: 700; }
.rank-2 { color: #ea580c; font-weight: 700; }
.rank-3 { color: #ca8a04; font-weight: 600; }

/* ===================== 发布账号组合框（自动识别 + 匹配账号库）===================== */
.acct-box { position: relative; }
.acct-input-wrap { position: relative; }
.acct-input-wrap .input { padding-right: 30px; }
.acct-clear {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--surface-2); color: var(--text-3); font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.acct-clear:hover { background: var(--red-soft); color: var(--red); }

.acct-drop {
  position: absolute; top: calc(100% + 5px); left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); max-height: 262px; overflow: auto;
}
.acct-drop a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; font-size: 13px; color: var(--text-2); cursor: pointer;
}
.acct-drop a:hover { background: var(--surface-2); color: var(--brand); }
.acct-drop a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.acct-drop .acct-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-drop .acct-meta { font-size: 11.5px; color: var(--text-3); white-space: nowrap; flex: 0 0 auto; }
.acct-drop .acct-empty { padding: 10px 12px; font-size: 12.5px; color: var(--text-3); }
.acct-drop .acct-create {
  border-top: 1px solid var(--border); color: var(--brand) !important;
  font-weight: 600; justify-content: flex-start;
}
.acct-drop .acct-create svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

.acct-unmatched {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); margin-bottom: 8px;
}
.acct-unmatched:last-child { margin-bottom: 0; }

/* ---------- 员工关键词明细：关键词 chip ---------- */
.kw-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 12px; font-size: 12px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  transition: opacity .12s ease;
}
.kw-chip small { font-size: 10.5px; color: var(--text-3); }
.kw-chip.lvl-core { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.kw-chip.lvl-core small { color: var(--red); opacity: .8; }
.kw-chip.lvl-major { border-color: var(--amber); background: var(--amber-soft); color: var(--amber); }
.kw-chip.lvl-major small { color: var(--amber); opacity: .8; }
.kw-chip.lvl-minor { border-color: var(--border); background: var(--slate-soft); color: var(--text-2); }
.kw-chip.dim { opacity: .7; }

/* ---------- AI 分析结果（Markdown 渲染） ---------- */
.ai-md { font-size: 13px; line-height: 1.78; color: var(--text); }
.ai-md p { margin: 0 0 8px; }
.ai-md h3 { font-size: 14.5px; margin: 16px 0 7px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.ai-md h4 { font-size: 13.5px; margin: 13px 0 5px; }
.ai-md h5 { font-size: 13px; margin: 11px 0 4px; }
.ai-md ul { margin: 6px 0 8px 20px; padding: 0; }
.ai-md li { margin: 3px 0; }
.ai-md code { background: var(--slate-soft); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.ai-md b { color: var(--brand); }
