/* =========================================================
   XIAOMAI · 样式表
   分层：令牌 → Reset → 骨架 → 组件 → 三态 → 浮层 → 登录 → 响应式
   ========================================================= */

/* =========================================================
   1. 设计令牌
   ========================================================= */

:root {
  /* 主色 */
  --primary: #006ee6;
  --primary-hover: #005bbf;
  --primary-soft: #e8f2fd;
  --primary-ring: rgba(0, 110, 230, 0.18);
  --primary-fg: #ffffff;

  /* 语义色 */
  --ok: #0f7b4f;
  --ok-soft: #e6f5ee;
  --warn: #a35b09;
  --warn-soft: #fdf3e4;
  --err: #c0392b;
  --err-soft: #fdeceb;
  --info: #006ee6;
  --info-soft: #e8f2fd;

  /* 中性 */
  --bg: #f1f3f9;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --surface-3: #eef1f8;
  --line: #e4e8f2;
  --line-strong: #d3dae8;

  --text: #101828;
  --text-soft: #475467;
  --text-muted: #667085;
  --text-faint: #98a2b3;

  /* 圆角 */
  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  /* 阴影 */
  --sh-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
  --sh-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --sh-md: 0 4px 14px -4px rgba(16, 24, 40, 0.12), 0 2px 4px -2px rgba(16, 24, 40, 0.06);
  --sh-lg: 0 20px 48px -20px rgba(16, 24, 40, 0.28);

  /* 尺寸 */
  --sidebar-w: 232px;
  --gutter: 28px;

  --font: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}

[data-theme="dark"] {
  --primary: #4d9aff;
  --primary-hover: #75b0ff;
  --primary-soft: #16283f;
  --primary-ring: rgba(77, 154, 255, 0.24);
  --primary-fg: #06121f;

  --ok: #4ec98b;
  --ok-soft: #122b1e;
  --warn: #e0a458;
  --warn-soft: #2e2314;
  --err: #f0736a;
  --err-soft: #2e1715;
  --info: #4d9aff;
  --info-soft: #16283f;

  --bg: #0f131a;
  --surface: #171c25;
  --surface-2: #1d232e;
  --surface-3: #232a36;
  --line: #262e3b;
  --line-strong: #333d4d;

  --text: #eef2f8;
  --text-soft: #c2cbd8;
  --text-muted: #98a2b3;
  --text-faint: #6d7887;

  --sh-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --sh-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --sh-md: 0 4px 14px -4px rgba(0, 0, 0, 0.55);
  --sh-lg: 0 20px 48px -20px rgba(0, 0, 0, 0.75);
}

/* =========================================================
   2. Reset
   ========================================================= */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
dl, dd, dt { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7;
      stroke-linecap: round; stroke-linejoin: round; }

::selection { background: var(--primary-soft); color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
  border: 3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* =========================================================
   3. 骨架
   ========================================================= */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* --- 侧边栏 --- */

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 12px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 8px 18px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  background: linear-gradient(145deg, #3d8ff5, var(--primary));
  color: #fff;
  box-shadow: 0 6px 14px -8px var(--primary);
}
.brand-mark svg { width: 24px; height: 24px; stroke: none; }
.brand-mark.lg { width: 50px; height: 50px; border-radius: 15px; }
.brand-mark.lg svg { width: 32px; height: 32px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.28; }
.brand-text strong { font-size: 16.5px; letter-spacing: 0.01em; }
.brand-text span { font-size: 11px; color: var(--text-faint); }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }

.nav-group {
  margin: 16px 10px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.nav-group:first-child { margin-top: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item svg { width: 18px; height: 18px; color: var(--text-faint); flex: none; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item.active svg { color: var(--primary); }

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 12px 8px 2px;
  border-top: 1px solid var(--line);
}
.user-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.32; }
.user-meta strong {
  font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-meta span { font-size: 11.5px; color: var(--text-faint); }

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  font-size: 13.5px;
}
.avatar.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 11.5px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }

/* --- 顶栏 --- */

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px var(--gutter) 10px;
}

.crumb {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-muted);
  box-shadow: var(--sh-xs);
}
.crumb-icon { width: 15px; height: 15px; }
.crumb i { font-style: normal; color: var(--text-faint); }
.crumb strong { color: var(--text); font-weight: 600; }

