:root,
[data-theme="forest"] {
  color-scheme: light;
  --bg: #f5f2ea;
  --surface: #fffdf8;
  --surface-soft: #f1ede3;
  --ink: #24271f;
  --muted: #656a5e;
  --line: #e6e1d5;
  --accent: #3c6e57;
  --accent-dark: #244c3b;
  --accent-soft: #e8f0e9;
  --on-accent: #fffdf8;
  --warm: #b96b43;
  --shadow: 0 12px 34px rgba(45, 52, 42, 0.07);
  --card-shadow-soft: 0 6px 18px rgba(45, 52, 42, 0.04);
  --glow-1: #e7efe3;
  --glow-2: #f4e7d6;
  --pill-bg: rgba(255, 253, 248, 0.72);
  --segment-bg: #ece7db;
  --chip-bg: #f5f2e9;
  --chip-border: #e9e4d8;
  --soft-ink: #5e6358;
  --faint: #6a6f62;
  --dashed: #d9d3c4;
  --preview-bg: rgba(255, 253, 248, 0.62);
  --tabbar-bg: rgba(255, 253, 248, 0.92);
  --brand-1: #4c8067;
  --brand-2: #2d5945;
  --hero-1: #294f3e;
  --hero-2: #3c6e57;
  --hero-3: #4c8067;
  --hero-shadow: 0 18px 40px rgba(36, 76, 59, 0.22);
  --veil-opacity: 0.32;
}

[data-theme="sakura"] {
  color-scheme: light;
  --bg: #f8f0ef;
  --surface: #fffafa;
  --surface-soft: #f4e7e7;
  --ink: #342a2c;
  --muted: #716064;
  --line: #eedddd;
  --accent: #964a5b;
  --accent-dark: #73384a;
  --accent-soft: #f6e2e6;
  --on-accent: #fffafa;
  --warm: #b46a4d;
  --shadow: 0 12px 34px rgba(82, 45, 55, 0.07);
  --card-shadow-soft: 0 6px 18px rgba(82, 45, 55, 0.04);
  --glow-1: #f3e2e2;
  --glow-2: #f7e8e0;
  --pill-bg: rgba(255, 250, 250, 0.72);
  --segment-bg: #ecdcdd;
  --chip-bg: #f8eeee;
  --chip-border: #eedcdd;
  --soft-ink: #6c5a5e;
  --faint: #786569;
  --dashed: #e0c9cc;
  --preview-bg: rgba(255, 250, 250, 0.62);
  --tabbar-bg: rgba(255, 250, 250, 0.93);
  --brand-1: #b56b7b;
  --brand-2: #8b4859;
  --hero-1: #5e313c;
  --hero-2: #8c4a58;
  --hero-3: #b06876;
  --hero-shadow: 0 18px 40px rgba(122, 64, 78, 0.22);
  --veil-opacity: 0.32;
}

[data-theme="ink"] {
  color-scheme: dark;
  --bg: #141916;
  --surface: #1e2420;
  --surface-soft: #262d28;
  --ink: #eef2ec;
  --muted: #b3bdb5;
  --line: #333c36;
  --accent: #7fb795;
  --accent-dark: #9bc9ac;
  --accent-soft: #263a2f;
  --on-accent: #10231a;
  --warm: #d98a63;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.35);
  --card-shadow-soft: 0 6px 18px rgba(0, 0, 0, 0.22);
  --glow-1: #1b2a22;
  --glow-2: #2a211b;
  --pill-bg: rgba(30, 36, 32, 0.72);
  --segment-bg: #232a25;
  --chip-bg: #232a25;
  --chip-border: #333c36;
  --soft-ink: #c3cbc3;
  --faint: #8f9a92;
  --dashed: #3b453f;
  --preview-bg: rgba(30, 36, 32, 0.65);
  --tabbar-bg: rgba(30, 36, 32, 0.94);
  --brand-1: #6fa585;
  --brand-2: #3f6b55;
  --hero-1: #10221a;
  --hero-2: #244c3a;
  --hero-3: #356a51;
  --hero-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
  --veil-opacity: 0.42;
}

[data-theme="coffee"] {
  color-scheme: light;
  --bg: #f3ece5;
  --surface: #fdf8f2;
  --surface-soft: #ece1d6;
  --ink: #2d251f;
  --muted: #6d6053;
  --line: #e2d5c8;
  --accent: #7a5a3f;
  --accent-dark: #5b4029;
  --accent-soft: #efe1d3;
  --on-accent: #fdf8f2;
  --warm: #b66a45;
  --shadow: 0 12px 34px rgba(66, 48, 34, 0.08);
  --card-shadow-soft: 0 6px 18px rgba(66, 48, 34, 0.05);
  --glow-1: #ece0d3;
  --glow-2: #f3e6d5;
  --pill-bg: rgba(253, 248, 242, 0.75);
  --segment-bg: #e8dccf;
  --chip-bg: #f5ece2;
  --chip-border: #e6d8ca;
  --soft-ink: #5d5248;
  --faint: #756759;
  --dashed: #d8c8b8;
  --preview-bg: rgba(253, 248, 242, 0.65);
  --tabbar-bg: rgba(253, 248, 242, 0.93);
  --brand-1: #8a6a4e;
  --brand-2: #634630;
  --hero-1: #4b2f1f;
  --hero-2: #6f4a33;
  --hero-3: #8a6044;
  --hero-shadow: 0 18px 40px rgba(87, 58, 38, 0.22);
  --veil-opacity: 0.32;
}

[data-theme="mist"] {
  color-scheme: light;
  --bg: #f0f1ef;
  --surface: #fbfcfb;
  --surface-soft: #e7e9e6;
  --ink: #242826;
  --muted: #626963;
  --line: #dfe2de;
  --accent: #596a61;
  --accent-dark: #3f4f47;
  --accent-soft: #e3e9e5;
  --on-accent: #fbfcfb;
  --warm: #a86a4d;
  --shadow: 0 12px 34px rgba(40, 48, 43, 0.08);
  --card-shadow-soft: 0 6px 18px rgba(40, 48, 43, 0.05);
  --glow-1: #e5e9e5;
  --glow-2: #eeeee8;
  --pill-bg: rgba(251, 252, 251, 0.75);
  --segment-bg: #e3e6e2;
  --chip-bg: #f2f4f2;
  --chip-border: #e2e5e1;
  --soft-ink: #4f5752;
  --faint: #666e68;
  --dashed: #d2d7d3;
  --preview-bg: rgba(251, 252, 251, 0.65);
  --tabbar-bg: rgba(251, 252, 251, 0.93);
  --brand-1: #6e7f76;
  --brand-2: #4d5c54;
  --hero-1: #2e3b35;
  --hero-2: #4a5a52;
  --hero-3: #5f7168;
  --hero-shadow: 0 18px 40px rgba(45, 58, 51, 0.22);
  --veil-opacity: 0.32;
}

[data-theme="lavender"] {
  color-scheme: light;
  --bg: #f4f1f8;
  --surface: #fdfbff;
  --surface-soft: #ebe6f3;
  --ink: #2b2733;
  --muted: #665e72;
  --line: #e2dbec;
  --accent: #725a97;
  --accent-dark: #55406f;
  --accent-soft: #ece5f6;
  --on-accent: #fdfbff;
  --warm: #b06a55;
  --shadow: 0 12px 34px rgba(63, 49, 90, 0.08);
  --card-shadow-soft: 0 6px 18px rgba(63, 49, 90, 0.05);
  --glow-1: #eae3f4;
  --glow-2: #f0eaf6;
  --pill-bg: rgba(253, 251, 255, 0.75);
  --segment-bg: #e6e0ef;
  --chip-bg: #f4f0fa;
  --chip-border: #e6dfee;
  --soft-ink: #5b5367;
  --faint: #70677d;
  --dashed: #d7cfe5;
  --preview-bg: rgba(253, 251, 255, 0.65);
  --tabbar-bg: rgba(253, 251, 255, 0.93);
  --brand-1: #846da8;
  --brand-2: #675188;
  --hero-1: #3f315a;
  --hero-2: #5a467a;
  --hero-3: #75609a;
  --hero-shadow: 0 18px 40px rgba(74, 57, 105, 0.22);
  --veil-opacity: 0.32;
}

[data-theme="honey"] {
  color-scheme: light;
  --bg: #fdf0e2;
  --surface: #fffaf4;
  --surface-soft: #f6e6d3;
  --ink: #322820;
  --muted: #715f4f;
  --line: #ecdbc7;
  --accent: #a65318;
  --accent-dark: #843f10;
  --accent-soft: #f6e3ce;
  --on-accent: #fffaf4;
  --warm: #b96b43;
  --shadow: 0 12px 34px rgba(112, 68, 38, 0.08);
  --card-shadow-soft: 0 6px 18px rgba(112, 68, 38, 0.05);
  --glow-1: #f8e3cd;
  --glow-2: #fbeadb;
  --pill-bg: rgba(255, 250, 244, 0.75);
  --segment-bg: #f2dfca;
  --chip-bg: #fbece0;
  --chip-border: #eed9c5;
  --soft-ink: #6a4f3a;
  --faint: #7a5f48;
  --dashed: #e6c9b1;
  --preview-bg: rgba(255, 250, 244, 0.65);
  --tabbar-bg: rgba(255, 250, 244, 0.93);
  --brand-1: #c4763a;
  --brand-2: #8a4413;
  --hero-1: #7a3c0f;
  --hero-2: #a65318;
  --hero-3: #c26a2b;
  --hero-shadow: 0 18px 40px rgba(122, 58, 18, 0.22);
  --veil-opacity: 0.32;
}

