/* ==========================================================================
   羽球老友记 · 设计系统
   Tokens → Base → Layout → Components → Views
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  /* 品牌：球场绿 + 羽毛球荧光黄 */
  --brand-50: #e2f4f4;
  --brand-300: #54b0b3;
  --brand-500: #0d8f95;
  --brand-600: #0a6f77;
  --volt: #b8f14e;
  --volt-dim: #a9d63a;

  /* 品牌色分两类：--brand-600 等用于文字/图标（跟随主题反转），
     下面这组用于「填充成品牌色的面」，深浅两套都必须是深绿，才压得住白字。 */
  --brand-solid: #0a6f77;
  --brand-solid-2: #043f45;
  --on-brand: #ffffff;
  --brand-track: #c7e7e9;
  --bill-bg: #05353a;

  /* 中性 */
  --bg: #f3f5f3;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f9f7;
  --surface-3: #eef1ee;
  --line: #e4e8e4;
  --line-strong: #d2d8d2;

  --ink: #10151a;
  --ink-2: #4d5760;
  --ink-3: #858f99;
  --ink-inverse: #ffffff;

  /* 语义 */
  --gold: #d99a1f;
  --silver: #94a0aa;
  --bronze: #b8794a;
  --danger: #d2453f;
  --danger-soft: #fdeceb;
  --warn: #a56a12;
  --warn-soft: #fdf2de;
  --male: #3f7fa8;
  --female: #b3559b;
  --flame: #d4682a;
  --info: #2f6fd0;

  /* 排版 */
  --font-sans: -apple-system, "SF Pro Text", "PingFang SC", "HarmonyOS Sans SC",
    "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-num: "SF Pro Display", -apple-system, "Helvetica Neue", system-ui, sans-serif;

  /* 间距 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;

  /* 圆角 */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 26px;
  --r-full: 999px;

  /* 阴影 */
  --shadow-xs: 0 1px 2px rgba(16, 25, 20, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 25, 20, 0.06), 0 4px 12px rgba(16, 25, 20, 0.04);
  --shadow-md: 0 2px 6px rgba(16, 25, 20, 0.07), 0 10px 28px rgba(16, 25, 20, 0.07);
  --shadow-lg: 0 8px 20px rgba(16, 25, 20, 0.1), 0 24px 60px rgba(16, 25, 20, 0.12);

  /* 动效 */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);
  --dur-fast: 140ms;
  --dur-base: 240ms;
  --dur-sheet: 380ms;

  /* 安全区 */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 58px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand-50: #0a2a2d;
    --brand-300: #4aa9b0;
    --brand-500: #22a4ad;
    --brand-600: #38bfc8;

    --bg: #0b0e0c;
    --bg-elevated: #141a16;
    --surface: #151b17;
    --surface-2: #1b221d;
    --surface-3: #232b25;
    --line: #262e28;
    --line-strong: #333c35;

    --brand-solid: #0d7e87;
    --brand-solid-2: #063a42;
    --on-brand: #ffffff;
    --brand-track: #1f3538;
    --bill-bg: #0d1a1c;

    --ink: #eef2ef;
    --ink-2: #a6b0a9;
    --ink-3: #737e77;
    --ink-inverse: #0b0e0c;

    --gold: #e7b34a;
    --silver: #a8b3bc;
    --bronze: #cc8f5f;
    --danger: #ef6a63;
    --danger-soft: #35191a;
    --warn: #e0ae5c;
    --warn-soft: #33260f;
    --male: #6aa8d0;
    --female: #d886c4;
    --flame: #f0925a;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --brand-50: #0a2a2d;
  --brand-300: #4aa9b0;
  --brand-500: #22a4ad;
  --brand-600: #38bfc8;

  --bg: #0b0e0c;
  --bg-elevated: #141a16;
  --surface: #151b17;
  --surface-2: #1b221d;
  --surface-3: #232b25;
  --line: #262e28;
  --line-strong: #333c35;

  --brand-solid: #0d7e87;
  --brand-solid-2: #063a42;
  --on-brand: #ffffff;
  --brand-track: #1f3538;
  --bill-bg: #0d1a1c;

  --ink: #eef2ef;
  --ink-2: #a6b0a9;
  --ink-3: #737e77;
  --ink-inverse: #0b0e0c;

  --gold: #e7b34a;
  --silver: #a8b3bc;
  --bronze: #cc8f5f;
  --danger: #ef6a63;
  --danger-soft: #35191a;
  --warn: #e0ae5c;
  --warn-soft: #33260f;
  --male: #6aa8d0;
  --female: #d886c4;
  --flame: #f0925a;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);

  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p,
figure {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.24;
  letter-spacing: -0.022em;
  font-weight: 700;
}
h2 {
  font-size: 19px;
  line-height: 1.32;
  letter-spacing: -0.016em;
  font-weight: 700;
}
h3 {
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: -0.01em;
  font-weight: 650;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
  touch-action: manipulation;
  border: 0;
  background: none;
  padding: 0;
  color: inherit;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.02em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

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

/* --------------------------------------------------------------------------
   3. Layout
   -------------------------------------------------------------------------- */
.shell {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
}

.page {
  padding: 0 var(--sp-4) calc(var(--tabbar-h) + var(--safe-bottom) + 80px);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  animation: page-in var(--dur-base) var(--ease-out);
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

/* 顶栏 */
.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  /* 高度用 min-height，刘海屏的安全区才不会把内容挤扁 */
  min-height: calc(52px + var(--safe-top));
  padding: var(--safe-top) var(--sp-4) 0;
  margin-bottom: var(--sp-2);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  transition: border-color var(--dur-base);
  border-bottom: 1px solid transparent;
}

.appbar.scrolled {
  border-bottom-color: var(--line);
}

.appbar__title {
  flex: 1;
  min-width: 0;
  font-size: 17px;
  font-weight: 680;
  letter-spacing: -0.01em;
}

.appbar__title small {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: 0;
}

.appbar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.logo {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--brand-solid), var(--brand-solid-2));
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-xs);
}

