/* 太阳花 · iOS Human Interface 气质 */
:root {
  color-scheme: light;
  --bg: #f2f2f7;
  --bg-elevated: #ffffff;
  --fill: rgba(120, 120, 128, 0.12);
  --fill-strong: rgba(120, 120, 128, 0.2);
  --separator: rgba(60, 60, 67, 0.18);
  --separator-opaque: #c6c6c8;
  --label: #000000;
  --secondary: rgba(60, 60, 67, 0.6);
  --tertiary: rgba(60, 60, 67, 0.3);
  --accent: #007aff;
  --accent-soft: rgba(0, 122, 255, 0.12);
  --danger: #ff3b30;
  --success: #34c759;
  --warning: #ff9f0a;
  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sheet: 0 10px 40px rgba(0, 0, 0, 0.18);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --topbar-h: 44px;
  --tabbar-h: 49px;
  --hairline: 0.5px;

  /* 兼容旧变量名 */
  --card: var(--bg-elevated);
  --text: var(--label);
  --muted: var(--secondary);
  --border: var(--separator);
}

* { box-sizing: border-box; }
html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  overscroll-behavior-y: none;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  text-size-adjust: 100%;
  touch-action: manipulation;
  scrollbar-width: none;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar,
*::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
* { scrollbar-width: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-appearance: none; appearance: none; }
input, textarea, select { -webkit-appearance: none; appearance: none; }
a { color: var(--accent); text-decoration: none; word-break: break-all; }
.hidden { display: none !important; }
.muted { color: var(--secondary); font-size: 13px; }
.error { color: var(--danger); font-size: 13px; font-weight: 400; }
.hint { color: var(--secondary); font-size: 15px; margin: 0 0 20px; text-align: center; }

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* —— 导航栏（毛玻璃） —— */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(var(--topbar-h) + var(--safe-t));
  padding: calc(4px + var(--safe-t)) 4px 4px 16px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 10;
  background: rgba(249, 249, 249, 0.82);
  -webkit-backdrop-filter: saturate(200%) blur(24px);
  backdrop-filter: saturate(200%) blur(24px);
  border-bottom: var(--hairline) solid var(--separator);
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: transform;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.brand-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 7px;
}
.topbar-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}
.export-ok {
  color: var(--success);
  font-size: 13px;
  margin: 0 0 10px;
  font-weight: 500;
}
.export-tips {
  margin: 4px 0 12px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.export-tips .wait-kicker {
  margin: 0 0 10px;
  text-align: center;
}
.export-tips .wait-tip-card {
  max-width: none;
}
.export-tips .wait-tip-text {
  min-height: 4.8em;
}

#main {
  flex: 1;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px);
  background: var(--bg);
}
body.has-topbar #main {
  padding-top: calc(var(--topbar-h) + var(--safe-t));
}
body:not(.has-tabbar) #main { padding-bottom: var(--safe-b); }

.screen { padding: 8px 16px 20px; }
.stats-panel { max-width: 560px; margin: 0 auto; }

