:root {
  --primary: #e8590c;
  --primary-dark: #c84a08;
  --bg: #f5f1ea;
  --card: #ffffff;
  --text: #2b2926;
  --muted: #9a907f;
  --line: #e8e0d2;
  --danger: #d64545;
  --danger-bg: #fff1f0;
  --radius: 16px;
}

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

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input, select {
  font-family: inherit;
  font-size: 16px;
}

.hidden {
  display: none !important;
}

/* ---------- 登录页 ---------- */

.view-login {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(165deg, #fff3e4 0%, #ffe3c8 55%, #ffd3ae 100%);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 24px;
  padding: 32px 26px 26px;
  box-shadow: 0 16px 40px rgba(180, 110, 40, 0.18);
}

.login-logo {
  font-size: 54px;
  text-align: center;
  line-height: 1.2;
}

.login-card h1 {
  text-align: center;
  font-size: 24px;
  margin-top: 6px;
  letter-spacing: 1px;
}

.login-sub {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin: 4px 0 22px;
}

.login-tabs {
  display: flex;
  background: #f4efe6;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 18px;
}

.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 0;
  border-radius: 9px;
  font-size: 15px;
  color: var(--muted);
}

.tab-btn.active {
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.field-label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 5px;
}

.field {
  width: 100%;
  border: 1px solid var(--line);
  background: #faf7f2;
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s;
}

.field:focus {
  border-color: var(--primary);
  background: #fff;
}

.primary-btn {
  width: 100%;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  padding: 13px 0;
  margin-top: 20px;
  transition: background 0.15s, transform 0.05s;
}

.primary-btn:active {
  background: var(--primary-dark);
  transform: scale(0.98);
}

.login-note {
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--muted);
  background: #faf6ef;
  border-radius: 10px;
  padding: 10px 12px;
}

/* ---------- 主框架 ---------- */

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: 84px;
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  background: rgba(255, 251, 245, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-title {
  font-size: 17px;
  font-weight: 700;
}

.ver {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted);
  background: #f1e9dc;
  border-radius: 6px;
  padding: 1px 6px;
  margin-left: 4px;
  vertical-align: 2px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-name {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--muted);
}

.logout-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12.5px;
}

.main {
  padding: 14px 14px 20px;
}

.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  z-index: 30;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: none;
  background: transparent;
  font-size: 12px;
  color: #a89e8d;
  padding: 5px 0;
}

.tab-item span {
  font-size: 11px;
}

.tab-item.active {
  color: var(--primary);
  font-weight: 600;
}

/* ---------- 通用卡片 ---------- */

.page-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.page-head h2 {
  font-size: 19px;
}

.back-btn {
  border: none;
  background: #fff;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 18px;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 10px rgba(120, 90, 40, 0.06);
}

.search {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 11px 14px;
  outline: none;
  margin-bottom: 12px;
}

.search:focus {
  border-color: var(--primary);
}

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  margin-bottom: 2px;
  scrollbar-width: none;
}

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

.chip {
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  transition: all 0.12s;
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.filter-select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
  margin-bottom: 12px;
  color: var(--text);
}

.sup-filter-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.sup-filter-wrap .filter-select {
  margin-bottom: 0;
}

.sup-manage-btn {
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 13px;
}

.sup-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sup-add-btn {
  width: 100%;
  border: 1.5px dashed #d8cbb4;
  background: #faf6ef;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 0;
  font-size: 15px;
  margin-bottom: 12px;
}

.sup-rename-btn {
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: #faf6ef;
  color: var(--text);
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 13.5px;
}

.sup-del-btn {
  flex-shrink: 0;
  border: 1px solid #ffc9c0;
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13.5px;
}

.tag {
  display: inline-block;
  background: #f7f1e6;
  color: #8a6b3d;
  border-radius: 6px;
  padding: 1px 8px;
  font-size: 11.5px;
  margin: 2px 6px 2px 0;
}

.tag-supplier {
  background: #eef4ec;
  color: #3d6b3a;
}

.empty {
  text-align: center;
  padding: 70px 20px;
  color: var(--muted);
}

.empty .empty-icon {
  font-size: 52px;
  display: block;
  margin-bottom: 10px;
}

