:root {
  --bg: #1d0705;
  --ink: #2d1511;
  --muted: #8b7062;
  --line: #d7aa62;
  --panel: #fff9eb;
  --panel-soft: #fbefd8;
  --green: #8f1712;
  --green-dark: #5f0d0a;
  --blue: #b87824;
  --amber: #c78625;
  --red: #99120e;
  --gold: #d9ae62;
  --gold-soft: #f4d890;
  --lacquer: #710704;
  --shadow: 0 22px 60px rgba(38, 8, 5, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(92, 8, 5, 0.9), rgba(46, 6, 4, 0.94)),
    url("./baishouji-logo-bg.jpg") center / cover fixed,
    var(--bg);
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    radial-gradient(circle at 50% 18%, rgba(242, 203, 125, 0.16), transparent 28%),
    linear-gradient(90deg, rgba(255, 222, 155, 0.035) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 222, 155, 0.026) 1px, transparent 1px);
  background-size: auto, 42px 42px, 42px 42px;
  pointer-events: none;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

h1 {
  font-size: 20px;
}

h2 {
  font-size: 26px;
}

h3 {
  font-size: 17px;
}

.app-shell {
  display: grid;
  grid-template-columns: 306px minmax(0, 1fr);
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.brand-block {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 86px 1fr;
  align-items: center;
  gap: 14px;
  min-height: 132px;
  padding: 18px;
  color: #fff;
  background:
    linear-gradient(rgba(98, 8, 5, 0.84), rgba(62, 6, 4, 0.9)),
    url("./baishouji-logo-bg.jpg") center / cover;
  border: 1px solid rgba(244, 216, 144, 0.78);
  border-radius: 14px;
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 244, 207, 0.08);
}

.brand-block::after {
  position: absolute;
  right: -28px;
  top: -38px;
  width: 140px;
  height: 140px;
  content: "";
  display: grid;
  place-items: center;
  border: 1px solid rgba(239, 196, 106, 0.34);
  border-radius: 999px;
  background: radial-gradient(circle, rgba(244, 216, 144, 0.13), transparent 62%);
}

.brand-logo {
  width: 86px;
  height: 86px;
  object-fit: cover;
  border: 2px solid var(--gold-soft);
  border-radius: 999px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
}

