:root {
  --bg: #f6f3ed;
  --panel: #fffdf8;
  --ink: #1f2a24;
  --muted: #6e756c;
  --line: #ded7ca;
  --brand: #24352b;
  --accent: #b35f34;
  --green: #55705b;
  --blue: #426b78;
  --danger: #9d3f37;
  --warn: #c7832f;
  --ok: #3f7652;
  --shadow: 0 12px 30px rgba(32, 38, 31, 0.1);
}

.settings-checks {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.settings-checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft, #f7f8f4);
}

.settings-checks input {
  width: 18px;
  height: 18px;
}

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

.store-banner-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.store-banner-preview {
  width: 140px;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border-radius: 6px;
  background: #eef1eb;
}

.store-banner-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(120px, .7fr) auto;
  gap: 8px;
  align-items: end;
}

.store-banner-path {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
}

.store-banner-path input {
  flex: 1;
}

.store-banner-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.settings-divider {
  height: 1px;
  margin: 8px 0;
  background: var(--line);
}

.store-upsell-list {
  display: grid;
  gap: 10px;
}

.store-upsell-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.8fr) minmax(110px, .6fr) minmax(100px, .5fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.store-upsell-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 44px;
}

.store-upsell-actions label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.store-upsell-actions input {
  width: 18px;
  height: 18px;
}

@media (max-width: 1100px) {
  .store-upsell-row {
    grid-template-columns: minmax(0, 1fr) minmax(110px, .45fr);
  }
}

.payment-settings-panel {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.payment-status-overview {
  border-top: 4px solid var(--accent);
}

.payment-head-actions,
.payment-test-actions,
.payment-refund-checks {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.payment-mode-note {
  margin: 0;
  color: var(--muted);
}

.payment-test-actions {
  margin-top: 14px;
}

.button-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: #fff;
  background: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.button-link.secondary {
  color: var(--accent);
  background: #fff;
}

.payment-provider-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.payment-provider-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.payment-provider-card.ready {
  border-color: #a8c5ae;
}

.payment-check-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.payment-check {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbf8;
}

.payment-check-icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--warn);
  font-weight: 800;
}

.payment-check.ok .payment-check-icon {
  background: var(--ok);
}

.payment-check strong,
.payment-check small,
.callback-row strong,
.callback-row small {
  display: block;
}

.payment-check small,
.callback-row small {
  margin-top: 2px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.payment-detail-grid {
  align-items: start;
}

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

.callback-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.callback-row:last-child {
  border-bottom: 0;
}

.payment-error {
  display: block;
  max-width: 280px;
  margin-top: 3px;
  color: var(--danger);
  white-space: normal;
}

@media (max-width: 900px) {
  .store-banner-row,
  .store-banner-fields,
  .payment-provider-grid,
  .payment-check-list {
    grid-template-columns: 1fr;
  }

  .store-banner-preview {
    width: 100%;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

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

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: white;
  padding: 0 16px;
  cursor: pointer;
}

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

button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  padding: 8px 10px;
  color: var(--ink);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

label input,
label select,
label textarea {
  color: var(--ink);
  font-size: 14px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

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

th {
  color: var(--muted);
  font-weight: 600;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #f8f4ea, #e8eee8);
}

.login-panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 32px;
  display: grid;
  gap: 18px;
}

.brand-mark {
  width: 190px;
  height: 120px;
  object-fit: contain;
}

.login-panel p {
  color: var(--muted);
}

.pos-entry {
  display: grid;
  min-height: 46px;
  place-items: center;
  border-radius: 6px;
  background: var(--brand);
  color: white;
  text-decoration: none;
  font-weight: 700;
}

.stack {
  display: grid;
  gap: 14px;
}

.error {
  color: var(--danger);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 20px;
}

.brand-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-row img {
  width: 42px;
  height: 42px;
}

.brand-row span,
.user-card small,
.topbar p,
small {
  display: block;
  color: var(--muted);
}

nav {
  display: grid;
  gap: 8px;
  align-content: start;
}

nav button {
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
  text-align: left;
}

nav button.active {
  background: #e9efe7;
  border-color: #cdd9ca;
}

.user-card {
  display: grid;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.notice {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #e9efe7;
  color: var(--brand);
  border: 1px solid #cdd9ca;
  box-shadow: 0 10px 24px rgba(36, 53, 43, 0.08);
}

.layout.two {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 18px;
  align-items: start;
}

.product-admin-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(270px, 330px) 1fr;
  gap: 18px;
  align-items: start;
}

.product-list-panel {
  min-width: 0;
}

.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.operation-board {
  margin-bottom: 18px;
}

.operation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.operation-card {
  min-height: 94px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 16px;
  text-align: left;
  color: var(--ink);
  background: linear-gradient(135deg, #fffaf0, #edf3ea);
  border: 1px solid #d6dece;
}

.operation-card strong {
  font-size: 17px;
}

.operation-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.operation-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(36, 53, 43, 0.1);
}

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

.section-head input {
  max-width: 240px;
}

.inline-filters {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  width: min(720px, 100%);
}

.inline-filters input,
.inline-filters select {
  min-width: 130px;
}

.inline-filters input:last-child {
  flex: 1;
  min-width: 240px;
}

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

.compact-toolbar h3 {
  margin-bottom: 3px;
}

.compact-toolbar label {
  min-width: 190px;
}

.table-wrap {
  overflow: auto;
}

#salesTable {
  min-width: 1320px;
}

#salesTable th:nth-child(1),
#salesTable td:nth-child(1) {
  min-width: 150px;
}

