/* =========================================================
   主题变量
   默认：白色底（浅色）
   html[data-theme="dark"]：夜间模式（黑 + 粉紫）
   ========================================================= */

:root {
  --bg: #fff8fb;
  --bg-glow-1: rgba(255, 150, 190, .16);
  --bg-glow-2: rgba(255, 190, 215, .20);
  --bg-glow-3: rgba(255, 170, 200, .10);

  --card-bg: #ffffff;
  --card-bg-2: #ffffff;
  --hero-bg:
    radial-gradient(620px 220px at 100% 0%, rgba(255, 150, 190, .18), transparent 70%),
    radial-gradient(420px 200px at 0% 100%, rgba(255, 190, 215, .16), transparent 70%),
    linear-gradient(180deg, #fffafd, #ffffff);

  --line: #f3e2ea;
  --line-soft: #f8eef3;

  --text: #2b1a24;
  --muted: #7f6a76;
  --muted-2: #a48e9b;
  --placeholder: #bfa8b6;

  --accent: #d6467f;
  --accent-2: #ff9dbe;
  --accent-grad: linear-gradient(135deg, #ffb0cd, #ff8ab6);
  --on-accent: #4a0f2a;
  --accent-soft: rgba(255, 138, 182, .12);
  --accent-shadow: rgba(255, 128, 178, .30);

  --ok-fg: #b32f68;
  --ok-bg: #ffe7f1;
  --ok-bd: #ffc7dc;

  --warn-fg: #a8641a;
  --warn-bg: #fff4e2;
  --warn-bd: #ffd9a8;

  --bad-fg: #b3244a;
  --bad-bg: #ffe9ee;
  --bad-bd: #ffc9d6;

  --info-fg: #8a5470;
  --info-bg: #fff0f6;
  --info-bd: #f7d3e3;

  --chip-muted-fg: #7f6a76;
  --chip-muted-bg: #f9f1f5;
  --chip-muted-bd: #f3e2ea;

  --track: #f9e9f0;
  --input-bg: #ffffff;
  --hover-bg: rgba(255, 138, 182, .10);
  --table-head-bg: #fff7fb;

  --header-bg: rgba(255, 255, 255, .86);
  --nav-bg: rgba(255, 255, 255, .94);
  --tabs-bg: rgba(255, 255, 255, .90);
  --modal-bg: #ffffff;
  --toast-bg: #ffffff;
  --modal-veil: rgba(90, 30, 60, .26);
  --modal-shadow: 0 -10px 50px rgba(120, 50, 80, .18);

  --date-badge-bg: #fff0f6;
  --date-badge-bd: #ffd6e6;
  --date-badge-fg: #c22f6a;

  --cal-bg: #ffffff;
  --cal-bg-has: #fff8fc;
  --cal-border: #f3e7ee;

  --avatar-bg: #ffe7f1;
  --avatar-fg: #c22f6a;

  --shadow: 0 12px 32px rgba(180, 90, 130, .10);
  --glow: 0 10px 24px rgba(255, 138, 182, .30);

  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

:root[data-theme="dark"] {
  --bg: #070509;
  --bg-glow-1: rgba(255, 122, 217, .13);
  --bg-glow-2: rgba(169, 123, 255, .14);
  --bg-glow-3: rgba(169, 123, 255, .07);

  --card-bg: linear-gradient(180deg, rgba(27, 18, 36, .92), rgba(18, 12, 25, .92));
  --card-bg-2: linear-gradient(180deg, rgba(27, 18, 36, .9), rgba(18, 12, 25, .9));
  --hero-bg:
    radial-gradient(620px 220px at 100% 0%, rgba(255, 122, 217, .2), transparent 70%),
    radial-gradient(420px 200px at 0% 100%, rgba(169, 123, 255, .14), transparent 70%),
    linear-gradient(180deg, #1d1228, #130d1a);

  --line: #2c1f39;
  --line-soft: #221728;

  --text: #f4edf9;
  --muted: #a294b0;
  --muted-2: #7b6d8a;
  --placeholder: #5d5269;

  --accent: #ff7ad9;
  --accent-2: #a97bff;
  --accent-grad: linear-gradient(135deg, #ff7ad9, #a97bff);
  --on-accent: #21061b;
  --accent-soft: rgba(255, 122, 217, .09);

  --ok-fg: #ffb3ea;
  --ok-bg: rgba(255, 122, 217, .12);
  --ok-bd: rgba(255, 122, 217, .32);

  --warn-fg: #ffc46b;
  --warn-bg: rgba(255, 196, 107, .10);
  --warn-bd: rgba(255, 196, 107, .28);

  --bad-fg: #ff5f8f;
  --bad-bg: rgba(255, 95, 143, .10);
  --bad-bd: rgba(255, 95, 143, .30);

  --info-fg: #cdb5ff;
  --info-bg: rgba(169, 123, 255, .12);
  --info-bd: rgba(169, 123, 255, .30);

  --chip-muted-fg: #a294b0;
  --chip-muted-bg: rgba(255, 255, 255, .04);
  --chip-muted-bd: #2c1f39;

  --track: rgba(255, 255, 255, .08);
  --input-bg: #0b0710;
  --hover-bg: rgba(255, 255, 255, .04);
  --table-head-bg: rgba(255, 255, 255, .025);

  --header-bg: rgba(9, 6, 12, .8);
  --nav-bg: rgba(9, 6, 12, .93);
  --tabs-bg: rgba(9, 6, 12, .92);
  --modal-bg: #170f20;
  --toast-bg: rgba(29, 19, 40, .98);

  --date-badge-bg: rgba(255, 122, 217, .06);
  --date-badge-bd: rgba(255, 122, 217, .16);
  --date-badge-fg: #ffd6f4;

  --cal-bg: #150e1d;
  --cal-bg-has: rgba(255, 122, 217, .07);
  --cal-border: #2a2033;

  --avatar-bg: linear-gradient(135deg, #3a2547, #2a1b36);
  --avatar-fg: #ff7ad9;

  --shadow: 0 12px 36px rgba(0, 0, 0, .5);
  --glow: 0 10px 28px rgba(255, 122, 217, .22);
  --accent-shadow: rgba(255, 122, 217, .22);
  --modal-veil: rgba(5, 3, 8, .7);
  --modal-shadow: 0 -10px 50px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Source Han Sans SC", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body { transition: background-color .25s ease, color .25s ease; }
body.modal-open { overflow: hidden; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 520px at 10% -12%, var(--bg-glow-1), transparent 62%),
    radial-gradient(760px 480px at 105% -5%, var(--bg-glow-2), transparent 58%),
    radial-gradient(800px 600px at 50% 120%, var(--bg-glow-3), transparent 60%),
    var(--bg);
}

/* 背景小星星（四角星 + ⊹），轻轻闪 */
.bg-deco {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg-deco span {
  position: absolute;
  color: var(--accent);
  line-height: 1;
  opacity: .14;
  animation: twinkle 5.5s ease-in-out infinite;
  will-change: transform, opacity;
}
@keyframes twinkle {
  0%, 100% { transform: scale(.82); opacity: .09; }
  50% { transform: scale(1.14); opacity: .26; }
}
@media (prefers-reduced-motion: reduce) {
  .bg-deco span { animation: none; opacity: .14; }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: .01em; }
p { margin: 0; }

.ico { width: 20px; height: 20px; flex: none; }
.ico.sm { width: 16px; height: 16px; }

/* --------------------------- 登录 --------------------------- */

.login-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
}

.login-theme {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 5;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card-bg);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.login-theme:hover { color: var(--text); }

.login-card {
  position: relative;
  width: 100%;
  max-width: 390px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 30px 24px 24px;
  box-shadow: 0 24px 70px rgba(180, 90, 130, .14), 0 0 0 1px var(--accent-soft);
  animation: rise .45s cubic-bezier(.2, .8, .2, 1);
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: -40% -30% auto;
  height: 220px;
  background: radial-gradient(closest-side, var(--accent-shadow), transparent 70%);
  filter: blur(10px);
  pointer-events: none;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background: var(--accent-grad);
  color: var(--on-accent);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 21px;
  margin-bottom: 16px;
  box-shadow: var(--glow);
  position: relative;
}

.login-card h1 { font-size: 23px; letter-spacing: .02em; margin-bottom: 18px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 5px 0 20px; letter-spacing: .04em; }

.login-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--chip-muted-bg);
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  margin-bottom: 18px;
}
.login-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 6px;
  border-radius: 10px;
  cursor: pointer;
  transition: color .15s, background .15s, box-shadow .15s;
}
.login-tab:hover { color: var(--text); }
.login-tab.active {
  color: var(--on-accent);
  background: var(--accent-grad);
  box-shadow: 0 6px 16px var(--accent-shadow);
}

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; letter-spacing: .02em; }

input[type=text], input[type=password], input[type=date], input[type=time],
input[type=number], input[type=month], select, textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text);
  padding: 11px 13px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .25s;
}

