/* ============================================================
   安肤星球 / Dr.Fu for Baby · 基础层
   ============================================================ */
:root {
  --paper: #f4f0e7;
  --paper-2: #efe9dd;
  --card: #fffcf6;
  --card-2: #fbf7ef;
  --ink: #1f302a;
  --ink-2: #40544b;
  --muted: #7c8a82;
  --muted-2: #9ba79f;
  --line: rgba(31, 48, 42, 0.1);
  --line-strong: rgba(31, 48, 42, 0.18);
  --green: #2f6353;
  --green-deep: #234c40;
  --green-soft: #dce8df;
  --green-mist: #edf3ee;
  --peach: #e8834e;
  --peach-deep: #cf6a37;
  --peach-soft: #f8dfce;
  --honey: #e5b45b;
  --honey-soft: #f6e8c8;
  --sky: #7fa8b8;
  --sky-soft: #dfeaec;
  --lilac: #9c8fb5;
  --lilac-soft: #e9e4f0;
  --clay: #b7725a;
  --clay-soft: #f1ded6;
  --sand: #b99a6b;
  --sand-soft: #f1e6d2;
  --danger: #c25b4b;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 20px 44px -26px rgba(31, 48, 42, 0.34);
  --shadow-soft: 0 10px 28px -20px rgba(31, 48, 42, 0.24);
  --serif: "Noto Serif SC", "STZhongsong", "Songti SC", "STSong", "SimSun", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(0.22, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.65;
  background:
    radial-gradient(900px 520px at 6% -8%, rgba(232, 131, 78, 0.11), transparent 62%),
    radial-gradient(820px 540px at 102% 0%, rgba(47, 99, 83, 0.12), transparent 58%),
    radial-gradient(700px 500px at 50% 110%, rgba(229, 180, 91, 0.09), transparent 60%),
    var(--paper);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.no-scroll { overflow: hidden; }

.grain {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; line-height: 1.35; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
figure { margin: 0; }

::selection { background: rgba(232, 131, 78, 0.22); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: 6px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(31, 48, 42, 0.16); border: 3px solid var(--paper); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(31, 48, 42, 0.3); }

[hidden] { display: none !important; }
.no-scroll { overflow: hidden; }
.nowrap { white-space: nowrap; }
.serif { font-family: var(--serif); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong { font-weight: 600; }
.green { color: var(--green); }
.peach { color: var(--peach-deep); }
.center { text-align: center; }
.relative { position: relative; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row-top { display: flex; align-items: flex-start; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }

.ic { width: 19px; height: 19px; flex: none; display: inline-block; vertical-align: middle; }
.ic-sm { width: 15px; height: 15px; }
.ic-xs { width: 13px; height: 13px; }
.ic-lg { width: 23px; height: 23px; }
.ic-xl { width: 28px; height: 28px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--green);
}
.eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: transform 0.2s var(--ease), background 0.2s, box-shadow 0.2s, color 0.2s, border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn .ic { width: 16px; height: 16px; }
.btn-primary {
  background: var(--green);
  color: #fff;
  box-shadow: 0 12px 22px -14px rgba(47, 99, 83, 0.8);
}
.btn-primary:hover { background: var(--green-deep); transform: translateY(-1px); box-shadow: 0 16px 26px -14px rgba(47, 99, 83, 0.75); }
.btn-accent {
  background: var(--peach);
  color: #fff;
  box-shadow: 0 12px 22px -14px rgba(232, 131, 78, 0.85);
}
.btn-accent:hover { background: var(--peach-deep); transform: translateY(-1px); }
.btn-soft { background: rgba(47, 99, 83, 0.08); color: var(--green); }
.btn-soft:hover { background: rgba(47, 99, 83, 0.14); }
.btn-outline { border-color: var(--line-strong); color: var(--ink-2); background: transparent; }
.btn-outline:hover { border-color: var(--ink-2); background: rgba(31, 48, 42, 0.03); }
.btn-ghost { color: var(--ink-2); padding-inline: 12px; }
.btn-ghost:hover { background: rgba(31, 48, 42, 0.05); }
.btn-white { background: #fff; color: var(--green); box-shadow: var(--shadow-soft); }
.btn-white:hover { transform: translateY(-1px); }
.btn-sm { padding: 7.5px 14px; font-size: 12px; }
.btn-sm .ic { width: 14px; height: 14px; }
.btn-lg { padding: 14px 26px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: var(--ink-2);
  transition: background 0.2s, color 0.2s, transform 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: rgba(31, 48, 42, 0.06); color: var(--ink); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn .ic { width: 19px; height: 19px; }

/* ---------- 标签 / 胶囊 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--green);
  background: var(--green-mist);
  white-space: nowrap;
}
.tag-peach { color: var(--peach-deep); background: var(--peach-soft); }
.tag-honey { color: #8a631f; background: var(--honey-soft); }
.tag-sky { color: #37626f; background: var(--sky-soft); }
.tag-clay { color: #7c4433; background: var(--clay-soft); }
.tag-lilac { color: #5d4b78; background: var(--lilac-soft); }
.tag-sand { color: #7a5b2e; background: var(--sand-soft); }
.tag-plain { color: var(--muted); background: rgba(31, 48, 42, 0.05); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 246, 0.6);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s var(--ease);
}
.chip:hover { border-color: var(--line-strong); background: #fffdf8; }
.chip.is-on {
  background: var(--ink);
  border-color: var(--ink);
  color: #fbf7ef;
  box-shadow: 0 8px 16px -12px rgba(31, 48, 42, 0.7);
}
.chip .ic { width: 14px; height: 14px; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip-scroll::-webkit-scrollbar { display: none; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-open { color: #9a6a1d; background: var(--honey-soft); }
.status-solved { color: var(--green); background: var(--green-soft); }
.status-answered { color: #37626f; background: var(--sky-soft); }
.status-pending { color: #9a6a1d; background: var(--honey-soft); }
.status-approved { color: var(--green); background: var(--green-soft); }
.status-rejected { color: var(--danger); background: #f3ded9; }
.status-done { color: var(--muted); background: rgba(31, 48, 42, 0.06); }

/* ---------- 头像 ---------- */
.avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0;
  background: linear-gradient(135deg, #6d9a88, #2f6353);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  user-select: none;
}
.avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.32), transparent 52%);
  pointer-events: none;
}
.avatar.av-xs { width: 26px; height: 26px; font-size: 11px; }
.avatar.av-sm { width: 34px; height: 34px; font-size: 14px; }
.avatar.av-md { width: 44px; height: 44px; font-size: 18px; }
.avatar.av-lg { width: 62px; height: 62px; font-size: 25px; }
.avatar.av-xl { width: 88px; height: 88px; font-size: 36px; }
.avatar.av-sage { background: linear-gradient(135deg, #6f9b89, #2f6353); }
.avatar.av-peach { background: linear-gradient(135deg, #f0a97c, #d06a39); }
.avatar.av-sky { background: linear-gradient(135deg, #9dc2ce, #4f7f8f); }
.avatar.av-sand { background: linear-gradient(135deg, #d3b787, #96743f); }
.avatar.av-clay { background: linear-gradient(135deg, #d49a84, #95513d); }
.avatar.av-lilac { background: linear-gradient(135deg, #b6a9cb, #71618e); }
.avatar.av-ink { background: linear-gradient(135deg, #5b6f65, #223a31); }
.avatar .av-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  border: 2px solid var(--card);
  z-index: 2;
}
.avatar .av-badge .ic { width: 9px; height: 9px; stroke-width: 3; }
.avatar .av-online {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #62a97f;
  border: 2px solid var(--card);
  z-index: 2;
}

.avatar-stack { display: flex; align-items: center; }
.avatar-stack .avatar { margin-left: -9px; border: 2px solid var(--card); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---------- 卡片 / 通用 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.card-pad { padding: 22px; }
.card-quiet { box-shadow: none; background: rgba(255, 252, 246, 0.55); }

.meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11.5px;
}
.meta span { display: inline-flex; align-items: center; gap: 4px; }
.meta .ic { width: 13px; height: 13px; }

.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); display: inline-block; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 26px 0 14px;
}
.section-head h2 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.section-head .sub { margin-top: 4px; font-size: 12px; color: var(--muted); }

.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 252, 246, 0.4);
}
.empty .ic { width: 32px; height: 32px; margin-bottom: 10px; opacity: 0.5; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 15px; }
.field > label, .field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0.01em;
}
.field .hint { font-size: 11px; color: var(--muted); margin-top: -2px; }
.input, .textarea, .select {
  width: 100%;
  padding: 11px 14px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: #fbf8f1;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.55;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: rgba(47, 99, 83, 0.55);
  background: #fffdf8;
  box-shadow: 0 0 0 3px rgba(47, 99, 83, 0.09);
}
.field.has-error .input,
.field.has-error .textarea,
.field.has-error .select {
  border-color: rgba(194, 91, 75, 0.65);
  background: #fdf5f2;
}
.textarea { min-height: 104px; resize: vertical; }
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='m1 1.5 5 5 5-5' fill='none' stroke='%237C8A82' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-note {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--green-mist);
  color: var(--green);
  font-size: 11.5px;
  line-height: 1.6;
}
.form-note .ic { width: 15px; height: 15px; margin-top: 1px; }

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 99px;
  background: rgba(31, 48, 42, 0.16);
  transition: background 0.25s;
  flex: none;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
  transition: transform 0.25s var(--ease);
}
.switch.is-on { background: var(--green); }
.switch.is-on::after { transform: translateX(18px); }

.seg {
  display: flex;
  padding: 3px;
  gap: 2px;
  border-radius: 11px;
  background: rgba(31, 48, 42, 0.06);
}
.seg button {
  flex: 1;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.2s;
  white-space: nowrap;
}
.seg button.is-on { background: var(--card); color: var(--ink); box-shadow: 0 2px 6px rgba(31, 48, 42, 0.1); }

/* ---------- 浮层 ---------- */
.layer { position: fixed; inset: 0; z-index: 90; display: none; }
.layer.is-open { display: block; }
.scrim {
  position: absolute;
  inset: 0;
  background: rgba(24, 36, 31, 0.38);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.sheet {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: min(520px, calc(100% - 24px));
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 30px 70px -30px rgba(15, 28, 22, 0.55);
  overflow: hidden;
  animation: sheetIn 0.42s var(--ease) both;
}
.sheet.wide { width: min(640px, calc(100% - 24px)); }
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
  flex: none;
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.96), rgba(255, 252, 246, 0.78));
}
.sheet-heading h2 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.sheet-heading p { margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.sheet-body { flex: 1; overflow-y: auto; padding: 20px 24px 28px; overscroll-behavior: contain; }
.sheet-foot {
  flex: none;
  padding: 14px 24px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 252, 246, 0.96);
}
.modal-wrap {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  overflow-y: auto;
}
.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 44px);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 30px 70px -30px rgba(15, 28, 22, 0.55);
  overflow: hidden;
  animation: modalIn 0.38s var(--ease) both;
}
.modal.wide { width: min(720px, 100%); }
.modal .sheet-body { padding: 20px 24px 24px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetIn { from { transform: translateX(36px) scale(0.985); } to { transform: none; } }
@keyframes sheetUp { from { transform: translateY(40px); } to { transform: none; } }
@keyframes modalIn { from { transform: translateY(16px) scale(0.98); } to { transform: none; } }
@keyframes rise { from { opacity: 0.99; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(1); } 38% { transform: scale(1.28); } 70% { transform: scale(0.94); } 100% { transform: scale(1); } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (max-width: 720px) {
  .sheet, .sheet.wide {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 91vh;
    border-radius: 26px 26px 0 0;
    border-bottom: 0;
    animation: sheetUp 0.42s var(--ease) both;
  }
  .sheet-head { padding: 18px 18px 14px; }
  .sheet-body { padding: 16px 18px calc(22px + env(safe-area-inset-bottom)); }
  .modal-wrap { padding: 12px; align-items: end; }
  .modal, .modal.wide { max-height: 92vh; border-radius: 24px; }
  .modal .sheet-body { padding: 16px 18px 20px; }
  .modal .sheet-head { padding: 18px 18px 14px; }
}

/* ---------- 提示 / 彩纸 ---------- */
.toasts {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 17px;
  border-radius: 999px;
  background: var(--ink);
  color: #fbf7ef;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 14px 30px -16px rgba(15, 28, 22, 0.7);
  animation: toastIn 0.38s var(--ease) both;
  max-width: 100%;
}
.toast span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast .ic { width: 15px; height: 15px; color: #b9d8bd; }
.toast-warn { background: #8a4f24; }
.toast-warn .ic { color: #f7d7ad; }
.toast-info { background: var(--green-deep); }
.toast.out { animation: toastOut 0.32s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px) scale(0.98); } }

.confetti-layer {
  position: fixed;
  left: 50%;
  top: 42%;
  z-index: 130;
  pointer-events: none;
  width: 0;
  height: 0;
}
.confetti-layer i {
  position: absolute;
  border-radius: 2px;
  background: var(--c);
  animation: confettiFly var(--d) cubic-bezier(0.18, 0.7, 0.3, 1) both;
}
@keyframes confettiFly {
  from { opacity: 1; transform: translate(0, 0) rotate(0); }
  to { opacity: 0; transform: translate(var(--x), var(--y)) rotate(var(--r)); }
}

@media (max-width: 860px) {
  .toasts { bottom: calc(88px + env(safe-area-inset-bottom)); }
}

/* 键盘与减少动效 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