.logo svg {
  width: 17px;
  height: 17px;
  stroke: var(--volt);
  stroke-width: 2;
}

/* 章节标题 */
.section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 0 var(--sp-1);
}

.section__head h2 {
  min-width: 0;
}

.section__head p {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 2px;
}

.eyebrow {
  display: block;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  color: var(--brand-600);
  margin-bottom: 3px;
}

/* --------------------------------------------------------------------------
   4. Components
   -------------------------------------------------------------------------- */

/* 4.1 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 46px;
  padding: 0 var(--sp-5);
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -0.005em;
  transition:
    transform var(--dur-fast) var(--ease-out),
    background var(--dur-fast),
    opacity var(--dur-fast);
  white-space: nowrap;
}

.btn:active:not(:disabled) {
  transform: scale(0.972);
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn--primary {
  background: var(--brand-solid);
  color: var(--on-brand);
  box-shadow: 0 1px 2px rgba(6, 48, 31, 0.2), 0 6px 16px -6px rgba(6, 48, 31, 0.5);
}

.btn--secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}

.btn--tonal {
  background: var(--brand-50);
  color: var(--brand-600);
}

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

.btn--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn--block {
  width: 100%;
}

.btn--sm {
  height: 36px;
  padding: 0 var(--sp-3);
  font-size: 13.5px;
  border-radius: var(--r-sm);
}

.btn--sm svg {
  width: 16px;
  height: 16px;
}

/* 进行中的按钮：转圈 + 挡住后续点击 */
.btn--loading {
  pointer-events: none;
}

.spinner {
  width: 16px;
  height: 16px;
  flex: none;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  opacity: 0.85;
  animation: spin 0.65s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 图标按钮 */
.icon-btn {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-full);
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast);
}

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

.icon-btn--plain {
  background: transparent;
  border-color: transparent;
}

/* 文字动作 */
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 13.5px;
  font-weight: 620;
  color: var(--brand-600);
  white-space: nowrap;
  flex: none;
}

.link-btn svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
}

/* 4.2 卡片 */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}

.card--pad {
  padding: var(--sp-4);
}

/* 4.3 个人主卡 */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-2xl);
  padding: var(--sp-5);
  color: #fff;
  background: linear-gradient(145deg, var(--brand-solid) 0%, var(--brand-solid-2) 100%);
  box-shadow: 0 10px 30px -12px rgba(6, 48, 31, 0.6);
}

.hero::after {
  content: "";
  position: absolute;
  right: -70px;
  top: -90px;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  border: 1.5px solid rgba(200, 241, 78, 0.16);
  background: radial-gradient(circle at 30% 30%, rgba(200, 241, 78, 0.12), transparent 65%);
  pointer-events: none;
}

.hero__top {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  position: relative;
}

/* 头像本身是彩色的，加一圈半透明白边才不会和深绿底"打架" */
.hero__top .avatar {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.hero__name {
  flex: 1;
  min-width: 0;
}

.hero__name b {
  display: block;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.hero__name small {
  display: block;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.62);
}

.hero__switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--r-full);
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.hero__switch svg {
  width: 14px;
  height: 14px;
}

.hero__stats {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: var(--sp-5);
}

.hero__stat {
  padding-right: var(--sp-3);
  text-align: left;
}

.hero__stat + .hero__stat {
  padding-left: var(--sp-4);
  border-left: 1px solid rgba(255, 255, 255, 0.13);
}

.hero__stat b {
  display: block;
  font-size: 25px;
  font-weight: 700;
  line-height: 1.15;
}

.hero__stat b i {
  font-style: normal;
  font-size: 14px;
  font-weight: 600;
  opacity: 0.72;
  margin-left: 1px;
}

.hero__stat span {
  display: block;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 3px;
}

/* 4.4 统计格 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-2);
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-3) var(--sp-4);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow-xs);
}

.stat__label {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 550;
}

.stat__value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 2px;
}

.stat__value i {
  font-style: normal;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  margin-left: 1px;
}

.stat__hint {
  font-size: 11.5px;
  color: var(--ink-3);
}

/* 4.5 头像 */
.avatar {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: var(--r-full);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0;
  color: #fff;
  overflow: hidden;
  user-select: none;
}

.avatar--lg {
  width: 48px;
  height: 48px;
  font-size: 19px;
}

.avatar--sm {
  width: 30px;
  height: 30px;
  font-size: 13px;
}

.avatar--xs {
  width: 24px;
  height: 24px;
  font-size: 11px;
  border: 1.5px solid var(--surface);
}

/* 「欣爸」这种两个字的头像，字号要收一档才塞得下 */
.avatar--duo {
  font-size: 12.5px;
  letter-spacing: -0.04em;
}

.avatar--duo.avatar--lg {
  font-size: 16px;
}

.avatar--duo.avatar--sm {
  font-size: 10.5px;
}

.avatar--duo.avatar--xs {
  font-size: 8.5px;
}

.avatar-stack {
  display: flex;
  align-items: center;
}

.avatar-stack .avatar--xs + .avatar--xs {
  margin-left: -8px;
}

/* 头像组末尾的「+N」，用中性色，不要跟性别色混淆 */
.avatar--more {
  background: var(--surface-3) !important;
  color: var(--ink-2);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.avatar-stack__more {
  margin-left: 6px;
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 550;
}

/* 4.6 列表行 */
.row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  background: var(--surface);
  transition: background var(--dur-fast);
}

