/* AdsThatSell App UI */
:root{
  --bg:#0b0b0b;
  --panel:#141414;
  --stroke:#262626;
  --stroke2:#303030;

  --text:#ffffff;
  --muted:#b0b0b0;
  --subtle:#7a7a7a;

  --red:#e10600;
  --red2:#a30000;

  --ok:#35e06f;

  --radius:12px;
  --shadow:0 10px 24px rgba(0,0,0,.45);
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
}
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{ margin:0; font-family:var(--font); background:var(--bg); color:var(--text); }
a{ color:inherit; }
.app{ height:100vh; display:flex; flex-direction:column; }

.topbar{
  height:64px; display:flex; align-items:center; justify-content:space-between;
  padding:0 18px; background:var(--bg); border-bottom:1px solid var(--stroke);
}
.brand{ display:flex; align-items:center; gap:12px; min-width:240px; }
.logoMark{
  width:34px; height:34px; border-radius:10px; border:1px solid var(--stroke2);
  background:#0f0f0f; display:grid; place-items:center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
}
.brandName{ font-weight:1000; letter-spacing:.2px; font-size:18px; line-height:1; }
.brandName .sell{ color:var(--red); }

.nav{ display:flex; align-items:center; gap:18px; font-size:14px; color:var(--muted); }
.nav a{ position:relative; text-decoration:none; color:inherit; padding:10px 6px; border-radius:8px; }
.nav a:hover{ background:#0f0f0f; color:#fff; }
.nav a.active{ color:#fff; }
.nav a.active::after{ content:""; position:absolute; left:6px; right:6px; bottom:-12px; height:2px; background:var(--red); border-radius:2px; }

.topbarRight{ display:flex; align-items:center; gap:12px; }
.pill{
  display:inline-flex; align-items:center; gap:8px; padding:8px 10px; border-radius:999px;
  background:#0f0f0f; border:1px solid var(--stroke); color:var(--muted); font-size:13px; white-space:nowrap;
}
.pill .dot{ width:8px; height:8px; border-radius:50%; background:var(--red); box-shadow:0 0 0 3px rgba(225,6,0,.15); }

.user{
  display:flex; align-items:center; gap:10px;
  padding:6px 8px; border-radius:12px; border:1px solid var(--stroke); background:#0f0f0f;
}
.avatar{ width:32px; height:32px; border-radius:50%; background:#222; border:1px solid var(--stroke2); display:grid; place-items:center; color:#fff; font-weight:1000; font-size:13px; }
.name{ font-size:13px; color:#fff; font-weight:900; max-width:220px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.logoutLink{
  margin-left:8px;
  font-size:12px;
  color:var(--muted);
  text-decoration:none;
  padding:6px 8px;
  border-radius:10px;
  border:1px solid var(--stroke2);
  background:#0b0b0b;
}
.logoutLink:hover{ border-color:#3a3a3a; color:#fff; }

.workspace{ flex:1; display:grid; grid-template-columns: 320px 1fr 320px; min-height:0; }
.panel{ background:var(--panel); padding:16px; min-height:0; overflow:auto; }
.panel.left{ border-right:1px solid var(--stroke); }
.panel.right{ border-left:1px solid var(--stroke); }

.panelTitle{ font-size:12px; color:var(--subtle); letter-spacing:.12em; font-weight:1000; text-transform:uppercase; margin:2px 0 12px; }

.field{ margin-bottom:12px; }
.label{ font-size:12px; color:var(--muted); margin:0 0 6px; font-weight:900; display:flex; align-items:center; justify-content:space-between; gap:10px; }
.row{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }

input, select, textarea{
  width:100%; border-radius:10px; border:1px solid var(--stroke2); background:#0f0f0f;
  color:#fff; padding:11px 12px; outline:none; font-size:14px;
}
input::placeholder, textarea::placeholder{ color:#7f7f7f; }
input:focus, select:focus, textarea:focus{ border-color: rgba(225,6,0,.65); box-shadow: 0 0 0 3px rgba(225,6,0,.12); }

.btnRow{ display:flex; gap:10px; }
.btn{
  flex:1; height:48px; border-radius:10px; border:1px solid #7a0b08; background:var(--red);
  color:#fff; font-weight:1000; letter-spacing:.2px; cursor:pointer; box-shadow:0 10px 22px rgba(225,6,0,.16);
}
.btn:hover{ background:var(--red2); }
.btnGhost{ height:40px; padding:0 12px; border-radius:10px; border:1px solid var(--stroke2); background:#0f0f0f; color:#fff; font-weight:1000; cursor:pointer; }
.btnGhost:hover{ border-color:#3a3a3a; }
.hint{ margin-top:8px; font-size:12px; color:var(--subtle); text-align:center; font-weight:800; }

.switchRow{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:10px; padding-top:10px; border-top:1px solid var(--stroke); }
.switchRow .labelTxt{ color:var(--muted); font-weight:1000; font-size:13px; }
.switch{ width:46px; height:26px; border-radius:999px; border:1px solid var(--stroke2); background:#0f0f0f; position:relative; cursor:pointer; flex:0 0 auto; }
.switch::after{ content:""; width:20px; height:20px; border-radius:50%; background:#2a2a2a; position:absolute; top:2px; left:2px; transition: all .15s ease; border:1px solid #3a3a3a; }
.switch.on{ background: rgba(225,6,0,.15); border-color: rgba(225,6,0,.65); }
.switch.on::after{ left:24px; background:var(--red); border-color:var(--red2); }

.statusRow{ display:flex; flex-wrap:wrap; gap:8px; margin:10px 0 0; }
.statusChip{ padding:7px 10px; border-radius:999px; border:1px solid var(--stroke2); background:#0f0f0f; color:var(--muted); font-size:12px; font-weight:1000; }
.statusChip.good{ border-color: rgba(53,224,111,.35); color:#dfffea; }
.statusChip.bad{ border-color: rgba(225,6,0,.35); color:#ffe1e1; }

.linkBtn{ margin-top:12px; width:100%; display:flex; align-items:center; justify-content:center; gap:10px; height:42px; border-radius:10px; border:1px solid var(--stroke2); background:#0f0f0f; color:#fff; font-weight:1000; cursor:pointer; }
.linkBtn:hover{ border-color:#3a3a3a; }

.creditsWrap{ margin-top:12px; background:#0f0f0f; border:1px solid var(--stroke); border-radius:12px; padding:10px; }
.creditsTop{ display:flex; align-items:center; justify-content:space-between; font-size:12px; color:var(--muted); margin-bottom:8px; font-weight:900; }
.bar{ height:10px; border-radius:999px; background:#1a1a1a; border:1px solid var(--stroke); overflow:hidden; }
.bar > span{ display:block; height:100%; background:var(--red); }

.canvas{ background:var(--bg); padding:20px 24px; min-height:0; overflow:auto; }
.canvasHeader{ display:flex; align-items:flex-end; justify-content:space-between; gap:14px; margin-bottom:14px; }
.canvasHeader h1{ font-size:18px; margin:0; font-weight:1000; letter-spacing:.2px; }
.topControls{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }

.viewTabs{ display:inline-flex; gap:8px; background:#0f0f0f; border:1px solid var(--stroke); border-radius:999px; padding:6px; }
.vtab{ border:1px solid transparent; background:transparent; color:var(--muted); padding:8px 10px; border-radius:999px; font-size:13px; cursor:pointer; min-width:70px; text-align:center; font-weight:1000; display:flex; align-items:center; justify-content:center; gap:8px; }
.vtab.active{ background:#1a1a1a; border-color:var(--stroke2); color:#fff; }
.vtab .count{ font-size:12px; padding:3px 7px; border-radius:999px; border:1px solid var(--stroke2); background:#0b0b0b; color:var(--muted); font-weight:1000; min-width:22px; text-align:center; }

.tabs{ display:inline-flex; gap:8px; background:#0f0f0f; border:1px solid var(--stroke); border-radius:999px; padding:6px; }
.tab{ border:1px solid transparent; background:transparent; color:var(--muted); padding:8px 10px; border-radius:999px; font-size:13px; cursor:pointer; min-width:64px; text-align:center; font-weight:1000; }
.tab.active{ background:#1a1a1a; border-color:var(--stroke2); color:#fff; }

.grid{ display:grid; grid-template-columns: repeat(2, minmax(320px, 1fr)); gap:16px; }

.adCard{ background:var(--panel); border:1px solid var(--stroke); border-radius:var(--radius); padding:12px; box-shadow:var(--shadow); position:relative; }
.adPreview{ background:#000; border:1px solid var(--stroke2); border-radius:10px; aspect-ratio:1/1; display:grid; place-items:center; overflow:hidden; position:relative; }
.adPreview .badge{ position:absolute; top:10px; left:10px; background:#0f0f0f; border:1px solid var(--stroke2); padding:6px 8px; border-radius:999px; font-size:12px; color:var(--muted); font-weight:1000; }

.trashBtn{ position:absolute; top:10px; right:10px; width:34px; height:34px; border-radius:10px; border:1px solid var(--stroke2); background:rgba(15,15,15,.85); display:grid; place-items:center; cursor:pointer; }
.trashBtn:hover{ border-color:#3a3a3a; }
.trashBtn .tip{ position:absolute; top:-34px; right:0; background:#0f0f0f; border:1px solid var(--stroke2); padding:6px 8px; border-radius:10px; font-size:12px; color:var(--muted); font-weight:1000; display:none; white-space:nowrap; }
.trashBtn:hover .tip{ display:block; }

.adActions{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding-top:10px; border-top:1px solid var(--stroke); margin-top:10px; }
.iconRow{ display:flex; gap:8px; }
.iconBtn{ width:36px; height:34px; border-radius:10px; border:1px solid var(--stroke2); background:#0f0f0f; display:grid; place-items:center; cursor:pointer; }
.iconBtn:hover{ border-color:#3a3a3a; }
.savePill{ padding:8px 10px; border-radius:10px; border:1px solid var(--stroke2); background:#0f0f0f; color:#fff; font-size:13px; font-weight:1000; cursor:pointer; display:inline-flex; align-items:center; gap:8px; white-space:nowrap; }
.savePill:hover{ border-color:#3a3a3a; }

/* Copy */
.copyWrap{ display:grid; grid-template-columns:1fr; gap:12px; }
.copyToolbar{ display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; padding:12px; border:1px solid var(--stroke); background:var(--panel); border-radius:12px; }
.copyToolbar .left{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.copyToolbar label{ color:var(--muted); font-size:12px; font-weight:1000; letter-spacing:.08em; text-transform:uppercase; }
.copyToolbar select{ width:auto; min-width:220px; }
.copyToolbar .right{ display:flex; gap:10px; align-items:center; }
.copyCard{ background:var(--panel); border:1px solid var(--stroke); border-radius:12px; padding:12px; box-shadow:var(--shadow); display:flex; flex-direction:column; gap:10px; }
.copyMeta{ display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.copyMeta .ttl{ font-weight:1000; letter-spacing:.04em; color:#fff; }
.pillMini{ padding:6px 10px; border-radius:999px; border:1px solid var(--stroke2); background:#0f0f0f; color:var(--muted); font-size:12px; font-weight:1000; }
.copyText{ border:1px solid var(--stroke2); background:#0f0f0f; border-radius:12px; padding:12px; color:#fff; font-size:14px; line-height:1.45; white-space:pre-wrap; }
.copyActions{ display:flex; align-items:center; justify-content:space-between; gap:10px; border-top:1px solid var(--stroke); padding-top:10px; }
.copyBtn{ height:36px; padding:0 12px; border-radius:10px; border:1px solid var(--stroke2); background:#0f0f0f; color:#fff; font-weight:1000; cursor:pointer; }
.copyBtn:hover{ border-color:#3a3a3a; }

/* Style list */
.styleList{ display:flex; flex-direction:column; gap:10px; }
.styleItem{ height:48px; border-radius:12px; border:1px solid var(--stroke2); background:#0f0f0f; display:flex; align-items:center; justify-content:space-between; padding:0 12px; cursor:pointer; color:var(--muted); font-weight:1000; }
.styleItem:hover{ border-color:#3a3a3a; color:#fff; }
.styleItem.active{ border-color: rgba(225,6,0,.85); box-shadow: inset 0 0 0 1px rgba(225,6,0,.2); color:#fff; }
.styleItem .left{ display:flex; align-items:center; gap:10px; font-size:14px; }
.check{ width:16px; height:16px; border-radius:4px; border:1px solid var(--stroke2); background:#0b0b0b; display:grid; place-items:center; }
.styleItem.active .check{ background:var(--red); border-color:var(--red2); }
.tick{ width:10px; height:10px; display:block; border-right:2px solid #fff; border-bottom:2px solid #fff; transform: rotate(40deg); margin-top:-1px; }
.styleItem:not(.active) .tick{ display:none; }
.variantGrid{ display:grid; grid-template-columns: repeat(3, 1fr); gap:8px; }
.variantBtn{ padding:10px 8px; border-radius:10px; border:1px solid var(--stroke2); background:#0f0f0f; color:#fff; font-weight:1000; font-size:12px; cursor:pointer; text-align:center; }
.variantBtn:hover{ border-color:#3a3a3a; }
.variantBtn.active{ border-color: rgba(225,6,0,.85); background: rgba(225,6,0,.08); }

/* Drawer */
.drawerOverlay{ position:fixed; inset:0; background: rgba(0,0,0,.55); display:none; align-items:stretch; justify-content:flex-end; z-index:50; }
.drawerOverlay.open{ display:flex; }
.drawer{ width:420px; max-width:95vw; background:var(--panel); border-left:1px solid var(--stroke); padding:16px; box-shadow: -12px 0 28px rgba(0,0,0,.45); display:flex; flex-direction:column; gap:12px; overflow:auto; }
.drawerTop{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding-bottom:10px; border-bottom:1px solid var(--stroke); }
.drawerTop .ttl{ font-weight:1000; letter-spacing:.12em; text-transform:uppercase; color:#fff; font-size:13px; }
.closeX{ width:36px; height:36px; border-radius:10px; border:1px solid var(--stroke2); background:#0f0f0f; cursor:pointer; display:grid; place-items:center; }
.closeX:hover{ border-color:#3a3a3a; }
.drawerSection{ border:1px solid var(--stroke); border-radius:12px; background:#121212; padding:12px; }
.kv{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 0; border-top:1px solid var(--stroke); }
.kv:first-child{ border-top:none; padding-top:0; }
.kv span{ color:var(--muted); font-weight:1000; font-size:13px; }
.kv select{ width:auto; min-width:180px; background:#0f0f0f; }

/* Toast */
.toast{ position:fixed; bottom:18px; left:50%; transform:translateX(-50%); background:#0f0f0f; border:1px solid var(--stroke2); border-radius:12px; padding:12px 14px; display:none; align-items:center; gap:12px; box-shadow:var(--shadow); z-index:80; max-width:min(720px, calc(100vw - 24px)); }
.toast.show{ display:flex; }
.toast .msg{ color:#fff; font-weight:1000; font-size:13px; letter-spacing:.02em; flex:1; }
.toast .small{ color:var(--muted); font-weight:900; font-size:12px; }
.toast .undo{ height:34px; padding:0 12px; border-radius:10px; border:1px solid rgba(225,6,0,.55); background: rgba(225,6,0,.08); color:#fff; font-weight:1000; cursor:pointer; white-space:nowrap; }
.toast .undo:hover{ border-color: rgba(225,6,0,.85); }
.toast .dismiss{ width:34px; height:34px; border-radius:10px; border:1px solid var(--stroke2); background:#0b0b0b; cursor:pointer; display:grid; place-items:center; }
.toast .dismiss:hover{ border-color:#3a3a3a; }

/* Auth pages */
.authWrap{
  width:100%;
  min-height:calc(100vh - 64px);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}
.authCard{
  width:min(520px, 100%);
  background:var(--panel);
  border:1px solid var(--stroke);
  border-radius:16px;
  box-shadow:var(--shadow);
  padding:18px;
}
.authCard h1{ margin:0 0 8px; font-size:20px; font-weight:1000; }
.authCard p{ margin:0 0 14px; color:var(--muted); }
.authRow{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.authActions{ display:flex; gap:10px; align-items:center; justify-content:space-between; margin-top:12px; }
.authActions a{ color:var(--muted); text-decoration:none; font-weight:900; }
.authActions a:hover{ color:#fff; }
.alert{ padding:10px 12px; border-radius:12px; border:1px solid rgba(225,6,0,.35); background:rgba(225,6,0,.08); color:#ffe1e1; font-weight:900; margin:10px 0; }
.success{ border-color: rgba(53,224,111,.35); background: rgba(53,224,111,.08); color:#dfffea; }

@media (max-width: 1180px){
  .workspace{ grid-template-columns: 320px 1fr; }
  .panel.right{ display:none; }
  .grid{ grid-template-columns: 1fr; }
}
@media (max-width: 860px){
  .workspace{ grid-template-columns: 1fr; }
  .panel.left{ display:none; }
  .nav{ display:none; }
  .grid{ grid-template-columns: 1fr; }
  .drawer{ width:100%; }
  .authRow{ grid-template-columns:1fr; }
}

.uploadRow{display:flex;gap:10px;align-items:center}
.fileInput{flex:1;min-height:42px;padding:10px 12px;border-radius:12px;border:1px solid rgba(255,255,255,.10);background:rgba(255,255,255,.03);color:#fff}
.uploadHint{margin-top:8px;color:var(--subtle);font-size:12px;font-weight:900}
.uploadList{margin-top:10px;display:grid;grid-template-columns:1fr;gap:10px}
.uploadItem{display:grid;grid-template-columns:38px 70px 1fr;gap:10px;align-items:center;padding:10px;border-radius:14px;border:1px solid rgba(255,255,255,.10);background:rgba(255,255,255,.03)}
.uploadItem.on{border-color:rgba(118,255,197,.40);background:rgba(118,255,197,.06)}
.uploadToggle{width:38px;height:38px;border-radius:12px;border:1px solid rgba(255,255,255,.14);background:rgba(0,0,0,.25);display:flex;align-items:center;justify-content:center;cursor:pointer}
.uploadToggle .dot{width:12px;height:12px;border-radius:50%;background:rgba(255,255,255,.25)}
.uploadItem.on .uploadToggle .dot{background:rgba(118,255,197,.95)}
.uploadThumb{width:70px;height:70px;border-radius:12px;overflow:hidden;border:1px solid rgba(255,255,255,.10);background:rgba(0,0,0,.25)}
.uploadThumb img{width:100%;height:100%;object-fit:cover;display:block}
.uploadMeta{display:flex;align-items:center;justify-content:space-between;gap:10px}
.uploadId{font-size:12px;font-weight:1000;color:rgba(255,255,255,.82)}
.btnTiny{padding:8px 10px;border-radius:12px}
.field.drag{outline:2px dashed rgba(118,255,197,.65);outline-offset:6px;border-radius:16px}
