/* =========================================================
   CreativaAI Renewal — Design Tokens & Utilities
   ========================================================= */

:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface-2: #f1f2f7;
  --border: #e6e7ee;
  --text: #15161d;
  --text-muted: #6b6e7d;
  --text-soft: #9aa0b1;
  --primary: #6366f1;       /* indigo-500 */
  --primary-strong: #4f46e5;
  --accent: #a855f7;        /* purple-500 */
  --grad-start: #6366f1;
  --grad-end: #a855f7;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --shadow-sm: 0 1px 2px rgba(20,22,40,.04), 0 1px 1px rgba(20,22,40,.03);
  --shadow-md: 0 6px 16px rgba(20,22,40,.06), 0 2px 4px rgba(20,22,40,.04);
  --shadow-lg: 0 20px 40px rgba(20,22,40,.10), 0 8px 16px rgba(20,22,40,.06);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html.dark {
  --bg: #0e0f15;
  --surface: #161821;
  --surface-2: #1d2030;
  --border: #2a2e42;
  --text: #f1f2f7;
  --text-muted: #a6abc0;
  --text-soft: #6b7088;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 6px 16px rgba(0,0,0,.4);
  --shadow-lg: 0 20px 40px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ----- Layout shell ----- */
.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.app-shell.collapsed { grid-template-columns: 72px 1fr; }
@media (max-width: 900px) { .app-shell, .app-shell.collapsed { grid-template-columns: 1fr; } }

/* ----- Sidebar ----- */
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 18px 14px; display: flex; flex-direction: column; gap: 6px;
  transition: width .2s ease;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 16px; font-weight: 800; font-size: 19px; letter-spacing: -.02em;
}
.brand .logo-mark {
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, var(--grad-start), var(--grad-end));
  display: grid; place-items: center; color: #fff; font-weight: 800;
  box-shadow: 0 6px 18px rgba(99,102,241,.35);
}
.side-section { padding: 12px 8px 4px; font-size: 11px; font-weight: 700;
  color: var(--text-soft); text-transform: uppercase; letter-spacing: .08em; }

.side-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px; color: var(--text-muted);
  font-weight: 600; font-size: 14px; position: relative;
  transition: background .15s, color .15s;
}
.side-item:hover { background: var(--surface-2); color: var(--text); }
.side-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,.12), rgba(168,85,247,.10));
  color: var(--text);
}
.side-item.active::before {
  content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px;
  background: linear-gradient(180deg, var(--grad-start), var(--grad-end));
  border-radius: 3px;
}
.side-item .icon { width: 20px; height: 20px; flex-shrink: 0; }
.app-shell.collapsed .side-item span,
.app-shell.collapsed .brand .brand-name,
.app-shell.collapsed .side-section { display: none; }
.app-shell.collapsed .side-item { justify-content: center; }

.side-foot { margin-top: auto; padding: 12px 8px; border-top: 1px solid var(--border); display: grid; gap: 6px; }

/* ----- Topbar ----- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 28px; background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
html.dark .topbar { background: rgba(22,24,33,.85); }

.search-wrap {
  flex: 1; max-width: 640px; margin: 0 auto;
  position: relative; display: flex; align-items: center;
}
.search-input {
  width: 100%; padding: 10px 40px 10px 42px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  font-size: 14px; outline: none; transition: border .15s, box-shadow .15s;
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,.15); }
.search-icon { position: absolute; left: 14px; color: var(--text-soft); pointer-events: none; }
.search-kbd { position: absolute; right: 10px; font-size: 11px; color: var(--text-soft);
  background: var(--surface); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border); }

.topbar-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--text-muted); display: grid; place-items: center;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.has-badge { position: relative; }
.icon-btn .badge {
  position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; display: grid; place-items: center;
}

.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--grad-start), var(--grad-end));
  color: #fff; display: grid; place-items: center; font-weight: 700; cursor: pointer;
  border: 2px solid var(--surface);
}

.wallet-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px; background: var(--surface-2);
  font-weight: 700; font-size: 13px; color: var(--text);
  border: 1px solid var(--border);
}
.wallet-chip .dot { width: 8px; height: 8px; border-radius: 50%;
  background: linear-gradient(135deg, var(--grad-start), var(--grad-end)); }

/* ----- Page container ----- */
.page { padding: 28px clamp(20px, 4vw, 48px); max-width: 1440px; margin: 0 auto; }
.page-title { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 8px 0; }
.page-sub { color: var(--text-muted); font-size: 14px; }

