:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --panel: #f9f5ee;
  --border: #ddd2c2;
  --text: #1e1b18;
  --muted: #74685a;
  --accent: #bc5a45;
  --accent-hover: #9f4734;
  --success: #257a5a;
  --radius: 14px;
  --shadow: 0 12px 30px rgba(76, 50, 31, 0.08);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}
body {
  touch-action: manipulation;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(188, 90, 69, 0.14), transparent 28%),
    linear-gradient(180deg, #f7f1e6 0%, var(--bg) 100%);
  color: var(--text);
}

.app-header {
  padding: 16px 24px;
  background: rgba(255, 253, 248, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(221, 210, 194, 0.8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #d78d62);
  color: #fff;
}
.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(221, 210, 194, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}
.user-pill-name {
  font-size: 13px;
  font-weight: 700;
}
.user-pill-points {
  font-size: 12px;
  color: var(--muted);
}
.user-pill.is-clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.user-pill.is-clickable:hover {
  border-color: rgba(188, 90, 69, 0.45);
  box-shadow: 0 4px 14px rgba(188, 90, 69, 0.12);
}

.account-center {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  padding: 20px;
  pointer-events: none;
}
.account-center.open {
  pointer-events: auto;
}
.account-center-backdrop {
  position: fixed;
  inset: 0;
  z-index: 54;
  background: rgba(30, 27, 24, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.account-center-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.account-center-panel {
  width: min(1080px, 100%);
  max-height: min(88vh, 820px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(39, 27, 19, 0.18);
  overflow: hidden;
  transform: translateY(12px);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.account-center.open .account-center-panel {
  transform: translateY(0);
  opacity: 1;
}
.account-center-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.account-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.account-center-head h2 {
  font-size: 20px;
  margin-top: 4px;
}
.account-center-body {
  display: grid;
  grid-template-columns: 200px 1fr;
  min-height: 0;
  flex: 1;
}
.account-nav {
  padding: 16px 12px;
  border-right: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.account-nav-item {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.account-nav-item:hover {
  background: rgba(255, 255, 255, 0.7);
}
.account-nav-item.active {
  background: #fff;
  border-color: var(--border);
  color: var(--accent);
}
.account-main {
  padding: 20px 24px;
  overflow: auto;
  min-height: 320px;
}
.account-pane[hidden] {
  display: none !important;
}
.account-placeholder {
  min-height: 280px;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 10px;
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 18px;
  background: rgba(249, 245, 238, 0.6);
}
.account-placeholder-title {
  font-size: 18px;
  font-weight: 700;
}
.account-placeholder-desc {
  color: var(--muted);
  font-size: 14px;
}
.account-history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.account-history-detail.hidden {
  display: none;
}
.account-history-list.hidden {
  display: none;
}
.account-job-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  width: 100%;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.account-job-card:hover {
  transform: translateY(-4px);
  border-color: rgba(188, 90, 69, 0.45);
  box-shadow: 0 12px 28px rgba(76, 50, 31, 0.12);
}
.account-job-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--panel);
  display: block;
}
.account-job-thumb.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  aspect-ratio: 1 / 1;
}
.account-job-body {
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.account-job-title {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.account-job-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.account-job-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(221, 210, 194, 0.4);
}
.account-job-status {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.account-job-status.done { background: rgba(37, 122, 90, 0.12); color: var(--success); }
.account-job-status.running { background: rgba(188, 90, 69, 0.12); color: var(--accent); }
.account-job-status.error { background: rgba(181, 83, 67, 0.12); color: #b55343; }
.account-empty {
  color: var(--muted);
  text-align: center;
  padding: 48px 16px;
}
.account-back {
  margin-bottom: 14px;
}
.account-detail-head {
  margin-bottom: 16px;
}
.account-detail-head h3 {
  font-size: 18px;
  margin-bottom: 6px;
}
.account-detail-meta {
  color: var(--muted);
  font-size: 13px;
}
.account-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.account-detail-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
}
.account-detail-card img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  display: block;
  background: var(--panel);
}
.account-detail-card .slot-label {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
}
.account-detail-card.is-failed {
  cursor: default;
}
.account-detail-failed {
  aspect-ratio: 2 / 3;
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  background: var(--panel);
}

/* ===== Dashboard Layout ===== */
.dashboard-body {
  min-height: 100vh;
  background: #f3efe7;
}
.dashboard-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.dashboard-sidebar {
  display: flex;
  flex-direction: column;
  background: #fffdf8;
  color: var(--text);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid rgba(221, 210, 194, 0.7);
}
.sidebar-brand {
  padding: 24px 22px 20px;
  border-bottom: 1px solid rgba(221, 210, 194, 0.5);
}
.sidebar-brand .logo {
  color: var(--text);
  gap: 10px;
}
.sidebar-brand .logo-icon {
  background: linear-gradient(135deg, var(--accent), #d78d62);
}

/* Sidebar User Card */
.sidebar-user {
  margin: 16px 16px;
  padding: 20px;
  background: linear-gradient(135deg, #f9f5ee, #f4ede0);
  border: 1px solid rgba(221, 210, 194, 0.6);
  border-radius: 16px;
  text-align: center;
}
.sidebar-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #d78d62);
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  font-size: 22px;
  color: #fff;
  font-weight: 700;
}
.sidebar-user-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.sidebar-user-role {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
}
.sidebar-balance {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 8px 18px;
  background: rgba(188, 90, 69, 0.08);
  border: 1px solid rgba(188, 90, 69, 0.18);
  border-radius: 999px;
}
.sidebar-balance-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
}
.sidebar-balance-unit {
  font-size: 12px;
  color: var(--muted);
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}
.sidebar-nav-item:hover {
  background: rgba(249, 245, 238, 0.8);
  color: var(--text);
}
.sidebar-nav-item.active {
  background: rgba(188, 90, 69, 0.1);
  color: var(--accent);
}
.sidebar-nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}
.sidebar-nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  line-height: 1;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(221, 210, 194, 0.5);
}
.sidebar-back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 12px;
  border: 2px solid rgba(188, 90, 69, 0.25);
  background: rgba(188, 90, 69, 0.06);
  transition: all 0.25s ease;
  margin-bottom: 8px;
}
.sidebar-back-icon {
  font-size: 16px;
  line-height: 1;
}
.sidebar-back-link:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(188, 90, 69, 0.3);
  transform: translateY(-1px);
}

/* ===== Main Content Area ===== */
.dashboard-main {
  padding: 0;
  overflow-y: auto;
  height: 100vh;
}

/* ===== Recovery Banner ===== */
.recovery-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 32px;
  background: linear-gradient(135deg, rgba(188, 90, 69, 0.08), rgba(188, 90, 69, 0.03));
  border-bottom: 1px solid rgba(188, 90, 69, 0.15);
}
.recovery-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
}
.recovery-banner-icon {
  font-size: 20px;
}
.recovery-banner-text {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}
.recovery-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 8px;
}

