/* ══════════════════════════════════════════════════════════════════════════
   Admin panel.
   Utility skin, not showroom: dense, legible, out of the way. It borrows the
   palette so it does not feel bolted on, and nothing else.
   ══════════════════════════════════════════════════════════════════════════ */

.ad-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 70;
  width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--line-2); color: var(--text-3);
  transition: color .25s var(--ease), border-color .25s var(--ease), transform .3s var(--ease);
}
.ad-fab:hover { color: var(--accent); border-color: var(--accent-line); transform: rotate(45deg); }
.ad-fab svg { width: 19px; height: 19px; }

.ad {
  position: fixed; inset: 0; z-index: 120;
  display: flex; flex-direction: column;
  background: var(--bg);
  font-size: 14px;
  --text-2: rgba(255,255,255,.78);
  --text-3: rgba(255,255,255,.57);
}
.ad[hidden] { display: none !important; }

/* ── top bar ───────────────────────────────────────────────────────────── */

.ad-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 18px; border-bottom: 1px solid var(--line); flex: none;
}
.ad-bar strong { font-size: .92rem; letter-spacing: -.01em; }
.ad-src { font-size: .78rem; color: var(--text-3); }
.ad-src.is-dirty { color: var(--premium); }
.ad-bar-actions { display: flex; gap: 7px; margin-left: auto; flex-wrap: wrap; }

.ad-btn {
  padding: 8px 14px; border-radius: var(--r-full); cursor: pointer;
  background: transparent; border: 1px solid var(--line-2);
  font-size: .8rem; font-weight: 600; color: var(--text-2); white-space: nowrap;
  transition: border-color .2s, color .2s, background .2s;
}
.ad-btn:hover { border-color: var(--text-3); color: var(--text); }
.ad-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.ad-btn-primary:hover { filter: brightness(1.08); color: #fff; }
.ad-btn-quiet { border-color: var(--line); color: var(--text-3); }
.ad-btn-danger { border-color: rgba(226, 75, 74, .4); color: #ff9d9d; }
.ad-btn-danger:hover { border-color: #e24b4a; color: #ff9d9d; }
.ad-btn-small { padding: 6px 12px; font-size: .76rem; margin-top: 8px; }

/* ── layout ────────────────────────────────────────────────────────────── */

.ad-body { flex: 1; display: grid; grid-template-columns: 330px minmax(0, 1fr); min-height: 0; }

.ad-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.ad-list-head { padding: 12px; border-bottom: 1px solid var(--line); flex: none; }
.ad-list-head input {
  width: 100%; height: 36px; padding: 0 13px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line); color: var(--text); outline: none;
}
.ad-list-head input:focus { border-color: var(--accent-line); }
.ad-list-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; color: var(--text-3); font-size: .73rem; }
.ad-list-tools select { width: auto; min-width: 125px; padding: 5px 8px; font-size: .73rem; }

.ad-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.ad-tab {
  padding: 5px 10px; border-radius: var(--r-full); cursor: pointer;
  background: transparent; border: 1px solid var(--line);
  font-size: .72rem; font-weight: 600; color: var(--text-3);
}
.ad-tab:hover { color: var(--text); }
.ad-tab.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }

