/* Парсер креативов — пастельно-розовый интерфейс. Один смелый элемент: «барабаны» на главной. */
:root {
  --powder: #FFF1F5;      /* фон */
  --paper: #FFFFFF;
  --rose: #F7B7C9;        /* заливки, рамка барабанов */
  --rose-soft: #FCE3EB;
  --malina: #A8325E;      /* действия, активное (контраст ≥ 4.5:1) */
  --plum: #3D2433;        /* основной текст */
  --ash: #7E5E6E;         /* вторичный текст */
  --line: #F3D3DE;        /* тонкие линии */
  --mint: #BFE8D9;
  --mint-ink: #1F6B52;
  --vanilla: #FFE9A8;
  --vanilla-ink: #7A5A00;
  --r-hero: 28px;
  --r-sheet: 24px;
  --r-field: 14px;
  --r-thumb: 12px;
  --tabs-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--plum);
  background: var(--powder);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--powder); overflow-x: hidden; }
body { min-height: 100vh; font-size: 15px; line-height: 1.45; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--malina); outline-offset: 2px; border-radius: 10px; }
a { color: var(--malina); }

/* ---------- шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: rgba(255, 241, 245, .92);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -.01em; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--rose); box-shadow: 0 0 0 3px var(--rose-soft); }
.status-pill {
  border: 0; border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600;
  background: var(--paper); color: var(--ash);
}
.status-pill.is-busy { background: var(--vanilla); color: var(--vanilla-ink); }
.status-pill.is-ok { background: var(--mint); color: var(--mint-ink); }

/* ---------- экран ---------- */
.view { padding: 4px 16px calc(var(--tabs-h) + var(--safe-b) + 24px); outline: none; }
.screen-title { font-family: "Unbounded", "Onest", sans-serif; font-weight: 700; font-size: 22px; letter-spacing: -.02em; margin: 10px 0 4px; }
.lead { color: var(--ash); margin: 0 0 16px; }
.section { margin-top: 26px; }
.section h3 { font-size: 17px; margin: 0 0 8px; font-weight: 700; }
.muted { color: var(--ash); }
.small { font-size: 13px; }