.topbar-actions { display: flex; align-items: center; gap: 9px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--sh-xs);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.pill:hover { border-color: var(--line-strong); color: var(--text); }
.pill svg { width: 15px; height: 15px; }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 13px 5px 6px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--sh-xs);
}

/* --- 内容区 --- */

.content {
  padding: 6px var(--gutter) 56px;
  outline: none;
}

/* =========================================================
   4. 基础组件
   ========================================================= */

/* --- 页头 --- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin: 10px 0 20px;
}
.page-head h1 { font-size: 25px; letter-spacing: -0.02em; }
.page-sub { margin-top: 4px; font-size: 13.5px; color: var(--text-muted); }
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    transform 0.1s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn.primary { background: var(--primary); color: var(--primary-fg); }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn.ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text-soft);
  box-shadow: var(--sh-xs);
}
.btn.ghost:hover:not(:disabled) { border-color: var(--line-strong); color: var(--text); }

.btn.soft { background: var(--primary-soft); color: var(--primary); }
.btn.soft:hover:not(:disabled) { filter: brightness(0.97); }

.btn.danger { background: var(--err); color: #fff; }
.btn.danger:hover:not(:disabled) { filter: brightness(1.06); }

.btn.ghost-danger {
  background: transparent;
  border-color: var(--line);
  color: var(--err);
}
.btn.ghost-danger:hover:not(:disabled) { background: var(--err-soft); border-color: transparent; }

.btn.block { width: 100%; }
.btn.sm { padding: 7px 13px; font-size: 12.5px; }
.btn.xs { padding: 5px 10px; font-size: 12px; border-radius: var(--r-xs); }

.link-btn {
  border: none;
  background: none;
  padding: 0;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
}
.link-btn:hover { text-decoration: underline; }

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

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
}
.card-head h2 { font-size: 15px; font-weight: 600; }
.card-head .hint { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.card-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.card-body { padding: 0 18px 18px; }

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

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  padding: 15px 17px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-xs);
}
.stat-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.stat-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); flex: none; }
.stat-dot.green { background: var(--ok); }
.stat-dot.red { background: var(--err); }
.stat-dot.amber { background: var(--warn); }
.stat-value {
  margin: 6px 0 2px;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.stat-foot { font-size: 12px; color: var(--text-faint); }

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

.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data thead th {
  padding: 9px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text-soft);
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data .col-right { text-align: right; }

.cell-main { color: var(--text); font-weight: 500; font-size: 13.5px; }
.cell-sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.cell-actions { display: flex; gap: 12px; justify-content: flex-end; align-items: center; }

/* --- 徽标 --- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.6;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.plain { background: var(--surface-3); color: var(--text-muted); }

/* --- 键值列表 --- */

.kv-list { display: flex; flex-direction: column; }
.kv-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.kv-row:last-child { border-bottom: none; }
.kv-row dt { color: var(--text-muted); flex: none; }
.kv-row dd {
  margin: 0;
  color: var(--text);
  text-align: right;
  word-break: break-all;
}
.kv-row dd.mono { font-family: var(--mono); font-size: 12px; }

/* --- 工具栏 --- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 11px 13px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-xs);
}
.toolbar-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 9px; }

/* --- 标签页 --- */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  overflow-x: auto;
}
.tabs button {
  padding: 9px 15px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

/* --- 分段控件 --- */

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: var(--sh-xs);
}
.segmented button {
  padding: 7px 18px;
  border: none;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* --- 表单 --- */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-soft);
}
.field > span .req { color: var(--err); font-style: normal; margin-left: 2px; }
.field .hint { font-size: 11.5px; color: var(--text-faint); line-height: 1.6; }