input::placeholder, textarea::placeholder { color: var(--placeholder); }

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

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

select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23988da3' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

.login-hint { color: var(--muted-2); font-size: 12.5px; margin-top: 16px; text-align: center; line-height: 1.6; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 16px;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  background: var(--chip-muted-bg);
  cursor: pointer;
  transition: transform .08s, filter .15s, background .15s, border-color .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn.block { width: 100%; }
.btn.primary {
  background: var(--accent-grad);
  color: var(--on-accent);
  box-shadow: 0 8px 22px var(--accent-shadow);
}
.btn.primary:hover { filter: brightness(1.04); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn.ghost:hover { background: var(--hover-bg); border-color: var(--accent); }
.btn.sm { padding: 7px 11px; font-size: 13px; border-radius: 9px; }
.btn.danger { color: var(--bad-fg); border-color: var(--bad-bd); background: var(--bad-bg); }
.btn.danger:hover { filter: brightness(.98); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.icon-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.icon-btn:hover { background: var(--hover-bg); color: var(--text); }

/* --------------------------- 框架 --------------------------- */

.app-shell { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; padding-bottom: 40px; }
.app-shell.admin { padding-bottom: 40px; }

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--line-soft);
}

.header-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-shell.admin .header-inner { max-width: 1040px; }

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { height: 34px; width: auto; display: block; flex: none; }
.login-logo { width: 190px; max-width: 76%; height: auto; display: block; margin-bottom: 14px; position: relative; }
.brand-dot {
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--accent-grad);
  color: var(--on-accent); display: grid; place-items: center;
  font-size: 15px; font-weight: 800; flex: none;
  box-shadow: 0 6px 16px var(--accent-shadow);
}
.brand-text { min-width: 0; }
.brand-name { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 11.5px; color: var(--muted-2); letter-spacing: .05em; }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.user-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 10px 5px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text);
  background: var(--card-bg);
}
.user-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--avatar-bg);
  display: grid; place-items: center; font-size: 11px; color: var(--avatar-fg);
}

.container { max-width: 720px; margin: 0 auto; padding: 18px 16px 8px; }
.app-shell.admin .container { max-width: 1040px; }