/* —— 天空启动与登录 —— */
#sky-background {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(ellipse at 80% 0%, #d0efff 0%, transparent 48%),
    linear-gradient(165deg, #57a7e6 0%, #90c9f1 38%, #d7eafa 73%, #f1f6fa 100%);
}
.sky-cloud {
  position: absolute;
  width: 155%;
  height: 65%;
  filter: blur(28px);
  will-change: transform;
  animation: sky-breathe 14s ease-in-out infinite alternate;
}
.sky-cloud-near {
  left: -38%;
  top: 37%;
  opacity: .94;
  transform: rotate(-18deg);
  background: radial-gradient(ellipse at 27% 52%, #fff 0%, #ffffffed 19%, transparent 47%),
    radial-gradient(ellipse at 66% 64%, #fffffff0 0%, #ffffffa6 20%, transparent 49%);
}
.sky-cloud-far {
  right: -51%;
  top: -25%;
  opacity: .76;
  background: radial-gradient(ellipse at 52% 45%, #fff 0%, #ffffffbf 22%, transparent 52%);
  animation-duration: 19s;
  animation-delay: -7s;
}
.sky-screen {
  position: fixed;
  inset: 0;
  z-index: 1;
  padding: 0;
  color: #234e70;
  text-align: center;
}
.sky-wordmark {
  position: absolute;
  top: 34%;
  left: 24px;
  right: 24px;
}
.sky-eyebrow { margin: 0 0 20px; font-size: 10px; font-weight: 500; letter-spacing: .44em; padding-left: .44em; }
.sky-wordmark h2 { margin: 0; font-size: 36px; font-weight: 400; letter-spacing: .2em; padding-left: .2em; }
.sky-line { display: block; width: 28px; height: 1px; margin: 28px auto 0; background: #416c8d66; }
.sky-footer {
  position: absolute;
  bottom: calc(11% + var(--safe-b));
  left: 32px;
  right: 32px;
  max-width: 320px;
  margin: 0 auto;
}
#startup-status { margin: 0 0 18px; font-size: 12px; letter-spacing: .16em; color: #426580; }
.sky-button {
  width: 100%;
  min-height: 52px;
  padding: 14px 22px;
  border: 1px solid #ffffffcc;
  border-radius: 18px;
  background: #ffffffa6;
  color: #234e70;
  box-shadow: 0 8px 32px #4a7a9e0a;
  font-size: 15px;
  letter-spacing: .08em;
  cursor: pointer;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.sky-button:disabled { opacity: .55; cursor: default; }
.sky-button:active { background: #ffffffe6; }
.sky-button:focus-visible { outline: 2px solid #234e70; outline-offset: 4px; }
.sky-caption { margin: 16px 0 0; font-size: 11px; letter-spacing: .06em; color: #426580; }
.sky-footer .error { color: #963e3e; margin: 0 0 16px; }
@keyframes sky-breathe {
  from { transform: translate3d(-1%, 0, 0) rotate(-12deg) scale(1); }
  to { transform: translate3d(3%, -2%, 0) rotate(-8deg) scale(1.06); }
}
@media (prefers-reduced-motion: reduce) {
  .sky-cloud { animation: none; will-change: auto; }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.field span {
  font-size: 13px;
  color: var(--secondary);
  font-weight: 500;
}
.field input,
.field select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--fill);
  color: var(--label);
  font-size: 17px;
}
.field input:focus,
.field select:focus,
textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-primary,
.btn-secondary,
.btn-danger,
.btn-text {
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 510;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.btn-primary:active,
.btn-secondary:active,
.btn-text:active { opacity: 0.55; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
  font-weight: 600;
}
.btn-primary:disabled {
  opacity: 0.45;
  cursor: default;
}
.btn-secondary {
  background: var(--fill);
  color: var(--accent);
  font-weight: 600;
  border: none;
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-text {
  background: transparent;
  color: var(--accent);
  padding: 8px 12px;
  font-size: 17px;
  font-weight: 400;
  border-radius: 8px;
}
.btn-text:active { background: var(--fill); opacity: 1; }

/* —— 分段控件（时间范围） —— */
.range-bar {
  display: flex;
  align-items: stretch;
  gap: 2px;
  margin: 4px 0 14px;
  padding: 2px;
  background: var(--fill);
  border-radius: 9px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.range-bar::-webkit-scrollbar { display: none; }
.range-bar .chip {
  flex: 1 1 0;
  min-width: 3.4rem;
  margin: 0;
  white-space: nowrap;
  border: none;
  background: transparent;
  color: var(--label);
  border-radius: 7px;
  padding: 7px 8px;
  font-size: 13px;
  font-weight: 510;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}
.range-bar .chip.active {
  background: var(--bg-elevated);
  color: var(--label);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.04);
}

.insight-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 4px 16px 10px;
  padding: 4px;
  border-radius: 12px;
  background: var(--fill);
}
.insight-tab {
  min-height: 36px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--secondary);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
}
.insight-tab.active { color: var(--text); background: var(--bg-elevated); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.chip-custom { max-width: 7.5rem; overflow: hidden; text-overflow: ellipsis; }

.section-hint {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--secondary);
  letter-spacing: -0.01em;
}
.range-asof {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 510;
  color: var(--secondary);
  letter-spacing: -0.01em;
}
.pending-note {
  margin: 32px 0;
  text-align: center;
  font-size: 15px;
}
.lab-placeholder {
  margin: 24px 0;
  padding: 32px 20px;
  border-radius: 18px;
  background: var(--bg-elevated);
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.lab-placeholder h2 {
  margin: 0 0 8px;
  font-size: 22px;
}
.lab-placeholder p { margin: 0; }

/* —— 日表：Inset Grouped —— */
.daily-block {
  margin: 0 0 18px;
}
.daily-block:last-child { margin-bottom: 0; }
.daily-block-title {
  margin: 0 0 8px;
  padding: 0 2px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--text);
}
.daily-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: none;
  border-radius: 18px;
  background: var(--bg-elevated);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.03);
}
.daily-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.daily-table th,
.daily-table td {
  padding: 12px 14px;
  border-bottom: var(--hairline) solid var(--separator);
  white-space: nowrap;
  text-align: right;
}
.daily-table th {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-weight: 510;
  font-size: 12px;
  color: var(--secondary);
  text-transform: none;
  z-index: 2;
  letter-spacing: -0.01em;
}
.daily-table th:first-child,
.daily-table td.col-date {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--bg-elevated);
  z-index: 1;
  min-width: 4.75rem;
  font-weight: 510;
}
.daily-table th:first-child {
  z-index: 3;
  background: rgba(255, 255, 255, 0.96);
  font-weight: 510;
}
.daily-table tr.is-today td {
  background: var(--accent-soft);
}
.daily-table tr.is-today td.col-date {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
  font-weight: 600;
  color: var(--accent);
}
.daily-table tbody tr:last-child td { border-bottom: none; }
.daily-table tbody tr:active td { background: var(--fill); }
.daily-table tbody tr.is-today:active td { background: rgba(0, 122, 255, 0.18); }

/* —— Tab Bar —— */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  display: flex;
  align-items: stretch;
  height: calc(var(--tabbar-h) + var(--safe-b));
  box-sizing: border-box;
  padding: 0 0 var(--safe-b);
  z-index: 20;
  background: rgba(249, 249, 249, 0.86);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: var(--hairline) solid var(--separator);
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: transform;
}
.tab {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 2px 6px;
  background: transparent;
  border: none;
  color: var(--secondary);
  font-size: 10px;
  font-weight: 510;
  letter-spacing: -0.01em;
  line-height: 1.15;
  cursor: pointer;
}
.tab::before {
  content: "";
  width: 26px;
  height: 26px;
  background: currentColor;
  opacity: 1;
}
.tab[data-tab="pay"]::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm.8 5.2v.7c1.5.3 2.5 1.2 2.5 2.6 0 1.5-1.1 2.4-3 2.7v3.1h-1.5v-3c-1.4-.2-2.5-1.1-2.6-2.5h1.6c.1.7.7 1.2 1.7 1.3v-2.5c-1.5-.3-2.5-1.2-2.5-2.6 0-1.5 1.2-2.4 2.9-2.7V5.2h1.5v.7c1.3.2 2.3 1 2.4 2.3h-1.6c-.1-.6-.6-1-1.5-1.1v2.1z'/%3E%3C/svg%3E") center / 24px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm.8 5.2v.7c1.5.3 2.5 1.2 2.5 2.6 0 1.5-1.1 2.4-3 2.7v3.1h-1.5v-3c-1.4-.2-2.5-1.1-2.6-2.5h1.6c.1.7.7 1.2 1.7 1.3v-2.5c-1.5-.3-2.5-1.2-2.5-2.6 0-1.5 1.2-2.4 2.9-2.7V5.2h1.5v.7c1.3.2 2.3 1 2.4 2.3h-1.6c-.1-.6-.6-1-1.5-1.1v2.1z'/%3E%3C/svg%3E") center / 24px no-repeat;
}
.tab[data-tab="user"]::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3Cpath d='M4 21v-2a8 8 0 0 1 16 0v2z'/%3E%3C/svg%3E") center / 24px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3Cpath d='M4 21v-2a8 8 0 0 1 16 0v2z'/%3E%3C/svg%3E") center / 24px no-repeat;
}
.tab[data-tab="lab"]::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 2h8v2h-1v5l5.4 9.4A2.4 2.4 0 0 1 18.3 22H5.7a2.4 2.4 0 0 1-2.1-3.6L9 9V4H8zm3 2v5.5L7.3 16h9.4L13 9.5V4z'/%3E%3C/svg%3E") center / 24px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 2h8v2h-1v5l5.4 9.4A2.4 2.4 0 0 1 18.3 22H5.7a2.4 2.4 0 0 1-2.1-3.6L9 9V4H8zm3 2v5.5L7.3 16h9.4L13 9.5V4z'/%3E%3C/svg%3E") center / 24px no-repeat;
}
.tab[data-tab="goods"]::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M7 4h10l1 3H6l1-3zm-1 5h12l-1.2 11.2A1.5 1.5 0 0 1 16.3 22H7.7a1.5 1.5 0 0 1-1.5-1.8L5 9z'/%3E%3C/svg%3E") center / 24px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M7 4h10l1 3H6l1-3zm-1 5h12l-1.2 11.2A1.5 1.5 0 0 1 16.3 22H7.7a1.5 1.5 0 0 1-1.5-1.8L5 9z'/%3E%3C/svg%3E") center / 24px no-repeat;
}
.tab[data-tab="consume"]::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M13.2 2.1a1 1 0 0 1 1.6.4l1.1 2.8 2.9.4a1 1 0 0 1 .55 1.7l-2.1 2 .5 3a1 1 0 0 1-1.45 1.05L13.5 12l-2.8 1.5a1 1 0 0 1-1.45-1.05l.5-3-2.1-2a1 1 0 0 1 .55-1.7l2.9-.4 1.1-2.8zM7 15.5h10v1.5H7V15.5zm-1 3h12V20H6v-1.5z'/%3E%3C/svg%3E") center / 24px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M13.2 2.1a1 1 0 0 1 1.6.4l1.1 2.8 2.9.4a1 1 0 0 1 .55 1.7l-2.1 2 .5 3a1 1 0 0 1-1.45 1.05L13.5 12l-2.8 1.5a1 1 0 0 1-1.45-1.05l.5-3-2.1-2a1 1 0 0 1 .55-1.7l2.9-.4 1.1-2.8zM7 15.5h10v1.5H7V15.5zm-1 3h12V20H6v-1.5z'/%3E%3C/svg%3E") center / 24px no-repeat;
}
.tab[data-tab="activity"]::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2a4 4 0 0 1 4 4v1h2.2A1.8 1.8 0 0 1 20 8.8v10.4A1.8 1.8 0 0 1 18.2 21H5.8A1.8 1.8 0 0 1 4 19.2V8.8A1.8 1.8 0 0 1 5.8 7H8V6a4 4 0 0 1 4-4zm0 2a2 2 0 0 0-2 2v1h4V6a2 2 0 0 0-2-2z'/%3E%3C/svg%3E") center / 24px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2a4 4 0 0 1 4 4v1h2.2A1.8 1.8 0 0 1 20 8.8v10.4A1.8 1.8 0 0 1 18.2 21H5.8A1.8 1.8 0 0 1 4 19.2V8.8A1.8 1.8 0 0 1 5.8 7H8V6a4 4 0 0 1 4-4zm0 2a2 2 0 0 0-2 2v1h4V6a2 2 0 0 0-2-2z'/%3E%3C/svg%3E") center / 24px no-repeat;
}
.tab[data-tab="insight"]::before,
.tab[data-tab="paperdoll"]::before,
.tab[data-tab="feedback"]::before,
.tab[data-tab="profile"]::before { display: grid; place-items: center; background: transparent; }
.tab[data-tab="insight"]::before { content: "◫"; font-size: 23px; line-height: 24px; }
.tab[data-tab="paperdoll"]::before { content: "✦"; font-size: 22px; line-height: 24px; }
.tab[data-tab="feedback"]::before { content: "◌"; font-size: 23px; line-height: 24px; }
.tab[data-tab="profile"]::before { content: "●"; font-size: 18px; line-height: 24px; }
.tab.active {
  color: var(--accent);
  font-weight: 600;
}
#dash-tabbar.hidden { display: none !important; }

