/* M-UI-CREATE / M-UI-PREVIEW / M-UI-TOKENS (Phase-PIXEL): экран «Создать возврат» 1:1 с прототипом.
   Scoped cc-* во избежание коллизий с app.css. Pixel-Perfect по СПЕЦ §3-7 + hi-01..17. */
[x-cloak] { display: none !important; }
.cc-wrap { max-width: 1040px; }
.cc-sub { color: var(--text-3, #A8A29E); font-size: 13px; margin: 2px 0 18px; }
.cc-empty { max-width: 560px; margin: 64px auto; text-align: center; }
.cc-empty-row { display: flex; gap: 8px; margin-top: 14px; }
.cc-input { flex: 1; height: 48px; border: 1px solid var(--border, #E7E5E4); border-radius: 8px;
  padding: 0 12px; font-family: 'JetBrains Mono', monospace; font-size: 14px; }
.cc-hint { color: var(--text-3, #A8A29E); font-size: 12px; margin-top: 10px; }
.htmx-indicator { opacity: 0; transition: opacity .15s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.cc-loading { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px;
  color: var(--text-2, #57534E); font-size: 13px; }

.cc-chip { display: flex; align-items: center; gap: 10px; background: var(--surface, #fff);
  border: 1px solid var(--border, #E7E5E4); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; max-width: 520px; }
.cc-chip-ic { width: 28px; height: 28px; border-radius: 6px; background: #111; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.cc-chip strong { font-size: 13px; } .cc-chip small { color: var(--text-3); margin-left: 6px;
  font-family: 'JetBrains Mono', monospace; font-size: 11.5px; }
.cc-chip a { margin-left: auto; color: var(--text-2, #57534E); font-size: 13px; }

.cc-grid { display: grid; grid-template-columns: minmax(440px, 1fr) 360px; gap: 18px; align-items: start; }
@media (max-width: 900px) { .cc-grid { grid-template-columns: 1fr; } }
.cc-card { background: var(--surface, #fff); border: 1px solid var(--border, #E7E5E4);
  border-radius: 10px; padding: 20px; }
.cc-card.frozen { opacity: .55; pointer-events: none; filter: grayscale(.4); }
.cc-lbl { color: var(--text-3, #A8A29E); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; }
.cc-name { font-size: 15px; font-weight: 600; margin: 4px 0; }
.cc-muted { color: var(--text-2, #57534E); font-size: 13px; }
.cc-mono { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }

/* тихий телефон с правкой по клику (hi-16) */
.cc-phone-pill { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; padding: 4px 8px;
  border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text-3); transition: background .12s; }
.cc-phone-pill:hover { background: #F5F5F4; }
.cc-phone-pill .cc-mono { color: var(--text-2); }
.cc-phone-src { font-size: 12px; color: var(--text-3); }
.cc-pencil { color: var(--text-3); opacity: 0; transition: opacity .12s; }
.cc-phone-pill:hover .cc-pencil { opacity: 1; }
.cc-phone-input { height: 32px; max-width: 200px; margin-top: 6px; border: 1px solid var(--border);
  border-radius: 6px; padding: 0 10px; font-size: 13px; }

/* даты курса */
.cc-dates { display: flex; gap: 12px; margin-top: 8px; }
.cc-fld { flex: 1; } .cc-fld label { display: block; font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
.cc-input-wrap { position: relative; display: block; }
.cc-input-wrap input { width: 100%; height: 38px; border: 1px solid var(--border); border-radius: 7px;
  padding: 0 32px 0 10px; font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.cc-cal { position: absolute; right: 10px; top: 12px; color: var(--text-3); pointer-events: none; }
.cc-date { width: 100%; height: 38px; border: 1px solid var(--border); border-radius: 7px;
  padding: 0 10px; font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--text);
  background: var(--surface); }
.cc-date::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .6; }
.cc-date:hover::-webkit-calendar-picker-indicator { opacity: 1; }

.cc-seg { display: inline-flex; gap: 2px; background: #F5F5F4; border-radius: 8px; padding: 2px; }
.cc-seg button { border: none; background: none; padding: 6px 12px; border-radius: 6px; font-size: 13px; cursor: pointer; color: var(--text-2); }
.cc-seg button.active { background: #fff; box-shadow: 0 0 0 1px var(--border); font-weight: 600; color: var(--text); }
.cc-seg-sm button { padding: 4px 10px; font-size: 12px; }
.cc-sep { height: 1px; background: var(--border); margin: 18px -20px; }
.cc-block-head { display: flex; justify-content: space-between; align-items: center; margin: 0 0 10px; }
.cc-ref-hint { font-size: 12.5px; color: var(--text-2); margin: 0 0 8px; }

/* платёж — карточка с рамкой (как в дизайне) */
.cc-pay { display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 10px; }
.cc-pay + .cc-pay { margin-top: 8px; }
.cc-pay.off { opacity: .5; }
.cc-check { width: 18px; height: 18px; flex: none; accent-color: #111; cursor: pointer; }
.cc-pay-ic { width: 26px; height: 26px; border-radius: 6px; background: #FEF3C7; color: #92400E;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.cc-pay-text { flex: 1; min-width: 0; } .cc-pay-text .l { font-size: 13px; font-weight: 500; display: block; }
.cc-pay-text .i { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-3); }
.cc-cap { display: block; font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
/* получено / к возврату — одинаковая высота строк -> подписи и значения на одном уровне */
.cc-pay-got, .cc-pay-ret { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
.cc-pay-val { height: 34px; display: flex; align-items: center; font-size: 13px; color: var(--text-2); }
.cc-arrow { color: var(--text-3); align-self: center; }
.cc-ret-field { display: inline-flex; align-items: center; gap: 4px; height: 34px; }
.cc-ret-input { width: 96px; height: 34px; border: 1px solid var(--border); border-radius: 7px;
  text-align: right; padding: 0 8px; font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.cc-ret-input:disabled { background: #FAFAF9; color: var(--text-3); }
.cc-cur { color: var(--text-3); font-size: 13px; }

/* разбивка «как считается» */
.cc-calc { margin-top: 14px; }
.cc-calc-toggle { display: flex; align-items: center; gap: 6px; background: none; border: none;
  color: var(--text-2); font-size: 13px; cursor: pointer; padding: 4px 0; }
.cc-chevron { transition: transform .15s; } .cc-chevron.open { transform: rotate(180deg); }
.cc-breakdown { margin-top: 8px; background: #FAFAF9; border-radius: 8px; padding: 10px 12px; }
.cc-bd-row { display: flex; justify-content: space-between; font-size: 13px; padding: 5px 0; color: var(--text-2); }
.cc-bd-row.total { font-weight: 600; color: var(--text); border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px; }

.cc-multi-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; padding: 10px 12px;
  background: #EFF6FF; border-radius: 8px; font-size: 12.5px; color: #1E40AF; }

.cc-add-comment { background: none; border: none; color: var(--text-2); font-size: 13px; cursor: pointer; padding: 14px 0 0; }
.cc-textarea { width: 100%; min-height: 64px; margin-top: 6px; border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; font-size: 13px; font-family: inherit; resize: vertical; }
.cc-saved { display: inline-block; min-height: 16px; margin-top: 6px; font-size: 12px; color: var(--ok, #065F46); }

/* правая панель */
.cc-result { background: var(--surface, #fff); border: 1px solid var(--border); border-radius: 10px;
  padding: 20px; position: sticky; top: 88px; }
.cc-result .sum { font-family: 'JetBrains Mono', monospace; font-size: 40px; font-weight: 700;
  font-variant-numeric: tabular-nums; margin: 6px 0; }
.cc-badge { display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: 20px; }
.cc-badge.full { background: #D1FAE5; color: #065F46; }
.cc-badge.days { background: #DBEAFE; color: #1E40AF; }
.cc-badge.manual { background: #FEF3C7; color: #92400E; }
.cc-formula { color: var(--text-3); font-size: 12px; margin: 10px 0; line-height: 1.4; }
.cc-divider { height: 1px; background: var(--border); margin: 20px 0; }
.cc-actions { display: flex; flex-direction: column; gap: 14px; }
.cc-actions .cc-btn, .cc-actions .cc-btn-2 { margin: 0; }
.cc-send-to { text-align: center; font-size: 12px; color: var(--text-3); margin-top: -8px;
  font-family: 'JetBrains Mono', monospace; }
.cc-actions .cc-preview-link { align-self: flex-start; margin-top: 2px; }
.cc-btn { width: 100%; height: 46px; border: none; border-radius: 8px; background: #111; color: #fff;
  font-size: 14px; font-weight: 600; margin-top: 10px; cursor: pointer; }
.cc-btn:disabled { opacity: .4; cursor: not-allowed; }
.cc-btn-2 { width: 100%; height: 40px; background: #fff; color: #111; border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; }
.cc-sm { width: auto; height: 32px; padding: 0 12px; font-size: 12px; }
.cc-sms-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; font-size: 11.5px; color: var(--text-3); line-height: 1.4; }
.cc-preview-link { display: inline-flex; align-items: center; gap: 6px; background: none; border: none;
  color: var(--text-2); font-size: 12.5px; cursor: pointer; margin-top: 14px; padding: 0; }
.cc-preview-link:hover { color: var(--text); }
/* Копирование ссылки — лёгкая текстовая кнопка (ниже по весу, чем «Создать возврат»). */
.cc-copy-link { align-self: center; background: none; border: none; color: var(--text-2);
  font-size: 12.5px; font-weight: 500; cursor: pointer; padding: 2px 0; text-decoration: underline;
  text-underline-offset: 3px; }
.cc-copy-link:hover { color: var(--text); }
.cc-copy-link:disabled { opacity: .4; cursor: not-allowed; }
.cc-link-row { display: flex; gap: 6px; margin-top: 12px; }
.cc-link { flex: 1; min-width: 0; height: 32px; border: 1px solid var(--border); border-radius: 7px;
  padding: 0 8px; font-size: 11.5px; color: var(--text-2); background: #FAFAF9; }

/* состояние «Отправлено» */
.cc-frozen-note { display: flex; gap: 8px; align-items: flex-start; background: #EFF6FF; color: #1E40AF;
  border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.cc-sent-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.cc-sent-ic { width: 30px; height: 30px; border-radius: 50%; background: #D1FAE5; color: #065F46;
  display: flex; align-items: center; justify-content: center; flex: none; }
.cc-sent-title { font-size: 15px; font-weight: 600; }
.cc-deliv { display: flex; gap: 8px; align-items: center; font-size: 12.5px; border-radius: 8px;
  padding: 8px 10px; margin-bottom: 12px; }
.cc-deliv-sending { background: #EFF6FF; color: #1E40AF; }
.cc-deliv-delivered { background: #D1FAE5; color: #065F46; }
.cc-deliv-failed { background: #FEF2F2; color: #B91C1C; }
.cc-deliv-ic.ok { color: #065F46; } .cc-deliv-ic.bad { color: #B91C1C; }
.cc-spin { width: 13px; height: 13px; border: 2px solid #BFDBFE; border-top-color: #1E40AF;
  border-radius: 50%; animation: cc-spin .7s linear infinite; flex: none; }
@keyframes cc-spin { to { transform: rotate(360deg); } }
.cc-deliv-fail { margin: -4px 0 12px; }
.cc-deliv-actions { display: flex; gap: 8px; margin-top: 8px; }

/* модалка подтверждения */
.cc-modal-scrim { position: fixed; inset: 0; background: rgba(28,25,23,.34); z-index: 70;
  display: grid; place-items: center; }
.cc-modal { background: #fff; border-radius: 14px; padding: 24px; max-width: 400px; text-align: center;
  box-shadow: 0 24px 48px -12px rgba(28,25,23,.3); }
.cc-modal-ic { width: 44px; height: 44px; border-radius: 50%; background: #FFFBEB; display: grid;
  place-items: center; margin: 0 auto 12px; }
.cc-modal-title { font-size: 17px; font-weight: 700; }
.cc-modal-text { font-size: 13.5px; color: var(--text-2); line-height: 1.5; margin: 8px 0 18px; }
.cc-modal-actions { display: flex; gap: 10px; justify-content: center; }
.cc-modal-actions .cc-btn-2 { width: auto; padding: 0 16px; }

/* ── дровер предпросмотра (M-UI-PREVIEW) ── */
.cc-pv-scrim { position: fixed; inset: 0; background: rgba(28,25,23,.34); z-index: 60; }
.cc-pv-drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 460px; max-width: 100vw;
  background: #fff; border-left: 1px solid var(--border); box-shadow: -16px 0 40px -12px rgba(28,25,23,.22);
  z-index: 61; display: flex; flex-direction: column; animation: cc-slide .2s ease-out; }
.cc-pv-drawer.desk { width: 900px; }
@keyframes cc-slide { from { transform: translateX(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.cc-pv-head { display: flex; align-items: flex-start; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.cc-pv-title { font-size: 15px; font-weight: 600; }
.cc-pv-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.cc-pv-device { display: inline-flex; gap: 2px; background: #F5F5F4; border-radius: 8px; padding: 2px; margin-left: auto; }
.cc-pv-device button { border: none; background: none; padding: 5px 10px; border-radius: 6px; font-size: 12px; cursor: pointer; color: var(--text-2); }
.cc-pv-device button.on { background: #fff; box-shadow: 0 0 0 1px var(--border); font-weight: 600; color: var(--text); }
.cc-pv-close { background: none; border: none; cursor: pointer; color: var(--text-3); padding: 2px; }
.cc-pv-subbar { display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-bottom: 1px solid var(--border); }
.cc-pv-subbar-lbl { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.cc-pv-body { flex: 1; overflow-y: auto; background: #F0EFEE; display: grid; place-items: start center; padding: 24px 16px; }
.cc-phone-frame { width: 380px; max-width: 100%; height: 720px; background: #fff; border-radius: 24px;
  border: 8px solid #1C1917; overflow: hidden; }
.cc-win-frame { width: 100%; max-width: 820px; background: #fff; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--border); box-shadow: 0 8px 24px -8px rgba(28,25,23,.15); }
.cc-win-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: #F5F5F4; border-bottom: 1px solid var(--border); }
.cc-win-dot { width: 10px; height: 10px; border-radius: 50%; }
.cc-win-url { margin-left: 10px; font-size: 11px; color: var(--text-3); }
.cc-pv-iframe { width: 100%; height: 704px; border: none; }
.cc-pv-iframe.desk { height: 620px; }
.cc-pv-channel { font-size: 11.5px; color: var(--text-3); text-align: center; margin-top: 16px; }

/* GC-чекбокс «Ожидает возврата» (перенесён в правый блок) — короткая строка над действиями */
.cc-gc-manage { display: flex; align-items: center; gap: 9px; margin: 0 0 14px; font-size: 13px;
  color: var(--text-2, #57534E); cursor: pointer; }
.cc-gc-manage input { width: 16px; height: 16px; flex: none; cursor: pointer; }

/* Phase-PIPELINE-2: галочка «без подтверждения по SMS» (автоподписание) на экране 2 */
.cc-adv { margin-top: 2px; }
.cc-nosms { display: flex; align-items: center; gap: 9px; margin-top: 12px; padding: 9px 11px;
  border: 1px solid var(--border, #E7E5E4); border-radius: 9px; font-size: 12.5px;
  color: var(--text-2, #57534E); cursor: pointer; }
.cc-nosms input { width: 15px; height: 15px; flex: none; cursor: pointer; }
.cc-nosms-hint { color: var(--text-3, #A8A29E); }

/* M-CARD-SIGN-PANEL: панель лимита SMS-подписи + сброс */
.cc-sign-limit { margin: 10px 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.cc-limit-warn { font-size: 13px; line-height: 1.4; color: #8a5a00; background: #fff6e5; border: 1px solid #ffe0a3; border-radius: 8px; padding: 8px 10px; }