/* ----- Hero ----- */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius-xl);
  padding: 56px 48px; color: #fff; margin-bottom: 36px;
  background: radial-gradient(120% 120% at 0% 0%, #4f46e5 0%, #6d28d9 40%, #be185d 100%);
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(600px 400px at 80% -10%, rgba(255,255,255,.18), transparent 60%),
    radial-gradient(500px 400px at 100% 100%, rgba(255,255,255,.12), transparent 60%);
  pointer-events: none;
}
.hero-grid { position: relative; display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } .hero { padding: 36px 24px; } }
.hero h1 { font-size: clamp(28px, 4vw, 44px); line-height: 1.15; margin: 0 0 14px; letter-spacing: -.02em; font-weight: 800; }
.hero p { font-size: 16px; opacity: .9; margin: 0 0 24px; max-width: 540px; }

.hero-search {
  display: flex; gap: 8px; background: rgba(255,255,255,.14);
  padding: 8px; border-radius: 16px; backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.2);
}
.hero-search input {
  flex: 1; background: transparent; border: 0; outline: 0; color: #fff;
  font-size: 15px; padding: 12px 14px;
}
.hero-search input::placeholder { color: rgba(255,255,255,.7); }
.hero-search button {
  background: #fff; color: #4f46e5; border: 0; border-radius: 12px;
  padding: 10px 20px; font-weight: 700; font-size: 14px;
  transition: transform .1s;
}
.hero-search button:hover { transform: translateY(-1px); }

.hero-stats { display: flex; gap: 28px; margin-top: 28px; flex-wrap: wrap; }
.hero-stats .stat { display: flex; flex-direction: column; gap: 2px; }
.hero-stats .stat .v { font-size: 22px; font-weight: 800; }
.hero-stats .stat .l { font-size: 12px; opacity: .85; }

.hero-art {
  position: relative; aspect-ratio: 4/3; border-radius: 20px; overflow: hidden;
  background: rgba(0,0,0,.2);
}
.hero-art .tile {
  position: absolute; border-radius: 14px; overflow: hidden;
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
  transform: rotate(var(--rot, 0deg));
}
.hero-art .tile img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ----- Filter chips ----- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  transition: all .15s;
}
.chip:hover { color: var(--text); border-color: var(--text-soft); }
.chip.active {
  background: linear-gradient(135deg, var(--grad-start), var(--grad-end));
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 12px rgba(99,102,241,.3);
}
.chip .count { font-size: 11px; opacity: .8; }

/* ----- Section ----- */
.section { margin-bottom: 36px; }
.section-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 16px; gap: 16px; }
.section-head h2 { font-size: 20px; font-weight: 800; margin: 0; letter-spacing: -.01em; }
.section-head .more { color: var(--primary); font-size: 13px; font-weight: 600; }