.page-title { font-size: 19px; margin-bottom: 2px; }
.page-sub { color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.section { margin-top: 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-title { font-size: 14.5px; font-weight: 650; color: var(--text); display: flex; align-items: center; gap: 8px; }
.section-more { font-size: 12.5px; color: var(--muted); }
.section-more:hover { color: var(--accent); }

/* --------------------------- 卡片 --------------------------- */

.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 12px; }
.card-pad { padding: 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--line-soft);
}
.card-title { font-size: 14px; font-weight: 650; }
.card-body { padding: 16px; }

/* --------------------------- 时长主卡 --------------------------- */

.hero-card {
  position: relative;
  padding: 20px;
  border-radius: 20px;
  border: 1px solid var(--ok-bd);
  background: var(--hero-bg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.hero-label { font-size: 12.5px; color: var(--muted); letter-spacing: .06em; }
.hero-num { display: flex; align-items: baseline; gap: 6px; margin-top: 4px; }
.hero-num b { font-size: 42px; line-height: 1.05; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hero-num span { font-size: 15px; color: var(--muted); }

.progress {
  height: 9px;
  border-radius: 99px;
  background: var(--track);
  overflow: hidden;
  margin: 14px 0 8px;
}
.progress > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 12px var(--accent-shadow);
  transition: width .6s cubic-bezier(.2, .8, .2, 1);
}
.progress.warn > i { background: linear-gradient(90deg, #d99a2b, #f0b445); box-shadow: none; }
.progress.bad > i { background: linear-gradient(90deg, #d34a6d, #ef5f7f); box-shadow: none; }

.hero-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.hero-meta b { color: var(--text); font-variant-numeric: tabular-nums; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .01em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.chip.ok { color: var(--ok-fg); background: var(--ok-bg); border-color: var(--ok-bd); }
.chip.warn { color: var(--warn-fg); background: var(--warn-bg); border-color: var(--warn-bd); }
.chip.bad { color: var(--bad-fg); background: var(--bad-bg); border-color: var(--bad-bd); }
.chip.info { color: var(--info-fg); background: var(--info-bg); border-color: var(--info-bd); }
.chip.muted { color: var(--chip-muted-fg); background: var(--chip-muted-bg); border-color: var(--chip-muted-bd); }

/* --------------------------- 列表 --------------------------- */

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-top: 1px solid var(--line-soft);
}
.list-item:first-child { border-top: none; }
.list-main { min-width: 0; flex: 1; }
.list-title { font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.list-side { flex: none; text-align: right; }
.list-side .btn { margin-left: 6px; }

.date-badge {
  width: 44px; flex: none;
  text-align: center;
  border-radius: 11px;
  background: var(--date-badge-bg);
  border: 1px solid var(--date-badge-bd);
  padding: 5px 0 4px;
}
.date-badge b { display: block; font-size: 15px; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--date-badge-fg); }
.date-badge span { font-size: 10.5px; color: var(--muted); }

/* --------------------------- 统计 --------------------------- */

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-grid.four { grid-template-columns: repeat(4, 1fr); }
.stat {
  background: var(--card-bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  box-shadow: var(--shadow);
}
.stat-num { font-size: 23px; font-weight: 720; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat-num small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* --------------------------- 底部导航 --------------------------- */

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  gap: 2px;
  padding: 8px 10px calc(8px + var(--safe-b));
  background: var(--nav-bg);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line-soft);
}
.bn-item {
  flex: 1;
  max-width: 110px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 5px 4px;
  border-radius: 12px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 550;
  transition: color .15s, background .15s;
}
.bn-item.active { color: var(--accent); background: var(--accent-soft); }

/* --------------------------- 管理端顶部页签 --------------------------- */

.admin-tabs {
  position: sticky;
  top: 57px;
  z-index: 19;
  background: var(--tabs-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line-soft);
}
.admin-tabs-inner {
  max-width: 1040px; margin: 0 auto;
  display: flex; gap: 4px; padding: 8px 12px;
  overflow-x: auto; scrollbar-width: none;
}
.admin-tabs-inner::-webkit-scrollbar { display: none; }
.tab {
  padding: 7px 13px;
  border-radius: 9px;
  font-size: 13.5px;
  color: var(--muted);
  white-space: nowrap;
  border: 1px solid transparent;
  font-weight: 550;
}
.tab:hover { color: var(--text); background: var(--hover-bg); }
.tab.active { color: var(--ok-fg); background: var(--accent-soft); border-color: var(--ok-bd); }

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

.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
table.data td:not(:first-child), table.data th { white-space: nowrap; }
table.data th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  background: var(--table-head-bg);
}
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data td:first-child { min-width: 150px; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: var(--accent-soft); }
td .row-actions { display: flex; gap: 5px; flex-wrap: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* --------------------------- 空状态 / 加载 --------------------------- */

.empty {
  text-align: center;
  padding: 30px 16px;
  color: var(--muted-2);
  font-size: 13.5px;
}
.empty .ico { width: 28px; height: 28px; margin-bottom: 8px; opacity: .45; }

.loading { text-align: center; padding: 60px 0; color: var(--muted); font-size: 13.5px; }
.spinner {
  width: 22px; height: 22px; margin: 0 auto 10px;
  border: 2px solid var(--track);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------- 弹窗 --------------------------- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: var(--modal-veil);
  backdrop-filter: blur(5px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
  animation: fade .18s ease;
}

@media (min-width: 640px) {
  .modal-backdrop { align-items: center; padding: 24px; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--modal-bg);
  border: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  box-shadow: var(--modal-shadow);
  animation: slide-up .24s cubic-bezier(.2, .8, .2, 1);
}
.modal.wide { max-width: 720px; }
@media (min-width: 640px) {
  .modal { border-radius: 18px; }
}
@keyframes slide-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px;
}
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 4px 18px 16px; overflow-y: auto; }
.modal-foot {
  padding: 12px 18px calc(16px + var(--safe-b));
  border-top: 1px solid var(--line-soft);
  display: flex; gap: 8px; justify-content: flex-end;
}
.modal-foot .btn { flex: 1; }
@media (min-width: 640px) { .modal-foot .btn { flex: 0 0 auto; } }

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

#toast-root { position: fixed; left: 0; right: 0; bottom: calc(96px + var(--safe-b)); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  max-width: 88vw;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  background: var(--toast-bg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: toast-in .22s ease;
}
.toast.ok { border-color: var(--ok-bd); color: var(--ok-fg); }
.toast.bad { border-color: var(--bad-bd); color: var(--bad-fg); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* --------------------------- 其它 --------------------------- */

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { margin-bottom: 0; flex: 1 1 130px; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }

.warn-box {
  border: 1px solid var(--warn-bd);
  background: var(--warn-bg);
  color: var(--warn-fg);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}
.info-box {
  border: 1px solid var(--line);
  background: var(--chip-muted-bg);
  color: var(--muted);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 12.5px;
}
.info-box b { color: var(--text); }

.divider { height: 1px; background: var(--line-soft); margin: 16px 0; }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.kv:last-child { border-bottom: none; }
.kv span { color: var(--muted); }
.kv b { font-weight: 600; }

.sticky-actions {
  position: sticky;
  bottom: calc(14px + var(--safe-b));
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.tag-demo { font-size: 10.5px; color: var(--warn-fg); border: 1px solid var(--warn-bd); border-radius: 5px; padding: 0 4px; }

.note-line {
  font-size: 11.5px;
  color: var(--muted-2);
  margin-top: 2px;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------- 侧边导航 --------------------------- */

.anchor-shell { display: flex; align-items: stretch; }

.sidebar { 
  width: 236px;
  flex: none;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  height: 100dvh;
  padding: 20px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--card-bg);
  border-right: 1px solid var(--line-soft);
  z-index: 40;
  transition: width .2s ease, padding .2s ease;
}

.sidebar-brand { position: relative; padding: 0 8px 18px; }
.sidebar-brand img { width: 152px; max-width: 100%; display: block; }
.sidebar-sub { font-size: 11px; color: var(--muted-2); letter-spacing: .12em; margin-top: 8px; }
.brand-mini {
  display: none;
  width: 38px; height: 38px;
  border-radius: 12px;
  background: var(--accent-grad);
  color: var(--on-accent);
  font-weight: 800;
  font-size: 17px;
  place-items: center;
  box-shadow: 0 6px 16px var(--accent-shadow);
}
.side-toggle {
  position: absolute;
  right: 0;
  top: -4px;
  width: 28px; height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card-bg);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.side-toggle:hover { color: var(--accent); border-color: var(--ok-bd); }
body.sidebar-collapsed .side-toggle .ico { transform: rotate(180deg); }

.side-nav { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; flex: 1; }
.side-group {
  font-size: 10.5px; letter-spacing: .16em; color: var(--muted-2);
  margin: 14px 10px 4px; text-transform: uppercase;
}
.side-group:first-child { margin-top: 4px; }
.side-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  border-radius: 11px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 550;
  transition: background .15s, color .15s;
}
.side-item:hover { background: var(--hover-bg); color: var(--text); }
.side-item.active { background: var(--accent-soft); color: var(--ok-fg); font-weight: 650; }
.side-item .ico { flex: none; }

.side-logout {
  margin-top: 14px;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.side-logout:hover { color: var(--text); background: var(--hover-bg); }

.sidebar-veil { display: none; }
.menu-btn { display: none; }
.main { flex: 1; min-width: 0; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-104%);
    transition: transform .26s cubic-bezier(.2, .8, .2, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
  }
  body.sidebar-open .sidebar { transform: none; }
  .sidebar-veil {
    display: block;
    position: fixed; inset: 0;
    background: rgba(50, 20, 40, .32);
    opacity: 0; pointer-events: none;
    transition: opacity .2s;
    z-index: 39;
  }
  body.sidebar-open .sidebar-veil { opacity: 1; pointer-events: auto; }
  .menu-btn { display: grid; margin-right: 2px; }
  .header-inner .brand-logo { display: none; }
  .side-toggle { display: none; }
}

@media (min-width: 901px) {
  body.sidebar-collapsed .sidebar { width: 76px; padding: 18px 10px 14px; }
  body.sidebar-collapsed .sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0 0 14px;
  }
  body.sidebar-collapsed .sidebar-brand img,
  body.sidebar-collapsed .sidebar-sub,
  body.sidebar-collapsed .side-group,
  body.sidebar-collapsed .side-item span,
  body.sidebar-collapsed .side-logout span { display: none; }
  body.sidebar-collapsed .brand-mini { display: grid; }
  body.sidebar-collapsed .side-toggle { position: static; }
  body.sidebar-collapsed .side-nav { align-items: center; }
  body.sidebar-collapsed .side-item {
    justify-content: center;
    padding: 11px 0;
    width: 44px;
  }
  body.sidebar-collapsed .side-logout {
    justify-content: center;
    padding: 10px 0;
  }
}

/* --------------------------- 主播首页 --------------------------- */

.welcome-card {
  padding: 26px 22px;
  border-radius: 22px;
  border: 1px solid var(--ok-bd);
  background:
    radial-gradient(520px 200px at 100% 0%, var(--accent-soft), transparent 70%),
    var(--card-bg);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.welcome-kicker { font-size: 11.5px; letter-spacing: .3em; color: var(--accent); }
.welcome-title { font-size: 26px; margin: 8px 0 6px; letter-spacing: .01em; }
.welcome-sub { font-size: 13px; color: var(--muted); }

.sched-link-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 16px 18px; margin-bottom: 14px;
}
.sched-link-main { min-width: 0; }
.sched-link-main .card-title { font-size: 15px; }
.sched-link-card .btn { flex: none; }

.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card-bg);
  color: var(--muted);
  font-size: 12.5px;
  transition: border-color .15s, color .15s;
}
.quick-item:hover { border-color: var(--ok-bd); color: var(--accent); }

/* --------------------------- 备忘录 --------------------------- */

.mood-row { display: flex; flex-wrap: wrap; gap: 6px; }
.mood {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--card-bg);
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, background .15s, transform .1s;
}
.mood:active { transform: scale(.96); }
.mood .mood-emoji { font-size: 13px; line-height: 1.2; letter-spacing: -.02em; }
.mood .mood-label { font-size: 10.5px; color: var(--muted); }
.mood.active { border-color: var(--accent); background: var(--accent-soft); }

.check-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text);
  margin: 2px 0 14px;
  cursor: pointer;
}
.check-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.check-row em { color: var(--muted-2); font-style: normal; font-size: 12px; }