.row:active {
  background: var(--surface-2);
}

.row__main {
  flex: 1;
  min-width: 0;
}

.row__main b {
  display: block;
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -0.008em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row__main small {
  display: block;
  font-size: 12.5px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
}

.row__end {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: none;
  color: var(--ink-3);
}

.row__value {
  text-align: right;
  font-size: 15px;
  font-weight: 650;
  color: var(--ink);
}

.row__value small {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-3);
}

.row__chev {
  color: var(--ink-3);
  width: 17px;
  height: 17px;
  stroke-width: 2.2;
}

/* 分组列表容器 */
.list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.list > .row + .row {
  border-top: 1px solid var(--line);
}

/* 4.7 活动卡片 */
.event {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  background: var(--surface);
  transition: background var(--dur-fast);
}

.event:active {
  background: var(--surface-2);
}

.event__date {
  width: 46px;
  flex: none;
  text-align: center;
  padding: 6px 0;
  border-radius: var(--r-md);
  background: var(--surface-3);
}

.event__date b {
  display: block;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
}

.event__date small {
  display: block;
  font-size: 10.5px;
  color: var(--ink-3);
  font-weight: 550;
}

.event__date--weekend {
  background: var(--brand-50);
  color: var(--brand-600);
}

.event__date--weekend small {
  color: var(--brand-600);
  opacity: 0.75;
}

.event__body {
  flex: 1;
  min-width: 0;
}

.event__body b {
  display: block;
  font-size: 14.5px;
  font-weight: 620;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px var(--sp-2);
  margin-top: 4px;
}

.event__amount {
  flex: none;
  text-align: right;
  font-size: 15px;
  font-weight: 680;
}

/* 4.8 徽标 / 标签 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--r-sm);
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--ink-2);
  white-space: nowrap;
}

.tag--brand {
  background: var(--brand-50);
  color: var(--brand-600);
}

.tag--muted {
  background: transparent;
  color: var(--ink-3);
  padding: 0;
}

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

.tag--dashed {
  background: transparent;
  border: 1px dashed var(--line-strong);
  color: var(--ink-3);
}

/* 4.9 分段控制器 */
.segmented {
  position: relative;
  display: flex;
  padding: 3px;
  border-radius: var(--r-md);
  background: var(--surface-3);
  gap: 2px;
}

.segmented button {
  flex: 1;
  height: 32px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  transition: color var(--dur-fast), background var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}

.segmented button[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

/* 4.10 底部导航 */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  padding: 6px var(--sp-2) calc(6px + var(--safe-bottom));
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-top: 1px solid var(--line);
}

.tabbar__inner {
  display: flex;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

.tabbar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 560;
  transition: color var(--dur-fast);
}

.tabbar button svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.7;
  transition: transform var(--dur-base) var(--ease-out);
}

.tabbar button[aria-current="page"] {
  color: var(--brand-600);
}

.tabbar button[aria-current="page"] svg {
  stroke-width: 2.1;
  transform: translateY(-1px);
}

/* 4.11 浮动按钮 */
.fab {
  position: fixed;
  right: max(var(--sp-4), calc(50vw - 280px + var(--sp-4)));
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--sp-4));
  z-index: 35;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 46px;
  padding: 0 18px 0 15px;
  border-radius: var(--r-full);
  font-size: 14.5px;
  font-weight: 650;
  color: var(--on-brand);
  background: var(--brand-solid);
  box-shadow: 0 4px 12px -2px rgba(6, 48, 31, 0.4), 0 12px 32px -8px rgba(6, 48, 31, 0.5);
  transition: transform var(--dur-fast) var(--ease-out);
  animation: fab-in var(--dur-base) var(--ease-out);
}

.fab:active {
  transform: scale(0.94);
}

@keyframes fab-in {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(8px);
  }
}

/* 4.12 表单 */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  padding-left: 2px;
}

.field__hint {
  font-size: 12px;
  color: var(--ink-3);
  padding-left: 2px;
}

.input {
  width: 100%;
  height: 46px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 15px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  -webkit-appearance: none;
  appearance: none;
}

.input::placeholder {
  color: var(--ink-3);
}

.input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 16%, transparent);
}

.input[type="date"],
.input[type="month"] {
  min-width: 0;
}

.input--num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

/* 选择触发器（打开底部选择器） */
.select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  width: 100%;
  height: 46px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 15px;
  font-weight: 550;
  text-align: left;
  transition: border-color var(--dur-fast);
}

.select-trigger:active {
  border-color: var(--line-strong);
}

.select-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-trigger svg {
  width: 17px;
  height: 17px;
  color: var(--ink-3);
  stroke-width: 2;
}

.select-trigger--empty span {
  color: var(--ink-3);
  font-weight: 500;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}

/* 开关 */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-1) 2px;
}

.switch-row > span {
  font-size: 14.5px;
  font-weight: 550;
}

.switch-row > span small {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-3);
}

.switch {
  position: relative;
  width: 48px;
  height: 29px;
  flex: none;
  border-radius: var(--r-full);
  background: var(--line-strong);
  transition: background var(--dur-base) var(--ease-out);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform var(--dur-base) var(--ease-out);
}

.switch:checked {
  background: var(--brand-500);
}

.switch:checked::after {
  transform: translateX(19px);
}

/* 4.13 人员选择芯片 */
/* 名字长短不一，用自适应宽度比等分格子好看得多 */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.chip {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 10px 0 6px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 570;
  text-align: left;
  transition:
    border-color var(--dur-fast),
    background var(--dur-fast),
    transform var(--dur-fast) var(--ease-out);
}

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