#salesTable th:nth-child(2),
#salesTable td:nth-child(2) {
  min-width: 280px;
}

#salesTable th:nth-child(4),
#salesTable td:nth-child(4) {
  min-width: 118px;
}

#salesTable th:nth-child(5),
#salesTable td:nth-child(5),
#salesTable th:nth-child(6),
#salesTable td:nth-child(6) {
  min-width: 128px;
}

#salesTable th:nth-child(7),
#salesTable td:nth-child(7) {
  min-width: 92px;
}

#salesTable td:nth-child(4) input,
#salesTable td:nth-child(5) select,
#salesTable td:nth-child(6) select {
  min-width: 104px;
}

#salesTable .actions {
  min-width: 228px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  border-left: 5px solid var(--accent);
}

.metric:nth-child(2) {
  border-color: var(--blue);
}

.metric:nth-child(3) {
  border-color: var(--green);
}

.metric strong {
  display: block;
  font-size: 26px;
  margin-top: 8px;
}

.visual-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.summary-pill {
  min-height: 62px;
  display: grid;
  gap: 4px;
  align-content: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
  color: var(--ink);
  text-align: left;
}

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

.summary-pill strong {
  font-size: 18px;
}

.summary-pill.ok {
  border-color: #c8dac8;
  background: #f0f6ee;
}

.summary-pill.warn {
  border-color: #efd7b4;
  background: #fff7ea;
}

.summary-pill.filter {
  cursor: pointer;
}

.summary-pill.filter.active {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 2px rgba(36, 53, 43, 0.14);
}

.operation-progress {
  display: grid;
  gap: 14px;
}

.target-row {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
}

.target-row strong,
.target-row span {
  display: block;
}

.target-row span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.operation-alerts {
  display: grid;
  gap: 10px;
}

.alert-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #d8d4ca;
  background: #fbfaf6;
}

.alert-card.warn {
  border-color: #efd7b4;
  background: #fff7ea;
}

.alert-card.ok {
  border-color: #c8dac8;
  background: #f0f6ee;
}

.alert-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.checklist-grid {
  display: grid;
  gap: 10px;
}

.check-row {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
  color: var(--ink);
  font-size: 14px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.status-chip {
  display: inline-grid;
  min-height: 28px;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--green);
  background: #eef1e8;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-chip.ok {
  color: var(--ok);
  background: #e8f4ea;
}

.status-chip.warn {
  color: var(--warn);
  background: #fff1d8;
}

.status-chip.danger {
  color: var(--danger);
  background: #f8e5e2;
}

.line-items {
  display: grid;
  gap: 10px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 12px;
}

.category-tab {
  min-height: 38px;
  flex: 0 0 auto;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}

.category-tab.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.product-card {
  min-height: 152px;
  display: grid;
  grid-template-rows: 92px auto;
  gap: 10px;
  padding: 10px;
  text-align: center;
  background: #fbfaf6;
  color: var(--ink);
  border: 1px solid var(--line);
}

.product-card:hover,
.product-admin-card:hover,
.category-manager-row:hover,
.cart-item:hover {
  border-color: #c9bba9;
  box-shadow: 0 8px 18px rgba(32, 38, 31, 0.06);
}

.product-card strong,
.product-card b {
  display: block;
}

.product-card strong {
  font-size: 16px;
  line-height: 1.25;
}

