:root {
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #1f2a24;
  --muted: #718075;
  --line: #dde5de;
  --brand: #1f7a4d;
  --brand-dark: #14583a;
  --accent: #f0a12b;
  --danger: #c74637;
  --soft: #eef7f1;
  --shadow: 0 10px 28px rgba(31, 42, 36, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

.muted {
  color: var(--muted);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, #e8f3eb 0%, #f6f7f4 58%);
}

.login-card,
.card {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-card {
  max-width: 420px;
  padding: 28px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.brand-mark {
  padding: 8px 10px;
  background: var(--brand);
  color: #fff;
  border-radius: 6px;
  font-weight: 800;
}

.brand-sub {
  color: var(--muted);
  font-size: 14px;
}

h1 {
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1.25;
}

.login-form {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 12px;
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.12);
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.primary-btn,
.secondary-btn,
.submit-btn,
.small-btn,
.header-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  font-weight: 700;
}

.primary-btn,
.submit-btn {
  background: var(--brand);
  color: #fff;
}

.primary-btn:hover,
.submit-btn:hover {
  background: var(--brand-dark);
}

.primary-btn:disabled,
.submit-btn:disabled {
  background: #aeb8b0;
  cursor: not-allowed;
}

.secondary-btn,
.small-btn {
  background: #eef2ef;
  color: var(--ink);
}

.full {
  width: 100%;
}

.footnote {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.notice,
.banner {
  margin: 12px 16px;
  padding: 10px 12px;
  border-radius: 6px;
  color: #5f470c;
  background: #fff4d8;
  border: 1px solid #f2dfad;
  font-size: 14px;
}

.notice.error,
.banner.danger {
  color: #7d261c;
  background: #fff0ed;
  border-color: #f4c3bb;
}

.shop-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.mini-brand {
  margin-bottom: 2px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.shop-header h1 {
  margin: 0;
  font-size: 18px;
}

.shop-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.header-link {
  min-width: 54px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 14px;
}

.order-rule {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.date-form {
  width: 150px;
  display: grid;
  gap: 4px;
}

.date-form input {
  padding: 9px 8px;
}

.rule-text {
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.rule-text strong {
  color: var(--brand-dark);
}

.rule-text span {
  color: var(--muted);
}

.search-wrap {
  position: sticky;
  top: 73px;
  z-index: 18;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.search-wrap input {
  height: 42px;
  background: #fff;
}

.shop-layout {
  display: grid;
  grid-template-columns: 94px 1fr;
  align-items: start;
  padding-bottom: 86px;
}

.category-rail {
  position: sticky;
  top: 135px;
  height: calc(100vh - 135px - 76px);
  overflow: auto;
  padding: 8px;
  background: #edf1ee;
  border-right: 1px solid var(--line);
}

.cat-btn {
  width: 100%;
  min-height: 44px;
  margin-bottom: 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #526158;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
}

.cat-btn span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: #91a097;
  font-weight: 500;
}

.cat-btn.active {
  background: #fff;
  color: var(--brand-dark);
  box-shadow: 0 2px 8px rgba(31, 42, 36, 0.06);
}

.shop-content {
  min-width: 0;
}

.subcategory-bar {
  position: sticky;
  top: 135px;
  z-index: 12;
  padding: 10px 8px 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.subcategory-bar > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.subcategory-bar strong {
  font-size: 17px;
}

.subcategory-bar span {
  color: var(--muted);
  font-size: 12px;
}

.subcategory-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.subcat-btn {
  flex: 0 0 auto;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: #fff;
  color: #526158;
  font-weight: 700;
  white-space: nowrap;
}

.subcat-btn span {
  margin-left: 4px;
}

.subcat-btn.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.subcat-btn.active span {
  color: rgba(255, 255, 255, 0.78);
}

.product-list {
  display: grid;
  gap: 8px;
  padding: 8px;
}

.product-card {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.product-main {
  padding: 12px;
}

.product-title {
  min-height: 24px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.product-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  min-height: 18px;
}

.product-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.price {
  color: var(--danger);
  font-size: 18px;
  font-weight: 850;
}

.unit {
  color: var(--muted);
  font-size: 12px;
}

.qty-control {
  display: grid;
  grid-template-columns: 32px minmax(36px, auto) 32px;
  align-items: center;
  gap: 4px;
}

.qty-control button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--brand);
  border-radius: 50%;
  background: #fff;
  color: var(--brand);
  font-size: 20px;
  line-height: 1;
}

.qty-control button:disabled {
  opacity: 0.35;
}

.qty {
  min-width: 36px;
  text-align: center;
  font-weight: 800;
}

.cart-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  display: grid;
  grid-template-columns: 1fr 132px;
  gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
}

.cart-summary {
  min-width: 0;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: #213027;
  color: #fff;
}

.drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  background: rgba(0, 0, 0, 0.36);
}

.drawer-mask.open {
  display: block;
}

.cart-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 31;
  transform: translateY(105%);
  max-height: 82vh;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto auto;
  gap: 10px;
  padding: 16px;
  background: #fff;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.16);
  transition: transform 0.2s ease;
}

.cart-drawer.open {
  transform: translateY(0);
}

.drawer-head,
.drawer-info,
.cart-line,
.history-item,
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer-head button {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.drawer-info {
  padding: 10px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 13px;
}

.cart-items {
  min-height: 80px;
  overflow: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.cart-line {
  padding: 10px 0;
  border-bottom: 1px solid #edf1ee;
}

.cart-line:last-child {
  border-bottom: 0;
}

.cart-line span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.notes-label {
  margin-top: 2px;
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 18px;
}

.page.narrow {
  max-width: 520px;
}

.card {
  padding: 18px;
}

.center-card {
  text-align: center;
}

.success-icon,
.status-icon {
  width: 58px;
  height: 58px;
  display: inline-grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--brand);
  font-size: 24px;
  font-weight: 900;
}

.status-icon {
  width: 72px;
  border-radius: 8px;
  font-size: 16px;
}

.order-total {
  margin: 16px 0;
  color: var(--danger);
  font-size: 30px;
  font-weight: 900;
}

.info-list {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.info-list div {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.info-list span {
  color: var(--muted);
}

.action-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  min-height: 52px;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.history-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.history-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-item span,
.history-item em {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.admin-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px;
}

.admin-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  padding: 14px;
  background: var(--soft);
  border-radius: 8px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin-bottom: 12px;
}

.toolbar label {
  display: grid;
  gap: 5px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  font-size: 14px;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f0f3f1;
  color: #46534b;
  font-size: 13px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
}

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

@media (min-width: 860px) {
  .shop-header,
  .order-rule,
  .search-wrap,
  .shop-layout {
    max-width: 980px;
    margin-left: auto;
    margin-right: auto;
  }

  .product-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cart-bar {
    left: 50%;
    right: auto;
    width: min(980px, 100%);
    transform: translateX(-50%);
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }

  .cart-drawer {
    left: 50%;
    right: auto;
    width: min(560px, calc(100% - 28px));
    transform: translate(-50%, 105%);
  }

  .cart-drawer.open {
    transform: translate(-50%, 0);
  }
}

@media (max-width: 520px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-rule {
    align-items: stretch;
  }

  .date-form {
    width: 144px;
  }

  .cart-bar {
    grid-template-columns: 1fr 116px;
  }
}