.chip span {
  max-width: 8.5em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip[aria-pressed="true"] {
  border-color: var(--brand-500);
  background: var(--brand-50);
  color: var(--brand-600);
}

/* 4.14 底部弹层 */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(8, 14, 10, 0.42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in var(--dur-base) var(--ease-out);
}

.scrim--closing {
  animation: fade-out var(--dur-base) var(--ease-out) forwards;
}

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

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  padding-bottom: var(--safe-bottom);
  box-shadow: var(--shadow-lg);
  animation: sheet-up var(--dur-sheet) var(--ease-sheet);
}

.scrim--closing .sheet {
  animation: sheet-down var(--dur-base) var(--ease-sheet) forwards;
}

@keyframes sheet-up {
  from {
    transform: translateY(100%);
  }
}

@keyframes sheet-down {
  to {
    transform: translateY(100%);
  }
}

.sheet__grip {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--line-strong);
  margin: 8px auto 0;
  flex: none;
}

.sheet__head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4) var(--sp-3);
  flex: none;
}

.sheet__head h2,
.sheet__head h3 {
  flex: 1;
  min-width: 0;
}

.sheet__head p {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 2px;
}

.sheet__body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--sp-4) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.sheet__body--flush {
  padding-left: 0;
  padding-right: 0;
  gap: 0;
}

.sheet__body--flush .option + .option {
  border-top: 1px solid var(--line);
}

/* 选择器选项 */
.option {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  transition: background var(--dur-fast);
}

.option:active {
  background: var(--surface-2);
}

.option__main {
  flex: 1;
  min-width: 0;
}

.option__main b {
  display: block;
  font-size: 15px;
  font-weight: 570;
}

.option__main small {
  display: block;
  font-size: 12.5px;
  color: var(--ink-3);
}

.option[aria-selected="true"] .option__main b {
  color: var(--brand-600);
  font-weight: 650;
}

.option__check {
  color: var(--brand-600);
  opacity: 0;
  transform: scale(0.8);
  transition: all var(--dur-fast) var(--ease-out);
}

.option[aria-selected="true"] .option__check {
  opacity: 1;
  transform: none;
}

/* 4.15 Toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 20px);
  z-index: 80;
  transform: translate(-50%, 12px);
  max-width: min(340px, calc(100vw - 32px));
  padding: 11px 18px;
  border-radius: var(--r-full);
  background: rgba(18, 24, 20, 0.94);
  color: #fff;
  font-size: 13.5px;
  font-weight: 550;
  text-align: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 4.16 空状态 */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
}

.empty__icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--ink-3);
  margin-bottom: 2px;
}

.empty h3 {
  font-size: 15px;
  font-weight: 620;
}

.empty p {
  font-size: 13px;
  color: var(--ink-3);
  max-width: 25ch;
}

/* 4.17 骨架屏 */
.skeleton {
  border-radius: var(--r-md);
  background: linear-gradient(
    100deg,
    var(--surface-3) 30%,
    var(--surface-2) 50%,
    var(--surface-3) 70%
  );
  background-size: 220% 100%;
  animation: shimmer 1.4s infinite linear;
}

@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

/* --------------------------------------------------------------------------
   5. Views
   -------------------------------------------------------------------------- */

/* 5.1 登录 */
.login {
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--sp-6) var(--sp-5) calc(var(--sp-6) + var(--safe-bottom));
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.login::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(247, 252, 239, 0.1), rgba(247, 252, 239, 0.72)),
    url("/assets/login-bg.jpg") center / cover no-repeat;
}

.login::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(246, 253, 241, 0.3) 45%,
    rgba(243, 247, 241, 0.72) 100%
  );
  backdrop-filter: blur(2px) saturate(115%);
  -webkit-backdrop-filter: blur(2px) saturate(115%);
  pointer-events: none;
}

.login__card {
  width: 100%;
  max-width: 440px;
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  padding: var(--sp-5);
  border-radius: var(--r-2xl);
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.66);
  box-shadow:
    0 24px 60px rgba(18, 53, 36, 0.16),
    0 4px 16px rgba(18, 53, 36, 0.08);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  animation: login-card-in 560ms var(--ease-out) both;
}

@keyframes login-card-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

/* 品牌行：图标 + 名字，下面一条细线把它和正文分开 */
.login__head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid rgba(18, 53, 36, 0.1);
}

.login__brand {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 14px;
  background: linear-gradient(150deg, var(--brand-solid), var(--brand-solid-2));
  display: grid;
  place-items: center;
  box-shadow:
    0 10px 22px -10px rgba(6, 48, 31, 0.7),
    inset 0 1px rgba(255, 255, 255, 0.22);
}

.login__brand svg {
  width: 24px;
  height: 24px;
  stroke: var(--volt);
  stroke-width: 2;
}

.login__copy {
  min-width: 0;
}

.login__eyebrow {
  display: block;
  color: var(--brand-600);
  font-size: 10.5px;
  font-weight: 760;
  letter-spacing: 0.16em;
  line-height: 1.2;
}

.login__copy b {
  display: block;
  margin-top: 3px;
  font-size: 19px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.login__welcome h1 {
  font-size: 30px;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.login__welcome p {
  margin-top: 6px;
  font-size: 14.5px;
  color: var(--ink-2);
}

.login form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.login__error {
  font-size: 13px;
  color: var(--danger);
  text-align: center;
}

.login .btn--primary {
  height: 50px;
  font-size: 16px;
}

/* 密码框：左边放把锁，去掉外面那层 label，输入区自己就是个整体 */
.login__field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-md);
  /* 卡片本身是浅色毛玻璃，输入框再用白边就看不见了，这里用实色描边 */
  border: 1.5px solid color-mix(in srgb, var(--brand-600) 28%, transparent);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 1px 2px rgba(18, 53, 36, 0.06);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

.login__field:focus-within {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 20%, transparent);
}

