:root {
  --paper: #f7f3ea;
  --paper-soft: #fbf8f1;
  --desk: #e9e4d8;
  --white: #fffdf8;
  --ink: #1d2924;
  --muted: #5e6862;
  --line: #ddd7ca;
  --green: #155044;
  --green-dark: #113f36;
  --green-soft: #e4ede7;
  --orange: #c94a26;
  --orange-dark: #ad3d1e;
  --orange-soft: #f7e5dd;
  --amber-soft: #f5ead2;
  --shadow: 0 22px 60px rgba(27, 38, 32, 0.14);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100dvh;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
}

svg {
  display: block;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(21, 80, 68, 0.28);
  outline-offset: 2px;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.stage {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 253, 248, 0.75), transparent 28%),
    var(--desk);
}

.phone {
  position: relative;
  width: min(460px, 100vw);
  height: min(900px, calc(100dvh - 24px));
  overflow: hidden;
  border: 1px solid rgba(23, 50, 42, 0.12);
  border-radius: 30px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.auth-screen {
  position: absolute;
  z-index: 45;
  inset: 0;
  overflow-y: auto;
  padding: max(34px, env(safe-area-inset-top)) 25px calc(30px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 100% 0, rgba(201, 74, 38, 0.07), transparent 30%),
    var(--paper);
  scrollbar-width: none;
}

.auth-screen[hidden] {
  display: none;
}

.auth-screen::-webkit-scrollbar {
  display: none;
}

.auth-shell {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: center;
}

.auth-brand {
  position: absolute;
  top: max(28px, env(safe-area-inset-top));
  left: 25px;
  display: flex;
  align-items: center;
  gap: 13px;
}

.auth-brand img {
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(21, 80, 68, 0.2);
}

.auth-brand div {
  display: grid;
  gap: 2px;
}

.auth-brand strong {
  font-size: 25px;
  font-weight: 760;
  letter-spacing: 0.06em;
}

.auth-brand span {
  color: var(--muted);
  font-size: 15px;
}

.auth-copy {
  margin-bottom: 26px;
}

.auth-copy h1 {
  margin: 0;
  font-size: 43px;
  line-height: 1.12;
  font-weight: 760;
  letter-spacing: -0.05em;
}

.auth-copy p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 19px;
}

.auth-form {
  display: grid;
  gap: 19px;
}

.auth-field {
  display: grid;
  gap: 9px;
}

.auth-field span {
  font-size: 19px;
  font-weight: 650;
}

.auth-field input {
  width: 100%;
  height: 62px;
  padding: 0 15px;
  border: 1px solid #cfc9bc;
  border-radius: 13px;
  outline: 0;
  background: var(--white);
  color: var(--ink);
  font-size: 21px;
}

.auth-field input:focus {
  border-color: rgba(21, 80, 68, 0.5);
  box-shadow: 0 0 0 4px rgba(21, 80, 68, 0.08);
}

.auth-error {
  margin: -4px 0 0;
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--orange-soft);
  color: var(--orange-dark);
  font-size: 16px;
}

.auth-submit {
  width: 100%;
  min-height: 66px;
  margin-top: 4px;
  border: 0;
  border-radius: 14px;
  background: var(--green);
  color: var(--white);
  font-size: 22px;
  font-weight: 720;
  box-shadow: 0 10px 22px rgba(21, 80, 68, 0.18);
}

.auth-submit:disabled {
  cursor: wait;
  opacity: 0.65;
}

.auth-help {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}

.app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: var(--paper);
}

