/* =========================================================
   数据中枢 · 设计系统 v5 — MSI 红白灰企业级风格
   主色：MSI 红 #D70015  ·  白底灰字  ·  干净专业布局
   ========================================================= */

/* ---------------- 字体（轻量化：仅保留拉丁字形 Poppins 4 档） ----------------
 * 优化说明：
 *  1) 移除 AlibabaPuHui 4 个 TTF（合计约 32MB）。中文字形改用系统字体栈
 *     （PingFang SC / Microsoft YaHei / Noto Sans SC），零下载、渲染更快、
 *     视觉差异极小；原方案首屏需拉取 8MB+ 字体，是最大的性能瓶颈。
 *  2) Poppins 由 9 档精简为 4 档（400/500/600/700），其余字重由浏览器
 *     合成，体积从 1.4MB 降至约 620KB。
 * ------------------------------------------------------------------ */
@font-face { font-family: "Poppins"; src: url("/fonts/poppins/poppins-400.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/poppins/poppins-500.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/poppins/poppins-600.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/fonts/poppins/poppins-700.ttf") format("truetype"); font-weight: 700; font-display: swap; }

/* ---------------- 设计令牌（红白灰） ---------------- */
:root {
  /* 表面 */
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --inset: #f0f1f3;

  /* 文字层级 */
  --text: #1a1a1a;
  --text-soft: #555555;
  --muted: #888888;

  /* 品牌色：MSI 红 */
  --primary: #D70015;
  --primary-2: #B80012;
  --primary-strong: #A60010;
  --primary-soft: #FEF0F0;

  /* 语义色 */
  --success: #16a34a;  --success-soft: #f0fdf4;
  --warning: #d97706;  --warning-soft: #fffbeb;
  --danger: #dc2626;   --danger-soft: #fef2f2;
  --info: #2563eb;     --info-soft: #eff6ff;

  /* 边框 & 阴影 */
  --border: #eaeaea;
  --border-strong: #ddd;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .06);
  --shadow: 0 4px 14px rgba(0, 0, 0, .07);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .11);

  /* 圆角（精致克制） */
  --radius: 6px;
  --radius-lg: 8px;
  --radius-sm: 4px;

  /* 框架 */
  --topbar-bg: #ffffff;
  --topbar-text: #1a1a1a;
  --topbar-sub: #777777;
  --topbar-border: #eaeaea;
  --sidebar-bg: #ffffff;
}

[data-theme="dark"] {
  --bg: #0e0e0e;
  --surface: #161616;
  --surface-2: #1c1c1c;
  --inset: #121212;

  --text: #ececec;
  --text-soft: #a8a8a8;
  --muted: #666666;

  --primary: #EF233C;
  --primary-2: #FF3B52;
  --primary-strong: #D70015;
  --primary-soft: #2A0808;

  --success: #34d399;  --success-soft: #061a12;
  --warning: #fbbf24;  --warning-soft: #2a2004;
  --danger: #f87171;   --danger-soft: #2a1010;
  --info: #60a5fa;     --info-soft: #0c1a28;

  --border: #252525;
  --border-strong: #333333;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .35);
  --shadow: 0 6px 20px rgba(0, 0, 0, .45);
  --shadow-lg: 0 22px 56px rgba(0, 0, 0, .65);

  --topbar-bg: #141414;
  --topbar-text: #ececec;
  --topbar-sub: #999999;
  --topbar-border: #252525;
  --sidebar-bg: #141414;
}

/* ---------------- 全局重置 ---------------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .4s ease, color .3s ease;
  line-height: 1.55;
}
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -.01em; margin: 0; line-height: 1.25; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
a { color: var(--primary); }

/* 实色面板（无模糊，边界清晰） */
.glass { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }

/* =========================================================
   认证页
   ========================================================= */
