:root {
  --bg: #f8fafc;
  --surface: #f8fafc;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #dbeafe;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #3b82f6;
  --accent: #d97706;
  --accent-soft: #fef3c7;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --danger: #dc2626;
  --shadow: 0 18px 38px rgba(37, 99, 235, 0.10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 9% 12%, rgba(219, 234, 254, 0.88), transparent 28%),
    radial-gradient(circle at 94% 88%, rgba(224, 242, 254, 0.82), transparent 30%),
    linear-gradient(135deg, #f8fafc 0%, #eef6ff 50%, #f8fafc 100%);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

button,
input,
select { font: inherit; }

button {
  cursor: pointer;
  border: 0;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, color 180ms ease;
}

button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0) scale(0.985); }
button:focus-visible,
input:focus,
select:focus {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 2px;
}

.shell {
  display: flex;
  min-height: 100vh;
  padding: 18px;
  gap: 18px;
}

.sidebar {
  position: sticky;
  top: 18px;
  width: 248px;
  height: calc(100vh - 36px);
  padding: 24px 18px;
  border: 1px solid rgba(219, 234, 254, 0.58);
  border-radius: 26px;
  background: linear-gradient(180deg, #0f172a 0%, #1e3a8a 100%);
  color: #fff;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
}

.brand span {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 15px;
  background: var(--primary);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.26);
  font-weight: 900;
}

.brand strong,
.brand small { display: block; }
.brand strong { font-size: 17px; }
.brand small { color: #bfdbfe; margin-top: 4px; }

.nav {
  width: 100%;
  height: 46px;
  margin-bottom: 10px;
  padding: 0 16px;
  border-radius: 15px;
  background: transparent;
  color: #dbeafe;
  text-align: left;
  font-weight: 700;
}

.nav.active,
.nav:hover {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 12px 12px 34px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding: 18px 20px;
  border: 1px solid rgba(219, 234, 254, 0.86);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.08);
  backdrop-filter: blur(16px);
}

h1,
h2,
p { margin: 0; }

h1 { font-size: 30px; line-height: 1.2; }
h2 { margin-bottom: 16px; font-size: 18px; }
.topbar p { margin-top: 8px; color: var(--muted); }

#refreshBtn,
form button,
.small-btn {
  min-height: 40px;
  padding: 0 18px;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.16);
  font-weight: 800;
}

