:root {
  --green: #32d638;
  --green-dark: #20b927;
  --green-soft: #ddf9df;
  --orange: #ff8a16;
  --red: #e54848;
  --blue: #2b7bd8;
  --bg: #f5f7f8;
  --side-bg: #edf4f7;
  --header-bg: #dedede;
  --panel: #fff;
  --text: #20262b;
  --muted: #858d96;
  --label: #5e6876;
  --line: #dfe5ea;
  --line-dark: #d2d9de;
  --table-head: #f7f8fa;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", Arial, sans-serif;
}

.site-record-footer {
  position: fixed;
  z-index: 20;
  right: 18px;
  bottom: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid rgba(220, 228, 234, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #7a858f;
  font-size: 12px;
  box-shadow: 0 4px 18px rgba(25, 39, 52, 0.08);
  backdrop-filter: blur(8px);
}

.site-record-footer a {
  color: #5d6974;
  text-decoration: none;
}

.site-record-footer a:hover {
  color: #20b927;
}

@media (max-width: 720px) {
  .site-record-footer {
    right: 8px;
    bottom: 6px;
    max-width: calc(100vw - 16px);
    gap: 6px;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) minmax(480px, 1.1fr);
  background:
    radial-gradient(circle at 18% 18%, rgba(50, 214, 56, 0.14), transparent 30%),
    linear-gradient(135deg, #f7fbfc 0%, #e9f1f5 100%);
}

.login-hero {
  padding: 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-mark {
  width: 112px;
  height: 72px;
  border: 12px solid var(--green);
  border-left-width: 22px;
  border-radius: 4px 28px 4px 28px;
  color: var(--green);
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 1px;
  margin-bottom: 26px;
}

.login-hero h1 {
  margin: 0 0 18px;
  font-size: 42px;
  line-height: 1.15;
  letter-spacing: 0;
}

.login-hero p {
  margin: 0;
  color: #64707a;
  font-size: 18px;
  line-height: 1.8;
  max-width: 520px;
}

.login-card-wrap {
  display: grid;
  place-items: center;
  padding: 40px;
}

.login-card {
  width: min(460px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 18px 44px rgba(36, 52, 63, 0.12);
}

.login-card h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.login-card .hint {
  margin: 0 0 24px;
  color: var(--muted);
}

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

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

.form-field label {
  color: var(--label);
  font-weight: 800;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #d9dfe5;
  border-radius: 6px;
  padding: 0 12px;
  color: #515b65;
  background: #fff;
}

.form-field textarea {
  min-height: 86px;
  padding: 10px 12px;
  resize: vertical;
}

.voucher-upload {
  margin-top: 16px;
  border: 1px dashed #aee8b2;
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  background: #f7fff8;
}

.voucher-upload strong {
  display: block;
  color: #3f4852;
  margin-bottom: 4px;
}

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

.voucher-upload input[type="file"] {
  display: none;
}

.voucher-preview-wrap {
  grid-column: 1 / -1;
}

.voucher-preview {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}

.voucher-preview img {
  width: 120px;
  height: 80px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.detail-field .voucher-preview {
  margin-top: 4px;
  align-items: flex-start;
}

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

.login-submit {
  height: 46px;
  border: 0;
  border-radius: 6px;
  font-size: 18px;
  font-weight: 900;
}

.demo-users {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.demo-users button {
  border: 1px solid var(--line);
  background: #f8fafb;
  border-radius: 6px;
  color: #53606b;
  padding: 5px 9px;
  margin: 4px 4px 0 0;
}

.app-shell {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: clamp(238px, 15vw, 286px) minmax(0, 1fr);
  overflow: hidden;
}

.sidebar {
  height: 100vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #f4fafb 0%, #e9f1f5 100%);
  border-right: 1px solid #d8e1e6;
}

.brand {
  padding: 26px 22px 18px;
}

.sidebar-account {
  display: none;
}

.brand .brand-mark {
  width: 96px;
  height: 66px;
  margin: 0 auto 16px;
}

.brand h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 900;
}

.menu {
  display: grid;
  gap: 4px;
  padding: 4px 0 32px;
}

.menu-group {
  display: grid;
}

.menu-button,
.menu-link {
  width: 100%;
  min-height: 54px;
  border: 0;
  background: transparent;
  color: #7d858e;
  display: grid;
  grid-template-columns: 26px 1fr 16px;
  align-items: center;
  gap: 12px;
  padding: 0 30px 0 34px;
  text-align: left;
}

.menu-link {
  grid-template-columns: 26px 1fr;
  min-height: 56px;
  padding-left: 64px;
}

.menu-button:hover,
.menu-link:hover {
  color: var(--green-dark);
  background: rgba(50, 214, 56, 0.08);
}

.menu-button.active,
.menu-link.active {
  background: var(--green);
  color: #fff;
  font-weight: 800;
}

.menu-icon {
  width: 24px;
  height: 24px;
  border: 2px solid currentColor;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
}

.menu-label {
  font-size: 20px;
  white-space: nowrap;
}

.chevron {
  font-size: 18px;
  transition: transform 0.18s ease;
}

.menu-group.is-open .chevron {
  transform: rotate(180deg);
}

.menu-children {
  display: none;
}

.menu-group.is-open .menu-children {
  display: grid;
}

.main-shell {
  height: 100vh;
  min-width: 0;
  display: grid;
  grid-template-rows: 58px 74px 1fr;
  overflow: hidden;
}

.app-header {
  background: linear-gradient(180deg, #eeeeee 0%, #d7d7d7 100%);
  border-bottom: 1px solid #cdd3d8;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 0 26px;
}

.mobile-menu {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green-dark);
  font-size: 22px;
}

.primary-nav {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 58px;
  max-width: 100%;
  overflow-x: auto;
}

.primary-nav button {
  border: 0;
  background: transparent;
  color: #777;
  font-size: 21px;
  font-weight: 900;
  min-height: 44px;
}

.primary-nav button.active {
  color: #5e5e5e;
}

.account-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #747474;
  white-space: nowrap;
  font-size: 16px;
  min-width: 0;
}

.account-bar strong {
  color: var(--green-dark);
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #14313a;
  color: #6ce070;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.divider {
  width: 1px;
  height: 22px;
  background: #9e9e9e;
}

.store-select {
  height: 36px;
  border: 1px solid #cbd2d8;
  border-radius: 6px;
  background: #fff;
  color: #505962;
  padding: 0 10px;
}

.logout-btn {
  border: 1px solid #cbd2d8;
  background: #fff;
  border-radius: 6px;
  color: #59636d;
  height: 34px;
  padding: 0 10px;
}

.tab-strip {
  background: #d2d2d2;
  border-bottom: 7px solid #efefef;
  padding: 20px 28px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
}

.page-tab {
  min-width: 94px;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: #fff;
  color: #596272;
  padding: 0 22px;
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.page-tab.active {
  color: var(--green-dark);
  background: var(--green-soft);
  border-color: var(--green);
}

.page-tab .close {
  font-weight: 400;
}

.content {
  background: #fff;
  overflow: hidden auto;
  min-width: 0;
}

.workbench {
  width: 100%;
  min-width: 0;
}

.list-top {
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 10px 14px 10px 18px;
}

.module-tabs {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 100%;
  min-width: 0;
  overflow-x: auto;
}

.module-tabs button {
  border: 0;
  background: transparent;
  color: #596272;
  min-height: 72px;
  padding: 0 8px;
  font-size: 18px;
  font-weight: 800;
  position: relative;
}

.module-tabs button.active {
  color: var(--green-dark);
}

.module-tabs button.active::after,
.sub-tabs button.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 4px;
  background: var(--green);
}

.filter-toggle {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn,
.muted-btn {
  min-height: 42px;
  border: 1px solid var(--green);
  border-radius: 6px;
  background: #fff;
  color: var(--green-dark);
  padding: 0 18px;
  font-size: 16px;
  font-weight: 800;
}

.btn.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 14px;
}

.muted-btn {
  color: #b7bdc5;
  border-color: #d8dee3;
  background: #f9fafb;
}

.btn.orange {
  color: var(--orange);
  border-color: var(--orange);
}

.btn.danger {
  color: var(--red);
  border-color: var(--red);
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.sub-tabs {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 58px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line-dark);
  overflow-x: auto;
}

.sub-tabs button {
  border: 0;
  background: transparent;
  color: #596272;
  min-height: 58px;
  padding: 0 10px;
  font-size: 18px;
  font-weight: 800;
  position: relative;
}

.sub-tabs button.active {
  color: var(--green-dark);
}

.filter-panel {
  border-bottom: 1px solid var(--line-dark);
  padding: 10px 28px 8px;
}

.filter-panel.closed {
  display: none;
}

.filter-grid {
  display: grid;
  gap: 14px 44px;
}

.filter-grid.cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.filter-grid.cols-4 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.filter-field {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: center;
  gap: 10px;
}

.filter-field label {
  color: var(--label);
  font-size: 17px;
  font-weight: 800;
  text-align: right;
}

.filter-field input,
.filter-field select {
  width: 100%;
  height: 42px;
  border: 1px solid #d9dfe5;
  border-radius: 6px;
  background: #fff;
  color: #68717a;
  padding: 0 12px;
  font-size: 16px;
}

.filter-field input::placeholder {
  color: #c0c7cf;
}

.filter-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-start;
  padding-left: 18px;
  gap: 10px;
}

.keyword-row {
  min-height: 64px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 28px;
  flex-wrap: wrap;
}

.keyword-row label {
  font-size: 17px;
  color: var(--label);
  font-weight: 800;
}

.keyword-row input {
  width: min(420px, 100%);
  flex: 1 1 260px;
  height: 42px;
  border: 1px solid #d9dfe5;
  border-radius: 6px;
  padding: 0 14px;
  font-size: 16px;
}

.table-shell {
  overflow: auto;
  border-top: 0;
  width: 100%;
  max-height: calc(100vh - 420px);
}

table {
  width: 100%;
  min-width: 1360px;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
}

th,
td {
  height: 50px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
  color: #6f7378;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  position: relative;
  background: var(--table-head);
  color: #5f6670;
  font-weight: 900;
  text-align: center;
  user-select: none;
}

th[draggable="true"] {
  cursor: grab;
}

th.dragging {
  opacity: 0.55;
}

.th-label {
  display: block;
  padding-right: 10px;
  pointer-events: none;
}

.column-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.column-resizer:hover {
  background: rgba(50, 214, 56, 0.18);
}

td {
  text-align: center;
}

td.link-cell,
.link-cell {
  color: var(--green-dark);
  font-weight: 800;
}

.link-button,
.inline-link {
  border: 0;
  background: transparent;
  color: var(--green-dark);
  font: inherit;
  font-weight: 900;
  padding: 0;
}

.link-button:hover,
.inline-link:hover {
  text-decoration: underline;
}

.checkbox-cell {
  width: 56px;
}

.index-cell {
  width: 70px;
}

.fake-check {
  width: 18px;
  height: 18px;
  display: inline-block;
  border: 2px solid #d9dfe6;
  border-radius: 4px;
  background: #f8fafb;
  vertical-align: middle;
}

.row-check {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
  vertical-align: middle;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 13px;
  font-weight: 900;
  background: #eef3f5;
  color: #59636d;
}

.status.green {
  background: #def7e0;
  color: #148a1a;
}

.status.orange {
  background: #fff0ce;
  color: #9a6200;
}

.status.red {
  background: #ffe0e0;
  color: #b42b2b;
}

.status.blue {
  background: #e1efff;
  color: #1f5fa8;
}

.summary-row td {
  background: #fbfcfd;
  font-weight: 800;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.bottom-scroll {
  height: 8px;
  width: 520px;
  background: #a6eba8;
  border-radius: 999px;
  margin: -8px 0 0 28px;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.pagination-summary {
  color: var(--muted);
  white-space: nowrap;
}

.pagination-summary strong {
  color: var(--text);
}

.pagination-controls,
.page-numbers {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-controls label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.pagination-controls select,
.page-nav,
.page-number {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.pagination-controls select {
  padding: 0 28px 0 10px;
}

.page-nav,
.page-number {
  padding: 0 12px;
  cursor: pointer;
}

.page-number {
  min-width: 36px;
  padding: 0 8px;
}

.page-number.active {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.page-nav:disabled {
  cursor: not-allowed;
  color: #aeb6bf;
  background: #f5f7f8;
}

@media (max-width: 820px) {
  .pagination-bar,
  .pagination-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-controls label,
  .page-numbers {
    justify-content: center;
  }

  .page-nav {
    width: 100%;
  }
}

.home-page {
  padding: 24px;
  width: 100%;
  min-width: 0;
}

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

.home-head h2 {
  margin: 0 0 8px;
  font-size: 26px;
}

.home-head p {
  margin: 0;
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.card,
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.card {
  padding: 18px;
}

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

.card strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
}

.home-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
}

.panel {
  padding: 18px;
  min-width: 0;
}

.panel h3 {
  margin: 0 0 14px;
}

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

.mini-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #5f6670;
}

.mini-item small {
  color: var(--muted);
  white-space: nowrap;
}

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

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

.settings-store-row strong {
  display: block;
  margin-bottom: 6px;
  color: #313a43;
  font-size: 18px;
}

.settings-store-row span {
  color: var(--muted);
  line-height: 1.6;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 25, 32, 0.38);
  display: grid;
  place-items: center;
  z-index: 50;
}

.modal {
  width: min(900px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: 0 18px 54px rgba(12, 20, 28, 0.22);
}

.detail-modal {
  width: min(1040px, calc(100vw - 32px));
}

.order-modal {
  width: min(1280px, calc(100vw - 32px));
}

.user-modal {
  width: min(1180px, calc(100vw - 32px));
}

.product-import-modal {
  width: min(1240px, calc(100vw - 32px));
}

.modal-head {
  min-height: 64px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
}

.modal-head h3 {
  margin: 0;
  font-size: 22px;
}

.modal-close {
  border: 0;
  background: transparent;
  font-size: 26px;
  color: #87919b;
}

.modal-body {
  padding: 22px;
}

.modal-hint {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.7;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

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

.user-form-section,
.role-guide-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 16px;
}

.permission-editor {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.permission-help {
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

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

.permission-group {
  border: 1px solid #dfe5ea;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.permission-group > strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 14px;
}

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

.permission-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #515b65;
  font-size: 13px;
  line-height: 1.45;
}

.permission-check input {
  margin-top: 3px;
  accent-color: var(--green);
}

.permission-check b,
.permission-check em {
  display: block;
}

.permission-check b {
  color: var(--text);
}

.permission-check em {
  margin-top: 2px;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.section-title {
  margin-bottom: 14px;
  color: var(--text);
  font-weight: 900;
}

.role-guide-list {
  display: grid;
  gap: 10px;
  max-height: min(480px, calc(100vh - 280px));
  overflow: auto;
  padding-right: 4px;
}

.role-guide-card {
  border: 1px solid #dfe5ea;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.role-guide-card.active {
  border-color: var(--green);
  background: #f0fff2;
  box-shadow: 0 0 0 2px rgba(47, 213, 52, 0.12);
}

.role-guide-card strong {
  display: block;
  color: var(--text);
  font-size: 15px;
}

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

.role-guide-card p {
  margin: 8px 0 0;
  color: #515b65;
  font-size: 13px;
  line-height: 1.55;
}

.product-import-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.file-picker input {
  display: none;
}

.file-picker span {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--green);
  border-radius: 6px;
  color: var(--green);
  font-weight: 900;
  padding: 0 16px;
  cursor: pointer;
}

.import-count {
  color: var(--muted);
  font-weight: 800;
}

.product-import-preview {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.product-import-preview .section-head {
  padding: 12px 14px;
  background: #fbfcfd;
  border-bottom: 1px solid var(--line);
}

.product-import-preview .section-head span {
  color: var(--muted);
  font-size: 13px;
}

.preview-table {
  overflow: auto;
  max-height: min(360px, calc(100vh - 360px));
}

.preview-table table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
}

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

.preview-table th {
  background: var(--table-head);
  color: #56606a;
  font-weight: 900;
}

.product-import-empty {
  margin: 14px 0;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.assign-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.assign-preview span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafb;
  color: #59636d;
  padding: 6px 10px;
  font-size: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 16px;
}

.form-field.wide {
  grid-column: span 3;
}

.modal-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.order-form-section {
  display: grid;
  gap: 16px;
  margin-bottom: 22px;
}

.order-form-section h4,
.section-head h4 {
  margin: 0;
  color: #3f4852;
  font-size: 18px;
}

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

.order-items-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
}

.order-items-head,
.order-items-row {
  display: grid;
  grid-template-columns: minmax(300px, 1.6fr) 150px 110px 140px 90px 80px 100px 100px minmax(150px, 1fr) 82px;
  min-width: 1320px;
}

.order-items-head span,
.order-items-row span,
.order-items-row input,
.order-items-row select,
.order-product-picker {
  min-height: 48px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  color: #626b74;
}

.order-items-head span {
  background: var(--table-head);
  color: #56606a;
  font-weight: 900;
}

.order-items-row input,
.order-items-row select {
  width: 100%;
  border-top: 0;
  border-left: 0;
  background: #fff;
  text-align: center;
}

.order-product-picker {
  display: grid;
  gap: 8px;
  padding: 8px;
  align-content: center;
}

.order-product-picker input,
.order-product-picker select {
  min-height: 36px;
  border: 1px solid #d9dfe5;
  border-radius: 6px;
  padding: 0 10px;
  text-align: left;
}

.order-items-row .btn {
  align-self: center;
  justify-self: center;
}

.order-total {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  color: #59636d;
  font-size: 17px;
  font-weight: 800;
}

.order-total strong {
  color: var(--green-dark);
  font-size: 22px;
}

.template-box {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafcfd;
  padding: 14px;
}

.template-box strong {
  display: block;
  margin-bottom: 10px;
  color: #4f5963;
}

.template-box pre {
  margin: 0;
  white-space: pre-wrap;
  color: #65707b;
  line-height: 1.6;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.settings-grid section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.settings-grid h4 {
  margin: 0 0 12px;
}

.settings-modal .modal-body {
  max-height: calc(100vh - 180px);
  overflow: auto;
}

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

.field-order-item {
  display: grid;
  grid-template-columns: 34px minmax(130px, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
}

.field-order-index {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 900;
}

.field-order-item strong {
  color: #46515c;
}

.field-order-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.field-order-actions .btn[disabled] {
  opacity: 0.38;
  cursor: not-allowed;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-list span {
  border: 1px solid #cfe8d2;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  padding: 6px 10px;
  font-weight: 800;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.detail-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.detail-section h4,
.follow-head h4 {
  margin: 0 0 14px;
  font-size: 18px;
}

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

.detail-field {
  min-height: 58px;
  border: 1px solid #edf1f4;
  border-radius: 6px;
  padding: 9px 10px;
  background: #fafcfd;
}

.detail-field span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.detail-field strong {
  display: block;
  color: #4f5963;
  font-size: 15px;
  line-height: 1.4;
  word-break: break-word;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.order-items-detail {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.mini-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.mini-table-head,
.mini-table-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr 80px 100px 100px;
}

.mini-table-head span,
.mini-table-row span {
  min-height: 42px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  color: #5f6670;
  text-align: center;
}

.mini-table-head span {
  background: var(--table-head);
  font-weight: 900;
}

.follow-section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

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

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

.follow-item {
  border: 1px solid #edf1f4;
  border-radius: 6px;
  padding: 12px;
  background: #fafcfd;
}

.follow-item div {
  color: #5c6670;
  font-size: 14px;
  margin-bottom: 8px;
}

.follow-item p {
  margin: 0 0 8px;
  color: #303841;
  line-height: 1.5;
}

.follow-item span,
.empty-note {
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: #1f2a33;
  color: #fff;
  border-radius: 8px;
  padding: 12px 16px;
  z-index: 80;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}

.overlay {
  display: none;
}

@media (max-width: 1200px) {
  .login-page {
    grid-template-columns: 1fr;
  }

  .login-hero {
    padding: 40px 40px 0;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(286px, 82vw);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 30;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-menu {
    display: block;
  }

  .account-bar {
    display: none;
  }

  .sidebar-account {
    margin-top: 14px;
    display: grid;
    gap: 10px;
    color: #5b6670;
    font-size: 14px;
  }

  .sidebar-account label,
  .sidebar-account span {
    display: grid;
    gap: 6px;
  }

  .sidebar-account .store-select,
  .sidebar-account .logout-btn {
    width: 100%;
    height: 38px;
  }

  .app-header {
    grid-template-columns: auto 1fr;
    padding: 0 12px;
  }

  .primary-nav {
    justify-self: start;
    gap: 20px;
  }

  .primary-nav button {
    font-size: 17px;
  }

  .overlay.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.28);
    z-index: 20;
  }
}

@media (max-width: 820px) {
  .login-card-wrap {
    padding: 20px;
  }

  .login-hero {
    padding: 28px 20px 0;
  }

  .login-hero h1 {
    font-size: 32px;
  }

  .main-shell {
    grid-template-rows: 58px 68px 1fr;
  }

  .primary-nav {
    gap: 10px;
  }

  .primary-nav button {
    font-size: 15px;
  }

  .tab-strip {
    padding: 14px 12px 8px;
  }

  .workbench,
  .home-page {
    min-width: 0;
  }

  .filter-grid.cols-3,
  .filter-grid.cols-4 {
    grid-template-columns: 1fr;
  }

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

  .list-top {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .module-tabs,
  .sub-tabs {
    gap: 14px;
  }

  .actions {
    justify-content: flex-start;
  }

  .home-head {
    flex-direction: column;
  }

  .home-grid {
    grid-template-columns: 1fr;
  }

  .settings-store-row,
  .mini-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .mini-item {
    display: grid;
    gap: 10px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-field.wide {
    grid-column: span 1;
  }

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

  .role-guide-list {
    max-height: none;
  }

  .detail-grid,
  .detail-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body {
    overflow: hidden;
  }

  .login-page {
    min-height: 100svh;
  }

  .login-hero {
    padding: 22px 18px 0;
  }

  .login-hero .brand-mark {
    width: 86px;
    height: 58px;
    border-width: 8px;
    border-left-width: 16px;
    margin-bottom: 14px;
  }

  .login-hero h1 {
    font-size: 28px;
  }

  .login-hero p {
    font-size: 14px;
    line-height: 1.6;
  }

  .login-card {
    padding: 22px;
    border-radius: 8px;
  }

  .app-shell,
  .main-shell {
    height: 100svh;
  }

  .main-shell {
    grid-template-rows: 52px 56px minmax(0, 1fr);
  }

  .app-header {
    min-width: 0;
    gap: 8px;
    padding: 0 10px;
  }

  .mobile-menu {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
  }

  .primary-nav {
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .primary-nav::-webkit-scrollbar,
  .tab-strip::-webkit-scrollbar,
  .module-tabs::-webkit-scrollbar,
  .sub-tabs::-webkit-scrollbar {
    display: none;
  }

  .primary-nav button {
    min-height: 36px;
    font-size: 15px;
    white-space: nowrap;
  }

  .sidebar {
    width: min(320px, 88vw);
  }

  .brand {
    padding: 20px 18px 14px;
  }

  .brand .brand-mark {
    width: 78px;
    height: 54px;
    border-width: 8px;
    border-left-width: 16px;
    margin: 0 0 12px;
  }

  .brand h1 {
    font-size: 24px;
  }

  .menu {
    padding-bottom: 20px;
  }

  .menu-button,
  .menu-link {
    min-height: 50px;
    padding: 0 18px;
    gap: 10px;
  }

  .menu-link {
    padding-left: 34px;
  }

  .menu-label {
    font-size: 17px;
  }

  .tab-strip {
    padding: 8px 10px;
    border-bottom-width: 4px;
    gap: 6px;
  }

  .page-tab {
    min-width: auto;
    min-height: 38px;
    border-radius: 8px;
    padding: 0 12px;
    font-size: 14px;
  }

  .content {
    -webkit-overflow-scrolling: touch;
  }

  .list-top {
    min-height: auto;
    padding: 10px;
    gap: 10px;
  }

  .module-tabs {
    gap: 10px;
  }

  .module-tabs button {
    min-height: 42px;
    font-size: 16px;
    white-space: nowrap;
  }

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

  .actions .btn,
  .actions .muted-btn {
    width: 100%;
    min-height: 38px;
    padding: 0 10px;
    font-size: 14px;
  }

  .sub-tabs {
    min-height: 44px;
    padding: 0 10px;
    gap: 12px;
  }

  .sub-tabs button {
    min-height: 44px;
    padding: 0 4px;
    font-size: 15px;
    white-space: nowrap;
  }

  .filter-panel {
    padding: 10px;
  }

  .filter-field {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .filter-field label {
    text-align: left;
    font-size: 14px;
  }

  .filter-field input,
  .filter-field select,
  .keyword-row input {
    height: 40px;
    font-size: 15px;
  }

  .filter-actions {
    padding-left: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .keyword-row {
    min-height: auto;
    padding: 10px;
    align-items: stretch;
  }

  .keyword-row label {
    width: 100%;
    font-size: 14px;
  }

  .keyword-row .btn {
    width: 96px;
  }

  .table-shell {
    max-height: none;
    overflow: visible;
    padding: 10px;
    background: #f5f7f8;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
  }

  td {
    min-height: 42px;
    height: auto;
    border-right: 0;
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    text-align: left;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    padding: 10px 12px;
    font-size: 14px;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 800;
    font-size: 13px;
  }

  td.checkbox-cell,
  td.index-cell {
    width: 100%;
  }

  .table-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .bottom-scroll,
  .summary-row {
    display: none;
  }

  .home-page {
    padding: 14px;
  }

  .home-head h2 {
    font-size: 22px;
  }

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

  .card {
    padding: 14px;
  }

  .card strong {
    font-size: 24px;
  }

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

  .panel {
    padding: 14px;
  }

  .modal-backdrop {
    place-items: stretch;
    padding: 0;
  }

  .modal,
  .detail-modal,
  .order-modal,
  .user-modal,
  .product-import-modal {
    width: 100vw;
    max-height: 100svh;
    height: 100svh;
    border-radius: 0;
    border: 0;
  }

  .modal-head {
    min-height: 56px;
    padding: 0 14px;
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
  }

  .modal-head h3 {
    font-size: 19px;
  }

  .modal-body {
    padding: 14px;
  }

  .modal-hint {
    font-size: 14px;
  }

  .modal-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 1px solid var(--line);
    margin: 14px -14px -14px;
    padding: 10px 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .modal-actions .btn {
    width: 100%;
  }

  .order-items-table,
  .preview-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .order-items-head,
  .order-items-row {
    min-width: 1180px;
  }

  .detail-section {
    padding: 12px;
  }

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

  .mini-table-head,
  .mini-table-row {
    min-width: 680px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .toast {
    left: 14px;
    right: 14px;
    bottom: 14px;
    text-align: center;
  }
}