/* —— Sheet / Dialog —— */
.sheet {
  border: none;
  border-radius: var(--radius-xl);
  padding: 8px 20px 20px;
  background: rgba(242, 242, 247, 0.96);
  color: var(--label);
  width: min(100%, 420px);
  max-width: calc(100vw - 24px);
  box-shadow: var(--shadow-sheet);
  -webkit-backdrop-filter: blur(40px);
  backdrop-filter: blur(40px);
}
dialog.sheet {
  margin: auto 12px 16px;
  width: calc(100% - 24px);
  max-width: 420px;
  border-radius: 28px;
  padding: 10px 20px calc(16px + var(--safe-b));
}
.sheet::backdrop {
  background: rgba(0, 0, 0, 0.32);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.sheet-grabber {
  width: 36px;
  height: 5px;
  border-radius: 100px;
  background: rgba(60, 60, 67, 0.3);
  margin: 4px auto 14px;
}
.sheet h3 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-align: center;
}
.sheet .hint {
  text-align: center;
  font-size: 13px;
  margin-bottom: 16px;
}
.sheet .field {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 10px;
}
.sheet .field span {
  font-size: 12px;
  font-weight: 510;
}
.sheet .field input {
  background: transparent;
  padding: 4px 0 0;
  border-radius: 0;
  font-size: 17px;
}
.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.sheet-actions button {
  flex: 1;
  min-height: 50px;
  border-radius: var(--radius-md);
  font-size: 17px;
}