.auth-view { position: fixed; inset: 0; display: grid; place-items: center; overflow: hidden; background: var(--bg); }
.auth-bg {
  position: absolute; inset: -10%;
  background:
    radial-gradient(420px 420px at 20% 20%, var(--primary-soft), transparent 60%),
    radial-gradient(480px 480px at 85% 85%, color-mix(in srgb, var(--primary) 15%, transparent), transparent 60%);
  opacity: .9; z-index: 0;
}
[data-theme="dark"] .auth-bg { opacity: .45; }
.auth-footer {
  position: absolute; bottom: 16px; left: 0; right: 0; z-index: 1;
  text-align: center; font-size: 12px; letter-spacing: .3px;
  color: var(--muted); pointer-events: none;
}
.auth-card {
  position: relative; z-index: 1; width: min(420px, 92vw); padding: 36px 32px 30px;
  border-radius: var(--radius-lg); background: var(--surface);
  border: 1px solid var(--border); border-top: 3px solid var(--primary); box-shadow: var(--shadow-lg);
}
.brand { text-align: center; margin-bottom: 24px; }
.brand-logo {
  width: auto; height: 42px; margin: 0 auto 14px;
  object-fit: contain;
}
.brand h1 { font-size: 22px; color: var(--text); }
.brand p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }

/* =========================================================
   表单
   ========================================================= */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: 14px; outline: none; transition: border-color .18s, box-shadow .18s;
}
[data-theme="dark"] .field input, [data-theme="dark"] .field select, [data-theme="dark"] .field textarea { background: var(--surface-2); }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* =========================================================
   按钮（红色主调）
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm); border: none; cursor: pointer;
  font-size: 14px; font-weight: 600; color: #ffffff;
  background: var(--primary);
  box-shadow: 0 3px 10px color-mix(in srgb, var(--primary) 26%, transparent);
  transition: transform .18s cubic-bezier(.16,1,.3,1), box-shadow .2s, filter .2s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 32%, transparent); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .50; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--text-soft); box-shadow: none; border: 1px solid var(--border-strong); }
.btn-ghost:hover { color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); border-color: var(--primary); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-danger { background: var(--danger); box-shadow: 0 3px 10px color-mix(in srgb, var(--danger) 24%, transparent); }
.btn-danger:hover { filter: brightness(1.04); }
.link { color: var(--primary); cursor: pointer; font-size: 13px; font-weight: 600; }
.link:hover { text-decoration: underline; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 13px; color: var(--muted); }

/* =========================================================
   主布局
   ========================================================= */
.main-view { min-height: 100vh; min-height: 100dvh; }

/* Topbar — 白底、细底边框、左侧 Logo + 右侧操作 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--topbar-bg); color: var(--topbar-text);
  border-bottom: 1px solid var(--topbar-border);
  display: flex; flex-direction: column; align-items: stretch;
  padding-top: env(safe-area-inset-top); /* 刘海屏顶部安全区 */
}
.topbar-main { display: flex; align-items: center; justify-content: space-between; padding: 10px 24px; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 14px; }
.brand-mini {
  font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 10px; color: var(--topbar-text);
}
.brand-mini img, .brand-mini-logo { height: 28px; width: auto; object-fit: contain; }
.brand-sub { white-space: nowrap; }
.topbar .icon-btn {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  cursor: pointer; font-size: 15px; color: var(--text-soft);
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
  transition: transform .18s, background .2s, color .2s, border-color .2s;
}
.topbar .icon-btn:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); transform: translateY(-1px); }
.topbar .user-chip { font-size: 13px; color: var(--topbar-sub); display: flex; align-items: center; gap: 9px; font-weight: 500; }
.topbar #logout-btn {
  color: var(--text-soft); border: 1px solid var(--border-strong); background: transparent;
  padding: 7px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.topbar #logout-btn:hover { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none;
}

.layout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 57px); }

/* =========================================================
   侧边导航（白底 / 左侧红色竖条选中态 / 分组）
   ========================================================= */
