/* ==========================================================================
   瓶窑一中 · 统一门户 —— 基础样式
   抄自「钉钉工资条」app/static/app.css：**顶部的设计 tokens 与用到的组件原样复用**，
   只删掉门户用不上的部分（导航栏、分页、进度条、筛选 chips 等）。

   为什么不是重写一份：六个系统的观感必须一致 —— 老师从门户点进工资条，
   不该觉得换了一个网站。所以配色、圆角、字号、按钮高度一律照旧，不自创色值。
   基调：学校内部工具的入口页 —— 克制、能一眼扫完、无装饰。
   ========================================================================== */

:root {
  --bg: #f5f6f8;
  --surface: #fff;
  --surface-2: #fafbfc;
  --border: #e3e6eb;
  --border-strong: #d0d5dd;
  --text: #1f2329;
  --text-2: #5a6270;
  --text-3: #8a93a2;
  --primary: #1677ff;
  --primary-hover: #0e5fd8;
  --primary-soft: #eef4ff;
  --success: #17803d;
  --success-soft: #eaf6ee;
  --warn: #a15c07;
  --warn-soft: #fdf3e3;
  --danger: #c02626;
  --danger-soft: #fdeced;
  --radius: 6px;
  --radius-sm: 4px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
  --shadow-2: 0 4px 12px rgba(16, 24, 40, .08);
  --nav-w: 224px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.4; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.icon { flex: 0 0 auto; vertical-align: -3px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ---------- 布局辅助 ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.card__title { font-size: 14px; }
.card__desc { font-size: 12.5px; color: var(--text-3); line-height: 1.7; }

.card__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.card__body--flush { padding: 0; gap: 0; }
.card__foot { padding: 12px 16px; border-top: 1px solid var(--border); }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 14px;
}

.page-title { font-size: 18px; }
.page-desc { font-size: 12.5px; color: var(--text-3); margin-top: 2px; line-height: 1.7; }

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
  line-height: 1;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}

.btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn:active:not(:disabled) { background: var(--surface-2); }

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

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

.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border); color: var(--text); }

.btn--sm { min-height: 26px; padding: 0 9px; font-size: 12.5px; }
.btn--lg { min-height: 42px; padding: 0 18px; font-size: 14.5px; }
.btn--block { width: 100%; }

.btn:disabled,
.is-disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 表单 ---------- */

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field__label { font-size: 12.5px; color: var(--text-2); }
.field__note { font-size: 12px; color: var(--text-3); line-height: 1.6; }

.input {
  width: 100%;
  min-height: 32px;
  padding: 5px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.input:hover { border-color: var(--text-3); }
.input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 2px var(--primary-soft); }
.input::placeholder { color: var(--text-3); }
.input:disabled { background: var(--surface-2); color: var(--text-2); cursor: not-allowed; }

select.input { padding-right: 6px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }

/* 开关 */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  position: relative;
  flex: 0 0 auto;
  width: 34px;
  height: 20px;
  background: var(--border-strong);
  border-radius: 10px;
  transition: background-color .14s ease;
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform .14s ease;
}
.switch input:checked + .switch__track { background: var(--primary); }
.switch input:checked + .switch__track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch input:disabled + .switch__track { opacity: .5; cursor: not-allowed; }
.switch__label { font-size: 13px; }

/* ---------- 徽章 ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  font-size: 12px;
  line-height: 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.badge--success { color: var(--success); background: var(--success-soft); border-color: #bfe3cb; }
.badge--danger { color: var(--danger); background: var(--danger-soft); border-color: #f0c2c2; }
.badge--warn { color: var(--warn); background: var(--warn-soft); border-color: #eed6ab; }
.badge--info { color: var(--primary); background: var(--primary-soft); border-color: #c7dcff; }
.badge--neutral { color: var(--text-2); background: var(--surface-2); border-color: var(--border); }

/* ---------- 消息块 ---------- */

.message {
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.65;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  word-break: break-word;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message--success { color: var(--success); background: var(--success-soft); border-color: #bfe3cb; }
.message--error { color: var(--danger); background: var(--danger-soft); border-color: #f0c2c2; }
.message--warn { color: var(--warn); background: var(--warn-soft); border-color: #eed6ab; }
.message--info { color: var(--primary); background: var(--primary-soft); border-color: #c7dcff; }
.message a { color: inherit; text-decoration: underline; }

/* ---------- 表格 ---------- */

.table-wrap { overflow: auto; max-height: 70vh; }

.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }

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

.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface-2);
  white-space: nowrap;
  box-shadow: inset 0 -1px 0 var(--border);
}

.table tbody tr { height: 40px; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }

.table__empty { padding: 30px 12px !important; text-align: center; color: var(--text-3); }
.table__empty--error { color: var(--danger); }

.cell-main { display: block; }
.cell-sub { display: block; margin-top: 1px; font-size: 12px; color: var(--text-3); word-break: break-all; }

/* 表格行里的图标 + 名称：图标是内联 SVG（stroke-width 1.5），与首页卡片同一套 */
.cell-icon { display: flex; align-items: center; gap: 8px; }
.cell-icon .icon { color: var(--primary); }

/* 排序的两个小按钮：紧挨在一起，像一对 */
.order-btns { display: inline-flex; gap: 4px; }
.order-btns .btn { padding: 0 7px; }
.order-btns .btn svg { display: block; }

/* ---------- 空状态 ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-3);
}
.empty__icon { color: var(--border-strong); }
.empty__title { font-size: 13.5px; color: var(--text-2); }
.empty__desc { font-size: 12.5px; max-width: 460px; line-height: 1.7; }

/* ---------- 弹窗 / toast ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 24, 40, .28);
}

.modal {
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
}
.modal__head { padding: 14px 16px 0; font-size: 15px; font-weight: 600; }
.modal__body { padding: 8px 16px 0; font-size: 13px; color: var(--text-2); line-height: 1.7; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px; }

.toasts {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 460px);
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.6;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-1);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.toast--success { border-left-color: var(--success); }
.toast--error { border-left-color: var(--danger); }
.toast--warn { border-left-color: var(--warn); }
.toast--info { border-left-color: var(--primary); }

/* ---------- 响应式 ---------- */

@media (max-width: 860px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .table-wrap { max-height: none; }
}

@media (max-width: 720px) {
  body { font-size: 13px; }
  .card__body, .card__head, .card__foot { padding-left: 12px; padding-right: 12px; }
}