.view { display: none; }
.view.active { display: block; }

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(128px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.metrics article,
.panel {
  border: 1px solid rgba(219, 234, 254, 0.95);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.metrics article {
  position: relative;
  min-height: 114px;
  padding: 20px;
  overflow: hidden;
}

.metrics article::after {
  position: absolute;
  right: -24px;
  bottom: -28px;
  width: 76px;
  height: 76px;
  border-radius: 999px;
  background: #dbeafe;
  content: '';
}

.metrics article:nth-child(3)::after,
.metrics article:nth-child(5)::after { background: #e0f2fe; }
.metrics article:nth-child(4)::after { background: #fef3c7; }
.metrics article:nth-child(6)::after { background: #dcfce7; }

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metrics strong {
  display: block;
  margin-top: 12px;
  color: var(--ink);
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
}

.metrics article:nth-child(2) strong,
.metrics article:nth-child(3) strong { color: var(--secondary); }
.metrics article:nth-child(4) strong { color: var(--accent); }
.metrics article:nth-child(5) strong { color: #0284c7; }
.metrics article:nth-child(6) strong { color: var(--green); }

.grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.panel { padding: 20px; }

.form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-content: start;
}

.form h2,
.form button { grid-column: 1 / -1; }

input,
select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  background: #ffffff;
  color: var(--ink);
}

input::placeholder { color: #94a3b8; }
input[type=file] { height: auto; padding: 10px 12px; }

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

.list-row,
.category-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid #dbeafe;
  border-radius: 18px;
  background: #ffffff;
}

.list-row b {
  display: inline-flex;
  min-width: 42px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--primary-dark);
}

.list-row small,
td small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.category-tree {
  display: grid;
  gap: 14px;
}

.category-card { align-items: flex-start; }
.category-main { flex: 1; }

.sub-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.sub-pill {
  padding: 7px 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 700;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid #dbeafe;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  background: #eff6ff;
  font-size: 13px;
  font-weight: 800;
}

th:first-child { border-radius: 14px 0 0 14px; }
th:last-child { border-radius: 0 14px 14px 0; }
tr:hover td { background: rgba(239, 246, 255, 0.7); }

.badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: #166534;
  font-size: 12px;
  font-weight: 800;
}

.badge.off {
  background: #fee2e2;
  color: #b91c1c;
}

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

.danger { background: var(--danger); }
.muted {
  background: #eff6ff;
  color: var(--primary-dark);
  box-shadow: none;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: none;
  padding: 13px 18px;
  border-radius: 16px;
  background: #0f172a;
  color: #fff;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.22);
  font-weight: 800;
}

.toast.show { display: block; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
}

@media (max-width: 980px) {
  .shell { flex-direction: column; }
  .sidebar { position: static; width: 100%; height: auto; }
  .metrics,
  .grid.two { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .shell { padding: 10px; }
  .main { padding: 0 0 24px; }
  .topbar { align-items: flex-start; flex-direction: column; gap: 14px; }
  .metrics,
  .grid.two,
  .form { grid-template-columns: 1fr; }
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.folder-workbench {
  margin-bottom: 18px;
  padding: 24px;
}

.folder-workbench .panel-title-row > div {
  min-width: 0;
}

.folder-workbench .panel-title-row p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.folder-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(240px, 1.15fr) minmax(220px, 1fr) 130px auto;
  gap: 14px;
  align-items: end;
}

.folder-form .field-block select,
.folder-form .field-block input {
  height: 48px;
  border-radius: 14px;
}

.folder-form > button {
  min-height: 48px;
  white-space: nowrap;
}

.folder-admin-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.folder-admin-row {
  display: flex;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  background: #f8fbff;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.folder-admin-row > div:first-child {
  min-width: 0;
}

.folder-admin-row strong,
.folder-admin-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-admin-row strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 850;
}

.folder-admin-row small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.folder-admin-row .actions {
  flex: 0 0 auto;
}

.folder-admin-row .small-btn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 12px;
}

.empty-panel {
  padding: 22px 14px;
  border: 1px dashed #bfdbfe;
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}
.upload-workbench {
  margin-bottom: 18px;
  padding: 24px;
}

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

.upload-head p {
  max-width: 760px;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.65;
}

.upload-rule {
  display: inline-flex;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--green-soft);
  color: #166534;
  align-items: center;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 850;
}

.upload-form {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(320px, 1fr) minmax(260px, 360px);
  gap: 16px;
  align-items: stretch;
}

.field-block {
  display: grid;
  gap: 9px;
  align-content: start;
  color: var(--ink);
  font-size: 14px;
  font-weight: 850;
}

.field-block select {
  height: 58px;
  border-radius: 18px;
}

.upload-drop {
  position: relative;
  display: flex;
  min-height: 116px;
  padding: 22px 24px;
  border: 2px dashed #93c5fd;
  border-radius: 22px;
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
  box-sizing: border-box;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
}

.upload-drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-drop-title {
  color: var(--primary-dark);
  font-size: 18px;
  font-weight: 950;
}