.topbar {
  z-index: 5;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  height: 78px;
  padding: max(10px, env(safe-area-inset-top)) 22px 8px;
  background: rgba(247, 243, 234, 0.94);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.brand img {
  border-radius: 13px;
  box-shadow: 0 7px 16px rgba(21, 80, 68, 0.18);
}

.brand-type {
  display: grid;
  gap: 2px;
}

.brand-type strong {
  font-size: 24px;
  line-height: 1.1;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.brand-type small {
  color: var(--muted);
  font-size: 14px;
  font-weight: 550;
}

.views {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.view {
  position: absolute;
  inset: 0;
  display: none;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 4px 22px 34px;
  scrollbar-width: none;
}

.view::-webkit-scrollbar {
  display: none;
}

.view.is-active {
  display: block;
  animation: page-in 0.24s ease both;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-loading,
.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 56vh;
  color: var(--muted);
  text-align: center;
}

.view-loading p,
.empty-state p {
  margin: 14px 0 0;
  font-size: 18px;
  line-height: 1.6;
}

.loading-mark,
.empty-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--white);
  color: var(--green);
}

.loading-mark {
  animation: breathe 1.5s ease-in-out infinite;
}

@keyframes breathe {
  50% { opacity: 0.55; transform: translateY(-2px); }
}

.loading-mark svg,
.empty-icon svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state strong {
  margin-top: 16px;
  color: var(--ink);
  font-size: 21px;
}

.text-button {
  min-height: 48px;
  margin-top: 18px;
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  background: var(--green);
  color: var(--white);
  font-size: 16px;
  font-weight: 650;
}

/* 首页 */
.home-page {
  padding-top: 10px;
}

.welcome {
  padding: 2px 0 0;
}

.today {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 17px;
  font-weight: 650;
}

.welcome h1 {
  margin: 0;
  font-size: clamp(34px, 9.5vw, 40px);
  line-height: 1.15;
  font-weight: 760;
  letter-spacing: -0.045em;
}

.welcome > p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.task-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 24px;
}

.task-action {
  display: flex;
  min-height: 178px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 16px;
  border: 0;
  border-radius: 20px;
  color: var(--white);
  text-align: center;
  box-shadow: 0 12px 24px rgba(23, 48, 39, 0.13);
  transition: transform 0.14s ease, opacity 0.14s ease;
}

.task-action:active {
  transform: scale(0.975);
}

.task-action.in {
  background: var(--green);
}

.task-action.out {
  background: var(--orange);
}

.task-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
}

.task-icon svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.task-action strong {
  font-size: 32px;
  line-height: 1.2;
  font-weight: 720;
  letter-spacing: 0.02em;
}

.task-action > span:last-child {
  color: rgba(255, 255, 255, 0.86);
  font-size: 18px;
}

.stock-overview {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  margin-top: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
}

.stock-total {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 18px 19px;
}

.stock-total > span {
  color: var(--muted);
  font-size: 18px;
}

.stock-total > strong {
  margin-top: 3px;
  font-size: 50px;
  line-height: 1.08;
  font-weight: 730;
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
}

.stock-total > strong small {
  margin-left: 5px;
  font-size: 19px;
  font-weight: 550;
  letter-spacing: 0;
}

.stock-total > em {
  margin-top: 3px;
  color: var(--muted);
  font-size: 16px;
  font-style: normal;
}

.stock-alert {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  padding: 10px;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--green-soft);
  color: var(--green);
}

.stock-alert.has-alert {
  background: var(--amber-soft);
  color: #8a5a06;
}