.product-card b {
  color: var(--accent);
  margin-top: 4px;
}

.cashier-product-photo {
  width: 100%;
  height: 92px;
  object-fit: cover;
  border-radius: 8px;
  background: #e8e6dd;
}

.cashier-product-text {
  min-width: 0;
}

.cart-panel {
  position: sticky;
  top: 18px;
}

.order-heading {
  margin-bottom: 0;
}

.checkout-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.checkout-actions .ghost {
  grid-column: 1 / -1;
}

.cart-list,
.sku-list {
  display: grid;
  gap: 10px;
}

.sales-editor {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
}

.material-editor {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid #cdd9ca;
  border-radius: 8px;
  background: #f2f7ef;
}

.material-editor details {
  display: grid;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
}

.material-editor summary {
  cursor: pointer;
  color: var(--green);
  font-weight: 700;
}

.editor-head,
.editor-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.editor-total {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.editor-total strong {
  color: var(--accent);
  font-size: 22px;
}

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

.actions.compact {
  flex-wrap: nowrap;
}

.actions button {
  min-height: 34px;
  padding: 0 10px;
  white-space: nowrap;
}

.muted-row {
  opacity: 0.62;
}

td small {
  display: block;
  margin-top: 4px;
}

button.danger-btn {
  color: var(--danger);
  border-color: #d8b9b4;
}

.stat-bars {
  display: grid;
  gap: 12px;
}

.stat-bar {
  display: grid;
  grid-template-columns: 1fr 72px;
  gap: 8px 12px;
  align-items: center;
}

.stat-bar strong {
  display: block;
}

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

.bar-track {
  grid-column: 1 / -1;
  height: 9px;
  border-radius: 999px;
  background: #ece7dc;
  overflow: hidden;
}

.bar-track i {
  display: block;
  height: 100%;
  min-width: 4px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--accent));
}

.cart-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfaf6;
}

.qty-control {
  display: grid;
  grid-template-columns: 34px 56px 34px;
  gap: 4px;
  align-items: center;
}

.qty-control button {
  min-height: 34px;
  padding: 0;
}

.qty-control input {
  min-height: 34px;
  padding: 4px;
  text-align: center;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.cart-total strong {
  font-size: 28px;
  color: var(--accent);
}

.sku-row {
  display: grid;
  grid-template-columns: 110px 1fr 120px 100px minmax(160px, 1fr) 90px auto auto auto;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfaf6;
}

.sku-options {
  grid-column: 1 / -1;
}

.product-admin-card {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
}

.admin-product-photo {
  width: 128px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #e8e6dd;
}

.admin-photo-fallback {
  display: grid;
  place-items: center;
  color: white;
  background: var(--green);
  font-size: 42px;
  font-weight: 800;
}

.product-admin-body,
.product-admin-fields,
.product-admin-actions,
.category-manager-list {
  display: grid;
  gap: 10px;
}

.product-admin-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.product-admin-title strong {
  display: block;
  font-size: 18px;
}

.product-admin-title b {
  color: var(--accent);
  font-size: 22px;
  white-space: nowrap;
}

.product-admin-fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.wide-field {
  grid-column: span 2;
}

.hidden-spec-source {
  display: none;
}

.product-admin-actions {
  grid-template-columns: 1.3fr 1fr 1fr 1fr auto;
}

.product-admin-actions button {
  white-space: nowrap;
}

.category-manager-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
}

.category-manager-row strong,
.category-manager-row small {
  display: block;
}

.category-order-actions,
.category-add-row {
  display: grid;
  gap: 8px;
}

.category-order-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.category-order-actions button {
  min-height: 34px;
  padding: 0 10px;
}

.category-add-row {
  grid-template-columns: 1fr auto;
  margin: 12px 0;
}

.category-name-editor {
  display: grid;
  gap: 4px;
}

.category-name-editor input {
  font-weight: 800;
}

.image-picker-row,
.product-list-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.image-picker-row button,
.product-list-tools button {
  white-space: nowrap;
}

.file-picker {
  display: none;
}

.new-product-spec-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
}

.new-product-spec-box strong,
.new-product-spec-box small {
  display: block;
}

.new-product-spec-box small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

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

.line-item {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.9fr auto;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfaf6;
}

.line-option-summary {
  grid-column: 1 / -1;
}

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

.user-list {
  display: grid;
  gap: 10px;
}