/* ===== Main Content Area (cont) ===== */

.dashboard-header {
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(221, 210, 194, 0.7);
  position: sticky;
  top: 0;
  z-index: 10;
}
.dashboard-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}
.dashboard-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}
.dashboard-header-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: rgba(249, 245, 238, 0.8);
  border: 1px solid rgba(221, 210, 194, 0.8);
  border-radius: 999px;
}
.header-user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.header-user-points {
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
}

/* ===== Notifications ===== */
.notify-wrapper {
  position: relative;
  margin-right: 4px;
}
.notify-toggle {
  position: relative;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(221, 210, 194, 0.8);
  border-radius: 50%;
  background: rgba(249, 245, 238, 0.8);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 18px;
  transition: background 0.2s;
}
.notify-toggle:hover {
  background: rgba(188, 90, 69, 0.08);
}
.notify-icon {
  line-height: 1;
}
.notify-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  line-height: 1;
}
.notify-panel {
  position: absolute;
  top: 48px;
  right: 0;
  width: 340px;
  max-height: 420px;
  background: var(--surface);
  border: 1px solid rgba(221, 210, 194, 0.9);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(76, 50, 31, 0.12);
  z-index: 50;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.notify-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(221, 210, 194, 0.5);
}
.notify-panel-title {
  font-size: 14px;
  font-weight: 700;
}
.notify-dismiss-all {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.notify-dismiss-all:hover {
  background: rgba(188, 90, 69, 0.06);
  color: var(--accent);
}
.notify-panel-list {
  overflow-y: auto;
  max-height: 360px;
  padding: 8px;
}
.notify-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.notify-item:hover {
  background: rgba(249, 245, 238, 0.7);
}
.notify-item--unseen {
  background: rgba(188, 90, 69, 0.06);
}
.notify-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}
.notify-item-body {
  flex: 1;
  min-width: 0;
}
.notify-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notify-item-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.notify-item-dismiss {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.notify-item:hover .notify-item-dismiss {
  opacity: 1;
}
.notify-item-dismiss:hover {
  color: var(--accent);
}
.dashboard-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-logout-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

/* ===== Stats Row ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 24px 32px;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid rgba(221, 210, 194, 0.8);
  border-radius: 18px;
  box-shadow: 0 2px 12px rgba(76, 50, 31, 0.04);
}
.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-card-icon--balance {
  background: rgba(188, 90, 69, 0.1);
}
.stat-card-icon--usage {
  background: rgba(37, 122, 90, 0.1);
}
.stat-card-icon--total {
  background: rgba(215, 141, 98, 0.1);
}
.stat-card-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.stat-card-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

/* ===== Panel Section ===== */
.panel-section {
  padding: 0 32px 24px;
}
.panel-section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}
.panel-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-section-head .panel-section-title {
  margin-bottom: 0;
}
#accountPaneHistory > .panel-section:first-child {
  padding-bottom: 8px;
}
#accountPaneHistory .history-list-view > .panel-section {
  padding-top: 0;
}