input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
input:disabled, select:disabled {
  background: var(--surface-2);
  color: var(--text-faint);
  cursor: not-allowed;
}
textarea {
  min-height: 80px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) calc(50% + 1px), calc(100% - 12px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row > .field { margin-bottom: 0; }

.form-error { min-height: 17px; margin: 0 0 8px; font-size: 12.5px; color: var(--err); }

/* 选择按钮组 */
.choice-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice-group button {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  transition: all 0.15s ease;
}
.choice-group button:hover { border-color: var(--line-strong); }
.choice-group button.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.choice-group.days { grid-template-columns: repeat(4, 1fr); }
.choice-group.days button { text-align: center; padding: 9px 4px; font-size: 12.5px; }

/* 开关 */
.switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex: none;
  border: none;
  border-radius: var(--r-pill);
  background: var(--line-strong);
  transition: background 0.18s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.28);
  transition: transform 0.18s ease;
}
.switch.on { background: #12b76a; }
.switch.on::after { transform: translateX(18px); }

/* --- 记录页 --- */

.filter-label { font-size: 13px; color: var(--text-muted); flex: none; }
/* 工具栏内的下拉框不占满整行 */
.toolbar select { width: auto; min-width: 130px; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 18px 0 4px;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* --- 详情页通用 --- */

.detail-group + .detail-group { margin-top: 16px; }

.place-list { display: flex; flex-direction: column; gap: 8px; }
.place-item {
  padding: 11px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.place-name { font-size: 13px; font-weight: 600; color: var(--text); }
.place-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-muted);
}

/* --- 额度页 --- */

.narrow-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  max-width: 860px;
}
.card-note { font-size: 12px; color: var(--text-faint); line-height: 1.65; }

.rule-list { display: flex; flex-direction: column; gap: 13px; }
.rule-title { font-size: 13px; font-weight: 600; color: var(--text); }
.rule-text { margin-top: 2px; font-size: 12.5px; color: var(--text-muted); line-height: 1.65; }

/* --- 设置页 --- */

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  max-width: 980px;
}
.settings-col { display: flex; flex-direction: column; gap: 16px; }

.code-block {
  margin: 0;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.85;
  color: var(--text-muted);
  overflow-x: auto;
  white-space: pre;
}
.inline-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* --- 任务页 --- */

.tab-switch { margin-bottom: 18px; }

.task-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.filter-panel { position: sticky; top: 16px; }
.task-panel { min-width: 0; }

.task-count {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}
.task-count h2 { font-size: 15.5px; }
.task-count span { font-size: 12.5px; color: var(--text-muted); }

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

.task-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 15px 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.task-card:hover { border-color: var(--line-strong); box-shadow: var(--sh-sm); }
.task-main { flex: 1; min-width: 0; }
.task-title { font-size: 14px; font-weight: 600; color: var(--text); }
.task-time {
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-muted);
}
.task-tags { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* --- 计划页 --- */

.plan-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
}
.plan-hero-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
}
.plan-hero-text { flex: 1; min-width: 0; }
.plan-hero-text h2 { font-size: 17px; margin-bottom: 4px; }
.plan-hero-text p { font-size: 13px; color: var(--text-muted); }

.plan-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.plan-stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-xs);
}
.plan-stat strong { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; }
.plan-stat span { font-size: 12.5px; color: var(--text-muted); }

.plan-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.side-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.side-title h3 { font-size: 13.5px; font-weight: 600; }

.plan-list { display: flex; flex-direction: column; gap: 12px; }
.plan-card {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.plan-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.plan-top h4 { font-size: 14.5px; font-weight: 600; }
.plan-account { margin-top: 2px; font-size: 12.5px; color: var(--text-faint); }
.plan-mode {
  margin: 11px 0 4px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.plan-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}
.meta-row { display: flex; justify-content: space-between; gap: 14px; font-size: 12.5px; }
.meta-row span { color: var(--text-muted); flex: none; }
.meta-row b { color: var(--text-soft); font-weight: 500; text-align: right; }
.plan-acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }

.mini-list { display: flex; flex-direction: column; gap: 8px; }
.mini-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.mini-row strong { display: block; font-size: 13px; font-weight: 600; }
.mini-row span { font-size: 11.5px; color: var(--text-faint); }

.disclosure {
  margin-top: 12px;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 12.5px;
  color: var(--text-muted);
}
.disclosure summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-soft);
}
.disclosure ol { margin: 10px 0 0; padding-left: 19px; line-height: 1.9; }

/* --- 账号列表 --- */

.search-box { position: relative; flex: 1; min-width: 160px; }
.search-box svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  pointer-events: none;
}
.search-box input { padding-left: 36px; }