.upload-drop-desc {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.upload-inspector {
  min-height: 116px;
}

.inspector-empty,
.inspector-card {
  display: flex;
  min-height: 116px;
  padding: 18px;
  border: 1px solid #dbeafe;
  border-radius: 22px;
  background: #ffffff;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  text-align: center;
}

.inspector-card {
  justify-content: space-between;
  gap: 14px;
  text-align: left;
}

.inspector-card strong,
.inspector-card small,
.inspector-card span {
  display: block;
}

.inspector-card strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.inspector-card small {
  margin-top: 7px;
  color: var(--muted);
}

.inspector-card > span {
  flex: 0 0 auto;
  padding: 8px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.inspector-card.ready > span {
  background: var(--green-soft);
  color: #166534;
}

.inspector-card.duplicate > span {
  background: #fef3c7;
  color: #92400e;
}

.upload-submit {
  grid-column: 1 / -1;
  min-height: 52px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #ffffff;
  font-weight: 950;
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.18);
}

.upload-note-panel h2 {
  margin-bottom: 14px;
}

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

.rule-list div {
  padding: 14px;
  border: 1px solid #dbeafe;
  border-radius: 18px;
  background: #ffffff;
}

.rule-list strong,
.rule-list span {
  display: block;
}

.rule-list strong {
  color: var(--primary-dark);
  font-size: 14px;
}

.rule-list span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 1080px) {
  .upload-form { grid-template-columns: 1fr; }
  .upload-head { flex-direction: column; }
  .upload-rule { white-space: normal; }
  .folder-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .folder-form > button { grid-column: 1 / -1; }
}
.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-title-row h2 { margin-bottom: 0; }
.panel-title-row span { color: var(--muted); font-size: 13px; font-weight: 800; }

.category-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
}

.editable-card {
  align-items: flex-start;
}

.category-actions {
  flex: 0 0 auto;
}

.sub-edit-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.sub-row {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  background: #f8fafc;
}

.sub-row > span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 850;
}

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

.sub-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid #dbeafe;
  border-radius: 18px;
  background: #f8fafc;
}

.filter-bar label {
  display: grid;
  min-width: 180px;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.filter-bar.compact {
  justify-content: flex-end;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

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

.empty-panel {
  padding: 32px;
  border: 1px dashed #bfdbfe;
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.modal-mask {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.46);
}

.modal-mask[hidden] {
  display: none;
}

.modal-card {
  width: min(560px, 100%);
  padding: 22px;
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.24);
}

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

.modal-header h2 { margin-bottom: 6px; }
.modal-header p { color: var(--muted); font-size: 13px; line-height: 1.5; }

.modal-close {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: #eff6ff;
  color: var(--primary-dark);
  font-size: 24px;
  line-height: 1;
}

.modal-card .field-block {
  margin-bottom: 13px;
}

.modal-card .field-block input,
.modal-card .field-block select {
  height: 44px;
}

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

@media (max-width: 760px) {
  .sub-edit-list { grid-template-columns: 1fr; }
  .filter-bar label { min-width: 100%; }
  .pager { justify-content: center; flex-wrap: wrap; }
}
/* 分类编辑弹窗：隐藏字段必须优先于通用 field-block 样式 */
[hidden],
.field-block[hidden] {
  display: none !important;
}

/* 文件管理：大分类/小分类选择框按内容紧凑展示 */
.upload-form {
  grid-template-columns: max-content max-content minmax(320px, 1fr) minmax(260px, 360px);
}

.upload-form .field-block,
.filter-bar label {
  min-width: 0;
  width: max-content;
}

.upload-form .field-block select,
.filter-bar select,
#fileCategorySelect,
#fileSubcategorySelect,
#uploadCategorySelect,
#uploadSubcategorySelect,
#fileFilterCategory,
#fileFilterSubcategory {
  width: auto;
  min-width: 9em;
  max-width: 16em;
  padding-right: 30px;
}

#filePageSize,
#memberPageSize,
#vipOrderPageSize {
  min-width: 6em;
}

@media (max-width: 1080px) {
  .upload-form .field-block,
  .filter-bar label {
    width: 100%;
  }

  .upload-form .field-block select,
  .filter-bar select,
  #fileCategorySelect,
  #fileSubcategorySelect,
  #uploadCategorySelect,
  #uploadSubcategorySelect,
  #fileFilterCategory,
  #fileFilterSubcategory {
    width: 100%;
    max-width: none;
  }
}
body.modal-open {
  overflow: hidden;
}