/* ===== Recharge Grid ===== */
.recharge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.recharge-card {
  position: relative;
  padding: 28px 24px;
  background: #fff;
  border: 1px solid rgba(221, 210, 194, 0.8);
  border-radius: 18px;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.recharge-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(76, 50, 31, 0.1);
}
.recharge-card--featured {
  border-color: rgba(188, 90, 69, 0.4);
  box-shadow: 0 4px 20px rgba(188, 90, 69, 0.1);
  background: linear-gradient(180deg, #fffdf8 0%, #fff 100%);
}
.recharge-card-ribbon {
  position: absolute;
  top: 12px;
  right: -6px;
  padding: 4px 16px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px 4px 4px 0;
}
.recharge-card-ribbon::after {
  content: "";
  position: absolute;
  bottom: -6px;
  right: 0;
  border: 3px solid #7a3322;
  border-right-color: transparent;
  border-bottom-color: transparent;
}
.recharge-card-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(188, 90, 69, 0.08);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 14px;
}
.recharge-card-amount {
  font-size: 36px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}
.recharge-card-unit {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
}
.recharge-card-desc {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.5;
}
.recharge-card-price {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 18px;
}
.recharge-card-price strong {
  font-size: 22px;
  color: var(--accent);
}
.recharge-card-price s {
  color: var(--muted);
  font-size: 13px;
  margin-left: 6px;
}
.recharge-btn {
  width: 100%;
}
.recharge-notice {
  margin: 0 32px 24px;
  padding: 16px 20px;
  background: rgba(249, 245, 238, 0.8);
  border: 1px solid rgba(221, 210, 194, 0.7);
  border-radius: 14px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* ===== Redeem Card (卡密核销) ===== */
.redeem-card {
  padding: 24px;
  background: #fff;
  border: 1px solid rgba(221, 210, 194, 0.6);
  border-radius: 14px;
}
.redeem-desc {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.6;
}
.redeem-form {
  display: flex;
  gap: 12px;
  align-items: center;
}
.redeem-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid rgba(221, 210, 194, 0.8);
  border-radius: 10px;
  background: #faf9f5;
  font-size: 16px;
  color: var(--text);
  font-family: monospace;
  letter-spacing: 1px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.redeem-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(188, 90, 69, 0.1);
}
.redeem-input::placeholder {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  letter-spacing: 0;
  font-size: 14px;
  color: #bbb;
}
.redeem-btn {
  white-space: nowrap;
  min-width: 120px;
  padding: 12px 24px;
  font-size: 15px;
}
.redeem-hint {
  margin-top: 12px;
  font-size: 13px;
  min-height: 20px;
}
.redeem-hint.success {
  color: var(--success);
}
.redeem-hint.error {
  color: var(--accent);
}
.redeem-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== Share referral ===== */
.share-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.share-stat {
  text-align: center;
  padding: 14px 8px;
  background: rgba(249, 245, 238, 0.9);
  border-radius: 12px;
  border: 1px solid rgba(221, 210, 194, 0.5);
}
.share-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 4px;
}
.share-stat-label {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
@media (max-width: 640px) {
  .share-stats-row {
    grid-template-columns: 1fr;
  }
}

/* ── Feedback ─────────────────────────────────────────── */
.panel-section-desc {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.form-required {
  color: var(--accent);
}

.form-input,
.form-textarea {
  padding: 12px 14px;
  border: 1px solid rgba(221, 210, 194, 0.8);
  border-radius: 10px;
  background: #faf9f5;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(188, 90, 69, 0.1);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-hint {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

.form-hint.over {
  color: var(--accent);
}

#feedbackSubmitBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Feedback List */
.feedback-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feedback-card {
  padding: 20px;
  background: #fff;
  border: 1px solid rgba(221, 210, 194, 0.6);
  border-radius: 14px;
  transition: box-shadow 0.18s ease;
}

.feedback-card:hover {
  box-shadow: 0 4px 16px rgba(76, 50, 31, 0.06);
}

.feedback-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.feedback-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.feedback-card-body {
  font-size: 14px;
  color: #3d3530;
  line-height: 1.7;
  margin-bottom: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}

.feedback-card-meta {
  font-size: 12px;
  color: var(--muted);
}

.feedback-reply {
  margin-top: 14px;
  padding: 14px 16px;
  background: #f6faf3;
  border-left: 4px solid var(--success);
  border-radius: 8px;
}

.feedback-reply-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 6px;
}

.feedback-reply-content {
  font-size: 14px;
  color: #3d3530;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.feedback-reply-time {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

/* Account Panes */
.account-pane[hidden] {
  display: none !important;
}

/* History views */
.history-detail-view.hidden,
.hidden {
  display: none !important;
}

.layout-simple {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  padding: 18px;
}

.setup-panel,
.workspace {
  background: rgba(255, 253, 248, 0.88);
  border: 1px solid rgba(221, 210, 194, 0.85);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.setup-panel {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.setup-panel.is-locked {
  position: relative;
}

.setup-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.baseline-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
}

.baseline-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}

textarea,
input,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font: inherit;
}

textarea { min-height: 100px; resize: vertical; }
textarea:focus,
input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(188, 90, 69, 0.12);
}

.chip-group,
.mini-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  font: inherit;
}
.chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.chip:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.stack { display: flex; flex-direction: column; gap: 12px; }
.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.upload-zone {
  border: 1.5px dashed var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, #fffdf8 0%, #f8f2e8 100%);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.upload-zone.has-file {
  border-color: var(--accent);
  color: var(--accent);
}
.upload-zone.is-disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}
.upload-icon { display: block; font-size: 28px; line-height: 1; margin-bottom: 8px; }
.upload-text {
  display: block;
}
.upload-preview {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(221, 210, 194, 0.7);
  padding: 8px;
}
.upload-file-name {
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.auto-line,
.field-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.credit-hint {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.55;
  border: 1px solid transparent;
}
.credit-hint[hidden] {
  display: none !important;
}
.credit-hint--ok {
  color: #257a5a;
  background: rgba(37, 122, 90, 0.08);
  border-color: rgba(37, 122, 90, 0.18);
}
.credit-hint--warn {
  color: #9a3b2e;
  background: rgba(181, 83, 67, 0.1);
  border-color: rgba(181, 83, 67, 0.22);
}
.credit-hint--info {
  color: var(--muted);
  background: rgba(39, 27, 19, 0.04);
  border-color: rgba(39, 27, 19, 0.08);
}
.credit-hint--loading {
  color: var(--muted);
  background: rgba(39, 27, 19, 0.04);
  border-color: rgba(39, 27, 19, 0.06);
}
.credit-hint-link {
  display: inline-block;
  margin-top: 6px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.credit-hint-link:hover {
  text-decoration: underline;
}
.btn-generate-bottom:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.workspace {
  min-height: calc(100vh - 110px);
  padding: 18px;
}

.workspace-empty,
.workspace-results {
  min-height: 100%;
}
.workspace-empty {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 12px;
}
.workspace-empty.hidden,
.workspace-results.hidden,
.hidden { display: none !important; }

.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: rgba(188, 90, 69, 0.14);
  color: var(--accent);
  font-size: 24px;
}
.empty-title { font-size: 20px; font-weight: 700; }
.empty-desc { max-width: 360px; color: var(--muted); }

.workspace-top {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}
.driver-badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(188, 90, 69, 0.12);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}
.workspace-meta { margin-left: auto; color: var(--muted); font-size: 13px; }
.progress-bar {
  width: 180px;
  height: 6px;
  border-radius: 999px;
  background: #eadfce;
  overflow: hidden;
}
.progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #d78d62);
  transition: width 0.25s ease;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}

