:root {
  --paper: #f5f1e9;
  --ink: #132f2f;
  --muted: #697978;
  --green: #173f3d;
  --green-soft: #dce8e2;
  --red: #c65343;
  --white: #fffdf9;
  --line: rgba(22, 57, 56, 0.12);
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  margin: 0;
  background:
    radial-gradient(circle at 100% 0, rgba(198, 83, 67, 0.08), transparent 26rem),
    var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.app-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 18px
    calc(108px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(198, 83, 67, 0.25);
  border-radius: 16px;
  background: var(--white);
  color: var(--red);
  font-family: STKaiti, KaiTi, serif;
  font-size: 24px;
  box-shadow: 0 8px 25px rgba(38, 65, 60, 0.08);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.topbar h1, .section-heading h2, .form-heading h2 {
  margin: 0;
  font-family: STKaiti, KaiTi, "Songti SC", serif;
  font-weight: 700;
}

.topbar h1 { font-size: 25px; letter-spacing: 0.04em; }

.header-add {
  display: flex;
  align-items: center;
  gap: 3px;
  min-height: 42px;
  margin-left: auto;
  padding: 0 15px;
  border: 0;
  border-radius: 14px;
  background: var(--green);
  color: white;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(23, 63, 61, 0.18);
}

.header-add span:first-child { font-size: 19px; font-weight: 400; line-height: 1; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.topbar-actions .header-add { margin-left: 0; }

.manage-button {
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 249, 0.72);
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.summary-card {
  position: relative;
  overflow: hidden;
  padding: 23px 22px 20px;
  border-radius: 26px;
  background: var(--green);
  color: white;
  box-shadow: 0 18px 35px rgba(23, 63, 61, 0.2);
}

.summary-card::after {
  position: absolute;
  right: -37px;
  bottom: -52px;
  width: 145px;
  height: 145px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
  content: "";
}

.summary-decor {
  position: absolute;
  top: -44px;
  right: 30px;
  width: 92px;
  height: 92px;
  border: 18px solid rgba(255, 255, 255, 0.045);
  border-radius: 50%;
}

.summary-label {
  position: relative;
  z-index: 1;
  margin: 0 0 6px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
}

.summary-card > strong {
  position: relative;
  z-index: 1;
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(32px, 9vw, 42px);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.summary-meta {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 17px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

.summary-meta b { color: white; font-size: 14px; }
.summary-meta i { width: 1px; height: 13px; background: rgba(255, 255, 255, 0.18); }
.records-section { margin-top: 31px; }

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

.section-heading h2, .form-heading h2 { font-size: 23px; }
.section-heading > span { color: var(--muted); font-size: 12px; }

.filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 13px;
}

.filter-row select {
  width: 100%;
  min-height: 42px;
  padding: 0 34px 0 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  background-color: rgba(255, 253, 249, 0.72);
  color: var(--ink);
  font-size: 13px;
}

.record-list { display: grid; gap: 12px; }

.record-card {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 253, 249, 0.88);
  box-shadow: 0 8px 24px rgba(32, 57, 53, 0.055);
}

.record-main { display: flex; gap: 13px; }

.province-badge {
  display: grid;
  flex: 0 0 auto;
  width: 47px;
  height: 47px;
  place-items: center;
  border-radius: 15px;
  background: var(--green-soft);
  color: var(--green);
  font-family: STKaiti, KaiTi, serif;
  font-size: 21px;
  font-weight: 700;
}

.record-copy { min-width: 0; flex: 1; }

.record-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.record-title h3 {
  overflow: hidden;
  margin: 0;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-title span {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1eae0;
  color: #7c6658;
  font-size: 12px;
  font-weight: 700;
}

.record-copy p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }

.record-copy small {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 7px;
  color: #8b9693;
  font-size: 12px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.record-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 15px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.record-bottom > div:first-child { display: grid; gap: 3px; }
.record-bottom span { color: var(--muted); font-size: 11px; }

.record-bottom strong {
  color: var(--red);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
}

.record-actions { display: flex; gap: 7px; }

.record-actions button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.record-actions button.danger { color: var(--red); }

.empty-card, .loading-card {
  padding: 42px 24px;
  border: 1px dashed rgba(23, 63, 61, 0.2);
  border-radius: 24px;
  background: rgba(255, 253, 249, 0.58);
  text-align: center;
}

.empty-symbol {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 15px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-size: 27px;
  font-weight: 300;
}

.empty-card h3 { margin: 0; font-size: 17px; }
.empty-card p, .loading-card { color: var(--muted); font-size: 13px; line-height: 1.7; }
.empty-card p { max-width: 300px; margin: 7px auto 18px; }

.empty-card button {
  min-height: 42px;
  padding: 0 17px;
  border: 0;
  border-radius: 13px;
  background: var(--green);
  color: white;
  font-size: 13px;
  font-weight: 700;
}

.empty-card.compact { padding: 30px 22px; }
.empty-card.compact button { margin-top: 15px; }
.storage-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 26px 0 0;
  color: #87918f;
  font-size: 11px;
  text-align: center;
}

.storage-note button {
  padding: 2px 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: #6d7d7a;
  font-size: 11px;
}

.floating-add {
  position: fixed;
  right: max(22px, calc((100vw - 720px) / 2));
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 10;
  display: grid;
  width: 55px;
  height: 55px;
  place-items: center;
  border: 4px solid rgba(245, 241, 233, 0.9);
  border-radius: 50%;
  background: var(--red);
  color: white;
  font-size: 27px;
  font-weight: 300;
  box-shadow: 0 14px 30px rgba(150, 59, 47, 0.28);
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-top: env(safe-area-inset-top);
  background: rgba(10, 31, 30, 0.42);
  backdrop-filter: blur(3px);
}

.form-sheet {
  width: min(100%, 720px);
  max-height: calc(100vh - 20px - env(safe-area-inset-top));
  overflow-y: auto;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  border-radius: 27px 27px 0 0;
  background: var(--white);
  box-shadow: 0 -18px 50px rgba(9, 34, 33, 0.18);
  animation: sheet-in 220ms ease-out;
}

@keyframes sheet-in {
  from { transform: translateY(20px); opacity: 0; }
}

.sheet-handle {
  width: 38px;
  height: 4px;
  margin: 0 auto 16px;
  border-radius: 999px;
  background: #dedbd4;
}

.form-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.form-heading > button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #f1eee8;
  color: var(--ink);
  font-size: 23px;
  font-weight: 300;
}

.form-sheet form { display: grid; gap: 16px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 7px; }
.field > span { color: #536563; font-size: 12px; font-weight: 700; }
.field em { color: #9ca5a3; font-size: 10px; font-style: normal; font-weight: 400; }

.field select, .field input, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
  background: #f8f5f0;
  color: var(--ink);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field select, .field input { min-height: 48px; padding: 0 12px; }
.field textarea { min-height: 84px; resize: vertical; padding: 12px; line-height: 1.55; }

.field select:focus, .field input:focus, .field textarea:focus {
  border-color: rgba(23, 63, 61, 0.45);
  box-shadow: 0 0 0 3px rgba(23, 63, 61, 0.08);
}

.input-with-unit { position: relative; }
.input-with-unit input { padding-right: 35px; }

.input-with-unit i {
  position: absolute;
  top: 50%;
  right: 13px;
  color: #8d9895;
  font-size: 12px;
  font-style: normal;
  pointer-events: none;
  transform: translateY(-50%);
}

.cost-input input { padding-right: 12px; padding-left: 30px; }
.cost-input i { right: auto; left: 13px; }

.calculated-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  border-radius: 14px;
  background: #edf2ee;
}

.calculated-total span { color: #60726f; font-size: 12px; }

.calculated-total strong {
  color: var(--green);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
  margin-top: 3px;
}

.form-actions button {
  min-height: 50px;
  border-radius: 15px;
  font-size: 14px;
  font-weight: 700;
}

.secondary-button { border: 1px solid var(--line); background: transparent; color: var(--green); }
.primary-button {
  border: 0;
  background: var(--green);
  color: white;
  box-shadow: 0 10px 22px rgba(23, 63, 61, 0.18);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.login-shell {
  position: relative;
  display: grid;
  min-height: 100svh;
  overflow: hidden;
  place-items: center;
  padding: calc(26px + env(safe-area-inset-top)) 20px
    calc(26px + env(safe-area-inset-bottom));
  background: var(--paper);
}

.login-orbit {
  position: absolute;
  border: 1px solid rgba(23, 63, 61, 0.09);
  border-radius: 50%;
  pointer-events: none;
}

.orbit-one {
  top: -145px;
  right: -125px;
  width: 340px;
  height: 340px;
}

.orbit-two {
  bottom: -175px;
  left: -135px;
  width: 390px;
  height: 390px;
  border-width: 38px;
  border-color: rgba(198, 83, 67, 0.04);
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(100%, 390px);
  padding: 31px 25px 24px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 253, 249, 0.94);
  box-shadow: 0 26px 70px rgba(25, 55, 51, 0.13);
}

.login-brand {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 19px;
  place-items: center;
  border: 1px solid rgba(198, 83, 67, 0.25);
  border-radius: 18px;
  background: #fffaf4;
  color: var(--red);
  font-family: STKaiti, KaiTi, serif;
  font-size: 29px;
  box-shadow: 0 10px 28px rgba(38, 65, 60, 0.08);
}

.login-card h1 {
  margin: 3px 0 0;
  font-family: STKaiti, KaiTi, "Songti SC", serif;
  font-size: 32px;
  letter-spacing: 0.05em;
}

.login-intro {
  min-height: 22px;
  margin: 7px 0 20px;
  color: var(--muted);
  font-size: 13px;
}

.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border-radius: 14px;
  background: #eeebe5;
}

.login-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #75817f;
  font-size: 13px;
  font-weight: 700;
}

.login-tabs button.active {
  background: var(--white);
  color: var(--green);
  box-shadow: 0 3px 12px rgba(31, 59, 55, 0.08);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
}

.login-form label > span {
  color: #536563;
  font-size: 12px;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  background: #f7f4ef;
  color: var(--ink);
  font-size: 15px;
  letter-spacing: 0.02em;
}

.login-form input:focus {
  border-color: rgba(23, 63, 61, 0.45);
  box-shadow: 0 0 0 3px rgba(23, 63, 61, 0.08);
}

.login-error,
.admin-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 11px;
  background: rgba(198, 83, 67, 0.1);
  color: #a33f34;
  font-size: 12px;
  line-height: 1.5;
}

.login-submit {
  min-height: 51px;
  margin-top: 3px;
  border: 0;
  border-radius: 15px;
  background: var(--green);
  color: white;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 12px 25px rgba(23, 63, 61, 0.19);
}

.login-submit:disabled,
.primary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.login-help {
  margin: 16px 0 0;
  color: #8a9592;
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

.admin-sheet {
  display: grid;
  gap: 14px;
  max-height: calc(100svh - 18px - env(safe-area-inset-top));
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

.admin-sheet .form-heading { margin-bottom: 2px; }

.admin-block {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #faf8f4;
}

.admin-block-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.admin-block-heading h3 {
  margin: 0;
  font-size: 15px;
}

.admin-block-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.code-create-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 9px;
}

.code-create-form .primary-button {
  min-width: 82px;
  min-height: 48px;
  padding: 0 15px;
  border-radius: 13px;
  font-size: 13px;
  font-weight: 700;
}

.new-code-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(23, 63, 61, 0.13);
  border-radius: 15px;
  background: var(--green-soft);
}

.new-code-box > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.new-code-box span {
  color: #617370;
  font-size: 11px;
}

.new-code-box strong {
  overflow-wrap: anywhere;
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 18px;
  letter-spacing: 0.07em;
}

.new-code-box button {
  align-self: center;
  min-height: 35px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: var(--green);
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.new-code-box p {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  color: #6f7f7c;
  font-size: 10px;
  line-height: 1.5;
}

.admin-empty {
  margin: 0;
  padding: 14px 0;
  color: #8a9592;
  font-size: 12px;
  text-align: center;
}

.code-list { display: grid; gap: 2px; }

.code-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.code-row:first-child { border-top: 0; }

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3f8b68;
  box-shadow: 0 0 0 4px rgba(63, 139, 104, 0.1);
}

.status-dot.off {
  background: #a9afad;
  box-shadow: 0 0 0 4px rgba(127, 135, 132, 0.08);
}

.code-row > div:nth-child(2) {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.code-row strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-row small {
  color: #899491;
  font-size: 10px;
}

.code-actions { display: flex; gap: 6px; }

.code-actions button {
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
}

.code-actions button.danger { color: var(--red); }

.password-panel {
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #faf8f4;
}

.password-panel summary {
  cursor: pointer;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.password-panel form {
  display: grid;
  gap: 13px;
  margin-top: 17px;
}

.password-panel .primary-button {
  min-height: 48px;
  border-radius: 13px;
  font-size: 13px;
  font-weight: 700;
}

@media (min-width: 680px) {
  .app-shell { padding-right: 28px; padding-left: 28px; }
  .record-list { grid-template-columns: 1fr 1fr; }
  .form-sheet { margin-bottom: 24px; border-radius: 27px; }
}

@media (max-width: 420px) {
  .field-grid { grid-template-columns: 1fr; }
  .field-grid.two-columns { grid-template-columns: 1fr 1fr; }

  .topbar-actions { gap: 6px; }
  .manage-button { padding: 0 10px; }
  .header-add { padding: 0 12px; }
  .code-create-form { grid-template-columns: 1fr; }
  .code-create-form .primary-button { width: 100%; }
  .code-row { grid-template-columns: auto minmax(0, 1fr); }
  .code-actions { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

[hidden] { display: none !important; }

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  max-width: calc(100vw - 36px);
  padding: 12px 17px;
  transform: translateX(50%);
  border-radius: 14px;
  background: var(--green);
  color: white;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 12px 34px rgba(19, 47, 47, 0.24);
}

/* Business ledger v2 */
.business-shell { padding-bottom: calc(108px + env(safe-area-inset-bottom)); }
.business-topbar { position: relative; margin-bottom: 16px; }
.brand-copy { min-width: 0; }
.brand-copy small { display: block; overflow: hidden; margin-top: 2px; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.icon-button { min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,253,249,.72); color: var(--muted); font-size: 11px; font-weight: 700; }

.owner-switcher { margin-bottom: 18px; padding: 13px 15px; border: 1px solid rgba(23,63,61,.12); border-radius: 17px; background: rgba(255,253,249,.72); }
.owner-switcher label { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 12px; }
.owner-switcher label > span { color: var(--muted); font-size: 11px; font-weight: 700; }
.owner-switcher select { width: 100%; min-height: 39px; padding: 0 34px 0 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--white); color: var(--ink); font-size: 12px; font-weight: 700; }
.owner-switcher small { display: block; margin-top: 7px; color: #8a9592; font-size: 9px; }

.business-page { animation: page-in .18s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.dashboard-hero { margin-bottom: 14px; }
.metric-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-bottom: 14px; }
.metric-card { display: grid; gap: 7px; min-height: 91px; padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--white); box-shadow: 0 8px 24px rgba(26,51,48,.05); }
.metric-card span { color: var(--muted); font-size: 10px; }
.metric-card strong { align-self: end; color: var(--ink); font-size: 18px; }
.metric-card.profit-card { background: linear-gradient(135deg,#e2eee8,#f9f8f3); }
.metric-card.profit-card strong { color: #287357; }
.negative { color: var(--red) !important; }

.quick-actions { display: grid; gap: 10px; }
.quick-card { display: flex; align-items: center; gap: 13px; width: 100%; padding: 14px 16px; border: 1px solid rgba(23,63,61,.12); border-radius: 18px; background: var(--white); color: var(--ink); text-align: left; box-shadow: 0 8px 24px rgba(26,51,48,.05); }
.quick-card > span { display: grid; flex: 0 0 42px; height: 42px; place-items: center; border-radius: 14px; background: var(--green-soft); color: var(--green); font-size: 20px; font-weight: 700; }
.quick-card.sale > span { background: rgba(198,83,67,.12); color: var(--red); }
.quick-card div { display: grid; gap: 3px; }
.quick-card strong { font-size: 13px; }
.quick-card small { color: var(--muted); font-size: 10px; }

.section-add { min-height: 38px; padding: 0 13px; border: 0; border-radius: 12px; background: var(--green); color: #fff; font-size: 11px; font-weight: 700; box-shadow: 0 8px 20px rgba(23,63,61,.18); }
.inventory-view-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 11px; padding: 5px; border-radius: 14px; background: #ebe8e2; }
.inventory-view-switch button { min-height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 700; }
.inventory-view-switch button.active { background: var(--white); color: var(--green); box-shadow: 0 3px 10px rgba(23,63,61,.08); }
.region-overview { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; margin-bottom: 11px; }
.region-overview > div { display: grid; gap: 4px; padding: 11px; border: 1px solid var(--line); border-radius: 13px; background: var(--white); }
.region-overview span { color: var(--muted); font-size: 8px; }
.region-overview strong { overflow: hidden; color: var(--green); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.inventory-list,.order-list { display: grid; gap: 11px; }
.inventory-card { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 19px; background: var(--white); box-shadow: 0 8px 24px rgba(26,51,48,.05); }
.inventory-copy { display: grid; gap: 4px; min-width: 0; }
.inventory-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.inventory-title h3 { margin: 0; font-size: 14px; }
.inventory-title strong { color: var(--green); font-size: 15px; white-space: nowrap; }
.inventory-copy p,.inventory-copy small { margin: 0; }
.inventory-copy p { color: var(--muted); font-size: 11px; }
.inventory-copy small { color: #8a9592; font-size: 9px; }
.inventory-copy em { justify-self: start; padding: 3px 7px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 9px; font-style: normal; font-weight: 700; }
.inventory-sale-button { min-height: 34px; padding: 0 11px; border: 0; border-radius: 11px; background: var(--green-soft); color: var(--green); font-size: 10px; font-weight: 700; }
.region-card { display: grid; gap: 10px; padding: 15px; border: 1px solid var(--line); border-radius: 19px; background: var(--white); box-shadow: 0 8px 24px rgba(26,51,48,.05); }
.region-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.region-card-head > div { display: grid; gap: 3px; }
.region-card-head h3,.region-card-head small { margin: 0; }
.region-card-head h3 { font-size: 15px; }
.region-card-head small { color: var(--muted); font-size: 9px; }
.region-card-head > strong { color: var(--green); font-size: 15px; white-space: nowrap; }
.region-spec-list { display: grid; border-top: 1px solid var(--line); }
.region-spec-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.region-spec-row:last-child { padding-bottom: 0; border-bottom: 0; }
.region-spec-row > div { display: grid; gap: 3px; }
.region-spec-row > div:nth-child(2) { justify-items: end; }
.region-spec-row strong,.region-spec-row b { font-size: 11px; }
.region-spec-row small { color: var(--muted); font-size: 8px; }

.order-card { display: grid; gap: 10px; padding: 15px; border: 1px solid var(--line); border-radius: 19px; background: var(--white); box-shadow: 0 8px 24px rgba(26,51,48,.05); }
.order-head,.order-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.order-head > div { display: grid; gap: 3px; }
.order-head strong { font-size: 12px; letter-spacing: .02em; }
.order-head small { color: #8a9592; font-size: 9px; }
.owner-badge { max-width: 45%; overflow: hidden; padding: 4px 8px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 9px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.order-body { display: grid; gap: 4px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.order-body h3,.order-body p,.order-body small { margin: 0; }
.order-body h3 { font-size: 14px; }
.order-body p { color: #445b59; font-size: 11px; line-height: 1.65; }
.order-body small { color: #8a9592; font-size: 9px; }
.order-foot > div:first-child { display: grid; gap: 3px; }
.order-foot span { color: var(--muted); font-size: 9px; }
.order-foot strong { font-size: 15px; }
.profit-text { color: #287357; font-size: 9px; font-weight: 700; }
.order-actions { display: flex; gap: 6px; }
.order-actions button { min-height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--green); font-size: 10px; font-weight: 700; }
.order-actions button.danger { color: var(--red); }
.sale-cup-details { display: grid; gap: 10px; margin: 6px 0; }
.sale-cup-row { min-width: 0; }
.sale-card .sale-cup-row p { font-size: 14px; }
.sale-card .sale-cup-row small { display: block; color: var(--muted); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.sale-order-totals { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin: 0; }
.sale-order-totals > div { min-width: 0; padding: 10px; border-radius: 12px; background: #f5f4ef; }
.sale-order-totals dt { color: var(--muted); font-size: 14px; }
.sale-order-totals dd { margin: 5px 0 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sale-order-totals small { display: block; margin-top: 4px; font-size: 13px; }
.sale-order-totals .sale-total-profit { background: var(--green-soft); color: #287357; }
.sale-order-totals .sale-total-profit.negative { background: #fff1ed; color: var(--red); }
.sale-cost-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.sale-card-actions { justify-content: flex-end; }
.sale-card-actions button { min-height: 40px; font-size: 14px; }
.status-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.status-tag { padding: 4px 8px; border-radius: 999px; font-size: 9px; font-weight: 700; }
.status-tag.good { background: #e1f0e7; color: #287357; }
.status-tag.warn { background: #fff0d7; color: #9b681c; }
.status-tag.muted { background: #ececea; color: #737b79; }

.bottom-nav { position: fixed; z-index: 30; right: 50%; bottom: 0; display: grid; grid-template-columns: repeat(4,1fr); width: min(100%,760px); padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); transform: translateX(50%); border-top: 1px solid rgba(23,63,61,.1); background: rgba(255,253,249,.94); box-shadow: 0 -8px 30px rgba(27,54,51,.08); backdrop-filter: blur(16px); }
.bottom-nav button { display: grid; gap: 2px; place-items: center; min-height: 48px; border: 0; border-radius: 14px; background: transparent; color: #82908d; }
.bottom-nav button > span { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 9px; font-family: STKaiti,KaiTi,serif; font-size: 14px; }
.bottom-nav button small { font-size: 9px; font-weight: 700; }
.bottom-nav button.active { color: var(--green); }
.bottom-nav button.active > span { background: var(--green-soft); }

.wide-sheet { max-height: min(92vh,880px); overflow-y: auto; }
.owner-field { margin-bottom: 14px; }
.quick-mode-note { display: flex; align-items: center; gap: 9px; margin: -2px 0 12px; padding: 10px 12px; border-radius: 13px; background: var(--green-soft); }
.quick-mode-note > span { flex: 0 0 auto; padding: 4px 7px; border-radius: 999px; background: var(--green); color: #fff; font-size: 8px; font-weight: 700; letter-spacing: .06em; }
.quick-mode-note p { margin: 0; color: #46615e; font-size: 10px; }
.quick-mode-note.sale { background: rgba(198,83,67,.09); }
.quick-mode-note.sale > span { background: var(--red); }
.quick-buyer-field { margin-bottom: 4px; }
.linked-purchase-field { margin-bottom: 12px; }
.linked-purchase-field > small { margin-top: 5px; color: #8a9592; font-size: 9px; line-height: 1.5; }
.quick-note-field { margin: 12px 0 15px; }
.quick-note-field textarea { min-height: 58px; }
.quick-line-section { margin-top: 10px; }
.quick-total { margin: 12px 0; }
.quick-details { margin: 12px 0 15px; border: 1px solid var(--line); border-radius: 15px; background: #faf8f4; overflow: hidden; }
.quick-details summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 14px; cursor: pointer; list-style: none; color: var(--ink); }
.quick-details summary::-webkit-details-marker { display: none; }
.quick-details summary > div { display: grid; gap: 2px; }
.quick-details summary strong { font-size: 11px; }
.quick-details summary small { color: #8a9592; font-size: 9px; font-weight: 400; }
.quick-details summary::after { content: "展开"; flex: 0 0 auto; color: var(--green); font-size: 9px; font-weight: 700; }
.quick-details[open] summary { border-bottom: 1px solid var(--line); }
.quick-details[open] summary::after { content: "收起"; }
.quick-details-body { display: grid; gap: 13px; padding: 14px; }
.quick-details-body .fee-section { margin: 0; padding: 0; border: 0; background: transparent; }
.line-section { display: grid; gap: 10px; margin: 15px 0; padding: 13px; border: 1px solid var(--line); border-radius: 17px; background: #faf8f4; }
.line-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.line-section-heading > div { display: grid; gap: 2px; }
.line-section-heading strong { font-size: 12px; }
.line-section-heading small { color: #8a9592; font-size: 9px; }
.line-section-heading button { min-height: 32px; padding: 0 9px; border: 0; border-radius: 9px; background: var(--green-soft); color: var(--green); font-size: 10px; font-weight: 700; }
.order-lines { display: grid; gap: 9px; }
.order-line { position: relative; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px; padding: 10px; border: 1px solid rgba(23,63,61,.1); border-radius: 13px; background: var(--white); }
.line-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; min-width: 0; }
.sale-line-fields { grid-template-columns: minmax(0,2fr) minmax(62px,.6fr) minmax(75px,.75fr); }
.mini-field { display: grid; gap: 4px; min-width: 0; }
.mini-field > span { color: var(--muted); font-size: 8px; font-weight: 700; }
.mini-field select,.mini-field input { width: 100%; min-width: 0; min-height: 38px; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; background: #fbfaf7; color: var(--ink); font-size: 10px; }
.line-remove { align-self: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 9px; background: rgba(198,83,67,.1); color: var(--red); font-size: 17px; }
.pricing-mode { margin: 15px 0 0; padding: 0; border: 0; }
.pricing-mode legend { margin-bottom: 8px; color: var(--ink); font-size: 11px; font-weight: 700; }
.mode-options { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 5px; border-radius: 13px; background: #ebe8e2; }
.mode-options label { position: relative; }
.mode-options input { position: absolute; opacity: 0; }
.mode-options span { display: grid; min-height: 39px; place-items: center; border-radius: 10px; color: var(--muted); font-size: 10px; font-weight: 700; }
.mode-options input:checked + span { background: var(--white); color: var(--green); box-shadow: 0 3px 10px rgba(23,63,61,.08); }
.helper-field { align-content: center; padding: 10px 13px; border-radius: 13px; background: var(--green-soft); }
.helper-field strong { color: var(--green); font-size: 16px; }
.fee-section { margin: 15px 0; padding: 13px; border: 1px solid var(--line); border-radius: 17px; background: #faf8f4; }
.fee-section h3 { margin: 0 0 11px; font-size: 11px; }
.check-field { display: flex; align-items: center; gap: 9px; margin: 10px 0; padding: 12px; border-radius: 13px; background: #fff0d7; color: #77501b; font-size: 10px; font-weight: 700; }
.check-field input { width: 17px; height: 17px; accent-color: var(--green); }
.sale-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 15px 0; }
.sale-summary > div { display: grid; gap: 5px; padding: 12px; border-radius: 14px; background: var(--green-soft); }
.sale-summary span { color: var(--muted); font-size: 9px; }
.sale-summary strong { color: var(--green); font-size: 15px; }

@media (min-width:680px){
  .metric-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .inventory-list,.order-list { grid-template-columns: 1fr 1fr; }
  .wide-sheet { max-width: 720px; }
}
@media (max-width:470px){
  .region-overview { grid-template-columns: 1fr 1fr; }
  .sale-line-fields { grid-template-columns: minmax(0,1fr) 62px; }
  .sale-line-fields .mini-field:last-child { grid-column: 1 / -1; }
  .line-fields:not(.sale-line-fields) { grid-template-columns: 1fr 1fr; }
}
