:root {
  color-scheme: light;
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-soft: #f1f5f9;
  --panel-hover: #f8fafc;
  --text: #0f172a;
  --text-secondary: #475569;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-glow: rgba(37, 99, 235, 0.15);
  --accent: #f59e0b;
  --accent-strong: #d97706;
  --ok: #10b981;
  --ok-soft: #ecfdf5;
  --warn: #f59e0b;
  --warn-soft: #fffbeb;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.select-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
}

.select-wrapper select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  padding: 6px 32px 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
}

.select-wrapper select::-ms-expand {
  display: none;
}

.select-wrapper .select-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%) rotate(0deg);
  pointer-events: none; /* 点击箭头穿透到 select */
  color: #666;
  transition: transform 0.25s ease;
}

/* 旋转状态（由 JS 控制） */
.select-wrapper.arrow-rotated .select-arrow {
  transform: translateY(-50%) rotate(180deg);
}

/* 现代药丸导航切换器 */
.view-switch {
  display: inline-flex;
  align-items: center;
  background: #e2e8f0;
  padding: 3px;
  border-radius: 999px;
  gap: 2px;
}

.view-switch button {
  border: none !important;
  background: transparent !important;
  color: var(--muted) !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  padding: 6px 16px !important;
  border-radius: 999px !important;
  min-height: 32px !important;
  box-shadow: none !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.view-switch button:hover:not(.is-active) {
  color: var(--text) !important;
}

.view-switch button.is-active {
  background: #ffffff !important;
  color: var(--primary) !important;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08) !important;
}

/* 按钮现代风格 */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 8px 14px;
}

button.primary {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #fff;
  border: none;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

button.primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

button.primary:active:not(:disabled) {
  transform: translateY(0);
}

button.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

button.ghost {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

button.ghost:hover:not(:disabled) {
  background: var(--panel-soft);
  border-color: var(--line-strong);
  color: var(--primary);
}

/* 状态指标网格现代卡片 */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.status-grid .metric {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-grid .metric:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(59, 130, 246, 0.25);
}

.status-grid .metric span {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.status-grid .metric strong {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

/* 面板面板现代风格 */
.panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
  margin-bottom: 16px;
  transition: border-color 0.2s ease;
}

details.panel summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  padding: 2px 0;
}

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

details.panel summary strong {
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
}

details.panel summary small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* 输入控件现代风格 */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="time"],
select,
textarea {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text);
  transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 0 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border-color, #e5e7eb);
  margin-top: 12px;
}

/* 页码按钮 */
.shop-pagination .page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-secondary, #6b7280);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.shop-pagination .page-btn:hover:not(:disabled) {
  /* background: var(--bg-hover, #f3f4f6); */
  border-color: var(--border-color, #d1d5db);
}

