/* ═══════════════════════════════════════════════════
   图钥 · Bootstrap 5 补充样式
   Design system: Warm Graphite & Amber
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&display=swap');

/* ── CSS Variables ───────────────────────────────── */
:root {
  --primary:       #d97706;
  --primary-dark:  #b45309;
  --primary-soft:  rgba(217,119,6,.07);
  --primary-glow:  rgba(217,119,6,.12);
  --bg:            #fafaf9;
  --card:          #ffffff;
  --border:        rgba(28,25,23,.08);
  --border-strong: rgba(28,25,23,.13);
  --muted:         #78716c;
  --muted-light:   #a8a29e;
  --text:          #1c1917;
  --text-secondary:#57534e;
  --success:       #059669;
  --warning:       #d97706;
  --danger:        #dc2626;
  --bg-soft:       #f5f5f4;
  --shadow-xs:     0 1px 2px rgba(28,25,23,.05);
  --shadow-sm:     0 2px 8px rgba(28,25,23,.07), 0 1px 2px rgba(28,25,23,.04);
  --shadow-md:     0 4px 16px rgba(28,25,23,.08), 0 2px 4px rgba(28,25,23,.04);
  --shadow-lg:     0 8px 30px rgba(28,25,23,.1), 0 2px 6px rgba(28,25,23,.05);
  --shadow-btn:    0 2px 8px rgba(217,119,6,.22);
  --shadow-amber:  0 4px 20px rgba(217,119,6,.12);
  --r-md:          12px;
  --r-lg:          16px;
  --r-xl:          20px;
  --r-full:        999px;
  --ease-out-expo: cubic-bezier(.16,1,.3,1);
  --ease-spring:   cubic-bezier(.34,1.56,.64,1);

  /* Bootstrap primary override */
  --bs-primary:         var(--primary);
  --bs-primary-rgb:     217,119,6;
  --bs-link-color:      #b45309;
  --bs-link-hover-color:#92400e;
  --bs-body-bg:         var(--bg);
  --bs-body-color:      var(--text);
  --bs-border-color:    var(--border);
  --bs-card-border-color: var(--border);
}

/* ── Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, "PingFang SC",
               "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { text-decoration: none; }
a:hover { text-decoration: none; }

/* ── Background Atmosphere ───────────────────────── */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: .12;
  pointer-events: none;
  z-index: 0;
  animation: orb-drift 20s ease-in-out infinite alternate;
}
.bg-orb-left  { width: 520px; height: 520px; background: #fde68a; top: -140px; left: -160px; }
.bg-orb-right { width: 440px; height: 440px; background: #fed7aa; bottom: 40px; right: -140px; animation-delay: -10s; }
@keyframes orb-drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(15px, 10px) scale(1.05); }
  100% { transform: translate(-10px, 20px) scale(.97); }
}

/* ── Shell ───────────────────────────────────────── */
.shell {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 20px 60px;
}

/* ── Topbar / Navbar ─────────────────────────────── */
.topbar {
  background: rgba(255,255,255,.88) !important;
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: none !important;
  border-bottom: 1px solid rgba(28,25,23,.06) !important;
  border-radius: 14px !important;
  box-shadow: 0 1px 3px rgba(28,25,23,.04), 0 4px 16px rgba(28,25,23,.03);
  position: sticky !important;
  top: 12px;
  z-index: 100;
  margin-bottom: 28px;
  padding: 10px 20px !important;
  transition: box-shadow .3s, background .3s;
}

.brand {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: unset;
  background-clip: unset;
}

.subtitle-pill {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted-light);
  padding: 2px 8px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: .2px;
}

/* Bootstrap navbar-nav link styles */
.topbar .navbar-nav .nav-link {
  padding: 6px 14px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: all .18s;
}
.topbar .navbar-nav .nav-link:hover,
.topbar .navbar-nav .nav-link:focus {
  color: var(--text);
  background: var(--bg-soft);
}
.topbar .navbar-nav .nav-link.active {
  color: var(--primary-dark);
  background: var(--primary-soft);
  font-weight: 600;
}

/* auth nav */
.nav-auth-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.nav-user-pill {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  transition: color .18s;
}
.nav-user-pill:hover { color: var(--text); }
.nav-logout-btn {
  font-size: 13px;
  padding: 5px 14px;
  border-radius: 8px;
}

/* ── Global Progress ─────────────────────────────── */
.global-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2.5px; z-index: 9999;
}
.global-progress span {
  display: block; height: 100%; width: 50%;
  background: linear-gradient(90deg, transparent, var(--primary) 30%, #fbbf24 70%, transparent);
  animation: progress-slide 1.4s ease-in-out infinite;
  border-radius: 2px;
}
@keyframes progress-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}
.global-progress.hidden { display: none; }

/* ── Page Layout ─────────────────────────────────── */
.page { display: flex; flex-direction: column; gap: 20px; }

/* ── Hero Section ────────────────────────────────── */
.hero { padding: 44px 36px; }
.hero h1 {
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.5px;
  margin: 16px 0 14px;
  color: var(--text);
}
.hero .lead {
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.75;
  margin-bottom: 32px;
  max-width: 600px;
}

