:root {
  --bg: #0b0f17;
  --panel: #121826;
  --panel-2: #171f2f;
  --card: #101723;
  --text: #f5f7fb;
  --muted: #94a3b8;
  --line: rgba(255,255,255,.09);
  --accent: #b9ff4a;
  --accent-2: #86e837;
  --danger: #ff6b6b;
  --shadow: 0 18px 60px rgba(0,0,0,.35);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(185,255,74,.16), transparent 35%),
    radial-gradient(circle at top right, rgba(99,102,241,.12), transparent 35%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
a { color: inherit; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  background: rgba(11,15,23,.78);
}
.brand, .topbar a { text-decoration: none; }
.brand { font-size: 20px; font-weight: 900; letter-spacing: -.03em; }
.topbar nav { display:flex; align-items:center; gap:18px; color:var(--muted); font-size:14px; }
.container { width:min(1380px, calc(100% - 32px)); margin: 30px auto 80px; }
.page-head {
  display:flex;
  justify-content:space-between;
  gap:20px;
  align-items:flex-start;
  margin-bottom:24px;
}
h1, h2, h3 { margin:0; letter-spacing:-.04em; }
h1 { font-size: clamp(34px, 4vw, 64px); line-height:.95; }
h2 { font-size: 28px; }
h3 { font-size: 18px; }
p { color: var(--muted); }
.lead { font-size:18px; max-width:760px; line-height:1.6; }
.muted-link { color: var(--muted); text-decoration:none; display:inline-block; margin-bottom:14px; }
.panel {
  background: rgba(18,24,38,.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin: 22px 0;
}
.panel-head { display:flex; justify-content:space-between; align-items:center; gap:20px; margin-bottom:18px; }
.panel-head p { margin:8px 0 0; }
.tabs { display:flex; gap:10px; flex-wrap:wrap; margin: 20px 0; }
.tabs a {
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius:999px;
  background:rgba(255,255,255,.04);
  color: var(--muted);
  text-decoration:none;
}
.tabs a:hover { color:var(--text); border-color:rgba(185,255,74,.5); }
.btn {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:40px;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.06);
  color: var(--text);
  text-decoration:none;
  cursor:pointer;
  font-weight:700;
  font-size:14px;
}
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color:#0a0d13; border-color:transparent; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
button, input, select, textarea { font: inherit; }
label { display:flex; flex-direction:column; gap:7px; color:var(--muted); font-size:13px; font-weight:700; }
input, select, textarea {
  width:100%;
  border:1px solid var(--line);
  border-radius: 14px;
  background: rgba(8,12,20,.88);
  color: var(--text);
  padding: 12px 13px;
  outline:none;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: rgba(185,255,74,.65); box-shadow: 0 0 0 3px rgba(185,255,74,.08); }
.grid-form { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:14px; }
.grid-form.compact { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-form h2, .grid-form .wide { grid-column:1/-1; }
.stack { display:grid; gap:14px; }
.auth-card, .install-card {
  max-width: 520px;
  margin: 70px auto;
  background: var(--panel);
  border:1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.install-card { max-width:760px; }
.logo { font-weight:900; font-size:24px; margin-bottom:8px; }
.flash {
  border-radius:14px;
  padding: 12px 14px;
  margin: 12px 0;
  border:1px solid var(--line);
}
.flash.ok { background:rgba(185,255,74,.09); border-color:rgba(185,255,74,.24); }
.flash.error { background:rgba(255,107,107,.1); border-color:rgba(255,107,107,.35); }
.meta-row { display:flex; gap:9px; flex-wrap:wrap; align-items:center; margin-top:10px; color:var(--muted); }
.meta-row span, .badge {
  border:1px solid var(--line);
  background:rgba(255,255,255,.045);
  padding:6px 10px;
  border-radius:999px;
}
.meta-row.small { font-size:12px; }
.badge { color:var(--accent); }
.offers-grid { display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:16px; }
.offer-card, .list-card, .creative-card {
  border:1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.025));
  border-radius: 18px;
}
.offer-card { display:block; padding:18px; text-decoration:none; transition:.18s ease; }
.offer-card:hover { transform: translateY(-2px); border-color:rgba(185,255,74,.4); }
.card-title-row { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.offer-stats, .metrics { display:flex; gap:10px; flex-wrap:wrap; margin-top:18px; color:var(--muted); font-size:13px; }
.offer-stats span, .metrics span { padding:8px 10px; border-radius:12px; background:rgba(0,0,0,.18); }
.filters, .search-line { display:flex; gap:10px; flex-wrap:wrap; }
.filters input { min-width:260px; flex:1; }
.filters select { width:auto; min-width:150px; }
.add-box {
  border:1px dashed rgba(255,255,255,.18);
  border-radius:18px;
  padding:14px;
  margin: 16px 0 22px;
  background: rgba(255,255,255,.025);
}
.add-box summary { cursor:pointer; font-weight:900; color:var(--accent); }
.add-box form { margin-top:16px; }
.creative-grid { display:grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap:18px; }
.creative-card { overflow:hidden; }
.preview {
  aspect-ratio: 1 / 1;
  background:#070a10;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}
.preview img, .preview video { width:100%; height:100%; object-fit:cover; display:block; }
.file-preview { text-align:center; color:var(--muted); font-weight:800; line-height:1.6; padding:20px; }
.creative-body { padding:16px; }
.rating { color:var(--accent); font-weight:900; white-space:nowrap; }
.tags { display:flex; gap:6px; flex-wrap:wrap; margin-top:12px; }
.tags span { color:#d9ff95; background:rgba(185,255,74,.08); border:1px solid rgba(185,255,74,.18); padding:5px 8px; border-radius:999px; font-size:12px; }
.note { line-height:1.5; font-size:14px; }
.actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-top:14px; }
.mini-edit { margin-top:14px; display:grid; gap:10px; grid-template-columns: repeat(2, minmax(0,1fr)); }
.hidden { display:none !important; }
.link-danger {
  color: var(--danger);
  background: none;
  border: 0;
  padding: 8px 0;
  cursor:pointer;
  text-decoration: underline;
}
.cards-list { display:grid; gap:12px; }
.list-card { padding:18px; display:flex; justify-content:space-between; gap:18px; align-items:flex-start; }
.text-card pre {
  white-space:pre-wrap;
  word-break:break-word;
  background:rgba(0,0,0,.2);
  border:1px solid var(--line);
  padding:14px;
  border-radius:14px;
  color:#dbeafe;
  max-height:360px;
  overflow:auto;
}
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; margin-top:14px; }
th, td { border-bottom:1px solid var(--line); text-align:left; padding:12px; vertical-align:top; }
th { color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.06em; }
.empty { color:var(--muted); border:1px dashed var(--line); border-radius:16px; padding:28px; text-align:center; }
.danger-form { margin-top:10px; }

@media (max-width: 1100px) {
  .offers-grid, .creative-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-form.compact { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 720px) {
  .container { width:min(100% - 20px, 1380px); margin-top:18px; }
  .topbar { padding:14px 16px; }
  .page-head, .panel-head, .list-card { flex-direction:column; }
  .offers-grid, .creative-grid, .grid-form, .grid-form.compact { grid-template-columns: 1fr; }
  .filters input, .filters select, .search-line input { width:100%; min-width:0; }
}

/* Launch builder */
.inline-form { margin-top: 12px; }
small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.mini-table { margin: 12px 0 22px; }
.launch-create-box {
  border: 1px solid rgba(185,255,74,.18);
  background: rgba(185,255,74,.045);
  border-radius: 18px;
  padding: 18px;
  margin: 18px 0 26px;
}
.subhead { margin: 18px 0 12px; }
.creative-pick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
  margin: 14px 0;
}
.creative-pick {
  display: grid;
  grid-template-columns: 24px 66px minmax(0,1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  border-radius: 16px;
  padding: 10px;
  cursor: pointer;
  color: var(--text);
}
.creative-pick input { width: auto; accent-color: var(--accent); }
.pick-preview {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: rgba(0,0,0,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 24px;
}
.pick-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick-info { min-width: 0; display: grid; gap: 4px; }
.pick-info b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-info small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.danger-text { color: var(--danger); }
@media (max-width: 1100px) { .creative-pick-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 720px) { .creative-pick-grid { grid-template-columns: 1fr; } }

/* Launch creative picker - compact cards with playable video */
.launch-creative-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0 18px;
}
.launch-creative-card {
  position: relative;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.025));
  border-radius: 18px;
  overflow: hidden;
}
.launch-check {
  position: absolute;
  z-index: 3;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: auto;
  padding: 7px 9px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  background: rgba(7,10,16,.78);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  backdrop-filter: blur(8px);
  cursor: pointer;
}
.launch-check input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}
.launch-preview {
  height: 180px;
  background: #070a10;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.launch-preview img,
.launch-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.launch-preview video {
  object-fit: contain;
  background: #070a10;
}
.launch-file-preview {
  text-align: center;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.6;
  padding: 18px;
}
.launch-creative-body {
  padding: 12px;
  display: grid;
  gap: 8px;
}
.launch-creative-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.launch-creative-title b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.launch-creative-title span {
  color: var(--accent);
  font-weight: 900;
  white-space: nowrap;
}
.launch-creative-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}
.launch-creative-meta span {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.045);
  padding: 5px 8px;
  border-radius: 999px;
}
.launch-creative-body small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 1200px) { .launch-creative-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 900px) { .launch-creative-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 560px) { .launch-creative-grid { grid-template-columns: 1fr; } .launch-preview { height: 220px; } }


/* Launch picker v3: use the same card geometry as the main creative grid */
.launch-picker-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 14px 0 20px;
}
.launch-picker-card {
  position: relative;
  overflow: hidden;
}
.launch-picker-card .preview {
  aspect-ratio: 1 / 1;
  height: auto;
}
.launch-picker-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #070a10;
}
.launch-select-bar {
  position: absolute;
  z-index: 4;
  top: 12px;
  left: 12px;
}
.launch-select-bar label {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 999px;
  background: rgba(7,10,16,.78);
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  backdrop-filter: blur(8px);
  cursor: pointer;
}
.launch-select-bar input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}
.launch-picker-card:has(.launch-select-bar input:checked) {
  border-color: rgba(185,255,74,.7);
  box-shadow: 0 0 0 3px rgba(185,255,74,.12);
}
@media (max-width: 1100px) { .launch-picker-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 720px) { .launch-picker-grid { grid-template-columns: 1fr; } }