[data-theme="crimson"] {
  color-scheme: light;
  --bg: #fbeee7;
  --surface: #fffaf6;
  --surface-soft: #f6e3da;
  --ink: #2e2220;
  --muted: #6f5a56;
  --line: #eed6cc;
  --accent: #b3252c;
  --accent-dark: #8a171c;
  --accent-soft: #f8e0da;
  --on-accent: #fff9f5;
  --warm: #8e571c;
  --shadow: 0 12px 34px rgba(88, 32, 28, 0.08);
  --card-shadow-soft: 0 6px 18px rgba(88, 32, 28, 0.05);
  --glow-1: #f7dfd4;
  --glow-2: #f6e6cf;
  --pill-bg: rgba(255, 250, 246, 0.72);
  --segment-bg: #f0dcd3;
  --chip-bg: #f9e9e2;
  --chip-border: #efdcd2;
  --soft-ink: #66514d;
  --faint: #78615c;
  --dashed: #e2c7bc;
  --preview-bg: rgba(255, 250, 246, 0.62);
  --tabbar-bg: rgba(255, 250, 246, 0.93);
  --brand-1: #c0453c;
  --brand-2: #9c1f24;
  --hero-1: #6e1316;
  --hero-2: #9c2026;
  --hero-3: #c03a33;
  --hero-shadow: 0 18px 40px rgba(120, 25, 28, 0.24);
  --veil-opacity: 0.32;
}

[data-theme="indigo"] {
  color-scheme: light;
  --bg: #edf2f7;
  --surface: #fbfdff;
  --surface-soft: #e2eaf2;
  --ink: #222a33;
  --muted: #56667a;
  --line: #d6e0ea;
  --accent: #3d6285;
  --accent-dark: #2c4a67;
  --accent-soft: #e1ebf4;
  --on-accent: #fbfdff;
  --warm: #b96b43;
  --shadow: 0 12px 34px rgba(37, 60, 86, 0.08);
  --card-shadow-soft: 0 6px 18px rgba(37, 60, 86, 0.05);
  --glow-1: #e1eaf3;
  --glow-2: #e8eef5;
  --pill-bg: rgba(251, 253, 255, 0.72);
  --segment-bg: #dfe7f0;
  --chip-bg: #f0f5fa;
  --chip-border: #dbe5ef;
  --soft-ink: #4c5b6e;
  --faint: #5c6d82;
  --dashed: #ccd9e6;
  --preview-bg: rgba(251, 253, 255, 0.62);
  --tabbar-bg: rgba(251, 253, 255, 0.93);
  --brand-1: #557ba0;
  --brand-2: #38597c;
  --hero-1: #223b54;
  --hero-2: #3d6285;
  --hero-3: #557fa6;
  --hero-shadow: 0 18px 40px rgba(48, 78, 110, 0.22);
  --veil-opacity: 0.32;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -6%, var(--glow-1) 0, transparent 38%),
    radial-gradient(circle at 102% 0%, var(--glow-2) 0, transparent 32%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* 背景图：可视区域与聊天列同宽（手机铺满），按原比例铺满这一列，不拉伸、不平铺 */
.background-layer {
  position: fixed;
  inset: 0;
  max-width: 920px;
  margin-inline: auto;
  z-index: 0;
  background-image: var(--bg-image, none);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  opacity: var(--bg-opacity, 0);
  filter: blur(var(--bg-blur, 0px));
  pointer-events: none;
  transition: opacity 0.3s ease, filter 0.2s ease;
}

/* 磨砂底：主图比例之外的区域用同一张图放大模糊，再向主题底色做渐变收边 */
.background-fill {
  position: fixed;
  inset: -72px;
  z-index: 0;
  background-image: var(--bg-image, none);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  opacity: calc(var(--bg-opacity, 0) * 0.85);
  filter: blur(52px) saturate(1.12) brightness(0.94);
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.background-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg);
  -webkit-mask-image: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.92) 0%,
    rgba(0, 0, 0, 0.55) 12%,
    transparent 34%,
    transparent 66%,
    rgba(0, 0, 0, 0.55) 88%,
    rgba(0, 0, 0, 0.92) 100%
  );
  mask-image: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.92) 0%,
    rgba(0, 0, 0, 0.55) 12%,
    transparent 34%,
    transparent 66%,
    rgba(0, 0, 0, 0.55) 88%,
    rgba(0, 0, 0, 0.92) 100%
  );
}

.background-veil {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--bg);
  opacity: var(--veil-opacity);
  pointer-events: none;
}

[v-cloak] {
  display: none;
}

button {
  font: inherit;
  color: inherit;
}

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

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 920px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(24px + env(safe-area-inset-top)) 20px
    calc(140px + var(--browser-bottom, 0px) + env(safe-area-inset-bottom));
}

.app-shell.chat-open {
  height: var(--chat-viewport-height, 100vh);
  height: var(--chat-viewport-height, 100dvh);
  min-height: 0;
  padding-bottom: calc(82px + var(--browser-bottom, 0px) + env(safe-area-inset-bottom));
  overflow: hidden;
}

.content {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 2px 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.offline-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 680px;
  margin: 0 auto 10px;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--warm) 26%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--warm) 7%, var(--surface));
  color: var(--soft-ink);
  font-size: 12.5px;
  line-height: 1.45;
}

.offline-banner .offline-text {
  flex: 1;
  min-width: 0;
}

.offline-banner .text-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.offline-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--warm);
}

.offline-banner.syncing .offline-dot {
  background: var(--accent);
  animation: offline-pulse 1.1s ease-in-out infinite;
}

.offline-banner.failed {
  border-color: color-mix(in srgb, var(--warm) 42%, var(--line));
}

@keyframes offline-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--brand-1), var(--brand-2));
  color: #fffdf8;
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(45, 89, 69, 0.24);
}

.brand-mark.has-image,
.chat-avatar.has-image,
.persona-preview.has-image {
  overflow: hidden;
  background: var(--surface-soft);
}

.brand-mark img,
.chat-avatar img,
.persona-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.brand-text strong {
  display: block;
  overflow: hidden;
  font-size: 19px;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-text small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.04em;
}

.page {
  animation: rise 0.32s ease both;
}

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

.chat-page {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  max-width: 680px;
  min-height: 0;
  margin: 0 auto;
}

.chat-thread {
  flex: 1;
  min-height: 0;
  padding: 4px 2px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--ink) 16%, transparent) transparent;
}

.chat-thread::-webkit-scrollbar {
  width: 6px;
}

.chat-thread::-webkit-scrollbar-track {
  background: transparent;
}

.chat-thread::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 14%, transparent);
}

.chat-thread::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--ink) 28%, transparent);
}

.chat-thread::-webkit-scrollbar-button {
  display: none;
}

.chat-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.chat-message.user {
  justify-content: flex-end;
}

.chat-day-separator {
  display: flex;
  justify-content: center;
  margin: 10px 0 14px;
}

.chat-day-separator span {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.5;
}

.chat-time {
  display: block;
  margin-top: 4px;
  padding: 0 4px;
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.35;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.chat-message.user .chat-time {
  text-align: right;
}

.chat-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 13px;
  background: linear-gradient(145deg, var(--brand-1), var(--brand-2));
  color: #fffdf8;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(45, 89, 69, 0.2);
}

.chat-body {
  max-width: min(78%, 560px);
  min-width: 0;
}

.chat-message.user .chat-body {
  max-width: 82%;
}

.chat-bubble {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px 18px 18px 6px;
  background: var(--surface);
  box-shadow: var(--card-shadow-soft);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.chat-message.user .chat-bubble {
  border-color: transparent;
  border-radius: 18px 18px 6px 18px;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: none;
}

.chat-bubble p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-bubble.chat-error {
  border-color: var(--warm);
  color: var(--warm);
}

.chat-bubble.typing {
  display: flex;
  gap: 4px;
  padding: 15px 16px;
}

.chat-bubble.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing-dot 1.1s ease-in-out infinite;
}

.chat-bubble.typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.chat-bubble.typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing-dot {
  0%,
  60%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.chat-menu-layer {
  position: fixed;
  inset: 0;
  z-index: 70;
}

.chat-menu-item {
  position: fixed;
  display: grid;
  place-items: center;
  width: 104px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--warm);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.chat-menu-item:disabled {
  opacity: 0.6;
  cursor: default;
}

.chat-toast {
  position: fixed;
  left: 50%;
  bottom: calc(104px + var(--browser-bottom, 0px));
  z-index: 71;
  max-width: min(86vw, 420px);
  margin: 0;
  padding: 9px 16px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 82%, transparent);
  color: #fffdf8;
  font-size: 12.5px;
  line-height: 1.5;
  text-align: center;
  transform: translateX(-50%);
}

.receipt-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.receipt-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.receipt-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.receipt-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.receipt-card.active .receipt-action {
  color: var(--accent);
}