/* ── Section head ────────────────────────────────── */
.panel-title {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.panel-title h2 { margin: 0; font-size: 17px; font-weight: 700; }

/* ── Status Chips (me page badges) ───────────────── */
.meta-chip {
  display: inline-block; font-size: 11.5px; font-weight: 500;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.status-success { background: #d1fae5; color: #065f46; }
.status-warning { background: #fef3c7; color: #92400e; }
.status-normal  { background: var(--primary-soft); color: var(--primary-dark); }

/* ── Custom badge variant ────────────────────────── */
.badge-soft {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid rgba(217,119,6,.18);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

/* ── Scene Cards (首页场景) ──────────────────────── */
.scene-card {
  border: 1.5px solid var(--border);
  transition: border-color .25s, box-shadow .3s var(--ease-out-expo), transform .3s var(--ease-out-expo);
}
.scene-card:hover {
  border-color: rgba(217,119,6,.2);
  box-shadow: 0 6px 20px rgba(217,119,6,.08);
  transform: translateY(-3px);
}
.scene-img {
  width: 100%; aspect-ratio: 400/260; object-fit: cover;
  border-radius: var(--r-md) var(--r-md) 0 0;
  transition: transform .4s var(--ease-out-expo);
}
.scene-card:hover .scene-img { transform: scale(1.04); }
.scene-card { overflow: hidden; }

/* ── Feature Cards (首页优势) ────────────────────── */
.feature-card {
  border: 1.5px solid var(--border);
  transition: border-color .25s, box-shadow .3s var(--ease-out-expo), transform .3s var(--ease-out-expo);
}
.feature-card:hover {
  border-color: rgba(217,119,6,.2);
  box-shadow: 0 6px 20px rgba(217,119,6,.08);
  transform: translateY(-3px);
}
.feature-icon {
  width: 52px; height: 52px; margin-bottom: 10px;
  background: linear-gradient(135deg, rgba(217,119,6,.05), rgba(251,191,36,.08));
  border-radius: 10px;
  padding: 6px;
  transition: transform .3s var(--ease-spring);
}
.feature-card:hover .feature-icon { transform: scale(1.1); }
.feature-icon svg { width: 100%; height: 100%; }

/* ── Scan Apps Hint ──────────────────────────────── */
.scan-apps-hint {
  margin: 14px 0 0;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(217,119,6,.04), rgba(251,191,36,.06));
  border: 1px solid rgba(217,119,6,.12);
  border-radius: var(--r-md);
}
.scan-apps-label {
  display: block; font-size: 12px; font-weight: 700;
  color: var(--primary-dark); margin-bottom: 6px;
  letter-spacing: .3px; text-transform: uppercase;
}
.scan-apps-hint p {
  margin: 0; font-size: 13.5px; line-height: 1.7;
  color: var(--text-secondary);
}
.scan-apps-hint strong { color: var(--text); font-weight: 700; }

/* ── Key Flow Diagram ────────────────────────────── */
.key-flow-figure { margin: 16px 0 0; text-align: center; }
.key-flow-diagram { max-width: 100%; height: auto; }

/* ── Check List ──────────────────────────────────── */
.check-list { padding-left: 1.2em; margin: 0; color: var(--muted); line-height: 1.8; }
.check-list li { font-size: 14px; }

/* ── Upload Zones ────────────────────────────────── */
.key-upload-zone {
  border: 2px dashed rgba(217,119,6,.22);
  border-radius: var(--r-lg); padding: 28px 24px;
  transition: border-color .2s, background .2s, box-shadow .2s;
  background: linear-gradient(165deg, #fffbeb, #fef3c7 40%, transparent 70%);
}
.key-upload-zone:hover,
.key-upload-zone.drag-over {
  border-color: var(--primary); background: var(--primary-soft);
  box-shadow: 0 0 0 4px rgba(217,119,6,.08);
}
.key-upload-label.has-file .key-upload-zone { border-style: solid; }

.key-upload-label {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; cursor: pointer; text-align: center;
}
.upload-icon { width: 40px; height: 40px; color: var(--primary); opacity: .6; }
.upload-hint { font-size: 14px; font-weight: 500; color: var(--muted); }
.upload-hint-sub { font-size: 12px; color: var(--muted-light); }

.key-upload-preview {
  display: flex; align-items: center; gap: 14px; padding: 12px;
  background: var(--primary-soft); border-radius: 10px; margin-top: 12px;
}
.upload-preview-img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; }
.upload-preview-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.upload-filename { font-size: 13px; color: var(--muted); word-break: break-all; }

.target-upload-dropzone {
  border: 2px dashed rgba(217,119,6,.22);
  border-radius: var(--r-lg); padding: 32px 20px;
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; text-align: center; cursor: pointer; min-height: 240px;
  justify-content: center; transition: border-color .2s, background .2s, box-shadow .2s;
  background: linear-gradient(165deg, #fffbeb, #fef3c7 40%, transparent 70%);
}
.target-upload-dropzone:hover,
.target-upload-dropzone.drag-over {
  border-color: var(--primary); background: var(--primary-soft);
  box-shadow: 0 0 0 4px rgba(217,119,6,.08);
}
.target-upload-dropzone.has-file { border-style: solid; }
.target-upload-kicker { font-size: 12px; color: var(--muted-light); text-transform: uppercase; letter-spacing: .5px; }
.target-upload-dropzone strong { font-size: 20px; font-weight: 700; }
.target-upload-copy { font-size: 13px; color: var(--muted); }

.target-upload-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.target-upload-side { display: flex; flex-direction: column; gap: 12px; }
.target-upload-preview { display: flex; align-items: flex-start; gap: 12px; }
.target-upload-preview-label { font-size: 11px; color: var(--muted-light); text-transform: uppercase; }
.target-upload-fields { display: flex; flex-direction: column; gap: 8px; }
.target-upload-field { display: flex; flex-direction: column; gap: 4px; }
.target-upload-field span { font-size: 13px; color: var(--muted); }
.target-upload-note { font-size: 12px; color: var(--muted-light); margin: 0; }

/* ── Legacy .button System (match.js templates) ──── */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 0 20px; border-radius: 10px;
  border: 1px solid var(--border); color: var(--text-secondary); background: var(--card);
  cursor: pointer; font-size: 14px; font-weight: 600; font-family: inherit;
  transition: transform .2s var(--ease-out-expo), box-shadow .25s, border-color .2s, background .2s, color .2s;
  white-space: nowrap; box-shadow: var(--shadow-xs); user-select: none; line-height: 1;
}
.button:hover { transform: translateY(-1px); border-color: rgba(28,25,23,.14); box-shadow: var(--shadow-sm); color: var(--text); }
.button:active { transform: translateY(0) scale(.98); }
.button:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.button.primary {
  color: #fff; background: var(--primary);
  border-color: transparent; box-shadow: var(--shadow-btn);
}
.button.primary:hover { background: var(--primary-dark); box-shadow: 0 4px 16px rgba(217,119,6,.3); }
.button.primary:disabled { background: #fbbf24; box-shadow: none; opacity: .6; }
.button.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.button.ghost:hover { background: var(--bg-soft); border-color: var(--border); }

/* ── Skeleton Loader ─────────────────────────────── */
.skeleton {
  border-radius: var(--r-md); min-height: 14px;
  background: linear-gradient(90deg, var(--bg-soft) 25%, var(--card) 50%, var(--bg-soft) 75%);
  background-size: 400% 100%; animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0% 0; } }

/* ── Key Selected Panel ──────────────────────────── */
.key-selected-card {
  display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: start;
  padding: 14px; border: 1.5px solid rgba(217,119,6,.15); border-radius: var(--r-lg);
  background: linear-gradient(135deg, rgba(217,119,6,.02), rgba(217,119,6,.06));
  box-shadow: 0 2px 8px rgba(217,119,6,.05);
  animation: tgi-enter .35s var(--ease-out-expo) both;
}
.key-selected-card--simple {
  display: flex; flex-direction: column; gap: 10px;
  padding: 0; border: none; background: none; box-shadow: none;
}
.key-selected-card--simple .key-selected-img {
  border-radius: var(--r-lg); border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.key-selected-reselect {
  align-self: stretch; font-size: 12.5px;
}
.key-selected-img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: var(--r-md); border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  transition: transform .3s var(--ease-out-expo);
  cursor: pointer;
}
.key-selected-img:hover { transform: scale(1.03); }
.key-selected-meta { display: flex; flex-direction: column; gap: 10px; }
.key-selected-meta .badge {
  align-self: flex-start; background: var(--primary-soft); color: var(--primary-dark);
  font-size: 10.5px; font-weight: 700; padding: 3px 10px; border-radius: 6px;
  border: 1px solid rgba(217,119,6,.12);
  letter-spacing: .3px; text-transform: uppercase;
}
.kv { display: grid; gap: 6px; }
.kv div {
  display: flex; flex-direction: column; gap: 2px; padding: 7px 10px;
  border-radius: 8px; background: rgba(255,255,255,.8); border: 1px solid var(--border);
  transition: border-color .15s;
}
.kv div:hover { border-color: rgba(217,119,6,.15); }
.kv span { color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: .2px; }
.kv strong { font-size: 13px; font-weight: 600; }

/* ── Target Image Items (JS-rendered) ────────────── */
.target-image-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--card);
  transition: border-color .18s, box-shadow .18s;
}
.target-image-item:hover { border-color: rgba(28,25,23,.14); box-shadow: var(--shadow-sm); }
.target-image-item img {
  width: 56px; height: 56px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--border); flex-shrink: 0; cursor: pointer;
}
.target-image-expiry {
  display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 500;
  color: var(--muted); flex: 1; min-width: 0;
}
.target-image-expiry input {
  width: 100%; font-size: 12px; padding: 5px 8px; min-height: 32px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--card);
}