/* Batch Download Toolbar */
.batch-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 4px;
  background: rgba(249, 245, 238, 0.7);
  border: 1px solid rgba(221, 210, 194, 0.7);
  border-radius: 12px;
  flex-wrap: wrap;
}
.batch-check-all {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}
.batch-check-all input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.batch-count {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-right: auto;
}
.batch-toolbar .btn {
  white-space: nowrap;
}

.image-slot {
  border: 1px solid rgba(221, 210, 194, 0.9);
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.image-slot:hover,
.image-slot.selected {
  transform: translateY(-2px);
  border-color: rgba(188, 90, 69, 0.5);
  box-shadow: 0 12px 24px rgba(76, 50, 31, 0.1);
}
.image-slot.is-locked {
  cursor: default;
}
.image-slot.is-locked:hover {
  transform: none;
  box-shadow: none;
}
.slot-preview {
  aspect-ratio: 1 / 1.2;
  background: linear-gradient(180deg, #fcf6ed 0%, #f4ebdf 100%);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}
.slot-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.slot-select-overlay {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.85);
  border: 2px solid rgba(116, 104, 90, 0.35);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.slot-select-overlay:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.95);
}
.slot-select-overlay.checked {
  background: var(--accent);
  border-color: var(--accent);
}
.slot-select-overlay input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.slot-check-icon {
  font-size: 14px;
  color: #fff;
  font-weight: 700;
  line-height: 1;
}

/* History Detail Batch Selection */
.history-detail-card {
  position: relative;
}
.history-img-wrap {
  position: relative;
  overflow: hidden;
}
.history-img-wrap img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  display: block;
  background: var(--panel);
}
.history-slot-select-overlay {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.85);
  border: 2px solid rgba(116, 104, 90, 0.35);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.history-slot-select-overlay:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.95);
}
.history-slot-select-overlay.checked {
  background: var(--accent);
  border-color: var(--accent);
}
.history-slot-select-overlay input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.slot-placeholder {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  color: var(--muted);
}
.slot-id {
  font-weight: 700;
  color: var(--accent);
}
.slot-foot {
  padding: 10px 12px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slot-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.slot-tag {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(188, 90, 69, 0.12);
  color: var(--accent);
  font-size: 11px;
}

.slot-meta {
  color: var(--muted);
  font-size: 12px;
}

.slot-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.slot-switch {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.slot-switch.is-on {
  border-color: rgba(188, 90, 69, 0.35);
  background: rgba(188, 90, 69, 0.09);
  color: var(--accent);
}
.slot-switch:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.slot-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(30, 27, 24, 0.4);
  font-size: 13px;
}

/* 局部重绘：不露出原缩略图（若仍渲染 img 时兜底） */
.slot-preview.inpaint-busy .slot-thumb-img {
  visibility: hidden;
}

/* 局部重绘 loading：必须高对比，避免白字+浅底看不清 */
.slot-preview.inpaint-busy > .slot-loading {
  z-index: 4;
  gap: 12px;
  padding: 16px;
  text-align: center;
  color: #fff;
  background: linear-gradient(
    155deg,
    rgba(42, 36, 32, 0.92) 0%,
    rgba(100, 58, 48, 0.9) 45%,
    rgba(35, 31, 28, 0.94) 100%
  );
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.slot-preview.inpaint-busy > .slot-loading .slot-spinner {
  width: 36px;
  height: 36px;
  border-width: 3px;
  border-color: rgba(255, 255, 255, 0.22);
  border-top-color: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.slot-preview.inpaint-busy > .slot-loading .slot-loading-text {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  max-width: 12em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.slot-preview.inpaint-busy > .slot-loading .slot-countdown {
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.slot-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: slot-spin 0.9s linear infinite;
}

.slot-countdown {
  font-size: 18px;
  font-weight: bold;
  font-family: monospace;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.slot-loading-text {
  color: #fff;
  font-size: 13px;
}

.slot-preview.is-generating img {
  opacity: 0.5;
}

.slot-cancelled {
  color: var(--muted);
  opacity: 0.65;
}
.slot-cancelled .slot-id {
  color: var(--muted);
}
.image-slot.is-cancelled {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.5);
}
.slot-preview.is-cancelled {
  background: rgba(0, 0, 0, 0.03);
}

@keyframes slot-spin {
  to { transform: rotate(360deg); }
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 11px 16px;
  cursor: pointer;
  font: inherit;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: #efe7d9;
  color: var(--text);
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover { background: var(--accent-hover); }
.btn-sm { padding: 8px 12px; font-size: 12px; }
.btn-generate-bottom {
  width: 100%;
  margin-top: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: -540px;
  width: min(540px, 100vw);
  height: 100vh;
  background: #fffdf8;
  box-shadow: -18px 0 38px rgba(39, 27, 19, 0.12);
  z-index: 30;
  transition: right 0.22s ease;
  display: flex;
  flex-direction: column;
}
.drawer.open { right: 0; }
.drawer-head {
  padding: 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.drawer-sub { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; }
#promptEditor {
  flex: 1;
  margin: 16px;
  min-height: 240px;
}
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(39, 27, 19, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 20;
}
.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(39, 27, 19, 0.5);
  z-index: 40;
}
.modal.open { display: flex; }
.modal-content {
  position: relative;
  width: min(92vw, 920px);
  max-height: 88vh;
  padding: 18px;
  border-radius: 24px;
  background: #fffdf8;
}
.auth-modal-content {
  width: min(92vw, 420px);
  padding: 24px;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-right: 48px;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  cursor: pointer;
}
.modal-title { font-weight: 700; }
.modal-index {
  color: var(--muted);
  font-size: 13px;
}
.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: rgba(30, 27, 24, 0.62);
  color: #fff;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  pointer-events: auto;
}
.modal-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.modal-prev { left: 20px; }
.modal-next { right: 20px; }
.modal-img-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
}
#modalImg {
  display: block;
  width: 100%;
  max-height: calc(88vh - 70px);
  object-fit: contain;
  border-radius: 16px;
}
#inpaintCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  border-radius: 16px;
  touch-action: none;
}
.modal-head-actions {
  margin-left: auto;
}

