:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --blue: #4267ff;
  --blue-soft: #eef2ff;
  --orange: #ff6243;
  --orange-dark: #e13f23;
  --red: #ef2f2f;
  --danger: #b42318;
  --shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

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

button,
input,
select {
  font: inherit;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.public-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.public-header p {
  margin-top: 4px;
  color: var(--muted);
}

.public-layout {
  max-width: 1680px;
  margin: 0 auto;
}

.brand {
  display: grid;
  gap: 4px;
  min-width: 260px;
}

h1 {
  font-size: 22px;
  font-weight: 700;
}

h2 {
  font-size: 16px;
  font-weight: 700;
}

.brand p,
.panel-heading span,
.muted {
  color: var(--muted);
}

.header-actions,
.product-toolbar,
.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-field {
  display: inline-grid;
  grid-template-columns: auto minmax(120px, 180px);
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.toolbar-select {
  min-height: 32px;
  border-radius: 6px;
}

.file-input {
  max-width: 200px;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  background: white;
}

button,
.button-link {
  min-height: 34px;
  border: 1px solid var(--orange);
  border-radius: 6px;
  padding: 0 12px;
  background: var(--orange);
  color: white;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

button:hover,
.button-link:hover {
  background: var(--orange-dark);
}

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

button.secondary,
button.ghost {
  background: white;
  color: var(--blue);
  border-color: #c7d2fe;
}

button.secondary:hover,
button.ghost:hover {
  background: var(--blue-soft);
}

button.danger {
  border-color: #fecaca;
  background: white;
  color: var(--danger);
}

button.danger:hover {
  background: #fff1f2;
}

button.favorite {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

button.favorite.active {
  border-color: #f59e0b;
  background: #f59e0b;
  color: white;
}

.layout {
  display: grid;
  gap: 16px;
  padding: 14px 16px 32px;
}

.category-shell {
  background: var(--surface);
  border-radius: 4px;
  box-shadow: var(--shadow);
  padding: 12px 16px;
}

.category-tabs {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.brand-tabs {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.brand-tabs-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.category-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: max-content;
  height: 40px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 0 14px;
  background: #f8fafc;
  color: #111827;
  font-size: 16px;
  font-weight: 700;
}

.category-tab:hover {
  border-color: #fecaca;
  background: #fffafa;
}

.category-tab.active {
  border: 1px solid var(--red);
  background: var(--orange);
  color: white;
}

.category-name {
  line-height: 1;
  text-align: center;
}

.category-tab.active:hover {
  background: var(--orange-dark);
  color: white;
}

.notice {
  display: flex;
  align-items: center;
  justify-self: center;
  gap: 10px;
  max-width: 760px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--surface);
  color: #4b5563;
}

.notice-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

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

.module-launcher {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.module-launch-card {
  display: grid;
  gap: 6px;
  min-height: 92px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
}

.module-launch-card strong {
  font-size: 16px;
}

.module-launch-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.module-launch-card:hover {
  border-color: #c7d2fe;
  background: #fbfdff;
}

.collapsible-panel {
  display: grid;
  padding: 0;
}

.collapsible-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.collapsible-panel > summary::-webkit-details-marker {
  display: none;
}

.collapsible-panel > summary > div {
  display: grid;
  gap: 4px;
}

.collapsible-panel > summary strong {
  font-size: 16px;
}

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

.collapsible-panel > summary::after {
  content: "▾";
  color: var(--muted);
  font-size: 16px;
  transition: transform 0.18s ease;
}

.collapsible-panel:not([open]) > summary::after {
  transform: rotate(-90deg);
}

.collapsible-body {
  border-top: 1px solid var(--border);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.panel-heading,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.section-heading {
  padding-left: 0;
  padding-right: 0;
  border-bottom: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr 0.75fr 0.6fr 0.6fr auto;
  align-items: end;
  gap: 12px;
  padding: 14px 16px 16px;
}

.collect-grid {
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 0.9fr) minmax(130px, 0.8fr) minmax(110px, 0.6fr) 80px auto auto;
}

.public-product-form {
  grid-template-columns: minmax(260px, 1.5fr) minmax(160px, 0.8fr) minmax(120px, 0.6fr) minmax(120px, 0.6fr) minmax(120px, 0.6fr) auto;
}

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

.span-3 {
  grid-column: span 3;
}

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

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

textarea {
  min-height: 74px;
  padding: 8px 10px;
  resize: vertical;
}

.whitelist-field {
  align-self: start;
  gap: 8px;
}

.whitelist-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.whitelist-toolbar-left {
  display: grid;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
}

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

.whitelist-search {
  width: min(100%, 260px);
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

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

.whitelist-action {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.whitelist-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fafafa;
  max-height: 180px;
  overflow: auto;
}

.whitelist-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #dbe3ee;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  cursor: pointer;
  user-select: none;
}

.whitelist-chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.whitelist-chip.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.whitelist-chip span {
  font-size: 12px;
}

.whitelist-empty {
  color: var(--muted);
  font-size: 12px;
  padding: 2px 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 12px;
  padding: 14px 16px 16px;
}

.products-section {
  min-width: 0;
}

.store-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0 14px;
  overflow-x: auto;
}

.view-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0 14px;
}

.store-filter {
  min-width: 96px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: #f0f0f0;
  color: #374151;
}

.store-filter.active {
  border: 1px solid var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.resolve-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  background: #fff7ed;
}

.resolve-heading {
  display: grid;
  gap: 4px;
}

.resolve-heading span,
.resolve-candidate small,
.resolve-candidate span {
  color: var(--muted);
}

.resolve-candidate {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid #ffedd5;
  border-radius: 6px;
  background: #ffffff;
}

.resolve-candidate img,
.resolve-image-empty {
  width: 64px;
  height: 64px;
  border-radius: 4px;
  object-fit: cover;
  background: #f3f4f6;
}

.resolve-candidate div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.resolve-candidate strong,
.resolve-candidate span,
.resolve-candidate small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
}

.product-card {
  position: relative;
  min-width: 0;
  background: var(--surface);
  border: 1px solid #edf0f5;
  border-radius: 4px;
  overflow: visible;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

.rank-badge {
  position: absolute;
  z-index: 2;
  top: -1px;
  left: 10px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 52px;
  background: linear-gradient(180deg, #ff513f, #ff8b62);
  color: white;
  border-radius: 0 0 9px 9px;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.rank-badge span {
  font-size: 11px;
  font-weight: 700;
}

.image-wrap {
  aspect-ratio: 1 / 1;
  background: #f8fafc;
  overflow: hidden;
  border-radius: 4px 4px 0 0;
  position: relative;
}

.product-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.product-image.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.source-overlay {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 5px 8px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  font-size: 12px;
  opacity: 1;
  transform: none;
  transition: none;
  pointer-events: none;
}

.image-wrap:hover .source-overlay {
  opacity: 1;
  transform: none;
}

.shop-summary {
  display: grid;
  gap: 8px;
  margin: 10px 0 12px;
}

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

.shop-summary-text {
  width: 100%;
  min-height: 72px;
  max-height: 132px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  line-height: 20px;
  resize: vertical;
}

.shop-summary-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.shop-summary-item {
  max-width: 220px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.shop-summary-item.active,
.shop-summary-item:hover {
  border-color: #2563eb;
  background: #eff6ff;
}

.card-body {
  display: grid;
  gap: 8px;
  padding: 10px 12px 12px;
}

.card-body h3 {
  height: 40px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 500;
  line-height: 20px;
}

.shop-line {
  height: 18px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sales-strip {
  display: grid;
  place-items: center;
  height: 38px;
  border-radius: 5px;
  background: #f2f5ff;
  color: #111827;
  font-size: 14px;
}

.public-sales-hot {
  color: var(--red);
  font-weight: 800;
}

.public-metric-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.public-card-actions {
  margin-top: auto;
}

.public-card-settings {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}

.public-alert-panel {
  margin-bottom: 20px;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  text-align: center;
}

.metric-row strong {
  display: block;
  overflow: hidden;
  color: var(--blue);
  font-size: 17px;
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.metric-row strong.subsidy-price {
  color: var(--red);
}

.metric-row span {
  display: block;
  color: #7c8491;
  font-size: 12px;
}

.sub-row,
.alert-row,
.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: #7c8491;
  font-size: 12px;
  white-space: nowrap;
}

.coupon {
  color: var(--red);
}

.coupon-detail {
  min-height: 18px;
  overflow: hidden;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.subsidy-note {
  height: 16px;
  overflow: hidden;
  color: #9ca3af;
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.meta-row {
  overflow: hidden;
  border-top: 1px dashed var(--border);
  padding-top: 7px;
}

.status {
  border-radius: 999px;
  padding: 1px 6px;
  background: #eef2ff;
  color: var(--blue);
}

.status.warn {
  background: #fff7ed;
  color: #c2410c;
}

.status.off {
  background: #f3f4f6;
  color: var(--muted);
}

.item-error {
  max-height: 34px;
  overflow: hidden;
  color: var(--danger);
  font-size: 12px;
  line-height: 17px;
}

.card-settings {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: 6px;
}

.card-settings label {
  gap: 4px;
  min-width: 0;
  font-size: 11px;
}

.card-settings .wide-setting {
  grid-column: 1 / -1;
}

.card-settings input {
  min-height: 30px;
  padding: 0 7px;
  font-size: 12px;
}

.card-settings button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.open-link {
  margin-right: auto;
  color: var(--blue);
  text-decoration: none;
}

.open-link.secondary-link {
  margin-right: 0;
  color: #0f766e;
}

.qr-hover {
  position: relative;
  display: inline-flex;
}

.qr-popover {
  position: absolute;
  z-index: 12;
  left: 50%;
  bottom: calc(100% + 8px);
  display: none;
  width: 244px;
  transform: translateX(-50%);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: white;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.2);
  text-align: center;
}

.qr-hover:hover .qr-popover,
.qr-hover:focus-within .qr-popover {
  display: grid;
  gap: 6px;
}

.qr-popover img {
  width: 220px;
  height: 220px;
  display: block;
}

.qr-popover small {
  color: var(--muted);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

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

.item-id {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.alerts {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  max-height: 360px;
  overflow: auto;
}

.alert {
  border-left: 3px solid var(--blue);
  padding: 8px 10px;
  background: #f8fafc;
}

.alert.price {
  border-left-color: var(--red);
}

.alert.coupon {
  border-left-color: #f59e0b;
}

.alert small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 40px));
  padding: 10px 12px;
  border-radius: 8px;
  background: #111827;
  color: white;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.24);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg);
}

.login-shell {
  width: min(100%, 420px);
}

.login-card {
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-heading {
  display: grid;
  gap: 8px;
}

.login-heading p,
.login-error {
  color: var(--muted);
}

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

.login-error {
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fef2f2;
  color: #991b1b;
}

.user-management-panel {
  display: grid;
  gap: 0;
}

.user-management-panel > .panel-heading {
  grid-column: 1 / -1;
}

.user-create-form {
  display: grid;
  gap: 12px;
  padding: 16px;
  align-content: start;
}

.permission-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 310px;
  overflow: auto;
  padding-right: 4px;
}

.permission-option {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fafafa;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}

.permission-option input {
  width: auto;
  min-height: auto;
}

.users-list {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}

.user-row {
  display: grid;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.user-list-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 2px;
}

.user-list-head strong {
  display: block;
  font-size: 16px;
}

.user-list-head span,
.user-list-count {
  color: var(--muted);
  font-size: 12px;
}

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

.user-table-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.9fr) 110px minmax(240px, 1.6fr) 150px minmax(220px, 1fr);
  gap: 12px;
  align-items: start;
}

.user-table-header {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.user-table-cell {
  min-width: 0;
}

.user-account-cell strong {
  display: block;
}

.user-account-cell small,
.user-time-cell {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.user-permissions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 140px;
  overflow: auto;
  padding-right: 4px;
}

.user-actions-cell {
  display: grid;
  gap: 8px;
}

.user-action-buttons,
.user-row-heading,
.user-row-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.user-row-heading {
  grid-column: 1 / -1;
}

.user-row-actions input {
  width: min(240px, 100%);
  min-height: 30px;
}

.user-enabled {
  display: inline-flex;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 5px;
}

.user-enabled input {
  width: auto;
  min-height: auto;
}

.user-empty {
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #fff;
}

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

.modal[hidden] {
  display: none;
}

.modal-card {
  width: min(340px, calc(100vw - 32px));
  display: grid;
  gap: 14px;
  justify-items: center;
  border-radius: 8px;
  background: white;
  padding: 16px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.28);
}

.modal-heading {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.qr-image {
  width: 240px;
  height: 240px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.mobile-add-page {
  min-height: 100vh;
  background: #f4f5f7;
}

.mobile-shell {
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 18px 14px 32px;
}

.mobile-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.mobile-heading {
  display: grid;
  gap: 8px;
  padding: 22px 18px 18px;
  border-bottom: 1px solid var(--border);
}

.mobile-heading h1 {
  font-size: 24px;
}

.mobile-heading p {
  color: var(--muted);
  line-height: 1.6;
}

.mobile-kicker {
  color: var(--orange-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.mobile-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.mobile-form label {
  gap: 7px;
}

.mobile-form textarea {
  min-height: 132px;
}

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

.mobile-submit {
  width: 100%;
  min-height: 46px;
  justify-content: center;
  margin-top: 4px;
  font-size: 16px;
  font-weight: 700;
}

.mobile-clipboard-btn {
  justify-content: center;
  border-color: #c7d2fe;
  background: white;
  color: var(--blue);
}

.mobile-clipboard-btn:hover {
  background: var(--blue-soft);
}

.mobile-result {
  margin: 0 18px 18px;
  padding: 12px 14px;
  border-radius: 6px;
  line-height: 1.6;
}

.mobile-result.success {
  color: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.mobile-result.warning {
  color: #9a3412;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.mobile-result.error {
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.mobile-result.loading {
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.mobile-candidates {
  display: grid;
  gap: 10px;
  padding: 0 18px 18px;
}

.mobile-candidates-heading {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 6px;
  background: #fff7ed;
}

.mobile-candidates-heading span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.mobile-candidate {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.mobile-candidate img,
.mobile-candidate-image {
  width: 58px;
  height: 58px;
  border-radius: 4px;
  object-fit: cover;
  background: #f3f4f6;
}

.mobile-candidate-body {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.mobile-candidate-body strong,
.mobile-candidate-body span,
.mobile-candidate-body small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-candidate-body span,
.mobile-candidate-body small {
  color: var(--muted);
}

.mobile-candidate button {
  padding: 0 9px;
}

.mobile-clipboard-sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  align-items: end;
  padding: 14px;
  background: rgba(15, 23, 42, 0.38);
  pointer-events: auto;
}

.mobile-clipboard-sheet[hidden] {
  display: none !important;
}

.mobile-clipboard-dialog {
  display: grid;
  gap: 12px;
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 18px;
  border-radius: 12px;
  background: white;
  box-shadow: 0 22px 52px rgba(15, 23, 42, 0.28);
  pointer-events: auto;
}

.mobile-clipboard-dialog strong {
  font-size: 18px;
}

.mobile-clipboard-status {
  padding: 10px 12px;
  border-radius: 6px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  line-height: 1.5;
}

.mobile-clipboard-dialog p {
  color: var(--muted);
  line-height: 1.6;
}

.mobile-clipboard-preview {
  max-height: 120px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  color: #374151;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-all;
}

.mobile-clipboard-actions {
  display: grid;
  grid-template-columns: 1fr 0.8fr;
  gap: 10px;
}

.mobile-clipboard-actions button {
  justify-content: center;
  min-height: 44px;
  touch-action: manipulation;
}

@media (max-width: 1180px) {
  .tool-grid,
  .split {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 900px) {
  .app-header,
  .public-header {
    display: grid;
  }

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

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

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

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

  .user-management-panel {
    grid-template-columns: 1fr;
  }

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

  .permission-options {
    grid-template-columns: 1fr;
    max-height: none;
  }

  .category-tabs {
    gap: 10px;
  }

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

  .whitelist-search {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .layout,
  .app-header,
  .public-header {
    padding-left: 12px;
    padding-right: 12px;
  }

  .category-tabs {
    gap: 8px;
  }

  .category-tab {
    height: 36px;
    padding: 0 12px;
    font-size: 15px;
  }

  .notice {
    border-radius: 8px;
    align-items: flex-start;
  }

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

  .section-heading,
  .product-toolbar {
    align-items: flex-start;
  }

  .section-heading {
    display: grid;
  }

  .toolbar-field {
    grid-template-columns: auto minmax(120px, 1fr);
  }

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

  .module-launcher {
    grid-template-columns: 1fr;
  }

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

  .user-table-header {
    display: none;
  }

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

  th,
  td {
    padding: 10px;
  }
}

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