.users-overview,
.user-editor-view {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.users-overview-panel {
  display: grid;
  gap: 18px;
}

.users-toolbar,
.subpage-head,
.editor-section-title,
.user-editor-actions {
  display: flex;
  align-items: center;
}

.users-toolbar {
  justify-content: space-between;
  gap: 20px;
}

.users-toolbar h3,
.users-toolbar p,
.subpage-head h3,
.subpage-head p,
.editor-section-title h3 {
  margin: 0;
}

.users-toolbar p,
.subpage-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

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

.user-stats > div {
  min-height: 74px;
  padding: 12px 14px;
  border: 1px solid #d7dfd4;
  border-radius: 8px;
  background: #f3f6f0;
}

.user-stats span,
.user-stats strong {
  display: block;
}

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

.user-stats strong {
  margin-top: 4px;
  color: var(--brand);
  font-size: 24px;
}

.user-summary-card {
  display: grid;
  grid-template-columns: 46px minmax(160px, 1fr) auto minmax(120px, auto) auto;
  gap: 14px;
  align-items: center;
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.user-summary-card:hover {
  border-color: #b9c8b8;
  box-shadow: 0 8px 18px rgba(36, 53, 43, 0.07);
}

.user-summary-avatar {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--brand);
  font-size: 18px;
  font-weight: 700;
}

.user-summary-identity,
.user-permission-summary {
  min-width: 0;
}

.user-summary-identity strong,
.user-summary-identity small,
.user-permission-summary strong,
.user-permission-summary small {
  display: block;
}

.user-summary-identity strong {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-summary-identity small,
.user-permission-summary small {
  margin-top: 3px;
  color: var(--muted);
}

.user-summary-meta {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}

.user-role-chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--brand);
  background: #edf1eb;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.user-edit-button {
  min-width: 76px;
}

.user-editor-view {
  display: grid;
  gap: 14px;
}

.subpage-head {
  gap: 12px;
  min-height: 58px;
  padding: 2px 2px 10px;
  border-bottom: 1px solid var(--line);
}

.subpage-back {
  display: grid;
  width: 42px;
  min-height: 42px;
  flex: 0 0 42px;
  place-items: center;
  padding: 0 0 3px;
  border: 1px solid #cbd6cc;
  border-radius: 50%;
  color: var(--brand);
  background: #eef3ed;
  font-size: 32px;
  line-height: 1;
}

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

.user-editor-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.editor-section-title {
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.editor-section-title small {
  margin-top: 3px;
}

.editor-section-index {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-weight: 700;
}

.field-hint {
  margin-top: -7px;
  line-height: 1.5;
}

.permissions-editor-card {
  min-width: 0;
}

.permission-editor {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.permission-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.permission-editor-head > div {
  display: grid;
  gap: 2px;
}

.permission-editor-head small {
  color: var(--muted);
}

.permission-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
}

#newUserPermissions .permission-groups {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.permission-group {
  min-width: 0;
  padding: 11px;
  border: 1px solid #dbe1d8;
  border-radius: 8px;
  background: #f7f8f4;
}

.permission-group > strong {
  display: block;
  margin-bottom: 6px;
  color: var(--green);
  font-size: 13px;
}

.permission-grid {
  display: grid;
  gap: 6px;
}

.permission-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.permission-option:has(input:checked) {
  border-color: #9eb4a2;
  background: #e8f0e8;
  color: var(--brand);
}

.permission-option input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--brand);
}

.permission-option span {
  min-width: 0;
  font-size: 13px;
  line-height: 1.35;
}

.compact-button {
  min-height: 34px;
  padding: 6px 10px;
  white-space: nowrap;
}

.user-editor-actions {
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.user-editor-actions button {
  min-width: 132px;
}

@media (max-width: 1050px) {
  .user-summary-card {
    grid-template-columns: 46px minmax(150px, 1fr) auto auto;
  }

  .user-permission-summary {
    grid-column: 2 / 4;
  }

  .user-edit-button {
    grid-column: 4;
    grid-row: 1 / 3;
  }

  .user-editor-layout {
    grid-template-columns: 1fr;
  }
}

.recipe-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.recipe-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef1e8;
  color: var(--green);
  font-size: 12px;
}

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

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 24, 21, 0.64);
}