/* ----- Workflow grid ----- */
.wf-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.wf-card {
  position: relative; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  overflow: hidden; transition: transform .2s, box-shadow .2s, border-color .2s;
  display: flex; flex-direction: column;
}
.wf-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: transparent; }
.wf-card .thumb {
  aspect-ratio: 4/3; background: var(--surface-2);
  position: relative; overflow: hidden;
}
.wf-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.wf-card:hover .thumb img { transform: scale(1.06); }
.wf-card .thumb::after {
  content: ''; position: absolute; inset: auto 0 0 0; height: 60%;
  background: linear-gradient(to top, rgba(0,0,0,.55), transparent);
  pointer-events: none;
}
.wf-card .badge {
  position: absolute; top: 10px; left: 10px;
  background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(6px);
  padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
}
.wf-card .badge.hot { background: linear-gradient(135deg, #ef4444, #f97316); }
.wf-card .badge.new { background: linear-gradient(135deg, #10b981, #06b6d4); }
.wf-card .badge.agent { background: linear-gradient(135deg, var(--grad-start), var(--grad-end)); }
.wf-card .meta {
  padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px;
}
.wf-card .meta h3 { font-size: 15px; font-weight: 700; margin: 0; }
.wf-card .meta .desc { font-size: 12.5px; color: var(--text-muted); }
.wf-card .meta .foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--border);
}
.wf-card .power {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--text-muted); font-weight: 600;
}
.wf-card .fav {
  width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2);
  display: grid; place-items: center; color: var(--text-soft);
}
.wf-card .fav.on { color: #f59e0b; }

/* category accent strip */
.wf-card[data-cat="thumbnail"] { box-shadow: inset 0 3px 0 #6366f1; }
.wf-card[data-cat="fashion"] { box-shadow: inset 0 3px 0 #ec4899; }
.wf-card[data-cat="video"] { box-shadow: inset 0 3px 0 #10b981; }
.wf-card[data-cat="edit"] { box-shadow: inset 0 3px 0 #f59e0b; }

/* ----- Buttons ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; transition: transform .1s, box-shadow .15s, background .15s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--grad-start), var(--grad-end));
  color: #fff; box-shadow: 0 6px 18px rgba(99,102,241,.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(99,102,241,.45); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-ghost:hover { background: var(--border); }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--text-soft); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }

/* ----- Editor 3-pane layout ----- */
.editor {
  display: grid; gap: 18px;
  grid-template-columns: 300px 1fr 280px;
  align-items: start;
}
@media (max-width: 1180px) { .editor { grid-template-columns: 280px 1fr; } .editor .panel.right { display: none; } }
@media (max-width: 800px)  { .editor { grid-template-columns: 1fr; } }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px;
}
.panel h3 { font-size: 14px; font-weight: 700; margin: 0 0 14px; letter-spacing: -.01em; }
.panel .field { margin-bottom: 14px; }
.panel .field label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; }
.panel input[type=text], .panel input[type=number], .panel select, .panel textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-size: 13.5px; outline: none;
  transition: border .15s, box-shadow .15s;
  font-family: inherit;
}
.panel textarea { min-height: 96px; resize: vertical; }
.panel input:focus, .panel select:focus, .panel textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

.opt-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 6px; }
.opt {
  padding: 8px 4px; border-radius: 8px; background: var(--surface-2);
  border: 1px solid var(--border); font-size: 12px; font-weight: 600;
  text-align: center; transition: all .12s; color: var(--text-muted);
}
.opt:hover { border-color: var(--text-soft); color: var(--text); }
.opt.active {
  background: linear-gradient(135deg, var(--grad-start), var(--grad-end));
  color: #fff; border-color: transparent;
}

.uploader {
  border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--surface-2); padding: 28px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center; cursor: pointer; transition: all .2s;
}
.uploader:hover { border-color: var(--primary); background: rgba(99,102,241,.04); }
.uploader.drag { border-color: var(--primary); background: rgba(99,102,241,.08); }
.uploader .ic { width: 44px; height: 44px; color: var(--text-soft); }
.uploader .hint { font-size: 12.5px; color: var(--text-muted); }
.uploader.has-img { padding: 0; border-style: solid; }
.uploader.has-img img { width: 100%; height: auto; border-radius: calc(var(--radius) - 2px); display: block; }

.preview-stage {
  min-height: 360px; border-radius: var(--radius); background: var(--surface-2);
  border: 1px solid var(--border); display: grid; place-items: center;
  position: relative; overflow: hidden;
}
.preview-stage img, .preview-stage video {
  max-width: 100%; max-height: 480px; border-radius: calc(var(--radius) - 2px); display: block;
}
.preview-stage .placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--text-soft); padding: 40px;
  text-align: center;
}

/* ----- Generate bar ----- */
.gen-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); margin-top: 16px;
  position: sticky; bottom: 16px;
  box-shadow: var(--shadow-md);
}
.gen-meta { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--text-muted); }
.gen-meta b { color: var(--text); font-weight: 700; font-size: 14px; }
.gen-btn {
  padding: 12px 28px; font-size: 15px;
  background: linear-gradient(135deg, var(--grad-start), var(--grad-end));
  color: #fff; border: 0; border-radius: 12px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 8px 20px rgba(99,102,241,.4);
  transition: transform .1s;
}
.gen-btn:hover { transform: translateY(-1px); }
.gen-btn:disabled { opacity: .55; cursor: not-allowed; }

/* loading shimmer */
.shimmer {
  position: relative; overflow: hidden;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--border) 50%, var(--surface-2) 100%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius);
}
@keyframes shimmer { 0% { background-position: -200% 0;} 100% { background-position: 200% 0;} }

.progress-ring { display: inline-block; width: 56px; height: 56px; }
.progress-ring circle { transition: stroke-dashoffset .15s linear; }

/* ----- Lightbox ----- */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.85);
  display: none; align-items: center; justify-content: center; z-index: 100;
  padding: 40px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 90vw; max-height: 90vh; border-radius: 12px; }
.lightbox .nav, .lightbox .close {
  position: absolute; background: rgba(255,255,255,.1); color: #fff;
  border: 0; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(8px);
}
.lightbox .close { top: 24px; right: 24px; }
.lightbox .prev { left: 24px; top: 50%; transform: translateY(-50%); }
.lightbox .next { right: 24px; top: 50%; transform: translateY(-50%); }

