/* ============================================================
   今日待办 · 样式表（移动端优先，支持浅色/深色）
   ============================================================ */

:root {
  --brand: #5b5bd6;
  --brand-strong: #4a4ac4;
  --brand-soft: rgba(91, 91, 214, 0.12);
  --danger: #dc4a4a;
  --success: #2fa26a;

  --bg: #f5f6fb;
  --bg-grad: radial-gradient(1200px 600px at 50% -10%, #e6e7ff 0%, #f5f6fb 55%);
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --border: #e5e7f0;
  --text: #1c1d29;
  --text-muted: #6b6f85;
  --text-faint: #9aa0b5;
  --shadow-sm: 0 1px 2px rgba(24, 26, 48, 0.06);
  --shadow-md: 0 6px 20px rgba(24, 26, 48, 0.09);
  --shadow-lg: 0 20px 50px rgba(24, 26, 48, 0.16);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --brand: #8b8bf5;
    --brand-strong: #a0a0ff;
    --brand-soft: rgba(139, 139, 245, 0.16);
    --danger: #ff8080;
    --success: #4fd39a;
    --bg: #0f1018;
    --bg-grad: radial-gradient(1200px 600px at 50% -10%, #1c1d33 0%, #0f1018 55%);
    --surface: #191a26;
    --surface-2: #20222f;
    --border: #2b2d3d;
    --text: #eef0f8;
    --text-muted: #a2a7bd;
    --text-faint: #767b92;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 22px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme='dark'] {
  --brand: #8b8bf5;
  --brand-strong: #a0a0ff;
  --brand-soft: rgba(139, 139, 245, 0.16);
  --danger: #ff8080;
  --success: #4fd39a;
  --bg: #0f1018;
  --bg-grad: radial-gradient(1200px 600px at 50% -10%, #1c1d33 0%, #0f1018 55%);
  --surface: #191a26;
  --surface-2: #20222f;
  --border: #2b2d3d;
  --text: #eef0f8;
  --text-muted: #a2a7bd;
  --text-faint: #767b92;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 22px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-size: 15px;
  line-height: 1.55;
}

.hidden { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }

/* ---------------------------------- 启动态 --------------------------------- */
.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  background-image: var(--bg-grad);
  z-index: 60;
}
.spinner {
  width: 30px; height: 30px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------- 通用 ---------------------------------- */
.view { animation: fade-up 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
  user-select: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn.primary {
  background: linear-gradient(160deg, var(--brand), var(--brand-strong));
  color: #fff;
  box-shadow: 0 4px 14px var(--brand-soft);
}
.btn.primary:hover:not(:disabled) { box-shadow: 0 6px 20px var(--brand-soft); }

.btn.subtle {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-muted);
}
.btn.subtle:hover:not(:disabled) { color: var(--text); border-color: var(--brand); }

.btn.block { width: 100%; }
.btn.small { padding: 8px 12px; font-size: 13.5px; }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 17px;
  transition: background 0.16s ease, color 0.16s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.small { width: 28px; height: 28px; font-size: 13px; }

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}
.field input, .field select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
  min-height: 44px;
}
.field input:focus, .field select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.input-with-action { position: relative; }
.input-with-action input { padding-right: 44px; }
.input-with-action .ghost-icon {
  position: absolute; right: 6px; top: 50%;
  transform: translateY(-50%);
  border: none; background: transparent; cursor: pointer;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  opacity: 0.6;
}
.input-with-action .ghost-icon:hover { opacity: 1; background: var(--surface-2); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 400px) { .grid-2 { grid-template-columns: 1fr; } }

.divider { height: 1px; background: var(--border); margin: 14px 0; }

.hint { font-size: 12px; color: var(--text-faint); margin: 8px 0 0; line-height: 1.6; }
.hint code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 11.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------------------------------- 登录页 --------------------------------- */
.auth-view {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 18px calc(24px + var(--safe-bottom));
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 30px 24px 24px;
  box-shadow: var(--shadow-lg);
}
.brand { text-align: center; margin-bottom: 22px; }
.brand-mark {
  width: 54px; height: 54px;
  margin: 0 auto 14px;
  border-radius: 17px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--brand), var(--brand-strong));
  color: #fff;
  box-shadow: 0 8px 22px var(--brand-soft);
}
.brand-mark svg { width: 27px; height: 27px; }
.brand h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.brand-sub { margin: 6px 0 0; font-size: 13px; color: var(--text-muted); }

.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  padding: 4px;
  margin-bottom: 20px;
}
.tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 0;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s ease;
}
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.form-error {
  background: rgba(220, 74, 74, 0.1);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.65;
  margin: 0 0 14px;
  word-break: break-word;
}
.auth-foot {
  margin: 18px 0 0;
  font-size: 11.5px;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.7;
}