/* ── Gallery Grid ────────────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 12px;
}
.gallery-card {
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .2s;
  background: var(--card);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-xs);
}
.gallery-card:hover {
  border-color: rgba(217,119,6,.25);
  box-shadow: 0 4px 16px rgba(217,119,6,.1);
  transform: translateY(-2px);
}
.gallery-card.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(217,119,6,.12), 0 4px 16px rgba(217,119,6,.1);
}
.gallery-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.gallery-meta { padding: 10px 12px 8px; }
.gallery-meta strong { display: block; font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.gallery-meta span { font-size: 11px; color: var(--muted); }
.gallery-card .button {
  margin: 0 12px 12px; min-height: 36px; font-size: 13px;
  border-radius: 8px; width: calc(100% - 24px);
}
.gallery-card .button.primary { box-shadow: none; }
.gallery-card-meta { padding: 6px 8px; font-size: 11px; color: var(--muted); }

/* ── Gallery Single (新单图模式) ─────────────────── */
.gallery-single {
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  max-width: 340px;
  transition: box-shadow .3s var(--ease-out-expo), border-color .3s;
}
.gallery-single:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.gallery-single-img-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--bg-soft);
  cursor: pointer;
  overflow: hidden;
}
.gallery-single-img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  transition: transform .5s var(--ease-out-expo), filter .4s;
}
.gallery-single-img-wrap:hover .gallery-single-img { transform: scale(1.05); filter: brightness(.92); }
.gallery-single-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0);
  transition: background .3s var(--ease-out-expo);
  pointer-events: none;
}
.gallery-single-img-wrap:hover .gallery-single-overlay { background: rgba(0,0,0,.32); }
.gallery-overlay-label {
  color: #fff; font-weight: 700; font-size: 14px;
  padding: 8px 24px; border-radius: 10px;
  background: rgba(255,255,255,.15); backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0; transform: translateY(6px);
  transition: opacity .25s, transform .3s var(--ease-spring);
  letter-spacing: .2px;
  border: 1px solid rgba(255,255,255,.12);
}
.gallery-single-img-wrap:hover .gallery-overlay-label { opacity: 1; transform: translateY(0); }
.gallery-skeleton {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--bg-soft) 25%, rgba(217,119,6,.06) 50%, var(--bg-soft) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.4s infinite;
}
@keyframes skeleton-wave { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.gallery-single-error {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; text-align: center;
  font-size: 13px; color: var(--muted);
}
.gallery-single-footer {
  display: flex;
  border-top: 1px solid var(--border);
  background: rgba(250,250,249,.6);
}
.gallery-footer-btn {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 12px 12px;
  background: transparent; color: var(--text-secondary);
  font-size: 12.5px; font-weight: 600; font-family: inherit;
  border: none; cursor: pointer;
  transition: background .2s, color .2s, transform .15s;
  line-height: 1; white-space: nowrap;
  text-decoration: none;
}
.gallery-footer-btn { flex: 1; min-width: 0; }
.gallery-footer-btn.hidden { display: none; }
.gallery-footer-btn + .gallery-footer-btn { border-left: 1px solid var(--border); }
.gallery-footer-btn.hidden + .gallery-footer-btn { border-left: none; }
.gallery-footer-btn:hover { background: var(--primary-soft); color: var(--primary-dark); }
.gallery-footer-btn:active { transform: scale(.97); }
.gallery-footer-btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
.gallery-footer-btn svg { flex-shrink: 0; transition: transform .2s; }
.gallery-footer-btn:hover svg { transform: rotate(-15deg); }

/* ── Huoma (活码) Panel ──────────────────────────── */
.huoma-img-wrap {
  position: relative; aspect-ratio: 1 / 1;
  background: #f5f3f0; overflow: hidden;
}
.huoma-placeholder {
  width: 100%; height: 100%; display: block;
  filter: blur(3px);
  opacity: .6;
}
.huoma-qr-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: contain;
  display: block; padding: 12px;
  background: #fff;
}
.huoma-qr-img.hidden { display: none; }
.huoma-generate-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; background: rgba(245,243,240,.6);
  border: none; cursor: pointer; font-family: inherit;
  transition: background .25s;
}
.huoma-generate-overlay:hover { background: rgba(245,243,240,.35); }
.huoma-generate-overlay.hidden { display: none; }
.huoma-generate-label {
  font-size: 15px; font-weight: 700; color: var(--primary-dark);
  padding: 10px 28px; border-radius: 10px;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 12px rgba(217,119,6,.12);
  border: 1px solid rgba(217,119,6,.15);
  transition: transform .2s var(--ease-spring), box-shadow .2s;
}
.huoma-generate-overlay:hover .huoma-generate-label {
  transform: scale(1.04);
  box-shadow: 0 4px 18px rgba(217,119,6,.18);
}
.huoma-generate-sub {
  font-size: 11.5px; color: var(--muted); font-weight: 500;
  margin-top: 2px;
}