/* ----- Toast ----- */
.toasts { position: fixed; top: 80px; right: 24px; z-index: 90; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  background: var(--surface); border: 1px solid var(--border); padding: 12px 18px;
  border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 600;
  min-width: 240px; pointer-events: auto;
  animation: toastIn .25s ease-out;
  display: flex; align-items: center; gap: 10px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }
@keyframes toastIn { from { transform: translateX(20px); opacity: 0;} to { transform: none; opacity: 1;} }

/* ----- Modal ----- */
.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; z-index: 80; padding: 20px;
}
.modal-back.open { display: flex; animation: fadeIn .15s; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg); padding: 28px;
  max-width: 480px; width: 100%; box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease-out;
}
.modal h3 { margin: 0 0 8px; font-size: 18px; font-weight: 700; }
.modal p { color: var(--text-muted); font-size: 14px; margin: 0 0 20px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
@keyframes fadeIn { from { opacity: 0;} to { opacity: 1;} }
@keyframes modalIn { from { transform: scale(.96); opacity: 0;} to { transform: none; opacity: 1;} }

/* ----- Wallet ----- */
.wallet-hero {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; margin-bottom: 24px;
}
@media (max-width: 900px) { .wallet-hero { grid-template-columns: 1fr; } }
.wallet-card {
  position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 28px;
  color: #fff;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #ec4899 100%);
}
.wallet-card .balance { font-size: clamp(36px, 5vw, 52px); font-weight: 800; letter-spacing: -.03em; }
.wallet-card .label { font-size: 13px; opacity: .9; margin-bottom: 4px; }
.wallet-card .stat-row { display: flex; gap: 24px; margin-top: 24px; flex-wrap: wrap; }
.wallet-card .stat-row .v { font-weight: 700; font-size: 18px; }
.wallet-card .stat-row .l { font-size: 12px; opacity: .85; }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.plan {
  position: relative; border-radius: var(--radius); padding: 18px;
  background: var(--surface); border: 1px solid var(--border);
  transition: all .15s;
}
.plan:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.plan.popular { border-color: var(--primary); }
.plan.popular::before {
  content: '인기'; position: absolute; top: -10px; right: 14px;
  background: linear-gradient(135deg, var(--grad-start), var(--grad-end));
  color: #fff; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
}
.plan .name { font-weight: 700; font-size: 14px; }
.plan .power { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0; }
.plan .price { color: var(--text-muted); font-size: 13px; margin-bottom: 12px; }
.plan ul { list-style: none; padding: 0; margin: 0 0 14px; font-size: 12.5px; color: var(--text-muted); }
.plan li { padding: 3px 0; }
.plan li::before { content: '✓ '; color: var(--success); font-weight: 700; }

.tx-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tx-table th, .tx-table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.tx-table th { font-size: 12px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.tx-table tr:last-child td { border-bottom: 0; }
.tx-table .pos { color: var(--success); font-weight: 700; }
.tx-table .neg { color: var(--danger); font-weight: 700; }

/* ----- Empty state ----- */
.empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty .ic { font-size: 48px; margin-bottom: 12px; }

/* ----- Misc utilities ----- */
.hide { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }

/* mobile drawer */
.drawer-back {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40;
}
.drawer-back.open { display: block; }
@media (max-width: 900px) {
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 260px; z-index: 50;
    transform: translateX(-100%); transition: transform .2s ease;
    border-right: 1px solid var(--border);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-grid !important; }
}
.menu-toggle { display: none; }

/* faq accordion */
.faq { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item:last-child { border-bottom: 0; }
.faq-q {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; background: var(--surface); cursor: pointer; font-weight: 600; font-size: 14px;
}
.faq-q:hover { background: var(--surface-2); }
.faq-a {
  max-height: 0; overflow: hidden; transition: max-height .25s ease, padding .25s ease;
  padding: 0 18px; color: var(--text-muted); font-size: 13.5px;
}
.faq-item.open .faq-a { max-height: 300px; padding: 4px 18px 16px; }
.faq-item.open .chev { transform: rotate(180deg); }
.chev { transition: transform .2s; }

/* progress bar */
.progress { width: 100%; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--grad-start), var(--grad-end)); width: 0; transition: width .2s; }

/* tag */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-muted);
}

/* spinner */
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg);} }

/* focus ring */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-soft); }