.account-list { display: flex; flex-direction: column; gap: 10px; }
.account-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.account-row:hover { border-color: var(--line-strong); box-shadow: var(--sh-sm); }
.account-row .avatar { width: 40px; height: 40px; border-radius: 12px; font-size: 15px; }
.account-info { flex: 1; min-width: 0; }
.account-name { font-size: 14px; font-weight: 600; color: var(--text); }
.account-school { margin-top: 2px; font-size: 12.5px; color: var(--text-faint); }
.account-tags { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.account-acts { display: flex; gap: 8px; flex: none; }

/* 登录态探测结果 */
.account-probe {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  font-size: 11.5px;
  color: var(--text-faint);
  flex-wrap: wrap;
}
.account-probe svg { width: 12px; height: 12px; flex: none; opacity: .75; }
.account-probe .probe-note {
  padding-left: 6px;
  border-left: 1px solid var(--line);
  color: var(--text-muted);
}

/* --- 账号详情分组 --- */

.detail-groups { display: flex; flex-direction: column; gap: 18px; }
.detail-group h4 {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* --- 表单分区 --- */

.form-section { margin-bottom: 22px; }
.form-section:last-of-type { margin-bottom: 6px; }
.form-section > h3,
.section-head h3 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.section-head h3 { margin: 0; }
.section-head .btn { flex: none; }
.section-hint { margin-top: 8px; font-size: 11.5px; color: var(--text-faint); line-height: 1.6; }

.box-empty {
  padding: 22px 16px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-faint);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-sm);
}

/* --- 扫码弹窗 --- */

.qr-img {
  display: block;
  width: 190px;
  height: 190px;
  margin: 0 auto 14px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.scan-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
}
.scan-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex: none;
  animation: scanPulse 1.4s ease-in-out infinite;
}
.scan-dot.ok { background: var(--ok); animation: none; }
.scan-dot.err { background: var(--err); animation: none; }
@keyframes scanPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}
.scan-note { margin-top: 10px; text-align: center; font-size: 11.5px; color: var(--text-faint); }

.captcha-img {
  display: block;
  max-width: 190px;
  margin: 0 auto 14px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
}

/* --- 工作台布局 --- */

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}
.dash-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dash-side { display: flex; flex-direction: column; gap: 16px; }

.quota-line { display: flex; align-items: baseline; gap: 6px; }
.quota-line strong { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }
.quota-line span { font-size: 12.5px; color: var(--text-faint); }

.mini-stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-stat { text-align: center; }
.mini-stat strong { display: block; font-size: 19px; font-weight: 600; line-height: 1.3; }
.mini-stat span { font-size: 11.5px; color: var(--text-faint); }

/* --- 提示列表 --- */

