/* 拼车管理 · 样式（无构建步骤，纯 CSS）
 * 视觉风格参考 Shiro（https://github.com/Innei/Shiro）的设计语言：悬浮胶囊导航、毛玻璃表面、
 * 极淡的描边、噪点底纹、日本传统色强调色（浅葱 / 桃）和柔和的弹簧动效。
 * 以下样式均为本项目独立编写，未复制 Shiro 的代码。
 */

/* ---------- 字体（Manrope 仅覆盖拉丁字母与数字，中文使用系统字体） ---------- */

@font-face {
  font-family: 'Manrope';
  src: url('/static/fonts/manrope-latin-wght-normal.woff2?v=1') format('woff2');
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2013-2014, U+2026, U+20AC, U+2212;
}

/* ---------- 设计变量 ---------- */

:root {
  /* 强调色：浅葱。原色只用于装饰，按钮和文字用加深版本以保证可读性 */
  --accent: #33a6b8;
  --accent-strong: #23808e;
  --accent-text: #1f7a88;
  --accent-soft: rgba(51, 166, 184, 0.12);
  --accent-ring: rgba(51, 166, 184, 0.35);
  --on-accent: #ffffff;

  --root-bg: #f9f9fa;
  --glass: rgba(255, 255, 255, 0.78);
  --glass-strong: rgba(255, 255, 255, 0.9);
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --hover: rgba(24, 24, 27, 0.04);
  --line: rgba(24, 24, 27, 0.08);
  --line-strong: rgba(24, 24, 27, 0.16);
  --ink: #18181b;
  --ink-2: #52525b;
  --muted: #71717a;

  /* 状态色：苹果系统色系，文字用加深版本 */
  --ok: #177a35;
  --ok-bg: rgba(52, 199, 89, 0.14);
  --soon: #a84d00;
  --soon-bg: rgba(255, 149, 0, 0.14);
  --today: #5a4300;
  --today-bg: #ffd60a;
  --today-text: #a84d00;
  --danger: #c41a10;
  --danger-bg: rgba(255, 59, 48, 0.12);
  --info: #0b5cc4;
  --info-bg: rgba(0, 122, 255, 0.1);

  --dot-ok: #34c759;
  --dot-soon: #ff9500;
  --dot-today: #ffcc00;
  --dot-danger: #ff3b30;

  --radius-xl: 22px;
  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 10px;
  --shadow-card: 0 1px 2px rgba(24, 24, 27, 0.04), 0 12px 32px -22px rgba(24, 24, 27, 0.2);
  --shadow-float: 0 8px 28px -12px rgba(24, 24, 27, 0.18), 0 1px 2px rgba(24, 24, 27, 0.05);
  --shadow-pop: 0 28px 70px -28px rgba(24, 24, 27, 0.35), 0 2px 10px rgba(24, 24, 27, 0.06);
  --blur: saturate(180%) blur(18px);

  /* 弹簧缓动：阻尼比约 0.73，回弹约 3.5%（由弹簧方程采样生成） */
  --spring: linear(0, 0.03, 0.105, 0.207, 0.321, 0.437, 0.548, 0.65, 0.739, 0.814, 0.877, 0.926, 0.964, 0.992, 1.012, 1.024, 1.032, 1.035, 1.035, 1.033, 1.03, 1.026, 1.022, 1.018, 1.014, 1.011, 1.008, 1.006, 1.004, 1.002, 1);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', 'Segoe UI', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --noise-opacity: 0.05;
  color-scheme: light;
  accent-color: var(--accent-strong);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* 深色模式强调色：桃 */
    --accent: #f596aa;
    --accent-strong: #f596aa;
    --accent-text: #f7a9b9;
    --accent-soft: rgba(245, 150, 170, 0.14);
    --accent-ring: rgba(245, 150, 170, 0.4);
    --on-accent: #2a1219;

    --root-bg: #1c1c1e;
    --glass: rgba(36, 36, 39, 0.72);
    --glass-strong: rgba(40, 40, 43, 0.9);
    --surface: #232326;
    --surface-2: rgba(255, 255, 255, 0.05);
    --hover: rgba(255, 255, 255, 0.05);
    --line: rgba(244, 244, 245, 0.09);
    --line-strong: rgba(244, 244, 245, 0.18);
    --ink: #f4f4f5;
    --ink-2: #c4c4cc;
    --muted: #8e8e98;

    --ok: #32d74b;
    --ok-bg: rgba(48, 209, 88, 0.16);
    --soon: #ffb340;
    --soon-bg: rgba(255, 159, 10, 0.16);
    --today: #2b2100;
    --today-bg: #ffd60a;
    --today-text: #ffd60a;
    --danger: #ff6961;
    --danger-bg: rgba(255, 69, 58, 0.18);
    --info: #64a8ff;
    --info-bg: rgba(10, 132, 255, 0.16);

    --dot-ok: #30d158;
    --dot-soon: #ff9f0a;
    --dot-today: #ffd60a;
    --dot-danger: #ff453a;

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -22px rgba(0, 0, 0, 0.6);
    --shadow-float: 0 8px 28px -12px rgba(0, 0, 0, 0.6);
    --shadow-pop: 0 28px 70px -28px rgba(0, 0, 0, 0.8);
    --noise-opacity: 0.03;
    color-scheme: dark;
  }
}

