:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --fill: #f5f5f7;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --line: rgba(0, 0, 0, .09);
  --line-2: rgba(0, 0, 0, .055);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: #e8f1fd;
  --danger: #ff3b30;
  --danger-soft: #ffe5e3;
  --success: #34c759;
  --success-soft: #e5f8ea;
  --warning: #ff9f0a;
  --warning-soft: #fff2dc;
  --violet: #bf5af2;
  --violet-soft: #f4e8fd;
  --radius: 18px;
  --radius-lg: 24px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow: 0 2px 10px rgba(0, 0, 0, .05), 0 10px 34px rgba(0, 0, 0, .06);
  --shadow-lg: 0 30px 70px rgba(0, 0, 0, .16);
  --header-h: 54px;
  --fc-bg: #f2f7ff;
  --fc-line: #dce9fc;
  --fc-head: #e6efff;
  --fc-text: #24529e;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "SF Pro SC", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4 { margin: 0 0 .45em; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0 0 .7em; }
button { font: inherit; }
input, textarea, select { font: inherit; color: inherit; }

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 22px;
}

/* ============ 顶部导航（Apple 风格毛玻璃） ============ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, .72);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, .06);
}

.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 22px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 22px;
}

.brand a {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--text);
}

.brand .logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(135deg, #0a84ff, #5e5ce6);
  color: #fff;
  font-size: 15px;
  box-shadow: 0 2px 8px rgba(10, 132, 255, .25);
}

.main-nav { display: flex; gap: 2px; flex: 1; }

.nav-link {
  padding: 6px 13px;
  border-radius: 980px;
  color: var(--text-2);
  font-weight: 500;
  font-size: 14px;
  transition: color .15s, background .15s;
}
.nav-link:hover { background: rgba(0, 0, 0, .05); color: var(--text); }
.nav-link.active { color: var(--text); }

.user-area { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 4px;
  border-radius: 980px;
  background: var(--fill);
  font-size: 13px;
  color: var(--text-2);
}

.user-chip .avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
}

.user-chip .role-badge {
  color: #8a6100;
  font-size: 12px;
  background: var(--warning-soft);
  padding: 0 7px;
  border-radius: 980px;
  line-height: 1.7;
}

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: 980px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.35;
  white-space: nowrap;
  user-select: none;
  transition: background .16s, border-color .16s, color .16s,
    box-shadow .16s, transform .1s, opacity .16s;
}

.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); color: #fff; }

.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #2fb550; color: #fff; }

.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent); }

.btn-outline {
  background: transparent;
  border-color: var(--line);
  color: var(--accent);
}
.btn-outline:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.btn-sm { padding: 4px 13px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-icon { padding: 6px 10px; }

/* ============ 表单 ============ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 22px;
}

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > label { font-size: 14px; font-weight: 600; color: var(--text); }
.field .hint { color: var(--text-3); font-size: 12px; font-weight: 400; margin-left: 4px; }

.input, .textarea, .select {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--fill);
  outline: none;
  font-size: 14px;
  transition: background .16s, box-shadow .16s, border-color .16s;
}

.input:focus, .textarea:focus, .select:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, .16);
}

.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 84px; }
.input[type="file"] { padding: 6px; }
.checkbox-line { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }

/* ============ 卡片与面板 ============ */
.panel {
  background: var(--surface);
  border: 1px solid rgba(0, 0, 0, .05);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.panel-pad { padding: 26px; }

.page-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -.022em;
  margin: 34px 0 22px;
  text-align: center;
}
.page-sub { color: var(--text-2); margin: 0 0 20px; }

.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 13px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 10px;
  border-radius: 980px;
  font-size: 12px;
  line-height: 1.75;
  background: var(--fill);
  color: var(--text-2);
  white-space: nowrap;
}

