/* ===========================================================
   爬宠饲养记录｜样式表
   =========================================================== */

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { min-height: 100vh; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
  margin: 0;
  padding: 0;
}
button { cursor: pointer; }
input, textarea { -webkit-appearance: none; }

::selection { background: var(--amber-soft); }

/* -----------------------------------------------------------
   布局
   ----------------------------------------------------------- */
#app {
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

.page {
  padding: calc(var(--safe-t) + 8px) var(--pad) calc(var(--tabbar-h) + var(--safe-b) + 32px);
  min-height: 100vh;
  animation: fade-in 0.22s var(--ease);
}
.page.no-tabbar {
  padding-bottom: calc(var(--safe-b) + 40px);
}

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

/* -----------------------------------------------------------
   顶部标题区
   ----------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  margin-bottom: 6px;
}
.topbar .left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar .right { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--r-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--text);
  flex: none;
  transition: transform 0.15s var(--ease), background 0.15s;
}
.icon-btn:active { transform: scale(0.92); background: var(--surface-2); }
.icon-btn.plain { background: transparent; }
.icon-btn svg { width: 20px; height: 20px; }

.page-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.6px;
  line-height: 1.15;
  margin: 6px 0 4px;
}
.page-sub {
  font-size: 13px;
  color: var(--text-3);
  margin: 0 0 18px;
}
.page-title + .page-sub { margin-top: 2px; }

.section-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.2px;
  margin: 26px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-title .more {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-3);
}

/* -----------------------------------------------------------
   卡片
   ----------------------------------------------------------- */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 16px;
}
.card + .card { margin-top: var(--gap); }
.card-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card-title .sub { font-size: 12px; font-weight: 400; color: var(--text-3); }
.card-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

/* 图标方块 */
.icon-sq {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex: none;
  line-height: 1;
}

/* -----------------------------------------------------------
   首页 Hero（问候 + 今日摘要）
   ----------------------------------------------------------- */
.hero {
  position: relative;
  background: linear-gradient(160deg, #232325 0%, #171719 62%, #131315 100%);
  border-radius: 24px;
  padding: 20px 18px 18px;
  overflow: hidden;
}
.hero-label { font-size: 13px; color: var(--text-2); margin-bottom: 2px; }
.hero-num {
  font-size: 52px;
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}
.hero-num.zero { color: var(--green); }
.hero-unit {
  font-size: 15px;
  font-weight: 500;
  margin-left: 8px;
  color: var(--text);
  letter-spacing: 0;
}
.hero-meta {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 8px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.hero-meta b { color: var(--text); font-weight: 600; }
.hero-meta .warn { color: var(--red); font-weight: 600; }
.hero-avatars {
  display: flex;
  align-items: center;
  gap: -6px;
  margin-top: 14px;
}
.hero-avatars .av { margin-right: -8px; }

/* 头像 */
.av {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  overflow: hidden;
  flex: none;
  color: var(--text);
}
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.lg { width: 56px; height: 56px; font-size: 24px; }
.av.sm { width: 28px; height: 28px; font-size: 14px; }

/* -----------------------------------------------------------
   周历
   ----------------------------------------------------------- */
.sticky-head {
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--bg);
  margin: 0 calc(var(--pad) * -1);
  padding: 6px var(--pad) 4px;
  transition: box-shadow 0.2s;
}
.sticky-head.stuck {
  box-shadow: 0 10px 20px -12px rgba(0, 0, 0, 0.9);
  border-bottom: 1px solid var(--line);
}

.week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin: 16px 0 10px;
}
.week-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 0 9px;
  border-radius: 16px;
  transition: background 0.15s;
}
.week-item .wd { font-size: 11px; color: var(--text-3); }
.week-item .dd {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.week-item .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: transparent;
}
.week-item .dot.on { background: var(--amber); }
.week-item .dot.done { background: var(--green); }
.week-item.today {
  background: var(--surface);
}
.week-item.today .wd { color: var(--text-2); }
.week-item.today .dd { color: var(--text); }
.week-item.active {
  background: var(--surface-2);
}
.week-item:active { background: var(--surface-2); }

/* -----------------------------------------------------------
   类型切换 / 分段控件
   ----------------------------------------------------------- */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }

/* 横向滚动时两端渐隐，提示还有内容可滑 */
.filter-row .chips {
  --fade-l: 0px;
  --fade-r: 0px;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--fade-l),
    #000 calc(100% - var(--fade-r)), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 var(--fade-l),
    #000 calc(100% - var(--fade-r)), transparent 100%);
}
.filter-row .chips.fade-l { --fade-l: 18px; }
.filter-row .chips.fade-r { --fade-r: 18px; }
.chip {
  flex: none;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
  white-space: nowrap;
}
.chip:active { transform: scale(0.96); }
.chip.on {
  background: var(--text);
  color: #000;
  font-weight: 600;
}
.chip .cnt {
  font-size: 11px;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}

.seg {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}
.seg-item {
  flex: 1;
  text-align: center;
  white-space: nowrap;
  padding: 7px 0;
  border-radius: 11px;
  font-size: 13.5px;
  color: var(--text-2);
  font-weight: 500;
  transition: all 0.18s var(--ease);
}
.seg-item.on {
  background: var(--surface-3);
  color: var(--text);
  font-weight: 600;
}

/* -----------------------------------------------------------
   待办卡
   ----------------------------------------------------------- */
.todo {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 14px;
  min-height: 92px;
  margin-bottom: var(--gap);
  position: relative;
  transition: transform 0.18s var(--ease), opacity 0.18s;
}
.todo-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  align-self: stretch;
  flex: none;
}
.todo:active { transform: scale(0.985); }
.todo.overdue { background: linear-gradient(150deg, #241d16 0%, #1b1b1d 55%); }
.todo.done { opacity: 0.42; }
.todo.done:active { transform: none; }

.todo .body { flex: 1; min-width: 0; }
.todo .name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.todo .name .kind { color: var(--text-2); font-weight: 500; font-size: 14px; }
.todo .meta {
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
.todo .meta .sep { width: 1px; height: 9px; background: var(--line-strong); }
.todo .meta .sug { color: var(--text-2); }
.todo .flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--red);
  background: var(--red-soft);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  margin-top: 8px;
}
.todo .flag.calm { color: var(--text-2); background: var(--surface-2); }

/* 圆圈按钮 */
.circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  flex: none;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s var(--ease);
  color: transparent;
}
.circle:active { transform: scale(0.86); border-color: var(--amber); }
.circle svg { width: 15px; height: 15px; }
.todo.done .circle {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}
.todo.overdue .circle { border-color: rgba(255, 107, 94, 0.5); }

.skip-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  flex: none;
  margin-top: 0;
}
.skip-btn:active { background: var(--surface-2); color: var(--text); }
.skip-btn svg { width: 16px; height: 16px; }

/* 分组标题 */
.group-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 600;
  margin: 18px 0 10px;
}
.group-hd .bar { width: 3px; height: 12px; border-radius: 2px; background: var(--red); }
.group-hd .bar.calm { background: var(--surface-3); }
.group-hd .bar.ok { background: var(--green); }
.group-hd .n { color: var(--text-3); font-weight: 400; }

/* 折叠已完成 */
.collapse-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 2px;
  font-size: 13px;
  color: var(--text-3);
  margin-top: 6px;
}
.collapse-hd svg { width: 14px; height: 14px; transition: transform 0.2s var(--ease); }
.collapse-hd.open svg { transform: rotate(180deg); }

/* -----------------------------------------------------------
   记录行
   ----------------------------------------------------------- */