.empty-sub {
  font-size: 13px;
  margin-top: 4px;
  opacity: 0.8;
}

/* ---------- 首页 ---------- */

.greeting {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 2px;
}

.greeting-sub {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 14px;
}

.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 2px 10px rgba(120, 90, 40, 0.06);
}

.stat-card .num {
  font-size: 30px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.stat-card .label {
  font-size: 13px;
  color: var(--muted);
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.quick-btn {
  border: none;
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  box-shadow: 0 2px 10px rgba(120, 90, 40, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.quick-btn:active {
  transform: scale(0.98);
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 4px 10px;
}

.share-tip {
  background: #fff7ec;
  border: 1px solid #ffe3c2;
  color: #9a5b1c;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

/* ---------- 食材/菜品列表 ---------- */

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(120, 90, 40, 0.05);
  cursor: pointer;
}

.list-row:active {
  transform: scale(0.99);
}

.thumb,
.thumb-empty {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  flex-shrink: 0;
  object-fit: cover;
  background: #f6f1e8;
}

.thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

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

.list-title {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

.list-right {
  text-align: right;
  flex-shrink: 0;
}

.price {
  color: var(--primary);
  font-weight: 700;
  font-size: 15px;
}

.list-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.dish-photo {
  width: 68px;
  height: 68px;
  border-radius: 14px;
}

.dish-photo-empty {
  width: 68px;
  height: 68px;
  border-radius: 14px;
  font-size: 30px;
}

/* ---------- 悬浮按钮 ---------- */

.fab {
  position: fixed;
  bottom: calc(86px + env(safe-area-inset-bottom));
  right: max(18px, calc(50% - 280px + 18px));
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 28px;
  font-weight: 300;
  box-shadow: 0 6px 18px rgba(232, 89, 12, 0.4);
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 2px;
}

.fab:active {
  transform: scale(0.95);
}

/* ---------- 表单页 ---------- */

.form-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 16px;
  box-shadow: 0 2px 10px rgba(120, 90, 40, 0.06);
}

.photo-picker {
  position: relative;
  width: 128px;
  height: 128px;
  border-radius: 18px;
  border: 1.5px dashed #d8cbb4;
  background: #faf6ef;
  margin: 0 auto 20px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.photo-picker img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-picker .picker-emoji {
  font-size: 40px;
  line-height: 1.1;
}

.photo-picker .picker-hint {
  font-size: 12px;
  margin-top: 6px;
}

.remove-photo {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  z-index: 2;
}

.form-label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 5px;
}

.danger-btn {
  width: 100%;
  border: 1px solid #ffc9c0;
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 0;
  margin-top: 10px;
}

/* ---------- 菜品编辑 ---------- */

.cost-box {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  background: #fff7ec;
  border: 1px solid #ffe3c2;
  border-radius: 12px;
  padding: 12px 14px;
  margin: 14px 0 4px;
}

.cost-box .cost-label {
  color: #9a5b1c;
  font-size: 13px;
}

.cost-box .cost-value {
  color: var(--primary);
  font-size: 22px;
  font-weight: 800;
}

.dish-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
}

.dish-row select {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: #faf7f2;
  border-radius: 10px;
  padding: 9px 8px;
  outline: none;
}

.dish-row input {
  width: 72px;
  border: 1px solid var(--line);
  background: #faf7f2;
  border-radius: 10px;
  padding: 9px 6px;
  text-align: center;
  outline: none;
}

.row-unit {
  width: 24px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  flex-shrink: 0;
}

.row-subtotal {
  width: 58px;
  font-size: 12.5px;
  color: var(--primary);
  font-weight: 600;
  text-align: right;
  flex-shrink: 0;
}

.row-del {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13px;
  flex-shrink: 0;
}

.add-row-btn {
  width: 100%;
  border: 1.5px dashed #d8cbb4;
  background: #faf6ef;
  color: var(--muted);
  border-radius: 12px;
  padding: 11px 0;
  font-size: 14px;
  margin-top: 4px;
}

.hint {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 8px;
}

/* ---------- 提示条 ---------- */

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(43, 41, 38, 0.92);
  color: #fff;
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 14px;
  z-index: 99;
  max-width: 86vw;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
