/* ============================================================
   云朵教务云 · 机构后台样式
   参照 TDesign 设计语言：主色 #0052d9，圆角 8px，浅灰底白卡片
   ============================================================ */

:root {
  --brand: #3d82f2;
  --brand-600: #2f6fe0;
  --brand-50: #eef5ff;
  --brand-100: #dceaff;
  --bg: #f4f7fc;
  --card: #ffffff;
  --border: #e7e7e7;
  --border-strong: #dcdcdc;
  --text: #181818;
  --text-2: #5e5e5e;
  --text-3: #8d8d8d;
  --success: #2ba471;
  --success-bg: #e3f9e9;
  --warning: #b25e09;
  --warning-bg: #fff1e9;
  --danger: #d54941;
  --danger-bg: #fff0ed;
  --muted-bg: #f3f3f3;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --sidebar-w: 220px;
  --sidebar-w-min: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
a { color: var(--brand); }
button { font-family: inherit; }
.muted { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.content {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 28px 40px;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 auto;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width 0.18s ease;
  overflow: visible;
}
.sidebar__head {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.sidebar__mark, .login__mark {
  width: 26px; height: 26px;
  flex: 0 0 auto;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sidebar__title { font-size: 15px; font-weight: 600; color: var(--text); }
.sidebar__foot { padding: 12px; border-top: 1px solid var(--border); }

.nav { flex: 1 1 auto; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.nav__item svg { flex: 0 0 auto; }
.nav__item:hover { background: #f3f6fc; color: var(--brand); }
.nav__item.is-active { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.nav__text { overflow: hidden; text-overflow: ellipsis; }

.layout.is-collapsed .sidebar { width: var(--sidebar-w-min); }
.layout.is-collapsed .sidebar__title,
.layout.is-collapsed .sidebar__mark,
.layout.is-collapsed .sidebar__foot .btn,
.layout.is-collapsed .nav__text { display: none; }
.layout.is-collapsed .nav__item { justify-content: center; padding: 10px 0; }
.layout.is-collapsed .sidebar__head { justify-content: center; padding: 0; }

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar__title { font-size: 15px; font-weight: 600; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar__org { color: var(--text-2); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__divider { width: 1px; height: 16px; background: var(--border-strong); }
.topbar__user { color: var(--text); font-weight: 500; white-space: nowrap; }
@media (max-width: 720px) {
  .topbar__org { display: none; }
  .topbar__divider { display: none; }
}

.icon-btn {
  width: 32px; height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.icon-btn:hover { background: var(--muted-bg); color: var(--text); }

/* 窄屏：侧栏收起为图标 */
@media (max-width: 960px) {
  .sidebar { width: var(--sidebar-w-min); }
  .sidebar__title, .sidebar__mark, .sidebar__foot .btn, .nav__text { display: none; }
  .nav__item { justify-content: center; padding: 10px 0; }
  .sidebar__head { justify-content: center; padding: 0; }
  .content { padding: 12px; }
  .topbar { padding: 0 12px; }
  .layout.is-collapsed .sidebar { width: 0; border-right: 0; overflow: hidden; }
}

/* ---------- 页面标题区 ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.page-head h2 { font-size: 22px; letter-spacing: 0.2px; }
.page-desc { color: var(--text-3); margin-top: 6px; font-size: 14px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar > .input, .toolbar > .select { width: auto; min-width: 108px; }
.toolbar > input[type="date"], .toolbar > input[type="month"] { min-width: 0; width: 152px; }
.toolbar .sep { color: var(--text-3); font-size: 13px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid #eef0f3;
  overflow: hidden;
}
.card + .card { margin-top: 16px; }
.grid-2 > .card + .card, .grid-3 > .card + .card { margin-top: 0; }
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.card__title { font-size: 16px; }
.card__body { padding: 18px 20px; }
.card__body--flush { padding: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--brand);
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn--ghost { background: #fff; color: var(--text); border-color: var(--border-strong); }
.btn--ghost:hover { background: #f7f9fc; color: var(--brand); border-color: var(--brand); }
.btn--danger { background: #fff; color: var(--danger); border-color: #f5c2be; }
.btn--danger:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.btn--text { background: transparent; border-color: transparent; color: var(--brand); padding: 0 6px; }
.btn--text:hover { background: var(--brand-50); }
.btn--sm { height: 26px; padding: 0 10px; font-size: 13px; }
.btn--block { width: 100%; height: 38px; font-size: 15px; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field__label { font-size: 13px; color: var(--text-2); }
.field__label .req { color: var(--danger); margin-left: 2px; }
.field__hint { font-size: 12px; color: var(--text-3); }
.field__error, .form-error { color: var(--danger); font-size: 12px; min-height: 16px; }
.form-error:empty { display: none; }

.input, .select, .textarea {
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.textarea { padding: 8px 10px; min-height: 76px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(0, 82, 217, 0.12); }
.input::placeholder, .textarea::placeholder { color: #b5b5b5; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #8d8d8d 50%), linear-gradient(135deg, #8d8d8d 50%, transparent 50%); background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
.input--sm, .select--sm { height: 28px; min-height: 28px; font-size: 13px; }
.select--sm { background-position: calc(100% - 14px) 12px, calc(100% - 9px) 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .field--full { grid-column: 1 / -1; }
/* 新建课程弹窗：按「重复」模式显隐单次 / 周期专属字段（form[data-weekly] 由 app.js 切换） */
form[data-weekly="0"] [data-only="weekly"], form[data-weekly="1"] [data-only="single"] { display: none; }
@media (max-width: 720px) { .form-grid, .form-grid--3 { grid-template-columns: minmax(0, 1fr); } }

.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }
.radio-line { display: flex; gap: 14px; flex-wrap: wrap; }

.upload { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.upload input[type="file"] { max-width: 100%; font-size: 13px; }
.upload__status { font-size: 12px; color: var(--text-3); }

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1;
  background: var(--muted-bg);
  color: var(--text-2);
  white-space: nowrap;
}
.tag--brand { background: var(--brand-50); color: var(--brand); }
.tag--success { background: var(--success-bg); color: var(--success); }
.tag--warning { background: var(--warning-bg); color: var(--warning); }
.tag--danger { background: var(--danger-bg); color: var(--danger); }
.tag--muted { background: var(--muted-bg); color: var(--text-3); }
.tag-list { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 统计卡 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid #eef0f3;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 3px solid var(--border-strong);
}
.stat--green { border-left-color: var(--success); }
.stat--yellow { border-left-color: #edb94b; }
.stat--red { border-left-color: var(--danger); }
.stat--brand { border-left-color: var(--brand); }
.stat--muted { border-left-color: #c3c3c3; }
.stat__label { font-size: 13px; color: var(--text-3); }
.stat__value { font-size: 30px; font-weight: 700; line-height: 1.2; }
.stat__note { font-size: 12px; color: var(--text-3); }

/* ---------- 纯 CSS 条形图 ---------- */
.chart-row { display: grid; grid-template-columns: 88px minmax(0, 1fr) 124px; align-items: center; gap: 10px; margin-bottom: 10px; }
.chart-label { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-track { height: 10px; background: #f0f2f5; border-radius: 6px; overflow: hidden; }
.chart-fill { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #4d8df5, var(--brand)); min-width: 2px; transition: width 0.4s ease; }
.chart-fill--green { background: linear-gradient(90deg, #63c79b, var(--success)); }
.chart-fill--orange { background: linear-gradient(90deg, #f7b267, #ed8936); }
.chart-fill--red { background: linear-gradient(90deg, #e98b84, var(--danger)); }
.chart-value { font-size: 12px; color: var(--text-2); text-align: right; }

.stack { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: #f0f2f5; }
.stack span { display: block; height: 100%; }
.stack__g { background: #2ba471; }
.stack__y { background: #edb94b; }
.stack__r { background: #d54941; }
.stack__m { background: #d9d9d9; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-3); margin-top: 6px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

.compare-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 188px; gap: 10px; align-items: center; margin-bottom: 10px; }
.compare-label { font-size: 13px; color: var(--text-2); }
.compare-nums { font-size: 12px; color: var(--text-3); text-align: right; }

.funnel-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) 64px; gap: 10px; align-items: center; margin-bottom: 8px; }
.funnel-name { font-size: 13px; color: var(--text-2); }
.funnel-track { background: #f0f2f5; border-radius: 6px; overflow: hidden; height: 26px; }
.funnel-fill {
  height: 100%;
  background: linear-gradient(90deg, #a8c6fb, var(--brand));
  border-radius: 6px;
  transition: width 0.4s ease;
  min-width: 2px;
}
.funnel-row:nth-child(2) .funnel-fill { background: linear-gradient(90deg, #a8c6fb, #2f7be8); }
.funnel-row:nth-child(3) .funnel-fill { background: linear-gradient(90deg, #b5d9ff, #4a90e2); }
.funnel-row:nth-child(4) .funnel-fill { background: linear-gradient(90deg, #b7e5cd, #2ba471); }
.funnel-row:nth-child(5) .funnel-fill { background: linear-gradient(90deg, #f3c9c5, #d54941); }
.funnel-count { font-size: 13px; color: var(--text-2); text-align: right; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 14px;
  background: #f3f6fc;
  color: var(--text-2);
  font-size: 12px;
}

/* ---------- 表格 ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { background: #fafafa; color: var(--text-2); font-weight: 500; white-space: nowrap; }
.table tbody tr:nth-child(even) td { background: #fbfcfe; }
.table tbody tr:hover td { background: #f3f7ff; }
.table td.right, .table th.right { text-align: right; }
.table__empty td { text-align: center; color: var(--text-3); padding: 0; font-size: 13px; }
.table tfoot td { background: #fafafa; font-weight: 600; }
.table .num { font-variant-numeric: tabular-nums; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 16px; color: var(--text-3); font-size: 13px; flex-wrap: wrap; }
.pager .select { width: auto; }

/* ---------- 空态 / 错误态 / 骨架 ---------- */
.empty, .error-box {
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.empty__icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  color: var(--brand);
  background: linear-gradient(160deg, #f7fbff 0%, var(--brand-50) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
}
.empty__icon svg { width: 22px; height: 22px; }
.empty__title { color: var(--text-2); font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.empty__desc { font-size: 13px; color: var(--text-3); max-width: 360px; line-height: 1.6; }
.empty--table { padding: 26px 16px; }
.empty--table .empty__icon { width: 38px; height: 38px; border-radius: 12px; margin-bottom: 9px; }
.empty--table .empty__icon svg { width: 19px; height: 19px; }
.empty--table .empty__title { font-size: 14px; margin-bottom: 2px; }
.empty--table .empty__desc { font-size: 12px; }
.error-box { color: var(--danger); }
.skeleton { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
.skel {
  height: 16px;
  border-radius: 4px;
  background: linear-gradient(90deg, #eef1f5 25%, #f7f9fc 37%, #eef1f5 63%);
  background-size: 400% 100%;
  animation: skel 1.2s ease infinite;
}
.skel--title { height: 22px; width: 40%; }
.skel--card { height: 96px; }
@keyframes skel {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ---------- 课表 ---------- */
.agenda-day { margin-bottom: 18px; }
.agenda-date {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 2px;
  border-bottom: 1px dashed var(--border);
  color: var(--text);
}
.agenda-date span { color: var(--text-3); font-size: 12px; }
.agenda-items { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.agenda-item {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.agenda-item:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(0, 82, 217, 0.08); }
.agenda-time { font-family: var(--mono); font-size: 13px; color: var(--brand); }
.agenda-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.agenda-main strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-meta { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 720px) {
  .agenda-item { grid-template-columns: 96px minmax(0, 1fr); }
  .agenda-tags { grid-column: 1 / -1; justify-content: flex-start; }
}

/* ---------- 详情键值 ---------- */
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
.info-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 640px) { .info-grid, .info-grid--3 { grid-template-columns: minmax(0, 1fr); } }
.kv { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kv__k { font-size: 12px; color: var(--text-3); }
.kv__v { font-size: 13px; color: var(--text); word-break: break-word; }
.section-title { font-size: 14px; margin: 16px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }

.log-list { display: flex; flex-direction: column; gap: 10px; }
.log-item { border-left: 2px solid var(--brand-100); padding: 2px 0 2px 12px; }
.log-item__head { display: flex; gap: 8px; align-items: center; font-size: 13px; flex-wrap: wrap; }
.log-item__meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.log-item__reason { font-size: 13px; color: var(--text-2); margin-top: 2px; }

/* ---------- 登录 ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(1200px 600px at 15% 10%, #e8f0ff 0%, #f5f7fa 45%, #eef2f8 100%); }
.login__panel {
  width: min(900px, 100%);
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(24, 55, 110, 0.12);
  overflow: hidden;
}
.login__brand {
  background: linear-gradient(160deg, #0052d9 0%, #2f7be8 55%, #4a90e2 100%);
  color: #fff;
  padding: 34px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login__logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; }
.login__mark { background: #fff; color: var(--brand); }
.login__slogan { font-size: 14px; opacity: 0.92; }
.login__points { margin: 8px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.9; opacity: 0.92; }
.login__copy { margin-top: auto; font-size: 12px; opacity: 0.7; }
.login__form { padding: 40px 36px; display: flex; flex-direction: column; justify-content: center; }
.login__form h1 { font-size: 22px; margin-bottom: 6px; }
.login__hint { color: var(--text-3); font-size: 13px; margin-bottom: 22px; }
.login__form .field { margin-bottom: 14px; }
.login__foot { margin-top: 18px; font-size: 12px; color: var(--text-3); text-align: center; }
@media (max-width: 760px) {
  .login { padding: 0; align-items: stretch; }
  .login__panel { grid-template-columns: minmax(0, 1fr); border-radius: 0; min-height: 100vh; }
  .login__brand { padding: 22px 20px; }
  .login__points { display: none; }
  .login__form { padding: 26px 20px 40px; }
}

/* ---------- Toast ---------- */
.toast-root { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  border-left: 3px solid var(--brand);
  font-size: 13px;
  animation: toast-in 0.18s ease;
}
.toast--error { border-left-color: var(--danger); }
.toast--success { border-left-color: var(--success); }
.toast--info { border-left-color: var(--brand); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 900;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px 24px;
  overflow-y: auto;
}
.modal {
  width: 100%;
  max-width: 600px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  max-height: 88vh;
  animation: modal-in 0.16s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal__head h3 { font-size: 15px; }
.modal__body { padding: 18px; overflow-y: auto; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }
@media (max-width: 640px) {
  .modal-mask { padding: 3vh 8px 16px; }
  .modal { max-height: 94vh; }
}

/* ---------- 钱包 ---------- */
.wallet-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.wallet-panel { display: none; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; background: #fafbfe; }
.wallet-panel.is-open { display: block; }
.wallet-panel h4 { font-size: 13px; margin-bottom: 10px; color: var(--text-2); }
.wallet-panel .form-grid { gap: 0 12px; }

/* ---------- 权限矩阵 ---------- */
.matrix-wrap { overflow-x: auto; }
.matrix { border-collapse: collapse; font-size: 13px; width: 100%; }
.matrix th, .matrix td { border: 1px solid var(--border); padding: 8px 10px; text-align: center; }
.matrix th { background: #fafafa; font-weight: 500; color: var(--text-2); }
.matrix td:first-child, .matrix th:first-child { text-align: left; white-space: nowrap; }
.matrix tbody tr:nth-child(even) td { background: #fbfcfe; }
.matrix .group-row td { background: #f3f6fc; color: var(--text-2); font-weight: 600; text-align: left; }
.matrix input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); }

/* ---------- 提示条 ---------- */
.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--brand-50);
  color: #1a3f7a;
  font-size: 13px;
  border: 1px solid var(--brand-100);
}
.notice--warn { background: var(--warning-bg); color: var(--warning); border-color: #ffd8be; }
.notice--danger { background: var(--danger-bg); color: var(--danger); border-color: #ffd4cf; }

/* ---------- 选项卡 ---------- */
.tabs { display: inline-flex; gap: 4px; padding: 3px; background: #f3f5f8; border-radius: var(--radius-sm); }
.tab {
  border: 0;
  background: transparent;
  padding: 5px 14px;
  border-radius: 4px;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
}
.tab.is-active { background: #fff; color: var(--brand); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }

/* 列表工具条 */
.list-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-tools .input, .list-tools .select { width: auto; min-width: 132px; }

/* ---------- 登录：小程序授权码 ---------- */
.login__divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 14px;
  color: var(--text-3);
  font-size: 12px;
}
.login__divider::before, .login__divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--border);
}

/* ---------- 电子相册 ---------- */
.album-cover {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  display: inline-block;
  background: var(--muted-bg);
}
.album-cover--empty { border: 1px dashed var(--border-strong); }
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
  margin-top: 4px;
}
.album-thumb { margin: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.album-thumb img { width: 100%; height: 132px; object-fit: cover; display: block; background: var(--muted-bg); }
.album-thumb figcaption { padding: 6px 8px; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: #fafbfe; }
.archive-pick-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fafbfe;
}
.archive-pick {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--border);
}
.archive-pick:hover { border-color: var(--brand-100); }
.archive-pick input { flex: 0 0 auto; }
.archive-pick img { width: 44px; height: 44px; border-radius: 4px; object-fit: cover; flex: 0 0 auto; background: var(--muted-bg); }
.archive-pick span { min-width: 0; display: flex; flex-direction: column; font-size: 12px; }
.archive-pick strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- AI 助手 ---------- */
.ai-chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 14px 0;
  max-height: 460px;
  overflow: auto;
  padding: 4px;
}
.ai-page { align-items: stretch; }
.ai-page > .card { display: flex; flex-direction: column; min-height: calc(100vh - 210px); }
.ai-page > .card > .card__body { flex: 1; display: flex; flex-direction: column; }
.ai-page .ai-chat { flex: 1; max-height: none; }
.ai-msg { max-width: 92%; border-radius: var(--radius); padding: 10px 12px; font-size: 13px; line-height: 1.65; }
.ai-msg--bot { align-self: flex-start; background: #f7f9fc; border: 1px solid var(--border); color: var(--text); }
.ai-msg--user { align-self: flex-end; background: var(--brand); color: #fff; }
.ai-msg--pending { color: var(--text-3); font-style: italic; }
.ai-msg--error { color: var(--danger); background: var(--danger-bg); border-color: #ffd4cf; }
.ai-msg__text { white-space: pre-wrap; }
.ai-ask { display: flex; gap: 8px; align-items: flex-end; }
.ai-ask .textarea { flex: 1 1 auto; resize: vertical; }
.ai-links { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ai-chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  min-height: 160px;
  margin-top: 14px;
  padding: 10px 4px 0;
  overflow-x: auto;
}
.ai-bar { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 56px; }
.ai-bar__value { font-size: 12px; font-weight: 600; color: var(--text-2); }
.ai-bar__track { height: 124px; width: 26px; display: flex; align-items: flex-end; background: #eef1f6; border-radius: 4px; overflow: hidden; }
.ai-bar__fill { width: 100%; background: linear-gradient(180deg, #4a86f7, var(--brand)); border-radius: 4px 4px 0 0; }
.ai-bar__label { font-size: 11px; color: var(--text-3); max-width: 76px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 通用小样式 ---------- */
.plain-list { margin: 0; padding-left: 18px; }
.plain-list li + li { margin-top: 4px; }
