/* ===== 上班鼓励器 · 管理后台（原型）===== */

:root {
  --bg: #F6F1E7;
  --panel: #FDFBF6;
  --ink: #2E241B;
  --ink-soft: #6F6154;
  --ink-faint: #9A8C7C;
  --wood: #B2714B;
  --wood-deep: #7C4A2F;
  --line: #E6DCC9;
  --ok: #4C7A5A;
  --warn: #C08A2D;
  --bad: #B3543E;
  --shadow: 0 1px 2px rgba(60, 40, 20, 0.06), 0 8px 24px rgba(60, 40, 20, 0.07);
}

* { box-sizing: border-box; }

/* hidden 属性优先于任何 display 声明（否则 .modal-mask 这类 display:flex 会盖住 hidden，遮罩常驻挡点击） */
[hidden] { display: none !important; }

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

body {
  min-width: 1120px;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

/* ===== 顶栏 ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 26px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 260px; }

.brand-mark { width: 34px; height: 34px; color: var(--wood-deep); }

.brand-text h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-text p { margin: 0; font-size: 11.5px; color: var(--ink-faint); }

.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
}

.tab {
  padding: 8px 18px;
  border-radius: 9px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab:hover { background: rgba(178, 113, 75, 0.10); color: var(--wood-deep); }

.tab.active { background: var(--wood-deep); color: #FFF8EE; }

.conn-badge {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--warn);
  background: rgba(192, 138, 45, 0.12);
  border: 1px solid rgba(192, 138, 45, 0.35);
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.conn-badge.conn-ok {
  color: var(--ok);
  background: rgba(76, 122, 90, 0.12);
  border-color: rgba(76, 122, 90, 0.35);
}

.conn-badge.conn-bad {
  color: var(--bad);
  background: rgba(179, 84, 62, 0.12);
  border-color: rgba(179, 84, 62, 0.35);
}

/* ===== 主体 ===== */
main { padding: 24px 26px 48px; }

.view { display: none; }
.view.active { display: block; }

/* ===== 统计卡 ===== */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow);
}

.stat-label { font-size: 12px; color: var(--ink-faint); font-weight: 500; }

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--wood-deep);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
}

/* ===== 面板 ===== */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.panel.narrow { max-width: 640px; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-head h2 { margin: 0; font-size: 15px; font-weight: 700; }

.panel-note { margin: 14px 0 0; font-size: 12px; color: var(--ink-faint); }

.hint { font-size: 12px; color: var(--ink-faint); }

/* ===== 搜索 ===== */
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 12px;
  background: var(--bg);
  width: 260px;
  color: var(--ink-faint);
}

.search svg { width: 16px; height: 16px; flex: none; }

.search input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  font-size: 13px;
  color: var(--ink);
  font-family: inherit;
}

/* ===== 账本表格 ===== */
.ledger { width: 100%; border-collapse: collapse; }

.ledger th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-faint);
  padding: 9px 12px;
  border-bottom: 2px solid var(--wood);
  letter-spacing: 0.4px;
}

.ledger td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.ledger tbody tr:nth-child(even) { background: rgba(178, 113, 75, 0.04); }
.ledger tbody tr:hover { background: rgba(178, 113, 75, 0.09); }

/* 永久封禁的行整行提红，一眼认出 */
.ledger tbody tr.row-banned td { background: rgba(179, 84, 62, 0.07); }
.ledger tbody tr.row-banned:hover td { background: rgba(179, 84, 62, 0.12); }

.acct {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.5px;
}

.email { color: var(--ink-soft); font-size: 13px; }

.pw-cell { display: flex; align-items: center; gap: 8px; }

.pw-mask { font-variant-numeric: tabular-nums; letter-spacing: 2px; color: var(--ink-soft); }

.pw-text { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }

.icon-btn {
  border: 0;
  background: transparent;
  padding: 5px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink-faint);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover { background: rgba(178, 113, 75, 0.12); color: var(--wood-deep); }

.icon-btn svg { width: 16px; height: 16px; }

/* ===== 印戳 ===== */
.stamp {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 2px 9px;
  border-radius: 6px;
  border: 1.5px solid currentColor;
  box-shadow: inset 0 0 0 1px var(--panel);
  transform: rotate(-0.6deg);
  white-space: nowrap;
}