.sidebar {
  border-right: 1px solid var(--border); border-top: none; border-bottom: none; border-left: none;
  padding: 16px 12px; position: relative; background: var(--sidebar-bg);
  display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar nav { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.sidebar-foot {
  margin-top: auto; flex: none; padding: 14px 14px 2px; white-space: nowrap;
  font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: var(--muted);
  border-top: 1px solid var(--border);
}
.site-footer {
  text-align: center; padding: 18px 20px 24px;
  font-size: 12px; color: var(--muted); line-height: 1.5;
  border-top: 1px solid var(--border); background: var(--surface);
}

/* Logo 上传区域 */
.logo-upload-area { display: flex; flex-direction: column; gap: 10px; }
.logo-preview {
  display: flex; align-items: center; justify-content: center;
  height: 64px; padding: 10px; border: 1.5px dashed var(--border); border-radius: var(--radius-sm);
  background: var(--inset); overflow: hidden;
}
.logo-preview img { max-height: 100%; max-width: 240px; object-fit: contain; }
.logo-text-preview { font-size: 28px; line-height: 1; }
.logo-upload-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.logo-hint { font-size: 11.5px; color: var(--muted); }
.nav-group {
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); padding: 18px 14px 7px; margin-top: 4px;
  border-top: 1px solid var(--border);
}
.nav-group:first-child { border-top: none; margin-top: 0; padding-top: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text-soft); font-size: 14px; font-weight: 500;
  position: relative; transition: background .18s, color .18s, transform .15s;
}
.nav-item:hover { background: var(--inset); color: var(--text); transform: translateX(1px); }
.nav-item.active { background: var(--inset); color: var(--text); font-weight: 700; }
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: var(--primary);
}
.nav-item .ico {
  width: 28px; height: 28px; flex: none; display: grid; place-items: center;
  font-size: 16px; line-height: 1; border-radius: var(--radius-sm); background: var(--inset);
  transition: background .18s, transform .18s;
}
.nav-item:hover .ico { background: color-mix(in srgb, var(--text) 9%, transparent); transform: scale(1.04); }
.nav-item.active .ico { background: color-mix(in srgb, var(--text) 9%, transparent); }
.nav-label { line-height: 1.2; }

.content { padding: 24px 30px; max-width: 1240px; }

/* 公告跑马灯 — 中性底 + 左侧红线点缀 */
.announce-bar {
  overflow: hidden; white-space: nowrap;
  background: #f8f8f8; color: var(--text-soft);
  border-top: 1px solid var(--border);
  border-left: 3px solid var(--primary);
}
.announce-bar.hidden { display: none; }
.announce-track {
  display: inline-block; padding: 8px 0; padding-left: 100%;
  font-size: 13px; line-height: 1.5; color: var(--text-soft); font-weight: 500; letter-spacing: .15px;
  animation: marquee 24s linear infinite;
}
.announce-track:hover { } /* reserved */
.announce-bar:hover .announce-track { animation-play-state: paused; }
/* 公告文字红色、喇叭图标灰色（满足"字体红色、图标黑/灰"要求） */
.announce-icon { color: #444; margin-right: 6px; filter: grayscale(1); }
.announce-text { color: var(--primary); font-weight: 600; }
@keyframes marquee { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } }

/* =========================================================
   公告发布（管理员）
   ========================================================= */
.ann-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.ann-card { padding: 16px 18px; }
.ann-card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 10px;
}
.ann-card-title { font-size: 15px; font-weight: 600; color: var(--text); word-break: break-word; }
.ann-card-actions { display: flex; gap: 6px; flex: none; }
.ann-card-content {
  font-size: 14px; line-height: 1.65; color: var(--text-soft);
  white-space: pre-wrap; word-break: break-word;
  background: #fafafa; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px;
}
.ann-card-time { font-size: 12px; margin-top: 8px; }
.ann-form { margin-top: 16px; padding: 18px 20px; }
.ann-form .field { margin-bottom: 14px; }
.ann-form textarea { resize: vertical; min-height: 92px; font-family: inherit; }
.form-actions { display: flex; gap: 10px; margin-top: 4px; }
.btn-danger-text { color: var(--danger); }
.btn-danger-text:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.note-field .muted { font-size: 13px; line-height: 1.6; }
.ann-form[open], .ann-form { animation: annFade .2s ease; }
@keyframes annFade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================================
   卡片 / 区块 / 页头
   ========================================================= */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm); margin-bottom: 20px;
}
.card h2 { font-size: 17px; }
.card .sub { color: var(--muted); font-size: 13px; margin: 4px 0 16px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; }

/* =========================================================
   表格
   ========================================================= */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th {
  color: var(--text-soft); font-weight: 600; font-size: 12.5px; letter-spacing: .02em;
  background: var(--surface-2); position: sticky; top: 0; border-bottom: 1px solid var(--border-strong);
}
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--primary-soft); }
tbody tr:last-child td { border-bottom: none; }
.link-cell a { color: var(--primary); text-decoration: none; }
.link-cell a:hover { text-decoration: underline; }