.login__field svg {
  width: 18px;
  height: 18px;
  color: var(--ink-3);
}

.login__field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 16px;
  letter-spacing: 0.04em;
}

.login__field input::placeholder {
  color: var(--ink-3);
  letter-spacing: 0;
}

:root[data-theme="dark"] .login__field {
  border-color: color-mix(in srgb, var(--brand-600) 42%, transparent);
  background: rgba(0, 0, 0, 0.28);
  box-shadow: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .login__field {
    border-color: color-mix(in srgb, var(--brand-600) 42%, transparent);
    background: rgba(0, 0, 0, 0.28);
    box-shadow: none;
  }
}

.login form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.login__error {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
}

.login .field {
  gap: 7px;
}

.login .input {
  height: 50px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.66);
  border-color: rgba(21, 80, 55, 0.15);
}

.login .input:focus {
  background: rgba(255, 255, 255, 0.88);
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(11, 138, 98, 0.12);
}

.login .btn--primary {
  height: 50px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--brand-solid), var(--brand-solid-2));
  box-shadow: 0 10px 22px -10px rgba(6, 48, 31, 0.75);
}

@media (max-width: 380px) {
  .login {
    padding-left: var(--sp-4);
    padding-right: var(--sp-4);
  }

  .login__card {
    padding: var(--sp-4);
  }

  .login__welcome h1 {
    font-size: 26px;
  }
}

/* 深色下换成暗色玻璃，照片压得更沉一些 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .login::before {
    background:
      linear-gradient(180deg, rgba(6, 20, 14, 0.35), rgba(6, 20, 14, 0.72)),
      url("/assets/login-bg.jpg") center / cover no-repeat;
  }

  :root:not([data-theme="light"]) .login::after {
    background: linear-gradient(
      180deg,
      rgba(5, 22, 15, 0.2) 0%,
      rgba(7, 25, 17, 0.48) 48%,
      rgba(11, 14, 12, 0.9) 100%
    );
  }

  :root:not([data-theme="light"]) .login__card {
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(14, 24, 20, 0.7);
    box-shadow: 0 22px 58px rgba(0, 0, 0, 0.42);
  }

  :root:not([data-theme="light"]) .login__head {
    border-bottom-color: rgba(255, 255, 255, 0.12);
  }
}

:root[data-theme="dark"] .login::before {
  background:
    linear-gradient(180deg, rgba(6, 20, 14, 0.35), rgba(6, 20, 14, 0.72)),
    url("/assets/login-bg.jpg") center / cover no-repeat;
}

:root[data-theme="dark"] .login::after {
  background: linear-gradient(
    180deg,
    rgba(5, 22, 15, 0.2) 0%,
    rgba(7, 25, 17, 0.48) 48%,
    rgba(11, 14, 12, 0.9) 100%
  );
}

:root[data-theme="dark"] .login__card {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(14, 24, 20, 0.7);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.42);
}

:root[data-theme="dark"] .login__head {
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

/* 5.2 走势图 */
.chart {
  padding: var(--sp-4);
}

.chart__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

/* 图表标题右侧的「我的 / 全群」切换，压窄一点，别抢标题的位置 */
.chart__head .segmented {
  flex: none;
  width: 132px;
  padding: 2px;
}

.chart__head .segmented button {
  height: 26px;
  font-size: 12.5px;
}

.chart__head b {
  font-size: 14.5px;
  font-weight: 650;
}

.chart__head small {
  font-size: 12px;
  color: var(--ink-3);
}

.chart__bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 5px;
  height: 92px;
}

.chart__col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
  min-width: 0;
}

.chart__bar {
  width: 100%;
  max-width: 26px;
  border-radius: 5px 5px 3px 3px;
  background: var(--brand-track);
  position: relative;
  transition: background var(--dur-fast);
  animation: bar-grow var(--dur-sheet) var(--ease-out) backwards;
}

@keyframes bar-grow {
  from {
    transform: scaleY(0);
  }
}

.chart__bar {
  transform-origin: bottom;
}

.chart__col--active .chart__bar {
  background: var(--brand-600);
}

.chart__val {
  font-size: 10.5px;
  font-weight: 650;
  color: var(--ink-2);
  line-height: 1;
}

.chart__label {
  font-size: 10.5px;
  color: var(--ink-3);
  line-height: 1;
  white-space: nowrap;
}

.chart__col--active .chart__label {
  color: var(--brand-600);
  font-weight: 650;
}

/* 5.3 日历 */
.calendar {
  padding: var(--sp-3) var(--sp-3) var(--sp-4);
}

.calendar__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: 0 var(--sp-1) var(--sp-3);
}

.calendar__month {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 680;
  letter-spacing: -0.01em;
}

.calendar__week,
.calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.calendar__week span {
  text-align: center;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
  padding-bottom: 6px;
}

.calendar__week span:nth-child(n + 6) {
  color: var(--brand-600);
}

.day {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: var(--r-md);
  font-size: 14.5px;
  font-weight: 550;
  color: var(--ink-2);
  transition: background var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}

.day:active {
  transform: scale(0.9);
}

.day--empty {
  pointer-events: none;
}

.day--weekend {
  color: var(--ink);
}

.day--today {
  box-shadow: inset 0 0 0 1.5px var(--brand-300);
  color: var(--brand-600);
  font-weight: 700;
}

.day--has {
  background: var(--brand-50);
  color: var(--brand-600);
  font-weight: 680;
}

.day--selected {
  background: var(--brand-solid);
  color: var(--on-brand);
  font-weight: 700;
}

.day__dot {
  position: absolute;
  bottom: 6px;
  display: flex;
  gap: 2.5px;
}

.day__dot i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.day--selected .day__dot i {
  background: var(--volt);
  opacity: 1;
}