/* ---------- 基础 ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scrollbar-gutter: stable;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--root-bg);
  color: var(--ink);
  font: 14px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 噪点底纹 */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: var(--noise);
  opacity: var(--noise-opacity);
  pointer-events: none;
}

body:has(dialog[open]) {
  overflow: hidden;
}

::selection {
  background: var(--accent);
  color: #fff;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 10px;
  background: var(--line-strong);
  background-clip: content-box;
}

a {
  color: var(--accent-text);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent-ring);
  text-underline-offset: 3px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.35;
  font-weight: 600;
}

code,
.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}

code {
  padding: 1px 7px;
  border-radius: 7px;
  background: var(--surface-2);
  word-break: break-all;
}

.icon {
  flex: none;
  vertical-align: -3px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 品牌标志 ---------- */

.plate {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  box-shadow:
    0 0 0 3px var(--accent-soft),
    0 4px 12px -4px var(--accent-ring);
}

.plate-lg {
  width: 52px;
  height: 52px;
  font-size: 22px;
  box-shadow:
    0 0 0 5px var(--accent-soft),
    0 10px 24px -8px var(--accent-ring);
}

.plate-xl {
  width: 76px;
  height: 76px;
  font-size: 32px;
  box-shadow:
    0 0 0 6px var(--accent-soft),
    0 12px 28px -10px var(--accent-ring);
}

/* 自定义头像：图片铺满圆形，透明部分显示底色 */
.plate-img {
  display: inline-block;
  object-fit: cover;
  background: var(--surface);
}

@media (prefers-color-scheme: dark) {
  .plate {
    color: var(--on-accent);
  }
}

/* ---------- 顶部栏与悬浮胶囊导航 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 14px 28px 10px;
}

/* 越往下越透明的模糊背景，让滚动内容从导航下方柔和地经过 */
.topbar::before {
  content: '';
  position: absolute;
  inset: 0 0 -18px;
  z-index: -1;
  background: color-mix(in srgb, var(--root-bg) 72%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  -webkit-mask-image: linear-gradient(to bottom, #000 45%, transparent);
  mask-image: linear-gradient(to bottom, #000 45%, transparent);
  pointer-events: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.brand:hover {
  text-decoration: none;
}

.pillnav {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--glass) 80%, transparent), var(--glass-strong));
  box-shadow:
    var(--shadow-float),
    inset 0 0 0 1px var(--line);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

/* 跟随指针的柔光（位置由 app.js 写入 --sx / --sy） */
.pillnav::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(var(--sr, 140px) circle at var(--sx, 50%) var(--sy, 50%), var(--accent-soft), transparent 65%);
  opacity: 0;
  transition: opacity 0.5s;
  pointer-events: none;
}

.pillnav:hover::before {
  opacity: 1;
}

.pill-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 15px;
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s;
}

.pill-item:hover {
  color: var(--accent-text);
  text-decoration: none;
}

.pill-item.active {
  color: var(--accent-text);
}

/* 当前页：底边一条两端淡出的强调色细线 */
.pill-item.active::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.topbar-actions {
  justify-self: end;
  margin: 0;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition:
    background-color 0.2s,
    color 0.2s,
    transform 0.4s var(--spring);
}

.icon-btn:hover {
  background: var(--hover);
  color: var(--ink);
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn.round {
  border-radius: 50%;
  background: var(--glass-strong);
  box-shadow:
    var(--shadow-float),
    inset 0 0 0 1px var(--line);
}

.tabbar {
  display: none;
}

/* ---------- 页面 ---------- */

.main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 28px 72px;
  animation: page-in 0.6s var(--spring) backwards;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.page-head,
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin: 22px 0 22px;
}

.page-title h1 {
  font-size: 26px;
  letter-spacing: 0.01em;
}

.page-sub {
  margin: 4px 0 0;
  color: var(--muted);
}

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

.breadcrumb {
  margin: -12px 0 16px;
  font-size: 13px;
}

.breadcrumb a {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--muted);
}

