:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --ink: #0f172a;
  --text: #334155;
  --muted: #64748b;
  --line: #e7eaf3;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --ok: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 16px 36px -20px rgba(15, 23, 42, .28);
  --shadow-lg: 0 30px 60px -24px rgba(15, 23, 42, .35);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(820px 460px at 6% -10%, #e6e9ff 0%, rgba(230, 233, 255, 0) 60%),
    radial-gradient(700px 400px at 100% 0%, #e2f0ff 0%, rgba(226, 240, 255, 0) 55%),
    var(--bg);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ============================ 登录 ============================ */

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 28px 20px; }

.login-shell {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  width: 100%;
  max-width: 900px;
  background: var(--surface);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, .6);
  animation: rise .5s cubic-bezier(.22, 1, .36, 1) both;
}

.login-aside {
  position: relative;
  overflow: hidden;
  padding: 46px 40px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(155deg, #4f46e5 0%, #6d28d9 52%, #2563eb 100%);
}

.aside-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(280px 220px at 85% 12%, rgba(255, 255, 255, .34), transparent 70%),
    radial-gradient(340px 260px at 0% 100%, rgba(255, 255, 255, .18), transparent 70%);
}

.login-aside > * { position: relative; }

.mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 26px;
}

.mark svg { width: 24px; height: 24px; }

.login-aside h1 { font-size: 26px; line-height: 1.35; margin: 0 0 12px; letter-spacing: .5px; }
.login-aside p { margin: 0; font-size: 14px; color: rgba(255, 255, 255, .78); max-width: 300px; }

.aside-list {
  list-style: none;
  margin: 34px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13.5px;
  color: rgba(255, 255, 255, .92);
}

.aside-list li { display: flex; align-items: center; gap: 10px; }

.tick {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .2);
  border: 1px solid rgba(255, 255, 255, .4);
  flex: 0 0 18px;
  position: relative;
}

.tick::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 3px;
  width: 5px;
  height: 9px;
  border-right: 1.6px solid #fff;
  border-bottom: 1.6px solid #fff;
  transform: rotate(42deg);
}

.aside-foot {
  margin-top: 40px;
  font-size: 12px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .55);
}

.login-main { padding: 52px 48px; display: flex; align-items: center; }
.login-form { width: 100%; }
.login-form h2 { margin: 0 0 6px; font-size: 22px; color: var(--ink); letter-spacing: .3px; }
.login-sub { margin: 0 0 26px; color: var(--muted); font-size: 13.5px; }

/* ============================ 表单元素 ============================ */

.field { display: block; margin-bottom: 16px; }

.field > span {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 7px;
  letter-spacing: .3px;
}

input:not([type]),
input[type="text"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcff;
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}

input::placeholder, textarea::placeholder { color: #a3aec2; }
input:hover, select:hover, textarea:hover { border-color: #d3d9e8; }

input:focus, select:focus, textarea:focus {
  background: #fff;
  border-color: #a5b4fc;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, .12);
}

textarea { resize: vertical; min-height: 96px; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: transform .12s, box-shadow .18s, background .18s, border-color .18s;
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover { border-color: #cfd6e6; background: #f8faff; box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn.primary {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  box-shadow: 0 8px 18px -8px rgba(79, 70, 229, .65);
}
.btn.primary:hover { filter: brightness(1.06); box-shadow: 0 12px 24px -10px rgba(79, 70, 229, .7); }

.btn.ghost { background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--brand); border-color: #c7d2fe; background: #f5f3ff; }

.btn.sm { padding: 6px 12px; font-size: 12.8px; border-radius: 8px; }
.btn.lg { padding: 12px; font-size: 15px; letter-spacing: 2px; }
.btn.block { width: 100%; }
.btn.danger { color: var(--danger); border-color: #fadada; }
.btn.danger:hover { background: #fef2f2; border-color: #f6c2c2; }

.error-text { color: var(--danger); font-size: 13px; min-height: 20px; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 16px 0 0; line-height: 1.7; }
.hint b { color: var(--text); }

/* ============================ 应用外壳 ============================ */

.app-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
  max-width: 100%;
  overflow-x: clip;
}

.mobile-bar { display: none; }

.drawer-mask {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-right: 1px solid var(--line);
}

.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 24px; }

.brand-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  box-shadow: 0 8px 18px -8px rgba(79, 70, 229, .8);
}

.brand-logo svg { width: 20px; height: 20px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-name { font-size: 14.5px; font-weight: 700; color: var(--ink); letter-spacing: .3px; white-space: nowrap; }
.brand-sub { font-size: 10px; letter-spacing: 1.3px; text-transform: uppercase; color: #9aa6bd; }

.side-nav { display: flex; flex-direction: column; gap: 4px; }

.tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13.8px;
  font-weight: 500;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all .16s;
}

.tab svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .85; }
.tab:hover { background: #f3f5fc; color: var(--ink); }

.tab.active {
  color: var(--brand);
  font-weight: 600;
  background: linear-gradient(135deg, rgba(79, 70, 229, .1), rgba(124, 58, 237, .08));
  border-color: rgba(79, 70, 229, .16);
}

.tab.active svg { opacity: 1; }

.sidebar-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 2px;
  border-top: 1px solid var(--line);
}

.avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #a855f7);
}

.foot-info { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; flex: 1; }
#currentUser { font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.foot-role { font-size: 11px; color: #9aa6bd; }

.foot-actions { display: flex; gap: 2px; }

.icon-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .16s;
}