.stock-alert > svg:first-child {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stock-alert > svg:last-child {
  display: none;
}

.stock-alert span {
  display: grid;
  gap: 2px;
  text-align: center;
}

.stock-alert strong {
  font-size: 18px;
  font-weight: 700;
}

.stock-alert small {
  color: currentColor;
  font-size: 16px;
  opacity: 0.88;
}

.recent-section {
  margin-top: 27px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.section-heading h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.section-heading button {
  min-height: 42px;
  padding: 0 3px 0 14px;
  border: 0;
  background: transparent;
  color: var(--green);
  font-size: 15px;
  font-weight: 600;
}

.activity-list {
  border-top: 1px solid var(--line);
}

.activity-row,
.record-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 82px;
  padding: 11px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.direction-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
}

.direction-icon.in {
  background: var(--green-soft);
  color: var(--green);
}

.direction-icon.out {
  background: var(--orange-soft);
  color: var(--orange);
}

.direction-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.activity-copy,
.record-copy {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.activity-copy strong,
.record-copy strong {
  overflow: hidden;
  font-size: 19px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-copy span,
.record-copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-number,
.record-number {
  display: grid;
  justify-items: end;
  gap: 4px;
  min-width: 58px;
}

.activity-number strong,
.record-number strong {
  font-size: 24px;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
}

.activity-number.in,
.record-number.in {
  color: #23694f;
}

.activity-number.out,
.record-number.out {
  color: var(--orange);
}

.activity-number span,
.record-number span {
  color: var(--muted);
  font-size: 16px;
}

/* 通用页面标题 */
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0 20px;
}

.page-heading p {
  margin: 0 0 5px;
  color: var(--green);
  font-size: 15px;
  font-weight: 650;
}

.page-heading h1 {
  margin: 0;
  font-size: 39px;
  line-height: 1.15;
  font-weight: 750;
  letter-spacing: -0.045em;
}

.count-badge {
  flex: 0 0 auto;
  margin-bottom: 2px;
  padding: 7px 11px;
  border-radius: 9px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 14px;
  font-weight: 600;
}

.inventory-heading {
  align-items: center;
}

.add-product-button {
  min-height: 50px;
  padding: 0 16px;
  border: 0;
  border-radius: 13px;
  background: var(--green);
  color: var(--white);
  font-size: 17px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(21, 80, 68, 0.16);
}

/* 库存 */
.search-field {
  display: flex;
  align-items: center;
  height: 62px;
  padding: 0 15px;
  border: 1px solid #d4cec1;
  border-radius: 14px;
  background: var(--white);
}

.search-field > svg {
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-field input {
  width: 100%;
  height: 100%;
  padding: 0 10px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
}

.search-field input::placeholder {
  color: #858b85;
}

.search-clear {
  display: none;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--paper-soft);
  color: var(--muted);
}

.search-clear.is-visible {
  display: grid;
}

.search-clear svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.filter-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 10px;
}

.filter-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 47px;
  padding: 0 12px;
  border: 1px solid #d4cec1;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
}

.filter-button span {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.filter-button.is-active {
  border-color: var(--green);
  background: var(--green);
  color: var(--white);
}

.product-list {
  margin-top: 7px;
  border-top: 1px solid var(--line);
}

.product-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  width: 100%;
  min-height: 96px;
  padding: 14px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.product-badge {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--green-soft);
  color: var(--green);
}

.product-badge svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.product-badge.sand { background: #eee2cd; color: #735b38; }
.product-badge.moss { background: #dfe9e1; color: #3f6855; }
.product-badge.orange { background: var(--orange-soft); color: #a84020; }
.product-badge.clay { background: #ebe0d7; color: #745b4d; }
.product-badge.sky { background: #dfe9e8; color: #476c6e; }
.product-badge.plum { background: #e9e0e6; color: #6e5364; }

.product-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.product-copy strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 20px;
  line-height: 1.35;
  font-weight: 680;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-copy > span {
  overflow: hidden;
  color: var(--muted);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-copy em {
  width: fit-content;
  margin-top: 4px;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--amber-soft);
  color: #855707;
  font-size: 15px;
  font-style: normal;
  font-weight: 600;
}

.product-number {
  display: grid;
  min-width: 55px;
  justify-items: end;
  gap: 2px;
}

.product-number strong {
  font-size: 31px;
  line-height: 1.1;
  font-weight: 730;
  font-variant-numeric: tabular-nums;
}

.product-number span {
  color: var(--muted);
  font-size: 17px;
}

.product-number.low strong {
  color: var(--orange);
}

/* 记录 */
.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 5px;
  border: 1px solid #d4cec1;
  border-radius: 15px;
  background: var(--white);
}

.segmented button {
  min-height: 52px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  font-weight: 600;
}

.segmented button.is-active {
  background: var(--green);
  color: var(--white);
}

.record-date-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.record-date-field {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 8px;
}

.record-date-field span {
  color: var(--ink-soft);
  font-size: 16px;
  font-weight: 650;
}

.record-date-input {
  position: relative;
  display: block;
}

.record-date-field input {
  width: 100%;
  height: 55px;
  padding: 0 13px;
  border: 1px solid #cfc9bc;
  border-radius: 12px;
  outline: 0;
  background: var(--white);
  color: var(--ink);
  font-size: 18px;
}

.record-date-field input.is-empty {
  color: transparent;
}

.record-date-field input.is-empty::-webkit-datetime-edit {
  color: transparent;
}

.record-date-field input:focus {
  border-color: rgba(21, 80, 68, 0.5);
  box-shadow: 0 0 0 4px rgba(21, 80, 68, 0.08);
}

.date-placeholder {
  position: absolute;
  top: 50%;
  left: 14px;
  color: #858b85;
  font-size: 18px;
  pointer-events: none;
  transform: translateY(-50%);
}

.clear-date-button {
  height: 55px;
  flex: 0 0 auto;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 16px;
  font-weight: 650;
}

.records-list {
  margin-top: 25px;
}

.date-group + .date-group {
  margin-top: 28px;
}

.date-group h2 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 5px;
  font-size: 21px;
  font-weight: 700;
}

.date-group h2 span {
  color: var(--muted);
  font-size: 16px;
  font-weight: 500;
}

.record-row {
  min-height: 92px;
}

/* 我的 */
.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--white);
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  border-radius: 18px;
  background: var(--green);
  color: var(--white);
  font-size: 24px;
  font-weight: 700;
}

.profile-copy {
  display: grid;
  gap: 5px;
}

.profile-copy strong {
  font-size: 22px;
  font-weight: 720;
}

.profile-copy span {
  color: var(--muted);
  font-size: 15px;
}

.storage-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 34px;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
  padding: 16px;
  border-radius: 18px;
  background: var(--green-soft);
  color: var(--green);
}

.storage-icon,
.storage-check {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 13px;
  background: rgba(255, 253, 248, 0.72);
}

.storage-check {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--green);
  color: var(--white);
}