.tag { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tag-article { background: var(--primary-soft); color: var(--primary); }
.tag-other { background: var(--info-soft); color: var(--info); }
.tag-admin { background: var(--warning-soft); color: var(--warning); }

/* =========================================================
   统计卡 / 图表
   ========================================================= */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; right: -24px; top: -24px; width: 84px; height: 84px; border-radius: 50%;
  background: linear-gradient(135deg, var(--text-soft), var(--border)); opacity: .07;
}
.stat .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat .value { font-size: 26px; font-weight: 800; margin-top: 6px; color: var(--text); letter-spacing: -.02em; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chart-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.chart-box h3 { margin: 0 0 12px; font-size: 15px; }
/* 图表画布容器：固定高度，避免饼图/柱图被拉得过大 */
.chart-canvas { position: relative; height: 232px; }
.chart-canvas--pie { height: 208px; max-width: 250px; margin: 0 auto; }

/* =========================================================
   选项卡 / 药丸
   ========================================================= */
.type-pills { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.pill {
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--border-strong);
  cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-soft);
  transition: all .2s; background: var(--surface);
  pointer-events: auto; position: relative; z-index: 1;
}
.pill:hover { border-color: var(--text-soft); color: var(--text); }
.pill.active {
  background: var(--text); color: #fff; border-color: transparent;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .14);
}
.pill.locked { pointer-events: none; opacity: .55; cursor: not-allowed; }

.sp-submit-banner { display: inline-block; font-size: 13px; font-weight: 700; padding: 5px 14px; border-radius: 8px; margin-top: 6px; letter-spacing: .3px; background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }

.sub-tabs { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.sub-pill {
  padding: 8px 18px; border-radius: var(--radius-sm); border: 1.5px solid var(--border-strong);
  cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-soft);
  transition: all .2s; background: transparent;
}
.sub-pill:hover { background: var(--inset); color: var(--text); }
.sub-pill.active {
  background: var(--text); color: #fff; border-color: transparent;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .15);
}

/* =========================================================
   动态提交行
   ========================================================= */
.dyn-row {
  display: grid; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 10px; background: var(--surface-2); position: relative; animation: fadeIn .3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.dyn-row .row-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.dyn-row .row-remove { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; line-height: 20px; text-align: center; font-size: 12px; padding: 0; border-radius: 4px; z-index: 1; }

/* =========================================================
   日历模块
   ========================================================= */
.year-nav { display: flex; align-items: center; gap: 10px; }
.year-label { font-size: 20px; font-weight: 800; min-width: 80px; text-align: center; color: var(--text); }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-soft); margin-right: 14px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot-current { background: var(--warning); }
.dot-submitted { background: var(--success); }
.dot-empty { background: var(--danger); }
.dot-gray { background: var(--muted); }

.calendar-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.cal-month {
  position: relative; padding: 20px 16px; border-radius: var(--radius); text-align: center;
  border: 1px solid var(--border); cursor: pointer;
  transition: all .25s cubic-bezier(.16,1,.3,1);
  background: var(--surface); user-select: none; box-shadow: var(--shadow-sm);
}
.cal-month:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--primary); }
.cal-month.current {
  border: 1px solid var(--warning);
  background: linear-gradient(135deg, var(--warning-soft), transparent);
  box-shadow: 0 0 0 1px var(--warning), var(--shadow);
}
.cal-month.past { opacity: .6; background: var(--surface-2); }
.cal-month.past:hover { opacity: .85; transform: translateY(-2px); }
.cal-month.future { opacity: .85; }

.cal-month-label { font-size: 21px; font-weight: 800; margin-bottom: 4px; color: var(--text); }
.cal-month.current .cal-month-label { color: var(--warning); }
.cal-submit-hint { font-size: 12px; margin-bottom: 8px; letter-spacing: .3px; padding: 3px 10px; border-radius: 6px; display: inline-block; font-weight: 600; line-height: 1.6; }
.cal-submit-hint.hint-past { background: #f0f2f5; color: #5d6b7e; }
.cal-submit-hint.hint-action { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }

.cal-status { display: inline-flex; align-items: center; gap: 5px; padding: 5px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 700; line-height: 1.4; }
.cal-status.submitted { background: var(--success-soft); color: var(--success); }
.cal-status.empty { background: var(--danger-soft); color: var(--danger); padding: 4px 12px; font-size: 12px; }
.cal-status.no-data { background: #e8ecf1; color: #5a6a7d; padding: 4px 12px; font-size: 12px; }
.cal-count { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

.cal-month.disabled { opacity: .40; cursor: not-allowed !important; pointer-events: none; }
.cal-month.disabled:hover { transform: none !important; box-shadow: var(--shadow-sm) !important; }
.cal-disabled-hint { font-size: 11px; color: var(--muted); margin-top: 6px; }

.year-picker { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 10px 0; }
.year-opt { min-width: 100px; font-size: 15px; }

.cal-readonly-tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 600; background: var(--inset); color: var(--muted);
  border: 1px solid var(--border);
}

/* =========================================================
   勾选列
   ========================================================= */
.check-label {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--text-soft);
  padding: 6px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  transition: background .15s;
}
.check-label:hover { background: var(--inset); }
.check-label input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }
.row-cb { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }

/* =========================================================
   工具条
   ========================================================= */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.toolbar .field { margin: 0; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.spacer { flex: 1; }

/* ---- 数据查看页：筛选行 / 操作栏 ---- */
.filter-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.filter-fields { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.filter-sep { color: var(--muted); font-size: 16px; user-select: none; }
.filter-actions { display: flex; gap: 8px; flex-shrink: 0; }
.filter-row input[type="date"] { min-width: 150px; height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.action-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; margin-bottom: 12px;
  background: #fffef5; border: 1px solid #f0e6d0; border-radius: var(--radius-sm);
}
.action-left, .action-right { display: flex; align-items: center; gap: 12px; }
.action-right .btn-danger { order: -1; }

/* ---- KOL 昵称模糊搜索下拉 ---- */
.kol-autocomplete-wrap { position: relative; min-width: 200px; }
.kol-autocomplete-wrap input {
  width: 100%; min-width: 200px; height: 34px; padding: 0 36px 0 12px;
  border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
  box-sizing: border-box; transition: border-color .2s, box-shadow .2s;
}
.kol-autocomplete-wrap input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(215,0,21,.08); }
.kol-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 220px; overflow-y: auto;
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.10); z-index: 50;
  display: none; list-style: none; margin: 0; padding: 4px 0;
}
.kol-dropdown.show { display: block; }
.kol-dropdown li {
  padding: 7px 14px; cursor: pointer; font-size: 13px; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.kol-dropdown li:hover, .kol-dropdown li.active { background: var(--inset); }
.kol-dropdown li .kd-nick { font-weight: 500; }
.kol-dropdown li .kd-name { color: var(--muted); font-size: 12px; }
.kol-dropdown .kd-empty { padding: 12px 14px; text-align: center; color: var(--muted); font-size: 13px; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }

/* =========================================================
   Toast
   ========================================================= */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  background: var(--surface); color: var(--text); padding: 13px 22px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); box-shadow: var(--shadow); z-index: 100; font-size: 14px; font-weight: 500;
  opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.success { border-color: var(--success); color: var(--success); }

/* =========================================================
   Modal
   ========================================================= */
.modal-mask { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: grid; place-items: center; z-index: 90; padding: 16px; }
.modal {
  width: min(620px, 96vw); max-height: 90vh; overflow: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px;
  box-shadow: var(--shadow-lg); animation: fadeIn .25s ease; border-top: 3px solid var(--primary);
}
.modal h3 { margin: 0 0 14px; }

/* =========================================================
   验证码 · 横向图标条（服务端出题 + 服务端校验目标下标）
   6 个图标排成一行，点击指定目标即可。极紧凑，不撑开登录弹窗。
   ========================================================= */
.captcha-bar-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap;
}
.captcha-bar-row label { margin-bottom: 0; font-size: 13.5px; }
.captcha-bar-prompt { font-size: 13px; color: var(--text-soft); }
.captcha-bar-prompt strong { color: var(--primary); font-size: 16px; }