/* ── Target Images Grid (新) ─────────────────────── */
.target-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
  border-radius: var(--r-lg);
  transition: background .2s var(--ease-out-expo);
  padding: 2px;
}
.target-images-grid.drag-over {
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 2px rgba(217,119,6,.15);
  border-radius: var(--r-lg);
}
/* 单个缩略图卡片 */
.tgi {
  display: flex; flex-direction: column;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1.5px solid var(--border);
  background: var(--card);
  animation: tgi-enter .35s var(--ease-out-expo) both;
  transition: border-color .2s, box-shadow .25s var(--ease-out-expo), transform .25s var(--ease-out-expo);
}
@keyframes tgi-enter {
  from { opacity: 0; transform: scale(.92) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.tgi:hover {
  border-color: rgba(217,119,6,.3);
  box-shadow: 0 4px 16px rgba(217,119,6,.12);
  transform: translateY(-2px);
}
.tgi-img-wrap {
  position: relative; overflow: hidden;
}
.tgi-img {
  width: 100%; aspect-ratio: 1 / 1;
  object-fit: cover; display: block;
  cursor: pointer;
  transition: transform .4s var(--ease-out-expo);
}
.tgi:hover .tgi-img { transform: scale(1.06); }
.tgi-del-btn {
  position: absolute; top: 5px; right: 5px;
  width: 22px; height: 22px;
  border-radius: 50%; border: none; cursor: pointer;
  background: rgba(0,0,0,.5); color: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 0; opacity: 0; transform: scale(.8);
  transition: opacity .2s, background .18s, transform .2s var(--ease-spring);
  backdrop-filter: blur(4px);
}
.tgi:hover .tgi-del-btn { opacity: 1; transform: scale(1); }
.tgi-del-btn:hover { background: rgba(220,38,38,.85); transform: scale(1.1); }
.tgi-meta {
  padding: 6px 8px;
  background: var(--card);
  display: flex; flex-direction: column; gap: 4px;
}
.tgi-expiry-label {
  display: flex; align-items: center; gap: 4px;
  cursor: pointer; font-size: 11px; font-weight: 500;
  color: var(--muted); line-height: 1.3;
  user-select: none;
  transition: color .15s;
}
.tgi-expiry-label:hover { color: var(--primary-dark); }
.tgi-expiry-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tgi-date-input {
  width: 100%; font-size: 11px; padding: 4px 6px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg-soft); color: var(--text);
  transition: border-color .15s;
}
.tgi-date-input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(217,119,6,.08); }

/* ── 上传 "+" 格子 ─────────────────────────────────── */
.tgi-add {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1 / 1; min-height: 80px;
  border: 2px dashed rgba(28,25,23,.1); border-radius: var(--r-md);
  cursor: pointer; color: var(--muted-light);
  transition: border-color .25s, color .25s, background .25s, transform .25s var(--ease-out-expo);
  animation: tgi-enter .35s var(--ease-out-expo) both;
}
.tgi-add:hover {
  border-color: var(--primary); color: var(--primary);
  background: var(--primary-soft); transform: translateY(-2px);
  box-shadow: var(--shadow-amber);
}
.tgi-add:active { transform: scale(.96); }
.tgi-add svg { transition: transform .25s var(--ease-spring); }
.tgi-add:hover svg { transform: rotate(90deg); }
.tgi-add--loading { pointer-events: none; opacity: .6; cursor: default; }
@keyframes spin { to { transform: rotate(360deg); } }
.target-images-grid.drag-over .tgi-add { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* 底部设置栏 */
/* ── ws-2 两栏布局 ─────────────────────────────── */
/* ── 统一布局：入口图 + 打开内容 ──────────────── */
.match-unified {
  display: flex; gap: 0; align-items: flex-start;
}
.match-key-col {
  flex: 0 0 220px; min-width: 0;
}
.match-key-col .gallery-single { max-width: 100%; }
.match-key-col .pick-source-tabs { margin-bottom: 12px; }
.match-col-divider {
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--border-strong) 20%, var(--border-strong) 80%, transparent);
  align-self: stretch; margin: 0 24px; flex-shrink: 0;
  min-height: 100px;
}
.match-target-col { flex: 1; min-width: 0; }
.match-target-hint {
  font-size: 13px; color: var(--muted-light); text-align: center;
  padding: 40px 16px; margin: 0;
  line-height: 1.6;
}
@media (max-width: 540px) {
  .match-unified { flex-direction: column; gap: 24px; }
  .match-key-col { flex: none; width: 100%; }
  .match-col-divider { display: none; }
}

.match-confirm-bar {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 24px 0 8px; margin-top: 16px;
  border-top: 1px solid var(--border);
}
.match-confirm-bar .btn { min-width: 200px; }
.confirm-hint {
  font-size: 12.5px; color: var(--muted-light); margin: 0;
}
.confirm-hint a { color: var(--primary); text-decoration: underline; }

