/* Chonglaoban local management app — shared desktop and mobile UI. */
:root {
  color-scheme: light;
  --sidebar-width: 210px;
  --topbar-height: 60px;
  --sidebar: #35415a;
  --sidebar-hover: #41506d;
  --brand: #2f7fd6;
  --primary-strong: #2f7fd6;
  --primary: #4a9ff0;
  --primary-dark: #3084d8;
  --text: #2f3646;
  --text-secondary: #5c6675;
  --muted: #8b95a6;
  --border: #dde6f0;
  --border-light: #ecf2f9;
  --canvas: #f1f6fc;
  --success: #5aa845;
  --danger: #e0655f;
  --radius: 5px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text);
  background: var(--canvas);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { margin: 0; }
button { cursor: pointer; }
a { color: var(--primary-strong); text-decoration: none; }
a:hover { color: var(--primary-dark); }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; }
button:disabled { opacity: .55; }
:focus-visible { outline: 3px solid #4a9ff066; outline-offset: 3px; }
img, svg { max-width: 100%; }
svg { vertical-align: middle; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 22px; line-height: 1.4; font-weight: 600; }
h2 { font-size: 17px; line-height: 1.5; font-weight: 600; }
h3 { font-size: 15px; line-height: 1.5; font-weight: 600; }
small { font-size: 12px; }
[hidden] { display: none !important; }

/* The dark sidebar and quiet header frame each working page. */
.app-shell { display: flex; min-height: 100vh; min-width: 0; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--sidebar);
  color: #d2dcec;
  scrollbar-width: thin;
  scrollbar-color: #5c6b88 transparent;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: var(--topbar-height);
  padding: 13px 20px;
  color: #fff;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: 1px;
  flex-shrink: 0;
  border-bottom: 1px solid #ffffff0b;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-size: 20px;
  line-height: 1;
  letter-spacing: 0;
}
.sidebar > nav, .sidebar .navigation { padding: 12px 0 18px; }
.nav-group { margin: 0; }
.nav-group summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 45px;
  padding: 11px 22px;
  list-style: none;
  color: #c4d0e2;
  cursor: pointer;
  user-select: none;
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: auto;
  flex: 0 0 6px;
  border-right: 1px solid #9dabc2;
  border-bottom: 1px solid #9dabc2;
  transform: rotate(-45deg);
  transition: transform .16s ease;
}
.nav-group[open] > summary::after { transform: rotate(45deg) translate(-2px, -2px); }
.nav-group summary:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 11px 22px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #d2dcec;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
  transition: background .15s, color .15s;
}
.nav-group .nav-item { min-height: 41px; padding-left: 46px; font-size: 13px; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; font-weight: 600; }
.nav-item svg, .nav-group summary svg { width: 17px; height: 17px; flex: 0 0 17px; }
.sidebar-footer {
  margin-top: auto;
  padding: 18px 21px;
  border-top: 1px solid #ffffff0d;
  color: #9dabc2;
  font-size: 12px;
}
.sidebar-footer strong { display: block; margin-bottom: 3px; color: #dde5f1; font-size: 13px; font-weight: 500; }
.workspace { width: calc(100% - var(--sidebar-width)); min-width: 0; margin-left: var(--sidebar-width); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: var(--topbar-height);
  padding: 0 25px;
  background: #fff;
  border-bottom: 1px solid var(--border-light);
}
.breadcrumbs { display: flex; align-items: center; gap: 11px; min-width: 0; color: var(--text-secondary); font-size: 13px; }
.breadcrumbs > :last-child { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumbs .separator { color: #bcc7d6; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 15px; min-width: 0; flex-shrink: 0; font-size: 13px; }
.topbar-actions > span { color: var(--text-secondary); }
.menu-toggle { display: none; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 6px; border: 0; background: transparent; color: var(--text-secondary); font-size: 22px; }
.main-content { width: 100%; min-width: 0; padding: 24px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-head h1 { margin-bottom: 5px; }
.page-head p { color: var(--muted); font-size: 13px; line-height: 1.7; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.page-head > .actions { justify-content: flex-end; padding-top: 2px; }

/* Fields keep the restrained proportions familiar to shop staff. */
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text-secondary);
  line-height: 1.5;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #b0bac8; opacity: 1; }
input:not([type="checkbox"]):not([type="radio"]):hover, select:hover, textarea:hover { border-color: #b8c6d8; }
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus { border-color: var(--primary); outline: 0; box-shadow: 0 0 0 2px #4a9ff014; }
input:disabled, select:disabled, textarea:disabled { background: #f4f7fb; color: #a2adbb; }
input[type="checkbox"], input[type="radio"] { width: 15px; height: 15px; flex-shrink: 0; accent-color: var(--primary); vertical-align: -2px; }
input[type="number"] { font-variant-numeric: tabular-nums; }
textarea { min-height: 85px; resize: vertical; }
select { padding-right: 28px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 15px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text-secondary);
  line-height: 1.5;
  font-size: 13px;
  font-weight: 400;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: color .15s, background .15s, border-color .15s, box-shadow .15s;
}
.button:hover { background: #eaf4fe; border-color: #b6d8f7; color: var(--primary-strong); }
.button.primary { background: var(--primary-strong); border-color: var(--primary-strong); color: #fff; }
.button.primary:hover { background: #2678cc; border-color: #2678cc; }
.button.danger { color: #e45757; border-color: #f1b9b9; background: #fff; }
.button.danger:hover { background: #fef0f0; border-color: #e88383; }
.button.subtle { border-color: transparent; background: transparent; color: var(--text-secondary); }
.button.subtle:hover { background: #eef4fa; color: var(--primary); }
.button.small { min-height: 28px; padding: 3px 9px; font-size: 12px; }
.button svg { width: 15px; height: 15px; flex: 0 0 15px; }
.link-button { display: inline; padding: 2px 0; border: 0; background: none; color: var(--primary-strong); font-size: inherit; text-align: left; }
.link-button:hover { color: var(--primary-dark); text-decoration: underline; }
.link-button.danger { color: var(--danger); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 17px; }
.search-form, .filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; }
.search-form { flex: 1; }
.search-form input:not([type="checkbox"]):not([type="radio"]) { width: 240px; max-width: 100%; }
.search-form select, .filter-row select { width: 160px; max-width: 100%; }
.filter-row { margin-bottom: 16px; }
.filter-row label { display: inline-flex; align-items: center; gap: 8px; color: var(--text-secondary); }
.filter-row input:not([type="checkbox"]):not([type="radio"]) { width: 170px; }
.filter-row .field { min-width: 140px; }
.toolbar + .table-wrap { margin-top: 0; }

/* Tables scroll inside their own panel instead of widening the page. */
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius); -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: #c8d6e6 #f3f7fb; }
table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 13px; color: var(--text-secondary); }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--border-light); text-align: left; vertical-align: middle; line-height: 1.65; }
th { background: #f7fafd; color: #67748a; font-size: 12px; font-weight: 500; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f6fafe; }
td .actions { flex-wrap: nowrap; gap: 12px; }
td .link-button { white-space: nowrap; }
td strong { color: var(--text); font-weight: 500; }
td small { display: block; color: var(--muted); }
td .empty-state { padding: 46px 20px; }
.table-wrap .empty-state { min-width: 0; }
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 23px; padding: 1px 8px; border: 1px solid #d7e8fb; border-radius: 3px; background: #eaf4fe; color: var(--primary-strong); font-size: 12px; line-height: 1.6; white-space: nowrap; }
.pill.success { color: #5b9a38; background: #f0f9eb; border-color: #e1f3d8; }
.pill.warning { color: #c2410c; background: #fff3ec; border-color: #fed0b0; }
.pill.muted { color: #92959c; background: #f4f4f5; border-color: #e9e9eb; }
.pill.danger { color: #dc6060; background: #fef0f0; border-color: #fde2e2; }
.empty-state, .error-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 210px; padding: 44px 22px; color: var(--muted); font-size: 13px; line-height: 1.75; text-align: center; }
.empty-state > svg, .error-state > svg { width: 42px; height: 42px; margin-bottom: 5px; color: #c8d3e2; }
.empty-state h3, .empty-state strong { color: #737e8e; font-weight: 500; }
.empty-state .button, .error-state .button { margin-top: 8px; }
.error-state { color: #c36b64; }
.notice { margin-bottom: 18px; padding: 11px 15px; border: 1px solid #d7e8fb; border-radius: 4px; background: #eaf4fe; color: #587ea4; font-size: 13px; line-height: 1.8; }
.notice.warning { border-color: #fed0b0; background: #fff3ec; color: #9a3412; }
.notice p + p { margin-top: 5px; }

/* Dashboard panels deliberately leave an honest empty state for new shops. */
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 22px; }
.metric-card { position: relative; min-width: 0; min-height: 139px; padding: 19px 21px 15px; overflow: hidden; border: 1px solid var(--border-light); border-radius: var(--radius); background: #fff; }
.metric-label { position: relative; z-index: 1; margin-bottom: 9px; color: #75808f; font-size: 13px; }
.metric-value { position: relative; z-index: 1; color: #2f3646; font-size: 29px; font-weight: 500; line-height: 1.35; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.metric-value small { margin-left: 5px; color: var(--muted); font-size: 12px; font-weight: 400; letter-spacing: 0; }
.metric-foot { position: relative; z-index: 1; margin-top: 10px; color: #9aa5b4; font-size: 12px; }
.metric-icon { position: absolute; top: 22px; right: 20px; display: flex; align-items: center; justify-content: center; width: 39px; height: 39px; border-radius: 50%; background: #e9f2fd; color: #7aaddb; font-size: 22px; }
.metric-card:nth-child(2) .metric-icon { background: #e6f0fd; color: #6f9fd8; }
.metric-card:nth-child(3) .metric-icon { background: #deeafa; color: #5b8ec9; }
.metric-card:nth-child(4) .metric-icon { background: #eef5ff; color: #8fb6e4; }
.metric-icon svg { width: 21px; height: 21px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; gap: 20px; margin-bottom: 20px; }
.card { min-width: 0; border: 1px solid var(--border-light); border-radius: var(--radius); background: #fff; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; min-height: 57px; padding: 16px 20px; border-bottom: 1px solid var(--border-light); }
.card-head h2, .card-head h3 { font-size: 14px; font-weight: 500; }
.card-head small, .card-head > span { color: var(--muted); font-size: 12px; }
.card-body { padding: 20px; }
.card > .table-wrap { border: 0; border-radius: 0 0 var(--radius) var(--radius); }
.card .empty-state { min-height: 240px; }
.chart-empty { position: relative; display: flex; align-items: center; justify-content: center; min-height: 250px; margin: 8px 0 0; padding: 30px 20px; border-bottom: 1px solid var(--border-light); color: #adb8c7; background: repeating-linear-gradient(to bottom, transparent 0, transparent 59px, #eef3f9 59px, #eef3f9 60px); font-size: 13px; text-align: center; }
.chart-empty > span { padding: 6px 12px; background: #ffffffe6; }
.bar-chart { display: flex; align-items: flex-end; justify-content: space-around; gap: 12px; min-height: 245px; padding: 20px 10px 28px; border-bottom: 1px solid var(--border-light); }
.bar-column { position: relative; display: flex; flex: 1; align-items: flex-end; justify-content: center; height: 210px; min-width: 0; }
.bar-column > i, .bar-column > .bar { display: block; width: min(34px, 70%); min-height: 2px; border-radius: 3px 3px 0 0; background: #7ab5ea; }
.bar-column > span, .bar-column > small { position: absolute; right: -5px; bottom: -26px; left: -5px; overflow: hidden; color: var(--muted); font-size: 11px; text-align: center; white-space: nowrap; text-overflow: ellipsis; }
.bar-column > em { position: absolute; bottom: calc(var(--bar-height, 0%) + 6px); color: #7d838e; font-size: 11px; font-style: normal; }
.dashboard-states { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
.dashboard-states > * { min-width: 0; padding: 20px 12px; border-right: 1px solid var(--border-light); text-align: center; }
.dashboard-states > :last-child { border-right: 0; }
.dashboard-states strong { display: block; margin-bottom: 6px; color: #525c6b; font-size: 23px; font-weight: 500; }
.dashboard-states span, .dashboard-states p { color: var(--muted); font-size: 12px; }
.shop-details dl { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 16px 12px; margin: 0; font-size: 13px; }
.shop-details dt { color: var(--muted); }
.shop-details dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: var(--text-secondary); }
.page-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 20px; }

/* Checkout keeps merchandise browsing and totals independently readable. */
.checkout-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 370px); align-items: start; gap: 20px; }
.checkout-side { position: sticky; top: 80px; min-width: 0; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 14px; }
.product-card { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; min-height: 155px; padding: 17px; border: 1px solid var(--border-light); border-radius: 5px; background: #fff; color: var(--text); text-align: left; transition: border-color .15s, box-shadow .15s, transform .15s; }
button.product-card:hover { border-color: #a6cff2; box-shadow: 0 3px 12px #4a9ff00d; transform: translateY(-1px); }
.product-card h3, .product-card strong { overflow-wrap: anywhere; font-size: 14px; font-weight: 500; }
.product-card p, .product-card small { color: var(--muted); font-size: 12px; }
.product-card .price, .product-card > b { margin-top: auto; color: #2f7fd6; font-size: 18px; font-weight: 500; }
.product-card img { width: 100%; height: 115px; object-fit: cover; border-radius: 3px; }
.cart-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 9px 15px; padding: 14px 0; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.cart-row > :first-child { min-width: 0; overflow-wrap: anywhere; }
.cart-row strong { font-size: 13px; font-weight: 500; }
.cart-row small { display: block; margin-top: 3px; color: var(--muted); }
.cart-row .actions { justify-content: flex-end; gap: 7px; }
.cart-row input:not([type="checkbox"]):not([type="radio"]) { width: 55px; min-height: 28px; padding: 3px 5px; text-align: center; }
.cart-totals { display: grid; gap: 10px; margin: 18px 0; padding-top: 5px; font-size: 13px; }
.cart-totals > div, .cart-totals > p { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; color: var(--text-secondary); }
.cart-totals > :last-child { margin-top: 6px; padding-top: 13px; border-top: 1px dashed var(--border); color: var(--text); }
.cart-totals strong { color: #2f7fd6; font-size: 25px; font-weight: 500; font-variant-numeric: tabular-nums; }
.checkout-side .card-body > .button.primary, .checkout-side > .button.primary { width: 100%; min-height: 40px; }
.tabs { display: flex; flex-wrap: wrap; gap: 0; min-width: 0; margin-bottom: 20px; border-bottom: 1px solid var(--border-light); }
.tab { position: relative; min-height: 43px; padding: 10px 19px; border: 0; background: transparent; color: var(--text-secondary); font-size: 14px; white-space: nowrap; }
.tab:hover { color: var(--primary-strong); }
.tab.active { color: var(--primary-strong); }
.tab.active::after { content: ""; position: absolute; inset: auto 15px -1px; height: 2px; background: var(--primary); }

/* Login, modal forms, and feedback share the same field and action language. */
.login-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 32px 20px; background: linear-gradient(160deg, #e7f1fd 0%, #f7fbff 52%, #eaf4fe 100%); }
.login-card { width: 100%; max-width: 420px; padding: 36px 36px 30px; border: 1px solid #e2ecf7; border-radius: 8px; background: #fff; box-shadow: 0 14px 44px #2b3a521f; }
.login-card .brand { justify-content: center; min-height: auto; padding: 0 0 21px; border: 0; color: var(--text); }
.login-card h1 { margin-bottom: 9px; font-size: 23px; text-align: center; }
.login-card > p { margin-bottom: 25px; color: var(--muted); font-size: 13px; text-align: center; }
.login-card .field { margin-bottom: 18px; }
.login-card .button.primary { width: 100%; min-height: 41px; margin-top: 7px; }
.login-card .hint { margin-top: 17px; color: #9ea9b8; font-size: 12px; text-align: center; }
.login-error { margin: 0 0 16px; padding: 9px 12px; border-radius: 4px; background: #fef0f0; color: #d35c5c; font-size: 13px; }
dialog.modal { width: min(680px, calc(100vw - 40px)); max-width: 100%; max-height: calc(100dvh - 60px); margin: auto; padding: 0; overflow: auto; overscroll-behavior: contain; border: 0; border-radius: 6px; background: #fff; color: var(--text); box-shadow: 0 14px 56px #0003; }
dialog.modal::backdrop { background: #11182766; backdrop-filter: blur(1px); }
dialog.modal form { margin: 0; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 64px; padding: 19px 24px; border-bottom: 1px solid var(--border-light); }
.modal-head h2, .modal-head h3 { font-size: 17px; font-weight: 500; }
.modal-head .button { min-height: 26px; padding: 1px 6px; color: #8b95a6; font-size: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 19px 20px; padding: 24px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > label, .field > .label { color: var(--text-secondary); font-size: 13px; line-height: 1.6; }
.field label.required::after { content: " *"; color: var(--danger); }
.field > label:has(input[type="checkbox"]), .field > label:has(input[type="radio"]) { display: flex; align-items: center; gap: 7px; min-height: 30px; }
.field .hint, .hint { color: #98a3b2; font-size: 12px; line-height: 1.7; }
.field .error, .field-error { color: var(--danger); font-size: 12px; }
.modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 17px 24px; border-top: 1px solid var(--border-light); background: #f8fbfe; }
.modal-actions .button { min-width: 74px; }
.modal .notice { margin: 20px 24px 0; }
.modal .form-grid + .notice { margin-top: 0; margin-bottom: 20px; }
.toast-stack { position: fixed; top: 76px; right: 24px; z-index: 1000; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; max-width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; max-width: 100%; padding: 13px 18px; border: 1px solid #d7e8fb; border-radius: 5px; background: #eaf4fe; color: #5a86ad; box-shadow: 0 5px 20px #2b3a521a; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; pointer-events: auto; animation: toast-in .18s ease-out; }
.toast.success { color: #66964b; border-color: #e1f3d8; background: #f0f9eb; }
.toast.error { color: #ce5b5b; border-color: #fde2e2; background: #fef0f0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.setting-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.setting-card { min-width: 0; padding: 23px; border: 1px solid var(--border-light); border-radius: var(--radius); background: #fff; }
.setting-card h2, .setting-card h3 { margin-bottom: 7px; font-size: 15px; font-weight: 500; }
.setting-card > p { margin-bottom: 22px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.setting-card .field + .field { margin-top: 17px; }
.setting-card .actions { margin-top: 22px; }
.setting-card .form-grid { padding: 0; }
.setting-card dl { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 12px; margin: 20px 0; font-size: 13px; }
.setting-card dt { color: var(--muted); }
.setting-card dd { margin: 0; overflow-wrap: anywhere; }
.print-only { display: none; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.sidebar-overlay, .sidebar-backdrop { display: none; }

@media (min-width: 1600px) {
  .main-content { padding: 28px 30px; }
  .metric-card { min-height: 148px; padding: 22px 24px; }
  .metric-icon { right: 24px; }
}
@media (max-width: 1180px) {
  .main-content { padding: 20px; }
  .metric-grid { gap: 12px; }
  .metric-card { padding: 17px 15px; }
  .metric-icon { top: 18px; right: 13px; width: 32px; height: 32px; font-size: 19px; }
  .metric-value { font-size: 26px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.65fr) minmax(250px, 1fr); gap: 16px; }
  .checkout-grid { grid-template-columns: minmax(0, 1fr) 310px; gap: 16px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 11px; }
  .product-card { padding: 14px; }
}
@media (max-width: 1020px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card { min-height: 130px; }
  .metric-icon { right: 20px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .checkout-grid { grid-template-columns: minmax(0, 1fr); }
  .checkout-side { position: static; }
  .page-grid, .setting-grid { grid-template-columns: minmax(0, 1fr); }
  .topbar-actions { gap: 9px; }
}
@media (max-width: 760px) {
  .sidebar { z-index: 60; width: 210px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; }
  .sidebar.open, .sidebar.is-open, .sidebar-open .sidebar, .app-shell.menu-open .sidebar { transform: translateX(0); box-shadow: 10px 0 35px #0002; }
  body.sidebar-open { overflow: hidden; }
  .sidebar-overlay, .sidebar-backdrop { position: fixed; inset: 0; z-index: 55; display: none; padding: 0; border: 0; background: #10131b66; }
  .sidebar-open .sidebar-overlay, .sidebar-open .sidebar-backdrop, .app-shell.menu-open .sidebar-overlay, .app-shell.menu-open .sidebar-backdrop, .sidebar-overlay.active, .sidebar-backdrop.active { display: block; }
  .workspace { width: 100%; margin-left: 0; }
  .topbar { gap: 11px; padding: 0 15px; }
  .menu-toggle { display: inline-flex; flex-shrink: 0; }
  .breadcrumbs { flex: 1; gap: 7px; overflow: hidden; }
  .topbar-actions { gap: 7px; font-size: 12px; }
  .topbar-actions > span { max-width: 125px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .main-content { padding: 18px 15px 28px; }
  .page-head { gap: 12px; margin-bottom: 18px; }
  h1 { font-size: 20px; }
  .page-head p { font-size: 12px; }
  .page-head > .actions { gap: 7px; }
  .page-head .button { padding: 7px 10px; }
  .metric-grid { gap: 11px; margin-bottom: 17px; }
  .metric-card { min-height: 128px; padding: 16px; }
  .metric-value { font-size: 25px; }
  .metric-icon { top: 18px; right: 14px; width: 30px; height: 30px; }
  .dashboard-grid { gap: 16px; margin-bottom: 16px; }
  .card-head { min-height: 53px; padding: 14px 16px; }
  .card-body { padding: 16px; }
  .toolbar { align-items: stretch; gap: 12px; }
  .search-form { width: 100%; }
  .search-form input:not([type="checkbox"]):not([type="radio"]) { flex: 1; width: auto; min-width: 150px; }
  .search-form select, .filter-row select { width: 145px; }
  .filter-row { gap: 9px; }
  table { min-width: 680px; }
  th, td { padding: 12px 14px; }
  .dashboard-states > * { padding: 18px 7px; }
  .dashboard-states strong { font-size: 21px; }
  .dashboard-states span, .dashboard-states p { font-size: 11px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); }
  .product-card { min-height: 145px; }
  .tabs { margin-bottom: 16px; }
  .tab { padding: 10px 14px; }
  .setting-card { padding: 19px 17px; }
  .toast-stack { top: 72px; right: 15px; }
  dialog.modal { width: calc(100vw - 28px); max-height: calc(100dvh - 32px); }
  .modal-head { min-height: 58px; padding: 16px 19px; }
  .form-grid { gap: 17px 15px; padding: 20px 19px; }
  .modal-actions { padding: 15px 19px; }
  .modal .notice { margin-right: 19px; margin-left: 19px; }
}
@media (max-width: 480px) {
  .topbar { padding: 0 11px; gap: 7px; }
  .topbar-actions > span { max-width: 92px; }
  .topbar-actions .button { padding-right: 7px; padding-left: 7px; font-size: 12px; }
  .breadcrumbs { font-size: 12px; }
  .main-content { padding: 16px 12px 24px; }
  .page-head { flex-direction: column; gap: 12px; }
  .page-head > .actions { width: 100%; justify-content: flex-start; padding-top: 0; }
  .metric-card { min-height: 123px; padding: 14px 12px; }
  .metric-label { max-width: calc(100% - 27px); font-size: 12px; }
  .metric-value { font-size: 23px; }
  .metric-foot { margin-top: 10px; font-size: 11px; }
  .metric-icon { top: 14px; right: 10px; width: 26px; height: 26px; font-size: 16px; }
  .metric-icon svg { width: 16px; height: 16px; }
  .search-form { gap: 8px; }
  .search-form input:not([type="checkbox"]):not([type="radio"]) { min-width: 120px; }
  .search-form select { flex: 1; width: 130px; }
  .filter-row > label { width: 100%; }
  .filter-row > label select, .filter-row > label input:not([type="checkbox"]):not([type="radio"]) { flex: 1; width: auto; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .product-card { min-height: 140px; padding: 13px 11px; }
  .product-card img { height: 100px; }
  .chart-empty { min-height: 220px; }
  .dashboard-states { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-states > * { padding: 16px 9px; border-bottom: 1px solid var(--border-light); }
  .dashboard-states > :nth-child(2n) { border-right: 0; }
  .dashboard-states > :nth-last-child(-n + 2) { border-bottom: 0; }
  .dashboard-states span, .dashboard-states p { font-size: 12px; }
  .shop-details dl { grid-template-columns: 70px minmax(0, 1fr); gap: 14px 10px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .field.full { grid-column: 1; }
  .modal-actions .button { min-width: 77px; }
  .login-screen { padding: 20px 15px; }
  .login-card { padding: 29px 24px 25px; }
  .setting-card .form-grid { grid-template-columns: minmax(0, 1fr); }
  .tab { padding-right: 12px; padding-left: 12px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media print {
  @page { margin: 12mm; }
  html, body { min-width: 0; min-height: 0; background: #fff; color: #000; }
  .sidebar, .topbar, .toast-stack, .sidebar-overlay, .sidebar-backdrop, .modal-actions { display: none !important; }
  .workspace { width: 100%; margin: 0; }
  .main-content { padding: 0; }
  .main-content .button, .main-content .actions, .main-content .pager, .main-content .search-form { display: none !important; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; font-size: 11px; }
  th, td { padding: 7px 4px; border-color: #bbb; color: #000; }
  body:not(.receipt-printing) .print-only, body:not(.receipt-printing) dialog { display: none !important; }
  body.receipt-printing * { visibility: hidden; }
  body.receipt-printing .app-shell, body.receipt-printing dialog { display: none !important; }
  body.receipt-printing .print-only, body.receipt-printing .print-only * { visibility: visible; }
  body.receipt-printing .print-only { position: absolute; top: 0; left: 0; display: block !important; width: 100%; padding: 0; color: #000; background: #fff; font-size: 12px; }
  body.receipt-printing .print-only h1, body.receipt-printing .print-only h2 { margin-bottom: 12px; text-align: center; }
  body.receipt-printing .print-only table { min-width: 0; color: #000; font-size: 11px; }
  body.receipt-printing .print-only th, body.receipt-printing .print-only td { padding: 7px 4px; border-color: #bbb; color: #000; background: #fff; }
  body.receipt-printing .print-only p { margin: 6px 0; }
}

/* Small helpers used by the final page templates. */
.muted { color: var(--muted); }
.eyebrow { color: var(--muted); font-size: 12px; letter-spacing: 1px; }
.error-text { min-height: 20px; margin: 8px 0; color: var(--danger); font-size: 12px; }
.brand > span:last-child { min-width: 0; line-height: 1.3; }
.brand small { display: block; margin-top: 4px; color: #9dabc2; font-size: 10px; font-weight: 400; letter-spacing: 0; }
.login-card > .brand-mark { display: flex; width: 44px; height: 44px; margin: 0 auto 14px; border-radius: 12px; font-size: 26px; }
.login-card > .eyebrow { margin-bottom: 7px; }
.login-card .field { font-size: 13px; color: var(--text-secondary); }
.login-card form { margin-top: 22px; }
.row-actions { white-space: nowrap; }
.row-actions .button + .button, .row-actions .link-button + .link-button { margin-left: 7px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 13px; margin-top: 18px; color: var(--muted); font-size: 12px; }
.dashboard-grid > div { display: grid; min-width: 0; gap: 20px; }
dl.shop-details { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 16px 12px; margin: 0; font-size: 13px; }
.chart-empty { flex-direction: column; gap: 7px; }
.chart-empty > div { color: #c2cbd8; font-size: 32px; line-height: 1.5; }
.chart-empty > small { color: #b0bac9; font-size: 12px; }
/* 客流分析折线图（全站统一蓝，不引入黄色） */
.line-chart { padding: 14px 6px 2px; border-bottom: 1px solid var(--border-light); }
.line-chart > svg { display: block; width: 100%; height: auto; }
.chart-grid { stroke: #e8eef7; stroke-width: 1; }
.chart-axis { fill: #9aa7b8; font-size: 11px; }
.chart-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart-line.member { stroke: #2f7fd6; }
.chart-line.walkin { stroke: #7ec1f5; }
.chart-line.total { stroke: #6b7a90; stroke-dasharray: 5 4; }
.chart-dot { fill: #fff; stroke-width: 1.7; }
.chart-dot.member { stroke: #2f7fd6; }
.chart-dot.walkin { stroke: #7ec1f5; }
.chart-dot.total { stroke: #6b7a90; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 16px; padding: 10px 4px 2px; color: var(--muted); font-size: 12px; }
.chart-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.chart-key { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.chart-key.member { background: #2f7fd6; }
.chart-key.walkin { background: #7ec1f5; }
.chart-key.total { background: #6b7a90; }
.bar-column > span { top: 0; bottom: auto; font-size: 10px; }
.bar-column > small { bottom: -26px; }
@media (max-width: 760px) {
  .dashboard-grid > div { gap: 16px; }
}
@media (max-width: 480px) {
  dl.shop-details { grid-template-columns: 70px minmax(0, 1fr); gap: 14px 10px; }
  .pager { justify-content: center; gap: 9px; }
}
.quantity-control { display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; }
.quantity-control .button { width: 28px; min-width: 28px; padding: 3px; }
.quantity-control > span { min-width: 19px; font-variant-numeric: tabular-nums; text-align: center; }
.cart-row > .button:last-child { grid-column: 2; justify-self: end; margin-top: -4px; }
.product-initial { display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; margin-bottom: 3px; border-radius: 9px; background: #eef4fb; color: #84a0bc; font-size: 22px; font-weight: 500; }
.product-card:nth-child(3n + 2) .product-initial { background: #e8f1fd; color: #79a6d8; }
.product-card:nth-child(3n + 3) .product-initial { background: #e2edfb; color: #6a9bcf; }
.card > .product-grid { padding: 20px; }
.product-grid > .empty-state { grid-column: 1 / -1; width: 100%; }
.checkout-grid .card-head .tabs { margin: -4px 0; border-bottom: 0; }
.checkout-grid .card-head .tabs .tab { min-height: 35px; padding: 5px 14px; border: 0; border-radius: 0; background: transparent; }
.checkout-grid .card-head > input { flex: 1; width: auto; min-width: 150px; max-width: 250px; }
.checkout-side .field { margin-bottom: 16px; }
.checkout-side .notice { margin-top: 7px; }
.loading-state { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 180px; padding: 30px; border: 1px solid var(--border-light); border-radius: var(--radius); background: #fff; color: var(--muted); font-size: 13px; text-align: center; }
.loading-state::before { content: ""; width: 16px; height: 16px; border: 2px solid #d9e5f4; border-top-color: var(--primary); border-radius: 50%; animation: loading-spin .8s linear infinite; }
@keyframes loading-spin { to { transform: rotate(360deg); } }
dialog.modal.wide { width: min(880px, calc(100vw - 40px)); }
.modal .error-text { margin: 0 24px 14px; }
@media (max-width: 760px) {
  .card > .product-grid { padding: 16px; }
  .checkout-grid .card-head > input { max-width: none; }
  dialog.modal.wide { width: calc(100vw - 28px); }
  .modal .error-text { margin-right: 19px; margin-left: 19px; }
}

/* 工作日历：月视图 + 当日时间轴 */
.calendar-layout { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); align-items: start; gap: 20px; }
.calendar-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 5px; color: var(--muted); font-size: 12px; text-align: center; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.calendar-cell { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 2px; min-height: 48px; padding: 5px 6px; border: 1px solid var(--border-light); border-radius: 4px; background: #fff; color: var(--text); font-size: 13px; text-align: left; transition: border-color .15s, box-shadow .15s; }
.calendar-cell:hover { border-color: var(--primary); }
.calendar-cell small { color: var(--primary-strong); font-size: 10px; }
.calendar-cell.rest { background: #f4f7fb; color: var(--muted); }
.calendar-cell.rest small { color: var(--muted); }
.calendar-cell.active { border-color: var(--primary); box-shadow: 0 0 0 2px #4a9ff026; font-weight: 600; }
.calendar-cell.blank { border: 0; background: transparent; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 16px; color: var(--text-secondary); font-size: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.legend-dot.pending { background: #e6a23c; }
.legend-dot.confirmed { background: #5aa845; }
.legend-dot.serving { background: #4a9ff0; }
.legend-dot.checkout { background: #8fb6e4; }
.legend-dot.completed { background: #2f7fd6; }
.legend-dot.cancelled { background: #c0c4cc; }
.legend-dot.hold { background: #b39ad8; }
.legend-dot.closed { background: #e0655f; }
.timeline { border-top: 1px solid var(--border-light); }
.timeline-row { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; border-bottom: 1px dashed var(--border-light); }
.timeline-time { padding: 9px 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.timeline-slot { display: flex; flex-direction: column; gap: 5px; min-height: 34px; padding: 4px 0; }
.timeline-slot.empty { cursor: pointer; }
.timeline-slot.empty:hover { background: #f6fafe; }
.timeline-slot.empty > span { padding-top: 6px; font-size: 12px; }
.timeline-item { display: flex; align-items: center; gap: 9px; padding: 6px 9px; border: 1px solid var(--border-light); border-left: 3px solid var(--primary); border-radius: 4px; background: #f7fafd; font-size: 13px; }
.timeline-item.blocked { border-left-color: #b39ad8; background: #f8f5fd; }
.timeline-item-time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.timeline-item-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.timeline-item-main small { color: var(--muted); font-size: 11px; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.week-column { min-width: 0; padding: 7px; border: 1px solid var(--border-light); border-radius: 4px; background: #fff; }
.week-column.active { border-color: var(--primary); }
.week-head { display: block; width: 100%; margin-bottom: 6px; padding: 0; border: 0; background: transparent; color: var(--text-secondary); font-size: 12px; text-align: left; }
.week-item { margin-bottom: 4px; padding: 4px 6px; border-radius: 3px; background: #f2f7fd; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.week-item.blocked { background: #f8f5fd; }
@media (max-width: 1020px) { .calendar-layout { grid-template-columns: minmax(0, 1fr); } .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 「较昨日」对比：全站统一蓝，涨用主蓝、跌用中性灰，不用红色 */
.metric-delta { font-weight: 500; }
.metric-delta.up { color: #2f7fd6; }
.metric-delta.down { color: #8593a5; }
.metric-delta.flat { color: #9aa5b4; }
.metric-note { color: #9aa5b4; }
/* 顶部栏身份：头像 + 姓名 + 角色，点进个人中心 */
.topbar-actions .whoami { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.topbar-actions .whoami > span { display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.topbar-actions .whoami small { color: var(--muted); font-size: 11px; }

/* 头像：没上传时显示姓氏首字，上传后盖一层图片 */
.avatar { position: relative; display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 34px; height: 34px; overflow: hidden; border-radius: 50%; background: #e9f2fd; color: #2f7fd6; font-size: 15px; font-weight: 600; }
.avatar > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar > b { position: relative; }
.avatar.large { width: 72px; height: 72px; font-size: 30px; }
.avatar.small { width: 26px; height: 26px; font-size: 12px; }

/* 个人中心 */
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.profile-head strong { font-size: 18px; }
.profile-head p { margin: 2px 0; font-size: 13px; }
.profile-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
.profile-grid .actions { margin-bottom: 12px; }
@media (max-width: 1100px) { .profile-grid { grid-template-columns: minmax(0, 1fr); } }