/* 局部重绘工具栏 */
#modal .modal-content {
  display: flex;
  flex-direction: column;
  overflow: auto;
}
#modal .modal-head {
  flex: 0 0 auto;
  order: 1;
}
#modal .modal-img-wrap {
  flex: 1 1 auto;
  order: 3;
  min-height: 0;
}
#modal .modal-nav {
  order: 4;
}
#modal.inpaint-open #modalImg {
  max-height: calc(88vh - 130px);
}
.inpaint-bar {
  flex: 0 0 auto;
  order: 2;
  margin: 0 0 8px;
  padding: 8px 12px;
  background: #faf6ef;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.inpaint-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.inpaint-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}
.inpaint-input:focus {
  border-color: var(--accent);
}
.inpaint-input::placeholder {
  color: #b5a898;
}
.inpaint-hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.inpaint-submitting .inpaint-input,
.inpaint-submitting .inpaint-bar-row button {
  opacity: 0.6;
  pointer-events: none;
}
.inpaint-submitting .inpaint-hint {
  color: var(--accent);
}

.auth-modal .modal-content {
  box-shadow: 0 20px 50px rgba(39, 27, 19, 0.16);
}
.auth-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}
.auth-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.auth-desc,
.auth-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.auth-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.auth-submit {
  width: 100%;
  margin-top: 4px;
}
.auth-modal .modal-close {
  background: rgba(188, 90, 69, 0.08);
  color: var(--accent);
}