.file-preview-mask {
  padding: 20px;
}

.file-preview-modal {
  display: flex;
  width: min(1180px, 96vw);
  height: min(900px, 92vh);
  overflow: hidden;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 28px 72px rgba(15, 23, 42, 0.28);
  flex-direction: column;
}

.file-preview-header {
  display: flex;
  min-height: 76px;
  padding: 16px 18px;
  border-bottom: 1px solid #dbeafe;
  background: #ffffff;
  box-sizing: border-box;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.file-preview-heading {
  min-width: 0;
}

.file-preview-heading h2 {
  overflow: hidden;
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-preview-heading p {
  overflow: hidden;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-preview-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.file-preview-actions a {
  display: inline-flex;
  min-height: 40px;
  box-sizing: border-box;
  align-items: center;
  text-decoration: none;
}

.file-preview-body {
  min-height: 0;
  background: #eef2f7;
  flex: 1;
}

.file-preview-body iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

@media (max-width: 760px) {
  .file-preview-mask { padding: 8px; }
  .file-preview-modal { width: 100%; height: 96vh; border-radius: 12px; }
  .file-preview-header { align-items: flex-start; }
  .file-preview-actions .small-btn { display: none; }
}
.customer-settings-panel {
  padding: 28px;
}

.customer-settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.customer-settings-head h2 {
  margin-bottom: 8px;
  font-size: 21px;
}

.customer-settings-head p {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.65;
}

.customer-qr-status {
  display: inline-flex;
  min-width: 76px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 850;
}

.customer-qr-status.configured {
  background: var(--green-soft);
  color: #166534;
}

.customer-qr-status.pending {
  background: var(--accent-soft);
  color: #92400e;
}

.customer-settings-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(360px, 1fr);
  gap: 32px;
  padding-top: 28px;
  align-items: start;
}

.customer-qr-preview-column {
  min-width: 0;
}

.customer-qr-frame {
  display: grid;
  width: min(280px, 100%);
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid #bfdbfe;
  border-radius: 18px;
  background: #f8fafc;
  place-items: center;
}

.customer-qr-frame img {
  display: block;
  width: 100%;
  height: 100%;
  padding: 14px;
  background: #ffffff;
  object-fit: contain;
}

.customer-qr-placeholder {
  display: flex;
  padding: 24px;
  color: var(--muted);
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.customer-qr-placeholder-mark {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 18px;
  border: 2px solid #93c5fd;
  border-radius: 14px;
  background: #eff6ff;
  color: var(--primary-dark);
  place-items: center;
  font-size: 17px;
  font-weight: 900;
}

.customer-qr-placeholder strong {
  color: var(--ink);
  font-size: 16px;
}

.customer-qr-placeholder span:last-child {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.customer-qr-updated {
  width: min(280px, 100%);
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

.customer-qr-form {
  display: flex;
  min-width: 0;
  padding-left: 32px;
  border-left: 1px solid var(--line);
  flex-direction: column;
}

.customer-qr-form-title h3 {
  margin: 0;
  font-size: 18px;
}

.customer-qr-form-title p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.customer-qr-upload {
  position: relative;
  display: flex;
  min-height: 146px;
  margin-top: 22px;
  padding: 24px;
  border: 2px dashed #93c5fd;
  border-radius: 18px;
  background: #f8fbff;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease;
}

.customer-qr-upload:hover,
.customer-qr-upload:focus-within {
  border-color: var(--primary);
  background: #eff6ff;
}

.customer-qr-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.customer-qr-upload-title {
  color: var(--primary-dark);
  font-size: 17px;
  font-weight: 900;
}

.customer-qr-upload-desc {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.customer-qr-selected {
  min-height: 42px;
  margin-top: 14px;
  padding: 11px 14px;
  overflow: hidden;
  border-radius: 12px;
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-qr-error {
  min-height: 22px;
  margin-top: 8px;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.5;
}

#customerQrSubmit {
  width: fit-content;
  min-width: 150px;
  min-height: 44px;
  margin-top: 8px;
}

#customerQrSubmit:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
  box-shadow: none;
}

@media (max-width: 900px) {
  .customer-settings-layout {
    grid-template-columns: 1fr;
  }

  .customer-qr-frame,
  .customer-qr-updated {
    margin-right: auto;
    margin-left: auto;
  }

  .customer-qr-form {
    padding-top: 24px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 560px) {
  .customer-settings-panel { padding: 20px; }
  .customer-settings-head { flex-direction: column; gap: 14px; }
  .customer-settings-layout { gap: 24px; padding-top: 22px; }
}
/* Admin authentication */
body.login-active {
  overflow: hidden;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-columns: minmax(320px, 0.78fr) minmax(460px, 1.22fr);
  background: #f8fafc;
}

.login-screen[hidden] {
  display: none;
}

.login-brand-panel {
  display: flex;
  min-height: 100%;
  padding: 48px;
  background: #0f172a;
  color: #ffffff;
  flex-direction: column;
  justify-content: space-between;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  font-weight: 800;
}

.login-brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #2563eb;
  place-items: center;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.28);
}

.login-brand-copy {
  max-width: 440px;
  padding: 72px 0;
}

.login-brand-copy p,
.login-card-header p {
  margin: 0 0 12px;
  color: #93c5fd;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.login-brand-copy h1 {
  margin: 0;
  color: #ffffff;
  font-size: 40px;
  line-height: 1.2;
}

.login-brand-copy strong {
  display: block;
  margin-top: 14px;
  color: #cbd5e1;
  font-size: 18px;
  line-height: 1.5;
}

.login-brand-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 700;
}

.login-brand-status span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}

.login-form-area {
  display: grid;
  min-width: 0;
  padding: 48px;
  place-items: center;
}

.login-card {
  width: min(420px, 100%);
  padding: 36px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.10);
}

.login-card-header {
  margin-bottom: 30px;
}

.login-card-header p {
  color: #2563eb;
}

.login-card-header h2 {
  margin: 0;
  color: #0f172a;
  font-size: 28px;
  line-height: 1.25;
}

.login-field {
  margin-top: 20px;
}

.login-field > label {
  display: block;
  margin-bottom: 8px;
  color: #334155;
  font-size: 14px;
  font-weight: 800;
}

.login-field input {
  width: 100%;
  height: 48px;
  border-color: #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #0f172a;
  font-size: 16px;
}

.login-password-control {
  position: relative;
}

.login-password-control input {
  padding-right: 82px;
}

.login-password-control button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 70px;
  height: 40px;
  border-radius: 5px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 800;
}