.storage-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.storage-check svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.storage-copy {
  display: grid;
  gap: 4px;
}

.storage-copy strong {
  font-size: 20px;
  font-weight: 700;
}

.storage-copy span {
  color: #4d6a5e;
  font-size: 16px;
}

.settings-list {
  margin-top: 24px;
  border-top: 1px solid var(--line);
}

.settings-row {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 24px;
  gap: 13px;
  align-items: center;
  width: 100%;
  min-height: 86px;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.settings-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: var(--white);
  color: var(--green);
}

.settings-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-copy {
  display: grid;
  gap: 4px;
}

.settings-copy strong {
  font-size: 20px;
  font-weight: 650;
}

.settings-copy span {
  color: var(--muted);
  font-size: 16px;
}

.settings-row > svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-row.danger .settings-icon {
  background: var(--orange-soft);
  color: var(--orange);
}

.settings-row.danger .settings-copy strong {
  color: var(--orange-dark);
}

.version-note {
  margin: 26px 0 4px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* 底部导航 */
.tabbar {
  z-index: 8;
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  height: calc(86px + env(safe-area-inset-bottom));
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.97);
  backdrop-filter: blur(18px);
}

.tab {
  display: grid;
  width: 100%;
  min-width: 0;
  place-items: center;
  align-content: center;
  gap: 5px;
  height: 68px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #717973;
  justify-self: stretch;
}

.tab svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab span {
  font-size: 16px;
  font-weight: 600;
}

.tab.is-active {
  color: var(--green);
}

.tab.is-active svg {
  stroke-width: 2;
}

/* 弹层 */
.sheet-layer {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  padding: 0;
  border: 0;
  background: rgba(19, 30, 25, 0.48);
  animation: fade-in 0.2s ease both;
  backdrop-filter: blur(3px);
}

.sheet {
  position: relative;
  width: min(460px, 100vw);
  max-height: 94dvh;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 22px calc(26px + env(safe-area-inset-bottom));
  border-radius: 27px 27px 0 0;
  background: var(--paper);
  box-shadow: 0 -18px 50px rgba(16, 28, 22, 0.2);
  animation: sheet-up 0.28s cubic-bezier(0.2, 0.82, 0.26, 1) both;
  scrollbar-width: none;
}

.sheet::-webkit-scrollbar {
  display: none;
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sheet-handle {
  width: 42px;
  height: 5px;
  margin: 0 auto 17px;
  border-radius: 99px;
  background: #d0cabf;
}

.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 22px;
}

.sheet-header p {
  margin: 0 0 5px;
  color: var(--green);
  font-size: 15px;
  font-weight: 650;
}

.sheet-header h2 {
  margin: 0;
  font-size: 34px;
  line-height: 1.15;
  font-weight: 750;
  letter-spacing: -0.04em;
}

.sheet-close {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid #d4cec1;
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
}