.brand-kicker {
  display: inline-flex;
  margin-bottom: 5px;
  color: var(--gold-soft);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.brand-subtitle,
.brand-block p {
  margin-top: 4px;
  opacity: 0.85;
}

.brand-block h1 {
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0.08em;
}

.panel,
.main-area {
  background: rgba(255, 249, 235, 0.96);
  border: 1px solid rgba(217, 174, 98, 0.72);
  border-radius: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.main-area {
  border-color: rgba(244, 216, 144, 0.72);
  overflow: hidden;
}

.panel {
  padding: 14px;
}

label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  color: var(--ink);
  background: #fffdf7;
  border: 1px solid rgba(215, 170, 98, 0.82);
  border-radius: 10px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(40, 110, 184, 0.13);
}

.context-panel {
  display: grid;
  gap: 8px;
}

.hidden {
  display: none !important;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tabs button,
.secondary-btn,
.cart-actions button,
.category-tabs button,
.receipt-actions button,
menu button {
  min-height: 38px;
  color: var(--ink);
  background: linear-gradient(180deg, #fbedd0, #ecd09a);
  border: 1px solid rgba(184, 120, 36, 0.56);
  border-radius: 10px;
  font-weight: 700;
}

.nav-tabs button {
  text-align: left;
  padding: 0 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.48);
}

.nav-tabs button.active,
.category-tabs button.active {
  color: #fff;
  background: linear-gradient(180deg, #bd1e16, #730805);
  border-color: var(--gold);
  box-shadow: 0 10px 18px rgba(119, 12, 8, 0.25);
}

.shift-panel {
  display: grid;
  gap: 12px;
}

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

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

.mini-stats,
.kpi-grid {
  display: grid;
  gap: 10px;
}

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

.mini-stats div,
.kpi-grid article {
  padding: 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mini-stats span,
.kpi-grid span,
.line span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.mini-stats strong {
  display: block;
  margin-top: 5px;
  font-size: 20px;
}

.main-area {
  min-width: 0;
  overflow: hidden;
}

.view {
  display: none;
  min-height: calc(100vh - 28px);
}

.view.active {
  display: block;
}

.topbar {
  color: #fff;
  background:
    radial-gradient(circle at 84% 18%, rgba(244, 216, 144, 0.2), transparent 25%),
    linear-gradient(90deg, rgba(255, 229, 175, 0.12), transparent 42%),
    linear-gradient(135deg, #93140f, #4d0705);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 112px;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(244, 216, 144, 0.64);
  box-shadow: inset 0 -1px 0 rgba(255, 244, 207, 0.08);
}

.eyebrow {
  color: #f4d287;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.topbar h2 {
  margin-top: 4px;
  font-size: 31px;
  letter-spacing: 0.02em;
}

.topbar-subtitle {
  margin-top: 8px;
  color: rgba(255, 244, 207, 0.76);
  font-size: 13px;
}

.topbar-seal {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  flex: 0 0 auto;
  color: #6a0906;
  background: radial-gradient(circle at 34% 28%, #fff0b6, #d1a04b 70%);
  border: 3px double rgba(92, 8, 5, 0.86);
  border-radius: 999px;
  font-size: 30px;
  font-weight: 900;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.24);
}

.scan-box {
  display: grid;
  grid-template-columns: minmax(280px, 520px) 96px;
  gap: 10px;
}

.scan-box button,
.primary-pay,
.confirm-btn {
  color: #fff;
  background: linear-gradient(180deg, #c42018, #7b0805);
  border: 1px solid rgba(244, 216, 144, 0.75);
  border-radius: 10px;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(121, 9, 5, 0.22);
}

.checkout-layout {
  display: grid;
  grid-template-columns: minmax(480px, 1fr) 408px;
  min-height: calc(100vh - 148px);
}

.selling-area {
  min-width: 0;
  background:
    radial-gradient(circle at 50% -10%, rgba(217, 174, 98, 0.26), transparent 28%),
    linear-gradient(180deg, rgba(255, 250, 240, 0.97), rgba(248, 231, 196, 0.7)),
    #fbf0dc;
}

.product-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: rgba(255, 245, 227, 0.88);
  border-bottom: 1px solid rgba(215, 170, 98, 0.6);
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  align-content: start;
  gap: 14px;
  max-height: calc(100vh - 218px);
  padding: 18px;
  overflow: auto;
}

.product-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-rows: 74px auto auto;
  gap: 10px;
  min-height: 196px;
  padding: 14px;
  text-align: left;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(255, 241, 214, 0.95)),
    #fff3df;
  border: 1px solid rgba(191, 132, 45, 0.58);
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(73, 21, 12, 0.08);
}

.product-card::after {
  position: absolute;
  right: -20px;
  bottom: -26px;
  content: "百";
  color: rgba(153, 18, 14, 0.05);
  font-size: 92px;
  font-weight: 900;
}

.product-card:hover {
  border-color: #a81712;
  box-shadow: 0 16px 34px rgba(151, 34, 17, 0.18);
  transform: translateY(-1px);
}

.product-card:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.product-art {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 74px;
  height: auto;
  padding: 12px 16px;
  color: #fff8df;
  text-align: center;
  line-height: 1.28;
  word-break: keep-all;
  overflow-wrap: anywhere;
  background: linear-gradient(135deg, var(--red), #5d0806);
  border: 1px solid #e7bd6d;
  border-radius: 20px;
  font-size: 18px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(255, 244, 207, 0.16);
}

.product-name {
  font-weight: 900;
  line-height: 1.3;
}

.product-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.product-price {
  display: block;
  margin-top: 4px;
  color: var(--red);
  font-size: 22px;
  font-weight: 900;
}

.product-member-price {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cart-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(255, 248, 234, 0.98), rgba(255, 241, 214, 0.98));
  border-left: 1px solid rgba(191, 132, 45, 0.66);
}

.member-card {
  padding: 18px;
  border-bottom: 1px solid rgba(215, 170, 98, 0.55);
}

.inline-field {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
  margin-bottom: 9px;
}

.inline-field button {
  color: #fff;
  background: var(--red);
  border: 1px solid var(--gold);
  border-radius: 6px;
  font-weight: 900;
}

#memberMatchSelect {
  width: 100%;
  margin: 0 0 10px;
}

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

.cart-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(215, 170, 98, 0.55);
}

.cart-list {
  flex: 1;
  min-height: 190px;
  overflow: auto;
}

.empty-cart {
  display: grid;
  place-items: center;
  min-height: 200px;
  color: var(--muted);
  text-align: center;
}

.cart-item {
  display: grid;
  grid-template-columns: 1fr 94px 28px;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(215, 170, 98, 0.42);
}

.cart-item.gift {
  background: #fff0d7;
}

.cart-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.mode-toggle {
  min-height: 26px;
  margin-top: 7px;
  padding: 0 9px;
  color: #fff;
  background: #8f1712;
  border: 1px solid #d5a14a;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.cart-item.gift .mode-toggle {
  color: #7a3d05;
  background: #f7d68c;
}

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

.qty-control {
  display: grid;
  grid-template-columns: 28px 36px 28px;
  align-items: center;
  height: 30px;
  background: #f4dfbd;
  border-radius: 6px;
}

.qty-control button {
  height: 30px;
  background: transparent;
}

.qty-control span {
  text-align: center;
  font-weight: 900;
}

.remove-btn {
  color: var(--red);
  background: transparent;
  font-size: 20px;
}

.settlement {
  display: grid;
  gap: 10px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 242, 219, 0.98), rgba(248, 224, 184, 0.88));
  border-top: 1px solid rgba(215, 170, 98, 0.64);
}

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