.login-remember {
  display: inline-flex;
  min-height: 44px;
  margin-top: 12px;
  color: #475569;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.login-remember input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #2563eb;
}

.login-error {
  min-height: 22px;
  margin-top: 4px;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.login-submit {
  display: inline-flex;
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
  border-radius: 6px;
  background: #2563eb;
  color: #ffffff;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.20);
  font-weight: 800;
}

.login-submit-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: login-spin 700ms linear infinite;
}

.login-submit.is-busy .login-submit-spinner {
  display: block;
}

.login-session-note {
  margin-top: 16px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

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

.admin-identity {
  display: flex;
  min-height: 44px;
  padding: 4px 10px 4px 5px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #ffffff;
  align-items: center;
  gap: 9px;
}

.admin-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: #eff6ff;
  color: #1d4ed8;
  place-items: center;
  font-size: 13px;
  font-weight: 900;
}

.admin-identity strong,
.admin-identity small {
  display: block;
  line-height: 1.25;
}

.admin-identity strong {
  color: #0f172a;
  font-size: 13px;
}

.admin-identity small {
  margin-top: 3px;
  color: #64748b;
  font-size: 11px;
}

.logout-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
}

.logout-button:hover {
  border-color: #fecaca;
  background: #fff7f7;
  color: #b91c1c;
}