.memo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 12px;
}
.memo {
  position: relative;
  border-radius: 18px;
  padding: 14px 14px 12px;
  color: #3b2333;
  border: 1px solid rgba(255, 255, 255, .75);
  background: rgba(255, 255, 255, .55);
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 28px rgba(180, 90, 130, .12);
  transform: rotate(-.6deg);
}
.memo:nth-child(2n) { transform: rotate(.7deg); }
.memo:nth-child(3n) { transform: rotate(-.3deg); }
.memo.tone-0 { background: rgba(255, 224, 238, .62); }
.memo.tone-1 { background: rgba(255, 245, 225, .62); }
.memo.tone-2 { background: rgba(240, 246, 255, .62); }
.memo.tone-3 { background: rgba(242, 239, 255, .62); }
.memo-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.memo-mood { font-size: 14px; line-height: 1.2; letter-spacing: -.01em; }
.memo-who { font-size: 12px; font-weight: 650; color: #7a3557; }
.memo-time { font-size: 10.5px; color: #9b7188; }
.memo-text { margin-top: 8px; font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.memo-foot { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.memo-del {
  border: none; background: transparent; color: #b0476f;
  font-size: 11.5px; font-family: inherit; cursor: pointer; padding: 2px 4px; border-radius: 6px;
}
.memo-del:hover { background: rgba(176, 71, 111, .1); }

/* --------------------------- 组内素材 --------------------------- */

.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.asset-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
}
.asset-name { font-size: 15px; font-weight: 650; }
.asset-note { font-size: 12.5px; color: var(--muted); min-height: 36px; }
.asset-card .btn { align-self: flex-start; }

.ellipsis { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* --------------------------- 提醒 --------------------------- */

.reminder-box {
  border: 1px solid var(--ok-bd);
  background:
    radial-gradient(420px 140px at 100% 0%, var(--accent-soft), transparent 70%),
    var(--card-bg);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.reminder-title { font-size: 13px; font-weight: 650; color: var(--ok-fg); display: flex; align-items: center; gap: 6px; }
.reminder-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; margin-top: 8px; }
.reminder-note { color: var(--muted); font-size: 12px; }

@media (max-width: 520px) {
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .welcome-title { font-size: 21px; }
  .sched-link-card { flex-direction: column; align-items: stretch; }
  .sched-link-card .btn { width: 100%; }
  .memo-grid { grid-template-columns: 1fr; }
}

/* --------------------------- 台历 --------------------------- */

.cal-card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px 16px 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.cal-card::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 12px;
  background:
    radial-gradient(circle at 7px 6px, var(--ok-bd) 3px, transparent 3.5px) 0 0 / 14px 12px repeat-x;
  opacity: .8;
}
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-title { display: flex; align-items: baseline; gap: 6px; }
.cal-title b { font-size: 27px; font-weight: 750; letter-spacing: -.02em; }
.cal-title span { font-size: 14px; color: var(--muted); }
.cal-nav {
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.cal-nav:hover { color: var(--accent); border-color: var(--ok-bd); }

.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11.5px;
  color: var(--muted-2);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; padding-top: 8px; }
.cal-cell {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-height: 84px;
  padding: 7px 8px 8px;
  background: var(--cal-bg);
  border: 1px solid var(--cal-border);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  text-align: left;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.cal-cell.empty { background: transparent; border-color: var(--cal-border); border-style: dashed; cursor: default; }
.cal-cell.has { background: var(--cal-bg-has); }
.cal-cell.has:hover { border-color: var(--accent); box-shadow: 0 8px 18px rgba(255, 138, 182, .14); }
.cal-cell.today { border-color: var(--accent); }
.cal-top { display: flex; align-items: center; justify-content: space-between; }
.cal-numwrap { position: relative; display: inline-grid; place-items: center; width: 24px; height: 24px; }
.cal-num {
  position: relative;
  z-index: 2;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.cal-cell.has .cal-num, .cal-cell.today .cal-num { color: var(--text); }
.cal-cell.today .cal-num { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.cal-ring {
  position: absolute;
  left: -6px;
  top: -5px;
  width: 38px;
  height: 36px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  opacity: .95;
  transform: rotate(-6deg);
  z-index: 1;
}
.cal-star { color: var(--accent); font-size: 11px; line-height: 1; }
.cal-tag {
  display: block;
  min-width: 0;
  max-width: 100%;
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--ok-bg);
  color: var(--ok-fg);
  font-size: 10.5px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-more { position: absolute; right: 6px; bottom: 4px; font-size: 9.5px; color: var(--muted-2); }
.cal-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 12px; flex-wrap: wrap;
}

/* 点开某一天的详情 */
.day-note { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.day-note:last-child { border-bottom: none; }
.day-note-head { display: flex; align-items: center; gap: 8px; }
.day-note-title { font-size: 15px; font-weight: 650; }
.day-note-meta { font-size: 11.5px; color: var(--muted-2); margin-top: 3px; }
.day-note-text {
  margin-top: 8px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text);
  background: var(--ok-bg);
  border: 1px solid var(--ok-bd);
  border-radius: 10px;
  padding: 9px 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
.day-note-empty { margin-top: 8px; font-size: 12.5px; color: var(--muted-2); }

@media (max-width: 520px) {
  .cal-grid { gap: 4px; }
  .cal-card { padding: 20px 10px 12px; }
  .cal-cell { min-height: 64px; padding: 4px 4px 5px; }
  .cal-tag {
    font-size: 9px;
    padding: 1px 3px;
    white-space: normal;
    word-break: break-all;
    text-overflow: clip;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .cal-title b { font-size: 22px; }
  .cal-num { font-size: 11.5px; }
}

/* --------------------------- 预约问卷 --------------------------- */

.survey-card-wrap { padding: 20px 18px; }
.survey-step { display: flex; align-items: center; gap: 10px; margin: 22px 0 10px; }
.survey-step:first-of-type { margin-top: 4px; }
.survey-num {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 7px;
  padding: 2px 7px;
  letter-spacing: .08em;
  flex: none;
}
.survey-q { font-size: 15px; font-weight: 650; }
.survey-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.survey-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card-bg);
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.survey-card:hover { border-color: var(--ok-bd); }
.survey-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 8px 20px rgba(255, 138, 182, .12);
}
.survey-card-name { font-size: 14px; font-weight: 650; }
.survey-card-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }
.survey-card-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.survey-options { display: flex; flex-direction: column; gap: 8px; }
.survey-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-bg);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.survey-option:hover { border-color: var(--ok-bd); }
.survey-option input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.survey-option-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.survey-option-body b { font-size: 13.5px; font-weight: 600; }
.survey-option-body span { font-size: 12px; color: var(--muted); }
.survey-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.survey-option.disabled { opacity: .45; cursor: not-allowed; }
.survey-empty {
  margin: 0;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  text-align: center;
  color: var(--muted-2);
  font-size: 13px;
}
.survey-card-wrap textarea { width: 100%; min-height: 92px; }
.survey-submit { margin-top: 16px; padding: 12px; }

@media (max-width: 520px) {
  .survey-grid { grid-template-columns: 1fr; }
  .survey-card-wrap { padding: 16px 14px; }
}

/* --------------------------- 粉丝档案 --------------------------- */

.fan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.fan-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px 16px;
  box-shadow: var(--shadow);
}
.fan-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fan-name { font-size: 16px; font-weight: 700; }
.fan-actions { display: flex; gap: 4px; }
.fan-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fan-kv { margin: 12px 0 0; display: grid; gap: 8px; }
.fan-kv > div { display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: start; }
.fan-kv dt { font-size: 12px; color: var(--muted-2); padding-top: 1px; }
.fan-kv dd { margin: 0; font-size: 13px; line-height: 1.55; word-break: break-word; white-space: pre-wrap; }
.birthday-row { display: flex; align-items: center; gap: 8px; }
.birthday-row select { width: auto; min-width: 96px; }

/* --------------------------- 直播时间 / 心事信笺 --------------------------- */

.live-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.live-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.live-label { width: 56px; font-size: 12.5px; color: var(--muted); flex: none; }
.live-row input[type="time"] { width: 124px; }
.live-dash { color: var(--muted-2); }
.live-tags { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.live-tag { font-size: 12.5px; color: var(--muted); }
.live-tag b { color: var(--text); margin-right: 6px; }

.letter-list { display: flex; flex-direction: column; gap: 12px; }
.letter-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.letter-text { font-size: 14px; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
.letter-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.letter-foot .spacer { flex: 1; }

/* --------------------------- 交付倒计时 --------------------------- */

.due-box {
  background: var(--bad-bg);
  border: 1px solid var(--bad-bd);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.due-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--bad-fg);
  margin-bottom: 6px;
}
.due-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; padding: 3px 0; }
.due-chip {
  display: inline-block;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11.5px;
  background: var(--chip-muted-bg);
  color: var(--muted);
  white-space: nowrap;
}
.due-chip.urgent {
  background: var(--bad-bg);
  color: var(--bad-fg);
  border: 1px solid var(--bad-bd);
  font-weight: 700;
}

/* --------------------------- 插件中心 --------------------------- */

.plugin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.plugin-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.plugin-top { display: flex; gap: 10px; align-items: flex-start; }
.plugin-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  flex: none;
}
.plugin-head { min-width: 0; }
.plugin-name { font-size: 15px; font-weight: 650; word-break: break-word; }
.plugin-meta { font-size: 11.5px; color: var(--muted-2); margin-top: 2px; }
.plugin-note { font-size: 12.5px; color: var(--muted); line-height: 1.6; word-break: break-word; }
.plugin-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.like-btn {
  border: 1px solid var(--line);
  background: var(--card-bg);
  border-radius: 999px;
  padding: 4px 11px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: border-color .15s, background .15s, color .15s;
}
.like-btn:hover { border-color: var(--accent); color: var(--accent); }
.like-btn.liked {
  background: var(--accent-soft);
  border-color: var(--ok-bd);
  color: #e0447f;
  font-weight: 600;
}

/* --------------------------- 素材预览 --------------------------- */

.asset-thumbs { display: flex; gap: 6px; margin-bottom: 6px; }
.asset-thumb {
  flex: 1;
  min-width: 0;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--chip-muted-bg);
}
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.asset-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* --------------------------- 时间轴排班表 --------------------------- */