.stamp-ok { color: var(--ok); background: rgba(76, 122, 90, 0.08); }
.stamp-part { color: var(--warn); background: rgba(192, 138, 45, 0.08); }
.stamp-bad { color: var(--bad); background: rgba(179, 84, 62, 0.08); }
.stamp-idle { color: var(--ink-faint); background: rgba(0, 0, 0, 0.03); }
.stamp-ban { color: var(--bad); background: rgba(179, 84, 62, 0.10); border-color: currentColor; }

.ban-remain { margin-top: 3px; font-size: 11.5px; color: var(--bad); font-variant-numeric: tabular-nums; }

.ban-reason { margin-top: 2px; font-size: 11px; color: var(--ink-faint); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== 行内小按钮 ===== */
.btn-mini {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.btn-mini:hover { border-color: var(--wood); color: var(--wood-deep); }

.btn-mini-ban { border-color: rgba(179, 84, 62, 0.4); color: var(--bad); }
.btn-mini-ban:hover { background: rgba(179, 84, 62, 0.08); border-color: var(--bad); }

/* ===== 封禁对话框 ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(40, 25, 10, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 20px;
}

.modal {
  width: 440px;
  max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(40, 25, 10, 0.28);
  padding: 22px 24px;
}

.modal h3 { margin: 0 0 4px; font-size: 16px; font-weight: 700; }

.modal-sub { margin: 0 0 16px; font-size: 12.5px; color: var(--ink-faint); }

.ban-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.ban-preset {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 0;
  border-radius: 9px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.ban-preset:hover { border-color: var(--wood); color: var(--wood-deep); }

.ban-preset.selected {
  border-color: var(--wood-deep);
  background: var(--wood-deep);
  color: #FFF8EE;
}

.ban-preset.selected-danger {
  border-color: var(--bad);
  background: var(--bad);
  color: #FFF8EE;
}

.ban-preview {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--ink-soft);
  min-height: 20px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.btn-danger { background: var(--bad); }
.btn-danger:hover { background: #983C2B; }

/* ===== 表单 ===== */
.split {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  align-items: start;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.field { display: flex; flex-direction: column; gap: 6px; }

.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }

.field input, .field textarea, .field select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--ink);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--wood);
  box-shadow: 0 0 0 3px rgba(178, 113, 75, 0.15);
}

.field textarea { resize: vertical; min-height: 150px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.radio { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }

.radio input { accent-color: var(--wood-deep); }

.send-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.btn-primary {
  border: 0;
  background: var(--wood-deep);
  color: #FFF8EE;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 26px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}

.btn-primary:hover { background: #6C3F27; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-ghost {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 9px;
  cursor: pointer;
}

.btn-ghost:hover { border-color: var(--bad); color: var(--bad); }

/* ===== 发送进度 ===== */
.progress-wrap { margin-top: 14px; }

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--wood);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.progress-text { margin: 8px 0 0; font-size: 12.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ===== 收件预览 ===== */
.preview-box {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 16px;
  min-height: 230px;
  background: var(--bg);
}

.preview-mail {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
}

.preview-mail .acct { font-size: 12.5px; }
.preview-mail .email { font-size: 12px; }
.preview-empty { color: var(--ink-faint); font-size: 13px; text-align: center; padding: 30px 0; }

/* ===== 提示条 ===== */
.callout {
  margin-top: 18px;
  border: 1px solid rgba(192, 138, 45, 0.4);
  background: rgba(192, 138, 45, 0.08);
  border-radius: 12px;
  padding: 12px 16px;
}

.callout h3 { margin: 0 0 4px; font-size: 13px; color: var(--warn); }
.callout p { margin: 0; font-size: 12.5px; color: var(--ink-soft); }

/* ===== Toast ===== */
.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 50;
}

.toast {
  background: var(--ink);
  color: #FFF8EE;
  font-size: 13px;
  padding: 11px 18px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(40, 25, 10, 0.25);
  animation: toast-in 0.22s ease;
  max-width: 380px;
}

.toast.ok { background: var(--ok); }
.toast.bad { background: var(--bad); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 空态 ===== */
.empty-row td { text-align: center; color: var(--ink-faint); padding: 26px 12px; font-size: 13px; }

/* ===== 公告 ===== */
.ann-list { display: flex; flex-direction: column; gap: 10px; max-height: 58vh; overflow-y: auto; }
.ann-item {
  background: #FFFDF8;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.ann-item-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ann-item-title { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.ann-item-time { font-size: 11px; color: var(--ink-faint); white-space: nowrap; }
.ann-item-body {
  margin: 6px 0 10px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-soft);
  white-space: pre-wrap;
  word-break: break-word;
}
.ann-empty { color: var(--ink-faint); font-size: 13px; text-align: center; padding: 30px 0; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