.ad-items { overflow-y: auto; padding: 8px; min-height: 0; }
.ad-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px; border-radius: var(--r-sm); cursor: pointer;
  background: transparent; border: 1px solid transparent; color: inherit;
  transition: background .2s, border-color .2s;
}
.ad-item:hover { background: var(--surface); }
.ad-item.is-on { background: var(--accent-soft); border-color: var(--accent-line); }
.ad-thumb {
  width: 40px; height: 52px; flex: none; border-radius: 6px; overflow: hidden;
  background: var(--bg-2); border: 1px solid var(--line);
}
.ad-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ad-item-text { min-width: 0; }
.ad-item-name {
  display: block; font-size: .84rem; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ad-item-name em { font-style: normal; color: var(--text-3); font-weight: 500; }
.ad-item-sub { display: block; font-size: .72rem; color: var(--text-3); margin-top: 2px; }
.ad-draft { color: var(--pro); font-weight: 700; }
.ad-warn { color: var(--premium); font-weight: 700; }
.ad-none { padding: 18px; color: var(--text-3); font-size: .82rem; }

/* ── form ──────────────────────────────────────────────────────────────── */

.ad-form { overflow-y: auto; padding: 20px clamp(16px, 3vw, 32px) 60px; min-height: 0; }
.ad-empty { padding: 60px 0; text-align: center; color: var(--text-3); }
.ad-hint { font-size: .78rem; color: var(--text-3); line-height: 1.6; margin: 4px 0 10px; }
.ad-hint code { font-family: ui-monospace, Menlo, monospace; color: var(--text-2); }

.ad-form-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  position: sticky; top: -20px; z-index: 5;
  margin: -8px 0 20px; padding: 14px 0;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.ad-form-head h2 { font-size: 1.35rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; margin: 3px 0; }
.ad-form-actions { display: flex; gap: 7px; margin-left: auto; flex-wrap: wrap; }
.ad-overline { color: var(--accent); font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.ad-save-state { color: var(--text-3); font-size: .72rem; }
.ad-editor-layout { display: grid; grid-template-columns: minmax(0,1fr) 240px; align-items: start; gap: 22px; }
.ad-editor-main { min-width: 0; }
.ad-section { padding: 18px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-2); }
.ad-section h3 { font-size: .9rem; font-weight: 750; letter-spacing: -.01em; margin: 0 0 6px; }
.ad-section .ad-hint { margin-bottom: 15px; }
.ad-section > .ad-f { margin-top: 6px; }
.ad-preview-sticky { position: sticky; top: 85px; }
.ad-preview-card { position: relative; aspect-ratio: 3 / 4; max-height: 360px; overflow: hidden; margin-top: 12px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface); }
.ad-preview-card::after { content: ''; position: absolute; inset: 35% 0 0; background: linear-gradient(transparent,rgba(0,0,0,.85)); pointer-events: none; }
.ad-preview-card img { width: 100%; height: 100%; object-fit: cover; }
.ad-preview-placeholder { display: flex; align-items: center; justify-content: center; height: 100%; padding: 24px; text-align: center; color: var(--text-3); font-size: .78rem; }
.ad-preview-badges { position: absolute; z-index: 1; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; gap: 5px; }
.ad-preview-badges b { max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 5px 8px; border-radius: 20px; background: rgba(10,10,12,.8); color: #fff; font-size: .62rem; text-transform: uppercase; }
.ad-preview-caption { position: absolute; z-index: 1; bottom: 13px; left: 13px; right: 13px; display: flex; flex-direction: column; gap: 4px; color: #fff; }
.ad-preview-caption strong { line-height: 1.15; font-size: 1rem; }
.ad-preview-caption span { font-size: .72rem; }

/* One row per offer. A checkpoint has three of them, so the row has to stay
   compact enough that three do not become a page. */
.ad-offer {
  display: grid; align-items: center; gap: 7px; margin-bottom: 7px;
  grid-template-columns: 116px 90px 72px 116px minmax(0, 1fr) auto auto;
}
.ad-offer input, .ad-offer select {
  width: 100%; height: 34px; padding: 0 9px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line); color: var(--text); outline: none;
  font-size: .8rem;
}
.ad-offer input:focus, .ad-offer select:focus { border-color: var(--accent-line); }
.ad-offer-pro { white-space: nowrap; font-size: .75rem; }
.ad-format { display: grid; grid-template-columns: minmax(0,1fr) 110px auto; gap: 7px; margin-bottom: 7px; max-width: 420px; }
.ad-format input {
  width: 100%; height: 34px; padding: 0 9px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line); color: var(--text); outline: none; font-size: .8rem;
}
.ad-format input:focus { border-color: var(--accent-line); }

.ad-offer-actions { display: flex; gap: 7px; margin-top: 10px; }

@media (max-width: 1180px) {
  .ad-offer { grid-template-columns: repeat(2, minmax(0, 1fr)) auto auto; }
}

.ad-problems {
  padding: 9px 13px; border-radius: var(--r-sm); margin-bottom: 14px;
  background: rgba(251, 191, 36, .08); border: 1px solid rgba(251, 191, 36, .28);
  color: var(--premium); font-size: .78rem;
}

.ad-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.ad-grid-3 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.ad-row { display: flex; flex-wrap: wrap; gap: 16px; margin: 12px 0; }

.ad-f { display: block; margin-bottom: 12px; }
.ad-f > span { display: block; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 5px; }
.ad-f small { display: block; font-size: .72rem; color: var(--text-3); margin-top: 4px; }