.line.total {
  align-items: baseline;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.line.total strong {
  color: var(--red);
  font-size: 42px;
  letter-spacing: 0;
}

.cart-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.cart-actions button.active {
  color: #fff;
  background: linear-gradient(180deg, #b51b14, #7e100c);
  border-color: #d4a04a;
}

.primary-pay {
  min-height: 52px;
  font-size: 20px;
}

.kpi-grid {
  grid-template-columns: repeat(4, 1fr);
  padding: 18px;
}

.kpi-grid strong {
  display: block;
  margin-top: 7px;
  color: var(--red);
  font-size: 32px;
}

.kpi-grid article {
  position: relative;
  overflow: hidden;
  min-height: 112px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(251, 239, 216, 0.95));
  border-color: rgba(215, 170, 98, 0.7);
}

.kpi-grid article::after {
  position: absolute;
  right: -12px;
  bottom: -28px;
  content: "百";
  color: rgba(153, 18, 14, 0.055);
  font-size: 92px;
  font-weight: 900;
}

.dashboard-grid,
.management-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
  gap: 16px;
  padding: 0 18px 18px;
}

.management-grid {
  grid-template-columns: 0.9fr 1.1fr;
  padding-top: 16px;
}

.wide {
  grid-column: 1 / -1;
}

.rank-list,
.channel-list,
.table-list,
.inventory-list,
.store-cards,
.report-box,
.rule-list {
  display: grid;
  gap: 8px;
}

.period-rank-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

.period-rank-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.86), rgba(251, 239, 216, 0.82));
  border: 1px solid rgba(215, 170, 98, 0.58);
  border-radius: 10px;
}

.period-rank-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--red);
}

.period-rank-head span {
  color: var(--muted);
  font-size: 12px;
}

.compact-rank-row {
  padding: 10px;
}

.rank-row,
.channel-row,
.table-row,
.stock-row,
.store-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.86), rgba(251, 239, 216, 0.82));
  border: 1px solid rgba(215, 170, 98, 0.58);
  border-radius: 10px;
}

.rank-row,
.channel-row,
.stock-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.table-row {
  grid-template-columns: 1.2fr 0.8fr 0.8fr 0.8fr;
  align-items: center;
}

.table-row.header {
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 900;
}

.store-card {
  grid-template-columns: 1fr auto;
}

.store-card .sales-detail {
  grid-column: 1 / -1;
}

.store-card strong,
.rank-row strong,
.channel-row strong,
.stock-row strong {
  font-size: 16px;
}

.inventory-edit-row {
  grid-template-columns: minmax(220px, 0.7fr) auto minmax(660px, 1.55fr);
}

.stock-adjust {
  display: grid;
  grid-template-columns: 0.7fr 0.7fr 0.7fr 0.7fr 0.8fr 0.9fr 64px 64px;
  align-items: end;
  gap: 8px;
}