.shop-pagination .page-btn.is-active {
  background: var(--primary-color, #3b82f6);
  color: #fff;
  border-color: var(--primary-color, #3b82f6);
}

.shop-pagination .page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 页码省略号 */
.shop-pagination .page-ellipsis {
  padding: 0 4px;
  color: var(--text-secondary, #9ca3af);
  font-size: 14px;
  user-select: none;
}

/* 页数信息 */
.shop-pagination .page-info {
  margin-left: 8px;
  font-size: 13px;
  color: var(--text-secondary, #6b7280);
  user-select: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.icon-sprite {
  display: none;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 100vh;
  padding: 24px 0 48px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.brand-mark img {
  width: 44px;
  height: 44px;
  padding: 4px;
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}

h2 {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.2px;
}

.actions,
.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.view-switch {
  display: inline-flex;
  align-items: center;
  justify-self: center;
  gap: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #eaf2f8;
}

.view-switch button {
  min-width: 82px;
  min-height: 36px;
  border: 0;
  border-radius: 7px;
  padding: 0 18px;
  background: transparent;
  font-weight: 650;
}

.view-switch button.is-active {
  color: #fff;
  background: var(--primary);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: var(--panel);
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
  background: var(--primary-soft);
}

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

button.is-loading {
  opacity: 0.82;
}

button.is-loading svg {
  display: none;
}

button.is-loading::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.primary {
  background: var(--primary);
  color: #fff;
}

.primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
  color: #fff;
}

.accent {
  background: var(--accent);
  color: #102033;
}

.accent:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #102033;
}

.ghost {
  border-color: var(--line);
  background: var(--panel);
}

.ghost.is-active {
  border-color: var(--primary);
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.status-grid,
.app-layout {
  display: grid;
  gap: 14px;
}

.status-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}

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

.metric {
  min-height: 82px;
  padding: 14px;
  position: relative;
  overflow: hidden;
}

.metric span,
label span,
.panel-head p {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 2px;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.app-layout {
  grid-template-columns: minmax(420px, 0.9fr) minmax(360px, 1.1fr);
  align-items: start;
}

.view-panel {
  display: block;
}

.config-column,
.side-column {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.side-column {
  position: sticky;
  top: 16px;
  align-self: start;
}

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

details.panel {
  padding: 0;
}

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

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

details.panel > summary ~ * {
  margin: 0 16px 16px;
}

summary strong {
  display: block;
  font-size: 16px;
}

summary small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.disclosure {
  position: relative;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.disclosure::before,
.disclosure::after {
  content: "";
  position: absolute;
  top: 13px;
  left: 8px;
  width: 12px;
  height: 2px;
  border-radius: 2px;
  background: var(--primary);
  transition: transform 160ms ease;
}

.disclosure::after {
  transform: rotate(90deg);
}

details[open] .disclosure::after {
  transform: rotate(0deg);
}

details.panel[open] > summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.panel-head {
  justify-content: space-between;
  margin-bottom: 16px;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  background: #fff;
  outline: none;
  min-width: 0;
}

textarea {
  min-height: 70px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: none;
}

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

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

.form-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px;
}

.form-grid.compact {
  margin-top: 12px;
}

.task-group {
  display: grid;
  gap: 12px;
}

.task-group + .task-group {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.task-switch {
  background: #fff;
}

.push-error-only {
  align-self: end;
}

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

.push-channel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.push-channel-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.push-channel-toggle {
  margin: 0;
  background: #fff;
}

.push-channel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.push-channel-fields {
  margin-top: 0;
}

.task-group.is-disabled .chips,
.task-group.is-disabled .compact {
  opacity: 0.48;
}

.task-group.is-disabled .chip,
.task-group.is-disabled .compact .check-row {
  color: var(--muted);
  background: #f7fafc;
}

.task-group.is-disabled .chip,
.task-group.is-disabled .chip input,
.task-group.is-disabled .compact .check-row,
.task-group.is-disabled .compact input {
  cursor: not-allowed;
}

.section-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-top: -4px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.check-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--primary);
}

.check-row span {
  color: var(--text);
}

.check-row.disabled {
  color: var(--muted);
  background: #f7fafc;
  cursor: help;
}

.check-row.disabled span {
  color: var(--muted);
}

.check-row.disabled input {
  cursor: not-allowed;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

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

.chip input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--primary);
}

.chip.disabled {
  color: var(--muted);
  background: #f7fafc;
  border-style: dashed;
  cursor: help;
}

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

.chip.disabled input {
  cursor: not-allowed;
}

.account-row {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  min-width: 0;
}

.account-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

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

.account-row + .account-row {
  margin-top: 10px;
}

.account-title {
  min-width: 0;
}

.account-title strong,
.account-title small {
  display: flex;
  align-items: center;
  gap: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-title small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  padding-left: 17px;
}

.account-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inline-name-input {
  width: min(360px, 100%);
  min-height: 32px;
  padding: 5px 8px;
  font-weight: 600;
}

.status-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #c3cbd1;
}

.status-dot.ok {
  background: var(--ok);
}

.account-cloud {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.account-subhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.account-subhead strong {
  font-size: 14px;
}

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

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

.cloud-token-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.cloud-token-row span {
  color: var(--text);
  font-size: 13px;
}

.cloud-token-row.disabled span {
  color: var(--muted);
}

.cloud-token-row.disabled input {
  border-style: dashed;
  color: var(--muted);
  background: #f7fafc;
  cursor: help;
}

.account-cloud.is-disabled .cloud-token-list {
  opacity: 0.48;
}

.account-cloud.is-disabled input {
  cursor: not-allowed;
}

.icon-only {
  width: 42px;
  padding: 0;
}

.hidden-field {
  display: none;
}

.is-hidden {
  display: none !important;
}

.account-login-slot {
  display: none;
  grid-column: 1 / -1;
}

.account-login-slot.active {
  display: block;
}

.inline-login {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}

.inline-login img {
  width: 150px;
  height: 150px;
  image-rendering: pixelated;
}

.qr-refresh-btn {
  position: relative;
  border: none;
  padding: 0;
  background: none;
  cursor: pointer;
  display: block;
}

.qr-refresh-btn img {
  width: 150px;
  height: 150px;
  image-rendering: pixelated;
  display: block;
}

.qr-refresh-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s;
}

.qr-refresh-btn:hover .qr-refresh-hint {
  opacity: 1;
}

.qr-refresh-btn.is-refreshing {
  pointer-events: none;
}

.qr-refresh-btn.is-refreshing .qr-loading {
  position: absolute;
  inset: 0;
  margin: auto;
}

.qr-refresh-btn.is-refreshing .qr-refresh-hint {
  opacity: 1;
}

.inline-login.pending {
  grid-template-columns: 48px minmax(0, 1fr);
}

.qr-loading {
  width: 42px;
  height: 42px;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.inline-login p {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.login-method-panel,
.captcha-login-panel {
  grid-template-columns: minmax(0, 1fr);
}

.login-method-actions,
.captcha-login-actions,
.captcha-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.login-method-actions {
  flex-wrap: wrap;
}

.captcha-login-fields {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.captcha-code-row input {
  flex: 1 1 160px;
  min-width: 0;
}

.captcha-code-row button {
  flex: 0 0 auto;
}

.login-panel-message {
  margin: 0;
  color: var(--muted);
}

.login-panel-message.error {
  color: var(--danger);
}

.empty-state {
  display: grid;
  gap: 4px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-soft);
}

.empty-state strong {
  color: var(--text);
  font-size: 15px;
}

.empty-state span {
  font-size: 13px;
}

.message {
  margin-top: 12px;
  color: var(--muted);
  min-height: 22px;
}

.logs {
  height: min(520px, calc(100vh - 210px));
  min-height: 320px;
  max-height: 560px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1d32;
  color: #dcecff;
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.log-panel {
  display: block;
}

.shop-status {
  margin-bottom: 14px;
}

.shop-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(340px, 0.42fr);
  gap: 14px;
  align-items: start;
}

.shop-main,
.shop-side {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.shop-side {
  position: sticky;
  top: 16px;
}

.shop-head,
.shop-tools {
  align-items: center;
}

.shop-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.shop-tools select {
  width: min(190px, 100%);
}

.shop-goods,
.shop-plans {
  display: grid;
  gap: 10px;
}

.shop-good,
.shop-plan {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.shop-good {
  grid-template-columns: 88px minmax(0, 1fr) auto;
  align-items: center;
}

.shop-good.is-sold-out {
  opacity: 0.72;
}

.shop-good.is-sold-out .shop-good-image img {
  filter: grayscale(1);
}

.shop-good-image {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.shop-good-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.shop-image-fallback {
  color: var(--muted);
  font-size: 13px;
}

.shop-good-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.shop-good-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.shop-good-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-good-title span,
.shop-good-meta span,
.shop-plan-foot span {
  color: var(--muted);
  font-size: 13px;
}

.shop-good-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shop-good-meta span {
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.shop-good-meta span.sold-out {
  border-color: #f0c9cf;
  color: var(--danger);
  background: #fff3f5;
  font-weight: 700;
}

.shop-good-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.shop-plan-head,
.shop-plan-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.shop-plan {
  padding: 0;
  overflow: hidden;
}

.shop-plan-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.shop-plan-summary::-webkit-details-marker {
  display: none;
}

.shop-plan-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.shop-plan-title strong,
.shop-plan-title small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.shop-plan-badges {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.plan-badge {
  min-width: 54px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  text-align: center;
  color: var(--primary-strong);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}

.plan-badge.paused {
  color: var(--muted);
  background: #f7fafc;
}

.plan-badge.running {
  color: #fff;
  background: var(--primary-strong);
  border-color: var(--primary-strong);
  animation: plan-pulse 1.6s ease-in-out infinite;
}

@keyframes plan-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.shop-plan-body {
  display: grid;
  gap: 12px;
  padding: 0 12px 12px;
  border-top: 1px solid var(--line);
}

.shop-plan-body > .shop-plan-head {
  padding-top: 12px;
}

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

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

.readonly-field strong {
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.shop-plan-head .check-row {
  min-width: 0;
  background: #fff;
}

.shop-plan-head .check-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-plan-foot {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.shop-empty {
  min-height: 180px;
}

.shop-loading {
  justify-items: center;
  align-content: center;
  text-align: center;
}

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

.modal-card {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.18);
}

.modal-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.modal-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

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

.geetest-dialog {
  width: min(360px, calc(100vw - 32px));
}

.geetest-box {
  min-height: 260px;
  display: grid;
  place-items: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  max-width: min(520px, calc(100% - 32px));
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--primary);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.toast.show {
  opacity: 1;
}

/* 统一移动端与桌面端响应式规范 (<= 768px) */
@media (max-width: 768px) {
  .shell {
    width: calc(100% - 20px);
    padding: 12px 0 40px;
  }

  .topbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-lg);
  }

  .topbar-row-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .brand-mark img {
    width: 28px;
    height: 28px;
  }

  .brand-copy h1 {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
  }

  .brand-tag {
    font-size: 11px;
    color: var(--muted);
    display: block;
    line-height: 1;
    margin-top: 2px;
  }

  .user-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    font-size: 12px;
  }

  .topbar-row-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
  }

  .view-switch {
    flex: 1;
    display: flex;
    padding: 3px;
    background: #e2e8f0;
    border-radius: 999px;
  }

  .view-switch button {
    flex: 1;
    text-align: center;
    padding: 6px 4px !important;
    font-size: 12px !important;
    min-height: 30px !important;
    white-space: nowrap;
  }

  .actions {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .actions button {
    padding: 6px 12px !important;
    font-size: 12px !important;
    min-height: 30px !important;
    white-space: nowrap;
  }

  .status-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
  }

  .status-grid .metric {
    padding: 12px 14px;
  }

  .status-grid .metric strong {
    font-size: 18px;
  }

  .app-layout,
  .shop-layout,
  .users-layout {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  .side-column,
  .shop-side,
  .users-side {
    position: static;
    max-height: none;
  }

  .logs {
    max-height: 350px;
  }

  .account-row {
    padding: 14px;
    border-radius: var(--radius-md);
  }

  .account-main {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

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

  /* 移动端输入框强制 16px 避免 iOS 变焦放大 */
  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  .modal-card {
    width: 100%;
    border-radius: 20px 20px 0 0;
    margin-top: auto;
    max-height: 85vh;
    overflow-y: auto;
  }
}

/* PC 端规范排版 (>= 769px) */
@media (min-width: 769px) {
  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
  }

  .topbar-row-main {
    display: flex;
    align-items: center;
    gap: 20px;
  }

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

  .brand-tag {
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    display: block;
    margin-top: 1px;
  }

  .topbar-row-nav {
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .view-switch {
    display: inline-flex;
    align-items: center;
    background: #e2e8f0;
    padding: 3px;
    border-radius: 999px;
    gap: 2px;
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

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

/* 现代独立认证居中层 */
.auth-screen {
  position: fixed;
  inset: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 120% at 50% 10%, #e0e7ff 0%, #f1f5f9 55%, #f8fafc 100%);
  padding: 24px 16px;
  z-index: 1000;
  overflow-y: auto;
}

.auth-card {
  width: min(430px, 100%);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 45px -12px rgba(15, 23, 42, 0.1), 0 0 0 1px rgba(226, 232, 240, 0.8);
  padding: 36px 32px;
  text-align: center;
  animation: authCardIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authCardIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.auth-card .brand-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card .brand-mark img {
  width: 50px;
  height: 50px;
  object-fit: contain;
}

.auth-card h2 {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 6px;
}

.auth-card .auth-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 20px;
}

.auth-tabs {
  display: flex;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
  margin-bottom: 22px;
  border: none;
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 8px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-tab:hover:not(.is-active) {
  color: var(--text);
}

.auth-tab.is-active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
}

.auth-field {
  text-align: left;
  margin-bottom: 14px;
}

.auth-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.auth-card input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: #ffffff;
}

.auth-card input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.auth-card button.primary {
  width: 100%;
  min-height: 42px;
  margin-top: 6px;
  font-size: 14px;
  font-weight: 600;
}

.auth-card .auth-error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 12px;
  min-height: 18px;
  padding: 4px 10px;
  border-radius: 6px;
}

.auth-card .auth-error:not(:empty) {
  background: var(--danger-soft);
  border: 1px solid #fecaca;
}

/* 顶部用户栏 */
.user-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
}

.user-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.user-badge.admin {
  background: #fef3c7;
  color: #b45309;
}

.user-badge.user {
  background: #e0f2fe;
  color: #0369a1;
}

.user-name {
  font-weight: 650;
  color: var(--text);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-btn {
  padding: 3px 8px !important;
  min-height: 24px !important;
  font-size: 12px !important;
  border-radius: 6px !important;
}

/* 输入框强制保证深色文字与白色背景 */
input,
select,
textarea {
  color: #0f172a !important;
  background-color: #ffffff !important;
  caret-color: var(--primary) !important;
  -webkit-text-fill-color: #0f172a !important;
}

input::placeholder,
textarea::placeholder {
  color: #94a3b8 !important;
  -webkit-text-fill-color: #94a3b8 !important;
  opacity: 1 !important;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: #0f172a !important;
  -webkit-box-shadow: 0 0 0px 1000px #ffffff inset !important;
  box-shadow: 0 0 0px 1000px #ffffff inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* 带图标输入框与密码眼睛切换 */
.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-with-icon .input-icon {
  position: absolute;
  left: 12px;
  color: #94a3b8;
  pointer-events: none;
  z-index: 1;
}

.input-with-icon input {
  padding-left: 38px !important;
}

.password-field-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-field-wrapper .input-icon {
  position: absolute;
  left: 12px;
  color: #94a3b8;
  pointer-events: none;
  z-index: 1;
}

.password-field-wrapper input {
  padding-left: 38px !important;
  padding-right: 42px !important;
}

.toggle-pwd-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #64748b !important;
  padding: 6px !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s ease;
  min-height: unset !important;
}

.toggle-pwd-btn:hover {
  color: var(--primary) !important;
  background: var(--panel-soft) !important;
}

.inline-name-edit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.inline-name-edit input {
  width: 120px;
  padding: 4px 8px !important;
  font-size: 13px !important;
  min-height: 28px !important;
}

/* 扫码绑定卡片 */
.channel-scan-box {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  margin-bottom: 8px;
}

.scan-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.scan-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e3a8a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.scan-box-tip {
  font-size: 12px;
  color: #475569;
  line-height: 1.5;
}

.qr-display-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid var(--line);
  margin: 8px auto;
  box-shadow: var(--shadow-sm);
  width: fit-content;
}

.qr-display-card img {
  width: 200px;
  height: 200px;
  object-fit: contain;
}

.auth-field {
  text-align: left;
  margin-bottom: 14px;
}

.auth-field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 500;
}

.auth-card input.text-left {
  text-align: left;
  letter-spacing: normal;
}

/* 用户管理面板布局 */
.users-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

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

.user-table-wrap {
  overflow-x: auto;
  margin-top: 14px;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.user-table th {
  background: var(--panel-soft);
  color: var(--muted);
  padding: 10px 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.user-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.user-table tr:hover td {
  background: #fbfdff;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge.active {
  background: #dcfce7;
  color: #15803d;
}

.status-badge.pending {
  background: #fef3c7;
  color: #b45309;
}

.status-badge.disabled {
  background: #fee2e2;
  color: #b91c1c;
}

.action-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-xs {
  padding: 3px 8px !important;
  font-size: 12px !important;
  min-height: 26px !important;
  border-radius: 4px !important;
}

.btn-xs.danger {
  color: var(--danger);
  border-color: #fca5a5;
}

.btn-xs.danger:hover {
  background: #fef2f2;
}

.btn-xs.success {
  color: var(--ok);
  border-color: #86efac;
}

.btn-xs.success:hover {
  background: #f0fdf4;
}

.reg-settings-form {
  margin-top: 14px;
}

.setting-item {
  display: block;
  margin-bottom: 12px;
}

.setting-item .label-text {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.styled-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
}

.reg-mode-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  padding: 8px 10px;
  background: var(--panel-soft);
  border-radius: 6px;
}

/* 账号所有者标签 */
.account-owner-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
  margin-left: 8px;
  font-weight: normal;
}

/* 模态框通用 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  width: min(480px, 100%);
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(226, 232, 240, 0.8);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: authCardIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  border-radius: 6px;
}

.modal-close:hover {
  background: var(--panel-soft);
  color: var(--text);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