.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { color: var(--brand); background: #f1f3fc; border-color: #e2e6f5; }

.main-col { min-width: 0; }

.content { max-width: 1000px; margin: 0 auto; padding: 34px 36px 80px; }

.panel { animation: fade .3s ease both; }

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

.panel-head h2 { margin: 0 0 4px; font-size: 22px; color: var(--ink); letter-spacing: .2px; }
.muted { color: var(--muted); margin: 0; font-size: 13px; }

/* ============================ 统计 ============================ */

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

.stat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon svg { width: 18px; height: 18px; }
.stat-icon.indigo { color: #4f46e5; background: #eef0ff; }
.stat-icon.green { color: #059669; background: #e8f9f1; }
.stat-icon.amber { color: #d97706; background: #fdf4e5; }

.stat-label { display: block; font-size: 12px; color: var(--muted); letter-spacing: .3px; }
.stat strong { font-size: 21px; line-height: 1.2; color: var(--ink); font-weight: 700; }

/* ============================ 卡片 / 列表 ============================ */

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

.list { display: flex; flex-direction: column; gap: 12px; }

.item {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 20px 18px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform .18s, box-shadow .18s, border-color .18s;
  animation: rise .38s cubic-bezier(.22, 1, .36, 1) both;
}

.item::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 18px;
  bottom: 18px;
  width: 3.5px;
  border-radius: 4px;
  background: linear-gradient(180deg, #6366f1, #a855f7);
}

.item[data-priority="high"]::before { background: linear-gradient(180deg, #ef4444, #f43f5e); }
.item[data-priority="normal"]::before { background: linear-gradient(180deg, #f59e0b, #fbbf24); }
.item[data-priority="low"]::before { background: linear-gradient(180deg, #6366f1, #a855f7); }

.item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #dfe3ee; }
.item.off { background: #fbfcfe; }
.item.off::before { background: #cbd5e1; }
.item.off .item-title { color: var(--muted); }

.item-main { min-width: 0; flex: 1; }

.item-check {
  display: flex;
  align-items: flex-start;
  padding-top: 2px;
  flex: 0 0 auto;
}

.item-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
}

/* 筛选与批量操作 */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.filter-bar input {
  flex: 1;
  min-width: 180px;
}

.filter-bar select {
  width: auto;
  min-width: 120px;
}

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.check-inline input {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
}

.bulk-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.item-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 6px;
  word-break: break-word;
}

.item-content { color: var(--muted); font-size: 13px; white-space: pre-wrap; word-break: break-word; margin-bottom: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f5f7fd;
  border: 1px solid #e8ecf7;
  color: #56617a;
  font-size: 12px;
  max-width: 100%;
  word-break: break-all;
}

.chip svg { width: 13px; height: 13px; flex: 0 0 13px; opacity: .7; }

.item-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex: 0 0 auto;
  min-width: 168px;
}

.due-label { font-size: 11px; letter-spacing: .6px; color: #9aa6bd; }
.due-value { font-size: 13.5px; font-weight: 600; color: #3730a3; white-space: nowrap; }
.due-sub { font-size: 11.5px; color: #a3aec2; white-space: nowrap; }

.item-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-top: 10px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #f8fafc;
  white-space: nowrap;
}

.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.ok { color: var(--ok); border-color: #bbf0d8; background: #f0fdf8; }
.badge.err { color: var(--danger); border-color: #fbd5d5; background: #fef5f5; }
.badge.warn { color: var(--warn); border-color: #fbe4bd; background: #fffbf0; }

.badge.high { color: #dc2626; border-color: #fecaca; background: #fef2f2; }
.badge.normal { color: #b45309; border-color: #fde68a; background: #fffbeb; }
.badge.low { color: #4f46e5; border-color: #c7d2fe; background: #eef2ff; }

.empty {
  padding: 64px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed #d7ddea;
  border-radius: var(--radius);
}

.empty-badge {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6366f1;
  background: linear-gradient(135deg, #eef0ff, #f6efff);
  border: 1px solid #e4e7fa;
}

.empty-badge svg { width: 26px; height: 26px; }
.empty-title { margin: 0 0 4px; font-size: 15px; font-weight: 600; color: var(--ink); }
.empty-desc { margin: 0 0 18px; font-size: 13px; color: var(--muted); }
.empty .btn { margin: 0 auto; }

/* ============================ 表单卡片 ============================ */

.form-card { padding: 24px; margin-bottom: 16px; }

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid #f1f4fa;
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.row-actions { display: flex; align-items: center; gap: 14px; margin-top: 6px; flex-wrap: wrap; }

.state-text { font-size: 12.5px; color: var(--muted); }

.muted code,
.hint code {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 12px;
  color: #475569;
}
.state-text.ok { color: var(--ok); }
.state-text.err { color: var(--danger); }

.inline-row { display: flex; gap: 10px; }
.inline-row input { flex: 1; }

.backup-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.rcpt-list { display: flex; flex-wrap: wrap; gap: 8px; }

.rcpt-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfcff;
  font-size: 12.5px;
  color: var(--ink);
  max-width: 100%;
  word-break: break-all;
}

.rcpt-chip button {
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0;
}

.rcpt-chip button:hover { color: #dc2626; }

.check-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcff;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}

.check-item input { width: 15px; height: 15px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }

.check-item span { min-width: 0; word-break: break-all; }

.check-item small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 1px; }

.check-empty { color: var(--muted); font-size: 12.5px; margin: 0; }

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

.table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

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

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table th { color: var(--muted); font-weight: 600; font-size: 12px; }

.data-table tbody tr:hover td { background: #f8faff; }

.data-table select { padding: 5px 8px; font-size: 12.5px; }

.row-actions { display: flex; gap: 8px; }

.data-table .row-actions { display: inline-flex; flex-wrap: nowrap; margin-top: 0; }
.data-table .row-actions .btn { flex-shrink: 0; white-space: nowrap; }

.btn.sm { padding: 5px 10px; font-size: 12.5px; }

.btn.danger { color: #dc2626; border-color: #fecaca; }

.btn.danger:hover { background: #fef2f2; }

@media (max-width: 900px) {
  .grid3 { grid-template-columns: 1fr; }
}

input[type="file"] {
  padding: 9px 12px;
  border: 1px dashed #d3d9e8;
  border-radius: var(--radius-sm);
  background: #fbfcff;
  color: var(--muted);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover { border-color: #c7d2fe; color: var(--brand); }

/* ============================ 表格 ============================ */

.table-card { padding: 4px 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }

.table th, .table td {
  text-align: left;
  padding: 12px 20px;
  border-bottom: 1px solid #f1f4fa;
  white-space: nowrap;
}

.table th {
  color: #94a3b8;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
  background: #fbfcff;
}

.table tbody tr:hover td { background: #fafbff; }
.table tr:last-child td { border-bottom: none; }
.table td.wrap { white-space: normal; max-width: 320px; word-break: break-word; color: var(--muted); }

/* ============================ 弹窗 ============================ */

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(3px);
  animation: fade .18s ease both;
}

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  animation: pop .26s cubic-bezier(.22, 1, .36, 1) both;
}

.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line); flex: none; }
.modal-head h3 { margin: 0; font-size: 16px; color: var(--ink); }
.modal-body { padding: 22px 24px; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1 1 auto; min-height: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); background: #fcfdff; flex: none; }

.close-x {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: #9aa6bd;
  cursor: pointer;
  padding: 0 4px;
  transition: color .15s;
}

.close-x:hover { color: var(--ink); }

.radio-row { display: flex; gap: 20px; flex-wrap: wrap; padding-top: 2px; }
.radio-row label { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text); cursor: pointer; }
.radio-row input, .switch-row input { width: auto; accent-color: var(--brand); }

/* ------------------------------ 日历视图 ------------------------------ */

.cal-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cal-title { font-weight: 600; font-size: 16px; min-width: 110px; text-align: center; }

.cal-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  overflow: hidden;
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.cal-weekdays > div {
  text-align: center;
  padding: 10px 0;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-cell {
  min-height: 96px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 6px 7px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cal-cell.cal-empty { background: transparent; }
.cal-cell.cal-weekend { background: #fafbff; }
.cal-cell.cal-today { background: #eef2ff; }
.cal-cell.cal-today .cal-day-num {
  background: var(--brand);
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-day-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}
.cal-weekend .cal-day-num { color: #8a94a6; }
.cal-events {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}
.cal-event {
  font-size: 11.5px;
  line-height: 1.35;
  padding: 3px 5px;
  border-radius: 5px;
  background: #eef2ff;
  color: var(--ink);
  border-left: 3px solid var(--brand);
  display: flex;
  gap: 4px;
  align-items: baseline;
  min-height: 20px;
}
.cal-event.pri-high { background: #fef2f2; border-left-color: var(--danger); }
.cal-event.pri-normal { background: #fefce8; border-left-color: var(--warn); }
.cal-event.pri-low { background: #f0fdf4; border-left-color: #22c55e; }
.cal-event.disabled { opacity: .55; border-left-style: dashed; }
.cal-time { color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.cal-ev-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .cal-cell { min-height: 76px; padding: 4px 5px; }
  .cal-event { font-size: 10.5px; padding: 2px 4px; }
  .cal-day-num { font-size: 12px; }
  .cal-nav { gap: 6px; }
  .cal-nav .btn { padding: 6px 10px; font-size: 12.5px; }
  .cal-title { font-size: 14px; min-width: 92px; }
}


.switch-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-top: 6px; color: var(--text); }
.switch-row input { width: auto; }

/* ============================ 提示 ============================ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 44px;
  transform: translateX(-50%) translateY(16px);
  padding: 11px 20px;
  border-radius: 12px;
  background: rgba(15, 23, 42, .94);
  color: #fff;
  font-size: 13.5px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s, transform .24s;
  z-index: 120;
  max-width: 80vw;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: rgba(185, 28, 28, .96); }

/* ============================ 动画 ============================ */

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ============================ 响应式 ============================ */

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }

  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    position: sticky;
    top: 0;
    z-index: 60;
    background: rgba(255, 255, 255, .93);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
  }

  .menu-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .menu-btn svg { width: 20px; height: 20px; }
  .mobile-title { font-size: 14.5px; font-weight: 700; color: var(--ink); }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 272px;
    max-width: 82vw;
    height: 100vh;
    height: 100dvh;
    z-index: 95;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 20px 16px 18px;
    background: #fff;
    border-right: 1px solid var(--line);
    box-shadow: 0 20px 50px rgba(15, 23, 42, .18);
    transform: translateX(-100%);
    transition: transform .26s ease;
    overflow-y: auto;
  }

  body.drawer-open .sidebar { transform: none; }
  body.drawer-open .drawer-mask { display: block; }
  body.drawer-open { overflow: hidden; }

  .sidebar-brand { padding: 0 4px 20px; }
  .brand-sub { display: none; }
  .side-nav { flex-direction: column; gap: 4px; overflow: visible; }
  .tab { padding: 11px 12px; white-space: normal; font-size: 14px; }
  .sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
  .foot-info { display: flex; }
  .avatar { display: flex; }
  .content { padding: 18px 14px 70px; }
}

@media (max-width: 860px) {
  .login-shell { grid-template-columns: 1fr; max-width: 430px; }
  .login-aside { display: none; }
  .login-main { padding: 40px 28px; }
}

@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat { padding: 10px 10px; gap: 8px; flex-direction: column; align-items: flex-start; }
  .stat-icon { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; }
  .stat strong { font-size: 19px; }
  .stat span { font-size: 11.5px; }
  .grid2 { grid-template-columns: 1fr; }
  .item { flex-direction: column; gap: 14px; padding: 16px 16px 16px 22px; }
  .item-side { align-items: flex-start; width: 100%; min-width: 0; }
  .item-actions { justify-content: flex-start; width: 100%; }
  .panel-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .panel-head .btn.primary { align-self: flex-start; }
  .inline-row { flex-direction: column; }
  .panel-head h2 { font-size: 19px; }
  .check-list { grid-template-columns: 1fr; }
  .data-table { min-width: 680px; }
  .data-table th,
  .data-table td { padding: 8px 10px; font-size: 12.5px; white-space: nowrap; }
  .data-table select { font-size: 12px; }
  .field input,
  .field select,
  .field textarea,
  .inline-row input { font-size: 16px; }
}

@media (max-width: 560px) {
  .content { padding: 16px 12px 64px; }
  .card { padding: 16px; }
  .sidebar { padding: 8px 12px; }
  .brand-name { font-size: 15px; }
  .panel-head h2 { font-size: 18px; }
  .item-title { gap: 5px; }
  .modal-mask { padding: 8px; align-items: flex-start; }
  .modal { max-width: 100%; max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); border-radius: 16px; }
  .modal-head,
  .modal-body { padding-left: 18px; padding-right: 18px; }
  .modal-body { padding-bottom: 26px; }
  .modal-foot { padding: 14px 18px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  .inline-row .btn { width: 100%; }
  .login-main { padding: 34px 20px; }
  .login-wrap { min-height: 100dvh; }
}

@media (max-width: 400px) {
  .brand-sub { display: none; }
  .tab { padding: 9px 10px; font-size: 13px; gap: 7px; }
  .stat strong { font-size: 17px; }
  .stat span { font-size: 11px; }
  .item-actions .btn { padding: 7px 10px; font-size: 12px; }
}

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