.row-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.row-item:last-child { border-bottom: none; }
.row-item .body { flex: 1; min-width: 0; }
.row-item .t1 {
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 7px;
}
.row-item .t2 {
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-item .val {
  font-size: 15px;
  font-weight: 600;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  flex: none;
}
.row-item .time {
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  flex: none;
}
.row-item .chev { color: var(--text-3); flex: none; }
.row-item .chev svg { width: 16px; height: 16px; display: block; }

/* 点击行 */
.tappable { transition: opacity 0.15s; }
.tappable:active { opacity: 0.6; }

/* -----------------------------------------------------------
   标签
   ----------------------------------------------------------- */
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-2);
  white-space: nowrap;
}
.tag.solid { background: var(--text); color: #000; font-weight: 600; }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.blue { background: var(--blue-soft); color: var(--blue); }

/* -----------------------------------------------------------
   个体列表
   ----------------------------------------------------------- */
.pet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}
.pet-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 168px;
  transition: transform 0.18s var(--ease);
}
.pet-card:active { transform: scale(0.975); }
.pet-card .nm {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.pet-card .sp { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.pet-card .foot {
  margin-top: auto;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.pet-card .mini {
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 6px 8px;
  min-width: 0;
}
.pet-card .mini .k { font-size: 10.5px; color: var(--text-3); display: block; line-height: 1.2; }
.pet-card .mini .v {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  margin-top: 2px;
}
.pet-card .mini .v.warn { color: var(--red); }
.pet-card .mini .v.ok { color: var(--green); }

.add-pet-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  min-height: 168px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-2);
  font-size: 14px;
}
.add-pet-card .plus {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.add-pet-card .plus svg { width: 22px; height: 22px; }

/* -----------------------------------------------------------
   统计块
   ----------------------------------------------------------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 14px 6px;
}
.stat {
  text-align: center;
  padding: 0 4px;
  border-right: 1px solid var(--line);
}
.stat:last-child { border-right: none; }
.stat .k { font-size: 11px; color: var(--text-3); display: block; margin-bottom: 5px; }
.stat .v {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stat .v.amber { color: var(--amber); }
.stat .v.green { color: var(--green); }
.stat .v.red { color: var(--red); }
.stat .v.mute { color: var(--text-3); }

/* 照料情况三行 */
.care-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.care-row:last-child { border-bottom: none; }
.care-row .k { font-size: 14px; font-weight: 500; flex: none; width: 52px; }
.care-row .mid { flex: 1; font-size: 12.5px; color: var(--text-3); }
.care-row .next { font-size: 13px; font-weight: 600; flex: none; }
.care-row .next.warn { color: var(--red); }
.care-row .next.soon { color: var(--amber); }

/* -----------------------------------------------------------
   按钮
   ----------------------------------------------------------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 48px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  width: 100%;
  transition: transform 0.15s var(--ease), opacity 0.15s;
}
.btn:active { transform: scale(0.98); opacity: 0.85; }
.btn.primary { background: var(--text); color: #000; }
.btn.amber { background: var(--amber); color: #1a1206; }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.ghost { background: transparent; color: var(--text-2); font-weight: 500; }
.btn.small { height: 38px; font-size: 14px; border-radius: 12px; width: auto; padding: 0 16px; }
.btn[disabled] { opacity: 0.35; }
.btn-row { display: flex; gap: 10px; }

.link-btn {
  font-size: 13px;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.link-btn.amber { color: var(--amber); }

/* -----------------------------------------------------------
   FAB
   ----------------------------------------------------------- */
.fab {
  position: fixed;
  right: max(calc((100vw - 560px) / 2 + var(--pad)), var(--pad));
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--text);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 20;
  transition: transform 0.18s var(--ease);
}
.fab:active { transform: scale(0.9); }
.fab svg { width: 26px; height: 26px; }

/* -----------------------------------------------------------
   底部 Tab
   ----------------------------------------------------------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  gap: 0;
  background: rgba(10, 10, 10, 0.86);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
  height: calc(var(--tabbar-h) + var(--safe-b));
}
.tabbar[hidden] { display: none; }
.tabbar .tab {
  flex: 1;
  max-width: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-3);
  font-size: 10px;
  padding-top: 8px;
  transition: color 0.15s;
}
.tabbar .tab svg { width: 23px; height: 23px; }
.tabbar .tab.on { color: var(--text); }

/* -----------------------------------------------------------
   空态
   ----------------------------------------------------------- */
.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-3);
}
.empty .ico { font-size: 34px; opacity: 0.5; margin-bottom: 12px; }
.empty .t { font-size: 15px; color: var(--text-2); }
.empty .d { font-size: 13px; margin-top: 6px; line-height: 1.6; }
.empty .actions { margin-top: 18px; display: flex; justify-content: center; gap: 10px; }

/* -----------------------------------------------------------
   表单
   ----------------------------------------------------------- */
.field { margin-bottom: 18px; }
.field > label {
  display: block;
  font-size: 12.5px;
  color: var(--text-3);
  margin-bottom: 8px;
  font-weight: 500;
}
.input {
  width: 100%;
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 13px 14px;
  font-size: 16px;
  color: var(--text);
  border: 1px solid transparent;
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--line-strong); }
.input::placeholder { color: var(--text-3); }
textarea.input { min-height: 84px; resize: none; line-height: 1.5; }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row .input { flex: 1; }
.unit-sel {
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: 13px 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
  flex: none;
}