/* ---------- барабаны (главный экран) ---------- */
.reels {
  margin-top: 6px; padding: 14px; border-radius: var(--r-hero);
  background: linear-gradient(160deg, #FBD6E1 0%, var(--rose) 100%);
  box-shadow: 0 18px 40px -22px rgba(168, 50, 94, .55);
}
.reels-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.reel {
  background: var(--paper); border-radius: 18px; padding: 14px 6px 10px; text-align: center; overflow: hidden;
  box-shadow: inset 0 6px 10px -8px rgba(61, 36, 51, .35), inset 0 -6px 10px -8px rgba(61, 36, 51, .35);
}
.reel-num {
  display: block; font-family: "Unbounded", "Onest", sans-serif; font-weight: 700; font-size: 28px;
  letter-spacing: -.03em; line-height: 1.1; color: var(--plum);
  animation: roll .7s cubic-bezier(.2, .9, .25, 1.15) both;
}
.reel:nth-child(2) .reel-num { animation-delay: .12s; }
.reel:nth-child(3) .reel-num { animation-delay: .24s; }
.reel-label { display: block; margin-top: 6px; font-size: 12px; color: var(--ash); line-height: 1.25; }
.reels-note { margin: 10px 4px 0; font-size: 13px; color: #6B3B52; }
@keyframes roll {
  0% { transform: translateY(-120%); filter: blur(3px); opacity: 0; }
  70% { filter: blur(0); opacity: 1; }
  100% { transform: translateY(0); }
}

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 13px 20px; font-weight: 600; text-decoration: none;
  transition: transform .12s ease, background .2s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--malina); color: #fff; }
.btn-soft { background: var(--rose-soft); color: var(--malina); }
.btn-ghost { background: transparent; color: var(--malina); padding: 8px 4px; }
.btn-block { width: 100%; margin-top: 14px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- списки ---------- */
.list { background: var(--paper); border-radius: 18px; padding: 2px 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row-main { min-width: 0; }
.row-title { font-weight: 600; overflow-wrap: anywhere; }
.row-sub { font-size: 13px; color: var(--ash); }
.row-value { font-weight: 700; white-space: nowrap; }
.row.is-link { cursor: pointer; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; background: var(--rose); }
.dot.ok { background: #4FB38E; } .dot.warn { background: #E2B33B; } .dot.off { background: #D9B8C6; }

/* ---------- фишки и поля ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip {
  flex: none; border: 1px solid var(--line); background: var(--paper); border-radius: 999px;
  padding: 7px 13px; font-size: 14px; white-space: nowrap;
}
.chip.is-on { background: var(--rose); border-color: var(--rose); color: var(--plum); font-weight: 600; }
.chip.is-x::after { content: " ×"; color: var(--malina); }
/* Фильтры таблицы: строка на фильтр, значения — в выпадающем списке */
.dd { border: 1px solid var(--line); border-radius: var(--r-field); background: var(--paper); margin-bottom: 8px; overflow: hidden; }
.dd-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 13px 14px; border: 0; background: none;
  font-weight: 600; text-align: left; }
.dd-val { margin-left: auto; max-width: 58%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-weight: 500; font-size: 14px; color: var(--ash); }
.dd-val.is-on { color: var(--malina); font-weight: 600; }
.dd-chev { flex: none; color: var(--ash); transition: transform .15s ease; }
.dd.is-open { border-color: var(--rose); }
.dd.is-open .dd-chev { transform: rotate(180deg); }
.dd-panel { padding: 0 8px 8px; border-top: 1px solid var(--line); }
.dd-panel .input { margin: 10px 0 4px; padding: 10px 12px; }
.dd-list { max-height: 300px; overflow-y: auto; overscroll-behavior: contain; }
.dd-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 6px; border: 0;
  border-bottom: 1px solid var(--rose-soft); background: none; text-align: left; }
.dd-opt:last-child { border-bottom: 0; }
.dd-box { flex: none; width: 20px; height: 20px; border: 1.5px solid var(--rose); border-radius: 6px; background: var(--paper);
  display: grid; place-items: center; font-size: 13px; line-height: 1; color: var(--paper); }
.dd-opt.is-on .dd-box { background: var(--malina); border-color: var(--malina); }
.dd-opt.is-on .dd-box::after { content: "✓"; }
.dd-opt.is-on .dd-name { font-weight: 600; }
.dd-n { margin-left: auto; font-size: 13px; color: var(--ash); }
@media (prefers-reduced-motion: reduce) { .dd-chev { transition: none; } }
.field { margin-top: 18px; }
.field > label, .field-label { display: block; font-weight: 600; margin-bottom: 8px; }
.input {
  width: 100%; border: 1px solid var(--line); background: var(--paper); border-radius: var(--r-field);
  padding: 12px 14px; font-size: 16px;
}
.input:focus { border-color: var(--malina); outline: none; box-shadow: 0 0 0 3px var(--rose-soft); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--rose-soft); border-radius: 999px; padding: 4px; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 9px; font-weight: 600; color: var(--ash); }
.seg button.is-on { background: var(--paper); color: var(--malina); box-shadow: 0 2px 8px -4px rgba(168, 50, 94, .5); }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--rose-soft); color: var(--malina); font-size: 20px; font-weight: 700; }
.stepper input { width: 110px; text-align: center; }

/* ---------- оценка стоимости ---------- */
.estimate { margin-top: 22px; padding: 16px; border-radius: 20px; background: var(--paper); border: 1.5px dashed var(--rose); }
.estimate-num { font-family: "Unbounded", "Onest", sans-serif; font-size: 30px; font-weight: 700; letter-spacing: -.03em; }
.estimate-sub { color: var(--ash); font-size: 14px; }
.progress { margin-top: 16px; padding: 14px 16px; border-radius: 18px; background: var(--vanilla); color: var(--vanilla-ink); }