.stock-adjust label {
  display: grid;
  gap: 5px;
  margin: 0;
}

.stock-adjust label span {
  color: var(--muted);
  font-size: 12px;
}

.stock-adjust input,
.stock-adjust select {
  min-height: 36px;
}

.stock-adjust button {
  min-height: 36px;
  color: #fff;
  background: linear-gradient(180deg, #b51b14, #7e100c);
  border: 1px solid #d4a04a;
  border-radius: 9px;
  font-weight: 900;
}

.stock-adjust .danger-btn {
  background: linear-gradient(180deg, #6f3d35, #3d211e);
}

.product-form {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.55fr 0.65fr 0.65fr 0.65fr 0.55fr 86px;
  gap: 8px;
  margin-bottom: 14px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255, 247, 232, 0.96), rgba(248, 224, 184, 0.82));
  border: 1px solid rgba(215, 170, 98, 0.72);
  border-radius: 12px;
}

.product-form input,
.product-form select {
  min-height: 38px;
}

.store-filter-bar {
  display: grid;
  grid-template-columns: minmax(140px, 0.35fr) minmax(220px, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.province-group {
  display: grid;
  gap: 10px;
}

.province-group h4 {
  margin: 2px 0 0;
  color: #8a120f;
  font-size: 16px;
  font-weight: 900;
}

.check-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 10px;
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid rgba(234, 216, 187, 0.86);
  border-radius: 12px;
}

.check-item input {
  width: auto;
  min-height: auto;
}

.check-item span {
  display: grid;
  gap: 2px;
  font-weight: 800;
}

.check-item small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 0 8px;
  color: #8a120f;
  background: linear-gradient(180deg, #f8e4ba, #eccb8d);
  border: 1px solid rgba(184, 120, 36, 0.44);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.tag.warn {
  color: #8a4d06;
  background: #fff0d7;
}

.rule-list p {
  padding: 11px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  line-height: 1.5;
}

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

.member-form label {
  display: grid;
  gap: 6px;
  margin: 0;
}

.member-form label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.member-form textarea {
  width: 100%;
  padding: 10px 11px;
  color: var(--ink);
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  resize: vertical;
  font: inherit;
}

.wide-field,
.member-form button {
  grid-column: 1 / -1;
}

.member-card-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(360px, 1.4fr) minmax(160px, 0.6fr);
  gap: 12px;
  padding: 12px;
  background: linear-gradient(180deg, #fffdf8, #fff2dc);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.member-card-row > p {
  grid-column: 1 / -1;
  padding-top: 8px;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  line-height: 1.5;
}

.member-card-row strong {
  display: block;
  margin-bottom: 5px;
  font-size: 18px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.member-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 12px;
  color: var(--muted);
  font-size: 13px;
}

.member-money {
  display: grid;
  align-content: start;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.member-money strong {
  color: var(--red);
  font-size: 22px;
}

dialog {
  width: min(460px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(16, 24, 34, 0.5);
}

.pay-modal,
.receipt-modal {
  padding: 18px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.ghost-btn {
  width: 34px;
  height: 34px;
  background: #f3dfbd;
  border: 1px solid #e0bd7e;
  border-radius: 6px;
}

.amount-display {
  display: grid;
  gap: 4px;
  padding: 15px;
  margin-bottom: 12px;
  color: #fff;
  background:
    radial-gradient(circle at 88% 12%, rgba(244, 216, 144, 0.18), transparent 22%),
    linear-gradient(135deg, #8f1712, #4d0705);
  border: 1px solid rgba(244, 216, 144, 0.72);
  border-radius: 12px;
}

.amount-display strong {
  font-size: 34px;
}

.payment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.adjust-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  background: linear-gradient(180deg, #fff7e8, #f8e5c0);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.adjust-box label {
  display: grid;
  gap: 6px;
  margin: 0;
}

.payment-field {
  display: grid;
  gap: 5px;
}

menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0;
  margin: 14px 0 0;
}

#receiptText,
#shiftText {
  max-height: 54vh;
  overflow: auto;
  padding: 14px;
  color: var(--ink);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: "Courier New", monospace;
  font-size: 13px;
  white-space: pre-wrap;
}

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

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 340px;
  padding: 12px 14px;
  color: #fff;
  background: #6f100d;
  border: 1px solid rgba(244, 216, 144, 0.78);
  border-radius: 10px;
  box-shadow: var(--shadow);
  transform: translateY(24px);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

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

  .sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .brand-block {
    grid-column: 1 / -1;
  }

  .nav-tabs {
    grid-column: 1 / -1;
    grid-template-columns: repeat(5, 1fr);
  }

  .nav-tabs button {
    text-align: center;
  }
}

@media (max-width: 860px) {
  .app-shell {
    padding: 8px;
  }

  .sidebar,
  .checkout-layout,
  .dashboard-grid,
  .management-grid,
  .kpi-grid,
  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .topbar-seal {
    display: none;
  }

  .topbar h2 {
    font-size: 26px;
  }

  .scan-box {
    grid-template-columns: 1fr 76px;
  }

  .nav-tabs {
    grid-template-columns: 1fr 1fr;
  }

  .cart-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .product-grid {
    max-height: none;
  }

  .product-card {
    min-height: 178px;
  }

  .table-row {
    grid-template-columns: 1fr;
  }

  .inventory-edit-row,
  .stock-adjust,
  .product-form,
  .member-form,
  .member-card-row,
  .member-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* Refined brand system: minimal, premium, Apple-like while keeping Baishouji red/gold. */
:root {
  --bg: #f7f2ea;
  --ink: #241817;
  --muted: #796a62;
  --line: #ead8bb;
  --panel: #fffdf8;
  --panel-soft: #f7efe2;
  --red: #8f0f0b;
  --gold: #c89b4b;
  --gold-soft: #ead2a0;
  --shadow: 0 18px 48px rgba(63, 26, 18, 0.08);
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 20% -10%, rgba(143, 15, 11, 0.08), transparent 30%),
    linear-gradient(180deg, #fffaf1 0%, #f7f2ea 42%, #f4eadc 100%);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

body::before {
  display: none;
}

.app-shell {
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
}

.brand-block,
.panel,
.main-area,
.product-card,
.kpi-grid article,
.rank-row,
.channel-row,
.table-row,
.stock-row,
.store-card,
.member-card-row,
.product-form,
.adjust-box {
  box-shadow: var(--shadow);
}

.brand-block {
  min-height: 148px;
  grid-template-columns: 72px 1fr;
  align-items: center;
  padding: 20px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.88);
  border: 1px solid rgba(200, 155, 75, 0.3);
  border-radius: 22px;
  backdrop-filter: blur(20px);
}

.brand-block::after {
  display: none;
}

.brand-logo {
  width: 72px;
  height: 72px;
  border: 1px solid rgba(200, 155, 75, 0.5);
  box-shadow: 0 12px 30px rgba(88, 21, 15, 0.14);
}

.brand-kicker {
  color: var(--red);
  font-size: 11px;
  letter-spacing: 0.14em;
}

.brand-block h1 {
  color: var(--red);
  font-size: 28px;
  letter-spacing: 0.04em;
}

.brand-subtitle,
.brand-block p {
  color: var(--muted);
  opacity: 1;
}

.panel,
.main-area {
  background: rgba(255, 253, 248, 0.86);
  border: 1px solid rgba(234, 216, 187, 0.8);
  border-radius: 24px;
  backdrop-filter: blur(22px);
}

.panel {
  padding: 18px;
}

input,
select,
textarea {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(200, 155, 75, 0.24);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(143, 15, 11, 0.38);
  box-shadow: 0 0 0 4px rgba(143, 15, 11, 0.08);
}

.nav-tabs {
  gap: 6px;
}

.nav-tabs button,
.secondary-btn,
.cart-actions button,
.category-tabs button,
.receipt-actions button,
menu button {
  color: var(--ink);
  background: rgba(255, 253, 248, 0.75);
  border: 1px solid rgba(200, 155, 75, 0.22);
  border-radius: 14px;
  box-shadow: none;
}

.nav-tabs button.active,
.category-tabs button.active,
.cart-actions button.active {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
  box-shadow: 0 10px 24px rgba(143, 15, 11, 0.18);
}

.mini-stats div,
.kpi-grid article {
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid rgba(234, 216, 187, 0.8);
  border-radius: 18px;
}

.topbar {
  min-height: 132px;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(143, 15, 11, 0.08), transparent 46%),
    rgba(255, 253, 248, 0.78);
  border-bottom: 1px solid rgba(234, 216, 187, 0.84);
  box-shadow: none;
  padding: 24px 28px;
}

.eyebrow,
.topbar-subtitle {
  color: var(--muted);
}

.topbar h2 {
  color: var(--ink);
  font-size: 36px;
  letter-spacing: 0;
}

.topbar-seal {
  width: 58px;
  height: 58px;
  color: var(--red);
  background: #fff7e7;
  border: 1px solid rgba(200, 155, 75, 0.42);
  box-shadow: none;
  font-size: 26px;
}

.scan-box button,
.primary-pay,
.confirm-btn,
.inline-field button,
.stock-adjust button {
  color: #fff;
  background: var(--red);
  border: 1px solid var(--red);
  border-radius: 14px;
  box-shadow: 0 12px 24px rgba(143, 15, 11, 0.18);
}

.checkout-layout {
  grid-template-columns: minmax(560px, 1fr) 420px;
  min-height: calc(100vh - 164px);
}

.selling-area,
.product-tools,
.cart-panel,
.settlement {
  background: transparent;
}

.product-tools {
  padding: 18px 22px;
  border-bottom: 1px solid rgba(234, 216, 187, 0.8);
}

.product-grid {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px;
  max-height: calc(100vh - 242px);
  padding: 22px;
}

.product-card {
  grid-template-rows: minmax(72px, auto) auto;
  min-height: 184px;
  padding: 18px;
  background: rgba(255, 253, 248, 0.82);
  border: 1px solid rgba(234, 216, 187, 0.9);
  border-radius: 22px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.product-card::after,
.kpi-grid article::after {
  display: none;
}

.product-card:hover {
  border-color: rgba(143, 15, 11, 0.24);
  box-shadow: 0 22px 44px rgba(63, 26, 18, 0.12);
  transform: translateY(-2px);
}

.product-art {
  min-height: 72px;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--red), #5d0806) !important;
  border: 0;
  border-radius: 20px;
  color: #fff8df;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.28;
  text-align: center;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.product-price {
  color: var(--red);
  font-size: 24px;
}

.product-member-price {
  color: var(--muted);
}

.cart-panel {
  border-left: 1px solid rgba(234, 216, 187, 0.9);
}

.member-card,
.cart-title,
.cart-item,
.settlement {
  padding-left: 22px;
  padding-right: 22px;
  border-color: rgba(234, 216, 187, 0.82);
}

.cart-item {
  border-bottom: 1px solid rgba(234, 216, 187, 0.7);
}

.cart-item.gift {
  background: rgba(255, 247, 231, 0.7);
}

.mode-toggle {
  background: var(--red);
  border: 0;
  border-radius: 999px;
}

.qty-control {
  background: rgba(247, 239, 226, 0.9);
  border-radius: 999px;
}

.line.total {
  border-color: rgba(200, 155, 75, 0.3);
}

.line.total strong {
  color: var(--red);
  font-size: 46px;
  font-weight: 800;
}

.primary-pay {
  min-height: 58px;
  font-size: 21px;
}

.kpi-grid {
  gap: 16px;
  padding: 22px;
}

.kpi-grid article {
  min-height: 124px;
  padding: 22px;
  background: rgba(255, 253, 248, 0.78);
  border-radius: 22px;
}

.kpi-grid strong {
  color: var(--red);
  font-size: 36px;
  font-weight: 800;
}

.dashboard-grid,
.management-grid {
  gap: 18px;
  padding: 0 22px 22px;
}

.rank-row,
.channel-row,
.table-row,
.stock-row,
.store-card,
.member-card-row,
.product-form,
.adjust-box,
.rule-list p {
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid rgba(234, 216, 187, 0.86);
  border-radius: 18px;
  box-shadow: none;
}

.product-form {
  padding: 16px;
}

.tag {
  color: var(--red);
  background: rgba(143, 15, 11, 0.06);
  border: 1px solid rgba(143, 15, 11, 0.1);
}

dialog {
  border-radius: 22px;
}

.amount-display {
  background: var(--red);
  border: 0;
  border-radius: 18px;
}

#receiptText,
#shiftText {
  background: rgba(247, 239, 226, 0.7);
  border-radius: 14px;
}

@media (max-width: 1180px) {
  .checkout-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app-shell {
    padding: 10px;
  }

  .brand-block {
    grid-template-columns: 58px 1fr;
    min-height: auto;
  }

  .brand-logo {
    width: 58px;
    height: 58px;
  }

  .topbar {
    min-height: auto;
    padding: 20px;
  }

  .topbar h2 {
    font-size: 28px;
  }
}

/* Final Baishouji brand override: keep the red premium POS surface. */
body {
  color: #2d1511;
  background:
    linear-gradient(rgba(92, 8, 5, 0.9), rgba(46, 6, 4, 0.94)),
    url("./baishouji-logo-bg.jpg") center / cover fixed,
    #1d0705;
}

body::before {
  display: block;
}

.brand-block {
  color: #fff;
  background:
    linear-gradient(rgba(98, 8, 5, 0.84), rgba(62, 6, 4, 0.9)),
    url("./baishouji-logo-bg.jpg") center / cover;
  border-color: rgba(244, 216, 144, 0.78);
  border-radius: 16px;
}

.brand-block::after {
  display: grid;
}

.brand-block h1 {
  color: #fff;
}

.brand-kicker {
  color: var(--gold-soft);
}

.brand-subtitle,
.brand-block p {
  color: rgba(255, 244, 207, 0.88);
}

.panel,
.main-area {
  background: rgba(255, 249, 235, 0.96);
  border-color: rgba(217, 174, 98, 0.72);
  border-radius: 16px;
}

.topbar {
  color: #fff;
  background:
    linear-gradient(90deg, rgba(84, 5, 3, 0.92), rgba(112, 10, 6, 0.72) 48%, rgba(62, 5, 3, 0.9)),
    url("./baishouji-logo-bg.jpg") center 42% / cover;
  border-bottom-color: rgba(244, 216, 144, 0.64);
}

.eyebrow {
  color: #f4d287;
}

.topbar h2 {
  color: #fff;
}

.topbar-subtitle {
  color: rgba(255, 244, 207, 0.76);
}

.topbar-seal {
  color: #6a0906;
  background: radial-gradient(circle at 34% 28%, #fff0b6, #d1a04b 70%);
  border: 3px double rgba(92, 8, 5, 0.86);
}

.selling-area {
  background:
    radial-gradient(circle at 50% -10%, rgba(217, 174, 98, 0.26), transparent 28%),
    linear-gradient(180deg, rgba(255, 250, 240, 0.97), rgba(248, 231, 196, 0.7)),
    #fbf0dc;
}

.product-tools {
  background: rgba(255, 245, 227, 0.88);
}

.checkout-layout {
  min-height: auto;
  align-items: start;
}

.product-grid {
  max-height: none;
  overflow: visible;
  padding-bottom: 18px;
}

.cart-panel {
  align-self: start;
  min-height: auto;
  background: rgba(255, 249, 235, 0.96);
}

#accountsView .management-grid {
  grid-template-columns: repeat(2, minmax(360px, 1fr));
  align-items: start;
}

.purchase-layout {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) 430px;
  min-height: calc(100vh - 164px);
}

.purchase-catalog {
  min-width: 0;
  background:
    radial-gradient(circle at 50% -10%, rgba(217, 174, 98, 0.26), transparent 28%),
    linear-gradient(180deg, rgba(255, 250, 240, 0.97), rgba(248, 231, 196, 0.7)),
    #fbf0dc;
}

.purchase-catalog .product-tools {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 320px);
}

.purchase-product-card .product-price {
  font-size: 20px;
}

.purchase-cart-panel {
  border-left: 1px solid rgba(234, 216, 187, 0.9);
}

.purchase-note {
  display: grid;
  gap: 6px;
  padding: 18px 22px;
  border-top: 1px solid rgba(234, 216, 187, 0.72);
}

.purchase-note span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.purchase-order-filter {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) 1fr;
  gap: 8px;
  padding: 0 22px 14px;
}