.tg-wrap { padding: 0; position: relative; overflow: auto; }
.time-grid thead th { height: auto; }
.time-grid tbody td,
.time-grid tbody th { height: var(--tg-row, 42px); }
.time-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 900px;
  font-size: 12px;
}
.time-grid th, .time-grid td {
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  padding: 2px 4px;
  vertical-align: top;
}
.time-grid th:last-child, .time-grid td:last-child { border-right: none; }
.time-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--table-head-bg);
  font-weight: 600;
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  padding: 7px 5px;
}
.time-grid thead th.is-today { color: var(--accent); background: var(--accent-soft); }
.time-grid .tg-date { font-size: 10.5px; color: var(--muted-2); font-weight: 400; }
.time-grid .tg-time {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 62px;
  min-width: 62px;
  background: var(--card-bg);
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 500;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.time-grid thead .tg-time { z-index: 3; background: var(--table-head-bg); }
.time-grid tr.full-hour td, .time-grid tr.full-hour .tg-time { border-top: 1px solid var(--line); }
.tg-cell { cursor: pointer; }
.tg-cell:hover { background: var(--accent-soft); }
.tg-cell.has { cursor: default; }
.tg-chips { display: flex; flex-direction: column; gap: 1px; }
.shift-chip {
  display: flex;
  align-items: baseline;
  gap: 3px;
  width: 100%;
  min-width: 0;
  text-align: left;
  border: 1px solid var(--ok-bd);
  background: var(--accent-soft);
  border-radius: 5px;
  padding: 0 4px;
  font-family: inherit;
  font-size: 9.5px;
  line-height: 1.25;
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
}
.shift-chip b { font-weight: 650; white-space: nowrap; flex: none; }
.shift-chip span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shift-chip:hover { border-color: var(--accent); background: var(--card-bg); }
.shift-chip.training {
  background: rgba(139, 122, 255, .14);
  border-color: rgba(139, 122, 255, .45);
}
.shift-chip.training b { color: #6f5bd6; }

/* 每天 80% 上限进度条 */
.load-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--chip-muted-bg);
  overflow: hidden;
  margin: -2px 0 12px;
}
.load-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #ff9ec4);
  transition: width .3s ease;
}