/* ── Confirm Modal ─────────────────────────────────────── */
.confirm-modal {
  z-index: 72;
}
.confirm-modal .modal-content {
  width: min(92vw, 420px);
  padding: 24px;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(39, 27, 19, 0.18);
}
.confirm-modal .modal-close {
  background: rgba(188, 90, 69, 0.08);
  color: var(--accent);
}
.confirm-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}
.confirm-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.confirm-title {
  font-size: 22px;
  line-height: 1.4;
}
.confirm-desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Announcement Modal ────────────────────────────────── */
.announce-modal {
  z-index: 70;
}
.announce-modal .modal-content {
  position: relative;
  width: min(92vw, 480px);
  padding: 0;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(39, 27, 19, 0.22);
  overflow: hidden;
  animation: announceIn 0.35s ease;
}
@keyframes announceIn {
  from {
    transform: translateY(20px) scale(0.96);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}
.announce-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 28px 0;
}
.announce-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(188, 90, 69, 0.12), rgba(215, 141, 98, 0.15));
  color: var(--accent);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.announce-head h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.announce-body {
  padding: 20px 28px;
  font-size: 14px;
  line-height: 1.75;
  color: #3d3530;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 50vh;
  overflow-y: auto;
}
.announce-foot {
  padding: 0 28px 24px;
  display: flex;
  justify-content: flex-end;
}
.announce-foot .btn {
  padding: 11px 28px;
  font-size: 14px;
  font-weight: 600;
}

