/* ==========================================================================
   弱电管理 · 设计系统（设计变量 + 基础组件）
   与工资条 / 门户 / 心理系统**共用同一套变量**（数值逐字对齐），
   四个系统放在一起看必须是"一个学校的东西"，不是一个系统一个样。
   规矩：不新增色值、不用渐变、不用大投影、不用 emoji 当图标。
   ========================================================================== */

: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;
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.35; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
svg.icon { flex: 0 0 auto; }

/* 表格里的地址、掩码、SN 一律等宽 + 表格数字：对齐才好核对 */
.mono { font-family: var(--mono); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn--ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--danger { border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); }
.btn--sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn--lg { height: 40px; padding: 0 18px; font-size: 15px; }
.btn--block { width: 100%; }
.btn--icon { width: 32px; height: 32px; padding: 0; }

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

.field { margin-bottom: 14px; }
.field__label {
  display: block;
  margin-bottom: 5px;
  font-size: 12.5px;
  color: var(--text-2);
}
/* 字段下面的一行说明：解释"为什么这么填/会怎么用"。
   比挤在 label 里好读，也避免 label 长到换行。 */
.field__hint {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-3);
}
.input, .select, .textarea {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
}
.textarea { height: auto; padding: 8px 10px; line-height: 1.6; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.input--mono { font-family: var(--mono); }

/* ---------- 卡片 / 区块 ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.card__title { font-size: 14.5px; font-weight: 600; }
.card__desc { margin-top: 3px; font-size: 12.5px; color: var(--text-3); }
.card__body { padding: 16px; }
.card__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* ---------- 徽标 ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.badge--primary { background: var(--primary-soft); border-color: #cfe0ff; color: var(--primary); }
.badge--success { background: var(--success-soft); border-color: #cbe6d4; color: var(--success); }
.badge--warn { background: var(--warn-soft); border-color: #f0e0c0; color: var(--warn); }
.badge--danger { background: var(--danger-soft); border-color: #f4cfd2; color: var(--danger); }

/* ---------- 提示条 ---------- */

.message {
  display: flex;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 13px;
  line-height: 1.7;
}
.message--info { background: var(--primary-soft); border-color: #cfe0ff; border-left-color: var(--primary); }
.message--success { background: var(--success-soft); border-color: #cbe6d4; border-left-color: var(--success); }
.message--warn { background: var(--warn-soft); border-color: #f0e0c0; border-left-color: var(--warn); }
.message--error { background: var(--danger-soft); border-color: #f4cfd2; border-left-color: var(--danger); }

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

.table-wrap { width: 100%; overflow-x: auto; }
table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th, .table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.table th {
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 500;
  font-size: 12.5px;
  white-space: nowrap;
}
.table tbody tr:hover { background: var(--surface-2); }
.table td.actions { white-space: nowrap; text-align: right; }
.table .row-warn { background: var(--warn-soft); }

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

.empty { padding: 40px 20px; text-align: center; color: var(--text-3); }
.empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px; height: 52px;
  margin-bottom: 12px;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text-3);
}
.empty__title { font-size: 15px; color: var(--text-2); font-weight: 600; }
.empty__desc { margin-top: 6px; font-size: 13px; }

/* ---------- 标签页 ---------- */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  padding: 9px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ---------- 浮层 ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 24, 40, .38);
}
.modal {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.modal--wide { max-width: 860px; }
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.modal__body { padding: 16px; overflow-y: auto; }
.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.toast-host {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 80;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  max-width: 90vw;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  background: #1f2329;
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow-2);
}
.toast--error { background: var(--danger); }
.toast--success { background: var(--success); }

/* ---------- 小工具 ---------- */

.row { display: flex; align-items: center; gap: 10px; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.hidden { display: none !important; }