/* —— 等待态 —— */
.wait-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 16px 28px;
  min-height: 320px;
}
.wait-ring-wrap {
  position: relative;
  width: 76px;
  height: 76px;
}
.wait-ring {
  --p: 12;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(#0a84ff calc(var(--p) * 1%), rgba(120, 120, 128, 0.14) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5.5px), #000 calc(100% - 4.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5.5px), #000 calc(100% - 4.5px));
}
.wait-pct {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  color: var(--label);
  pointer-events: none;
}
.wait-kicker {
  margin: 20px 0 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--secondary);
}
.wait-tip-card {
  width: 100%;
  max-width: 22rem;
  background: var(--bg-elevated);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);
  text-align: left;
}
.wait-tip-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--label);
  min-height: 5.6em;
  letter-spacing: -0.015em;
  font-weight: 400;
}
.wait-sub { margin: 14px 0 0; font-size: 11px; }

/* —— 旧组件兼容（未用页面） —— */
.today-strip,
.card,
.stat-card,
.analysis-box,
.standup-banner {
  background: var(--bg-elevated);
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.chip {
  border: none;
  background: var(--fill);
  color: var(--label);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
}
.chip.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 510;
}
.dash-section { margin-top: 20px; }
.dash-title { margin: 0 0 10px; font-size: 20px; font-weight: 700; letter-spacing: -0.03em; }
.empty { text-align: center; color: var(--secondary); padding: 40px 0; }
.stat-num { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; }
.stat-label { color: var(--secondary); font-size: 13px; margin-top: 4px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

@media (prefers-reduced-motion: reduce) {
  .btn-primary, .btn-secondary, .btn-text, .range-bar .chip { transition: none; }
}

/* —— 反馈 Tab —— */
.feedback-panel {
  padding: 12px 16px calc(16px + var(--tabbar-h) + var(--safe-b));
  min-height: 50dvh;
}
.fb-login-title {
  margin: 24px 0 8px;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
}
.fb-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.fb-filters input,
.fb-filters select {
  width: 100%;
  border: none;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
}
.fb-filters input { grid-column: 1 / -1; }
.fb-filter-go { grid-column: 1 / -1; }
.fb-list { display: flex; flex-direction: column; gap: 8px; }
.fb-card {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.fb-card:active { opacity: 0.88; }
.fb-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--secondary);
  margin-bottom: 6px;
}
.fb-card-body {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fb-card-extra { margin: 6px 0 0; font-size: 12px; }
.fb-more { width: 100%; margin-top: 12px; }
.fb-detail-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 88px;
}
.fb-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.fb-tag {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--secondary);
}
.fb-tag-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0;
}
.fb-tag-editor input {
  width: 100%;
  border: none;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
}
.fb-user-id {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  color: var(--secondary);
  font-size: 12px;
}
.fb-user-id code {
  color: var(--text);
  font-size: 12px;
  overflow-wrap: anywhere;
  user-select: all;
  -webkit-user-select: all;
}
.fb-copy-btn {
  flex: 0 0 auto;
  border: none;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
}
.fb-detail-tabs {
  display: flex;
  gap: 4px;
  padding: 2px;
  background: var(--fill);
  border-radius: 10px;
}
.fb-detail-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--secondary);
  border-radius: 8px;
  min-height: 36px;
  font-size: 14px;
  font-weight: 510;
}
.fb-detail-tab.active {
  background: var(--bg-elevated);
  color: var(--label);
  box-shadow: var(--shadow-sm);
}
.fb-history-count {
  margin-left: 4px;
  color: var(--tertiary);
  font-weight: 400;
  font-size: 12px;
}
.fb-history-current {
  font-size: 11px;
  color: var(--secondary);
}
.fb-original {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.fb-original-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 16px;
  line-height: 1.45;
}
.fb-investigation {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.fb-investigation.warning {
  background: rgba(255, 159, 10, 0.1);
}
.fb-investigation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.fb-investigation-head strong { font-size: 14px; }
.fb-investigation-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.5;
}
.fb-investigation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.fb-investigation-actions button { min-height: 38px; }
.fb-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.fb-image-btn {
  display: block;
  padding: 0;
  border: none;
  background: transparent;
  line-height: 0;
}
.fb-images img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--fill);
  -webkit-touch-callout: none;
}
.fb-chips-row { display: flex; flex-direction: column; gap: 8px; }
.fb-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.fb-chip {
  flex: 0 0 auto;
  border: none;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 510;
}
.fb-field-label {
  display: block;
  font-size: 13px;
  color: var(--secondary);
  margin-bottom: 6px;
}
.fb-reply-field textarea {
  width: 100%;
  border: none;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  min-height: 120px;
  resize: vertical;
  box-shadow: var(--shadow-sm);
}
.fb-detail-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-b));
  z-index: 9;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(242, 242, 247, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: var(--hairline) solid var(--separator);
}
.fb-detail-actions .btn-primary,
.fb-detail-actions .btn-secondary {
  min-height: 44px;
}
.fb-compensate-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}
.fb-tpl-toolbar { margin-bottom: 12px; }
.fb-tpl-list { display: flex; flex-direction: column; gap: 8px; }
.fb-tpl-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.fb-tpl-card strong { font-size: 15px; }
.fb-tpl-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.btn-text.danger { color: var(--danger); }
.fb-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 72px);
  transform: translateX(-50%);
  z-index: 40;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  pointer-events: none;
}
.topbar-brand { display: flex; align-items: center; gap: 6px; min-width: 0; }
#dash-tabbar .tab { flex: 1 1 0; font-size: 10px; line-height: 12px; gap: 2px; padding: 3px 2px; }
#dash-tabbar .tab::before { display: none; }
#dash-tabbar .tab-icon { width: 28px; height: 28px; flex: 0 0 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fb-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  touch-action: none;
}
.fb-lightbox.hidden { display: none !important; }
.fb-lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.fb-lightbox-close,
.fb-lightbox-nav {
  position: absolute;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  min-width: 44px;
  min-height: 44px;
  border-radius: 999px;
  font-size: 28px;
  line-height: 1;
  z-index: 1;
}
.fb-lightbox-close {
  top: calc(12px + var(--safe-t));
  right: 12px;
  font-size: 32px;
}
.fb-lightbox-prev,
.fb-lightbox-next {
  top: 50%;
  transform: translateY(-50%);
}
.fb-lightbox-prev { left: 8px; }
.fb-lightbox-next { right: 8px; }
.fb-lightbox-counter {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(16px + var(--safe-b));
  text-align: center;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  pointer-events: none;
}
:root .north-star-frame, :root .lab-frame, :root .avatar-frame { display: block; width: 100%; height: calc(100dvh - var(--topbar-h) - var(--safe-t) - var(--tabbar-h) - var(--safe-b)); min-height: 0; border: 0; border-radius: 0; background: #f2f2f7; }
body:not(.insight-active) #insight-tabs, body:not(.insight-active) #range-bar { display: none; }
body:not(.insight-active) #btn-export { display: none; }
#btn-logout { display: none !important; }
body.lab-active #range-bar, body.lab-active #btn-export,
body.avatar-active #range-bar, body.avatar-active #btn-export { display: none; }
body.north-star-active #panel-dashboard, body.lab-active #panel-dashboard, body.avatar-active #panel-dashboard { padding: 0; max-width: 1100px; }
body.north-star-active #screen-dashboard, body.lab-active #screen-dashboard, body.avatar-active #screen-dashboard { padding: 0; }
body.north-star-active #main, body.lab-active #main, body.avatar-active #main { padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); overflow: hidden; }
body.avatar-active #topbar { display: none; }
body.has-topbar.avatar-active #main { padding-top: var(--safe-t); }
body.avatar-active .avatar-frame { height: calc(100dvh - var(--safe-t) - var(--tabbar-h) - var(--safe-b)); }
.profile-card { display: flex; align-items: center; gap: 14px; margin: 20px 16px 12px; padding: 20px; border-radius: 18px; background: var(--bg-elevated); box-shadow: 0 1px 5px rgba(0,0,0,.08); }
.profile-avatar { display: grid; place-items: center; width: 54px; height: 54px; flex: 0 0 54px; border-radius: 50%; color: #fff; background: var(--accent); font-size: 24px; font-weight: 700; }
.profile-copy { min-width: 0; }
.profile-label { margin: 0 0 4px; color: var(--secondary); font-size: 14px; }
.profile-copy h2 { margin: 0; font-size: 20px; line-height: 1.3; overflow-wrap: anywhere; }
.profile-logout { display: block; width: calc(100% - 32px); min-height: 48px; margin: 0 16px; border: 0; border-radius: 14px; color: #ff3b30; background: var(--bg-elevated); font: inherit; font-size: 16px; font-weight: 600; box-shadow: 0 1px 5px rgba(0,0,0,.06); }
