/* Petit Chats · 订单管理 · 样式 */
:root {
  --cream: #F5F0E7;
  --cream-2: #FFFDF9;
  --ink: #33251F;
  --ink-2: #5A4636;
  --muted: #8B8178;
  --line: #E3D9C9;
  --accent: #B4794A;
  --accent-soft: #EFE2D2;
  --green: #4E7A55;
  --amber: #B8860B;
  --red: #A4453B;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(51, 37, 31, .06);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

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

html, body {
  margin: 0; padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
}

body { padding-bottom: calc(76px + var(--safe-b)); }

/* Netlify 免费版角标（iframe）会挡住底部导航，直接隐藏 */
#nl-badge-frame { display: none !important; }

#app { min-height: 100dvh; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: rgba(245, 240, 231, .92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { width: 34px; height: 34px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 16px; letter-spacing: .5px; }
.brand-text span { font-size: 11px; color: var(--muted); }

.ghost-btn {
  border: 1px solid var(--line); background: var(--cream-2); color: var(--ink-2);
  border-radius: 999px; padding: 7px 12px; font-size: 12px; max-width: 46vw;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 主体 */
.view { padding: 14px 14px 8px; max-width: 720px; margin: 0 auto; }

.hero-card {
  background: linear-gradient(160deg, #3B2A20, #58402F);
  color: #F7EFE3; border-radius: 20px; padding: 18px 18px 16px;
  box-shadow: var(--shadow);
}
.hero-card .label { font-size: 12px; opacity: .75; letter-spacing: 2px; }
.hero-card .amount { font-size: 34px; font-weight: 600; margin: 6px 0 2px; letter-spacing: .5px; }
.hero-card .sub { font-size: 12px; opacity: .7; }

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

.stat {
  background: var(--cream-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 22px; font-weight: 600; margin-top: 4px; }

.section-title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 20px 2px 10px;
}
.section-title h2 { font-size: 15px; margin: 0; letter-spacing: 1px; font-weight: 600; }
.section-title a, .section-title button {
  font-size: 12px; color: var(--accent); background: none; border: 0; padding: 0;
}

/* 列表 */
.card {
  background: var(--cream-2); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.card + .card { margin-top: 10px; }

.row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-size: 15px; font-weight: 500; }
.row .meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.row .amount { font-size: 15px; font-weight: 600; white-space: nowrap; }

.empty {
  text-align: center; color: var(--muted); font-size: 13px;
  padding: 34px 12px; line-height: 1.8;
}

/* 状态徽章 */
.badge {
  display: inline-block; font-size: 11px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.badge.pending { background: #FBF0DC; color: #8a6420; border-color: #EFDDBD; }
.badge.making  { background: #E8F0FB; color: #2f5d8f; border-color: #CFE0F4; }
.badge.done    { background: #E7F1E8; color: #34603B; border-color: #CFE3D2; }
.badge.cancelled { background: #F2EDEA; color: #8a7a70; border-color: #E2D8D0; }
.badge.paid    { background: #E7F1E8; color: #34603B; border-color: #CFE3D2; }
.badge.unpaid  { background: #FBF0DC; color: #8a6420; border-color: #EFDDBD; }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; letter-spacing: .5px; }
input, select, textarea {
  width: 100%; font-family: inherit; font-size: 16px; color: var(--ink);
  background: var(--cream-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 13px; outline: none; appearance: none; -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 74px; resize: vertical; }

.btn {
  width: 100%; border: 0; border-radius: 14px; padding: 15px;
  font-size: 16px; font-weight: 600; color: #FFF8EE;
  background: linear-gradient(180deg, #6B4B33, #4A3426);
  box-shadow: 0 4px 14px rgba(51, 37, 31, .18);
}
.btn:active { transform: scale(.985); }
.btn.secondary {
  background: var(--cream-2); color: var(--ink); border: 1px solid var(--line); box-shadow: none;
}
.btn.danger { background: #A4453B; }
.btn:disabled { opacity: .55; }

.segmented { display: flex; gap: 8px; }
.segmented button {
  flex: 1; border: 1px solid var(--line); background: var(--cream-2); color: var(--ink-2);
  border-radius: 12px; padding: 10px; font-size: 14px;
}
.segmented button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); font-weight: 600; }

/* 加减器 */
.stepper { display: inline-flex; align-items: center; gap: 10px; }
.stepper button {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--cream-2); color: var(--ink); font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.stepper .qty { min-width: 22px; text-align: center; font-variant-numeric: tabular-nums; }

/* 底部导航 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around; align-items: flex-end;
  padding: 8px 6px calc(8px + var(--safe-b));
  background: rgba(255, 253, 249, .96);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; border: 0; background: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 9.5px; padding: 4px 0; letter-spacing: 0;
}

/* 日历 */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 12px; }
.cal-head .m { font-size: 16px; font-weight: 600; letter-spacing: 1px; }
.cal-head button {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--cream-2); color: var(--ink); font-size: 16px; line-height: 1;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 10px; color: var(--muted); padding-bottom: 4px; }
.cal-cell {
  aspect-ratio: 1 / 1; border-radius: 10px; border: 1px solid transparent;
  background: var(--cream-2); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: var(--ink);
  position: relative; overflow: hidden;
}
.cal-cell.empty { background: none; }
.cal-cell.has { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.cal-cell.today { box-shadow: inset 0 0 0 1.5px var(--ink); }
.cal-cell .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.cal-cell .thumb {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .35;
}
.cal-cell span { position: relative; z-index: 1; }

.cake-item { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.cake-item:last-child { border-bottom: 0; }
.cake-item img { width: 66px; height: 66px; border-radius: 10px; object-fit: cover; background: var(--accent-soft); }
.cake-item .grow { flex: 1; min-width: 0; }
.cake-item .t { font-size: 14px; font-weight: 600; }
.cake-item .d { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.5; }

.cake-pick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.cake-pick button {
  border: 1px solid var(--line); background: var(--cream-2); color: var(--ink-2);
  border-radius: 10px; padding: 8px 11px; font-size: 12.5px;
}
.cake-pick button.on { background: var(--ink); color: #F7EFE3; border-color: var(--ink); }

.cake-preview {
  margin-top: 10px; padding: 12px; border-radius: 12px;
  background: var(--accent-soft); font-size: 13px; color: var(--ink);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.tab .ico { font-size: 18px; line-height: 1; }
.tab.on { color: var(--ink); font-weight: 600; }
.tab-main .ico {
  width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: #F7EFE3;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  margin-top: -18px; box-shadow: 0 6px 16px rgba(51, 37, 31, .25);
}

/* 弹层 */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(40, 28, 22, .38); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 720px; max-height: 88dvh; overflow: auto;
  background: var(--cream); border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + var(--safe-b));
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet h3 { margin: 0 0 14px; font-size: 16px; }

.toast {
  position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); transform: translateX(-50%);
  background: rgba(51, 37, 31, .94); color: #FFF6E9; font-size: 13px;
  padding: 10px 16px; border-radius: 999px; z-index: 60; max-width: 86vw; text-align: center;
}

/* 登录 */
.auth-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 360px; background: var(--cream-2); border: 1px solid var(--line);
  border-radius: 22px; padding: 26px 22px; box-shadow: 0 10px 40px rgba(51,37,31,.10); text-align: center;
}
.auth-card img { width: 64px; height: 64px; object-fit: contain; margin-bottom: 6px; }
.auth-card h1 { font-size: 20px; margin: 6px 0 2px; letter-spacing: 1px; }
.auth-card p.sub { font-size: 12px; color: var(--muted); margin: 0 0 20px; letter-spacing: 2px; }
.auth-card .field { text-align: left; }
.auth-error { color: var(--red); font-size: 13px; margin: 6px 0 12px; min-height: 18px; }

.tabs-mini { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs-mini button {
  flex: 1; border: 0; background: none; color: var(--muted); font-size: 13px; padding: 8px 0;
  border-bottom: 2px solid transparent;
}
.tabs-mini button.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }

.filters { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; padding-bottom: 2px; }
.chip {
  border: 1px solid var(--line); background: var(--cream-2); color: var(--ink-2);
  border-radius: 999px; padding: 7px 13px; font-size: 12px; white-space: nowrap;
}
.chip.on { background: var(--ink); color: #F7EFE3; border-color: var(--ink); }

.bar-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.bar-row .bl { flex: 1; min-width: 0; font-size: 13px; }
.bar-track { flex: 1.2; height: 8px; background: var(--accent-soft); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }
