/* Бонусы и кешбэк — дополнения к app.css (копия mockups/app.css без изменений). Взято из mockups/loyalty.css и 10-oformlenie.html.
   Только переменные и приёмы оттуда же: карточки, плитки, таблицы в рамке, .pill, .bar. */

.tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .tiles-3, .tiles-4 { grid-template-columns: minmax(0, 1fr); } }
.tile .v small { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.tile.accent { background: var(--info-bg); box-shadow: none; }
.tile.accent .k { color: var(--info-ink); }
.tile.okk { background: var(--ok-bg); box-shadow: none; }
.tile.okk .k, .tile.okk .v { color: var(--ok-ink); }
.tile.warn { background: var(--warn-bg); box-shadow: none; }
.tile.warn .k, .tile.warn .v { color: var(--warn-ink); }

/* клиент в шапке вкладки */
.who-line { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 16px; }
.who-line .name { font-weight: 600; font-size: 16px; }
.who-line .name a { color: var(--ink); text-decoration: none; }
.who-line .sub { font-size: 13px; color: var(--muted); }
.who-main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ava { width: 40px; height: 40px; border-radius: 50%; background: #c7d2d9; color: #fff; display: grid; place-items: center; font-weight: 600; flex: none; }

/* уровень */
.lvl { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 12px; white-space: nowrap; }
.lvl.base { background: #eef1f3; color: #5b6670; }
.lvl.silver { background: #e6ebf0; color: #48596b; box-shadow: inset 0 0 0 1px #c3ced8; }
.lvl.gold { background: #fff1c7; color: #8a6400; box-shadow: inset 0 0 0 1px #f1d27a; }
.lvl-track { position: relative; height: 10px; border-radius: 5px; background: var(--chip-bg); margin: 30px 0 34px; }
.lvl-fill { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: var(--accent); }
.lvl-fill.after { background: repeating-linear-gradient(135deg, var(--info-bg) 0 6px, #c9eefa 6px 12px); }
.lvl-tick { position: absolute; top: -6px; bottom: -6px; border-left: 1.5px dashed var(--line-strong); }
.lvl-tick span { position: absolute; top: -20px; left: 0; transform: translateX(-50%); font-size: 12px; color: var(--muted); white-space: nowrap; }
.lvl-tick em { position: absolute; bottom: -20px; left: 0; transform: translateX(-50%); font-style: normal; font-size: 12px; font-weight: 600; white-space: nowrap; }
.lvl-tick.first span, .lvl-tick.first em { transform: none; }
.lvl-tick.last span, .lvl-tick.last em { transform: translateX(-100%); }

/* форма списания */
.pay { border-left: 4px solid var(--cta); }
.pay-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px 28px; align-items: start; }
@media (max-width: 860px) { .pay-grid { grid-template-columns: minmax(0, 1fr); } }
.amount { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.amount .input { font-size: 22px; font-weight: 600; width: 170px; text-align: right; min-height: 46px; font-variant-numeric: tabular-nums; }
.amount .unit { font-size: 15px; color: var(--ink-2); }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.quick button { border: 1px solid var(--line-strong); background: #fff; border-radius: 14px; padding: 3px 12px; font-size: 13px; color: var(--ink-2); }
.quick button.on { border-color: var(--accent); color: var(--accent-dark); background: var(--info-bg); }
.limits { margin-top: 12px; font-size: 13px; color: var(--ink-2); display: flex; flex-direction: column; gap: 3px; }
.limits b { font-weight: 600; color: var(--ink); }
.code-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; font-size: 14px; }
.code-row .input { width: 120px; letter-spacing: .3em; text-align: center; font-weight: 600; }
.check { background: var(--chip-bg); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.check .ln { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.check .ln span:first-child { color: var(--ink-2); }
.check .ln.minus span:last-child { color: var(--err-ink); }
.check .ln.tot { border-top: 1px solid var(--line-strong); padding-top: 8px; font-weight: 600; font-size: 16px; }
.check .ln.tot span:first-child { color: var(--ink); }
.check .ln.plus span:last-child { color: var(--ok-ink); font-weight: 600; }

/* резерв */
.hold { border-left: 4px solid var(--accent); }
.hold-head { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
.hold-head .big { font-size: 22px; font-weight: 600; }
.done { border-left: 4px solid var(--ok-ink); }

/* операции */
.ops { display: flex; flex-direction: column; }
.op { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto 110px; gap: 4px 14px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.op:first-child { border-top: 0; padding-top: 0; }
.op .d { color: var(--muted); font-size: 13px; white-space: nowrap; }
.op .t b { font-weight: 500; }
.op .t .sub { font-size: 12px; color: var(--muted); }
.op .s { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.op .s.p { color: var(--ok-ink); }
.op .s.m { color: var(--err-ink); }
.op .s.h { color: var(--info-ink); }
.op .s.w { color: var(--muted); }
@media (max-width: 640px) { .op { grid-template-columns: 70px minmax(0, 1fr) auto; } .op .pill { display: none; } }

/* партии: что сгорит */
.lots { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.lot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; }
.lot .bar { grid-column: 1 / -1; height: 6px; }
.lot .bar i { background: var(--accent); }
.lot.soon .bar i { background: #f0b400; }
.lot .n { font-weight: 600; font-variant-numeric: tabular-nums; }
.lot .sub { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }

/* две колонки */
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.cols > .main, .cols > .side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 980px) { .cols { grid-template-columns: minmax(0, 1fr); } }

/* таблицы */
table.money { min-width: 640px; }
.money td { vertical-align: middle; }
.money td .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.money tr.total td { border-top: 2px solid var(--line-strong); background: var(--chip-bg); font-weight: 600; }
.money td.neg { color: var(--err-ink); }
.money td.pos { color: var(--ok-ink); }

/* SMS-превью */
.sms { background: #e9edf0; border-radius: 16px 16px 16px 4px; padding: 10px 14px; font-size: 14px; max-width: 420px; line-height: 1.45; }
.sms-from { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

/* настройки */
.form-row { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 8px 16px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); font-size: 14px; }
.form-row:first-of-type { border-top: 0; }
.form-row .field-label { font-size: 14px; color: var(--ink); font-weight: 500; }
.form-row .field-label small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.form-row .input { min-height: 34px; padding: 4px 10px; }
.form-row .input.n { width: 90px; text-align: right; }
@media (max-width: 720px) { .form-row { grid-template-columns: minmax(0, 1fr); } }
.choice { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line-strong); border-radius: 10px; padding: 12px 14px; background: #fff; font-size: 14px; }
.opt input { accent-color: var(--accent); margin: 3px 0 0; flex: none; }
.opt.on { border-color: var(--accent); background: #f7fbfd; }
.opt b { display: block; font-weight: 600; margin-bottom: 2px; }
.opt .sub { color: var(--muted); font-size: 13px; }
table.levels td, table.levels th { padding: 8px 10px; }
.levels .input { min-height: 32px; padding: 4px 8px; width: 120px; text-align: right; }
.levels .input.name { width: 150px; text-align: left; }

/* схема роботов на стадиях — иллюстрация в разделе «Роботы» */
.robo { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 3px; overflow-x: auto; }
.robo-col { background: #f5f7f8; min-height: 300px; padding: 0 8px 12px; }
.robo-col h3 { margin: 0 -8px 10px; font-size: 13px; color: #fff; padding: 8px 12px; font-weight: 500; }
.robo-card { background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; padding: 10px 12px; font-size: 13px; margin-bottom: 8px; }
.robo-card b { display: block; font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.robo-card .sub { color: var(--muted); }
.robo-card.ours { border-color: var(--accent); box-shadow: 0 0 0 2px var(--info-bg); }
.robo-card .tag { float: right; font-size: 11px; color: var(--info-ink); background: var(--info-bg); padding: 0 6px; border-radius: 4px; }
.var { display: inline-block; background: var(--info-bg); color: var(--info-ink); border-radius: 4px; padding: 0 5px; font-size: 13px; font-family: ui-monospace, Menlo, monospace; }

/* ---------- вкладка в карточке: рисуется прямо во фрейме ---------- */
.app.tab { max-width: none; padding: 14px 16px 22px; gap: 14px; }

/* ошибки и сообщения рядом с действием */
.note.err, .note.warn, .note.info { border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.note.err { background: var(--err-bg); color: var(--err-ink); }
.note.warn { background: var(--warn-bg); color: var(--warn-ink); }
.note.info { background: var(--info-bg); color: var(--info-ink); }
.err-line { font-size: 13px; color: var(--err-ink); margin-top: 8px; }
.ok-line { font-size: 13px; color: var(--ok-ink); margin-top: 8px; }
.err-line:empty, .ok-line:empty { display: none; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; background: #2b3540; color: #fff; padding: 10px 16px;
  border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); max-width: min(560px, 92vw); }
.toast.bad { background: var(--err-ink); }

/* промокод в сделке */
.promo-ok { background: var(--ok-bg); border-radius: 10px; padding: 12px 14px; margin-top: 12px; }
.promo-ok b { color: var(--ok-ink); }
.promo-ok .hint { color: var(--ok-ink); }
.promo-input { width: 170px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.pay h2 + .row { margin-top: 10px; }
.pay-sub { margin: 18px 0 10px; }

/* форма ручной операции и купоны клиента */
.opform { border-left: 4px solid var(--accent); display: flex; flex-direction: column; gap: 10px; }
.opform .row .input { width: auto; }
.cpn { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.cpn:first-child { border-top: 0; padding-top: 0; }
.cpn .code { font-weight: 600; letter-spacing: .04em; font-family: ui-monospace, Menlo, monospace; }
.cpn .sub { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.ops .op.mini { grid-template-columns: minmax(0, 1fr) auto; }
a.plain { color: inherit; text-decoration: none; }
a.plain:hover { color: var(--link); text-decoration: underline; }

/* оформление кабинета (из макета 10-oformlenie.html) */
.wl { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 20px; align-items: start; }
.wl > .main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.wl .side { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
@media (max-width: 1000px) { .wl { grid-template-columns: minmax(0, 1fr); } .wl .side { position: static; } }
.themes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 720px) { .themes { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.theme { border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: #fff; box-shadow: var(--shadow); font-size: 12px; text-align: center; padding: 0; cursor: pointer; }
.theme.on { border-color: var(--accent); }
.theme i { display: block; height: 34px; }
.theme b { display: block; padding: 4px 0 6px; font-weight: 500; color: var(--ink-2); }
.swatch { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 4px 10px 4px 4px; background: #fff; font-size: 14px; font-family: ui-monospace, Menlo, monospace; cursor: pointer; }
.swatch input[type=color] { width: 26px; height: 26px; border: 0; padding: 0; background: none; cursor: pointer; }
.swatch .hex { width: 76px; border: 0; font: inherit; text-transform: uppercase; padding: 0; outline: none; }
.logo-box { width: 64px; height: 64px; border-radius: 14px; background: var(--chip-bg); color: var(--muted); display: grid; place-items: center; font-weight: 700; font-size: 22px; overflow: hidden; flex: none; }
.logo-box img { width: 100%; height: 100%; object-fit: cover; }
.warnline { font-size: 13px; color: var(--warn-ink); background: var(--warn-bg); border-radius: 8px; padding: 6px 10px; }
.blocks { display: flex; flex-direction: column; gap: 6px; }
.blk { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 10px; background: #fff; font-size: 14px; }
.blk .grow { flex: 1; }
.blk.off { opacity: .55; }
.blk .mv { border: 0; background: var(--chip-bg); border-radius: 6px; width: 26px; height: 26px; padding: 0; line-height: 1; color: var(--ink-2); }
.blk .mv:disabled { opacity: .35; cursor: default; }
.phone { width: 390px; max-width: 100%; background: #111; border-radius: 44px; padding: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
.phone .screen { background: #f4f6f8; border-radius: 34px; overflow: hidden; height: 760px; position: relative; }
.phone iframe { display: block; width: 100%; height: 100%; border: 0; background: #f4f6f8; }
.phone .screen .loading-line { position: absolute; top: 12px; right: 16px; }
.dns { font-family: ui-monospace, Menlo, monospace; color: var(--ink-2); font-size: 13px; }

/* «Поможем настроить» — компактная плашка с вопросом в чат поддержки (как в «Журнале изменений CRM» и «Целях и плане») */
.cta-chat { margin: 0; max-width: 820px; padding: 9px 12px 9px 10px; border-radius: 10px; color: #fff;
  background: linear-gradient(120deg, #4aa3ff 0%, #1269d3 100%); box-shadow: 0 3px 10px rgba(30, 136, 255, .2); }
.cta-main { display: flex; align-items: center; gap: 10px; }
.cta-ico { flex: none; width: 30px; height: 30px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 16px; line-height: 1; }
.cta-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 13px; color: rgba(255,255,255,.92); }
.cta-title { font-size: 14px; font-weight: 600; color: #fff; display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; }
.cta-free { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: #ffe066; color: #5c4400; border-radius: 5px; padding: 1px 6px; }
.cta-act { flex: none; display: flex; align-items: center; }
.btn.cta-btn { height: 30px; padding: 0 14px; background: #fff; color: #1265c7; border: 0; font-weight: 700; text-decoration: none; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.btn.cta-btn:hover { background: #eef6ff; }
.btn.cta-btn:disabled { opacity: .7; cursor: default; }
.cta-link { border: 0; background: none; padding: 0; color: #fff; font: inherit; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.cta-form { margin-top: 9px; display: flex; flex-direction: column; gap: 8px; }
.cta-form .input { border-color: transparent; color: #333; }
.cta-form-row { display: flex; align-items: center; gap: 14px; }
.cta-msg { margin-top: 6px; font-size: 13px; color: #fff; font-weight: 500; }
@media (max-width: 720px) { .cta-main { flex-wrap: wrap; } .cta-act { width: 100%; } }
.cta-chat [hidden] { display: none !important; }