.ad input, .ad select, .ad textarea {
  width: 100%; padding: 9px 12px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  font-family: inherit; font-size: .84rem; outline: none; resize: vertical;
}
.ad input:focus, .ad select:focus, .ad textarea:focus { border-color: var(--accent-line); }
.ad select option { background: var(--surface); }

.ad-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .82rem; color: var(--text-2); }
.ad-check input { width: auto; }

.ad-h { font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin: 26px 0 4px; }

/* images */
.ad-img { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.ad-img-thumb {
  width: 34px; height: 44px; flex: none; border-radius: 5px; overflow: hidden;
  background: var(--bg-2); border: 1px solid var(--line);
}
.ad-img-thumb img,.ad-img-thumb video { width: 100%; height: 100%; object-fit: cover; }
.ad-img-blur { display: inline-flex; align-items: center; gap: 5px; flex: none; color: var(--text-2); font-size: .72rem; cursor: pointer; }
.ad-img-blur input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.ad-img-uploaded { flex: 1; min-width: 0; padding: 9px 12px; color: var(--text-2); font-size: .78rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); }
.ad-trainer-grid { display: grid; gap: 9px; margin-top: 18px; }
.ad-trainer-image { display: grid; grid-template-columns: 58px minmax(0,1fr) auto 32px; align-items: center; gap: 10px; padding: 9px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.ad-trainer-thumb { width: 58px; height: 68px; display: grid; place-items: center; overflow: hidden; border-radius: 7px; background: var(--bg-2); color: var(--text-3); font-size: .7rem; }
.ad-trainer-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ad-trainer-fields { min-width: 0; }.ad-trainer-fields strong { display: block; margin-bottom: 6px; font-size: .76rem; }.ad-trainer-fields small { display: block; margin-top: 4px; color: var(--text-3); font-size: .65rem; }
.ad-hero-preview { width: 100%; min-height: 180px; aspect-ratio: 16 / 7; margin: 12px 0 20px; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--text-3); background: var(--surface); }
.ad-hero-preview img { width: 100%; height: 100%; object-fit: cover; }
.ad-img-tag {
  flex: none; font-size: .64rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); padding: 4px 8px; border-radius: var(--r-full); background: var(--accent-soft);
}
.ad-mini {
  flex: none; width: 30px; height: 30px; border-radius: 7px; cursor: pointer;
  background: transparent; border: 1px solid var(--line); color: var(--text-2); font-size: .9rem;
}
.ad-mini:hover:not(:disabled) { border-color: var(--line-2); color: var(--text); }
.ad-mini:disabled { opacity: .3; cursor: default; }
.ad-mini-x:hover { border-color: #e24b4a; color: #ff9d9d; }
.ad-upload { display: inline-flex; align-items: center; margin-left: 6px; }
.ad [hidden] { display: none !important; }

/* offers */
.ad-shop-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 12px; }
.ad-shop-fields .ad-f:last-child { grid-column: 1 / -1; max-width: 220px; }

.ad-colls { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 8px; }

/* ── import dialog ─────────────────────────────────────────────────────── */

.ad-modal {
  position: fixed; inset: 0; z-index: 130;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(4, 4, 8, .8);
}
.ad-modal-card {
  width: 100%; max-width: 620px; padding: 24px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r);
}
.ad-modal-card h2 { font-size: 1.05rem; font-weight: 800; margin-bottom: 8px; }
.ad-modal-card textarea {
  width: 100%; margin-top: 10px; font-family: ui-monospace, Menlo, monospace; font-size: .76rem;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--r-sm); padding: 10px;
}
.ad-modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

/* ── narrow screens ────────────────────────────────────────────────────── */

@media (max-width: 860px) {
  .ad-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .ad-list { border-right: none; border-bottom: 1px solid var(--line); max-height: 40vh; }
}
@media (max-width: 1180px) {
  .ad-editor-layout { grid-template-columns: minmax(0,1fr); }
  .ad-preview-panel { grid-row: 1; }
  .ad-preview-sticky { position: static; }
  .ad-preview-card { width: 180px; height: 220px; aspect-ratio: auto; }
}
@media (max-width: 560px) {
  .ad-form-head { top: -20px; }
  .ad-form-actions { width: 100%; margin-left: 0; }
  .ad-section { padding: 14px; }
  .ad-grid, .ad-grid-3, .ad-shop-fields { grid-template-columns: minmax(0,1fr); }
  .ad-img { flex-wrap: wrap; }
  .ad-img input { flex: 1 1 calc(100% - 55px); }
  .ad-preview-panel { display: none; }
  .ad-trainer-image { grid-template-columns: 48px minmax(0,1fr) 32px; }
  .ad-trainer-thumb { width: 48px; height: 58px; }
  .ad-trainer-image > label { grid-column: 2; justify-self: start; margin: 0; }
}