.sales-detail {
  border-top: 1px dashed rgba(191, 132, 45, 0.42);
  padding-top: 8px;
}

.sales-detail summary,
.store-sales-row summary {
  cursor: pointer;
  color: var(--red);
  font-weight: 900;
}

.sales-detail-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 96px;
  gap: 8px;
  padding: 8px 0;
  color: var(--muted);
  border-bottom: 1px solid rgba(215, 170, 98, 0.22);
}

.sales-detail-row strong {
  color: var(--ink);
  text-align: right;
}

.sales-detail-row span:last-child {
  text-align: right;
}

.sales-detail-empty {
  padding: 10px 0 2px;
  color: var(--muted);
}

.store-sales-row {
  display: block;
}

.store-sales-row summary {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr 0.8fr;
  gap: 8px;
  align-items: center;
  list-style: none;
}

.store-sales-row summary::-webkit-details-marker {
  display: none;
}

.sales-detail-body {
  padding-top: 10px;
  margin-top: 8px;
  border-top: 1px dashed rgba(191, 132, 45, 0.42);
}

.purchase-admin-grid {
  padding-top: 18px;
}

.source-product-form {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.source-product-form input,
.source-product-form select {
  min-width: 0;
  min-height: 48px;
}

.source-product-form button {
  grid-column: 1 / -1;
  min-height: 48px;
}

.form-hint {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.purchase-row button {
  min-height: 30px;
  margin-top: 6px;
  margin-right: 6px;
  padding: 0 10px;
  color: #fff;
  background: var(--red);
  border: 1px solid var(--red);
  border-radius: 8px;
  font-weight: 800;
}

.purchase-status-note {
  display: block;
  margin-top: 5px;
  line-height: 1.35;
}

.purchase-row .danger-btn {
  background: #5d312c;
  border-color: #5d312c;
}

.report-filter-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(88px, auto)) minmax(150px, 1fr) minmax(150px, 1fr) 110px;
  gap: 10px;
}