.sheet-close svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.form-field {
  display: block;
  margin-top: 19px;
}

.form-field > span:first-child {
  display: block;
  margin-bottom: 9px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 650;
}

.form-field > span:first-child em {
  color: var(--muted);
  font-size: 14px;
  font-style: normal;
  font-weight: 500;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  border: 1px solid #cfc9bc;
  border-radius: 13px;
  outline: 0;
  background: var(--white);
  color: var(--ink);
  font-size: 20px;
}

.form-field input,
.form-field select {
  height: 62px;
  padding: 0 15px;
}

.form-field textarea {
  min-height: 90px;
  padding: 13px 14px;
  line-height: 1.55;
  resize: none;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: #8b908b;
}

.select-wrap {
  position: relative;
}

.select-wrap::after {
  position: absolute;
  top: 50%;
  right: 17px;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  content: "";
  pointer-events: none;
  transform: translateY(-68%) rotate(45deg);
}

.select-wrap select {
  appearance: none;
  padding-right: 43px;
}

.voice-field-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.voice-field-row input {
  min-width: 0;
  flex: 1;
}

.voice-input-button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 78px;
  flex-direction: column;
  gap: 3px;
  min-height: 62px;
  padding: 5px;
  border: 0;
  border-radius: 13px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 14px;
  font-weight: 650;
}

.voice-input-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.voice-input-button.is-listening {
  background: var(--orange);
  color: var(--white);
  animation: voice-pulse 1s ease-in-out infinite;
}

@keyframes voice-pulse {
  50% { box-shadow: 0 0 0 6px rgba(201, 74, 38, 0.14); }
}

.voice-tip {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.stock-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  margin-top: 12px;
  padding: 10px 15px;
  border-radius: 12px;
  background: var(--green-soft);
  color: #3e5e50;
  font-size: 18px;
}

.stock-note strong {
  font-size: 20px;
  font-weight: 700;
}

.stock-note.low {
  background: var(--amber-soft);
  color: #805406;
}

.quantity-control {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  height: 68px;
  overflow: hidden;
  border: 1px solid #cfc9bc;
  border-radius: 13px;
  background: var(--white);
}

.quantity-control button {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green);
}

.quantity-control button:active {
  background: var(--green-soft);
}

.quantity-control button svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.quantity-control input {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-right: 1px solid #ded9cd;
  border-left: 1px solid #ded9cd;
  border-radius: 0;
  background: transparent;
  font-size: 30px;
  font-weight: 700;
  text-align: center;
  -moz-appearance: textfield;
}

.quantity-control input::-webkit-inner-spin-button,
.quantity-control input::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.submit-button {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 68px;
  margin-top: 24px;
  padding: 10px 18px;
  border: 0;
  border-radius: 14px;
  background: var(--green);
  color: var(--white);
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(21, 80, 68, 0.18);
}

.submit-button.out {
  background: var(--orange);
  box-shadow: 0 10px 22px rgba(201, 74, 38, 0.2);
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

/* 商品详情 */
.product-hero {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: -4px;
  padding: 4px 0 21px;
}

.product-hero .product-badge {
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  border-radius: 18px;
}

.product-hero .product-badge svg {
  width: 34px;
  height: 34px;
}

.product-hero > span:last-child {
  display: grid;
  gap: 5px;
}

.product-hero strong {
  font-size: 21px;
  font-weight: 680;
}

.product-hero small {
  color: var(--muted);
  font-size: 15px;
}

.product-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
}

.product-stats.single {
  grid-template-columns: 1fr;
}

.product-stats > div,
.product-stats > button {
  display: grid;
  gap: 6px;
  padding: 18px;
}

.product-stats > * + * {
  border-left: 1px solid var(--line);
}

.stock-setting {
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  background: var(--white);
  color: var(--ink);
  text-align: left;
}

.stock-setting em {
  margin-top: 3px;
  color: var(--green);
  font-size: 16px;
  font-style: normal;
  font-weight: 650;
}

.product-stats span {
  color: var(--muted);
  font-size: 17px;
}

.product-stats strong {
  font-size: 38px;
  line-height: 1;
  font-weight: 730;
}