/* ── featured picker ────────────────────────────────────────────────────────
   One screen for a job that used to mean opening a form per product. */
.ad-feat-list { display: grid; gap: 7px; }
.ad-feat-rest { max-height: 460px; overflow-y: auto; margin-top: 12px; padding-right: 4px; }

.ad-feat {
  display: flex; align-items: center; gap: 12px;
  padding: 7px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface);
}
.ad-feat.is-on { border-color: var(--accent-line); background: var(--accent-soft); }
.ad-feat-noimg { opacity: .6; }

.ad-feat-thumb {
  position: relative; flex: none; width: 46px; height: 58px;
  overflow: hidden; border-radius: 7px; background: var(--bg-2);
}
.ad-feat-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ad-feat-thumb b {
  position: absolute; inset: auto 0 0 0; padding: 2px 0;
  background: var(--accent); color: #fff; font-size: .62rem; text-align: center;
}

.ad-feat-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; margin-right: auto; }
.ad-feat-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .84rem; }
.ad-feat-text small { color: var(--text-3); font-size: .72rem; }

.ad-feat-actions { display: flex; gap: 5px; flex: none; }
.ad-feat-add { flex: none; margin-top: 0; }

#adFeatSearch {
  width: 100%; height: 36px; padding: 0 13px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line); color: var(--text); outline: none;
}
#adFeatSearch:focus { border-color: var(--accent-line); }

/* SEO: a search result as Google draws it, and the list of every page. */
.ad-count { display: inline-block; margin-top: 5px; font-style: normal; font-size: .7rem; color: rgba(255,255,255,.45); }
.ad-count.is-good { color: #6ede9f; }
.ad-count.is-over { color: #ff8a70; }
.ad-serp { display: grid; gap: 4px; margin-top: 12px; padding: 16px 18px; border-radius: 12px; background: #fff; font-family: Arial, sans-serif; }
.ad-serp-url { color: #202124; font-size: 12px; }
.ad-serp-title { color: #1a0dab; font-size: 19px; font-weight: 400; line-height: 1.3; }
.ad-serp-desc { color: #4d5156; font-size: 13.5px; line-height: 1.55; }
.ad-seo-list { display: grid; gap: 8px; }
.ad-seo-row { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; background: rgba(255,255,255,.02); color: #fff; text-align: left; cursor: pointer; font: inherit; }
.ad-seo-row:hover { border-color: rgba(255,255,255,.25); }
.ad-seo-row.is-bad { border-color: rgba(255,150,80,.35); }
.ad-seo-row strong { font-size: .86rem; }
.ad-seo-row span { font-size: .78rem; color: rgba(255,255,255,.72); line-height: 1.45; }
.ad-seo-row .is-auto { color: rgba(255,255,255,.5); font-weight: 500; }
.ad-seo-row small { font-size: .7rem; color: rgba(255,255,255,.42); }
.ad-seo-row small b { color: #ffab63; font-weight: 600; }

/* Direct sale: the files a buyer receives. */
.ad-sale-files { display: grid; gap: 8px; margin-top: 10px; padding: 14px; border: 1px dashed rgba(255,255,255,.16); border-radius: 12px; }
.ad-sale-title { font-size: .8rem; }
.ad-sale-file { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.04); font-size: .8rem; }
.ad-sale-file small { color: rgba(255,255,255,.45); }
.ad-sale-files .ad-btn { justify-self: start; }

/* Coming soon and release notifications */
.ad-soon { color: var(--accent, #e8642d); font-weight: 700; }
.ad-soon-box { display: grid; gap: 10px; margin-top: 12px; padding: 14px; border: 1px solid rgba(232,100,45,.35); border-radius: 12px; background: rgba(232,100,45,.05); }
.ad-release:not(:empty) { display: grid; gap: 8px; margin-top: 12px; padding: 14px; border: 1px dashed rgba(255,255,255,.16); border-radius: 12px; }
.ad-release .ad-btn { justify-self: start; }
.ad-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ad-confirm p { flex-basis: 100%; margin: 0 0 4px; font-size: .85rem; }