.picker-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.picker-chips .chip.on { background: var(--text); color: #000; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.switch-row:last-child { border-bottom: none; }
.switch-row .k { font-size: 15px; }
.switch-row .d { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.switch {
  width: 46px;
  height: 28px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  position: relative;
  flex: none;
  transition: background 0.2s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s var(--ease);
}
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(18px); }

/* -----------------------------------------------------------
   弹层 / toast / 对话框
   ----------------------------------------------------------- */
.layer { position: fixed; inset: 0; pointer-events: none; z-index: 100; }

.mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.22s;
  pointer-events: auto;
}
.mask.on { opacity: 1; }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 560px;
  margin: 0 auto;
  background: #131315;
  border-radius: 24px 24px 0 0;
  padding: 8px var(--pad) calc(var(--safe-b) + 20px);
  transform: translateY(100%);
  transition: transform 0.3s var(--ease);
  pointer-events: auto;
  max-height: 86vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.sheet.on { transform: none; }
.sheet .grab {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
  margin: 6px auto 14px;
}
.sheet-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}
.sheet-sub { font-size: 13px; color: var(--text-3); margin-bottom: 16px; line-height: 1.5; }

.dialog {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -46%) scale(0.96);
  width: min(320px, 84vw);
  background: #1c1c1e;
  border-radius: 20px;
  padding: 22px 20px 16px;
  opacity: 0;
  transition: all 0.22s var(--ease);
  pointer-events: auto;
  text-align: center;
}
.dialog.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.dialog .d-title { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.dialog .d-msg { font-size: 13.5px; color: var(--text-2); line-height: 1.55; margin-bottom: 18px; }
.dialog .d-actions { display: flex; flex-direction: column; gap: 8px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 24px);
  transform: translateX(-50%) translateY(20px);
  background: #2a2a2d;
  border-radius: var(--r-pill);
  padding: 11px 8px 11px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: all 0.26s var(--ease);
  pointer-events: auto;
  max-width: calc(100vw - 32px);
  z-index: 200;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .msg { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast .act {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--amber);
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--amber-soft);
  flex: none;
}
.toast.plain { padding-right: 18px; }

/* -----------------------------------------------------------
   图表
   ----------------------------------------------------------- */
.chart-wrap { margin: 4px -4px -4px; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-empty {
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 13px;
  background: var(--surface-2);
  border-radius: var(--r-md);
}

/* -----------------------------------------------------------
   筛选行 / 批量
   ----------------------------------------------------------- */
.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.filter-row .chips { flex: 1; min-width: 0; }
.batch-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  margin-bottom: 6px;
}
.batch-btn:active { background: var(--surface-2); }
.batch-btn svg { width: 18px; height: 18px; }

/* 勾选行 */
.pick-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.pick-row:last-child { border-bottom: none; }
.pick-box {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
}
.pick-box svg { width: 13px; height: 13px; }
.pick-row.on .pick-box {
  background: var(--green);
  border-color: var(--green);
  color: #08210b;
}

/* -----------------------------------------------------------
   照片
   ----------------------------------------------------------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.ph, .ph-add {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
}
.ph-img { width: 100%; height: 100%; }
.ph-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-x {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.66);
  color: #fff;
  font-size: 14px;
  line-height: 18px;
  text-align: center;
}
.ph-add {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  border: 1px dashed var(--line-strong);
}
.ph-add svg { width: 20px; height: 20px; }
.photo-view { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-view .pv {
  width: calc((100% - 16px) / 3);
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
}
.photo-view .pv img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* -----------------------------------------------------------
   月历
   ----------------------------------------------------------- */