/* 5.4 账单 */
.bill {
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--bill-bg);
  color: #e9f5ef;
  overflow: hidden;
}

.bill__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.bill__head b {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 650;
  color: var(--volt);
}

.bill__head b svg {
  width: 16px;
  height: 16px;
}

.bill pre {
  margin: 0;
  font-family: var(--font-num);
  font-size: 12.5px;
  line-height: 1.9;
  white-space: pre-wrap;
  word-break: break-word;
  color: rgba(255, 255, 255, 0.88);
}

.bill__actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}

.bill__actions .btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

/* 5.5 录入时段卡 */
.slot {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.slot__head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.slot__index {
  width: 22px;
  height: 22px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-full);
  background: var(--brand-solid);
  color: var(--on-brand);
  font-size: 11.5px;
  font-weight: 700;
}

.slot__title {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 650;
}

.slot__body {
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.slot__pick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.slot__pick-head .field__label {
  padding-left: 0;
}

.slot__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--brand-50);
  color: var(--brand-600);
  font-size: 13px;
  font-weight: 600;
}

.slot__summary b {
  font-size: 17px;
  font-weight: 700;
}

/* 折叠区 */
.disclosure {
  border-top: 1px solid var(--line);
  margin: 0 calc(-1 * var(--sp-4)) calc(-1 * var(--sp-4));
}

.disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  list-style: none;
}

.disclosure > summary::-webkit-details-marker {
  display: none;
}

.disclosure > summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.8px solid var(--ink-3);
  border-bottom: 1.8px solid var(--ink-3);
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--dur-base) var(--ease-out);
  flex: none;
}

.disclosure[open] > summary::after {
  transform: rotate(225deg) translateY(-2px);
}

.disclosure__body {
  padding: 0 var(--sp-4) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.fee-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.fee-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.fee-item > span {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fee-item .input {
  width: 104px;
  flex: none;
  height: 40px;
  text-align: right;
}

.inline-input {
  display: flex;
  gap: var(--sp-2);
}

.inline-input .input {
  flex: 1;
  min-width: 0;
}

/* 添加时段 */
.add-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 48px;
  border-radius: var(--r-lg);
  border: 1.5px dashed var(--line-strong);
  color: var(--ink-2);
  font-size: 14.5px;
  font-weight: 600;
  background: transparent;
  transition: border-color var(--dur-fast), color var(--dur-fast);
}

.add-slot:active {
  border-color: var(--brand-500);
  color: var(--brand-600);
}

/* 底部固定操作条 */
.actionbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + var(--safe-bottom));
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
}

.actionbar__inner {
  display: flex;
  gap: var(--sp-2);
  max-width: 560px;
  margin: 0 auto;
}

.actionbar__inner .btn--primary {
  flex: 1;
}

.page--actionbar {
  padding-bottom: calc(76px + var(--safe-bottom) + var(--sp-6));
}

/* 二级页面没有底部导航和浮动按钮，不用留那么多空 */
.shell--sub .page:not(.page--actionbar) {
  padding-bottom: calc(var(--safe-bottom) + var(--sp-8));
}

/* 5.6 排行榜领奖台 */
.podium {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: end;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-3) var(--sp-3);
}

.podium__slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.podium__crown {
  color: var(--gold);
  height: 18px;
  margin-bottom: -2px;
}

.podium__crown svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  stroke-width: 1.4;
}

.podium__name {
  font-size: 12.5px;
  font-weight: 620;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium__score {
  font-size: 11.5px;
  color: var(--ink-3);
  font-weight: 550;
}

.podium__block {
  width: 100%;
  border-radius: var(--r-md) var(--r-md) 0 0;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  margin-top: 2px;
}

.podium__slot:nth-child(1) .podium__block {
  height: 44px;
  background: linear-gradient(180deg, var(--silver), color-mix(in srgb, var(--silver) 70%, #000));
}

.podium__slot:nth-child(2) .podium__block {
  height: 62px;
  background: linear-gradient(180deg, var(--gold), color-mix(in srgb, var(--gold) 70%, #000));
}

.podium__slot:nth-child(3) .podium__block {
  height: 34px;
  background: linear-gradient(180deg, var(--bronze), color-mix(in srgb, var(--bronze) 70%, #000));
}

.podium__slot .avatar {
  box-shadow: 0 0 0 2.5px var(--surface), 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* 排行行 */
.rank-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  background: var(--surface);
  transition: background var(--dur-fast);
}

.rank-row:active {
  background: var(--surface-2);
}

.rank-row__no {
  width: 22px;
  flex: none;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-3);
}

.rank-row--me {
  background: var(--brand-50);
}

.rank-row--me .rank-row__no {
  color: var(--brand-600);
}

.rank-row__bar {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--brand-track);
  margin-top: 5px;
  overflow: hidden;
}

.rank-row__bar i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--brand-600);
  transition: width var(--dur-sheet) var(--ease-out);
}

/* 5.7 我的 / 管理页分组 */
.group-title {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-3);
  letter-spacing: 0.02em;
  padding: 0 var(--sp-1) var(--sp-1);
}

/* 详情条目 */
.detail-slot {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.detail-slot__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: 6px;
}

.detail-slot__head b {
  font-size: 14px;
  font-weight: 650;
}

.detail-slot__formula {
  font-family: var(--font-num);
  font-size: 12.5px;
  color: var(--ink-3);
  word-break: break-word;
}

.detail-people {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--sp-3);
}

.person-fee {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 550;
}

.person-fee b {
  font-family: var(--font-num);
  font-weight: 680;
  color: var(--brand-600);
}

/* 推算出来的历史费用：虚线框 + 角标，一眼能看出不是实际记录 */
.person-fee--estimated {
  border-style: dashed;
}

.person-fee--estimated b {
  color: var(--ink-3);
}

.person-fee--estimated::after {
  content: "估";
  font-size: 9.5px;
  font-weight: 700;
  color: var(--ink-3);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 0 2px;
  line-height: 1.3;
}

.person-fee--unpaid {
  border-color: var(--warn);
  background: var(--warn-soft);
  color: var(--warn);
}

.person-fee--unpaid b {
  color: var(--warn);
}

/* 收款状态条 */
.settle {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
}

.settle--done {
  background: var(--brand-50);
  color: var(--brand-600);
}

.settle--owing {
  background: var(--warn-soft);
  color: var(--warn);
}

.settle__main {
  flex: 1;
  min-width: 0;
}

.settle__main small {
  display: block;
  font-size: 12px;
  font-weight: 500;
  opacity: 0.85;
}

.settle svg {
  width: 18px;
  height: 18px;
}

/* 收款弹层里的一行 */
.settle-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  transition: background var(--dur-fast);
}