.toast {
  position: fixed;
  left: 50%;
  top: 20px;
  bottom: auto;
  transform: translateX(-50%) translateY(-14px);
  background: rgba(30, 27, 24, 0.94);
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 60;
  box-shadow: 0 12px 28px rgba(39, 27, 19, 0.18);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.btn-danger {
  background: #b55343;
  color: #fff;
}
.btn-danger:hover {
  background: #933c30;
}

@media (max-width: 1100px) {
  .stats-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    padding: 20px;
  }
  .recharge-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
  .panel-section {
    padding: 0 20px 20px;
  }
  .dashboard-header {
    padding: 20px 24px;
  }
}

@media (max-width: 900px) {
  .layout-simple {
    grid-template-columns: 1fr;
  }
  .workspace {
    min-height: auto;
  }
  .dashboard-layout {
    grid-template-columns: 220px 1fr;
  }
  .stats-row {
    grid-template-columns: 1fr;
  }
  .recharge-grid {
    grid-template-columns: 1fr;
  }
  .stat-card {
    padding: 18px;
  }
}

/* ── 首次登录引导图 ─────────────────────────────────────── */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.onboarding-overlay.active {
  opacity: 1;
  /* 遮罩不拦截点击，避免 tooltip/遮罩挡住高亮输入框 */
  pointer-events: none;
}

/* 背景遮罩 */
.onboarding-mask {
  position: absolute;
  inset: 0;
  background: rgba(30, 27, 24, 0.62);
  transition: background 0.35s ease;
}

/* 聚光圈 - 通过 box-shadow 镂空 */
.onboarding-spotlight {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(30, 27, 24, 0.62);
  background: rgba(255, 255, 255, 0.04);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 1;
}

/* 被高亮的元素需要提升到遮罩与提示框之上，确保可点击输入 */
.onboarding-highlight {
  position: relative;
  z-index: 90 !important;
  pointer-events: auto !important;
}

/* 提示卡片 */
.onboarding-tooltip {
  position: absolute;
  z-index: 85;
  background: #fffdf8;
  border: 1px solid rgba(221, 210, 194, 0.9);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(39, 27, 19, 0.22);
  padding: 20px 22px 18px;
  width: 340px;
  max-width: calc(100vw - 24px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}
.onboarding-tooltip.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: none;
}
.onboarding-overlay:not(.active) .onboarding-tooltip,
.onboarding-overlay:not(.active) .onboarding-spotlight {
  pointer-events: none !important;
  visibility: hidden !important;
}
.onboarding-tooltip.visible button,
.onboarding-tooltip.visible .onboarding-tooltip-buttons,
.onboarding-tooltip.visible .onboarding-dots {
  pointer-events: auto;
}

/* 提示卡片的小三角 */
.onboarding-tooltip-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.onboarding-tooltip-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.onboarding-tooltip-kicker {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.onboarding-tooltip-step {
  font-size: 12px;
  font-weight: 700;
  color: #8b6b54;
}

.onboarding-progress {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(221, 210, 194, 0.45);
  overflow: hidden;
}

.onboarding-progress-fill {
  display: block;
  height: 100%;
  width: 25%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #d78d62);
  transition: width 0.25s ease;
}

.onboarding-tooltip-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}

.onboarding-tooltip-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.onboarding-tooltip-hint {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(249, 245, 238, 0.9);
  border: 1px solid rgba(221, 210, 194, 0.7);
  color: #6f5d4d;
  font-size: 12px;
  line-height: 1.6;
}

.onboarding-tooltip-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}

.onboarding-tooltip-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.onboarding-tooltip .btn-skip {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  transition: color 0.15s;
}
.onboarding-tooltip .btn-skip:hover {
  color: var(--text);
}

.onboarding-tooltip .btn-prev,
.onboarding-tooltip .btn-next {
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.onboarding-tooltip .btn-prev {
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  border: 1px solid var(--border);
}

.onboarding-tooltip .btn-prev:hover {
  border-color: rgba(188, 90, 69, 0.35);
  color: var(--accent);
}

.onboarding-tooltip .btn-prev:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: var(--border);
  color: var(--muted);
}

.onboarding-tooltip .btn-next {
  background: var(--accent);
  color: #fff;
  border: none;
}