.cal-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.cal-hd .m { font-size: 16px; font-weight: 600; }
.cal-hd .nav { display: flex; gap: 8px; }
.cal-hd .nav button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
}
.cal-hd .nav svg { width: 16px; height: 16px; }
.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 6px;
}
.cal-week span {
  text-align: center;
  font-size: 11px;
  color: var(--text-3);
  padding: 4px 0;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-cell {
  aspect-ratio: 1 / 1.05;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 12px;
  font-size: 14px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.cal-cell.out { color: var(--text-3); opacity: 0.32; }
.cal-cell.today { background: var(--surface-2); color: var(--text); font-weight: 700; }
.cal-cell:active { background: var(--surface-2); }
.cal-cell .cd { width: 4px; height: 4px; border-radius: 50%; }
.cal-cell .cd.on { background: var(--amber); }
.cal-cell .cd.done { background: var(--green); }
.cal-cell .cd.overdue { background: var(--red); }
.cal-cell .cd.plan { background: var(--text-3); }

/* 字段小标题 */
.panel-label {
  font-size: 12.5px;
  color: var(--text-3);
  font-weight: 500;
  margin: 20px 0 10px;
}


.muted { color: var(--text-3); }
.dim { color: var(--text-2); }
.amber { color: var(--amber); }
.green { color: var(--green); }
.red { color: var(--red); }
.mono { font-variant-numeric: tabular-nums; }
.tiny { font-size: 12px; }
.small { font-size: 13px; }
.center { text-align: center; }
.mt6 { margin-top: 6px; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; }
.mb12 { margin-bottom: 12px; }
.hr { height: 1px; background: var(--line); margin: 14px 0; }
.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap6 { gap: 6px; }
.gap8 { gap: 8px; }
.gap12 { gap: 12px; }
.grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* -----------------------------------------------------------
   选择器弹层（物种 / 基因）
   ----------------------------------------------------------- */
.sheet.tall {
  max-height: 92vh;
  height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: calc(var(--safe-b) + 8px);
}
.sheet.tall .sheet-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.pick { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.pick-nav { display: flex; align-items: center; gap: 4px; padding-bottom: 10px; }
.pick-nav-t { flex: 1; text-align: center; font-size: 17px; font-weight: 600; letter-spacing: -0.2px; }
.pick-nav-r { min-width: 72px; display: flex; justify-content: flex-end; }
.pick-link { color: var(--amber); font-size: 14px; font-weight: 500; padding: 4px; }

.pick-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border-radius: var(--r-md);
  padding: 11px 13px; margin-bottom: 10px;
}
.pick-search-ico { font-size: 13px; opacity: 0.45; }
.pick-search-in {
  flex: 1; min-width: 0; background: none; border: 0; outline: 0;
  color: var(--text); font-size: 15px; -webkit-appearance: none;
}
.pick-search-in::placeholder { color: var(--text-3); }
.pick-search-in::-webkit-search-cancel-button { -webkit-appearance: none; }

.pick-chips { padding-bottom: 10px; }
.pick-hint { font-size: 12.5px; color: var(--text-3); margin-bottom: 10px; }
.pick-hint b { color: var(--amber); font-weight: 600; }

.pick-list {
  flex: 1; min-height: 0; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 calc(-1 * var(--pad));
  padding: 0 var(--pad) 8px;
  overscroll-behavior: contain;
}
.pick-group {
  background: var(--surface);
  border-radius: var(--r-lg);
  margin-bottom: 12px;
  overflow: hidden;
}
.pick-group-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px 9px;
  font-size: 13px; font-weight: 600; color: var(--green);
}
.pick-group-cnt { color: var(--text-3); font-weight: 400; font-size: 12px; }

.pick-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  background: none;
}
.pick-row:last-child { border-bottom: none; }
.pick-row:active { background: var(--surface-2); }
.pick-row-main { flex: 1; min-width: 0; }
.pick-row-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.pick-cn { font-size: 16px; font-weight: 500; color: var(--text); flex: none; }
.pick-en {
  font-size: 12.5px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.pick-alias { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.pick-tick { color: var(--amber); flex: none; display: flex; }
.pick-tick svg { width: 18px; height: 18px; display: block; }
.pick-flag {
  font-size: 10.5px; padding: 1px 5px; border-radius: 4px;
  background: var(--surface-3); color: var(--text-2); flex: none; margin-left: auto;
}
.pick-flag.dom { background: var(--amber-soft); color: var(--amber); }

.pick-box {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  border: 1.5px solid var(--line-strong);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.pick-box.on { background: var(--amber); border-color: var(--amber); color: #000; }
.pick-box svg { width: 14px; height: 14px; display: block; }

.pick-del {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: var(--surface-2); color: var(--text-2);
  font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}

.pick-empty { text-align: center; padding: 52px 20px; color: var(--text-2); font-size: 14px; }

.pick-foot { padding-top: 12px; display: flex; gap: 10px; }
.pick-foot .btn { flex: 1; }

.pick-manual { display: flex; gap: 8px; padding: 6px 0 10px; }
.pick-manual .input { flex: 1; }
.pick-manual .btn { flex: none; padding: 0 18px; }

/* -----------------------------------------------------------
   建档表单：行选择器 / 周期行 / 多行文本
   ----------------------------------------------------------- */
.field-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 4px 0 14px;
  margin-bottom: 2px;
}
.field-row:active { opacity: 0.7; }
.fr-k { font-size: 13.5px; color: var(--text-2); flex: none; }
.fr-v {
  flex: 1; min-width: 0; text-align: right;
  font-size: 15.5px; font-weight: 500; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fr-v.is-ph { color: var(--text-3); font-weight: 400; }
.fr-chev { color: var(--text-3); flex: none; display: flex; }
.fr-chev svg { width: 16px; height: 16px; display: block; }

/* 周期行 */
.per-card { padding-top: 4px; padding-bottom: 4px; }
.per-row { padding: 10px 0; }
.per-hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.per-label { font-size: 15px; font-weight: 500; }
.per-seg { flex: none; }
.per-seg .seg-item { padding: 5px 9px; font-size: 12px; }
.per-body { margin-top: 10px; }
.per-body[hidden] { display: none; }
.per-none { padding: 2px 0 2px; }

/* 周几 chips 收紧 */
.picker-chips .chip.sm { padding: 5px 10px; font-size: 12.5px; }

/* 多行文本 */
.input.ta {
  min-height: 84px; resize: none; line-height: 1.55;
  padding: 12px 14px; font-family: inherit;
}
.ta-count {
  text-align: right; font-size: 11.5px; color: var(--text-3);
  margin-top: 6px; font-variant-numeric: tabular-nums;
}
.ta-count span { color: var(--text-2); }

/* 日期选择器的日历图标在暗色下反白 */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  filter: invert(1); opacity: 0.35;
}
input[type="date"]::-webkit-date-and-time-value { text-align: left; }

/* 头像照片 & 性别符号 */
.av.has-photo { background: var(--surface-2); }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pet-card .nm .gd {
  font-size: 13px; font-weight: 500; color: var(--text-3);
  margin-left: 5px; vertical-align: 1px;
}

/* 档案标签里的基因用琥珀色；备注卡 */
.tags .tag.amber { color: var(--amber); background: var(--amber-soft); }
.note-card {
  font-size: 13.5px; line-height: 1.6; color: var(--text-2);
  margin-top: 10px; white-space: pre-wrap; word-break: break-word;
}

/* -----------------------------------------------------------
   卡片内表单控件的宽度与对比
   卡片底色与 .input/.chip 默认底色同为 --surface，直接放进去会看不见，
   这里统一提亮一档，保证「这是个可点的控件」一眼可辨。
   ----------------------------------------------------------- */
.card .input,
.card .picker-chips .chip {
  background: var(--surface-2);
}
.card .input:focus { background: var(--surface-2); }
.card .picker-chips .chip.on {
  background: var(--text);
  color: #000;
}
/* 开关/行选择器不要把卡片撑出内边距 */
.card .field-row { max-width: 100%; }

/* -----------------------------------------------------------
   宠物列表：顶部筛选 / 排序 / 长按拖动
   ----------------------------------------------------------- */
.icon-btn.accent { background: var(--text); color: #000; }
.icon-btn.accent:active { background: var(--text); opacity: 0.82; }

.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 12px 0 0;
  padding-bottom: 2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.filter-bar::-webkit-scrollbar { display: none; }
.fchip {
  flex: none;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.fchip.on {
  background: var(--text);
  border-color: transparent;
  color: #000;
  font-weight: 600;
}

.sort-bar { display: flex; align-items: center; gap: 8px; margin: 12px 0 14px; }
.sort-bar .lb { font-size: 12.5px; color: var(--text-3); flex: none; }
.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 6px 10px 6px 12px;
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.sort-btn:active { background: var(--surface-2); }
.sort-btn svg { width: 13px; height: 13px; opacity: 0.55; }
.sort-bar .drag-hint { margin-left: auto; font-size: 11.5px; color: var(--text-3); }

/* 长按拖动排序 */
.pet-grid.drag-on { touch-action: none; }
.pet-grid.sortable .pet-card {
  position: relative;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.pet-grid.sortable .pet-card::after {
  content: '\283F';                 /* ⠿ 拖动把手 */
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 15px;
  line-height: 1;
  color: var(--text-3);
  opacity: 0.55;
  pointer-events: none;
}
.pet-card.dragging {
  transform: scale(1.04);
  z-index: 5;
  opacity: 0.96;
  border: 1px solid var(--line-strong);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5);
}
