/* ============================================================================
   WorkBuddy · 到期提醒 — Design System
   clean / modern / lightweight / business SaaS
   ========================================================================== */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-2: #374151;
  --muted: #6b7280;
  --muted-2: #9ca3af;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-ring: rgba(37, 99, 235, 0.18);

  --success: #16a34a;
  --success-soft: #f0fdf4;
  --warning: #f59e0b;
  --warning-soft: #fff7ed;
  --caution: #ca8a04;
  --caution-soft: #fefce8;
  --danger: #dc2626;
  --danger-soft: #fef2f2;

  --r-card: 14px;
  --r-btn: 10px;
  --r-input: 10px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 1px 3px rgba(16, 24, 40, 0.08), 0 8px 24px -12px rgba(16, 24, 40, 0.18);
  --shadow-lg: 0 24px 64px -24px rgba(16, 24, 40, 0.32);

  --sidebar-w: 244px;
  --topbar-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html { color-scheme: light; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { background: #fff; }
::selection { background: #dbeafe; }

/* ------------------------------------------------------------------ 基础组件 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--r-btn);
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.05s;
  user-select: none;
}
.btn:active { transform: translateY(0.5px); }
.btn:focus-visible { outline: 3px solid var(--primary-ring); outline-offset: 1px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn .ic { width: 15px; height: 15px; flex: none; }

.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover:not([disabled]) { background: var(--primary-hover); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover:not([disabled]) { background: var(--surface-2); border-color: var(--border-strong); }
.btn-subtle { background: transparent; color: var(--muted); }
.btn-subtle:hover:not([disabled]) { background: #f3f4f6; color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not([disabled]) { background: #b91c1c; }
.btn-danger-ghost { background: #fff; border-color: #fecaca; color: var(--danger); }
.btn-danger-ghost:hover:not([disabled]) { background: var(--danger-soft); }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 9px; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: 9px; }
.btn-block { width: 100%; }

.field { display: block; margin-bottom: 14px; }
.field > .lbl {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}
.field .req { color: var(--danger); font-weight: 700; }
.field .hint { font-size: 12px; color: var(--muted-2); margin-top: 5px; line-height: 1.45; }

.input, .select, .textarea {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  background: #fff;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}
.textarea { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; }
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input[readonly] { background: var(--surface-2); color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px 20px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-overdue { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.badge-d7 { background: var(--warning-soft); color: #b45309; border-color: #fed7aa; }
.badge-d30 { background: var(--caution-soft); color: #a16207; border-color: #fde68a; }
.badge-normal { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }
.badge-paused { background: #f3f4f6; color: var(--muted-2); border-color: #e5e7eb; }
.badge-success { background: var(--success-soft); color: var(--success); border-color: #bbf7d0; }
.badge-failed { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.badge-skipped { background: #f9fafb; color: var(--muted); border-color: var(--border); }
.badge-role { background: var(--primary-soft); color: var(--primary); border-color: #bfdbfe; }
.badge-plain { background: #f3f4f6; color: var(--text-2); border-color: var(--border); }

/* ------------------------------------------------------------------ 登录页 */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1000px 500px at 15% -10%, #e0edff 0%, rgba(224, 237, 255, 0) 60%),
    radial-gradient(800px 400px at 100% 0%, #eef2ff 0%, rgba(238, 242, 255, 0) 55%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  padding: 30px 30px 24px;
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-brand .mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(140deg, #3b82f6, #2563eb); color: #fff; box-shadow: var(--shadow-sm);
}
.auth-brand .name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.auth-brand .sub { font-size: 11.5px; color: var(--muted-2); }
.auth-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 4px; }
.auth-desc { font-size: 13px; color: var(--muted); margin: 0 0 20px; }
.auth-switch { margin-top: 16px; font-size: 13px; color: var(--muted); text-align: center; }
.auth-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted-2); text-align: center; }

/* ------------------------------------------------------------------ App 骨架 */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 40;
}
.sidebar-head { height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid var(--border); }
.sidebar-head .mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(140deg, #3b82f6, #2563eb); color: #fff; flex: none;
}
.sidebar-head .t1 { font-size: 13.5px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.sidebar-head .t2 { font-size: 11px; color: var(--muted-2); line-height: 1.2; }
.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-label { padding: 10px 10px 6px; font-size: 11px; font-weight: 600; color: var(--muted-2); letter-spacing: 0.04em; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px;
  border-radius: 9px; color: var(--text-2); font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: background 0.14s, color 0.14s;
}
.nav-item:hover { background: #f3f4f6; color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item .ic { width: 17px; height: 17px; flex: none; opacity: 0.9; }
.nav-item .count { margin-left: auto; font-size: 11.5px; color: var(--danger); font-weight: 700; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 10px; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 10px; cursor: pointer; }
.user-chip:hover { background: #f3f4f6; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: #e0e7ff; color: #3730a3; font-size: 12px; font-weight: 700; text-transform: uppercase;
}
.user-chip .ue { font-size: 12.5px; font-weight: 600; max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .ur { font-size: 11px; color: var(--muted-2); }

.app-main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 26px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 16px; font-weight: 700; letter-spacing: -0.015em; margin: 0; white-space: nowrap; display: none; }
.topbar .spacer { flex: 1; }
.topbar .gsearch { position: relative; width: 300px; max-width: 38vw; }
.topbar .gsearch .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted-2); }
.topbar .gsearch input { height: 36px; padding-left: 32px; border-radius: 9px; background: var(--surface-2); }
.topbar .gsearch input:focus { background: #fff; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: #f3f4f6; color: var(--text); }
.icon-btn .ic { width: 17px; height: 17px; }

.content { padding: 22px 26px 40px; max-width: 1320px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 3px; }
.page-head p { margin: 0; font-size: 13px; color: var(--muted); }
.summary-line { font-size: 13px; color: var(--text-2); }
.summary-line b { color: var(--text); }
.summary-line .danger { color: var(--danger); font-weight: 600; }
.summary-line .warn { color: #b45309; font-weight: 600; }

/* 移动端底部 Tab（桌面隐藏） */
.tabbar { display: none; }
.mobile-only { display: none; }

/* ------------------------------------------------------------------ 统计卡 */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  position: relative;
  text-align: left;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.stat.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 11.5px; color: var(--muted-2); margin-top: 2px; }
.stat .dot { width: 7px; height: 7px; border-radius: 50%; }
.stat.overdue .v { color: var(--danger); }
.stat.overdue .dot { background: var(--danger); }
.stat.d7 .v { color: #b45309; }
.stat.d7 .dot { background: var(--warning); }
.stat.d30 .v { color: #a16207; }
.stat.d30 .dot { background: #eab308; }
.stat.total .dot { background: var(--muted-2); }

/* ------------------------------------------------------------------ 工具条 */
.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; background: #fff; border: 1px solid var(--border);
  border-radius: var(--r-card); box-shadow: var(--shadow-sm); margin-bottom: 14px;
}
.toolbar .search { position: relative; flex: 1 1 220px; min-width: 180px; }
.toolbar .search .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted-2); }
.toolbar .search input { height: 36px; padding-left: 32px; }
.toolbar .select { height: 36px; width: auto; min-width: 116px; }
.toolbar .divider { width: 1px; height: 22px; background: var(--border); margin: 0 2px; }
.toolbar .grow { flex: 1; }

/* ------------------------------------------------------------------ 表格 */
.table-wrap { background: #fff; border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-sm); overflow: hidden; }
.dtable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.dtable thead th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted);
  letter-spacing: 0.03em; text-transform: uppercase; padding: 11px 12px;
  background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.dtable tbody td { padding: 11px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.dtable tbody tr:last-child td { border-bottom: 0; }
.dtable tbody tr:hover { background: #fafbfc; }
.dtable tbody tr.selected { background: #f5f9ff; }
.dtable .num { font-variant-numeric: tabular-nums; }
.cell-main { font-weight: 600; color: var(--text); display: block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-sub { font-size: 11.5px; color: var(--muted-2); display: block; margin-top: 1px; }
.row-actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.act { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 8px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.act:hover { background: #f3f4f6; color: var(--text); }
.act.danger:hover { background: var(--danger-soft); color: var(--danger); }
.act .ic { width: 14px; height: 14px; }
.checkbox { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.days-left { font-variant-numeric: tabular-nums; font-weight: 600; }
.days-left.neg { color: var(--danger); }
.days-left.warn { color: #b45309; }

.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); background: #fff; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 6px; }

/* ------------------------------------------------------------------ Tabs */
.tabs { display: flex; align-items: center; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab {
  position: relative; padding: 10px 12px; font-size: 13.5px; font-weight: 500; color: var(--muted);
  background: none; border: 0; cursor: pointer; white-space: nowrap; border-radius: 8px 8px 0 0;
}
.tab:hover { color: var(--text); background: #f9fafb; }
.tab.active { color: var(--primary); font-weight: 600; }
.tab.active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--primary); border-radius: 2px 2px 0 0; }
.tab .n { margin-left: 5px; font-size: 11.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ 空状态 */
.empty { text-align: center; padding: 56px 24px; }
.empty .ico { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--primary-soft); color: var(--primary); }
.empty .ico .ic { width: 24px; height: 24px; }
.empty h3 { margin: 0 0 6px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.empty p { margin: 0 auto 20px; font-size: 13.5px; color: var(--muted); max-width: 400px; line-height: 1.6; }
.empty .acts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ------------------------------------------------------------------ Skeleton */
.sk { background: linear-gradient(90deg, #f1f5f9 25%, #e9eef5 37%, #f1f5f9 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 6px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-row { display: flex; gap: 12px; align-items: center; padding: 13px 14px; border-bottom: 1px solid #f1f5f9; }
.sk-line { height: 10px; }

/* ------------------------------------------------------------------ Drawer / Modal */
.overlay {
  position: fixed; inset: 0; z-index: 80; background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(2px); display: flex; animation: fade 0.16s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes popIn { from { transform: translateY(10px) scale(0.985); opacity: 0; } to { transform: none; opacity: 1; } }

.drawer-panel {
  margin-left: auto; width: 520px; max-width: 100%; background: #fff; height: 100%;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slideIn 0.2s ease;
}
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer-head h3 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.drawer-head .sub { font-size: 12px; color: var(--muted-2); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.drawer-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); background: #fff; }

.form-section { margin-bottom: 20px; }
.form-section > .sec-title { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 12px; padding-bottom: 7px; border-bottom: 1px solid var(--border); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

.modal-panel {
  margin: auto; width: 440px; max-width: calc(100% - 32px); background: #fff; border-radius: 16px;
  box-shadow: var(--shadow-lg); animation: popIn 0.18s ease; overflow: hidden;
}
.modal-panel.wide { width: 560px; }
.modal-head { padding: 18px 20px 0; }
.modal-head h3 { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.modal-head p { margin: 0; font-size: 13px; color: var(--muted); }
.modal-body { padding: 16px 20px; max-height: 60vh; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.danger-note { display: flex; gap: 10px; padding: 12px 14px; background: var(--danger-soft); border: 1px solid #fecaca; border-radius: 10px; font-size: 13px; color: #991b1b; line-height: 1.6; }

/* ------------------------------------------------------------------ Toast */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 120; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: flex-start; gap: 9px; min-width: 240px; max-width: 360px;
  padding: 11px 13px; background: #fff; border: 1px solid var(--border); border-radius: 11px;
  box-shadow: var(--shadow-md); font-size: 13.5px; color: var(--text-2);
  animation: popIn 0.18s ease; pointer-events: auto;
}
.toast .ic { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.toast.success { border-left: 3px solid var(--success); }
.toast.success .ic { color: var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.error .ic { color: var(--danger); }
.toast.info { border-left: 3px solid var(--primary); }
.toast.info .ic { color: var(--primary); }

/* ------------------------------------------------------------------ 开关 */
.switch-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.switch-row:last-child { border-bottom: 0; }
.switch-row .st { font-size: 13.5px; font-weight: 600; }
.switch-row .sd { font-size: 12.5px; color: var(--muted); margin-top: 2px; max-width: 460px; line-height: 1.55; }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; background: #d1d5db; border-radius: 999px; transition: background 0.18s; }
.switch .thumb { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform 0.18s; }
.switch input:checked ~ .track { background: var(--primary); }
.switch input:checked ~ .thumb { transform: translateX(18px); }
.switch input:focus-visible ~ .track { box-shadow: 0 0 0 3px var(--primary-ring); }

/* ------------------------------------------------------------------ 邮箱标签输入 */
.chips-box {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 44px;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--r-input); background: #fff; cursor: text;
  transition: border-color .15s, box-shadow .15s;
}
.chips-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.chips-box.invalid { border-color: var(--danger); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 6px 0 9px;
  background: var(--primary-soft); color: #1e40af; border-radius: 8px; font-size: 12.5px; font-weight: 500;
}
.chip.err { background: var(--danger-soft); color: var(--danger); }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; opacity: .6; display: grid; place-items: center; }
.chip button:hover { opacity: 1; }
.chip .ic { width: 12px; height: 12px; }
.chips-box input { flex: 1; min-width: 140px; border: 0; outline: none; height: 28px; background: transparent; font-size: 13.5px; }

/* ------------------------------------------------------------------ 上传区 */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-card); background: #fff;
  padding: 40px 24px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .ico { width: 46px; height: 46px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin: 0 auto 12px; }
.dropzone .ico .ic { width: 22px; height: 22px; }
.dropzone .dz-t { font-size: 14.5px; font-weight: 600; }
.dropzone .dz-d { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.dropzone .dz-meta { font-size: 12px; color: var(--muted-2); margin-top: 14px; }

.stepper { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.step .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; background: #f3f4f6; color: var(--muted); border: 1px solid var(--border); }
.step.active { color: var(--text); font-weight: 600; }
.step.active .n { background: var(--primary); color: #fff; border-color: var(--primary); }
.step.done .n { background: var(--success-soft); color: var(--success); border-color: #bbf7d0; }
.step-line { flex: 1; min-width: 20px; height: 1px; background: var(--border); }

.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; font-size: 13px; line-height: 1.6; }
.alert-info { background: var(--primary-soft); border: 1px solid #bfdbfe; color: #1e40af; }
.alert-warn { background: var(--warning-soft); border: 1px solid #fed7aa; color: #92400e; }
.alert-danger { background: var(--danger-soft); border: 1px solid #fecaca; color: #991b1b; }
.alert .ic { width: 16px; height: 16px; flex: none; margin-top: 2px; }

.result-card { text-align: center; padding: 28px 20px; }
.result-card .big { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.result-cell { padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.result-cell .k { font-size: 12px; color: var(--muted); }
.result-cell .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ 其他 */
.err-list { margin: 0; padding-left: 18px; }
.err-list li { font-size: 13px; color: var(--danger); margin-bottom: 3px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mini-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.mini-table td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.mini-table tr.row-error td { background: #fff7f7; }
.mini-table .why { color: var(--danger); font-size: 12px; }
.scroll-x { overflow-x: auto; }
.recent-card { margin-top: 16px; }
.recent-item { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px dashed #eef2f7; font-size: 12.5px; }
.recent-item:last-child { border-bottom: 0; }
.recent-item .t { margin-left: auto; color: var(--muted-2); font-size: 11.5px; white-space: nowrap; }
.recent-item .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 13px; }
.kv .k { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.text-muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.nowrap { white-space: nowrap; }
.stack-8 > * + * { margin-top: 8px; }
.stack-12 > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.row-end { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.mt-16 { margin-top: 16px; }
.hidden { display: none !important; }

/* ============================================================================
   响应式：≤1024 收窄，≤860 上底部 Tab + 表格转卡片
   ========================================================================== */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar .gsearch { width: 220px; }
}

@media (max-width: 860px) {
  :root { --topbar-h: 56px; }
  .sidebar { display: none; }
  .app-main { margin-left: 0; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar h1 { font-size: 15px; display: block; }
  .topbar .gsearch { display: none; }
  .content { padding: 14px 14px 92px; }
  .page-head { margin-bottom: 12px; }
  .page-head h2 { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 11px 12px; border-radius: 12px; }
  .stat .v { font-size: 22px; }
  .stat .s { display: none; }
  .toolbar { padding: 8px; gap: 6px; }
  .toolbar .search { flex: 1 1 100%; }
  .toolbar .select { flex: 1 1 calc(50% - 3px); min-width: 0; }
  .toolbar .divider { display: none; }
  .toolbar .grow { display: none; }
  .mobile-only { display: inline-flex; }
  .desktop-only { display: none !important; }

  /* 表格 → 卡片 */
  .table-wrap { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .dtable, .dtable tbody { display: block; }
  .dtable thead { display: none; }
  .dtable tbody tr {
    display: grid; grid-template-columns: auto 1fr auto; gap: 2px 8px; align-items: start;
    background: #fff; border: 1px solid var(--border); border-radius: 12px;
    padding: 12px 12px 10px; margin-bottom: 8px; box-shadow: var(--shadow-sm);
  }
  .dtable tbody tr.selected { border-color: var(--primary); background: #f5f9ff; }
  .dtable tbody td { display: block; padding: 1px 0; border: 0; min-width: 0; }
  .dtable tbody td::before {
    content: attr(data-label); display: block; font-size: 10.5px; color: var(--muted-2);
    text-transform: uppercase; letter-spacing: .03em; margin-bottom: 1px;
  }
  .dtable td[data-col="check"] { grid-column: 1; grid-row: 1; padding-top: 4px; }
  .dtable td[data-col="check"]::before { display: none; }
  .dtable td[data-col="name"] { grid-column: 2; grid-row: 1; }
  .dtable td[data-col="status"] { grid-column: 3; grid-row: 1; justify-self: end; text-align: right; padding-top: 2px; }
  .dtable td[data-col="status"]::before { display: none; }
  .dtable td[data-col="person"], .dtable td[data-col="expiry"], .dtable td[data-col="remind"],
  .dtable td[data-col="updated"], .dtable td[data-col="time"], .dtable td[data-col="channel"],
  .dtable td[data-col="to"], .dtable td[data-col="err"], .dtable td[data-col="role"],
  .dtable td[data-col="state"], .dtable td[data-col="items"], .dtable td[data-col="created"],
  .dtable td[data-col="email"] {
    grid-column: 1 / -1;
  }
  .dtable td[data-col="actions"] { grid-column: 1 / -1; border-top: 1px dashed #eef2f7; margin-top: 6px; padding-top: 6px; }
  .row-actions { justify-content: flex-start; }
  .cell-main { max-width: none; }
  .table-foot { border: 1px solid var(--border); border-radius: 12px; margin-top: 4px; background: #fff; }

  /* 抽屉/弹窗全屏 */
  .drawer-panel { width: 100%; border-radius: 0; }
  .drawer-head { padding: 12px 14px; }
  .drawer-body { padding: 14px; }
  .drawer-foot { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .drawer-foot .btn { flex: 1; height: 44px; }
  .modal-panel, .modal-panel.wide { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 16px 16px 0 0; }
  .overlay.bottom-align { align-items: flex-end; }
  .modal-foot { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; height: 44px; }
  .grid-2 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 92px 1fr; }

  /* 底部 Tab */
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: flex; align-items: stretch;
    background: rgba(255,255,255,.94); backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar button {
    flex: 1; border: 0; background: none; padding: 8px 2px 9px;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: var(--muted-2); font-size: 10.5px; font-weight: 500; cursor: pointer;
  }
  .tabbar button .ic { width: 20px; height: 20px; }
  .tabbar button.active { color: var(--primary); }
  .tabbar button.active .ic { stroke-width: 2.3; }

  .auth-card { padding: 24px 20px 18px; border-radius: 16px; }
  .toasts { left: 12px; right: 12px; top: 10px; }
  .toast { min-width: 0; max-width: none; }
  .empty { padding: 36px 16px; }
}