/* --------------------------- 排班页：整屏不滚动 --------------------------- */

body.sched-mode, html.sched-mode { overflow: hidden; }
body.sched-mode .container { display: flex; flex-direction: column; min-height: 0; }
body.sched-mode.admin-mode .container { height: calc(100dvh - 112px); }
body.sched-mode:not(.admin-mode) .container { height: calc(100dvh - 66px); max-width: 1120px; }
body.sched-mode .container > * { flex: none; }
body.sched-mode .container > .tg-wrap { flex: 1 1 auto; min-height: 0; }
.sched-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.sched-tab {
  border: 1px solid var(--line);
  background: var(--card-bg);
  color: var(--muted);
  border-radius: 10px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.sched-tab:hover { border-color: var(--ok-bd); }
.sched-tab.active {
  background: var(--accent-soft);
  border-color: var(--ok-bd);
  color: var(--accent);
  font-weight: 650;
}
.sched-count {
  display: inline-block;
  min-width: 16px;
  padding: 0 5px;
  margin-left: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .8);
  font-size: 10.5px;
  font-weight: 600;
}
.sched-panel { flex: 1 1 auto; min-height: 0; overflow: auto; }

/* --------------------------- 工作表注意事项 --------------------------- */

.notice-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(180deg, rgba(255, 236, 244, .75), rgba(255, 246, 250, .6));
  border: 1px dashed var(--ok-bd);
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 10px;
}
.notice-more {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.notice-more:hover { text-decoration: underline; }
.notice-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(255, 255, 255, .78);
  border-radius: 7px;
  padding: 2px 8px;
  letter-spacing: .04em;
  white-space: nowrap;
}
.notice-list {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--muted);
}
.notice-list li + li { margin-top: 3px; }
.notice-examples {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  padding-left: 2px;
}
.notice-examples span { display: block; color: var(--text); }
.notice-list b,
.notice-list strong { color: var(--text); font-weight: 650; }
.notice-tip {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .7);
  border: 1px solid rgba(255, 255, 255, .9);
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--text);
}
.notice-soft { margin: 8px 0 0; font-size: 11.5px; color: var(--muted-2); }