.target-settings-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0 0; margin-top: 8px;
  border-top: 1px solid var(--border);
  gap: 12px; flex-wrap: wrap;
}
.target-count-badge {
  font-size: 11.5px; font-weight: 600;
  color: var(--muted-light); letter-spacing: .3px;
  font-variant-numeric: tabular-nums;
}
.target-display-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 500; color: var(--muted);
}
.display-mode-radios {
  display: flex; gap: 4px;
}
.display-mode-radio {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 999px; cursor: pointer;
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  border: 1.5px solid var(--border); background: var(--card);
  transition: all .2s var(--ease-out-expo);
  user-select: none;
}
.display-mode-radio input[type="radio"] { display: none; }
.display-mode-radio:hover {
  border-color: rgba(217,119,6,.2); color: var(--text-secondary);
}
.display-mode-radio:has(input:checked) {
  border-color: var(--primary); color: var(--primary-dark);
  background: var(--primary-soft);
  box-shadow: 0 1px 4px rgba(217,119,6,.1);
}

/* ── Target Images List (旧，保留兼容) ────────────── */
.target-images-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.target-image-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; background: var(--primary-soft);
  border-radius: 10px; border: 1px solid rgba(217,119,6,.12);
}
.target-image-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 7px; flex-shrink: 0; }

/* ── Wizard Stepper ─────────────────────────────── */
.wizard-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 28px 24px 24px;
  margin-bottom: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}
.wizard-stepper::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(217,119,6,.02) 0%, transparent 50%, rgba(217,119,6,.015) 100%);
  pointer-events: none;
}

.wizard-step {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; position: relative; z-index: 1; flex: 0 0 auto;
}
.wizard-step-dot {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  border: 2.5px solid var(--border);
  background: var(--card);
  color: var(--muted-light);
  transition: all .35s cubic-bezier(.4,0,.2,1);
  position: relative;
  box-shadow: 0 1px 3px rgba(28,25,23,.04);
}
.wizard-step-label {
  font-size: 12.5px; font-weight: 600;
  color: var(--muted-light);
  transition: color .3s;
  white-space: nowrap;
  letter-spacing: -.1px;
}

/* Connector line between steps */
.wizard-connector {
  flex: 1; height: 2.5px; min-width: 40px; max-width: 120px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 -2px;
  align-self: flex-start;
  margin-top: 19px; /* center with dot */
  transition: background .4s;
  position: relative;
  z-index: 0;
}

/* Active step */
.wizard-step.is-active .wizard-step-dot {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(217,119,6,.3), 0 0 0 4px rgba(217,119,6,.08);
}
.wizard-step.is-active .wizard-step-label {
  color: var(--primary-dark);
}

/* Completed step */
.wizard-step.is-done .wizard-step-dot {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 4px rgba(217,119,6,.2);
}
.wizard-step.is-done .wizard-step-label {
  color: var(--primary-dark);
}
/* Checkmark for done steps */
.wizard-step.is-done .wizard-step-dot::after {
  content: "";
  display: block;
  width: 10px; height: 6px;
  border-left: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}
.wizard-step.is-done .wizard-step-dot span { display: none; }

/* Completed connector */
.wizard-connector.is-done {
  background: var(--primary);
}

/* ── Workflow Sections ───────────────────────────── */
.workflow-section {
  padding: 24px;
  margin-bottom: 16px;
  border-radius: var(--r-lg);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  transition: box-shadow .3s, border-color .3s, background .4s, opacity .4s;
}
.workflow-section:last-child { margin-bottom: 0; }
.workflow-section:not(.is-locked):hover { box-shadow: var(--shadow-sm); }

.workflow-section-head {
  display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px;
}
.workflow-section-index {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(217,119,6,.25);
  transition: background .3s, box-shadow .3s;
}
.workflow-section-head h3 { font-size: 16px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.3px; transition: color .3s; }
.workflow-section-head p  { font-size: 13px; color: var(--muted); margin: 0; }

/* ── Locked workflow section ── */
.workflow-section.is-locked {
  opacity: 1; pointer-events: none; user-select: none;
  background: var(--bg-soft); border-color: transparent; box-shadow: none;
}
.workflow-section.is-locked .workflow-section-index { background: var(--muted-light); box-shadow: none; }
.workflow-section.is-locked .workflow-section-head h3 { color: var(--muted-light); }
.workflow-section.is-locked .workflow-section-head p  { color: var(--muted-light); }
.workflow-section.is-locked .target-display-mode,
.workflow-section.is-locked .target-images-list,
.workflow-section.is-locked .target-upload-form,
.workflow-section.is-locked #pay-form,
.workflow-section.is-locked #pay-step-hint { opacity: .25; }

.workflow-lock-hint {
  font-size: 13px; color: var(--primary-dark); font-weight: 500;
  padding: 10px 16px; margin-bottom: 16px; border-radius: 10px;
  background: var(--primary-soft); border: 1px solid rgba(217,119,6,.15);
  display: flex; align-items: center; gap: 8px;
}
.workflow-lock-hint::before { content: "\1F512"; font-size: 14px; }