.receipt-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.receipt-label {
  overflow: hidden;
  font-size: 14px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receipt-amount {
  flex: 0 0 auto;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.receipt-amount.expense {
  color: var(--warm);
}

.receipt-amount.income {
  color: var(--accent);
}

.receipt-meta {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.receipt-action {
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}

.chat-action {
  margin-top: 10px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.chat-bubble .chat-ai-note {
  margin-top: 8px;
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.5;
  white-space: normal;
}

.daily-brief-label {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.offline-pill {
  display: inline-flex;
  align-items: center;
  margin: 0 6px 7px 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--warm) 12%, var(--surface));
  color: var(--warm);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.chat-message.user .offline-pill {
  background: color-mix(in srgb, #fffdf8 18%, transparent);
  color: var(--on-accent);
}

.offline-pill.failed {
  background: color-mix(in srgb, var(--warm) 20%, var(--surface));
}

.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.quick-chip {
  padding: 6px 11px;
  border: 1px solid var(--chip-border);
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--soft-ink);
  font-size: 12px;
  cursor: pointer;
}

.quick-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chat-composer {
  position: relative;
  z-index: 19;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 7px 7px 7px 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--tabbar-bg);
  box-shadow: 0 14px 40px rgba(33, 44, 36, 0.16);
  backdrop-filter: blur(14px);
}

.chat-composer input {
  flex: 1;
  min-width: 0;
  padding: 9px 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.chat-composer input::placeholder {
  color: var(--faint);
}

.send-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
}

.send-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.send-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.install-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--dashed);
  border-radius: 14px;
  background: var(--preview-bg);
  color: var(--soft-ink);
  font-size: 12px;
  line-height: 1.5;
}

.install-hint-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.text-btn {
  padding: 4px 6px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.icon-btn {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.install-card {
  margin-top: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.install-steps {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.install-steps p {
  margin: 0;
  color: var(--soft-ink);
  font-size: 12.5px;
  line-height: 1.7;
}

.stage-tag.done {
  background: var(--accent);
  color: var(--on-accent);
}

.state-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 56px 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.state-card h2 {
  margin: 0;
  font-size: 20px;
}

.state-card p {
  max-width: 360px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.loading-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.primary-btn {
  margin-top: 6px;
  padding: 10px 20px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.primary-btn:hover {
  background: var(--accent-dark);
}

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 18px 20px 0;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--hero-1) 0%, var(--hero-2) 58%, var(--hero-3) 100%);
  color: #f7f5ef;
  box-shadow: var(--hero-shadow);
}

.hero-card::after {
  content: "";
  position: absolute;
  top: -70px;
  right: -50px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  pointer-events: none;
}

.hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 12.5px;
  letter-spacing: 0.06em;
}

.hero-badge {
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.86);
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

.hero-amount {
  margin: 6px 0 12px;
  font-size: clamp(30px, 7.5vw, 42px);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

.currency {
  margin-right: 7px;
  font-size: 0.46em;
  font-weight: 500;
  opacity: 0.82;
}

.hero-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 10px 0 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.hero-split > div + div {
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
}

.hero-split span {
  display: block;
  color: rgba(255, 255, 255, 0.66);
  font-size: 11.5px;
}

.hero-split strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin: 30px 2px 14px;
}

.section-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.section-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ledger-sort {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -4px 2px 12px;
}

.ledger-filter-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 10px;
  margin: -2px 2px 10px;
  padding: 7px 10px;
  border: 1px solid var(--chip-border);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  line-height: 1.5;
}

.ledger-filter-hint > span {
  min-width: 0;
}

.ledger-filter-hint .text-btn {
  flex: 0 0 auto;
  padding: 2px 4px;
  color: var(--accent);
}

.ledger-error-inline {
  margin: 0 2px 10px;
}

.sort-chip {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.sort-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.sort-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.sort-loading {
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  animation: sort-loading-in 0.18s ease both;
}

.sort-loading .loading-dot {
  width: 8px;
  height: 8px;
}

@keyframes sort-loading-in {
  from {
    opacity: 0;
    transform: translateY(-2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.batch-notice {
  margin: -6px 2px 12px;
  color: var(--accent);
  font-size: 12px;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.empty-card {
  padding: 36px 24px 32px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.empty-card.compact {
  padding: 26px 24px;
}

.empty-art svg {
  width: 92px;
  height: 92px;
}

.empty-card h3 {
  margin: 18px 0 8px;
  font-size: 20px;
  font-weight: 650;
}

.empty-card.compact h3 {
  margin-top: 0;
}

.empty-card p {
  max-width: 360px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.try-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
}

.try-label {
  color: var(--muted);
  font-size: 12px;
}

.try-chip {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--soft-ink);
  font-size: 12px;
}

.record-list {
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  list-style: none;
}

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

.record-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 15px 18px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.record-row:hover {
  background: var(--surface-soft);
}

/* 展开编辑时不染色，避免和编辑区连成一整块 */
.record-row[aria-expanded="true"],
.record-row[aria-expanded="true"]:hover {
  background: transparent;
}

.record-item.selected .record-row {
  background: var(--accent-soft);
}

.batch-check {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
}

.batch-check.checked {
  border-color: var(--accent);
  background: var(--accent);
}

.batch-check.checked::after {
  content: '';
  width: 8px;
  height: 4px;
  border-left: 2px solid var(--on-accent);
  border-bottom: 2px solid var(--on-accent);
  transform: rotate(-45deg) translateY(-1px);
}

.batch-panel {
  position: sticky;
  top: 8px;
  z-index: 6;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--accent);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.batch-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.batch-panel-head strong {
  font-size: 14px;
}

.batch-panel .editor-grid {
  margin-top: 10px;
}

.batch-apply {
  width: 100%;
  margin-top: 12px;
}

.batch-apply:disabled {
  opacity: 0.5;
  cursor: default;
}

.batch-apply:disabled:hover {
  background: var(--accent);
}

.record-editor {
  margin: 10px 14px 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

.chat-message.chat-editing {
  flex-wrap: wrap;
}

.chat-record-editor {
  flex: 1 0 100%;
  width: 100%;
  margin: 8px 0 0;
  padding: 12px;
  background: var(--surface);
  box-shadow: var(--card-shadow-soft);
  -webkit-user-select: text;
  user-select: text;
}

.chat-record-editor .editor-grid,
.chat-record-editor .editor-type {
  margin-top: 8px;
}

.chat-record-editor .editor-actions {
  margin-top: 10px;
}

.chat-record-editor .chat-editor-type {
  margin-top: 0;
}

.chat-record-editor .chat-editor-type button {
  padding: 9px 10px;
}

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

.editor-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.editor-grid:first-child {
  margin-top: 0;
}

.editor-type {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.editor-type button {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.editor-type button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* 收支切换紧跟字段标签，和旁边的输入框同高 */
.field > .editor-type {
  flex: 1;
  margin-top: 0;
}

.field > .editor-type button {
  padding-top: 0;
  padding-bottom: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.editor-select-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.editor-select-btn::after {
  content: '';
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  margin-left: auto;
  border-right: 1.6px solid var(--muted);
  border-bottom: 1.6px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.18s ease, margin 0.18s ease;
}

.editor-select-btn.open {
  border-color: var(--accent);
}

.editor-select-btn.open::after {
  margin-top: 3px;
  transform: rotate(225deg);
}

.editor-select-btn .editor-select-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-select-btn.is-empty .editor-select-value {
  color: var(--muted);
}

.editor-select-btn:disabled {
  cursor: default;
  opacity: 0.55;
}

.editor-select-btn:disabled::after {
  display: none;
}

.editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

.editor-actions .primary-btn {
  margin-top: 0;
}

.record-editor .appearance-error {
  margin-top: 10px;
}

.record-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 18px;
  font-weight: 650;
}

.record-main {
  flex: 1;
  min-width: 0;
}

.record-main strong {
  display: block;
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-main small {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-amount {
  flex: 0 0 auto;
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.record-amount.expense {
  color: var(--warm);
}

.record-amount.income {
  color: var(--accent);
}

.stage-tag {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.preview-card {
  padding: 16px;
  border: 1px dashed var(--dashed);
  border-radius: 18px;
  background: var(--preview-bg);
}

.preview-card:last-child {
  grid-column: 1 / -1;
}

.preview-index {
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.preview-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.preview-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 16px;
  background: var(--segment-bg);
}

.segmented button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.segmented button span {
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
}

.segmented button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(45, 52, 42, 0.08);
}

.segmented button.active span {
  color: var(--accent);
}

.category-page .section-head {
  margin-top: 22px;
}

.category-page .category-toolbar {
  margin-top: 14px;
}

.category-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.category-card {
  padding: 12px 14px 11px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--card-shadow-soft);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.category-card input,
.category-card textarea {
  -webkit-user-select: text;
  user-select: text;
}

.category-card header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 8px;
}

.category-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.category-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: box-shadow 0.18s ease;
}

.category-icon:hover,
.category-icon:focus-visible {
  box-shadow: 0 0 0 2px var(--accent);
}

.category-card h3 {
  max-width: 11em;
  min-width: 0;
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.35;
}

.category-name {
  display: block;
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.category-name:hover:not(:disabled) {
  color: var(--accent);
}

.category-name:disabled {
  color: inherit;
  cursor: default;
  opacity: 1;
}

.category-count {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.chip {
  padding: 3px 8px;
  border: 1px solid var(--chip-border);
  border-radius: 8px;
  background: var(--chip-bg);
  color: var(--soft-ink);
  font-size: 12px;
  line-height: 1.35;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.avatar {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--brand-1), var(--brand-2));
  color: #fffdf8;
  font-size: 23px;
  font-weight: 650;
}

.profile-main {
  flex: 1;
  min-width: 0;
}

.profile-main h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
}

.profile-main p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.persona-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.persona-preview {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  overflow: hidden;
  border-radius: 20px;
  background: linear-gradient(145deg, var(--brand-1), var(--brand-2));
  color: #fffdf8;
  font-size: 28px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(45, 89, 69, 0.2);
}

.persona-preview-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.persona-preview-main strong {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.persona-preview-main small {
  color: var(--muted);
  font-size: 11.5px;
}

.persona-upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 5px;
}

.persona-name-field {
  margin-top: 16px;
}

.persona-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.persona-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.appearance-card,
.tone-card {
  margin-top: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* 折叠状态下整张卡片可点，点一下就展开；不额外改边框，避免点击时闪一圈颜色 */
.appearance-card.is-collapsed,
.tone-card.is-collapsed,
.install-card.is-collapsed {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.appearance-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

/* 点击表头也能展开/折叠，不出现移动端点击高亮 */
.card-head-toggle {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.appearance-head > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.section-head > div:first-child {
  min-width: 0;
}

.appearance-head > :not(:first-child),
.section-head > :not(:first-child) {
  flex: 0 0 auto;
  white-space: nowrap;
}

.appearance-head h2,
.appearance-head p {
  overflow-wrap: anywhere;
}

.appearance-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
}

.appearance-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.save-state {
  flex: 0 0 auto;
  min-width: 44px;
  padding-top: 2px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

/* 卡片右上角的收起/展开箭头 */
.card-collapse {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--soft-ink);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.card-collapse svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card-collapse:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.card-collapse.open {
  transform: rotate(180deg);
}

.save-state.saved {
  color: var(--accent);
}

.save-state.error {
  color: var(--warm);
}

.tone-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.tone-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--soft-ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.tone-chip strong {
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 650;
}

.tone-chip small {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.tone-chip:hover {
  border-color: var(--faint);
}

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

.tone-chip.active strong {
  color: var(--accent);
}

.tone-chip.active small {
  color: var(--soft-ink);
}

.tone-preview {
  margin-top: 14px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.tone-preview-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.02em;
}

.tone-preview p {
  margin: 7px 0 0;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.75;
}

.tone-preview small {
  display: block;
  margin-top: 8px;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.5;
}

.ai-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.ai-note {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.ai-advanced {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.ai-advanced summary {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.ai-advanced-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.ai-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ai-actions .primary-btn {
  margin-top: 0;
}

.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  flex: 0 0 48px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.toggle span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.18s ease, background 0.18s ease;
}

.toggle.on {
  border-color: var(--accent);
  background: var(--accent);
}

.toggle.on span {
  transform: translateX(20px);
  background: #fff;
}

.toggle:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.daily-brief-actions {
  margin-top: 14px;
}

.ai-status {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  line-height: 1.55;
}

.ai-status.error {
  color: var(--warm);
}

.ai-privacy {
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.6;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.theme-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--soft-ink);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.theme-chip:hover {
  border-color: var(--faint);
}

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

.theme-swatch {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.background-block {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.background-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.background-head > :not(:first-child) {
  flex: 0 0 auto;
  white-space: nowrap;
}

.background-head strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.background-head small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

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

.image-history {
  margin-top: 14px;
}

.image-history-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.image-history-head strong {
  font-size: 13px;
  font-weight: 600;
}

.image-history-head small {
  color: var(--muted);
  font-size: 11px;
}

.image-history-grid {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.image-history-item {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: 104px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  -webkit-tap-highlight-color: transparent;
}

.image-history-main {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.image-history-main:disabled {
  cursor: default;
}

.image-history-item img {
  display: block;
  width: 100%;
  height: 62px;
  object-fit: cover;
}

.image-history-item span {
  display: block;
  padding: 4px 0 5px;
  font-size: 10.5px;
  line-height: 1;
}

.image-history-item:not(.current):hover {
  border-color: var(--accent);
  color: var(--accent);
}

.image-history-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(28, 32, 29, 0.55);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.image-history-delete:hover {
  background: rgba(163, 57, 44, 0.9);
}

.image-history-delete:disabled {
  opacity: 0.5;
  cursor: default;
}

.image-history-item.current {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.image-history-item.current span {
  font-weight: 600;
}

.image-history.avatar-history .image-history-item img {
  height: 58px;
}

.ghost-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--soft-ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease;
}

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

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  opacity: 0;
  clip: rect(0 0 0 0);
}

.ghost-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.ghost-btn.danger:hover {
  border-color: var(--warm);
  color: var(--warm);
}

.ghost-btn.busy {
  opacity: 0.6;
  pointer-events: none;
}

.slider-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.slider-row input[type="range"] {
  width: 100%;
  height: 24px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.slider-row span {
  color: var(--soft-ink);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.slider-row.disabled {
  opacity: 0.4;
}

.slider-row.disabled input {
  cursor: not-allowed;
}

.appearance-error {
  margin: 12px 0 0;
  color: var(--warm);
  font-size: 12px;
  line-height: 1.5;
}

.settings-card {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 20px;
}

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

.setting-row strong {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
}

.setting-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.setting-row > button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.setting-panel {
  display: block;
  background: var(--surface-soft);
}

.settings-card .setting-panel {
  margin: 0;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.export-actions a {
  text-decoration: none;
}

.soon-tag {
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.version-tag {
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.footnote {
  margin: 18px 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  /* --browser-bottom 补浏览器底栏高度；导航底色一直铺到屏幕底，不露底下页面 */
  padding: 6px 6px calc(8px + var(--browser-bottom, 0px) + env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: linear-gradient(var(--tabbar-bg), var(--tabbar-bg)), var(--bg);
  box-shadow: 0 -10px 30px rgba(33, 44, 36, 0.12);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
  transition: opacity 0.18s ease, transform 0.18s ease, padding-bottom 0.18s ease;
}

/* 键盘弹起时收起底部导航，避免挡住正在编辑的表单 */
body.kb-open .tabbar {
  opacity: 0;
  transform: translate(-50%, 26px);
  pointer-events: none;
}

/* 键盘弹起时补一段上滚空间，iOS 不缩布局视口时也能把编辑区顶上去 */
body.kb-open .app-shell:not(.chat-open) {
  padding-bottom: calc(140px + var(--kb-inset, 0px) + env(safe-area-inset-bottom));
}

body.kb-open .app-shell.chat-open {
  padding-bottom: calc(10px + var(--kb-gap, 0px) + env(safe-area-inset-bottom));
}

.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px 6px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: background 0.18s ease, color 0.18s ease;
}

/* 底部导航点按不闪焦点框，选中态由背景色表示 */
.tab:focus,
.tab:focus-visible {
  outline: none;
}

.tab svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab span {
  font-size: 12px;
  font-weight: 600;
}

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

.tab.active svg {
  stroke-width: 2.1;
}

.ledger-filter-card {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--card-shadow-soft);
}

.ledger-page .section-head {
  margin-top: 20px;
  scroll-margin-top: 12px;
}

.ledger-page .section-head-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.filter-periods {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-periods::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: 0 0 auto;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--chip-border);
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--soft-ink);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.filter-custom {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
  gap: 8px;
  margin-top: 10px;
}

.filter-custom .primary-btn {
  margin-top: 0;
  padding: 9px 14px;
}

.filter-selects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.filter-dropdown {
  position: relative;
}

.filter-select-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  min-height: 36px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.filter-select-key {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.filter-select-btn::after {
  content: '';
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  margin-left: auto;
  border-right: 1.6px solid var(--muted);
  border-bottom: 1.6px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.18s ease, margin 0.18s ease;
}

.filter-select-btn.open {
  border-color: var(--accent);
}

.filter-select-btn.open::after {
  margin-top: 3px;
  transform: rotate(225deg);
}

.field .filter-select-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 30;
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.filter-menu.up {
  top: auto;
  bottom: calc(100% + 6px);
}

.filter-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  right: 0;
  left: auto;
  width: min(260px, calc(100vw - 40px));
}

.filter-selects > .filter-dropdown:nth-child(odd) .filter-menu-grid {
  right: auto;
  left: 0;
}

.filter-menu-group {
  grid-column: 1 / -1;
  margin: 6px 8px 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.filter-menu-group:first-child {
  margin-top: 2px;
}

.filter-option {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  overflow: hidden;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--soft-ink);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.filter-option:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.filter-option.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}

.filter-option-wide {
  grid-column: 1 / -1;
}

.editor-select-menu {
  position: fixed;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  padding: 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.editor-select-menu .filter-option {
  min-height: 36px;
}

.filter-keyword {
  margin-top: 8px;
}

.filter-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.filter-foot > button,
.batch-panel-head > button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.day-group {
  transition: opacity 0.18s ease;
}

.day-group + .day-group {
  margin-top: 18px;
}

/* 重新排序时旧列表先淡下去，等新数据回来再恢复 */
.day-group.is-sorting,
.load-more.is-sorting {
  opacity: 0.5;
}

.day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 4px 8px;
  color: var(--muted);
  font-size: 12px;
}

.day-head strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.load-more {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 16px;
  padding: 11px;
}

.chip-custom {
  display: inline-flex;
  align-items: center;
  padding: 0;
  overflow: hidden;
}

.chip-name {
  padding: 3px 8px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.chip-name:hover {
  color: var(--accent);
}

.chip-add {
  border-style: dashed;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}

.chip-add:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.category-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 4px 12px;
}

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

.category-sort-hint {
  margin-left: auto;
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.5;
  white-space: nowrap;
}

.category-toolbar button:disabled {
  cursor: default;
  opacity: 0.55;
}

.category-sort-bar {
  position: sticky;
  top: 8px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 4px;
  padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 13px;
  background: color-mix(in srgb, var(--accent-soft) 75%, var(--surface));
  color: var(--accent-dark);
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: var(--card-shadow-soft);
}

.category-sort-bar .primary-btn {
  flex: 0 0 auto;
  margin-top: 0;
  padding: 7px 14px;
  font-size: 12px;
}

.category-card.sorting {
  cursor: grab;
  touch-action: none;
  user-select: none;
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

.category-card.sorting:active {
  cursor: grabbing;
}

.category-card.sorting header button,
.category-card.sorting .category-actions,
.category-card.sorting .chips button,
.category-card.sorting .category-editor,
.category-card.sorting .budget-editor {
  pointer-events: none;
}

.category-card.dragging {
  opacity: 0.55;
}

.category-card.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

body.category-dragging {
  user-select: none;
}

.category-error-global {
  margin: 0 4px 10px;
}

.budget-status,
.budget-summary {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
}

.budget-summary {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
}

.budget-status.over,
.budget-summary.over {
  border-color: var(--warm);
}

.budget-status-top,
.budget-summary-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.budget-status-top strong,
.budget-summary-top strong {
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.budget-status.over .budget-status-top strong,
.budget-summary.over .budget-summary-top strong {
  color: var(--warm);
}

.budget-bar {
  height: 6px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--segment-bg);
}

.budget-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.25s ease;
}

.budget-bar span.over {
  background: var(--warm);
}

.budget-status-meta,
.budget-summary-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 5px 12px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.budget-editor {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.budget-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.category-custom-tag {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 650;
}

.category-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
}

.category-detail {
  padding: 1px 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.4;
  cursor: pointer;
}

.category-detail.danger {
  color: var(--warm);
}

.top-editor {
  margin-bottom: 12px;
}

.category-editor {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.category-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.category-editor-actions .primary-btn {
  margin-top: 0;
  padding: 8px 14px;
}

.category-editor-delete {
  margin-right: auto;
  color: var(--warm);
}

.category-editor-delete:hover {
  border-color: var(--warm);
  color: var(--warm);
}

.confirm-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(360px, 100%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.confirm-panel h3 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 650;
}

.confirm-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.category-editor-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.emoji-field {
  margin-top: 10px;
}

.emoji-preview {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 10px;
  border-radius: 14px;
  background: var(--accent-soft);
  font-size: 24px;
  line-height: 1;
}

.emoji-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.emoji-tab {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--soft-ink);
  font: inherit;
  font-size: 11.5px;
  line-height: 1.4;
}

.emoji-tab.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 600;
}

.emoji-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 168px;
  overflow-y: auto;
  padding: 2px;
}

.emoji-choice {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 18px;
  line-height: 1;
}

.emoji-choice.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.emoji-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.emoji-custom input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.category-notice {
  margin: 0 4px 12px;
  color: var(--accent);
  font-size: 12px;
  line-height: 1.6;
}

.category-hint {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.query-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.query-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.query-row:hover {
  border-color: var(--accent);
}

.query-rank {
  color: var(--faint);
  font-size: 11px;
  font-weight: 650;
}

.query-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.query-count {
  color: var(--muted);
  font-size: 11px;
}

.query-row strong {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

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

.import-template-row a {
  text-decoration: none;
}

.import-start-actions {
  margin-top: 12px;
}

.import-hint {
  margin: 8px 0 0;
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.7;
}

.import-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.import-file-row > button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.import-file-row > span {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.import-file-row strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-file-row small {
  color: var(--muted);
  font-size: 10.5px;
}

.import-section {
  margin-top: 8px;
}

.import-mapping {
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--preview-bg);
}

.import-mapping summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
}

.import-mapping summary span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
}

.import-mapping-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.import-mapping-grid .field span em {
  color: var(--warm);
  font-style: normal;
}

.import-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.import-actions .primary-btn {
  margin-top: 0;
}

.import-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 14px 0 8px;
}

.import-stat {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
}

.import-stat.ok {
  background: var(--accent-soft);
  color: var(--accent);
}

.import-stat.dup {
  background: var(--segment-bg);
  color: var(--muted);
}

.import-stat.bad {
  background: var(--accent-soft);
  color: var(--warm);
}

.import-groups,
.import-preview-rows {
  margin-top: 14px;
}

.import-groups h3,
.import-preview-rows h3 {
  margin: 0 0 5px;
  font-size: 13px;
  font-weight: 650;
}

.import-preview-rows h3 small {
  color: var(--faint);
  font-size: 10px;
  font-weight: 500;
}

.import-group {
  margin-top: 9px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.import-group-head span {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.import-group-head strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-group-head small {
  color: var(--muted);
  font-size: 10.5px;
}

.import-group-action {
  width: 100%;
  margin-top: 8px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
}

.import-map-selects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.import-map-selects select {
  width: 100%;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
}

.import-group-hint {
  margin: 7px 0 0;
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.6;
}

.import-row-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 360px;
  margin-top: 8px;
  padding-right: 2px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.import-row {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.import-row.duplicate {
  background: var(--surface-soft);
}

.import-row.invalid {
  border-color: var(--dashed);
}

.import-status {
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 9.5px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.import-status.duplicate {
  background: var(--segment-bg);
  color: var(--muted);
}

.import-status.invalid {
  background: var(--surface-soft);
  color: var(--warm);
}

.import-row-main {
  min-width: 0;
}

.import-row-main strong {
  display: block;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-row-main small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
}

.import-row-main .import-reason {
  color: var(--warm);
}

.import-commit {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.import-commit .primary-btn {
  margin-top: 0;
}

.import-receipt {
  margin-top: 10px;
}

.import-receipt-hero {
  padding: 14px;
  border-radius: 16px;
  background: var(--accent-soft);
}

.import-receipt-hero .stage-tag {
  display: inline-block;
  margin-bottom: 7px;
}

.import-receipt-hero strong {
  display: block;
  font-size: 17px;
}

.import-receipt-hero p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}

.import-created,
.import-errors {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
}

.import-created strong,
.import-errors strong {
  font-size: 11.5px;
}

.import-created p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.import-errors ul {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--warm);
  font-size: 11px;
  line-height: 1.7;
}

.dash-page {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding-bottom: 12px;
}

.dash-page-head {
  align-items: flex-start;
}

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

.dash-loading-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.dash-loading-tag .loading-dot {
  width: 7px;
  height: 7px;
}

.dash-period-card {
  padding: 12px 14px 11px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--pill-bg);
  backdrop-filter: blur(10px);
}

.dash-period-card .filter-periods {
  margin: 0;
}

.dash-period-card .filter-custom {
  margin-top: 10px;
}

.dash-period-card .dash-budget {
  margin-top: 12px;
  padding-top: 12px;
}

.dash-period-card .dash-budget-head .inline-link {
  font-size: 17px;
}

.dash-period-card .dash-period-empty {
  margin: 12px 0 0;
  padding: 10px 2px 0;
  border: 0;
  border-top: 1px dashed var(--line);
  border-radius: 0;
  background: transparent;
  font-size: 12px;
  text-align: left;
}

.dash-state {
  margin-top: 16px;
}

.dash-card {
  overflow: hidden;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--card-shadow-soft);
}

.dash-quick-card {
  margin-top: 16px;
}

.dash-quick-card + .dash-period-card {
  margin-top: 12px;
}

.dash-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 12px;
}

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

.dash-kicker {
  display: block;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.dash-card-title h3 {
  margin: 3px 0 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.dash-card-body {
  padding: 0 18px 18px;
}

.dash-collapse {
  flex: 0 0 auto;
  padding: 4px 2px 4px 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.dash-chevron {
  display: inline-block;
  margin-left: 3px;
  font-size: 13px;
  transition: transform 0.2s ease;
}

.dash-chevron.open {
  transform: rotate(180deg);
}

.dash-quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  padding: 0 14px 14px;
}

.quick-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 13px 13px 11px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.quick-tile:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.quick-label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
}

.quick-tile strong {
  overflow: hidden;
  color: var(--accent);
  font-size: clamp(20px, 5.6vw, 28px);
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-tile strong small {
  margin-right: 2px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0.7;
}

.quick-meta {
  overflow: hidden;
  color: var(--faint);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-tile.tone-warm strong {
  color: var(--warm);
}

.quick-tile.tone-deep strong {
  color: var(--accent-dark);
}

.quick-tile.tone-year {
  grid-column: span 2;
  border-color: transparent;
  background: linear-gradient(135deg, var(--hero-1) 0%, var(--hero-2) 60%, var(--hero-3) 100%);
  color: #f7f5ef;
  box-shadow: var(--hero-shadow);
}

.quick-tile.tone-year .quick-label,
.quick-tile.tone-year .quick-meta {
  color: rgba(255, 255, 255, 0.7);
}

.quick-tile.tone-year strong {
  color: #fffdf8;
}

.negative {
  color: var(--warm) !important;
}

.dash-budget {
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px dashed var(--line);
}

.dash-budget-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.dash-budget-head .inline-link {
  margin-left: 3px;
  font-size: 15px;
  font-weight: 650;
}

.dash-budget-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.dash-budget-meta strong {
  color: var(--accent);
  font-size: 11.5px;
}

.dash-budget-meta strong.over {
  color: var(--warm);
}

.dash-budget .budget-bar {
  margin-top: 8px;
}

.dash-budget-empty {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
}

.inline-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.inline-link:hover {
  text-decoration: underline;
}

.dash-empty {
  margin: 0;
  padding: 22px 12px;
  border: 1px dashed var(--dashed);
  border-radius: 14px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.dash-control-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dash-seg {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 12px;
  background: var(--segment-bg);
}

.dash-seg button {
  padding: 6px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.dash-seg button.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(40, 50, 40, 0.08);
}

.dash-seg.compact button {
  padding: 6px 8px;
  font-size: 11px;
}

.dash-note {
  margin: 9px 0 0;
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.6;
}

.dash-note.error {
  color: var(--warm);
}

.dash-trend-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 11.5px;
}

.dash-trend-head .inline-link {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.trend-chart {
  margin-top: 8px;
}

.trend-axis {
  display: flex;
  justify-content: space-between;
  padding: 0 2px 5px;
  color: var(--faint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.trend-plot {
  position: relative;
  height: 172px;
  padding: 0 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.trend-inner {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: max-content;
  min-width: 100%;
  height: 100%;
}

.trend-zero {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  height: 1px;
  background: var(--line);
  pointer-events: none;
}

.trend-average {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background-image: repeating-linear-gradient(
    90deg,
    color-mix(in srgb, var(--accent) 78%, transparent) 0 4px,
    transparent 4px 8px
  );
  pointer-events: none;
}

.trend-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.trend-legend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  margin-left: auto;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.trend-legend:hover {
  border-color: var(--accent);
}

.trend-legend.off {
  background: transparent;
  color: var(--faint);
}

.trend-legend-mark {
  flex: 0 0 16px;
  width: 16px;
  height: 1px;
  background-image: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px);
  opacity: 0.9;
}

.trend-legend.off .trend-legend-mark {
  opacity: 0.45;
}

.trend-col {
  position: relative;
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  min-width: 6px;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.trend-bar-area {
  position: relative;
  display: block;
  flex: 0 0 150px;
  width: 100%;
  height: 150px;
}

.trend-bar {
  position: absolute;
  left: 20%;
  width: 60%;
  min-width: 3px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--accent) 84%, #000) 0%,
    var(--accent) 46%,
    color-mix(in srgb, var(--accent) 82%, #fff) 100%
  );
  transition: filter 0.15s ease, height 0.2s ease;
}

.trend-bar.negative,
.trend-chart.metric-balance .trend-bar.negative {
  border-radius: 0 0 4px 4px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--warm) 84%, #000) 0%,
    var(--warm) 46%,
    color-mix(in srgb, var(--warm) 82%, #fff) 100%
  );
}

.trend-bar.zero {
  display: none;
}

.trend-value {
  position: absolute;
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
  color: var(--soft-ink);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 0 3px var(--surface), 0 0 2px var(--surface);
}

.trend-value.prominent {
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
}

.trend-chart.metric-balance .trend-value.negative {
  color: var(--warm);
}

.trend-chart.ultra .trend-value:not(.prominent) {
  display: none;
}

.trend-col:hover .trend-bar {
  filter: brightness(1.12);
}

.trend-col-label {
  position: absolute;
  top: 155px;
  left: 50%;
  display: block;
  width: max-content;
  height: 17px;
  color: var(--faint);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transform: translateX(-50%);
}

.dash-donut-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.dash-donut {
  position: relative;
  flex: 0 0 168px;
  width: 168px;
  height: 168px;
  border-radius: 50%;
}

.dash-donut::after {
  content: "";
  position: absolute;
  inset: 24px;
  border-radius: 50%;
  background: var(--surface);
}

.dash-donut-center {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.dash-donut-center span {
  color: var(--muted);
  font-size: 10.5px;
}

.dash-donut-center strong {
  max-width: calc(100% - 48px);
  overflow: hidden;
  font-size: 18.5px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-legend {
  width: 100%;
}

.dash-legend-row {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto auto 42px 8px;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 8px 3px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dash-legend-row:last-child {
  border-bottom: 0;
}

.dash-legend-row:hover {
  background: var(--surface-soft);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
}

.legend-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-meta {
  color: var(--faint);
  font-size: 10px;
  white-space: nowrap;
}

.dash-legend-row strong {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.legend-percent {
  color: var(--muted);
  font-size: 10.5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.legend-chevron {
  color: var(--faint);
  font-size: 14px;
  line-height: 1;
  text-align: right;
}

.dash-category-hint {
  margin: 10px 2px 0;
  color: var(--faint);
  font-size: 11px;
}

.dash-compare-grid {
  display: grid;
  gap: 11px;
}

.dash-compare-block {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

.dash-compare-block > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.dash-compare-block > header span {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.dash-compare-block > header strong {
  font-size: 14px;
}

.dash-compare-block > header small {
  color: var(--muted);
  font-size: 10px;
}

.dash-compare-range {
  text-align: right;
}

.dash-compare-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) minmax(0, 1fr) 48px;
  align-items: center;
  gap: 5px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.dash-compare-row.head {
  padding: 4px 0;
  border-top: 0;
  color: var(--faint);
  font-size: 9.5px;
}

.dash-compare-row > span:first-child {
  color: var(--muted);
  font-weight: 600;
}

.dash-compare-row button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.dash-compare-row button.base {
  color: var(--muted);
}

.dash-compare-row button:hover {
  color: var(--accent);
  text-decoration: underline;
}

.dash-compare-row strong {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.dash-compare-row strong.up {
  color: var(--warm);
}

.dash-compare-row strong.down {
  color: var(--accent);
}

.dash-compare-row strong.flat {
  color: var(--faint);
}

.dash-compare-bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 7px;
}

.dash-compare-bar {
  display: block;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--segment-bg);
}

.dash-compare-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--warm);
}

.dash-compare-bar.base span {
  background: var(--faint);
}

.dash-calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 0 0 10px;
}

.dash-calendar-toolbar strong {
  min-width: 86px;
  font-size: 14px;
  text-align: center;
}

.cal-nav {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--soft-ink);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.cal-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.dash-calendar-weekdays,
.dash-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.dash-calendar-weekdays {
  margin-bottom: 4px;
  color: var(--faint);
  font-size: 9.5px;
  text-align: center;
}

.dash-calendar-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 43px;
  padding: 4px 2px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.dash-calendar-day::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
}

.dash-calendar-day > * {
  position: relative;
  z-index: 1;
}

.dash-calendar-day.heat-1::before {
  opacity: 0.06;
}

.dash-calendar-day.heat-2::before {
  opacity: 0.16;
}

.dash-calendar-day.heat-3::before {
  opacity: 0.28;
}

.dash-calendar-day.heat-4::before {
  opacity: 0.42;
}

.dash-calendar-day.heat-5::before {
  opacity: 0.58;
}

.dash-calendar-day.heat-6::before {
  opacity: 1;
}

/* 最高档直接铺满主色，和下一档拉开明显差距 */
.dash-calendar-day.heat-6 {
  border-color: transparent;
  color: var(--on-accent);
}

.dash-calendar-day.empty {
  border-color: transparent;
  background: transparent;
  cursor: default;
}

.dash-calendar-day:not(.empty):hover {
  border-color: var(--accent);
}

.cal-day {
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.cal-amount {
  color: var(--soft-ink);
  font-size: 8.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

/* 深色格子上金额改成正文色，保证小字看得清 */
.dash-calendar-day.heat-3 .cal-amount,
.dash-calendar-day.heat-4 .cal-amount,
.dash-calendar-day.heat-5 .cal-amount {
  color: var(--ink);
}

.dash-calendar-day.heat-6 .cal-amount {
  color: var(--on-accent);
  opacity: 0.82;
}

/* 金额位数多时缩小一点，避免撑出格子 */
.cal-amount.dense {
  font-size: 7.5px;
  letter-spacing: -0.2px;
}

.dash-calendar-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 11.5px;
}

.dash-calendar-summary .inline-link {
  font-size: 13px;
}

.dash-platform-list {
  display: flex;
  flex-direction: column;
}

.dash-platform-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dash-platform-row:last-child {
  border-bottom: 0;
}

.dash-platform-row:hover {
  background: var(--surface-soft);
}

.platform-rank {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
}

.platform-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.platform-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.platform-top strong {
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platform-top span {
  color: var(--faint);
  font-size: 10px;
  white-space: nowrap;
}

.platform-bar {
  display: block;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--segment-bg);
}

.platform-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--brand-1));
}

.platform-amount {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dash-summary-card {
  background: linear-gradient(150deg, var(--accent-soft), var(--surface) 62%);
}

.dash-status-tag {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--segment-bg);
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.dash-status-tag.ai {
  background: var(--accent);
  color: var(--on-accent);
}

.dash-summary-text p {
  margin: 0 0 8px;
  font-size: 14.5px;
  line-height: 1.8;
}

.dash-summary-text p:last-child {
  margin-bottom: 0;
}

.dash-summary-text .dash-empty {
  font-size: 13px;
}

.dash-summary-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}

.dash-summary-actions .ghost-btn {
  margin: 0;
}

.dash-summary-actions .dash-note {
  flex: 1;
  min-width: 180px;
  margin: 0;
  text-align: right;
}

@media (min-width: 640px) {
  .app-shell {
    padding: calc(30px + env(safe-area-inset-top)) 28px calc(140px + env(safe-area-inset-bottom));
  }

  /* 悬浮导航距底 14px + 约 70px 高，留白要给输入框再留出呼吸间隙 */
  .app-shell.chat-open {
    padding-bottom: calc(100px + env(safe-area-inset-bottom));
  }

  /* 电脑/平板没有浏览器底栏，恢复悬浮胶囊样式 */
  .tabbar {
    bottom: calc(14px + env(safe-area-inset-bottom));
    width: min(calc(100% - 28px), 560px);
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: linear-gradient(var(--tabbar-bg), var(--tabbar-bg)), var(--bg);
    box-shadow: 0 14px 40px rgba(33, 44, 36, 0.16);
    transition: opacity 0.18s ease, transform 0.18s ease;
  }

  .topbar {
    padding-bottom: 24px;
  }

  .filter-periods {
    flex-wrap: wrap;
    gap: 7px;
  }

  .filter-chip {
    flex: 0 0 auto;
    padding: 7px 12px;
    font-size: 12.5px;
  }

  .filter-selects {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

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

  .preview-card:last-child {
    grid-column: auto;
  }

  .dash-card-head {
    padding: 17px 20px 13px;
  }

  .dash-card-body {
    padding: 0 20px 20px;
  }

  .dash-quick-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 0 18px 18px;
  }

  .dash-donut-layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 22px;
  }

  .dash-legend {
    flex: 1;
    min-width: 0;
  }

  .dash-compare-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-calendar-day {
    min-height: 50px;
  }

  .cal-amount {
    font-size: 9px;
  }
}

@media (max-width: 420px) {
  .hero-card {
    padding: 16px 18px 0;
  }

  .hero-split {
    gap: 12px;
  }

  .hero-split > div + div {
    padding-left: 12px;
  }

  .empty-card {
    padding: 30px 18px 28px;
  }

  .editor-grid,
  .editor-grid.three {
    grid-template-columns: 1fr;
  }

  .chat-record-editor .editor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-custom {
    grid-template-columns: 1fr 1fr auto;
  }

  .filter-custom .primary-btn {
    width: auto;
  }

  .chat-body {
    max-width: 82%;
  }

  .chat-message.user .chat-body {
    max-width: 86%;
  }

  .dash-card-head {
    padding: 14px 14px 10px;
  }

  .dash-card-body {
    padding: 0 14px 14px;
  }

  .dash-quick-grid {
    gap: 8px;
    padding: 0 12px 12px;
  }

  .quick-tile {
    padding: 11px 11px 10px;
  }

  .quick-tile strong {
    font-size: 20px;
  }

  .dash-compare-row {
    grid-template-columns: 32px minmax(0, 1fr) minmax(0, 1fr) 42px;
    gap: 4px;
  }

  .dash-compare-row button,
  .dash-compare-row strong {
    font-size: 11px;
  }

  .dash-legend-row {
    grid-template-columns: 9px minmax(0, 1fr) auto 38px 8px;
  }

  .legend-meta {
    display: none;
  }

  .dash-donut {
    width: 150px;
    height: 150px;
    flex-basis: 150px;
  }

  .dash-calendar-day {
    min-height: 40px;
  }

  .cal-amount {
    font-size: 8px;
  }
}

/* 手机端账本明细编辑：两列紧凑排布，保存按钮不用滑动就能看到 */
@media (max-width: 560px) {
  .image-history-grid {
    flex-wrap: wrap;
  }

  .image-history-item {
    flex: 0 1 calc((100% - 16px) / 3);
    max-width: none;
  }

  .ledger-record-editor {
    margin: 10px 10px 12px;
    padding: 10px;
    border-radius: 14px;
  }

  .ledger-record-editor .editor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
  }

  .ledger-record-editor .editor-grid:first-child {
    margin-top: 0;
  }

  .ledger-record-editor .field {
    gap: 4px;
  }

  .ledger-record-editor .field span {
    font-size: 11px;
  }

  .ledger-record-editor .field input,
  .ledger-record-editor .field select {
    padding: 7px 9px;
    border-radius: 9px;
    font-size: 13.5px;
  }

  .ledger-record-editor .field .editor-select-btn {
    padding: 7px 9px;
    border-radius: 9px;
  }

  .ledger-record-editor .field .editor-select-value {
    font-size: 13.5px;
  }

  .ledger-record-editor .field > .editor-type button {
    border-radius: 9px;
    font-size: 12.5px;
  }

  .ledger-record-editor .editor-actions {
    margin-top: 10px;
  }

  .batch-panel .editor-grid {
    gap: 8px;
    margin-top: 8px;
  }

  .batch-panel .field {
    gap: 4px;
  }

  .batch-panel .field span {
    font-size: 11px;
  }

  .batch-panel .field .editor-select-btn {
    padding: 7px 9px;
    border-radius: 9px;
  }

  .batch-panel .field .editor-select-value {
    font-size: 13.5px;
  }
}

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

/* P5 账号、登录与隐私 */
.auth-shell {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 460px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(38px + env(safe-area-inset-top)) 20px calc(38px + env(safe-area-inset-bottom));
}

.auth-card {
  width: 100%;
  padding: 26px 24px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.auth-brand .brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.auth-brand .brand-text strong {
  font-size: 16px;
}

.auth-brand .brand-text small {
  color: var(--muted);
  font-size: 11.5px;
}

.auth-card h1 {
  margin: 0 0 18px;
  font-size: 24px;
  letter-spacing: -0.01em;
}

.auth-card .field {
  margin-bottom: 12px;
}

.auth-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 14px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.auth-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.auth-submit {
  width: 100%;
  margin-top: 6px;
  padding: 12px 18px;
  font-size: 15px;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  margin-top: 14px;
}

.auth-error {
  margin: 10px 0 0;
  color: #a33f2f;
  font-size: 12.5px;
  line-height: 1.55;
}

.auth-notice {
  margin: 10px 0 0;
  color: var(--accent);
  font-size: 12.5px;
  line-height: 1.55;
}

.auth-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.auth-dev {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px dashed var(--accent);
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12.5px;
  line-height: 1.6;
  word-break: break-all;
}

.auth-dev a {
  color: var(--accent-dark);
  font-weight: 700;
}

.auth-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 4px;
}

.auth-code-row .field {
  margin-bottom: 0;
}

.auth-code-row .ghost-btn {
  height: 37px;
  margin-bottom: 1px;
  white-space: nowrap;
}

.auth-foot {
  margin: 0;
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.6;
  text-align: center;
}

.privacy-shell {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 30px 16px calc(60px + env(safe-area-inset-bottom));
  overflow-y: auto;
  background: rgba(20, 25, 22, 0.46);
  backdrop-filter: blur(6px);
}

.privacy-card {
  position: relative;
  max-width: 560px;
}

.privacy-card h1 {
  padding-right: 28px;
}

.privacy-card h2 {
  margin: 20px 0 6px;
  font-size: 15px;
}

.privacy-card p {
  margin: 0;
  color: var(--soft-ink);
  font-size: 13px;
  line-height: 1.75;
}

.privacy-card .auth-submit {
  margin-top: 22px;
}

.privacy-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.account-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 14px;
}

.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-soft);
  font-size: 13px;
}

.account-row > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.account-row strong {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.account-email-form,
.account-password-form {
  margin-top: 12px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.account-email-form .field,
.account-password-form .field {
  margin-bottom: 10px;
}

.account-email-form .auth-code-row .field {
  margin-bottom: 0;
}

.account-email-form .primary-btn,
.account-password-form .primary-btn {
  margin-top: 10px;
}

.account-password-form {
  margin-bottom: 14px;
}

.account-rows .account-email-form,
.account-rows .account-password-form {
  margin-top: 0;
  margin-bottom: 0;
}

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

.account-actions .primary-btn {
  margin-top: 0;
}

.account-card .account-actions .primary-btn {
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 12px;
}

.session-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.session-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.session-main {
  flex: 1;
  min-width: 0;
}

.session-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.session-title strong {
  font-size: 13.5px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.session-current,
.session-count {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
}

.session-current {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}

.session-count {
  background: var(--surface);
  color: var(--muted);
}

.session-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.session-row .text-btn {
  flex: 0 0 auto;
}

.session-empty,
.notice-empty {
  margin: 14px 0 0;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.invite-card .primary-btn.small {
  margin-top: 0;
  padding: 8px 14px;
  font-size: 12px;
  white-space: nowrap;
}

.admin-entry-btn {
  flex: 0 0 auto;
  margin-top: 0;
  padding: 8px 14px;
  font-size: 12px;
}

.admin-page-head {
  align-items: center;
}

.admin-back-btn {
  margin-top: 0;
  padding: 8px 14px;
  font-size: 12px;
}

.admin-confirm-card .field,
.admin-entry-gate .field {
  margin: 12px 0;
}

.admin-stats-periods {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.admin-stats-card .appearance-head {
  flex-wrap: wrap;
}

.admin-stats-period {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--soft-ink);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.admin-stats-period:hover {
  border-color: var(--faint);
}

.admin-stats-period.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.admin-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.admin-stat span {
  color: var(--muted);
  font-size: 11.5px;
}

.admin-stat strong {
  color: var(--ink);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.admin-stat small {
  color: var(--faint);
  font-size: 11px;
}

@media (max-width: 560px) {
  .admin-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .admin-stat {
    padding: 9px;
    border-radius: 12px;
  }

  .admin-stat span {
    font-size: 10.5px;
  }

  .admin-stat strong {
    font-size: 20px;
  }

  .admin-stat small {
    font-size: 10px;
  }
}

.admin-invite-portal-card .ghost-btn {
  text-decoration: none;
}

.invite-portal-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.invite-portal-controls .field {
  min-width: 110px;
  margin: 0;
}

.invite-portal-controls .primary-btn {
  margin-top: 0;
}

.invite-portal-toggle {
  margin-left: auto;
  white-space: nowrap;
}

.invite-portal-toggle.pause {
  background: #b45309;
  color: #fffdf8;
}

.invite-portal-toggle.pause:hover {
  background: #92400e;
}

.invite-portal-controls .primary-btn:disabled {
  cursor: default;
  opacity: 0.6;
}

.invite-portal-recent {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.invite-portal-recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 6px;
  color: var(--faint);
  font-size: 11px;
}

.invite-portal-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 10px;
  padding: 9px 2px;
  border-top: 1px dashed var(--line);
}

.invite-portal-recent-head + .invite-portal-row {
  border-top: 0;
}

.invite-portal-recent-past {
  margin-top: 8px;
  padding-top: 0;
  border-top: 0;
}

.invite-portal-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.invite-portal-main strong {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
}

.invite-portal-main small {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.invite-portal-time {
  grid-column: 1 / -1;
  color: var(--faint);
  font-size: 11px;
}

.admin-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.admin-image-item {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.admin-image-item img {
  display: block;
  width: 100%;
  height: 96px;
  object-fit: cover;
  background: var(--segment-bg);
}

.admin-image-meta {
  min-width: 0;
  padding: 7px 9px 0;
}

.admin-image-meta strong {
  display: block;
  font-size: 12px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.admin-image-meta small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.admin-image-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}

.admin-image-item .text-btn {
  align-self: flex-start;
  margin: 4px 9px 8px;
  padding: 2px 0;
}

.admin-image-preview {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(14, 18, 15, 0.72);
  backdrop-filter: blur(6px);
}

.admin-image-preview-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(94vw, 760px);
  height: min(88vh, 820px);
  padding: 14px;
  overflow: hidden;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
}

.admin-image-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-right: 54px;
}

.admin-image-preview-title {
  min-width: 0;
}

.admin-image-preview-head strong {
  display: block;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.admin-image-preview-head small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.admin-image-zoom {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
}

.admin-image-zoom button {
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.admin-image-zoom button:hover:not(:disabled) {
  border-color: var(--faint);
}

.admin-image-zoom button:disabled {
  opacity: 0.45;
  cursor: default;
}

.admin-image-zoom button.admin-image-zoom-reset {
  min-width: 54px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.admin-image-preview-stage {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  margin-top: 12px;
}

.admin-image-preview-body {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: 12px;
  background: rgba(15, 18, 16, 0.55);
}

.admin-image-preview-body img {
  display: block;
  margin: auto;
  max-width: none;
  max-height: none;
  object-fit: contain;
}

.admin-image-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 56px;
  padding: 0;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(15, 18, 16, 0.52);
  color: #fffdf8;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.admin-image-nav:hover {
  background: rgba(15, 18, 16, 0.74);
}

.admin-image-nav.prev {
  left: 8px;
}

.admin-image-nav.next {
  right: 8px;
}

.admin-image-nav svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.admin-image-preview-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.admin-image-preview-foot small {
  color: var(--muted);
  font-size: 11.5px;
}

.admin-image-preview-foot .text-btn {
  flex: 0 0 auto;
}

.admin-account-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.admin-account-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-account-row.is-unregistering {
  border-color: var(--accent);
}

.admin-account-list .admin-confirm-card {
  margin-top: 0;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: none;
  scroll-margin-bottom: 88px;
}

.admin-account-list .admin-confirm-card .appearance-head h2 {
  font-size: 14px;
}

.admin-account-list .admin-confirm-card .appearance-head p {
  margin-top: 2px;
  font-size: 12px;
}

.admin-account-list .admin-confirm-card .appearance-error,
.admin-account-list .admin-confirm-card .ai-note {
  margin: 8px 0 0;
}

.admin-account-list .admin-confirm-card .account-actions {
  margin-top: 10px;
}

.admin-account-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.admin-account-main {
  min-width: 0;
}

.admin-account-main strong {
  display: block;
  font-size: 13px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.admin-account-main small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
  overflow-wrap: anywhere;
}

.admin-account-count {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.admin-account-row .text-btn {
  padding: 2px 0;
}

.invite-head-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.invite-past {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.invite-past-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.invite-past-toggle .dash-chevron {
  margin-left: 0;
}

.invite-table {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.invite-table-past {
  margin-top: 8px;
}

.invite-table-head,
.invite-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  white-space: nowrap;
}

.invite-table-head {
  padding-top: 5px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 600;
}

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

.invite-table-past .invite-code {
  color: var(--muted);
}

.invite-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.invite-status {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.invite-status.used,
.invite-status.expired {
  background: var(--surface);
  color: var(--faint);
}

.invite-row small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invite-action {
  padding: 2px 0;
  font-size: 11.5px;
}

.notice-list,
.notice-admin-list {
  display: flex;
  flex-direction: column;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.notice-row,
.notice-admin-row {
  padding: 11px 12px;
}

.notice-row + .notice-row,
.notice-admin-row + .notice-admin-row {
  border-top: 1px solid var(--line);
}

.notice-row.unread {
  background: var(--surface);
  box-shadow: inset 3px 0 0 var(--accent);
}

.notice-row-head,
.notice-admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.notice-row-head strong,
.notice-admin-head strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.notice-row-head span:not(.invite-status),
.notice-admin-head span {
  color: var(--muted);
  font-size: 11.5px;
}

.notice-admin-head .text-btn {
  margin-left: auto;
  padding: 2px 0;
}

.notice-content {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.notice-read-btn {
  margin-top: 6px;
  padding: 2px 0;
  font-size: 11.5px;
}

.notice-actions {
  justify-content: space-between;
}

.mail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.mail-grid .field {
  margin: 0;
}

.mail-card .primary-btn,
.mail-card .ghost-btn {
  margin-top: 0;
}

.pending-card {
  margin-top: 8px;
}

.pending-card .stage-tag.danger {
  background: var(--warm);
  color: #fffdf8;
}

.pending-meta {
  color: var(--muted);
  font-size: 12px;
}

.pending-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}

.pending-actions .primary-btn {
  margin-top: 0;
}

.delete-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.clear-result-card {
  margin-top: 16px;
}

.clear-result-card .ghost-btn {
  margin-top: 10px;
}

.delete-warning {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.primary-btn.danger {
  background: var(--warm);
}

.primary-btn.danger:hover {
  background: #9c5534;
}

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

@media (max-width: 560px) {
  .trend-chart.dense .trend-value:not(.prominent) {
    display: none;
  }

  .mail-grid {
    grid-template-columns: 1fr;
  }

  .invite-table-head {
    display: none;
  }

  .invite-row {
    gap: 6px;
    padding: 7px 8px;
  }

  .invite-code {
    font-size: 12px;
    letter-spacing: 0.04em;
  }

  .invite-status {
    padding: 2px 6px;
    font-size: 10px;
  }

  .invite-row small,
  .invite-action {
    font-size: 11px;
  }

  .auth-shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  .auth-card {
    padding: 22px 18px;
  }
}

.site-icp {
  margin: 22px 0 0;
  text-align: center;
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.6;
}

.site-icp a,
.auth-foot a {
  color: var(--faint);
  text-decoration: none;
}

.site-icp a:hover,
.auth-foot a:hover {
  color: var(--accent);
}

.field textarea {
  width: 100%;
  min-height: 110px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
}

.feedback-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.feedback-actions {
  justify-content: space-between;
}

.feedback-actions .primary-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.feedback-count {
  color: var(--faint);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.ai-usage-note {
  margin: 10px 0 0;
}

.feedback-config-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin-top: 12px;
}

.feedback-config-row .field {
  margin: 0;
}

.feedback-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.feedback-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.feedback-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  margin-top: 10px;
}

.feedback-controls .feedback-toggle,
.feedback-controls .feedback-more {
  margin-top: 0;
}

.feedback-toggle .dash-chevron {
  margin-left: 0;
}

.feedback-more {
  margin-top: 8px;
}

.feedback-list-read {
  margin-top: 8px;
}

.feedback-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.feedback-row.unread {
  border-color: var(--accent);
}

.feedback-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.feedback-row-head strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.feedback-row-head span:not(.invite-status) {
  color: var(--muted);
  font-size: 11.5px;
}

.feedback-content {
  margin: 10px 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.feedback-row-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.feedback-row-foot small {
  color: var(--muted);
  font-size: 11.5px;
  overflow-wrap: anywhere;
}

.feedback-row-foot small.error {
  color: var(--warm);
}

.feedback-row-foot .text-btn {
  margin-left: auto;
  padding: 2px 0;
}

@media (max-width: 560px) {
  .feedback-config-row {
    grid-template-columns: 1fr;
  }

  .feedback-config-row .ghost-btn {
    justify-self: start;
  }
}

.tip-tabs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.tip-tab {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.tip-tab.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.tip-qr-wrap {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.tip-qr-wrap img {
  width: min(240px, 70vw);
  height: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.tip-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.tip-admin {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.tip-admin summary {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.tip-admin-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tip-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.tip-admin-actions .text-btn {
  padding: 2px 0;
}

.tip-message {
  margin: 4px 0 0;
  color: var(--soft-ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
}

.tip-message-field {
  margin-top: 12px;
}

.crop-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 19, 17, 0.66);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overscroll-behavior: contain;
}

.crop-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(380px, 100%);
  max-height: calc(100vh - 36px);
  max-height: calc(100dvh - 36px);
  padding: 18px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.crop-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.crop-head strong {
  color: var(--ink);
  font-size: 15px;
}

.crop-head small {
  color: var(--muted);
  font-size: 12px;
}

.crop-stage {
  position: relative;
  flex: none;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 12px;
  background: #101412;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.crop-stage:active {
  cursor: grabbing;
}

.crop-stage-avatar {
  border-radius: 50%;
}

.crop-stage img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  pointer-events: none;
  -webkit-user-drag: none;
  will-change: transform;
}

.crop-zoom {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.crop-zoom input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.crop-zoom span:last-child {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.crop-actions .ghost-btn {
  min-width: 76px;
}

.crop-actions .primary-btn {
  min-width: 88px;
  margin-top: 0;
}

.crop-actions button:disabled {
  opacity: 0.6;
  cursor: default;
}

.category-detail-overlay {
  align-items: flex-end;
  padding: 0;
}

.category-detail-panel {
  display: flex;
  flex-direction: column;
  width: min(460px, 100%);
  max-height: min(78vh, 680px);
  max-height: min(78dvh, 680px);
  padding: 18px 18px calc(16px + var(--browser-bottom, 0px) + env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: category-sheet-up 0.22s ease-out;
}

@keyframes category-sheet-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.category-detail-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

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

.category-detail-title h3 {
  margin: 3px 0 0;
  overflow: hidden;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-detail-title p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

.category-detail-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.category-detail-body {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.category-detail-list-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  padding: 0 2px 7px;
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 600;
}

.category-detail-list-head span:last-child {
  text-align: right;
}

.category-detail-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto 44px 8px;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 11px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.category-detail-row:last-child {
  border-bottom: 0;
}

.category-detail-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-detail-count {
  color: var(--faint);
  font-size: 10px;
  white-space: nowrap;
}

.category-detail-row strong {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.category-detail-percent {
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.category-detail-arrow {
  color: var(--faint);
  font-size: 14px;
  line-height: 1;
  text-align: right;
}

.category-detail-empty {
  margin: 0;
  padding: 22px 8px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.category-detail-actions {
  display: flex;
  gap: 10px;
  padding-top: 12px;
}

.category-detail-actions .primary-btn {
  flex: 1;
  margin-top: 0;
}

@media (min-width: 640px) {
  .category-detail-overlay {
    align-items: center;
    padding: 18px;
  }

  .category-detail-panel {
    max-height: min(80vh, 680px);
    max-height: min(80dvh, 680px);
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
    border-radius: 22px;
    animation: none;
  }
}

/* 触屏点按不出现浏览器焦点框或点按高亮；鼠标/键盘操作仍保留 focus-visible 提示。
   放在样式表末尾，确保覆盖上传按钮、分类图标等单独写的焦点样式。 */
@media (pointer: coarse) {
  button:focus,
  button:focus-visible,
  a:focus,
  a:focus-visible,
  input:focus,
  input:focus-visible,
  select:focus,
  select:focus-visible,
  textarea:focus,
  textarea:focus-visible,
  [role="button"]:focus,
  [role="button"]:focus-visible,
  .ghost-btn:focus-within {
    outline: none;
  }

  .category-icon:focus-visible {
    box-shadow: none;
  }
}

/* 锁屏保护 */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.lock-btn,
.notice-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--pill-bg);
  color: var(--soft-ink);
  cursor: pointer;
}

.lock-btn svg,
.notice-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lock-btn:active,
.notice-btn:active {
  transform: scale(0.96);
}

.lock-btn:focus-visible,
.notice-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.lock-cover {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg);
  color: var(--muted);
}

.lock-cover .brand-mark {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 18px;
  font-size: 26px;
}

.lock-cover strong {
  font-size: 16px;
  letter-spacing: 0.04em;
}

.lock-shell {
  justify-content: center;
  padding-top: calc(24px + env(safe-area-inset-top));
}

.lock-card {
  max-width: 420px;
}

.lock-card .lock-secret {
  -webkit-text-security: disc;
}

.lock-card .auth-brand {
  margin-bottom: 10px;
}

.lock-card h1 {
  margin-bottom: 16px;
}

.lock-card .auth-submit {
  margin-top: 14px;
}

.lock-card .auth-links {
  justify-content: center;
  margin-top: 12px;
}

.account-row select {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
}

.account-row .push-right {
  margin-left: auto;
}

.lock-tip {
  margin: 10px 4px 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.notice-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #c44536;
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 2px 5px rgba(60, 20, 15, 0.25);
}

.notice-shell {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: calc(62px + env(safe-area-inset-top)) 16px calc(40px + env(safe-area-inset-bottom));
  overflow-y: auto;
  background: rgba(20, 25, 22, 0.42);
  backdrop-filter: blur(6px);
}

.notice-popup {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  max-height: min(70vh, 620px);
  padding: 22px 20px;
}

.notice-popup-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-right: 40px;
}

.notice-popup-head h2 {
  margin: 0;
  font-size: 18px;
}

.notice-popup-count {
  color: var(--muted);
  font-size: 11.5px;
}

.notice-readall {
  margin-left: auto;
  padding: 2px 0;
}

.notice-popup .notice-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.notice-popup .notice-empty {
  margin-top: 14px;
}

.notice-toast {
  position: fixed;
  top: calc(64px + env(safe-area-inset-top));
  left: 50%;
  z-index: 90;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--surface);
  font-size: 12.5px;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: var(--shadow);
  pointer-events: none;
}

.lock-screen-note {
  margin: -4px 0 14px;
  padding: 8px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--warm) 10%, var(--surface));
  color: var(--warm);
  font-size: 12px;
  line-height: 1.5;
}