/* ---------- 首页标题与统计 ---------- */

.hero {
  margin-top: 30px;
  margin-bottom: 26px;
}

.hero-date {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

.hero-title {
  margin-top: 6px;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.hl {
  color: var(--accent-text);
  font-style: normal;
  font-weight: 700;
}

.hero-note {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 10px 0 0;
  color: var(--ink-2);
  font-size: 13.5px;
}

.hero-note .icon {
  color: var(--accent);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px 15px;
  border-radius: var(--radius-lg);
  background: var(--glass);
  box-shadow:
    var(--shadow-card),
    inset 0 0 0 1px var(--line);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  color: var(--ink);
  transition:
    transform 0.6s var(--spring),
    box-shadow 0.3s;
}

.stat:hover {
  transform: translateY(-3px);
  box-shadow:
    var(--shadow-float),
    inset 0 0 0 1px var(--accent-ring);
  text-decoration: none;
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
}

.stat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}

.stat-danger .stat-dot {
  background: var(--dot-danger);
}

.stat-today .stat-dot {
  background: var(--dot-today);
}

.stat-soon .stat-dot {
  background: var(--dot-soon);
}

.stat-ok .stat-dot {
  background: var(--dot-ok);
}

.stat-num {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.stat-zero .stat-num {
  color: var(--muted);
  font-weight: 500;
}

.stat-sub {
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--glass-strong);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 0.2s,
    box-shadow 0.2s,
    color 0.2s,
    transform 0.45s var(--spring);
}

.btn:hover {
  background: var(--surface);
  box-shadow:
    inset 0 0 0 1px var(--accent-ring),
    0 4px 14px -8px var(--accent-ring);
  text-decoration: none;
}

.btn:active {
  transform: scale(0.96);
}

.btn:disabled,
.btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--accent-strong);
  box-shadow: 0 6px 18px -8px var(--accent-ring);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent-strong);
  box-shadow: 0 10px 24px -10px var(--accent);
  filter: brightness(1.06);
}

.btn-accent {
  background: var(--accent-soft);
  box-shadow: none;
  color: var(--accent-text);
}

.btn-accent:hover {
  background: var(--accent-strong);
  box-shadow: 0 6px 18px -10px var(--accent);
  color: var(--on-accent);
}

.btn-ghost {
  background: transparent;
  box-shadow: none;
  color: var(--ink-2);
}

.btn-ghost:hover {
  background: var(--hover);
  box-shadow: none;
  color: var(--ink);
}

.btn-danger {
  background: #e5342a;
  box-shadow: 0 6px 18px -10px rgba(229, 52, 42, 0.7);
  color: #fff;
}

.btn-danger:hover {
  background: #e5342a;
  box-shadow: 0 10px 24px -12px rgba(229, 52, 42, 0.9);
  filter: brightness(1.05);
}

.btn-danger-soft {
  background: var(--danger-bg);
  box-shadow: none;
  color: var(--danger);
}

.btn.danger,
.danger-text {
  color: var(--danger);
}