/* ── Step Tabs ───────────────────────────────────── */
.step-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.step-tab {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card);
  cursor: pointer; text-align: left;
  transition: border-color .18s, background .18s;
}
.step-tab:hover { border-color: var(--primary); background: var(--primary-soft); }
.step-tab.is-active { border-color: var(--primary); background: var(--primary-soft); }
.step-nav {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px;
}
.step-tab-index {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-soft); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.step-tab.is-active .step-tab-index { background: var(--primary); color: #fff; }
.step-tab-copy strong { display: block; font-size: 13px; font-weight: 600; }
.step-tab-copy small  { font-size: 12px; color: var(--muted); }

/* ── Pick Source Tabs (小型 tab) ─────────────────── */
.pick-source-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.pick-tab {
  flex: 1; padding: 10px 14px; border-radius: 10px;
  border: 1.5px solid var(--border); background: var(--card);
  font-size: 14px; font-weight: 700; color: var(--text-secondary);
  cursor: pointer; transition: all .25s var(--ease-out-expo); box-shadow: var(--shadow-xs);
  position: relative; text-align: center; line-height: 1.2;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.pick-tab small {
  display: block; font-size: 11px; font-weight: 500;
  opacity: .6; letter-spacing: .2px;
}
.pick-tab:hover {
  color: var(--primary-dark); border-color: rgba(217,119,6,.25);
  background: var(--primary-soft); box-shadow: var(--shadow-sm); transform: translateY(-1px);
}
.pick-tab.is-active {
  background: var(--primary);
  color: #fff; border-color: transparent;
  box-shadow: 0 2px 10px rgba(217,119,6,.3), 0 0 0 3px rgba(217,119,6,.08);
}
.pick-tab.is-active small { opacity: .75; }
/* Sub-tabs (source selection — smaller) */
#key-select-panel > .pick-source-tabs .pick-tab {
  padding: 7px 16px; font-size: 13px; font-weight: 500;
  border-radius: 8px; box-shadow: none; border-width: 1px;
}
#key-select-panel > .pick-source-tabs .pick-tab.is-active { background: var(--primary); box-shadow: 0 2px 6px rgba(217,119,6,.2); }
#key-select-panel > .pick-source-tabs .pick-tab:hover { transform: none; box-shadow: none; }

/* ── Display Mode ────────────────────────────────── */
.target-display-mode { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.label-inline { font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; }

/* ── Result messages ─────────────────────────────── */
.result { font-size: 13px; border-radius: 8px; padding: 0; }
.result:not(:empty) { padding: 10px 14px; margin-top: 6px; }
.result.success { background: #d1fae5; color: #065f46; }
.result.error   { background: #fee2e2; color: #991b1b; }
.result.warning { background: #fef3c7; color: #92400e; }
.result.info    { background: #e0f2fe; color: #0c4a6e; }

/* ── Toast Region ────────────────────────────────── */
.toast-region {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  max-width: 320px; width: calc(100vw - 48px);
  pointer-events: none;
}
.toast {
  padding: 12px 16px; border-radius: 12px;
  font-size: 13.5px; font-weight: 500;
  box-shadow: 0 8px 32px rgba(28,25,23,.15), 0 2px 6px rgba(28,25,23,.08);
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: auto;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: toast-slide-in .35s var(--ease-out-expo);
}
@keyframes toast-slide-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
.toast.success { background: rgba(209,250,229,.95); color: #065f46; border: 1px solid rgba(5,150,105,.12); }
.toast.error   { background: rgba(254,226,226,.95); color: #991b1b; border: 1px solid rgba(220,38,38,.12); }
.toast.warning { background: rgba(254,243,199,.95); color: #92400e; border: 1px solid rgba(217,119,6,.12); }
.toast.info    { background: rgba(224,242,254,.95); color: #0c4a6e; border: 1px solid rgba(14,165,233,.12); }

/* ── Me Page ─────────────────────────────────────── */
.me-hero { padding: 24px; }
.me-hero-head {
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 20px;
}
.me-hero-head h1 { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.me-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.me-summary-strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.me-summary-pill {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 14px 12px; background: var(--primary-soft);
  border: 1px solid rgba(217,119,6,.12); border-radius: 10px;
  text-align: center;
}
.me-summary-pill span { font-size: 12px; color: var(--muted); }
.me-summary-pill strong { font-size: 20px; font-weight: 700; color: var(--primary-dark); }

.me-filter-summary { font-size: 13px; color: var(--muted); margin: 0; }
.me-record-grid { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }

/* ── Record Cards (rc-*) ──────────────────────────── */
@keyframes rc-enter {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.rc-card {
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: border-color .25s, box-shadow .3s var(--ease-out-expo), transform .3s var(--ease-out-expo);
  animation: rc-enter .4s var(--ease-out-expo) both;
}
.rc-card:hover {
  border-color: rgba(217,119,6,.16);
  box-shadow: 0 6px 24px rgba(217,119,6,.08), 0 2px 6px rgba(28,25,23,.04);
  transform: translateY(-1px);
}
.rc-card-inner {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0;
}
.rc-key-visual {
  position: relative;
  overflow: hidden;
  background: var(--bg-soft);
  aspect-ratio: 1 / 1;
  align-self: start;
}
.rc-key-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: transform .3s ease;
}
.rc-card:hover .rc-key-img { transform: scale(1.04); }
.rc-key-status {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 2;
  backdrop-filter: blur(6px);
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.rc-key-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(28,25,23,.55) 0%, transparent 60%);
  display: flex; align-items: flex-end; justify-content: center;
  gap: 12px; padding: 10px;
  opacity: 0; transition: opacity .22s;
}
.rc-card:hover .rc-key-overlay { opacity: 1; }
.rc-key-overlay a {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,.2); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  color: #fff; transition: background .18s;
}
.rc-key-overlay a:hover { background: rgba(255,255,255,.35); }

.rc-info {
  padding: 14px 16px;
  display: flex; flex-direction: column;
  justify-content: center;
  gap: 10px; min-width: 0;
}
.rc-info-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.rc-status {
  font-size: 11.5px; font-weight: 600;
  padding: 2px 10px; border-radius: 999px;
  white-space: nowrap; letter-spacing: .2px;
}
.rc-status--success { background: #d1fae5; color: #065f46; }
.rc-status--warning { background: #fef3c7; color: #92400e; }
.rc-status--normal  { background: var(--primary-soft); color: var(--primary-dark); }
.rc-time {
  font-size: 12px; color: var(--muted-light); white-space: nowrap;
  margin-left: auto;
}

/* Target mini row */
.rc-targets-row {
  display: flex; align-items: center; gap: 8px;
  min-height: 56px; flex-wrap: wrap;
}
.rc-target-mini {
  width: 56px; height: 56px; border-radius: 8px;
  object-fit: cover; border: 1px solid var(--border);
  cursor: pointer; flex-shrink: 0;
  transition: transform .18s, box-shadow .18s;
}
.rc-target-mini:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 10px rgba(28,25,23,.15);
  z-index: 1; position: relative;
}
.rc-target-more {
  width: 56px; height: 56px; border-radius: 8px;
  background: var(--bg-soft); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: var(--muted);
  flex-shrink: 0;
}
.rc-targets-label {
  font-size: 12px; color: var(--muted); margin-left: 2px;
}
.rc-targets-text { color: var(--muted); }
.rc-targets-text svg { flex-shrink: 0; opacity: .6; }
.rc-targets-empty .rc-targets-label {
  color: var(--muted-light); font-style: italic;
}

/* Card actions */
.rc-actions {
  display: flex; gap: 8px; margin-top: auto;
  flex-wrap: wrap; align-items: center;
}
.rc-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 14px; border-radius: 8px;
  font-size: 12.5px; font-weight: 600; font-family: inherit;
  border: 1px solid transparent; cursor: pointer;
  transition: all .18s; white-space: nowrap;
  line-height: 1.4; text-decoration: none;
}
.rc-btn-primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 1px 4px rgba(217,119,6,.22);
}
.rc-btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(217,119,6,.3);
  transform: translateY(-1px);
  color: #fff;
}
.rc-btn-outline {
  color: var(--text-secondary);
  background: var(--card);
  border-color: var(--border);
}
.rc-btn-outline:hover {
  border-color: rgba(217,119,6,.25);
  color: var(--primary-dark);
  background: var(--primary-soft);
}
.rc-btn-ghost {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  padding: 5px 10px;
}
.rc-btn-ghost:hover {
  color: var(--primary-dark);
  background: var(--primary-soft);
}
.rc-btn-ghost svg { flex-shrink: 0; }

/* Legacy compat: keep old class names working for non-card elements */
.me-record-kicker { font-size: 11px; color: var(--muted-light); text-transform: uppercase; letter-spacing: .3px; margin: 0 0 2px; }
.me-record-id-group strong { font-size: 14px; display: block; margin-bottom: 2px; }
.me-record-time { font-size: 12px; color: var(--muted); margin: 0; }
.me-inline-hint { font-size: 13px; color: var(--muted); }
.me-record-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

.me-target-preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.me-target-thumb {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--border); cursor: pointer;
}

.me-target-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px;
  margin-top: 8px;
}
.me-target-card {
  background: rgba(28,25,23,.02); border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border);
}
.me-target-card .me-target-thumb {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
  border: none; border-radius: 0;
}
.me-target-copy {
  padding: 6px 8px; font-size: 12px; color: var(--muted);
}
.me-target-copy strong { display: block; font-size: 12px; font-weight: 600; color: var(--text); }
.me-target-copy span { font-size: 11px; }
.me-target-card-single {
  display: flex; align-items: center; gap: 12px;
  background: rgba(28,25,23,.02); border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border); margin-top: 8px;
}
.me-target-card-single .me-target-thumb {
  width: 80px; height: 80px; aspect-ratio: auto; flex-shrink: 0;
  border: none; border-radius: 0;
}
.me-target-text-card {
  padding: 12px; background: rgba(28,25,23,.02); border-radius: 8px;
  border: 1px solid var(--border); margin-top: 8px;
}
.me-target-text-card strong { display: block; font-size: 13px; margin-bottom: 4px; }
.me-target-text-card p { font-size: 13px; color: var(--muted); margin: 0 0 6px; word-break: break-all; }
.me-target-text-card a { font-size: 13px; }
.me-target-empty {
  padding: 20px; background: rgba(28,25,23,.02); border-radius: 8px;
  border: 1px dashed var(--border); text-align: center; margin-top: 8px;
}
.me-target-empty strong { font-size: 14px; }
.me-target-empty p { font-size: 13px; margin: 4px 0 0; }

.me-target-block-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

/* ── Me Page: Key image cell ────────────────────── */
.key-image-cell { text-align: center; }
.key-image-thumb {
  width: 100%; max-height: 200px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--border); cursor: pointer;
}
.key-image-actions {
  display: flex; gap: 8px; justify-content: center; margin-top: 8px; font-size: 13px;
}

/* ── Clickable image previews ───────────────────── */
.me-target-thumb, .gallery-card img { cursor: pointer; }

/* ── Image Lightbox ────────────────────────────── */
.img-lightbox-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(28,25,23,.85); backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; cursor: pointer;
  animation: lightbox-fade-in .25s var(--ease-out-expo);
}
@keyframes lightbox-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.img-lightbox-overlay img {
  max-width: 90vw; max-height: 85vh; object-fit: contain;
  border-radius: 12px; box-shadow: 0 16px 60px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.2);
  cursor: default;
  animation: lightbox-img-in .3s var(--ease-out-expo);
}
@keyframes lightbox-img-in {
  from { transform: scale(.92); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.img-lightbox-close {
  position: absolute; top: 16px; right: 20px;
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.08);
  color: #fff; font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, transform .2s;
  backdrop-filter: blur(6px);
}
.img-lightbox-close:hover { background: rgba(255,255,255,.25); transform: scale(1.08); }

/* ── Login Card ──────────────────────────────────── */
.login-card { max-width: 480px; margin: 40px auto; }
.login-card h1 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }

/* ── Input inline action ─────────────────────────── */
.input-inline-action { display: flex; gap: 8px; }
.input-inline-action .form-control { flex: 1; min-width: 0; }

/* ── Stack (vertical gap) ────────────────────────── */
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ── Match Workspace ─────────────────────────────── */
.match-workspace { background: transparent !important; border: none !important; box-shadow: none !important; padding: 0 !important; }

.match-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 22px;
  background: var(--card); border-radius: var(--r-lg);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}
.match-header::after {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--primary), #fbbf24, var(--primary));
  opacity: .5;
}
.match-header-left { display: flex; align-items: center; gap: 12px; }
.match-header-left h1 { font-size: 18px; font-weight: 800; margin: 0; letter-spacing: -.4px; }

/* ── Refresh Gallery Button ── */
#refresh-gallery {
  padding: 6px 16px; border-radius: 8px; font-weight: 600; font-size: 13px;
  border: 1.5px solid var(--border); background: var(--card); color: var(--primary-dark);
  transition: all .2s;
}
#refresh-gallery:hover { background: var(--primary-soft); border-color: rgba(217,119,6,.25); box-shadow: var(--shadow-sm); }

/* ── Key Selected Panel ──────────────────────────── */
.selected-key-layout { display: grid; grid-template-columns: 160px 1fr; gap: 16px; align-items: start; }
.selected-key-img { max-width: 100%; border-radius: 10px; border: 1px solid var(--border); }

/* ── Footer ──────────────────────────────────────── */
.footer-note {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 4px; font-size: 12.5px; color: var(--muted-light);
  border-top: 1px solid var(--border); margin-top: 40px; flex-wrap: wrap; gap: 6px;
  letter-spacing: .2px;
}