.badge.period { background: var(--accent-soft); color: #0060c4; }
.badge.category { background: var(--success-soft); color: #1e8e3e; }
.badge.role-admin { background: var(--warning-soft); color: #94600d; }
.badge.role-user { background: var(--accent-soft); color: #0060c4; }

.empty-state { text-align: center; color: var(--text-3); padding: 70px 20px; }
.empty-state .empty-icon { font-size: 46px; margin-bottom: 12px; }

/* ============ 顶部统计 + 筛选背景框 ============ */
.top-panel {
  background: var(--surface);
  border: 1px solid rgba(0, 0, 0, .05);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 26px 26px 14px;
  margin: 28px 0 30px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0 0 22px;
}

.stat-card {
  background: var(--fill);
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: background .18s, transform .18s;
}

.stat-card:hover { background: #efeff1; transform: translateY(-1px); }

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  background: var(--accent-soft);
  flex: none;
}

.stat-icon.green { background: var(--success-soft); }
.stat-icon.amber { background: var(--warning-soft); }
.stat-icon.violet { background: var(--violet-soft); }

.stat-num { font-size: 25px; font-weight: 650; line-height: 1.15; letter-spacing: -.02em; }
.stat-label { color: var(--text-2); font-size: 12.5px; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 18px 0 4px;
  border-top: 1px solid var(--line-2);
}

.search-box { position: relative; flex: 1; min-width: 230px; max-width: 420px; }
.search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 15px;
  pointer-events: none;
}
.search-box .input { padding-left: 38px; border-radius: 980px; }
.month-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.month-filter .mf-label { font-size: 13px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.month-filter .mf-input {
  width: 168px;
  border-radius: 980px;
  font-size: 13px;
  padding: 6px 14px;
}
.result-count { color: var(--text-2); font-size: 13px; white-space: nowrap; }

.cat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 8px 0 6px;
}

.cat-tab {
  border: none;
  background: var(--fill);
  color: var(--text-2);
  padding: 5px 15px;
  border-radius: 980px;
  cursor: pointer;
  font-size: 13px;
  transition: background .15s, color .15s, transform .1s;
}
.cat-tab:hover { background: #e9e9ec; color: var(--text); }
.cat-tab:active { transform: scale(.97); }
.cat-tab.active { background: var(--accent); color: #fff; }
.cat-tab .count { opacity: .7; font-size: 12px; margin-left: 3px; }

/* ============ 月份分组与卡片网格 ============ */
.month-group { margin: 26px 0 34px; }
.month-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 15px; }
.month-head h2 { font-size: 19px; font-weight: 650; margin: 0; }
.month-head .count-badge {
  background: rgba(0, 0, 0, .06);
  color: var(--text-2);
  border-radius: 980px;
  padding: 1px 10px;
  font-size: 12.5px;
  font-weight: 600;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(300px, 1fr));
  gap: 8px;
  align-items: start;
}

.doc-card {
  background: var(--surface);
  border: 1px solid rgba(0, 0, 0, .06);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform .2s cubic-bezier(.25, .1, .25, 1),
    box-shadow .2s, border-color .2s;
}

.doc-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: rgba(0, 0, 0, .1);
}

.doc-card.has-forecast { grid-column: 1 / -1; }

.card-inner {
  display: grid;
  grid-template-columns: minmax(240px, .8fr) minmax(380px, 1.2fr);
  gap: 26px;
  padding: 24px 28px 6px;
  align-items: center;
}

.doc-card .card-body { padding: 20px 22px 2px; }
.card-left {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.card-left .doc-title { margin-bottom: 2px; }
.card-left .doc-badges { margin: 8px 0 2px; }
.card-left .doc-desc { margin: 8px 0 10px; }
.card-left .doc-tags { margin: 6px 0 10px; }
.card-left .doc-meta { margin-top: 4px; padding-bottom: 10px; }
.card-left .doc-actions { padding: 8px 0 12px; }

.doc-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.012em;
  line-height: 1.4;
  color: var(--text);
}
.doc-title a { min-width: 0; color: inherit; }
.doc-title a:hover { color: var(--accent); }

.new-tag {
  flex: none;
  display: inline-block;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1.6;
  padding: 1px 6px;
  border-radius: 5px;
  text-transform: uppercase;
  white-space: nowrap;
}
.doc-desc {
  color: var(--text-2);
  font-size: 13.5px;
  margin: 8px 0 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.doc-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 9px 0 4px; }

.doc-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 10px; }
.tag {
  background: var(--fill);
  color: var(--text-2);
  padding: 1px 9px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.75;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  color: var(--text-3);
  font-size: 12.5px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line-2);
}

.doc-actions { display: flex; gap: 8px; padding: 11px 22px 4px; flex-wrap: wrap; }
.doc-card.has-forecast .doc-actions { padding-left: 0; padding-right: 0; }

.card-hint {
  margin-top: auto;
  padding: 8px 22px 10px;
  color: var(--text-3);
  font-size: 12px;
  border-top: 1px solid var(--line-2);
  text-align: right;
  background: linear-gradient(#fff, var(--surface-2));
}

/* ============ 预测数据表（对齐 + 与左侧内容保持适中距离） ============ */
.forecast-wrap {
  min-width: 0;
  align-self: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.forecast-wrap .fc-label {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 600;
  margin: 0 0 10px;
  letter-spacing: .01em;
}

.fc-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--fc-bg);
  border: 1px solid var(--fc-line);
  border-radius: 16px;
  overflow: hidden;
  font-size: 13.5px;
}

.fc-table th, .fc-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--fc-line);
  vertical-align: middle;
  word-break: break-word;
  text-align: left;
}

