/* Creator dashboard v2 — built on Wolf's creator-dashboard.html (layout, tabs, panel fade, stat lift, bar
   transitions kept as designed). Palette mapped to the official DU brand: #05040c, violet #7c5cff → #b9a8ff, cyan #22d3ee. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/fonts/inter-latin-700-normal.woff2") format("woff2"); }
:root {
  --bg: #11141a;
  --bg-elevated: #161a21;
  --bg-card: #161a21;
  --border: rgba(230,232,236,0.08);
  --border-hover: rgba(230,232,236,0.27);
  --text: #e6e8ec;
  --text-muted: #a8acb5;
  --text-dim: #a8acb5;
  --accent: #9a97e8;
  --accent-2: #9a97e8;
  --accent-grad: #4f46e5;
  --accent-soft: rgba(79,70,229,0.16);
  --cyan: #9a97e8;
  --success: #9a97e8;
  --warn: #9a97e8;
  --danger: #f08080;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; line-height: 1.5; -webkit-font-smoothing: antialiased; min-height: 100vh; }
body::before { content: ''; position: fixed; inset: 0; background: transparent; pointer-events: none; z-index: -1; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.container.wide { max-width: 1320px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

header.top { position: sticky; top: 0; z-index: 40; background: rgba(17,20,26,0.85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 60px; max-width: 1320px; margin: 0 auto; padding: 0 20px; gap: 12px; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; line-height: 0; }
.logo img.full { height: 30px; width: auto; }
.logo img.mark { height: 30px; width: 30px; display: none; }
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-btn { padding: 7px 14px; border-radius: 8px; font-size: 0.85rem; font-weight: 500; text-decoration: none; color: var(--text-muted); transition: all 0.15s; border: 0; background: none; cursor: pointer; }
.nav-btn:hover { color: var(--text); background: rgba(230,232,236,0.04); }
.nav-btn.active { background: var(--accent-soft); color: var(--text); }
.nav-btn.primary { background: var(--accent-grad); color: #e6e8ec; }
.beta-pill { font-size: 0.7rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--cyan); border: 1px solid rgba(230,232,236,0.24); border-radius: 999px; padding: 2px 8px; line-height: 1.4; }

.page { padding-top: 32px; padding-bottom: 60px; }
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 24px; }

.tabs { display: flex; gap: 4px; background: var(--bg-elevated); padding: 4px; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 20px; width: fit-content; max-width: 100%; }
.tab { padding: 8px 16px; border-radius: 8px; font-size: 0.85rem; font-weight: 500; background: transparent; border: none; color: var(--text-muted); cursor: pointer; transition: all 0.2s; text-decoration: none; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent-grad); color: #e6e8ec; }

.panel { display: none; }
.panel.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; transition: border-color 0.2s, transform 0.2s; }
.stat:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.stat-label { font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 1.6rem; font-weight: 700; margin: 4px 0; }
.stat-change { font-size: 0.75rem; color: var(--accent-2); }

.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 18px; margin-bottom: 14px; }
.card h2 { font-size: 1rem; font-weight: 600; margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

.listing { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.listing:last-child { border-bottom: none; }
.listing-icon { width: 40px; height: 40px; border-radius: 8px; background: #4f46e5; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; font-weight: 700; flex: none; overflow: hidden; }
.listing-icon img { width: 100%; height: 100%; object-fit: cover; }
.listing-info { flex: 1; min-width: 0; }
.listing-info strong { display: block; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.listing-info span { font-size: 0.75rem; color: var(--text-dim); }
.listing-stats { font-size: 0.8rem; color: var(--text-muted); text-align: right; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.chart-placeholder { height: 180px; background: transparent; border-radius: 10px; display: flex; align-items: flex-end; justify-content: space-around; padding: 12px; gap: 6px; }
.chart-placeholder.sm { height: 90px; padding: 8px; gap: 3px; }
.bar { flex: 1; background: var(--du-accent-fill,#4f46e5); border-radius: 4px 4px 0 0; transition: height 0.6s ease; min-height: 2px; position: relative; }
.bar.c { background: var(--du-accent-fill,#4f46e5); }
.bar:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: #20242d; border: 1px solid var(--border); padding: 3px 7px; border-radius: 6px; font-size: .72rem; white-space: nowrap; color: var(--text); z-index: 2; pointer-events: none; }
.chart-axis { display: flex; justify-content: space-between; font-size: .72rem; color: var(--text-dim); margin-top: 6px; }
.legend { display: flex; gap: 14px; font-size: .78rem; color: var(--text-muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--du-accent-fill,#4f46e5); margin-right: 6px; vertical-align: -1px; }
.legend i.c { background: var(--du-accent-fill,#4f46e5); }
.charts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.charts-grid .card { margin: 0; }
.mini-tot { font-size: .8rem; color: var(--text-muted); margin-top: 8px; }

/* Pills, buttons, form controls */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-muted); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.live { color: var(--success); border-color: rgba(230,232,236,0.22); }
.pill.review { color: var(--warn); border-color: rgba(230,232,236,0.22); }
.pill.off, .pill.unsaved { color: var(--text-dim); }
.pill.bad { color: var(--danger); border-color: rgba(240,128,128,0.35); }
.pill.saving { color: var(--cyan); border-color: rgba(230,232,236,0.22); }
.pill.saving::before { animation: pulse 1s infinite; }
.pill.saved { color: var(--accent-2); border-color: rgba(230,232,236,0.22); }
.pill.unsaved { color: var(--warn); border-color: rgba(230,232,236,0.22); }
.pill.owner { color: var(--cyan); border-color: rgba(230,232,236,0.22); }
.pill.owner::before { display: none; }
@keyframes pulse { 50% { opacity: .3; } }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9px; font-size: .85rem; font-weight: 600; border: 1px solid var(--border); background: rgba(230,232,236,0.03); color: var(--text); cursor: pointer; text-decoration: none; transition: all .15s; }
.btn:hover { border-color: var(--border-hover); background: rgba(79,70,229,0.08); }
.btn.primary { background: var(--accent-grad); border-color: transparent; color: #e6e8ec; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.sm { padding: 5px 10px; font-size: .78rem; border-radius: 7px; }
.btn.ghost { background: none; }
.btn.danger:hover { border-color: rgba(240,128,128,0.6); background: rgba(240,128,128,0.08); color: #f08080; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.select-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
select.ctl, input.ctl, textarea.ctl { background: #161a21; border: 1px solid rgba(230,232,236,0.12); border-radius: 10px; padding: 10px 12px; font-size: 1rem; line-height: 1.5; color: var(--text); width: 100%; transition: border-color .15s, box-shadow .15s; }
select.ctl.inline { width: auto; font-size: .85rem; padding: 7px 10px; }
textarea.ctl { resize: vertical; min-height: 120px; }
.ctl:focus { outline: none; border-color: var(--du-accent-fill,#4f46e5); box-shadow: 0 0 0 3px rgba(79,70,229,0.25); }
.ctl[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(79,70,229,0.15); }
.fld { margin-bottom: 18px; }
.fld > label, .fld > .lbl { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.hint { color: var(--text-dim); font-size: .85rem; margin-top: 5px; }
.err { color: #f08080; font-size: .86rem; margin-top: 5px; }
.err:empty { display: none; }
.count { float: right; font-weight: 400; color: var(--text-dim); font-size: .8rem; }
.count.over { color: var(--danger); }
.muted { color: var(--text-muted); }
.empty { color: var(--text-muted); padding: 18px 0; text-align: center; }
.banner { border: 1px solid rgba(230,232,236,0.22); background: rgba(79,70,229,0.06); border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: .9rem; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.banner.warn { border-color: rgba(230,232,236,0.24); background: rgba(79,70,229,0.07); }
.banner.bad { border-color: rgba(240,128,128,0.45); background: rgba(240,128,128,0.07); }
.banner[hidden], .tabs[hidden] { display: none; }
.skel { height: 56px; border-radius: 10px; background: transparent; background-size: 200% 100%; animation: sk 1.2s infinite; margin: 8px 0; }
@keyframes sk { to { background-position: -200% 0; } }

/* Sign-in */
.signin { max-width: 420px; }

/* ---------- Edit page ---------- */
.edit-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.edit-top .crumbs { font-size: .85rem; color: var(--text-dim); }
.edit-top .crumbs a { color: var(--text-muted); text-decoration: none; }
.edit-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.edit-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 24px; align-items: start; }
.edit-form .card { padding: 22px; }
.preview-col { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow: auto; scrollbar-width: thin; }
.preview-col h3 { font-size: .75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; margin: 4px 0 8px; font-weight: 600; }
.pv-toggle { display: none; }

/* Live preview: marketplace card */
.pv-card { background: #161a21; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; max-width: 340px; transition: border-color .2s, transform .2s; }
.pv-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.pv-media { aspect-ratio: 16/9; background: #4f46e5; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 700; color: var(--accent-2); overflow: hidden; }
.pv-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-body { padding: 14px; }
.pv-body strong { display: block; font-size: 1rem; }
.pv-body .by { font-size: .8rem; color: var(--text-dim); }
.pv-body p { font-size: .86rem; color: var(--text-muted); margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chip { font-size: .72rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-muted); }
.chip.cy { border-color: rgba(230,232,236,0.26); color: #9a97e8; }
/* Live preview: detail page */
.pv-detail { background: #11141a; border: 1px solid var(--border); border-radius: 16px; padding: 18px; margin-top: 18px; }
.pv-detail h4 { font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; }
.pv-detail .by { color: var(--accent-2); font-size: .85rem; }
.pv-detail .pitch { color: var(--text-muted); margin: 10px 0; font-size: .92rem; }
.pv-detail .desc p { font-size: .9rem; color: #e6e8ec; margin-bottom: 10px; white-space: pre-line; }
.pv-hero { border-radius: 12px; overflow: hidden; aspect-ratio: 16/9; background: #161a21; margin: 10px 0 8px; }
.pv-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; }
.pv-strip img { width: 84px; height: 52px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); flex: none; }
.pv-strip img.on { border-color: var(--du-accent-fill,#4f46e5); }
.pv-visit { display: inline-flex; padding: 8px 14px; border-radius: 9px; background: var(--accent-grad); color: #e6e8ec; font-weight: 600; font-size: .85rem; margin: 4px 0 12px; }

/* Gallery manager */
.drop { border: 1.5px dashed rgba(230,232,236,0.22); border-radius: 14px; padding: 22px; text-align: center; color: var(--text-muted); transition: border-color .15s, background .15s; cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--du-accent-fill,#4f46e5); background: rgba(79,70,229,0.05); color: var(--text); }
.drop strong { color: var(--text); }
.uploads { list-style: none; margin-top: 10px; }
.uploads li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; font-size: .85rem; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; background: rgba(230,232,236,0.02); }
.uploads .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uploads .prog { grid-column: 1 / -1; height: 5px; background: rgba(230,232,236,0.06); border-radius: 99px; overflow: hidden; }
.uploads .prog i { display: block; height: 100%; width: 0; background: var(--du-accent-fill,#4f46e5); transition: width .2s; }
.uploads li.fail { border-color: rgba(240,128,128,0.4); }
.uploads li.fail .prog i { background: var(--danger); }
.uploads li.done { opacity: .7; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; list-style: none; }
.thumb { position: relative; background: #161a21; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: transform .18s ease, border-color .15s, opacity .15s; }
.thumb:hover { border-color: var(--border-hover); }
.thumb .ph { aspect-ratio: 16/10; background: #1a1e26; cursor: grab; position: relative; }
.thumb .ph img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.thumb .badge { position: absolute; top: 6px; left: 6px; font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--accent-grad); color: #e6e8ec; padding: 2px 7px; border-radius: 6px; }
.thumb .badge.chk { left: auto; right: 6px; background: rgba(79,70,229,0.9); color: #11141a; }
.thumb .tools { display: flex; gap: 4px; padding: 6px; flex-wrap: wrap; }
.thumb .tools .btn { padding: 4px 7px; font-size: .74rem; }
.thumb .tools .grow { flex: 1; }
.thumb input.alt { width: calc(100% - 12px); margin: 0 6px 6px; background: #11141a; border: 1px solid rgba(230,232,236,0.1); border-radius: 7px; padding: 6px 8px; font-size: .82rem; }
.thumb input.alt:focus { outline: none; border-color: var(--du-accent-fill,#4f46e5); }
.thumb.dragging { opacity: .25; }
.thumb.lift { animation: lift .25s ease; }
@keyframes lift { 50% { transform: scale(1.04); } }
.drag-ghost { position: fixed; z-index: 100; pointer-events: none; border-radius: 12px; overflow: hidden; box-shadow: 0 18px 50px rgba(17,20,26,0.6), 0 0 0 2px var(--accent); transform: rotate(2deg) scale(1.04); opacity: .95; background: #161a21; }
.drag-ghost img { width: 100%; height: 100%; object-fit: cover; display: block; }
.legacy { display: flex; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: 12px; margin-top: 12px; font-size: .85rem; color: var(--text-muted); }
.legacy img { width: 96px; height: 60px; object-fit: cover; border-radius: 8px; flex: none; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px); opacity: 0; background: #20242d; border: 1px solid var(--border-hover); border-radius: 12px; padding: 10px 12px 10px 16px; display: flex; gap: 12px; align-items: center; font-size: .9rem; z-index: 120; transition: all .25s ease; pointer-events: none; box-shadow: 0 12px 40px rgba(17,20,26,0.5); max-width: calc(100vw - 24px); }
.toast.on { opacity: 1; transform: translateX(-50%); pointer-events: auto; }

.savebar-mobile { display: none; }

@media (max-width: 980px) {
  .edit-grid { grid-template-columns: 1fr; }
  .preview-col { position: static; max-height: none; overflow: visible; }
  .pv-toggle { display: inline-flex; }
  .edit-grid[data-view="form"] .preview-col { display: none; }
  .edit-grid[data-view="preview"] .edit-form { display: none; }
  .pv-card { max-width: none; }
}
@media (max-width: 640px) {
  .nav-links .nav-btn:not(.primary):not(.keep) { display: none; }
  .logo img.full { display: none; }
  .logo img.mark { display: block; }
  .tabs { width: 100%; overflow-x: auto; }
  .tab { flex: 1; text-align: center; padding: 8px 10px; }
  .page { padding-top: 22px; }
  .listing { flex-wrap: wrap; }
  .listing-stats { width: 100%; justify-content: flex-start; padding-left: 52px; }
  .thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .edit-form .card { padding: 16px; }
  .savebar-mobile { display: flex; position: sticky; bottom: 0; z-index: 30; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); margin: 0; border-radius: 12px 12px 0 0; background: #11141a; backdrop-filter: blur(12px); border-top: 1px solid var(--border); }
  .edit-actions .btn.save-desk { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
.legacy[hidden], .uploads:empty { display: none; }
.logo { flex: none; }
@media (max-width: 640px) { .nav-links .beta-pill { display: none; } .nav-btn { padding: 7px 10px; } }

/* Tag pills input */
.ctl.tagbox { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 7px 8px; cursor: text; min-height: 46px; }
.ctl.tagbox:focus-within { border-color: var(--du-accent-fill,#4f46e5); box-shadow: 0 0 0 3px rgba(79,70,229,0.25); }
.tagbox input { flex: 1 1 120px; min-width: 100px; background: transparent; border: 0; outline: none; color: var(--text); font: inherit; padding: 3px 4px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--accent-soft); border: 1px solid rgba(230,232,236,0.24); color: var(--accent-2); font-size: .85rem; font-weight: 600; line-height: 1.3; animation: tagIn .18s ease-out; }
.tag button { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 0; background: transparent; color: var(--accent-2); font-size: 15px; line-height: 1; cursor: pointer; padding: 0; transition: background .15s, color .15s; }
.tag button:hover, .tag button:focus-visible { background: rgba(240,128,128,0.2); color: var(--danger); }
@keyframes tagIn { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .tag { animation: none; } }
