/* 爱时刻控制台 · 统一样式
   一套颜色、一套按钮、一套间距 —— 所有页面共用 */

/* hidden 必须真正隐藏 —— 否则 .app / .modal-host 的 display 会把它顶掉，
   页面会被一层看不见的遮罩盖住，点什么都没反应 */
[hidden] { display: none !important; }

:root {
  --brand: #07c160;
  --brand-dark: #06a854;
  --brand-soft: #e8f9ef;
  --side-bg: #ffffff;
  --side-bg-active: #d8f6e7;
  --side-text: #111111;
  --side-text-active: #111111;

  --text: #111111;
  --text-2: #333333;
  --text-3: #555555;

  --bg: #f4f9f6;
  --card: #ffffff;
  --line: #dfe9e4;

  --ok: #07c160;
  --ok-soft: #e8f9ef;
  --warn: #c77700;
  --warn-soft: #fff5e4;
  --danger: #d43a28;
  --danger-soft: #ffedeb;
  --info-soft: #eaf4ff;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(20, 60, 45, .06), 0 4px 16px rgba(20, 60, 45, .05);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; }

button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ============ 登录 ============ */
.boot-mask {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 55;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--text-3); font-size: 14px;
}
.login-layer {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(155deg, #eaf7f0 0%, #dcf3e8 60%, #cff0e0 100%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 360px;
  background: var(--card);
  border-radius: 14px;
  padding: 32px 28px 26px;
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(20, 60, 45, .18);
}
.login-brand { font-size: 20px; font-weight: 600; letter-spacing: .5px; }
.login-brand span { color: var(--brand); }
.login-sub { color: var(--text-2); font-size: 13px; margin: 6px 0 22px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.field input {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fbfcfc; outline: none; transition: border-color .15s, background .15s;
}
.field input:focus { border-color: var(--brand); background: #fff; }
.login-error { min-height: 20px; color: var(--danger); font-size: 13px; margin-bottom: 6px; }
.login-tip { color: var(--text-3); font-size: 12px; margin-top: 14px; text-align: center; }
.login-foot { text-align: center; margin-top: 14px; }

/* 回工作台的口（登录页 + 顶栏共用同一个样子） */
.back-wk {
  display: inline-flex; align-items: center; justify-content: center;
  height: 30px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: #fff;
  color: var(--text-2); font-size: 13px; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.back-wk:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }

/* ============ 框架 ============ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px; flex: 0 0 216px;
  background: var(--side-bg);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side-brand {
  color: var(--text); font-size: 17px; font-weight: 600;
  padding: 20px 20px 16px; letter-spacing: .5px;
}
.side-brand span { color: var(--brand-dark); margin-left: 4px; font-weight: 400; font-size: 13px; }
.nav { flex: 1; padding: 6px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 4px;
  color: var(--side-text); text-decoration: none;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: #eaf7f0; }
.nav-item.active {
  background: var(--side-bg-active); color: var(--side-text-active); font-weight: 700;
  box-shadow: inset 3px 0 0 var(--brand);
}
.nav-item.soon { opacity: .55; cursor: not-allowed; }
.nav-item .ico { width: 18px; text-align: center; }
.side-foot { padding: 14px 16px; border-top: 1px solid var(--line); }
.side-user { color: var(--text-2); font-size: 13px; margin-bottom: 8px; }
.side-logout {
  width: 100%; height: 32px; border-radius: var(--radius-sm);
  background: #fff; color: var(--text);
  border: 1px solid var(--line);
}
.side-logout:hover { background: #eaf7f0; border-color: var(--brand); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; flex: 0 0 60px;
  background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 17px; }
.topbar-right {
  color: var(--text-3); font-size: 13px;
  display: flex; align-items: center; gap: 12px; min-width: 0;
}
.topbar-right #pageHint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-host { padding: 20px 24px 40px; }

/* ============ 卡片 ============ */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.card-title { font-size: 15px; font-weight: 600; }
.card-body { padding: 16px; }

/* ============ 两栏布局 ============ */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.two-col .card { margin-bottom: 0; }

/* ============ 数字块 ============ */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px 14px 20px; box-shadow: var(--shadow);
}
.stat::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--brand);
}
.stat:nth-child(4n+1)::before { background: #07c160; }
.stat:nth-child(4n+2)::before { background: #2f9cf4; }
.stat:nth-child(4n+3)::before { background: #f5a623; }
.stat:nth-child(4n)::before   { background: #ef5b4c; }
.stat:nth-child(4n+1) .v { color: #06a854; }
.stat:nth-child(4n+2) .v { color: #2b8fdc; }
.stat:nth-child(4n+3) .v { color: #d98500; }
.stat:nth-child(4n) .v   { color: #dc4a3a; }
.stat .k { color: var(--text-2); font-size: 13px; font-weight: 500; }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: .5px; }
.stat .v small { font-size: 13px; font-weight: 400; color: var(--text-3); margin-left: 4px; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: #fff; color: var(--text);
  transition: background .15s, border-color .15s, color .15s; white-space: nowrap;
}
.btn:hover { border-color: #cfd8db; background: #fafbfb; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-ghost { background: #fff; border-color: var(--brand); color: var(--brand); }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-danger { background: #fff; border-color: #e6b3ac; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-block { width: 100%; height: 40px; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============ 表单 ============ */
.input, select.input {
  height: 34px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: #fff; outline: none; min-width: 0;
}
.input:focus { border-color: var(--brand); }
.input-search { width: 220px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters .grow { flex: 1; }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th {
  text-align: left; font-weight: 700; font-size: 13px; color: #111111;
  background: #eef8f2; padding: 11px 12px; border-bottom: 1px solid #d6e9e0;
  white-space: nowrap;
}
table.grid td {
  padding: 11px 12px; border-bottom: 1px solid #eef2f3; vertical-align: middle;
}
table.grid tbody tr:hover { background: #f4fbf7; }
table.grid tbody tr:last-child td { border-bottom: none; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.u-name { font-weight: 600; font-size: 14px; color: var(--text); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
  background: var(--info-soft); flex: 0 0 32px;
  display: flex; align-items: center; justify-content: center; color: var(--text-3); font-size: 13px;
}
.muted { color: var(--text-3); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }
.actions { display: flex; gap: 6px; flex-wrap: nowrap; }

/* ============ 标签 ============ */
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 20px;
  font-size: 12px; line-height: 18px; white-space: nowrap;
}
.tag-ok { background: var(--ok-soft); color: var(--brand); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-gray { background: var(--info-soft); color: var(--text-2); }

/* 列表里可点的一行 */
table.grid tbody tr.row-link { cursor: pointer; }
table.grid tbody tr.row-link:hover { background: #e9f9f1; }
.list-tip {
  padding: 8px 16px; font-size: 12px; color: var(--text-3);
  background: #fafcfc; border-bottom: 1px solid var(--line);
}

/* ============ 单人档案 ============ */
.p-bar { margin-bottom: 14px; }
.p-top { display: flex; align-items: flex-start; gap: 16px; padding: 18px 20px; }
.avatar-lg { width: 56px; height: 56px; flex: 0 0 56px; font-size: 20px; }
.p-info { flex: 1; min-width: 0; }
.p-name { font-size: 18px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.p-meta { color: var(--text-3); font-size: 13px; margin-top: 3px; word-break: break-all; }
.p-clip { cursor: pointer; }
.p-clip:hover { color: var(--brand); }
.p-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.p-member {
  border-top: 1px solid var(--line); padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; background: #fafcfc;
  border-radius: 0 0 var(--radius) var(--radius);
}
.p-mstate { font-size: 15px; }

/* tab 切换 */
.tabs { display: flex; gap: 2px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tab {
  height: 34px; padding: 0 12px; border: none; background: none;
  color: var(--text-2); border-bottom: 2px solid transparent; border-radius: 6px 6px 0 0;
}
.tab:hover { color: var(--text); background: #f5f8f8; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tab b { font-weight: 400; color: var(--text-3); margin-left: 4px; }
.tab-body { padding: 4px 0; min-height: 80px; }
.mini-row {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 20px; border-bottom: 1px solid #f1f5f5;
}
.mini-row:last-child { border-bottom: none; }
.mini-main { flex: 1; min-width: 0; }
.mini-title { font-weight: 500; word-break: break-all; }
.mini-sub { color: var(--text-3); font-size: 12px; margin-top: 2px; word-break: break-all; }
.mini-right { flex: 0 0 auto; }
.mini-empty { text-align: center; color: var(--text-3); padding: 40px 16px; }

/* ============ 分页 ============ */
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 12px 16px; color: var(--text-2); }
.pager .pg { min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--line); background: #fff; border-radius: var(--radius-sm); }
.pager .pg.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager .pg:disabled { opacity: .45; }

/* ============ 空状态 / 加载 ============ */
.empty { text-align: center; color: var(--text-3); padding: 48px 16px; }
.empty .big { font-size: 30px; display: block; margin-bottom: 8px; opacity: .6; }
.loading { text-align: center; color: var(--text-3); padding: 40px; }

/* ============ 弹窗 ============ */
.modal-host {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 100;
  background: rgba(20, 35, 42, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--card); border-radius: 12px; width: 100%; max-width: 460px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
  max-height: 88vh; display: flex; flex-direction: column;
}
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 600; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.kv { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; }
.kv .k { color: var(--text-2); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.hint { color: var(--text-3); font-size: 12px; margin-top: 6px; }
.form-row { margin-bottom: 12px; }
.form-row > label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.form-row .input { width: 100%; }

/* ============ 提示 ============ */
.toast-host { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #ffffff; color: #111111; padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); border-left: 4px solid var(--brand);
  box-shadow: 0 8px 24px rgba(20, 60, 45, .18); font-size: 14px;
  animation: toast-in .18s ease-out;
}
.toast.ok { border-left-color: var(--brand); }
.toast.err { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ============ 手机 ============ */
@media (max-width: 720px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .topbar { padding: 0 14px; }
  .topbar-right #pageHint { display: none; }
  .back-wk { height: 28px; padding: 0 10px; font-size: 12px; }
  .page-host { padding: 14px 14px 30px; }
  .input-search { width: 100%; }
  .login-card { padding: 26px 20px 20px; }
}