.onboarding-tooltip .btn-next:hover {
  background: var(--accent-hover);
}

/* 步骤指示点 */
.onboarding-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}
.onboarding-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(221, 210, 194, 0.6);
  transition: all 0.25s ease;
}
.onboarding-dot.active {
  background: var(--accent);
  width: 10px;
  height: 10px;
}
.onboarding-dot.done {
  background: rgba(188, 90, 69, 0.35);
}

/* Account mobile bottom navigation */
.account-mobile-nav {
  display: none;
}

@media (max-width: 640px) {
  .onboarding-tooltip {
    width: calc(100vw - 24px);
    max-width: none;
    padding: 18px 18px 16px;
  }
  .onboarding-tooltip::before {
    display: none;
  }
  .onboarding-tooltip-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .onboarding-dots {
    justify-content: center;
  }
  .onboarding-tooltip-buttons {
    width: 100%;
  }
  .onboarding-tooltip .btn-prev,
  .onboarding-tooltip .btn-next {
    flex: 1;
    text-align: center;
  }
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .header-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .dashboard-body {
    height: 100dvh;
    overflow: hidden;
  }
  .dashboard-layout {
    grid-template-columns: 1fr;
    height: 100%;
    min-height: 0;
  }
  .dashboard-sidebar {
    display: none;
  }
  .account-mobile-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 120;
    align-items: stretch;
    justify-content: space-around;
    gap: 2px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 253, 248, 0.96);
    border-top: 1px solid rgba(221, 210, 194, 0.85);
    backdrop-filter: blur(10px);
    box-shadow: 0 -8px 24px rgba(76, 50, 31, 0.08);
  }
  .account-mobile-nav-item {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 4px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    text-decoration: none;
    cursor: pointer;
    position: relative;
  }
  .account-mobile-nav-item.active {
    color: var(--accent);
    background: rgba(188, 90, 69, 0.1);
  }
  .account-mobile-nav-icon {
    font-size: 18px;
    line-height: 1;
  }
  .account-mobile-nav-label {
    line-height: 1.2;
    white-space: nowrap;
  }
  .account-mobile-nav-badge {
    position: absolute;
    top: 2px;
    right: 8px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
  }
  .dashboard-main {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
  }
  .dashboard-main > .recovery-banner {
    flex-shrink: 0;
  }
  .dashboard-header {
    position: relative;
    top: auto;
    flex-shrink: 0;
    z-index: 20;
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 20px;
  }
  .account-pane.active {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
  #historyDetailView:not(.hidden) > .account-back {
    position: sticky;
    top: 0;
    z-index: 8;
    margin: 12px 16px 0;
    background: rgba(255, 253, 248, 0.96);
    backdrop-filter: blur(8px);
  }
  #historyDetailView:not(.hidden) .batch-toolbar {
    position: sticky;
    top: 48px;
    z-index: 7;
    background: rgba(255, 253, 248, 0.96);
    backdrop-filter: blur(8px);
    margin-bottom: 8px;
  }
  .dashboard-header-right {
    width: 100%;
  }
  .notify-panel {
    left: 0;
    right: auto;
    width: min(340px, calc(100vw - 40px));
  }
  .dashboard-header-user {
    width: 100%;
    justify-content: center;
  }
  .stats-row {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
  }
  .recharge-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .panel-section {
    padding: 0 16px 16px;
  }
  .recharge-notice {
    margin: 0 16px 16px;
  }
  .account-center-body,
  .account-page-body {
    grid-template-columns: 1fr;
  }
  .account-nav {
    flex-direction: row;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .account-nav-item {
    white-space: nowrap;
  }
  .account-history-list {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
  .row-2 {
    grid-template-columns: 1fr;
  }
  .modal-nav {
    width: 38px;
    height: 38px;
    font-size: 24px;
  }
  .modal-prev { left: 12px; }
  .modal-next { right: 12px; }
  .modal-content {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    padding: 14px;
  }
  #modalImg {
    max-height: calc(100vh - 180px);
  }
  #modal.inpaint-open #modalImg {
    max-height: calc(100vh - 240px);
  }
  .inpaint-bar-row {
    flex-wrap: wrap;
  }
  .inpaint-input {
    min-width: 0;
    width: 100%;
    flex: 1 1 100%;
  }
  .inpaint-bar-row .btn {
    flex: 1 1 auto;
  }
  .auth-row {
    grid-template-columns: 1fr;
  }
}