.captcha-bar {
  display: flex; gap: 8px; justify-content: center;
}
.captcha-bar-cell {
  width: 48px; height: 48px; padding: 0;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  border-radius: 12px; font-size: 24px; line-height: 1; cursor: pointer;
  display: grid; place-items: center; user-select: none; flex: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s, border-color .12s, background .12s, box-shadow .12s;
}
.captcha-bar-cell:hover { border-color: var(--primary); transform: translateY(-2px); }
.captcha-bar-cell:active { transform: scale(.92); }
.captcha-bar-cell.tapped {
  border-color: var(--primary); background: var(--primary-soft);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.captcha-bar-footer {
  display: flex; align-items: center; justify-content: space-between; margin-top: 5px;
}
.captcha-hint { font-size: 11.5px; color: var(--muted); }
.captcha-refresh { font-size: 12px; }

/* 角色标签与角色下拉 */
.tag-super { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.role-select {
  padding: 5px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-family: inherit; font-size: 13px;
}

/* =========================================================
   站点设置
   ========================================================= */
#site-form textarea {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 14px; outline: none;
  resize: vertical; transition: border-color .2s, box-shadow .2s;
}
#site-form textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }

#inline-submit-area h3 { margin-bottom: 8px; }

/* =========================================================
   响应式
   ========================================================= */
.only-mobile { display: none !important; }

/* 移动端侧边栏遮罩：默认隐藏，侧边栏展开时由 JS 加 .show 显示，点击可关闭 */
.sidebar-backdrop {
  position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .42);
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.sidebar-backdrop.show { opacity: 1; pointer-events: auto; }

/* =========================================================
   数据统计模块（统计概览 / 当月统计）
   ========================================================= */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.ov-cell {
  position: relative; padding: 16px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
  transition: transform .25s cubic-bezier(.16,1,.3,1), box-shadow .25s, border-color .2s;
  box-shadow: var(--shadow-sm);
}
.ov-cell.has-data { cursor: pointer; }
.ov-cell.has-data:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--primary); }
.ov-cell.no-data { opacity: .62; background: var(--surface-2); }
.ov-month { font-size: 18px; font-weight: 800; margin-bottom: 4px; color: var(--text); }
.ov-cell.has-data .ov-month { color: var(--primary); }
.ov-submit-hint { font-size: 11.5px; margin-bottom: 8px; letter-spacing: .3px; padding: 2px 9px; border-radius: 5px; display: inline-block; font-weight: 600; line-height: 1.6; }
.ov-submit-hint.hint-past { background: #f0f2f5; color: #5d6b7e; }
.ov-submit-hint.hint-action { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.ov-empty { font-size: 12.5px; color: var(--muted); padding: 8px 0; text-align: center; }
.ov-metrics { display: flex; flex-direction: column; gap: 8px; }
.ov-metric { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ov-m-label { font-size: 12.5px; color: var(--text-soft); font-weight: 500; }
.ov-m-value { font-size: 16px; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
.ov-m-value.money { color: var(--primary); }

/* 月份输入框（统计页 / 当月统计） */
.month-input {
  min-width: 150px; height: 34px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
  background: var(--surface); color: var(--text); font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
[data-theme="dark"] .month-input { background: var(--surface-2); }
.month-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }

/* 当月统计：可点击钻取单元格 */
.cm-click { cursor: pointer; }
.cm-click:hover { background: var(--primary-soft); }
.cm-click .link { pointer-events: none; }
.strong { font-weight: 700; }

/* =========================================================
   统计弹层（用户汇总 / 明细）
   ========================================================= */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .2s ease;
}
.modal-box {
  width: min(960px, 96vw); max-height: 88vh;
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
  animation: slideUp .28s cubic-bezier(.16,1,.3,1);
}
.modal-box.modal-lg { width: min(1100px, 96vw); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { margin: 0; font-size: 17px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--inset);
  font-size: 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-soft); transition: all .2s; flex-shrink: 0;
}
.modal-close:hover { background: var(--danger-soft, #fef2f2); color: #dc2626; }
.modal-filter {
  display: flex; align-items: center; gap: 10px; padding: 12px 22px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
  background: var(--surface-2, #f8f9fa);
}
.modal-filter input {
  flex: 1; min-width: 200px; height: 34px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
  background: var(--surface); color: var(--text); font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.modal-filter input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.modal-body {
  flex: 1; overflow: auto; padding: 16px 22px;
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 260px;
    transform: translateX(-100%); transition: transform .28s cubic-bezier(.16,1,.3,1); z-index: 40;
    box-shadow: var(--shadow-lg); padding-top: calc(56px + env(safe-area-inset-top));
    padding-bottom: env(safe-area-inset-bottom);
    overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  .sidebar.open { transform: none; }
  /* 遮罩层覆盖全屏（包括顶栏下方），确保点击可关闭 */
  .sidebar-backdrop {
    top: 0;
  }
  .only-mobile { display: inline-flex !important; }
  .brand-sub { display: none; }            /* 移动端隐藏副标题，只留 logo */
  .content { padding: 18px 16px; }
  .chart-grid { grid-template-columns: 1fr; }
  .row-2 { grid-template-columns: 1fr; }
  .calendar-grid { grid-template-columns: repeat(2, 1fr); }
  .overview-grid { grid-template-columns: repeat(2, 1fr); }

  /* 表单输入字号 ≥16px，避免 iOS 聚焦时整页缩放 */
  .field input, .field select, .field textarea { font-size: 16px; }
  .auth-card { width: min(420px, 92vw); }
  /* 筛选条 / 工具条在窄屏整行铺满，避免横向溢出 */
  .filter-row input, .filter-row select, .toolbar input, .toolbar select, .month-input { width: 100%; min-width: 0; }
  .filter-fields { width: 100%; }
  .filter-actions { width: 100%; }
  .filter-actions .btn { flex: 1; }
  /* 表格在移动端更紧凑，减少横向滑动幅度 */
  .table-wrap table { font-size: 12.5px; min-width: 520px; }
  th, td { padding: 9px 10px; }
  .topbar-main { padding: 9px 14px; }
  .modal { padding: 18px 16px; border-radius: var(--radius); }
  .auth-footer { bottom: calc(16px + env(safe-area-inset-bottom)); }
}

@media (max-width: 480px) {
  .content { padding: 14px 12px; }
  .topbar-main { padding: 8px 10px; gap: 6px; }
  .topbar-left, .topbar-right { gap: 8px; }
  .user-chip .uname { display: none; }      /* 仅保留头像，节省顶栏空间 */
  .brand-mini { font-size: 15px; gap: 8px; }
  .auth-card { padding: 26px 18px 22px; }
  .calendar-grid { grid-template-columns: 1fr; }   /* 超窄屏月份单列更清晰 */
  .overview-grid { grid-template-columns: 1fr; }
  .stat .value { font-size: 22px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .btn-guide .txt-long { display: none; }
  .captcha-bar { gap: 6px; }
  .captcha-bar-cell { width: 44px; height: 44px; font-size: 22px; border-radius: 10px; }
  .captcha-hint { font-size: 11px; }
  .filter-row, .toolbar { gap: 8px; }
  .ann-cards { grid-template-columns: 1fr; }
  .modal-box { padding: 0; }
  .modal-header { padding: 14px 16px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
  .modal-body { padding: 14px 16px; }
  .row-2 { gap: 0; }   /* 单列时去掉多余间距 */
}

@media (max-width: 380px) {
  .topbar-main { padding: 6px 8px; }
  .brand-mini { font-size: 14px; }
  .auth-card { width: 94vw; padding: 22px 14px 18px; }
  .brand h1 { font-size: 20px; }
  .site-footer { padding: 14px 12px 20px; }
}

/* ---------- 操作指南按钮（顶栏，退出按钮旁） ---------- */
.btn-guide {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: transform .2s cubic-bezier(.16,1,.3,1), box-shadow .2s ease, background .2s ease, color .2s ease;
  user-select: none;
}
.btn-guide:hover { transform: translateY(-1px); }

/* 普通用户：红色高亮 */
.btn-guide--user {
  background: linear-gradient(135deg, #e11d2a, #c11622);
  color: #fff;
  box-shadow: 0 6px 18px rgba(225, 29, 42, .35);
  animation: guidePulse 2.4s ease-in-out infinite;
}
.btn-guide--user:hover {
  background: linear-gradient(135deg, #ef2a37, #c11622);
  box-shadow: 0 8px 22px rgba(225, 29, 42, .45);
}
@keyframes guidePulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(225, 29, 42, .35); }
  50% { box-shadow: 0 6px 26px rgba(225, 29, 42, .55); }
}

/* 管理员：描边样式（与品牌色一致，区别于红色） */
.btn-guide--admin {
  background: transparent;
  color: var(--accent, #D70015);
  border-color: var(--accent, #D70015);
}
.btn-guide--admin:hover {
  background: rgba(215, 0, 21, .08);
  box-shadow: 0 6px 16px rgba(215, 0, 21, .18);
}
@media (max-width: 640px) {
  .btn-guide { padding: 7px 11px; font-size: 12px; }
  .btn-guide .txt-long { display: none; }
}
