:root {
  /* Палитра по брендбуку 2022: красный = Pantone 185C / RGB 238-49-53 */
  --red: #EE3135;
  --red-dark: #C42226;
  --ink: #1c1c1e;
  --green: #2E9E5B;
  --bg: #faf7f2;
  --card: #ffffff;
  --line: #ece7df;
  --muted: #8a8580;
  --amber: #d98b00;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(30,20,10,.06);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  /* Roboto — фирменный шрифт по брендбуку */
  font-family: "Roboto", -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 15px; line-height: 1.45;
}
.editor a, .pv-p a { color: var(--red); }
h2 { font-size: 18px; margin: 0 0 6px; display: flex; align-items: center; gap: 10px; }
.muted { color: var(--muted); font-size: 13px; }
.hint { font-size: 12px; font-weight: 500; color: var(--muted); background: #f3efe8; padding: 2px 8px; border-radius: 20px; }

/* ── topbar ── */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.logo {
  font-weight: 900; font-size: 24px; letter-spacing: 1px; color: #fff;
  background: var(--red); padding: 3px 12px; border-radius: 6px;
}
.brand-sub { color: var(--muted); font-size: 13px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.admin-link { color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 600; }
.admin-link:hover { color: var(--red); }
.badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; letter-spacing: .5px; }
.badge-demo { background: #fff3d6; color: var(--amber); }
.badge-live { background: #e0f4e8; color: var(--green); }

/* ── tabs ── */
.tabs { display: flex; gap: 4px; padding: 14px 24px 0; }
.tab {
  border: none; background: transparent; padding: 10px 20px; font-size: 15px; font-weight: 600;
  color: var(--muted); cursor: pointer; border-radius: 10px 10px 0 0; border-bottom: 2px solid transparent;
}
.tab.active { color: var(--red); border-bottom-color: var(--red); }
.tabpane { display: none; }
.tabpane.active { display: block; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 24px 60px; }

/* messages layout */
#tab-messages { display: none; grid-template-columns: 1fr 1fr; gap: 20px; }
#tab-messages.active { display: grid; }
@media (max-width: 820px) { #tab-messages.active { grid-template-columns: 1fr; } }

/* ── card ── */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px;
}
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
input[type=text], textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 14px; font-family: inherit; background: #fff; margin-top: 4px;
}
input[type=text]:focus, textarea:focus { outline: none; border-color: var(--red); }
textarea { resize: vertical; }
.field-row { margin-bottom: 14px; }
.dates { display: flex; align-items: center; gap: 8px; }
.dates input { width: 110px; }
.dates span { color: var(--muted); }

.prod-row { display: grid; grid-template-columns: 1fr 100px; gap: 8px; margin-bottom: 8px; }
.prod-row input { margin-top: 0; }

/* ── buttons ── */
.btn {
  border: none; border-radius: 10px; padding: 11px 18px; font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: transform .05s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--red); color: #fff; margin-top: 6px; }
.btn-primary:hover:not(:disabled) { background: var(--red-dark); }
.btn-approve { background: var(--green); color: #fff; }
.btn-approve:hover:not(:disabled) { background: #268049; }
.btn-ghost { background: #f2efe8; color: var(--ink); }
.btn-ghost:hover { background: #e8e3da; }
.btn-send { background: var(--ink); color: #fff; }
.btn-send:hover { background: #000; }
.row-actions { display: flex; gap: 10px; margin-top: 14px; }

/* ── messages result ── */
.msg-text { font-size: 18px; font-weight: 600; line-height: 1.4; }
.msg-meta { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.counter { font-weight: 700; font-size: 14px; padding: 3px 10px; border-radius: 20px; background: #e0f4e8; color: var(--green); }
.counter.over { background: #fde5e6; color: var(--red); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badges .b { font-size: 11px; background: #f3efe8; color: var(--muted); padding: 2px 8px; border-radius: 20px; }
.approved-note { margin-top: 12px; color: var(--green); font-weight: 600; font-size: 14px; }

/* ── promo input ── */
.promo-grid { display: grid; grid-template-columns: 260px 1fr; gap: 20px; margin: 12px 0; }
@media (max-width: 720px) { .promo-grid { grid-template-columns: 1fr; } }
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); min-height: 170px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  cursor: pointer; color: var(--muted); font-size: 13px; padding: 12px; transition: border-color .15s;
}
.drop:hover, .drop.drag { border-color: var(--red); }
.drop img { max-width: 100%; max-height: 220px; border-radius: 8px; }
.channels-pick { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.channels-pick label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; margin: 0; cursor: pointer; }
.channels-pick input { width: auto; margin: 0; }

/* ── brief card ── */
.brief-card { border-left: 4px solid var(--red); }
.brief-card h3 { margin: 0 0 8px; font-size: 15px; }
.brief-kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 14px; font-size: 13px; }
.brief-kv dt { color: var(--muted); }
.brief-kv dd { margin: 0; }

/* ── channels grid ── */
.channels { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .channels { grid-template-columns: 1fr; } }
.chan-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.chan-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fdfcfa; }
.chan-title { font-weight: 700; font-size: 14px; }
.chan-model { font-size: 10px; color: var(--muted); font-family: ui-monospace, monospace; }
.chan-body { padding: 14px 16px; flex: 1; }

/* editor toolbar */
.toolbar { display: flex; gap: 4px; margin-bottom: 8px; }
.toolbar button { width: 30px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 7px; cursor: pointer; font-size: 14px; }
.toolbar button:hover { background: #f2efe8; }
.tb-b { font-weight: 800; } .tb-i { font-style: italic; } .tb-u { text-decoration: underline; }

.editor {
  border: 1px solid var(--line); border-radius: 9px; padding: 12px; min-height: 90px;
  font-size: 14px; line-height: 1.5; background: #fff;
}
.editor:focus-within { border-color: var(--red); }
.editor .blk { outline: none; margin: 0 0 6px; }
.editor .pv-h, .editor [data-type=heading] { font-weight: 700; font-size: 15px; }
.editor ul, .editor [data-type=list] { margin: 6px 0; padding-left: 4px; }
.editor .li { outline: none; padding-left: 16px; position: relative; }
.editor .li::before { content: "•"; position: absolute; left: 2px; color: var(--red); }
.editor [data-type=quote] { border-left: 3px solid var(--red); padding: 2px 0 2px 12px; margin: 6px 0; color: #555; font-style: italic; background: #faf3f3; border-radius: 0 6px 6px 0; }
.editor [data-type=cta] { display: inline-block; background: var(--red); color: #fff; padding: 6px 14px; border-radius: 8px; font-weight: 700; outline: none; margin-top: 4px; }
.tb-q { font-size: 15px; line-height: 1; }
.pv-quote { border-left: 3px solid var(--red); margin: 6px 0; padding: 4px 12px; color: #555; font-style: italic; background: #faf3f3; border-radius: 0 6px 6px 0; }

/* channel view tabs */
.cv-tabs { display: flex; gap: 4px; margin: 12px 0 8px; }
.cv-tab { font-size: 12px; padding: 4px 10px; border-radius: 7px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--muted); }
.cv-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.cv-out { font-size: 12px; }
.raw { background: #1e1e22; color: #e6e6e6; padding: 12px; border-radius: 9px; font-family: ui-monospace, "SF Mono", monospace; font-size: 11.5px; white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; }
.push-preview { background: #edeef0; border-radius: 12px; padding: 12px; display: flex; gap: 10px; align-items: flex-start; }
.push-preview .ico { width: 34px; height: 34px; border-radius: 8px; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 12px; flex: none; }
.push-preview .pt { font-weight: 700; font-size: 13px; }
.push-preview .pb { font-size: 13px; color: #333; }
.email-frame { width: 100%; height: 320px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }

.chan-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line); }
.chan-status { font-size: 12px; }
.chan-status.ok { color: var(--green); } .chan-status.warn { color: var(--amber); }
.edit-count { font-size: 11px; color: var(--muted); }

.sendbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 8px; padding: 16px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 30px; font-weight: 600; font-size: 14px;
  opacity: 0; transition: all .25s; z-index: 100; pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.err { background: var(--red); }

.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { text-align: center; padding: 40px; color: var(--muted); }

/* ═══════════════ МАСТЕР «АКЦИЯ» ═══════════════ */
.btn-lg { padding: 14px 26px; font-size: 15px; margin-top: 14px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-skip { background: #f3efe8; color: var(--muted); }
.btn-skip:hover { background: #e8e3da; color: var(--ink); }

/* прогресс мастера */
.wiz-progress { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 4px 0 22px; flex-wrap: wrap; }
.wp-step { display: flex; align-items: center; gap: 8px; opacity: .5; transition: opacity .2s; }
.wp-step.active, .wp-step.done { opacity: 1; }
.wp-num { width: 26px; height: 26px; border-radius: 50%; background: #e2ddd4; color: var(--muted); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.wp-step.active .wp-num { background: var(--red); color: #fff; }
.wp-step.done .wp-num { background: var(--green); color: #fff; }
.wp-step.done .wp-num::after { content: "✓"; } .wp-step.done .wp-num { font-size: 0; } .wp-step.done .wp-num::after { font-size: 14px; }
.wp-t { font-size: 13px; font-weight: 600; }
.wp-line { width: 40px; height: 2px; background: #e2ddd4; }
@media (max-width: 600px) { .wp-t { display: none; } .wp-line { width: 20px; } }

.wiz-phase { display: none; }
.wiz-phase.active { display: block; animation: fade .25s; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* блоки материалов */
.mat-block { margin-top: 18px; }
.mat-label { font-weight: 700; font-size: 13px; margin-bottom: 10px; }
.chan-chip { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 500; margin: 0 8px 8px 0; transition: all .12s; user-select: none; }
.chan-chip input { width: auto; margin: 0; accent-color: var(--red); }
.chan-chip:has(input:checked) { border-color: var(--red); background: #fdeef0; }

/* строки товаров по артикулу */
.art-row { display: grid; grid-template-columns: 48px 90px 1fr 90px 90px 1fr 30px; gap: 8px; align-items: center; margin-bottom: 8px; }
.art-row input { margin: 0; }
.art-thumb { width: 48px; height: 48px; border-radius: 8px; background: #f4f2ef; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.art-thumb img { width: 100%; height: 100%; object-fit: cover; }
.art-thumb.empty::after { content: "фото"; font-size: 9px; color: #c3bcb0; }
.art-del { border: none; background: #f3efe8; color: var(--muted); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 18px; line-height: 1; }
.art-del:hover { background: #fde5e6; color: var(--red); }
@media (max-width: 760px) { .art-row { grid-template-columns: 40px 1fr 1fr 30px; } .art-row .art-name { grid-column: 2 / 4; } }

/* степпер */
.stepper { display: flex; gap: 8px; margin: 6px 0 18px; overflow-x: auto; padding-bottom: 4px; }
.step { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--muted); flex: none; position: relative; }
.step.current { border-color: var(--red); color: var(--ink); box-shadow: 0 2px 8px rgba(227,6,19,.12); }
.step.approved { border-color: var(--green); color: var(--green); }
.step.skipped { opacity: .55; }
.step-ico { font-size: 15px; }
.step-badge { font-weight: 800; }
.step.approved .step-badge { color: var(--green); }

/* карточка проверки */
.review-card { padding: 0; overflow: hidden; }
.rc-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); background: #fdfcfa; }
.rc-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.rc-ico { font-size: 18px; }
.rc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
@media (max-width: 860px) { .rc-grid { grid-template-columns: 1fr; } }
.rc-edit { padding: 16px 18px; border-right: 1px solid var(--line); }
.rc-preview { padding: 16px 18px; background: #fbfaf8; }
.rc-prev-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.rc-hint { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.review-card .editor { min-height: 200px; }
.review-card .chan-status { margin-top: 10px; font-size: 13px; }
.chan-status.ok { color: var(--green); } .chan-status.warn { color: var(--amber); }
.msg-panel { padding: 20px 18px; }
.msg-panel .msg-text { font-size: 18px; font-weight: 600; }

/* нижняя навигация шага */
.panel-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; gap: 12px; flex-wrap: wrap; }
.panel-nav-right { display: flex; align-items: center; gap: 10px; }
.edit-count { font-size: 12px; color: var(--muted); }

/* фаза «готово» */
.done-card { text-align: center; max-width: 640px; margin: 0 auto; }
.done-ico { width: 60px; height: 60px; border-radius: 50%; background: var(--green); color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.done-summary { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 18px 0; }
.done-chip { font-size: 13px; padding: 6px 12px; border-radius: 20px; font-weight: 600; }
.done-chip.ok { background: #e0f4e8; color: var(--green); }
.done-chip.skip { background: #f2efe8; color: var(--muted); }

/* автоподтягивание товара по артикулу */
.art-thumb.loading { background: #f4f2ef; }
.spin-sm { display: inline-block; width: 16px; height: 16px; border: 2px solid #d9d3c8; border-top-color: var(--red); border-radius: 50%; animation: spin .7s linear infinite; }
.art-row.art-notfound .art-sku { border-color: var(--red); background: #fdeef0; }
.art-row.art-unavail { opacity: .72; }
.art-row.art-unavail .art-name::after { content: " · нет в наличии"; }