/* ---------- таблица: панель ---------- */
.toolbar { padding: 6px 0 8px; }
.toolbar-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.toolbar-row .input { padding: 10px 12px; }
.icon-btn { flex: none; border: 1px solid var(--line); background: var(--paper); border-radius: 12px; padding: 9px 12px; font-weight: 600; font-size: 14px; }
.icon-btn.is-on { border-color: var(--malina); color: var(--malina); }
.count { font-size: 13px; color: var(--ash); margin: 4px 2px 8px; }

/* ---------- карточки объявлений ---------- */
.ad { display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.ad:last-child { border-bottom: 0; }
.thumb { width: 68px; height: 68px; border-radius: var(--r-thumb); object-fit: cover; background: var(--rose-soft); display: block; }
.thumb-ph { width: 68px; height: 68px; border-radius: var(--r-thumb); background: var(--rose-soft); display: grid; place-items: center; color: var(--malina); font-weight: 700; }
.ad-hook { font-weight: 600; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ad-meta { font-size: 13px; color: var(--ash); margin-top: 2px; overflow-wrap: anywhere; }
.ad-when { font-size: 12px; color: var(--malina); margin-top: 1px; }
.group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 18px 4px 8px; }
.group-head b { font-family: "Unbounded", "Onest", sans-serif; font-size: 15px; letter-spacing: -.01em; }
.group-head span { font-size: 13px; color: var(--ash); text-align: right; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--rose-soft); color: var(--malina); }
.tag.offer { background: var(--mint); color: var(--mint-ink); }
.tag.warn { background: var(--vanilla); color: var(--vanilla-ink); }
.tag.go { background: var(--mint); color: var(--mint-ink); font-weight: 600; }
.tag.maybe { background: var(--vanilla); color: var(--vanilla-ink); }
.tag.no { background: #EFE6EA; color: var(--ash); }
.tag.key { background: var(--paper); color: var(--ash); border: 1px solid var(--line); }
.sched { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.sched .field { margin-top: 12px; }
.step-input { width: 84px; padding: 7px 10px; font-size: 14px; border-radius: 999px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-head h3 { margin: 0 0 8px; }
.copy-btn { border: 1px solid var(--line); background: var(--paper); color: var(--malina); border-radius: 999px;
  padding: 4px 12px; font-size: 13px; font-weight: 600; flex: none; margin-left: auto; }
.copy-btn:active { background: var(--rose-soft); }
.tz-label .copy-btn { margin-left: auto; }
.ad-id, .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; color: var(--ash); }
/* разбор по ТЗ в карточке объявления */
.tz { background: var(--paper); border-radius: 18px; padding: 14px 16px; margin-top: 12px; }
.tz.is-pending { display: grid; gap: 4px; }
.tz-label { font-size: 13px; color: var(--ash); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tz .detail-hook { margin-top: 4px; }
.tz-list { margin: 12px 0 0; display: grid; gap: 10px; }
.tz-list dt { font-size: 13px; color: var(--ash); }
.tz-list dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.tz-rd { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.tag.score { background: var(--plum); color: #fff; font-weight: 600; }
.hook-rd { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; margin-top: 12px;
  padding: 12px; border-radius: 14px; background: var(--rose-soft); }
.hook-score { display: flex; align-items: baseline; gap: 4px; color: var(--plum); }
.hook-score b { font-size: 34px; line-height: 1; }
.hook-score span { font-size: 12px; color: var(--ash); line-height: 1.2; }
.crit { display: grid; gap: 5px; }
.crit-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 14px; gap: 8px; align-items: center; font-size: 12px; color: var(--ash); }
.crit-bar { display: block; height: 6px; border-radius: 3px; background: var(--paper); overflow: hidden; }
.crit-bar b { display: block; height: 100%; background: var(--malina); }
.crit-bar.risk b { background: #E2B33B; }
.crit-row em { font-style: normal; color: var(--plum); font-weight: 600; text-align: right; }
.pm { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.pm li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 6px; overflow-wrap: anywhere; }
.pm.plus span { color: var(--mint-ink); font-weight: 700; } .pm.minus span { color: #B25B2E; font-weight: 700; }
.tz-use { margin: 4px 0 0; padding: 8px 10px; background: var(--powder); border-radius: 10px; overflow-wrap: anywhere; }
.tz-rd p { margin: 6px 0 0; }

/* ---------- таблица: сетка ---------- */
.grid-wrap { overflow-x: auto; background: var(--paper); border-radius: 18px; }
table.grid { border-collapse: collapse; min-width: 760px; font-size: 13px; }
.grid th, .grid td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid th { font-weight: 600; color: var(--ash); background: var(--paper); position: sticky; top: 0; }
.grid td:first-child, .grid th:first-child { position: sticky; left: 0; background: var(--paper); }
.grid tr { cursor: pointer; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- полоски аналитики ---------- */
.bar-row { padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.bar-row:last-child { border-bottom: 0; }
.bar-head { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.bar { height: 8px; border-radius: 999px; background: var(--rose-soft); margin-top: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--rose), #EE8FB0); }
.bar-example { display: none; margin-top: 6px; font-size: 13px; color: var(--ash); }
.bar-row.is-open .bar-example { display: block; }
.rnd { background: var(--paper); border-radius: 18px; padding: 14px 16px; white-space: pre-line; }

/* ---------- шторка ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(61, 36, 51, .28); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 88vh; overflow-y: auto;
  background: var(--powder); border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  padding: 8px 16px calc(24px + var(--safe-b)); box-shadow: 0 -18px 50px -20px rgba(61, 36, 51, .45);
  animation: sheet-in .26s cubic-bezier(.2, .9, .3, 1) both;
}
.sheet-grip { width: 42px; height: 5px; border-radius: 999px; background: var(--line); margin: 4px auto 10px; }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
.detail-img { width: 100%; max-height: 52vh; object-fit: contain; border-radius: 18px; background: var(--rose-soft); }
.detail-hook { font-size: 19px; font-weight: 700; line-height: 1.3; margin: 12px 0 4px; overflow-wrap: anywhere; }
.detail-orig { color: var(--ash); font-size: 14px; margin: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin-top: 14px; font-size: 14px; }
.kv dt { color: var(--ash); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.text-block { background: var(--paper); border-radius: 14px; padding: 12px 14px; white-space: pre-line; font-size: 14px; margin-top: 8px; overflow-wrap: anywhere; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 10px 0 10px 40px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.steps li:last-child { border-bottom: 0; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 9px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--rose); color: var(--plum); font-weight: 700; font-size: 14px; display: grid; place-items: center;
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.actions .btn { flex: 1 1 140px; }

/* ---------- нижние вкладки ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: calc(var(--tabs-h) + var(--safe-b));
  padding-bottom: var(--safe-b); display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line);
}
.tab { border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--ash); }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab.is-active { color: var(--malina); font-weight: 600; }
.tab.is-active svg { stroke-width: 2.2; }

/* ---------- тост и пустые состояния ---------- */
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabs-h) + var(--safe-b) + 12px); z-index: 30; background: var(--plum); color: #fff; border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.empty { text-align: center; padding: 34px 12px; color: var(--ash); }
.empty b { display: block; color: var(--plum); font-size: 16px; margin-bottom: 4px; }
.skeleton { height: 68px; border-radius: 14px; background: linear-gradient(90deg, var(--rose-soft), #fff, var(--rose-soft)); background-size: 200% 100%; animation: shimmer 1.2s infinite; margin: 10px 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 640px) {
  .view { max-width: 640px; margin: 0 auto; }
  .reel-num { font-size: 34px; }
}