/* ── Focus Rings ─────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
button:focus-visible, .btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(217,119,6,.15);
}

/* ── Smooth Scroll ───────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Utilities ───────────────────────────────────── */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.hidden { display: none !important; }
.small  { font-size: 12.5px; }
.muted  { color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Scan Demo Animation ─────────────────────────── */
.scan-demo {
  position: relative; overflow: hidden; border-radius: var(--r-lg);
  max-width: 320px; margin: 20px auto; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.scan-demo img { width: 100%; display: block; }
.scan-demo-cover {
  position: absolute; inset: 0; z-index: 2;
  animation: scan-hold 1.2s ease-in forwards;
}
.scan-demo-cover img { width: 100%; height: 100%; object-fit: cover; }
.scan-demo-scanline {
  position: absolute; left: 0; right: 0; height: 3px; z-index: 3;
  background: linear-gradient(90deg, transparent, rgba(217,119,6,.9), transparent);
  box-shadow: 0 0 12px 4px rgba(217,119,6,.4);
  animation: scan-sweep 1.2s ease-in-out forwards;
}
.scan-demo-cover.fade-out {
  transition: opacity .6s ease-out;
  opacity: 0;
}
@keyframes scan-sweep {
  0%   { top: 0; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}
@keyframes scan-hold {
  0%   { opacity: 1; }
  95%  { opacity: 1; }
  100% { opacity: 1; }
}

/* ── Plan Badge ──────────────────────────────────── */
.plan-badge {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; vertical-align: middle;
  background: var(--bg-soft); color: var(--muted);
  border: 1px solid var(--border);
}
.plan-badge--pro {
  background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e;
  border-color: rgba(217,119,6,.2);
}
.plan-badge--ultra {
  background: linear-gradient(135deg, #1e293b, #334155); color: #fbbf24;
  border-color: rgba(51,65,85,.3);
}

/* ── Quota Display (match page) ─────────────────── */
.quota-display {
  font-size: 11.5px; font-weight: 600;
  color: var(--primary-dark); padding: 4px 12px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(217,119,6,.06), rgba(251,191,36,.08));
  border: 1px solid rgba(217,119,6,.12);
  white-space: nowrap;
  letter-spacing: .2px;
}
.quota-display a { color: var(--primary-dark); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }

/* ── Pricing Page ───────────────────────────────── */
.pricing-cycle-toggle { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.pricing-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-top: 8px;
}
.pricing-card {
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: var(--r-lg); padding: 24px 20px; text-align: center;
  display: flex; flex-direction: column; gap: 16px;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.pricing-card:hover {
  border-color: rgba(217,119,6,.25); box-shadow: 0 4px 16px rgba(217,119,6,.08);
  transform: translateY(-2px);
}
.pricing-card--active {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(217,119,6,.1);
}
.pricing-card-header h3 { font-size: 18px; font-weight: 700; margin: 0 0 6px; }
.pricing-price { font-size: 28px; font-weight: 800; color: var(--primary-dark); }
.pricing-features {
  list-style: none; padding: 0; margin: 0; font-size: 14px; color: var(--text-secondary);
  display: flex; flex-direction: column; gap: 6px; flex: 1;
}
.pricing-features li { padding: 4px 0; }
.pricing-features .muted { color: var(--muted-light); }
.pricing-action { margin-top: auto; }

/* ── Code Stats Panel (me page) ─────────────────── */
.code-stats-panel { margin-top: 12px; padding: 12px; background: rgba(28,25,23,.02); border-radius: 8px; }
.code-stats-summary {
  display: flex; gap: 16px; margin-bottom: 10px; font-size: 13px; color: var(--muted);
}
.code-stats-summary strong { color: var(--text); font-weight: 600; }
.stats-bar-chart {
  display: flex; align-items: flex-end; gap: 4px; height: 80px;
  padding: 4px 0; border-bottom: 1px solid var(--border);
}
.stats-bar-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0;
  height: 100%;
}
.stats-bar {
  width: 100%; max-width: 20px; background: var(--primary); border-radius: 3px 3px 0 0;
  min-height: 2px; margin-top: auto;
}
.stats-bar-item span { font-size: 10px; color: var(--muted-light); white-space: nowrap; }

/* ── Bootstrap .btn-primary override ─────────────── */
.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-dark);
  --bs-btn-hover-border-color: var(--primary-dark);
  --bs-btn-active-bg: #92400e;
  --bs-btn-active-border-color: #92400e;
  --bs-btn-disabled-bg: #fbbf24;
  --bs-btn-disabled-border-color: #fbbf24;
  font-weight: 600;
}
.btn-outline-primary {
  --bs-btn-color: var(--primary-dark);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary);
  --bs-btn-hover-border-color: var(--primary);
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--primary-dark);
  --bs-btn-active-border-color: var(--primary-dark);
  font-weight: 600;
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 768px) {
  .shell { padding: 10px 12px 40px; }
  .topbar { top: 6px; border-radius: 12px !important; }
  .hero { padding: 28px 20px; }
  .target-upload-layout { grid-template-columns: 1fr; }
  .step-tabs { grid-template-columns: 1fr; }
  .rc-card-inner { grid-template-columns: 130px 1fr; }
  .rc-key-overlay { opacity: 1; }
  .rc-info { padding: 12px 14px; gap: 8px; }
  .rc-target-mini { width: 48px; height: 48px; }
  .rc-target-more { width: 48px; height: 48px; }
  .me-summary-strip { grid-template-columns: 1fr; }
  .me-target-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
  .selected-key-layout { grid-template-columns: 1fr; }
  .key-selected-card { grid-template-columns: 1fr; }
  .workflow-section { padding: 18px 16px; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .login-card { margin: 20px auto; }
  .me-hero-head { flex-direction: column; }
  .wizard-stepper { padding: 20px 16px 18px; gap: 0; }
  .wizard-step-dot { width: 32px; height: 32px; font-size: 12px; border-width: 2px; }
  .wizard-step-label { font-size: 11px; }
  .wizard-connector { min-width: 24px; margin-top: 16px; }
}

@media (max-width: 480px) {
  .gallery-grid { grid-template-columns: 1fr; }
  .pick-tab { padding: 8px 14px; font-size: 13px; }
  .toast-region { right: 10px; left: 10px; width: auto; }
  .rc-card-inner { grid-template-columns: 110px 1fr; }
  .rc-target-mini { width: 44px; height: 44px; }
  .rc-target-more { width: 44px; height: 44px; }
  .rc-info { padding: 10px 12px; }
  .rc-actions { gap: 6px; }
  .rc-btn { padding: 4px 10px; font-size: 12px; }
}