@keyframes login-spin {
  to { transform: rotate(360deg); }
}

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

  .login-brand-panel {
    min-height: 190px;
    padding: 28px;
  }

  .login-brand-copy {
    padding: 28px 0 18px;
  }

  .login-brand-copy h1 {
    font-size: 30px;
  }

  .login-brand-copy strong {
    margin-top: 8px;
    font-size: 16px;
  }

  .login-form-area {
    padding: 32px 24px;
    align-items: start;
  }
}

@media (max-width: 640px) {
  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .admin-identity {
    order: -1;
    margin-right: auto;
  }
}

@media (max-width: 480px) {
  .login-brand-panel {
    min-height: 170px;
    padding: 22px;
  }

  .login-brand-copy {
    padding: 20px 0 10px;
  }

  .login-brand-status {
    display: none;
  }

  .login-form-area {
    padding: 24px 16px;
  }

  .login-card {
    padding: 26px 22px;
  }
}

@media (max-width: 640px) {
  .folder-form {
    grid-template-columns: 1fr;
  }

  .folder-form > button {
    grid-column: auto;
  }

  .folder-admin-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .folder-admin-row .actions {
    width: 100%;
  }
}
.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.category-forms-grid {
  align-items: stretch;
}

.category-forms-grid .form {
  min-width: 0;
}

.category-folder-form .field-block {
  min-width: 0;
}

.folder-list-panel {
  margin-bottom: 18px;
}

.folder-list-panel .panel-title-row p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.upload-workbench {
  overflow-x: auto;
}

.upload-form {
  min-width: 1030px;
  grid-template-columns: minmax(150px, 0.8fr) minmax(170px, 0.9fr) minmax(170px, 0.9fr) minmax(240px, 1.3fr) minmax(270px, 1.4fr);
  gap: 12px;
}

.upload-form .field-block select {
  min-width: 0;
  height: 58px;
  border-radius: 18px;
}

.upload-drop,
.upload-inspector {
  min-width: 0;
  height: 116px;
  min-height: 116px;
}

.upload-drop {
  padding: 18px;
}

.upload-drop-title {
  font-size: 16px;
}

.upload-drop-desc {
  font-size: 12px;
}

.upload-inspector .inspector-empty,
.upload-inspector .inspector-card {
  min-height: 116px;
  padding: 14px;
}

.filter-bar label {
  min-width: 160px;
}

@media (max-width: 1180px) {
  .grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .grid.three {
    grid-template-columns: 1fr;
  }

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

  .upload-form {
    grid-template-columns: minmax(150px, 0.8fr) minmax(170px, 0.9fr) minmax(170px, 0.9fr) minmax(240px, 1.3fr) minmax(270px, 1.4fr);
  }
}

@media (max-width: 640px) {
  .category-forms-grid .form {
    grid-template-columns: 1fr;
  }

  .filter-bar label {
    min-width: 100%;
  }
}

/* upload workbench responsive sizing */
.upload-workbench {
  width: 100%;
  overflow-x: auto;
  box-sizing: border-box;
}

.upload-form {
  width: 100%;
  min-width: 0;
  grid-template-columns:
    minmax(130px, 0.72fr)
    minmax(190px, 1fr)
    minmax(190px, 1fr)
    minmax(240px, 1.18fr)
    minmax(260px, 1.28fr);
  gap: 8px;
}

.upload-form .field-block {
  width: auto;
  min-width: 0;
}

.upload-form .field-block select,
#uploadCategorySelect,
#uploadSubcategorySelect,
#uploadFolderSelect {
  width: 100%;
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
}

.upload-drop,
.upload-inspector {
  width: 100%;
  min-width: 0;
}

@media (max-width: 980px) {
  .upload-form {
    min-width: 1030px;
  }
}