/* ---------------------------------- 主界面 --------------------------------- */
/* 布局骨架：移动端单列 + 侧栏抽屉；≥980px 双栏（侧栏常驻） */
.shell { min-height: 100dvh; }

.content {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 16px calc(18px + var(--safe-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 2px 10px;
}
.topbar-main { display: flex; align-items: center; gap: 4px; min-width: 0; }
.topbar-title { margin: 0; font-size: 25px; font-weight: 700; letter-spacing: -0.02em; }
.topbar-sub { margin: 3px 0 0; font-size: 13px; color: var(--text-muted); }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.side-toggle { display: inline-grid; }

.user-chip {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, var(--brand), var(--brand-strong));
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
}

.demo-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(240, 170, 40, 0.14);
  border: 1px solid rgba(240, 170, 40, 0.34);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 12.5px;
  margin-bottom: 12px;
}
.demo-banner span { flex: 1; color: var(--text-muted); }

/* 侧栏（移动端为抽屉） */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 45;
  width: min(304px, 86vw);
  padding: 16px 14px calc(20px + var(--safe-bottom));
  background: var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateX(-105%);
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  visibility: hidden;
}
body.side-open .sidebar {
  transform: none;
  visibility: visible;
  box-shadow: var(--shadow-lg);
}
.side-mask {
  position: fixed; inset: 0;
  z-index: 44;
  background: rgba(14, 15, 25, 0.42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fade-in 0.22s ease;
}

.side-search { position: relative; margin-bottom: 14px; }
.side-search-icon {
  position: absolute; left: 11px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--text-faint);
  pointer-events: none;
}
.side-search input {
  width: 100%;
  padding: 10px 34px 10px 33px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  outline: none;
  font-size: 13.5px;
  min-height: 40px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
  -webkit-appearance: none;
  appearance: none;
}
.side-search input::-webkit-search-cancel-button { display: none; }
.side-search input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.side-search-clear {
  position: absolute; right: 7px; top: 50%;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  border: none; border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  display: grid; place-items: center;
}

.side-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 0 11px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.stat b { display: block; font-size: 21px; font-weight: 700; color: var(--brand); line-height: 1.2; }
.stat span { font-size: 11px; color: var(--text-faint); letter-spacing: 0.04em; }

.side-block { margin-bottom: 20px; }
.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 9px;
}
.side-head-btns { display: flex; gap: 2px; }
.mini-btn {
  width: 26px; height: 26px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.mini-btn:hover { background: var(--surface-2); color: var(--text); }

/* 日历 */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-dow {
  font-size: 10.5px;
  color: var(--text-faint);
  text-align: center;
  padding: 3px 0 5px;
}
.cal-day {
  position: relative;
  height: 36px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  cursor: pointer;
  padding: 0;
  transition: background 0.14s ease, color 0.14s ease;
}
.cal-day:hover { background: var(--surface-2); color: var(--text); }
.cal-day.has-tasks { color: var(--text); font-weight: 600; }
.cal-day .dot {
  position: absolute;
  bottom: 4px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--brand);
  opacity: 0.8;
}
.cal-day.is-today { box-shadow: inset 0 0 0 1.5px var(--brand); }
.cal-day.is-selected {
  background: linear-gradient(160deg, var(--brand), var(--brand-strong));
  color: #fff;
  box-shadow: none;
}
.cal-day.is-selected .dot { background: #fff; }
.cal-blank { height: 36px; }

/* 标签 */
.tags-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-pill);
  padding: 5px 11px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.tag-row:hover { border-color: var(--brand); color: var(--text); }
.tag-row .tag-hash { color: var(--brand); font-weight: 700; }
.tag-row b { font-weight: 600; color: var(--text-faint); font-size: 11.5px; }

/* 时间线 */
.timeline { font-size: 13px; }
.tl-year {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  font-weight: 700;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.tl-year:hover { background: var(--surface-2); }
.tl-year small { color: var(--text-faint); font-weight: 500; }
/* 日历标题可点击 → 查看整月 */
#cal-title {
  cursor: pointer;
  border-radius: 6px;
  padding: 1px 4px;
  margin: -1px -4px;
  transition: background 0.15s ease, color 0.15s ease;
}
#cal-title:hover { background: var(--surface-2); color: var(--brand); }
.tl-months { display: flex; flex-wrap: wrap; gap: 5px; padding: 2px 4px 10px 10px; }
.tl-month {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.tl-month:hover { border-color: var(--brand); color: var(--text); }
.tl-month b { color: var(--brand); font-weight: 600; margin-left: 3px; }

/* 日期条 */
.datebar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 14px;
}
.date-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-pill);
  padding: 9px 20px;
  min-width: 168px;
  text-align: center;
  font-weight: 600;
  font-size: 14.5px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.16s ease;
  user-select: none;
}
.date-pill:hover { border-color: var(--brand); }
.date-pill input[type='date'] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer; width: 100%; height: 100%;
  border: none; padding: 0;
}