.fc-table th:first-child { border-top-left-radius: 15px; }
.fc-table th:last-child { border-top-right-radius: 15px; }
.fc-table tr:last-child td:first-child { border-bottom-left-radius: 15px; }
.fc-table tr:last-child td:last-child { border-bottom-right-radius: 15px; }
.fc-table tr:last-child th, .fc-table tr:last-child td { border-bottom: none; }

.fc-table thead th {
  background: var(--fc-head);
  color: var(--fc-text);
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
}

.fc-table th:nth-child(1), .fc-table td:nth-child(1) { width: 132px; }
.fc-table tbody td { color: var(--text); }
.fc-table tbody td:first-child { color: var(--fc-text); font-weight: 500; }
.fc-table .fc-row-more {
  text-align: center;
  background: rgba(255, 255, 255, .65);
}
.fc-table .fc-row-more button {
  border: none;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 12.5px;
  padding: 4px 12px;
  border-radius: 980px;
}
.fc-table .fc-row-more button:hover { background: var(--accent-soft); }

.fc-table.collapsed tbody tr.hide-row { display: none; }
.fc-short { display: none; }

/* ============ 详情页 ============ */
.doc-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.doc-hero h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 10px; word-break: break-word; }

.doc-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px 20px;
  padding: 16px 0;
}

.doc-info-item .k { color: var(--text-3); font-size: 12px; margin-bottom: 1px; }
.doc-info-item .v { font-weight: 500; font-size: 13.5px; word-break: break-word; }

.fc-strip {
  border: 1px solid var(--fc-line);
  border-radius: var(--radius-lg);
  background: var(--fc-bg);
  margin: 16px 0;
  overflow: hidden;
}

.fc-strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  cursor: pointer;
  user-select: none;
  color: var(--fc-text);
  font-weight: 600;
  font-size: 14px;
}
.fc-strip-head:hover { background: rgba(230, 239, 255, .6); }
.fc-strip-head .fc-arrow { transition: transform .2s; color: var(--accent); }
.fc-strip.collapsed .fc-arrow { transform: rotate(-90deg); }
.fc-strip-body { max-height: 236px; overflow: auto; padding: 0 16px 14px; }
.fc-strip.collapsed .fc-strip-body { display: none; }

.preview-box {
  background: var(--surface);
  border: 1px solid rgba(0, 0, 0, .06);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 22px;
  box-shadow: var(--shadow-sm);
}

.preview-frame {
  width: 100%;
  height: 72vh;
  min-height: 460px;
  border: none;
  display: block;
  background: #fff;
}

.preview-note {
  padding: 14px 20px;
  border-top: 1px solid var(--line-2);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface-2);
}

.preview-banner {
  padding: 16px 22px;
  border-left: 4px solid var(--success);
  background: var(--success-soft);
  color: #1c6b2f;
}
.preview-banner.warn { border-left-color: var(--warning); background: var(--warning-soft); color: #8a5a00; }

.unsupported-box { text-align: center; padding: 76px 20px; color: var(--text-2); }
.unsupported-box .icon { font-size: 54px; margin-bottom: 14px; }
.unsupported-box h3 { font-size: 20px; color: var(--text); }
.unsupported-box .btns { margin-top: 20px; }

/* ============ 页签 ============ */
.main-tabs, .sub-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line-2);
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.main-tabs { margin-top: 28px; }

.tab-btn {
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: 14.5px;
  transition: color .15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-page { display: none; }
.tab-page.active { display: block; }

/* ============ 表格 ============ */
.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(0, 0, 0, .06);
  border-radius: var(--radius-lg);
  background: #fff;
}

.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 680px; }
.data-table th {
  background: var(--surface-2);
  text-align: left;
  font-weight: 600;
  color: var(--text-2);
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
  font-size: 12.5px;
}
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; word-break: break-word; }
.data-table tbody tr:hover { background: #fafafa; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .title-cell { font-weight: 600; min-width: 200px; }
.data-table .ops-cell { white-space: nowrap; text-align: right; }

.table-headbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; flex-wrap: wrap; }
.table-headbar h3 { margin: 0; font-size: 17px; }
.table-headbar .count-badge {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 980px;
  padding: 1px 11px;
  font-size: 12.5px;
  font-weight: 600;
  margin-left: 6px;
}