.report-filter-bar button {
  min-height: 44px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.78);
  border: 1px solid rgba(200, 155, 75, 0.28);
  border-radius: 12px;
  font-weight: 900;
}

.report-filter-bar .confirm-btn {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

#accountsView .panel {
  min-width: 0;
}

#accountsView .product-form {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
  padding: 18px;
}

#accountsView .product-form input,
#accountsView .product-form select {
  min-width: 0;
  min-height: 52px;
  font-size: 16px;
}

#accountsView .product-form button {
  grid-column: 1 / -1;
  min-height: 52px;
  font-size: 16px;
}

#accountsView .wide {
  grid-column: 1 / -1;
}

#regionalBindForm {
  grid-template-columns: minmax(260px, 360px) 1fr;
}

#regionalBindForm .check-grid {
  grid-column: 1 / -1;
}

#regionalBindForm button {
  grid-column: 1 / 2;
}

@media (max-width: 1120px) {
  #accountsView .management-grid,
  #accountsView .product-form,
  #regionalBindForm,
  .source-product-form,
  .purchase-layout,
  .purchase-catalog .product-tools,
  .report-filter-bar {
    grid-template-columns: 1fr;
  }

  #regionalBindForm button {
    grid-column: 1 / -1;
  }
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(70, 5, 3, 0.82), rgba(28, 3, 2, 0.92)),
    url("./baishouji-logo-bg.jpg") center / cover;
}