.settle-row:active {
  background: var(--surface-2);
}

.settle-row__state {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-full);
  font-size: 12.5px;
  font-weight: 620;
  background: var(--surface-3);
  color: var(--ink-3);
}

.settle-row__state svg {
  width: 14px;
  height: 14px;
}

.settle-row[data-paid="true"] .settle-row__state {
  background: var(--brand-50);
  color: var(--brand-600);
}

.settle-row[data-paid="false"] .settle-row__state {
  background: var(--warn-soft);
  color: var(--warn);
}

/* 性别小标 */
.gender {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: none;
  font-size: 11.5px;
  font-weight: 620;
  vertical-align: middle;
}

.gender svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.2;
}

.gender--male {
  color: var(--male);
}

.gender--female {
  color: var(--female);
}

/* 小标放在副标题最前面，和后面的文字留一点距离 */
.row__main small .gender,
.option__main small .gender,
.appbar__title small .gender {
  margin-right: 5px;
}

/* 副标题是浅灰的，小标要单独把颜色扳回来 */
.row__main small .gender svg,
.appbar__title small .gender svg {
  width: 12px;
  height: 12px;
}

/* 配色选择：一排色块 */
.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: var(--sp-2);
}

.swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px 8px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 11.5px;
  font-weight: 560;
  color: var(--ink-2);
  transition:
    border-color var(--dur-fast),
    transform var(--dur-fast) var(--ease-out);
}

.swatch:active {
  transform: scale(0.95);
}

.swatch i {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.swatch[aria-checked="true"] {
  border-color: var(--brand-500);
  color: var(--brand-600);
  font-weight: 660;
}

.swatch[aria-checked="true"] i {
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.12),
    0 0 0 2px var(--surface),
    0 0 0 4px var(--brand-500);
}

/* 账单图片预览 */
.image-preview {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface-2);
  box-shadow: var(--shadow-sm);
}

/* 卡路里估算 */
.burn {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}

.burn > svg {
  width: 22px;
  height: 22px;
  color: var(--flame);
  fill: color-mix(in srgb, var(--flame) 16%, transparent);
}

.burn__main {
  min-width: 0;
}

.burn__main b {
  display: block;
  font-size: 15px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
}

.burn__main small {
  display: block;
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 1px;
}

/* 明细条目里的卡路里，只在个人视角下出现 */
.burn-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: none;
  font-size: 11.5px;
  font-weight: 620;
  color: var(--flame);
  font-variant-numeric: tabular-nums;
}

.burn-chip svg {
  width: 12px;
  height: 12px;
  fill: color-mix(in srgb, var(--flame) 18%, transparent);
}

/* 英雄卡里的紧凑版，跟在深色底上 */
.burn-compact {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.86);
  font-variant-numeric: tabular-nums;
}

.burn-compact svg {
  width: 15px;
  height: 15px;
  color: #ffb46b;
  fill: rgba(255, 180, 107, 0.24);
}

/* 英雄卡底部：左边卡路里，右边跳去完整明细 */
.hero__foot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin: var(--sp-4) calc(-1 * var(--sp-5)) calc(-1 * var(--sp-5));
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.12);
  width: calc(100% + var(--sp-5) * 2);
  text-align: left;
  color: inherit;
  border-radius: 0 0 var(--r-2xl) var(--r-2xl);
  transition: background var(--dur-fast);
}

.hero__foot:active {
  background: rgba(0, 0, 0, 0.2);
}

.hero__foot-cta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: none;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--volt);
}

.hero__foot-cta svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.4;
}

/* 球友详情顶部的一行小字：加入时间 + 名次 */
.person-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 10px;
  margin-top: -4px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.person-meta span + span::before {
  content: "·";
  margin-right: 10px;
  color: var(--line-strong);
}

.person-meta b {
  color: var(--brand-600);
  font-weight: 680;
}

/* 按月分段的时间轴：月份标题当分隔，下面挂当月的活动 */
.timeline {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.timeline__group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.timeline__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 0 var(--sp-1);
}

.timeline__head b {
  position: relative;
  padding-left: 14px;
  font-size: 14.5px;
  font-weight: 680;
  letter-spacing: -0.01em;
}

/* 月份前面点一个小圆点，读起来像一条时间线 */
.timeline__head b::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: var(--brand-500);
}

.timeline__head span {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 550;
  white-space: nowrap;
}

/* 月份 / 年份步进条 */
.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: 2px;
}