.product-stats strong small {
  margin-left: 4px;
  color: var(--muted);
  font-size: 17px;
  font-weight: 500;
}

.simple-alert {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  padding: 14px 15px;
  border-radius: 12px;
  background: var(--amber-soft);
  color: #7d5208;
  font-size: 17px;
  font-weight: 550;
}

.simple-alert svg {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.two-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.wide-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 64px;
  border: 0;
  border-radius: 13px;
  color: var(--white);
  font-size: 21px;
  font-weight: 700;
}

.wide-button.in {
  background: var(--green);
}

.wide-button.out {
  background: var(--orange);
}

.wide-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sheet-description {
  margin: -4px 0 20px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.min-stock-product {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
}

.min-stock-product span {
  font-size: 18px;
  font-weight: 650;
}

.min-stock-product strong {
  flex: 0 0 auto;
  color: var(--green);
  font-size: 18px;
  font-weight: 700;
}

/* 记录详情 */
.record-amount {
  display: grid;
  gap: 4px;
  padding: 7px 0 20px;
  border-bottom: 1px solid var(--line);
}

.record-amount span {
  color: var(--muted);
  font-size: 17px;
}

.record-amount strong {
  font-size: 54px;
  line-height: 1.05;
  font-weight: 720;
  letter-spacing: -0.045em;
}

.record-amount.in strong {
  color: #23694f;
}

.record-amount.out strong {
  color: var(--orange);
}

.record-amount small {
  margin-left: 5px;
  color: var(--muted);
  font-size: 19px;
  font-weight: 500;
}

.record-details {
  margin-top: 8px;
}

.record-details > div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  min-height: 58px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  font-size: 18px;
}

.record-details span {
  flex: 0 0 auto;
  color: var(--muted);
}

.record-details strong {
  font-weight: 600;
  text-align: right;
}

.record-details strong.mono {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 14px;
}

/* 库存提醒 */
.alert-list {
  border-top: 1px solid var(--line);
}

.alert-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 94px;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
}

.alert-row > span {
  display: grid;
  gap: 6px;
}

.alert-row strong {
  font-size: 20px;
  font-weight: 680;
}

.alert-row small {
  color: var(--muted);
  font-size: 16px;
}

.alert-row > svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.sheet-tip {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

.all-good {
  display: grid;
  place-items: center;
  min-height: 240px;
  text-align: center;
}

.all-good > span {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: var(--green-soft);
  color: var(--green);
}

.all-good svg {
  width: 31px;
  height: 31px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.all-good strong {
  margin-top: 17px;
  font-size: 19px;
}

.all-good p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 15px;
}

/* 提示 */
.toast-root {
  position: fixed;
  z-index: 100;
  top: max(20px, env(safe-area-inset-top));
  left: 50%;
  display: grid;
  justify-items: center;
  width: min(410px, calc(100vw - 30px));
  pointer-events: none;
  transform: translateX(-50%);
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 14px 18px;
  border-radius: 13px;
  background: rgba(21, 80, 68, 0.97);
  color: var(--white);
  box-shadow: 0 12px 30px rgba(21, 38, 29, 0.22);
  font-size: 17px;
  font-weight: 550;
  animation: toast-in 0.25s ease both;
  backdrop-filter: blur(12px);
}

.toast.error {
  background: rgba(167, 55, 26, 0.98);
}

.toast svg {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toast.is-leaving {
  animation: toast-out 0.2s ease both;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-9px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(-7px); }
}

@media (max-width: 600px) {
  .stage {
    display: block;
    background: var(--paper);
  }

  .phone {
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .topbar {
    height: calc(74px + env(safe-area-inset-top));
    padding-top: max(9px, env(safe-area-inset-top));
  }

  .sheet {
    width: 100vw;
  }
}

@media (max-width: 350px) {
  .view {
    padding-right: 17px;
    padding-left: 17px;
  }

  .topbar {
    padding-right: 17px;
    padding-left: 17px;
  }

  .task-actions {
    gap: 10px;
  }

  .task-action {
    min-height: 168px;
  }

  .stock-overview {
    grid-template-columns: 1fr;
  }

  .stock-total {
    padding-right: 14px;
    padding-left: 14px;
  }

  .stock-total > strong {
    font-size: 46px;
  }
}

@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;
  }
}