.tip-list { display: flex; flex-direction: column; gap: 14px; }
.tip-item { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.tip-item:last-child { padding-bottom: 0; border-bottom: none; }
.tip-head { margin-bottom: 5px; }
.tip-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.tip-text { margin-top: 3px; font-size: 12.5px; color: var(--text-muted); line-height: 1.65; }

.notice {
  padding: 11px 14px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  line-height: 1.7;
}
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.info { background: var(--info-soft); color: var(--info); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.err { background: var(--err-soft); color: var(--err); }

/* --- 配置向导 --- */

.wiz-steps {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 2px 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.wiz-step { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.wiz-step:last-child { flex: 0 1 auto; }
.wiz-no {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex: none;
  background: var(--surface-3);
  color: var(--text-faint);
  border: 1px solid var(--line);
}
.wiz-step.active .wiz-no {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-ring);
}
.wiz-step.done .wiz-no {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: transparent;
}
.wiz-no svg { width: 13px; height: 13px; }
.wiz-label {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wiz-step.active .wiz-label { color: var(--text); font-weight: 600; }
.wiz-line { flex: 1; height: 1px; background: var(--line); margin: 0 2px; }
.wiz-body { max-height: min(58vh, 520px); overflow-y: auto; padding-right: 2px; }
.modal-foot-inline {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  width: 100%;
}

/* --- 今日查寝（工作台） --- */

.today-list { display: flex; flex-direction: column; }
.today-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line);
}
.today-row:last-child { border-bottom: none; }
.today-main { flex: 1; min-width: 0; }
.today-act { flex: none; display: flex; }

/* --- 执行趋势图 --- */

.log-trend-grid { margin-bottom: 14px; }
.trend {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 6px;
  align-items: end;
  padding: 6px 2px 2px;
}
.trend-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.trend-bars {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 82px;
  width: 100%;
  max-width: 26px;
  border-radius: 5px;
  overflow: hidden;
}
.trend-seg { display: block; width: 100%; }
.trend-seg.ok { background: color-mix(in srgb, var(--ok) 68%, white); }
.trend-seg.warn { background: color-mix(in srgb, var(--warn) 58%, white); }
.trend-seg.err { background: color-mix(in srgb, var(--err) 62%, white); }
.trend-seg.zero { height: 2px; background: var(--line-strong); border-radius: 2px; }
.trend-date { font-size: 10.5px; color: var(--text-faint); }

.trend-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.trend-legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.err { background: var(--err); }

/* --- 执行日历 --- */

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.cal-wd {
  text-align: center;
  font-size: 10.5px;
  color: var(--text-faint);
  padding: 2px 0 4px;
}
.cal-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  font-size: 12px;
  color: var(--text-soft);
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid transparent;
  cursor: default;
}
.cal-cell.blank { background: transparent; }
.cal-cell.ok { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.cal-cell.warn { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.cal-cell.err { background: var(--err-soft); color: var(--err); font-weight: 600; }
.cal-cell.today {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-ring);
}

/* =========================================================
   5. 三态
   ========================================================= */

.state-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 52px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  color: var(--text-faint);
  font-size: 13.5px;
}
.state-box strong { color: var(--text); font-size: 14.5px; font-weight: 600; }
.state-box p { color: var(--text-muted); max-width: 420px; }
.state-box.err .state-icon { background: var(--err-soft); color: var(--err); }

.state-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 4px;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text-faint);
}
.state-icon svg { width: 22px; height: 22px; stroke-width: 1.5; }
.state-action { margin-top: 12px; }

.spinner {
  width: 30px;
  height: 30px;
  margin-bottom: 6px;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  border-radius: var(--r-xs);
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  height: 13px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.loading-block { display: flex; flex-direction: column; gap: 11px; padding: 24px 20px; }

/* =========================================================
   6. 浮层
   ========================================================= */

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 22px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  backdrop-filter: blur(3px);
}
[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, 0.68); }

.modal-card {
  position: relative;
  width: min(500px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  animation: pop 0.18s cubic-bezier(0.2, 0.9, 0.4, 1.04);
}
.modal-card.wide { width: min(700px, 100%); }
@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px 12px;
}
.modal-head h2 { font-size: 16.5px; }
.modal-sub { margin-top: 3px; font-size: 12.5px; color: var(--text-muted); }
.modal-body { padding: 2px 20px 6px; overflow-y: auto; }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 12px 20px 18px;
  flex-wrap: wrap;
}
.modal-foot:empty { display: none; }

.confirm-text { font-size: 13.5px; color: var(--text-soft); line-height: 1.7; }

/* --- Toast --- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 16px);
  z-index: 120;
  max-width: min(420px, calc(100vw - 40px));
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: rgba(16, 24, 40, 0.94);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--sh-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: #0d7a4d; }
.toast.err { background: #b42318; }
.toast.info { background: #175cd3; }

/* =========================================================
   7. 登录屏
   ========================================================= */

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 460px at 50% -12%, var(--primary-soft), transparent 62%),
    var(--bg);
}

.auth-theme {
  position: fixed;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  box-shadow: var(--sh-xs);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.auth-theme:hover { color: var(--text); border-color: var(--line-strong); }
.auth-theme svg { width: 17px; height: 17px; }

.auth-card {
  width: min(410px, 100%);
  padding: 32px 28px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--sh-lg);
}

.auth-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 24px; }
.auth-brand h1 { font-size: 21px; letter-spacing: 0.01em; }
.auth-brand p { margin-top: 2px; font-size: 12.5px; color: var(--text-muted); }

.auth-tabs {
  display: flex;
  gap: 3px;
  padding: 4px;
  margin-bottom: 20px;
  background: var(--surface-2);
  border-radius: var(--r-pill);
}
.auth-tabs button {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
}
.auth-tabs button.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--sh-xs);
}

.auth-note {
  margin-top: 16px;
  font-size: 11.5px;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.7;
}

/* =========================================================
   8. 移动端底部导航
   ========================================================= */