.receipt-dialog {
  position: relative;
  z-index: 1;
  width: min(390px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #ece8df;
  border-radius: 8px;
  padding: 18px;
}

.receipt-paper {
  width: 80mm;
  max-width: 100%;
  margin: 0 auto;
  padding: 8mm 6mm;
  background: white;
  color: #111;
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 13px;
}

.receipt-paper header,
.receipt-paper footer {
  text-align: center;
}

.receipt-paper header {
  padding-bottom: 12px;
  border-bottom: 1px dashed #555;
}

.pickup-number {
  display: block;
  font-size: 42px;
  line-height: 1.2;
  margin: 8px 0;
}

.receipt-meta,
.receipt-items,
.receipt-paper footer {
  display: grid;
  gap: 6px;
  padding: 12px 0;
}

.receipt-meta {
  border-bottom: 1px dashed #555;
}

.receipt-items > div,
.receipt-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.receipt-items small {
  display: block;
  color: #444;
  font-size: 11px;
  line-height: 1.35;
}

.receipt-note {
  padding: 10px 0;
  font-weight: 700;
  border-top: 1px dashed #555;
}

.receipt-total {
  padding: 12px 0;
  border-top: 1px dashed #555;
  border-bottom: 1px dashed #555;
  font-size: 18px;
}

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

.spec-dialog {
  position: relative;
  z-index: 1;
  width: min(900px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--panel);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.spec-groups {
  display: grid;
  gap: 14px;
  margin: 16px 0;
}

.spec-group {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
}

.spec-group-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}

.spec-options {
  display: grid;
  gap: 8px;
}

.spec-option {
  display: grid;
  grid-template-columns: 1fr 120px auto;
  gap: 8px;
  align-items: end;
}

.spec-actions {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

@media (max-width: 1200px) and (min-width: 821px) {
  .app-shell {
    grid-template-columns: 190px 1fr;
  }

  .sidebar,
  .main {
    padding: 14px;
  }

  .pos-layout {
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 12px;
  }

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

  .product-admin-layout {
    grid-template-columns: minmax(260px, 320px) 1fr;
  }

  .product-list-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    grid-template-rows: auto auto auto;
  }

  nav {
    grid-template-columns: repeat(3, 1fr);
  }

  nav button {
    text-align: center;
  }

  .layout.two,
  .product-admin-layout,
  .pos-layout,
  .cards,
  .grid2,
  .grid3 {
    grid-template-columns: 1fr;
  }

  .cart-panel {
    position: static;
  }
}

@media print {
  @page {
    size: 80mm auto;
    margin: 0;
  }

  body * {
    visibility: hidden !important;
  }

  #receiptModal,
  #receiptModal * {
    visibility: visible !important;
  }

  #receiptModal {
    position: absolute;
    inset: 0 auto auto 0;
    display: block;
    padding: 0;
    background: white;
  }

  .modal-backdrop,
  .receipt-actions {
    display: none !important;
  }

  .receipt-dialog {
    width: 80mm;
    max-height: none;
    overflow: visible;
    padding: 0;
    background: white;
  }

  .receipt-paper {
    width: 80mm;
    max-width: none;
    box-shadow: none;
  }
}

@media (max-width: 620px) {
  .main,
  .sidebar {
    padding: 14px;
  }

  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .line-item {
    grid-template-columns: 1fr;
  }

  .cart-item,
  .sku-row,
  .product-admin-card,
  .product-admin-fields,
  .product-admin-actions,
  .category-manager-row,
  .spec-group-head,
  .spec-option,
  .spec-actions {
    grid-template-columns: 1fr;
  }

  .wide-field {
    grid-column: auto;
  }

  .actions,
  .editor-head,
  .editor-total {
    align-items: stretch;
    flex-direction: column;
  }

  .actions button {
    width: 100%;
  }

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

  .product-card {
    min-height: 112px;
    padding: 12px;
  }

  .users-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .users-toolbar button {
    width: 100%;
  }

  .user-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .user-stats > div {
    min-height: 66px;
    padding: 10px;
  }

  .user-stats strong {
    font-size: 20px;
  }

  .user-summary-card {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 10px;
  }

  .user-summary-avatar {
    width: 42px;
    height: 42px;
  }

  .user-summary-meta,
  .user-permission-summary {
    grid-column: 2 / 4;
  }

  .user-edit-button {
    grid-column: 3;
    grid-row: 1;
    min-width: 64px;
  }

  .permission-groups,
  #newUserPermissions .permission-groups {
    grid-template-columns: 1fr;
  }

  .permission-editor-head {
    align-items: stretch;
    flex-direction: column;
  }

  .user-editor-actions {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
  }

  .user-editor-actions button {
    min-width: 0;
  }

  th,
  td {
    padding: 8px;
  }
}