.login-card {
  width: min(430px, 100%);
  display: grid;
  gap: 16px;
  padding: 30px;
  color: #fff8df;
  background: rgba(89, 8, 5, 0.74);
  border: 1px solid rgba(244, 216, 144, 0.72);
  border-radius: 24px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.login-logo {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border: 2px solid var(--gold-soft);
  border-radius: 999px;
}

.login-card h1 {
  color: #fff;
  font-size: 34px;
}

.login-card p,
.login-demo {
  color: rgba(255, 244, 207, 0.82);
}

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

.login-form label {
  display: grid;
  gap: 6px;
  color: rgba(255, 244, 207, 0.82);
  font-weight: 800;
}

.login-form input {
  min-height: 48px;
}

.login-demo {
  display: grid;
  gap: 5px;
  padding-top: 10px;
  border-top: 1px solid rgba(244, 216, 144, 0.22);
  font-size: 13px;
}

.store-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.store-actions button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(143, 23, 18, 0.18);
  border-radius: 8px;
  color: var(--ink);
  background: #fff8ea;
  font-weight: 800;
}

.account-badge {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
}

#currentAccountLabel {
  color: var(--red);
  font-weight: 900;
}

@media (max-width: 1180px) {
  .period-rank-grid {
    grid-template-columns: 1fr;
  }
}