.bottom-nav { display: none; }

/* =========================================================
   9. 响应式
   ========================================================= */

@media (max-width: 1180px) {
  :root { --gutter: 22px; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .task-layout { grid-template-columns: 260px minmax(0, 1fr); }
}

@media (max-width: 1040px) {
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 940px) {
  .task-layout { grid-template-columns: minmax(0, 1fr); }
  .filter-panel { position: static; }
  .plan-grid { grid-template-columns: minmax(0, 1fr); }
  .narrow-grid { grid-template-columns: minmax(0, 1fr); }
}

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

  .topbar { padding: 14px 18px 8px; }
  .content { padding: 4px 18px 96px; }
  .page-head h1 { font-size: 22px; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

  .bottom-nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    padding: 7px 5px;
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: blur(16px);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--sh-md);
  }
  .bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 2px;
    border-radius: 13px;
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
  }
  .bottom-nav a svg { width: 19px; height: 19px; }
  .bottom-nav a.active { color: var(--primary); background: var(--primary-soft); }
  .toast { bottom: 90px; }
}

@media (max-width: 720px) {
  .content { padding: 2px 14px 96px; }
  .topbar { padding: 12px 14px 6px; }
  .crumb { display: none; }
  .topbar-actions { margin-left: auto; }
  .user-chip span:not(.avatar) { display: none; }
  .user-chip { padding: 5px 7px; }

  .page-head { margin: 8px 0 16px; gap: 14px; }
  .page-head h1 { font-size: 21px; }
  .page-sub { font-size: 13px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }

  .stat { padding: 13px 14px; }
  .stat-value { font-size: 25px; }

  .card-head { padding: 14px 15px 10px; }
  .card-body { padding: 0 15px 15px; }

  .toolbar { padding: 10px 12px; }
  .toolbar-left, .toolbar-right { width: 100%; }
  .toolbar-right .btn { flex: 1; }

  .field-row { grid-template-columns: 1fr; gap: 0; }
  .field-row > .field { margin-bottom: 14px; }

  .kv-row { grid-template-columns: 78px minmax(0, 1fr); gap: 10px; font-size: 12.5px; }

  .task-card { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px; }
  .task-card .btn { width: 100%; }
  .plan-hero { flex-direction: column; align-items: stretch; padding: 18px; }
  .plan-hero .btn { width: 100%; }
  .plan-stats { gap: 8px; }
  .plan-stat { flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; }
  .account-row { flex-wrap: wrap; gap: 12px; padding: 14px; }
  .account-acts { width: 100%; justify-content: flex-end; }
  .section-head { flex-wrap: wrap; }
  .section-head .btn { width: 100%; }

  /* 表格卡片化：按 data-label 展开 */
  table.data.stack thead { display: none; }
  table.data.stack tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 12px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--line);
    align-items: start;
  }
  table.data.stack tbody tr:last-child { border-bottom: none; }
  table.data.stack tbody td {
    display: block;
    padding: 0;
    border: none;
    font-size: 13px;
  }
  table.data.stack tbody td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    color: var(--text-faint);
    margin-bottom: 2px;
  }
  table.data.stack tbody td:first-child { grid-column: 1 / -1; }
  table.data.stack tbody td:first-child::before { display: none; }
  table.data.stack tbody td.col-right { grid-column: 1 / -1; text-align: left; }
  table.data.stack tbody td.col-right::before { display: none; }
  table.data.stack .cell-actions { justify-content: flex-start; gap: 16px; padding-top: 6px; }
  table.data.stack tbody tr:hover td { background: transparent; }
  .table-wrap { overflow: visible; }

  .modal { padding: 0; align-items: flex-end; }
  .modal-card { width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; }
  .modal-body { padding: 2px 18px 6px; }
  .modal-foot { padding: 12px 18px calc(16px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }

  .auth-card { padding: 26px 20px 20px; border-radius: 22px; }
  .auth-brand h1 { font-size: 19px; }
}

@media (max-width: 420px) {
  .stat-row { gap: 8px; }
  .stat-value { font-size: 22px; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; padding: 7px 10px; font-size: 12.5px; }
  .tabs button { padding: 8px 12px; font-size: 13px; }
  .choice-group.days { grid-template-columns: repeat(4, 1fr); }
}

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