.stepper__label {
  flex: 1;
  text-align: center;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

/* 日期选择弹层 */
.datepicker__quick {
  display: flex;
  gap: var(--sp-2);
}

.datepicker__quick .btn {
  flex: 1;
}

.datepicker__value {
  text-align: center;
  font-size: 14px;
  font-weight: 620;
  color: var(--brand-600);
}

/* 弹层里的日历不需要卡片阴影，外面已经有一层了 */
.sheet .calendar {
  box-shadow: none;
}

/* 日历上「有人还没交」的角标 */
.day__owe {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warn);
}

@media (min-width: 600px) {
  .page {
    padding-left: var(--sp-5);
    padding-right: var(--sp-5);
  }
  .appbar {
    padding-left: var(--sp-5);
    padding-right: var(--sp-5);
  }
}

/* --------------------------------------------------------------------------
   6. 可选配色
   默认「球场绿」写在最上面的 :root 里，这里只覆盖换肤要动的那几个 token。
   选择器都比基础层多一个 [data-palette]，所以放在文件末尾就能稳定生效；
   深色块又比浅色块多一层条件，浅深切换不会打架。
   -------------------------------------------------------------------------- */

/* 暖阳橙 */
:root[data-palette="sunset"] {
  --brand-50: #fdeee4;
  --brand-300: #eda175;
  --brand-500: #e0622a;
  --brand-600: #bf4915;
  --brand-solid: #bf4915;
  --brand-solid-2: #79290b;
  --brand-track: #f8dcc9;
  --bill-bg: #45180a;
  --volt: #ffd166;
}
:root[data-palette="sunset"][data-theme="dark"] {
  --brand-50: #331a0d;
  --brand-300: #e08a5a;
  --brand-500: #f07437;
  --brand-600: #ff9159;
  --brand-solid: #c94f1f;
  --brand-solid-2: #6b280d;
  --brand-track: #3d2519;
  --bill-bg: #1d1310;
  --volt: #ffd166;
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="sunset"]:not([data-theme="light"]) {
    --brand-50: #331a0d;
    --brand-300: #e08a5a;
    --brand-500: #f07437;
    --brand-600: #ff9159;
    --brand-solid: #c94f1f;
    --brand-solid-2: #6b280d;
    --brand-track: #3d2519;
    --bill-bg: #1d1310;
    --volt: #ffd166;
  }
}

/* 夜行蓝 */
:root[data-palette="midnight"] {
  --brand-50: #e8eefb;
  --brand-300: #7d9bd8;
  --brand-500: #2f5fc4;
  --brand-600: #1e3f8f;
  --brand-solid: #1e3f8f;
  --brand-solid-2: #101f47;
  --brand-track: #ccd9f2;
  --bill-bg: #101f47;
  --volt: #d7ff3e;
}
:root[data-palette="midnight"][data-theme="dark"] {
  --brand-50: #101d34;
  --brand-300: #6f93d6;
  --brand-500: #4a7de0;
  --brand-600: #6d9ef5;
  --brand-solid: #23478f;
  --brand-solid-2: #0d1c3b;
  --brand-track: #22304d;
  --bill-bg: #0d1626;
  --volt: #d7ff3e;
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="midnight"]:not([data-theme="light"]) {
    --brand-50: #101d34;
    --brand-300: #6f93d6;
    --brand-500: #4a7de0;
    --brand-600: #6d9ef5;
    --brand-solid: #23478f;
    --brand-solid-2: #0d1c3b;
    --brand-track: #22304d;
    --bill-bg: #0d1626;
    --volt: #d7ff3e;
  }
}

/* 墨石 */
:root[data-palette="ink"] {
  --brand-50: #ecefed;
  --brand-300: #9aa39e;
  --brand-500: #3d4643;
  --brand-600: #232a27;
  --brand-solid: #1e2422;
  --brand-solid-2: #0b0e0d;
  --brand-track: #d9dedb;
  --bill-bg: #141917;
  --volt: #c8f14e;
}
:root[data-palette="ink"][data-theme="dark"] {
  --brand-50: #232a27;
  --brand-300: #8e9a94;
  --brand-500: #b6c0bb;
  --brand-600: #dbe3df;
  --brand-solid: #39423e;
  --brand-solid-2: #181d1b;
  --brand-track: #2c3532;
  --bill-bg: #111614;
  --volt: #c8f14e;
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="ink"]:not([data-theme="light"]) {
    --brand-50: #232a27;
    --brand-300: #8e9a94;
    --brand-500: #b6c0bb;
    --brand-600: #dbe3df;
    --brand-solid: #39423e;
    --brand-solid-2: #181d1b;
    --brand-track: #2c3532;
    --bill-bg: #111614;
    --volt: #c8f14e;
  }
}

/* 球场绿 */
:root[data-palette="court"] {
  --brand-50: #e9f5ef;
  --brand-300: #62b393;
  --brand-500: #0b8a62;
  --brand-600: #086b4e;
  --brand-solid: #086b4e;
  --brand-solid-2: #04402f;
  --brand-track: #cfe9dd;
  --bill-bg: #06382a;
  --volt: #c8f14e;
}
:root[data-palette="court"][data-theme="dark"] {
  --brand-50: #0d2b21;
  --brand-300: #4fae8b;
  --brand-500: #23a97b;
  --brand-600: #35bd8c;
  --brand-solid: #0e7a59;
  --brand-solid-2: #063a2b;
  --brand-track: #24382f;
  --bill-bg: #0e1c16;
  --volt: #c8f14e;
}
@media (prefers-color-scheme: dark) {
  :root[data-palette="court"]:not([data-theme="light"]) {
    --brand-50: #0d2b21;
    --brand-300: #4fae8b;
    --brand-500: #23a97b;
    --brand-600: #35bd8c;
    --brand-solid: #0e7a59;
    --brand-solid-2: #063a2b;
    --brand-track: #24382f;
    --bill-bg: #0e1c16;
    --volt: #c8f14e;
  }
}