.btn-sm {
  min-height: 30px;
  padding: 4px 12px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.link {
  color: var(--accent-text);
  font-weight: 500;
  white-space: nowrap;
}

.inline-form {
  display: inline;
  margin: 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

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

.card {
  margin-bottom: 20px;
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  background: var(--glass);
  box-shadow:
    var(--shadow-card),
    inset 0 0 0 1px var(--line);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

/* 锚点跳转时不被顶部导航挡住 */
.card[id] {
  scroll-margin-top: 88px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 14px;
}

.card-head h2 {
  font-size: 16px;
}

.card-head h3 {
  font-size: 14px;
}

.card-head-sub {
  align-items: center;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.card-sub {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* 汇总栏（收款页） */
.strip {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 20px;
  border-radius: var(--radius-lg);
  background: var(--glass);
  box-shadow:
    var(--shadow-card),
    inset 0 0 0 1px var(--line);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
}

.strip-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 15px 24px;
}

.strip-item + .strip-item {
  border-left: 1px solid var(--line);
}

.strip-label {
  color: var(--muted);
  font-size: 12.5px;
}

.strip-value {
  font-size: 21px;
  font-weight: 600;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.strip-main .strip-value {
  color: var(--accent-text);
  font-size: 27px;
  font-weight: 700;
}

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

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  padding: 11px 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
}

.alert .icon {
  margin-top: 3px;
}

.alert > span {
  flex: 1;
}

.alert a {
  margin-left: 4px;
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.alert-warn {
  background: var(--soon-bg);
  color: var(--soon);
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
}

.alert-info {
  background: var(--info-bg);
  color: var(--info);
}

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

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

.table-wrap {
  margin: 0 -22px;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.table th {
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.table td {
  position: relative;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table th:first-child,
.table td:first-child {
  padding-left: 24px;
}

.table th:last-child,
.table td:last-child {
  padding-right: 22px;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr {
  transition: background-color 0.2s;
}

.table tbody tr:hover {
  background: var(--hover);
}

.table .num {
  text-align: right;
}

.table .actions-col,
.table td.actions {
  text-align: right;
  white-space: nowrap;
}

.row-actions {
  display: inline-flex;
  justify-content: flex-end;
  gap: 6px;
}

/* 行首的状态短竖条 */
.row-expired td:first-child::before,
.row-today td:first-child::before,
.row-soon td:first-child::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 3px;
}

.row-expired td:first-child::before {
  background: var(--dot-danger);
}

.row-today td:first-child::before {
  background: var(--dot-today);
}

.row-soon td:first-child::before {
  background: var(--dot-soon);
}

.row-left td {
  color: var(--muted);
}

.row-left td .strong {
  color: var(--ink-2);
}

.strong {
  color: var(--ink);
  font-weight: 600;
}

a.strong:hover {
  color: var(--accent-text);
}

.sub {
  margin-top: 1px;
  color: var(--muted);
  font-size: 12.5px;
}

.sub-inline {
  color: var(--muted);
  font-size: 12.5px;
}

.muted {
  color: var(--muted);
}

.nowrap {
  white-space: nowrap;
}

.cell-note {
  max-width: 240px;
  color: var(--ink-2);
  font-size: 13px;
  word-break: break-word;
}

.cell-message {
  max-width: 380px;
}

.table-foot {
  margin: 0 -22px;
  padding: 12px 24px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.sort {
  color: inherit;
}

.date {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.weekday {
  margin-left: 6px;
  color: var(--muted);
  font-size: 12px;
}

.money {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- 状态 ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 1px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge::before {
  content: '';
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.badge-warn {
  background: var(--soon-bg);
  color: var(--soon);
}

.badge-today {
  background: var(--today-bg);
  color: var(--today);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-muted {
  box-shadow: inset 0 0 0 1px var(--line);
}

.days {
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.days-ok {
  color: var(--ok);
}

.days-warn {
  color: var(--soon);
}

.days-today {
  color: var(--today-text);
}

.days-danger {
  color: var(--danger);
}

.days-muted {
  color: var(--muted);
}

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12px;
  white-space: nowrap;
}

.tag-accent {
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* 席位：一排座位 */
.seats {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.seat-row {
  display: inline-flex;
  gap: 3px;
}

.seat {
  display: block;
  width: 9px;
  height: 11px;
  border-radius: 4px 4px 3px 3px;
}

.seat-taken {
  background: var(--accent);
}

.seat-own {
  background: var(--ink-2);
}

.seat-free {
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
}

.seat-over {
  background: var(--dot-danger);
}

.seats-text {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.seats-full {
  color: var(--soon);
}

.seats-danger {
  color: var(--danger);
}

.bar {
  display: block;
  width: 64px;
  height: 5px;
  border-radius: 5px;
  background: var(--line);
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: 5px;
  background: var(--accent);
}

.bar > i.bar-full {
  background: var(--dot-soon);
}

.bar > i.bar-danger {
  background: var(--dot-danger);
}

.w-0 { width: 0; }
.w-10 { width: 10%; }
.w-20 { width: 20%; }
.w-30 { width: 30%; }
.w-40 { width: 40%; }
.w-50 { width: 50%; }
.w-60 { width: 60%; }
.w-70 { width: 70%; }
.w-80 { width: 80%; }
.w-90 { width: 90%; }
.w-100 { width: 100%; }

/* ---------- 工具栏与筛选 ---------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.search,
.filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.search {
  flex-wrap: nowrap;
}

.filters {
  margin-bottom: 14px;
}

/* 电脑上筛选条件直接排在一行；手机上收进「筛选」按钮 */
.filter-extra {
  display: contents;
}

.filter-toggle {
  display: none;
}

.search input[type='search'],
.filter-q {
  width: 260px;
}

.filters .filter-q {
  flex: 1 1 180px;
  width: auto;
  min-width: 160px;
}

.filters select {
  width: auto;
  max-width: 220px;
}

.date-range {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.date-range input {
  width: 138px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 3px 13px;
  border-radius: 999px;
  background: var(--glass-strong);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition:
    box-shadow 0.2s,
    color 0.2s,
    background-color 0.2s;
}

.chip:hover {
  box-shadow: inset 0 0 0 1px var(--accent-ring);
  color: var(--ink);
  text-decoration: none;
}

.chip.active {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-ring);
  color: var(--accent-text);
}

.chip-count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.chip.active .chip-count {
  background: var(--accent-strong);
  color: var(--on-accent);
}

.chip-expired:not(.active) .chip-count {
  background: var(--danger-bg);
  color: var(--danger);
}

.chip-today:not(.active) .chip-count {
  background: var(--today-bg);
  color: var(--today);
}

.chip-soon:not(.active) .chip-count {
  background: var(--soon-bg);
  color: var(--soon);
}

.chip:not(.active) .chip-count.zero {
  background: var(--surface-2);
  color: var(--muted);
}

.chip-sep {
  width: 1px;
  height: 18px;
  margin: 0 4px;
  background: var(--line);
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.tab {
  position: relative;
  padding: 8px 14px 10px;
  color: var(--muted);
  font-weight: 600;
}

.tab:hover {
  color: var(--ink);
  text-decoration: none;
}

.tab.active {
  color: var(--accent-text);
}

.tab.active::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.empty {
  padding: 40px 16px;
  text-align: center;
}

.empty-title {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.empty-hint {
  margin-top: 6px;
  color: var(--muted);
}

.empty-actions {
  margin-top: 18px;
  text-align: left;
}

.empty-actions:has(> .btn) {
  text-align: center;
}

.kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 24px;
  margin: 0 0 14px;
}

.kv-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.kv dt {
  color: var(--muted);
  font-size: 12.5px;
}

.kv dd {
  margin: 0;
  word-break: break-word;
}

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

.form {
  margin: 0;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field.wide {
  grid-column: 1 / -1;
}

.field > label,
.field > legend {
  padding: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

fieldset.field {
  margin-bottom: 14px;
}

.req {
  margin-left: 3px;
  color: var(--danger);
}

/* :where() 把优先级降为 0，各处可以直接用类名覆盖宽度等样式 */
:where(input:not([type='checkbox'], [type='radio'], [type='hidden'])),
:where(select, textarea) {
  width: 100%;
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background-color: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  -webkit-appearance: none;
  appearance: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

:where(select) {
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2371717a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 13px center;
  background-repeat: no-repeat;
  background-size: 12px 8px;
  cursor: pointer;
}

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

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

input::-webkit-date-and-time-value {
  text-align: left;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--accent-ring);
}

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

@media (prefers-color-scheme: dark) {
  :where(select) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238e8e98' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}

input[type='checkbox'],
input[type='radio'] {
  accent-color: var(--accent-strong);
}

.has-error input,
.has-error select,
.has-error textarea {
  border-color: var(--dot-danger);
}

.field-error {
  color: var(--danger);
  font-size: 12.5px;
}

.field .hint {
  margin: 0;
}

.static-value {
  padding: 8px 0;
  font-weight: 600;
}

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

.pill {
  position: relative;
  cursor: pointer;
}

.pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pill span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 15px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--ink-2);
  font-weight: 500;
  white-space: nowrap;
  transition:
    background-color 0.2s,
    box-shadow 0.2s,
    color 0.2s,
    transform 0.45s var(--spring);
}

.pill:hover span {
  box-shadow: inset 0 0 0 1px var(--accent-ring);
  color: var(--ink);
}

.pill:active span {
  transform: scale(0.96);
}

.pill input:checked + span {
  background: var(--accent-strong);
  box-shadow: 0 6px 16px -8px var(--accent-ring);
  color: var(--on-accent);
}

.pill input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
}

.switch input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.summary {
  margin-bottom: 18px;
  padding: 13px 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.summary-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font-size: 15px;
}

.summary-team {
  color: var(--ink-2);
  font-size: 14px;
}

.summary-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 13px;
}

/* 头像设置 */
.avatar-form {
  display: flex;
  align-items: center;
  gap: 22px;
}

.avatar-preview {
  flex: none;
  display: grid;
  place-items: center;
  padding: 6px;
}

.avatar-side {
  flex: 1;
  min-width: 0;
}

.avatar-side .button-row {
  margin-top: 0;
}

.avatar-side .hint {
  margin-top: 10px;
}

/* 文件选择框透明地盖在按钮上，点按钮任意位置都能选择图片 */
.file-btn {
  position: relative;
  overflow: hidden;
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-btn:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 续期预览 ---------- */

.renew-preview {
  margin: 16px 0;
}

[data-preview] {
  transition: opacity 0.15s;
}

[data-preview].loading {
  opacity: 0.5;
}

.preview {
  padding: 15px 18px;
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-ring);
}

.preview-error {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--danger-bg);
  box-shadow: none;
  color: var(--danger);
}

.preview-dates {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.preview-label {
  color: var(--ink-2);
  font-size: 12px;
}

.preview-old {
  color: var(--muted);
  font-size: 19px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-decoration: line-through;
  text-decoration-color: var(--muted);
}

.preview-new {
  color: var(--accent-text);
  font-size: 27px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.preview-new small {
  margin-left: 6px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
}

.preview-arrow {
  color: var(--accent);
}

.preview-meta {
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 13px;
}

.preview-warn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: var(--soon);
  font-size: 13px;
  font-weight: 500;
}

.preview-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.preview-inline strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.preview-inline.muted {
  background: var(--surface-2);
  color: var(--muted);
}

.preview-inline-error {
  background: var(--danger-bg);
  color: var(--danger);
}

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

dialog.modal {
  width: fit-content;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-xl);
  background: var(--glass-strong);
  box-shadow:
    var(--shadow-pop),
    inset 0 0 0 1px var(--line);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  color: var(--ink);
  overflow: auto;
}

dialog.modal[open] {
  animation: modal-in 0.6s var(--spring);
}

dialog.modal::backdrop {
  background: rgba(24, 24, 27, 0.28);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: fade-in 0.25s var(--ease);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.modal-frame {
  width: min(580px, calc(100vw - 32px));
}

.modal-frame.modal-lg {
  width: min(780px, calc(100vw - 32px));
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px 10px 24px;
}

.modal-head h2 {
  font-size: 17px;
}

.modal-body {
  padding: 4px 24px 24px;
}

.modal-loading {
  padding: 48px;
  color: var(--muted);
  text-align: center;
}

.page-form {
  max-width: 640px;
}

.page-form-lg {
  max-width: 820px;
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 11px 20px 11px 16px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 88%, transparent);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  color: var(--root-bg);
  font-weight: 500;
  box-shadow: var(--shadow-pop);
  transform: translateX(-50%);
  animation:
    toast-in 0.6s var(--spring),
    toast-out 0.4s ease-in 4.6s forwards;
  cursor: pointer;
}

.toast::before {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot-ok);
}

.toast-error::before {
  background: var(--dot-danger);
}

.toast-info::before {
  background: var(--accent);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 14px) scale(0.96);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

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

.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: 136px 72px minmax(0, 1fr);
  align-items: baseline;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.timeline li:last-child {
  border-bottom: 0;
}

.timeline .tag {
  justify-self: start;
}

.timeline time {
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timeline-text {
  word-break: break-word;
}

.timeline-link {
  color: var(--ink);
}

.today-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.today-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.today-list li:last-child {
  border-bottom: 0;
}

.today-title {
  flex: 1;
  min-width: 0;
}

.today-title small {
  margin-left: 8px;
  color: var(--muted);
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.facts li {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.facts li > span {
  color: var(--muted);
  font-size: 12.5px;
}

.chat-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.chat-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 18px;
}

.pager-info {
  color: var(--muted);
  font-size: 13px;
}

details.help {
  margin-top: 14px;
  color: var(--ink-2);
}

details.help summary {
  color: var(--accent-text);
  font-weight: 500;
}

details.help ol {
  margin: 8px 0 0;
  padding-left: 20px;
}

details summary {
  cursor: pointer;
}

pre.message {
  margin: 8px 0 0;
  padding: 11px 13px;
  border-radius: var(--radius);
  background: var(--surface-2);
  font: 12.5px/1.65 var(--font);
  white-space: pre-wrap;
  word-break: break-word;
}

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

body.bare {
  min-height: 100vh;
}

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: min(380px, 100%);
  padding: 34px 30px 30px;
  border-radius: 26px;
  background: var(--glass-strong);
  box-shadow:
    var(--shadow-pop),
    inset 0 0 0 1px var(--line);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  animation: modal-in 0.7s var(--spring);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 26px;
  text-align: center;
}

.login-brand .plate {
  margin-bottom: 14px;
}

.login-brand h1 {
  font-size: 21px;
}

.login-brand p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.login-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-body label {
  font-size: 13px;
  font-weight: 600;
}

.login-body .btn {
  min-height: 44px;
  margin-top: 8px;
  font-size: 15px;
}

/* ---------- 平板与手机 ---------- */

@media (max-width: 960px) {
  .topbar {
    position: relative;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 14px 16px 4px;
    padding-top: max(14px, env(safe-area-inset-top));
  }

  .topbar::before {
    content: none;
  }

  .pillnav {
    display: none;
  }

  body:not(.bare) {
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
  }

  .main {
    padding: 0 16px 24px;
  }

  /* 底部悬浮胶囊标签栏 */
  .tabbar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    border-radius: 999px;
    background: var(--glass-strong);
    box-shadow:
      var(--shadow-float),
      inset 0 0 0 1px var(--line);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
  }

  .tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: 60px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    list-style: none;
    cursor: pointer;
    transition: color 0.2s;
  }

  .tab-item:hover {
    text-decoration: none;
  }

  .tab-item::-webkit-details-marker {
    display: none;
  }

  .tab-item.active {
    color: var(--accent-text);
  }

  .tab-more {
    position: relative;
  }

  .more-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 12px);
    min-width: 196px;
    padding: 6px;
    border-radius: var(--radius-lg);
    /* 嵌套在毛玻璃标签栏里时背景模糊不到页面内容，所以用不透明背景 */
    background: var(--surface);
    box-shadow:
      var(--shadow-pop),
      inset 0 0 0 1px var(--line);
    animation: modal-in 0.5s var(--spring);
  }

  .more-menu form {
    margin: 0;
  }

  .more-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 0;
    border-radius: 12px;
    background: none;
    color: var(--ink);
    font: inherit;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
  }

  .more-item:hover {
    background: var(--hover);
    text-decoration: none;
  }

  .more-item.active {
    color: var(--accent-text);
    font-weight: 600;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 15px;
  }

  /* 输入框不小于 16px，避免 iPhone 聚焦时自动放大页面 */
  :where(input:not([type='checkbox'], [type='radio'], [type='hidden'])),
  :where(select, textarea) {
    min-height: 44px;
    font-size: 16px;
  }

  .page-head,
  .hero {
    align-items: center;
    margin: 14px 0 16px;
  }

  .page-title h1 {
    font-size: 23px;
  }

  .hero-title {
    font-size: 25px;
  }

  .card {
    padding: 16px;
    border-radius: var(--radius-lg);
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stat {
    padding: 13px 14px;
  }

  .stat-num {
    font-size: 28px;
  }

  .stat-sub {
    white-space: normal;
  }

  .strip-item {
    flex: 1 1 40%;
    padding: 12px 16px;
  }

  .strip-item + .strip-item {
    border-left: 0;
  }

  .strip-main {
    flex-basis: 100%;
    border-bottom: 1px solid var(--line);
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  /* 手机上按钮和说明会换行，头像与第一行按钮顶部对齐 */
  .avatar-form {
    align-items: flex-start;
    gap: 14px;
  }

  .plate-xl {
    width: 64px;
    height: 64px;
    font-size: 27px;
  }

  .search,
  .filters {
    width: 100%;
  }

  .search input[type='search'],
  .filters select {
    flex: 1 1 100%;
    width: 100%;
    max-width: none;
  }

  .filters .filter-q {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
  }

  .filter-toggle {
    display: inline-flex;
    flex: none;
    min-height: 44px;
  }

  .filters.expanded .filter-toggle {
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px var(--accent-ring);
    color: var(--accent-text);
  }

  .filters:not(.expanded) .filter-extra,
  .filters .filter-submit {
    display: none;
  }

  .filters.expanded .filter-extra {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
  }

  .date-range {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr);
    flex: 1 1 100%;
    min-width: 0;
  }

  .date-range input {
    width: 100%;
    min-width: 0;
    padding-left: 10px;
    padding-right: 8px;
  }

  .chips {
    flex-wrap: nowrap;
    margin-left: -16px;
    margin-right: -16px;
    padding: 2px 16px 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .chips::-webkit-scrollbar {
    display: none;
  }

  /* 手机上表格改为卡片 */
  .table-wrap {
    margin: 0;
    overflow: visible;
  }

  .table.responsive thead {
    display: none;
  }

  .table.responsive,
  .table.responsive tbody,
  .table.responsive tr,
  .table.responsive td {
    display: block;
    width: 100%;
  }

  .table.responsive tr {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
  }

  .table.responsive tbody tr:first-child {
    padding-top: 2px;
  }

  .table.responsive tbody tr:last-child {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .table.responsive tbody tr:hover {
    background: none;
  }

  .table.responsive td,
  .table.responsive td:first-child,
  .table.responsive td:last-child {
    display: flex;
    justify-content: flex-end;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 2px 8px;
    max-width: none;
    padding: 3px 0;
    border: 0;
    text-align: right;
  }

  .table.responsive td::before {
    content: attr(data-label);
    flex: none;
    margin-right: auto;
    color: var(--muted);
    font-size: 13px;
    text-align: left;
  }

  .table.responsive td.cell-title {
    display: block;
    padding-bottom: 6px;
    font-size: 16px;
    text-align: left;
  }

  .table.responsive td.cell-title::before,
  .table.responsive td.actions::before {
    content: none;
  }

  .table.responsive td.cell-title .sub {
    display: inline;
    margin-left: 6px;
  }

  .table.responsive td.actions {
    display: block;
    padding-top: 10px;
    text-align: left;
  }

  /* 卡片模式下状态短竖条放在标题行 */
  .table.responsive .row-expired td.cell-title,
  .table.responsive .row-today td.cell-title,
  .table.responsive .row-soon td.cell-title {
    padding-left: 12px;
  }

  .table.responsive .row-expired td.cell-title::before,
  .table.responsive .row-today td.cell-title::before,
  .table.responsive .row-soon td.cell-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 5px;
    bottom: 11px;
    width: 3px;
    border-radius: 3px;
  }

  .row-actions {
    display: flex;
    flex-wrap: wrap;
  }

  .row-actions .btn,
  .row-actions .inline-form {
    flex: 1;
  }

  .row-actions .inline-form .btn {
    width: 100%;
  }

  .row-actions .btn-sm {
    min-height: 38px;
    font-size: 14px;
  }

  .table-foot {
    margin: 12px 0 0;
    padding: 12px 0 0;
    text-align: center;
  }

  /* 弹窗变为底部抽屉 */
  dialog.modal {
    width: 100vw;
    max-width: 100vw;
    max-height: 92vh;
    margin: auto 0 0;
    border-radius: 24px 24px 0 0;
  }

  dialog.modal[open] {
    animation: sheet-in 0.6s var(--spring);
  }

  .modal-frame,
  .modal-frame.modal-lg {
    width: 100%;
  }

  .modal-head {
    padding-left: 20px;
  }

  .modal-body {
    padding: 4px 20px max(20px, env(safe-area-inset-bottom));
  }

  .form-actions {
    position: sticky;
    bottom: 0;
    margin: 20px -20px -20px;
    padding: 12px 20px max(12px, env(safe-area-inset-bottom));
    background: var(--glass-strong);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
  }

  .form-actions .btn {
    flex: 1;
    min-height: 44px;
  }

  .timeline li {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .timeline .timeline-text {
    grid-column: 1 / -1;
  }

  .preview-dates {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .preview-arrow {
    transform: rotate(90deg);
  }

  .preview-old {
    font-size: 17px;
  }

  .preview-new {
    font-size: 23px;
  }

  .toast {
    bottom: calc(86px + env(safe-area-inset-bottom));
  }
}

@keyframes sheet-in {
  from {
    transform: translateY(40px);
    opacity: 0.6;
  }
}

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