.user-link { color: var(--accent); cursor: pointer; font-weight: 600; }
.user-link:hover { text-decoration: underline; }
.password-cell {
  font-family: var(--mono);
  color: var(--text-2);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============ 上传区 ============ */
.upload-zone {
  border: 1.5px dashed rgba(0, 0, 0, .18);
  border-radius: var(--radius-lg);
  padding: 34px 20px;
  text-align: center;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .16s, background .16s;
  color: var(--text-2);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}
.upload-zone .up-icon { font-size: 34px; }
.upload-zone .up-name { margin-top: 8px; font-weight: 600; color: var(--accent); word-break: break-all; }
.upload-zone .up-size { font-size: 12px; color: var(--text-3); }
.upload-zone input[type="file"] { display: none; }

.forecast-editor {
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  overflow: auto;
  max-height: 440px;
  background: #fff;
}

.forecast-editor table { width: 100%; border-collapse: collapse; min-width: 640px; }
.forecast-editor th, .forecast-editor td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); text-align: left; }
.forecast-editor th { background: var(--surface-2); font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.forecast-editor .input { padding: 6px 10px; font-size: 13px; }
.forecast-editor .row-del { width: 40px; text-align: center; }
.fc-count { color: var(--text-2); font-size: 12.5px; margin-left: auto; }

.email-rows { display: flex; flex-direction: column; gap: 8px; }
.email-row { display: flex; gap: 8px; }
.email-row .email-addr { flex: 1; min-width: 0; }
.email-row .email-row-del { flex: none; }

.form-actions { display: flex; gap: 10px; margin-top: 24px; align-items: center; flex-wrap: wrap; }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .35);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn .16s ease;
}

.modal {
  background: #fff;
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 460px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  animation: popIn .2s cubic-bezier(.2, .8, .3, 1);
}

.modal.wide { max-width: 780px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; font-weight: 650; font-size: 17px; }
.modal-close {
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 50%;
}
.modal-close:hover { background: var(--fill); color: var(--text); }
.modal-body { padding: 14px 22px 20px; overflow: auto; }
.modal-foot { padding: 0 22px 20px; display: flex; justify-content: flex-end; gap: 9px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }

.logs-scroll { max-height: 54vh; overflow: auto; }

/* ============ Toast ============ */
.toast-wrap {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: rgba(29, 29, 31, .92);
  color: #fff;
  padding: 9px 20px;
  border-radius: 980px;
  font-size: 13.5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
  animation: toastIn .2s ease;
  max-width: min(560px, 90vw);
  text-align: center;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.toast.error { background: rgba(255, 59, 48, .94); }
.toast.success { background: rgba(52, 199, 89, .94); }
@keyframes toastIn { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============ 登录页（Apple 风格） ============ */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #e8f2ff 0%, var(--bg) 55%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid rgba(0, 0, 0, .06);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 44px 38px 32px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.015em;
  margin-bottom: 30px;
  text-align: center;
}

.login-brand .logo {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a84ff, #5e5ce6);
  color: #fff;
  font-size: 30px;
  box-shadow: 0 12px 30px rgba(10, 132, 255, .3);
}

.login-card .field { margin-bottom: 16px; }
.login-card .input { padding: 13px 16px; border-radius: 14px; }
.login-error {
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.login-tip { margin-top: 22px; font-size: 13px; color: var(--text-2); text-align: center; }

/* ============ 工具类 ============ */
.hidden { display: none !important; }
.flex { display: flex; align-items: center; gap: 8px; }
.spread { justify-content: space-between; }
.mt0 { margin-top: 0; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; } .mt20 { margin-top: 20px; }
.mb0 { margin-bottom: 0; } .mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
.mb16 { margin-bottom: 16px; } .mb20 { margin-bottom: 20px; }
.text-center { text-align: center; }
.text-danger { color: var(--danger); }
.nowrap { white-space: nowrap; }

.spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn .spinner { border-color: rgba(0, 113, 227, .25); border-top-color: currentColor; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 响应式 ============ */
@media (max-width: 1100px) {
  .doc-grid { grid-template-columns: repeat(2, minmax(280px, 1fr)); }
  .doc-card.has-forecast { grid-column: 1 / -1; }
}

@media (max-width: 960px) {
  .card-inner { grid-template-columns: 1fr; gap: 22px; align-items: start; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .fc-full { display: none; }
  .fc-short { display: inline; }
  .header-inner { gap: 8px; padding: 0 14px; }
  .brand a { font-size: 15px; }
  .nav-link { padding: 6px 10px; font-size: 13px; }
  .container { padding: 0 14px; }
  .top-panel { padding: 18px 16px 10px; }
  .page-title { font-size: 28px; margin-top: 24px; }
  .doc-hero h1 { font-size: 22px; }
  .preview-frame { height: 62vh; }
}

@media (max-width: 640px) {
  .doc-grid { grid-template-columns: 1fr; }
  .stats-grid { gap: 10px; }
  .stat-card { padding: 12px 14px; gap: 10px; }
  .stat-num { font-size: 21px; }
  .doc-actions .btn { flex: 1; }
  .user-chip .role-badge { display: none; }
  .card-inner { padding: 18px 18px 4px; }
  .login-card { padding: 34px 24px 24px; }
}