/* 预约前的知晓提示 */
.ack-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--accent-soft);
  border: 1px dashed var(--ok-bd);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 12.5px;
  color: var(--muted);
}
.ack-banner .btn { margin-left: auto; }
.is-locked { pointer-events: none; opacity: .55; filter: saturate(.75); }

/* 自动同步 */
.sync-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.sync-token {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  background: var(--chip-muted-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  word-break: break-all;
}
.sync-sample {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  background: var(--chip-muted-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  overflow-x: auto;
  margin: 0 0 8px;
  white-space: pre;
}

/* 培训提醒 */
.training-card { display: flex; gap: 16px; align-items: flex-start; padding: 20px 22px; min-height: 96px; overflow: hidden; }
.training-badge {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(139, 122, 255, .14);
  color: #6f5bd6;
  flex: none;
}
.training-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.training-title { font-size: 14px; font-weight: 700; color: #6f5bd6; letter-spacing: .02em; }
.training-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14.5px; line-height: 1.5; }
.training-note { color: var(--muted); font-size: 13px; }

/* 预约时间选择 */
.book-when { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.book-time { display: inline-flex; align-items: center; gap: 8px; }
.book-when input[type="time"] { width: 124px; }
/* 预约时间看板 */
.book-grid-wrap { border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
.book-grid { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 560px; font-size: 11px; }
.book-grid th, .book-grid td { border-bottom: 1px solid var(--line-soft); border-right: 1px solid var(--line-soft); }
.book-grid thead th {
  padding: 6px 4px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  background: var(--table-head-bg);
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
}
.book-grid thead th span { display: block; font-size: 10px; color: var(--muted-2); font-weight: 400; }
.book-grid thead th.is-today { color: var(--accent); background: var(--accent-soft); }
.book-grid .bg-time {
  width: 54px;
  text-align: right;
  padding: 0 6px;
  color: var(--muted-2);
  font-weight: 500;
  background: var(--card-bg);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.book-grid td { height: 26px; cursor: pointer; }
.book-grid td:hover { background: var(--accent-soft); }
.book-grid td.busy { background: var(--chip-muted-bg); cursor: not-allowed; }
.bg-dot {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-2);
  margin: 0 auto;
  opacity: .45;
}
.book-grid td.sel { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.book-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--muted);
  flex-wrap: wrap;
}
.book-legend .spacer { flex: 1; }
.book-sel-label { font-weight: 600; color: var(--accent); }
.legend-item { display: inline-flex; align-items: center; gap: 4px; }
.legend-item .dot { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }
.legend-item .dot.busy { background: var(--line); }
.legend-item .dot.sel { background: var(--accent); }

.hidden { display: none !important; }

/* --------------------------- 预约页的服务分组 --------------------------- */

.service-block { margin-bottom: 18px; }
.service-head { margin: 0 2px 8px; }
.service-title {
  font-size: 15px; font-weight: 650;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.service-desc { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.day-group + .day-group { margin-top: 16px; }
.day-head { display: flex; align-items: baseline; gap: 8px; margin: 0 2px 8px; }
.day-head b { font-size: 13.5px; font-weight: 650; }
.day-head span { font-size: 12px; color: var(--muted-2); }

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

@media (max-width: 520px) {
  .stat-grid.four { grid-template-columns: repeat(2, 1fr); }
  .hero-num b { font-size: 34px; }
  .list-item { padding: 12px 14px; }
  .card-body { padding: 14px; }
}

/* --------------------------- ҹ¼äģʽ£ºÐÂ×é¼þµÄÊÊÅä --------------------------- */

:root[data-theme="dark"] .memo {
  color: var(--text);
  border-color: rgba(255, 255, 255, .07);
  background: rgba(255, 255, 255, .045);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
}
:root[data-theme="dark"] .memo.tone-0 { background: rgba(255, 122, 217, .10); }
:root[data-theme="dark"] .memo.tone-1 { background: rgba(255, 196, 107, .09); }
:root[data-theme="dark"] .memo.tone-2 { background: rgba(120, 170, 255, .09); }
:root[data-theme="dark"] .memo.tone-3 { background: rgba(169, 123, 255, .10); }
:root[data-theme="dark"] .memo-who { color: #ffb3ea; }
:root[data-theme="dark"] .memo-time { color: var(--muted-2); }
:root[data-theme="dark"] .memo-del { color: #ff9cc7; }
:root[data-theme="dark"] .memo-del:hover { background: rgba(255, 122, 217, .12); }

:root[data-theme="dark"] .notice-strip {
  background: rgba(255, 122, 217, .06);
  border-color: rgba(255, 122, 217, .26);
}
:root[data-theme="dark"] .notice-badge {
  background: rgba(255, 122, 217, .14);
  color: #ffb3ea;
}
:root[data-theme="dark"] .notice-tip {
  background: rgba(255, 255, 255, .04);
  border-color: rgba(255, 255, 255, .07);
}
:root[data-theme="dark"] .notice-soft { color: var(--muted-2); }
:root[data-theme="dark"] .notice-list { color: var(--muted); }
:root[data-theme="dark"] .notice-list b,
:root[data-theme="dark"] .notice-list strong { color: var(--text); }

:root[data-theme="dark"] .training-badge {
  background: rgba(169, 123, 255, .16);
  color: #c9b6ff;
}
:root[data-theme="dark"] .training-title { color: #c9b6ff; }
:root[data-theme="dark"] .shift-chip.training {
  background: rgba(169, 123, 255, .16);
  border-color: rgba(169, 123, 255, .38);
}
:root[data-theme="dark"] .shift-chip.training b { color: #d5c6ff; }

:root[data-theme="dark"] .tag-demo {
  background: rgba(255, 196, 107, .12);
  color: var(--warn-fg);
  border-color: var(--warn-bd);
}

:root[data-theme="dark"] .sync-token,
:root[data-theme="dark"] .sync-sample {
  background: rgba(255, 255, 255, .04);
  border-color: var(--line);
}