/* 编辑器卡片 */
.composer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px 10px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.composer:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.composer input[type='text'] {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  min-height: 42px;
  font-size: 15px;
  padding: 0;
}
.composer input[type='text']::placeholder { color: var(--text-faint); }
.composer-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.composer-spacer { flex: 1; }
.composer-date {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.16s ease, color 0.16s ease;
}
.composer-date:hover { border-color: var(--brand); color: var(--text); }
.composer-date input[type='date'] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer; width: 100%; height: 100%;
  border: none; padding: 0;
}
.add-hint {
  color: var(--danger);
  font-size: 12.5px;
  margin: 0;
  min-width: 0;
  flex: 1;
  text-align: right;
}
.composer.shake { animation: shake 0.34s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* 卡片流 */
.feed-wrap { flex: 1; }
.feed { display: flex; flex-direction: column; gap: 10px; }

.search-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 26%, transparent);
  border-radius: var(--radius-sm);
  padding: 8px 8px 8px 13px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 12px;
}
.search-banner span { min-width: 0; word-break: break-all; }

.feed-date-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 14px 2px 2px;
  font-size: 13px;
  font-weight: 700;
}
.feed-date-head:first-child { margin-top: 2px; }
.feed-date-head small { color: var(--text-faint); font-weight: 500; }
.feed-date-head .feed-date-count { margin-left: auto; font-size: 12px; color: var(--text-faint); font-weight: 500; }

/* memo 卡片 */
.memo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px 11px;
  box-shadow: var(--shadow-sm);
  animation: item-in 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: border-color 0.16s ease, opacity 0.2s ease, transform 0.2s ease;
}
@keyframes item-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.memo:hover { border-color: var(--brand); }
.memo.removing { opacity: 0; transform: translateX(20px); }

.memo-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.memo-meta .memo-time { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.memo-acts {
  display: flex;
  gap: 2px;
  margin-left: auto;
  opacity: 0.45;
  transition: opacity 0.15s ease;
}
.memo:hover .memo-acts, .memo:focus-within .memo-acts { opacity: 1; }
.memo-acts button {
  width: 26px; height: 26px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  display: grid; place-items: center;
  padding: 0;
  transition: all 0.15s ease;
}
.memo-acts button svg { width: 13px; height: 13px; }
.memo-acts button:hover { background: var(--surface-2); color: var(--text); }
.memo-acts .memo-del:hover { background: rgba(220, 74, 74, 0.12); color: var(--danger); }

.memo-body {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 5px;
}

.check {
  flex: none;
  width: 22px; height: 22px;
  margin-top: 1px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: grid; place-items: center;
  transition: all 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
  padding: 0;
}
.check:hover { border-color: var(--brand); }
.check svg { width: 12px; height: 12px; opacity: 0; transform: scale(0.4); transition: all 0.18s ease; color: #fff; }
.memo.done .check {
  background: linear-gradient(160deg, var(--brand), var(--brand-strong));
  border-color: transparent;
}
.memo.done .check svg { opacity: 1; transform: scale(1); }

.memo-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  padding-top: 1px;
  transition: color 0.2s ease;
  outline: none;
  border-radius: 4px;
  line-height: 1.6;
}
.memo-text:focus { box-shadow: 0 0 0 3px var(--brand-soft); }
.memo.done .memo-text {
  color: var(--text-faint);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

/* 标题里的 #标签 */
.tag-chip {
  display: inline-block;
  border: none;
  background: var(--brand-soft);
  color: var(--brand-strong);
  border-radius: 6px;
  padding: 0 6px;
  margin: 0 1px;
  font-size: 0.92em;
  font-weight: 600;
  line-height: 1.6;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}
.tag-chip:hover { background: color-mix(in srgb, var(--brand) 22%, transparent); }
.tag-chip:active { transform: scale(0.96); }

/* 空状态 */
.empty-state { text-align: center; padding: 54px 20px; }
.empty-art { font-size: 42px; margin-bottom: 10px; opacity: 0.9; }
.empty-title { margin: 0; font-weight: 600; font-size: 15px; }
.empty-sub { margin: 5px 0 0; font-size: 13px; color: var(--text-faint); }

/* 底部统计 */
.footer {
  position: sticky;
  bottom: 0;
  margin-top: 14px;
  padding: 10px 2px calc(10px + var(--safe-bottom));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(170%) blur(14px);
  -webkit-backdrop-filter: saturate(170%) blur(14px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 20;
}
.footer-stat { display: flex; align-items: baseline; gap: 5px; font-size: 13.5px; color: var(--text-muted); }
.footer-stat #remaining-count { font-size: 19px; font-weight: 700; color: var(--brand); }
.footer-actions { display: flex; gap: 8px; }
@media (max-width: 400px) {
  .footer-actions .btn { padding: 7px 9px; font-size: 12.5px; }
}

/* ---------------------------------- 抽屉 ---------------------------------- */
.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(14, 15, 25, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 40;
  display: flex;
  justify-content: flex-end;
  animation: fade-in 0.22s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.drawer {
  width: min(440px, 100%);
  height: 100%;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slide-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes slide-in { from { transform: translateX(24px); opacity: 0.4; } to { transform: none; opacity: 1; } }

.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--bg);
  z-index: 2;
}
.drawer-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.drawer-body { overflow-y: auto; padding: 14px 16px calc(28px + var(--safe-bottom)); -webkit-overflow-scrolling: touch; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 15px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.card-label {
  margin: 0 0 4px;
  font-size: 12px; font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.card-desc { margin: 0 0 14px; font-size: 13px; color: var(--text-muted); line-height: 1.65; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account-name { margin: 2px 0 0; font-weight: 600; font-size: 15px; }

.collapse summary {
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  list-style: none;
  padding: 4px 0;
}
.collapse summary::-webkit-details-marker { display: none; }
.collapse summary::before { content: '▸ '; display: inline-block; transition: transform 0.18s ease; }
.collapse[open] summary::before { content: '▾ '; }
.collapse-body { padding-top: 12px; }

.switch-row { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 14px; }
.switch {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  font-size: 13.5px;
  user-select: none;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: relative;
  flex: none;
  width: 44px; height: 26px;
  background: var(--border);
  border-radius: var(--radius-pill);
  transition: background 0.2s ease;
}
.switch .slider::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::after { transform: translateX(18px); }
.switch-text { color: var(--text-muted); }
.switch.compact { margin-top: 2px; }
.switch.compact .switch-text { font-size: 12.5px; line-height: 1.5; }

.provider-panel {
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 13px 4px;
  margin-bottom: 14px;
  animation: fade-up 0.24s ease;
}

.btn-row { display: flex; gap: 8px; margin-bottom: 8px; }
.btn-row .btn { flex: 1; }

.status-line {
  font-size: 12.5px;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  margin: 8px 0 0;
  word-break: break-word;
}
.status-line.ok { background: rgba(47, 162, 106, 0.12); color: var(--success); }
.status-line.err { background: rgba(220, 74, 74, 0.12); color: var(--danger); }
.status-line.busy { background: var(--surface-2); color: var(--text-muted); }

.about-card .card-desc { margin-bottom: 6px; }

/* ---------------------------------- Toast ---------------------------------- */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 70;
  pointer-events: none;
  width: min(92vw, 460px);
}
.toast {
  background: #1f2130;
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-width: 100%;
  text-align: center;
}
.toast.err { background: #b3383a; }
.toast.ok { background: #1f7a53; }
/* 长文案（如后端返回的排查指引）用卡片样式，胶囊形会撑得很怪 */
.toast.long {
  border-radius: 14px;
  padding: 12px 16px;
  text-align: left;
  line-height: 1.65;
  word-break: break-word;
}
.toast.leaving { animation: toast-out 0.22s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px) scale(0.97); } }

/* ---------------------------------- 桌面端布局 ---------------------------------- */
@media (min-width: 980px) {
  .shell {
    display: grid;
    grid-template-columns: 268px minmax(0, 1fr);
    max-width: 1180px;
    margin: 0 auto;
    align-items: start;
  }
  .sidebar {
    position: sticky;
    top: 0;
    height: 100dvh;
    width: auto;
    transform: none;
    visibility: visible;
    background: transparent;
    border-right: 1px solid var(--border);
    box-shadow: none;
    padding: 22px 16px 20px;
  }
  .side-mask { display: none !important; }
  .side-toggle { display: none; }
  .content { padding: 0 28px calc(18px + var(--safe-bottom)); }
  .topbar { padding-top: 30px; }
  .topbar-title { font-size: 28px; }
}

@media (max-width: 979px) {
  .main-view { max-width: 700px; margin: 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
