/* =====================================================================
   ServiceCRM UI-kit (2026-10-14) — единый стиль страниц.
   Эталон — «Заявки с сайтов», «Уведомления», «Записи разговоров».
   Только классы с префиксом ui-: подключение ничего не меняет на старых
   страницах. Токены цвета/тени — из theme.css (--scrm-*).
   ===================================================================== */
:root {
  --ui-line: var(--scrm-border, #e6e9f0);
  --ui-text: var(--scrm-text, #0f172a);
  --ui-muted: var(--scrm-muted, #64748b);
  --ui-faint: #94a3b8;
  --ui-shadow-xs: 0 1px 2px rgba(15,23,42,.04);
  --ui-shadow-sm: 0 1px 2px rgba(15,23,42,.04), 0 4px 12px rgba(15,23,42,.05);
  --ui-shadow: 0 6px 22px rgba(15,23,42,.08);
  --ui-blue: #0d6efd;
}

/* Страница и шапка */
.ui-page { max-width: 880px; margin: 0 auto; }
.ui-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.ui-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; color: var(--ui-text); }
.ui-count { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; background: #ef4444; color: #fff; font-size: .8rem; font-weight: 700; }
.ui-count--muted { background: #e9edf3; color: #475569; }
.ui-lead { margin: 0 0 14px; font-size: .9rem; line-height: 1.45; color: var(--ui-muted); }
.ui-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.ui-tool { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 7px 13px; border-radius: 999px; background: #fff; border: 1px solid var(--ui-line); color: #334155; font-size: .85rem; font-weight: 500; text-decoration: none; box-shadow: var(--ui-shadow-xs); transition: border-color .15s, color .15s; }
.ui-tool:hover { border-color: #c7d2e4; color: var(--ui-text); }
.ui-tool svg { flex-shrink: 0; color: var(--ui-muted); }
.ui-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; color: var(--ui-blue); font-size: .88rem; font-weight: 500; text-decoration: none; }

/* Группа по дню */
.ui-day { margin: 18px 2px 8px; font-size: .76rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ui-faint); }
.ui-day--first { margin-top: 4px; }
.ui-list { display: flex; flex-direction: column; gap: 10px; }

/* Карточка */
.ui-card { position: relative; background: #fff; border: 1px solid var(--ui-line); border-radius: 18px; box-shadow: var(--ui-shadow-sm); padding: 14px 16px; overflow-wrap: anywhere; transition: box-shadow .18s ease; }
@media (hover: hover) { .ui-card:hover { box-shadow: var(--ui-shadow); } }
.ui-card--accent { box-shadow: inset 4px 0 0 var(--ui-accent, var(--ui-blue)), var(--ui-shadow-sm); }
@media (hover: hover) { .ui-card--accent:hover { box-shadow: inset 4px 0 0 var(--ui-accent, var(--ui-blue)), var(--ui-shadow); } }
.ui-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ui-card__title { font-size: 1.1rem; font-weight: 700; color: var(--ui-text); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.ui-when { flex-shrink: 0; text-align: right; font-size: .78rem; color: var(--ui-faint); font-variant-numeric: tabular-nums; line-height: 1.25; }
.ui-when b { display: block; font-size: .95rem; font-weight: 600; color: #475569; }
.ui-meta { font-size: .84rem; color: var(--ui-muted); margin-top: 6px; }
.ui-meta b { font-weight: 500; color: #334155; }

/* Метки */
.ui-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 9px; }
.ui-tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: .76rem; font-weight: 500; background: #f1f5f9; color: #475569; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.ui-tag--red { background: #fdecec; color: #b91c1c; }
.ui-tag--amber { background: #fff4e0; color: #b45309; }
.ui-tag--green { background: #e7f6ec; color: #15803d; }
.ui-tag--blue { background: #e8f0fe; color: #1d4ed8; }
.ui-tag--violet { background: #f2ecff; color: #6d28d9; }

/* Кнопки */
.ui-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.ui-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 7px 15px; border-radius: 999px; border: 1px solid transparent; font-size: .88rem; font-weight: 600; text-decoration: none; cursor: pointer; transition: filter .15s, box-shadow .15s, background .15s; }
.ui-btn svg { flex-shrink: 0; }
.ui-btn--primary { background: var(--ui-blue); color: #fff; box-shadow: 0 4px 12px rgba(13,110,253,.22); }
.ui-btn--primary:hover { color: #fff; filter: brightness(1.05); }
.ui-btn--success { background: #16a34a; color: #fff; box-shadow: 0 4px 12px rgba(22,163,74,.22); }
.ui-btn--success:hover { color: #fff; filter: brightness(1.05); }
.ui-btn--soft { background: #fff; color: #334155; border-color: var(--ui-line); box-shadow: var(--ui-shadow-xs); font-weight: 500; }
.ui-btn--soft:hover { border-color: #c7d2e4; color: var(--ui-text); }
.ui-btn:focus-visible, .ui-tool:focus-visible, .ui-seg a:focus-visible { outline: 3px solid #91bfff; outline-offset: 2px; }

/* Сегмент-переключатель */
.ui-seg { display: flex; padding: 4px; gap: 4px; background: #e9edf3; border-radius: 14px; margin-bottom: 14px; }
.ui-seg a { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 6px 10px; border-radius: 11px; color: #475569; font-size: .9rem; font-weight: 500; text-decoration: none; white-space: nowrap; }
.ui-seg a.is-active, .ui-seg a[aria-current="page"] { background: #fff; color: var(--ui-text); font-weight: 600; box-shadow: 0 1px 3px rgba(15,23,42,.12); }

/* Пустое состояние и сноска */
.ui-empty { text-align: center; padding: 44px 16px; color: var(--ui-muted); background: #fff; border: 1px solid var(--ui-line); border-radius: 18px; box-shadow: var(--ui-shadow-sm); }
.ui-empty__ic { width: 60px; height: 60px; margin: 0 auto 12px; border-radius: 18px; display: flex; align-items: center; justify-content: center; background: #eef1f5; color: var(--ui-faint); }
.ui-empty p { margin: 0; }
.ui-empty p:first-of-type { font-weight: 600; color: #334155; }
.ui-footnote { display: flex; align-items: flex-start; gap: 8px; margin-top: 16px; font-size: .8rem; color: var(--ui-muted); line-height: 1.45; }
.ui-dot { flex-shrink: 0; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.15); }

@media (max-width: 575px) {
  .ui-title { font-size: 1.4rem; }
  .ui-card { padding: 12px 14px; border-radius: 16px; }
}
@media (prefers-reduced-motion: reduce) { .ui-card, .ui-btn, .ui-tool { transition: none; } }

/* ── Обращения клиентов (ap-*) — карточка, блоки, форма результата ── */
.ap-section { margin: 14px 0 16px; }
.ap-section__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.ap-section__title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--ui-text); }
.ap-section--mine .ap-section__title { font-size: 1.1rem; }
.ap-card.is-overdue { border-color: #fca5a5; box-shadow: inset 4px 0 0 #ef4444, var(--ui-shadow-sm); }
.ap-card.is-closed { background: #fcfcfd; box-shadow: var(--ui-shadow-xs); }
.ap-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.ap-tags { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; min-width: 0; }
.ap-head > .ui-tag { flex-shrink: 0; }
.ap-type { background: #fff4e0; color: #b45309; font-weight: 600; }
.ap-type--where_master { background: #fdecec; color: #b91c1c; }
.ap-type--call_ahead { background: #e8f0fe; color: #1d4ed8; }
.ap-type--reschedule { background: #f2ecff; color: #6d28d9; }
.ap-type--payment { background: #e7f6ec; color: #15803d; }
.ap-type--warranty { background: #e3f5f3; color: #0f766e; }
.ap-type--other { background: #f1f5f9; color: #475569; }
.ap-order { margin-top: 8px; font-size: .9rem; color: #475569; }
.ap-order a { font-weight: 600; color: var(--ui-blue); text-decoration: none; }
.ap-text { margin-top: 8px; padding: 8px 11px; border-radius: 12px; background: #f6f7fa; font-size: .9rem; color: #334155; white-space: pre-line; overflow-wrap: anywhere; }
.ap-meta { margin-top: 7px; font-size: .8rem; color: var(--ui-muted); line-height: 1.45; }
.ap-proof { margin-top: 8px; padding: 6px 10px; border-radius: 10px; font-size: .84rem; line-height: 1.35; }
.ap-proof--ok { background: #ecfdf3; color: #166534; border: 1px solid #cdf2dd; }
.ap-proof--try { background: #eff6ff; color: #1e40af; border: 1px solid #dbeafe; }
.ap-proof--warn { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.ap-result { margin-top: 8px; font-size: .86rem; color: #334155; }
.ap-result__comment { color: var(--ui-muted); }
.ap-resolve { margin-top: 10px; padding: 12px; border-radius: 14px; background: #f8fafc; border: 1px solid #edf0f5; }
.ap-resolve.show, .ap-resolve.collapsing { display: flex; flex-direction: column; gap: 10px; }
.ap-outcomes { display: flex; flex-wrap: wrap; gap: 6px; }
.ap-chip { position: relative; display: inline-flex; cursor: pointer; margin: 0; }
.ap-chip input { position: absolute; opacity: 0; pointer-events: none; }
.ap-chip span { display: inline-flex; align-items: center; min-height: 34px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--ui-line); background: #fff; font-size: .84rem; font-weight: 500; color: #334155; }
.ap-chip input:checked + span { background: var(--ui-blue); border-color: var(--ui-blue); color: #fff; }
.ap-chip--warn input:checked + span { background: #f59e0b; border-color: #f59e0b; }
.ap-chip input:focus-visible + span { outline: 3px solid #91bfff; outline-offset: 2px; }
.ap-field { display: flex; flex-direction: column; gap: 4px; font-size: .84rem; font-weight: 500; color: #475569; margin: 0; }
.ap-field textarea, .ap-field input { font-size: 16px; border-radius: 12px; }
.ap-field--resched { display: none; }
.ap-resolve:has(input[value="rescheduled"]:checked) .ap-field--resched { display: flex; }
.ap-cancel { margin-top: 8px; }
.ap-cancel button { border: 0; background: none; padding: 0; color: var(--ui-faint); font-size: .8rem; text-decoration: underline; }
.ap-modal .ap-outcomes { margin-bottom: 12px; }
.ap-modal__hint { font-size: .86rem; color: var(--ui-muted); margin-bottom: 12px; }
.ap-urgent { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: .9rem; color: #334155; }
.ap-kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
@media (max-width: 575px) { .ap-kpi { grid-template-columns: repeat(2, 1fr); } }
.ap-kpi__tile { padding: 11px 13px; border-radius: 16px; background: #f1f3f8; border: 1px solid #e6e9f0; }
.ap-kpi__tile b { display: block; font-size: 1.3rem; font-weight: 700; color: var(--ui-text); line-height: 1.2; }
.ap-kpi__tile span { font-size: .76rem; color: var(--ui-muted); }
.ap-kpi__tile--green { background: #e9faf1; border-color: #cdf2dd; } .ap-kpi__tile--green b { color: #16a34a; }
.ap-kpi__tile--red { background: #fdeef0; border-color: #fbd9de; } .ap-kpi__tile--red b { color: #e11d48; }
.ap-kpi__tile--amber { background: #fff7e8; border-color: #fde7c2; } .ap-kpi__tile--amber b { color: #b45309; }
.ap-seg-count { min-width: 20px; padding: 0 6px; border-radius: 999px; background: #dfe4ec; color: #475569; font-size: .72rem; font-weight: 600; }
.ap-seg-count--red { background: #ef4444; color: #fff; }
.ap-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin-bottom: 14px; }
.ap-filters .form-select { font-size: 16px; min-height: 42px; border-radius: 12px; border-color: var(--ui-line); box-shadow: var(--ui-shadow-xs); }
.ap-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }

/* ── Баланс мастеров (/balance/) ─────────────────────────────────────────── */
.bl-kpi { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.bl-kpi__tile { min-width: 0; padding: 11px 14px; border-radius: 16px; background: #fff; border: 1px solid var(--ui-line); box-shadow: var(--ui-shadow-xs); }
.bl-kpi__tile b { display: block; font-size: 1.2rem; font-weight: 750; line-height: 1.2; color: var(--ui-text); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bl-kpi__tile span { font-size: .76rem; color: var(--ui-muted); }
.bl-kpi__tile.is-debt { background: #fff2f4; border-color: #fbd6dd; }
.bl-kpi__tile.is-debt b { color: #d61f45; }
.bl-kpi__tile.is-credit { background: #edfbf3; border-color: #cdeedb; }
.bl-kpi__tile.is-credit b { color: #0f8a4f; }
.bl-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.bl-search { flex: 1 1 240px; display: flex; align-items: center; gap: 8px; min-height: 44px; margin: 0; padding: 0 14px; border-radius: 999px; background: #fff; border: 1px solid var(--ui-line); box-shadow: var(--ui-shadow-xs); color: var(--ui-faint); cursor: text; }
.bl-search:focus-within { border-color: #9ec5fe; box-shadow: 0 0 0 3px rgba(13,110,253,.12); }
.bl-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--ui-text); }
.bl-tools .ui-seg { margin: 0; flex: 1 1 0; min-width: 0; }
.bl-sort { flex: 0 0 auto; min-height: 46px; }
.bl-seg__n { min-width: 20px; padding: 0 6px; border-radius: 999px; background: #dfe5ee; color: #475569; font-size: .74rem; font-weight: 600; line-height: 18px; text-align: center; }
.ui-seg a.is-active .bl-seg__n { background: #e8f0fe; color: #1d4ed8; }
.bl-list { background: #fff; border: 1px solid var(--ui-line); border-radius: 18px; box-shadow: var(--ui-shadow-sm); overflow: hidden; }
.bl-row { display: flex; align-items: center; gap: 2px; padding-right: 12px; border-top: 1px solid #eef1f5; transition: background-color .15s; }
.bl-row:first-child { border-top: 0; }
.bl-row[hidden] { display: none; }
@media (hover: hover) { .bl-row:hover { background: #f8faff; } }
.bl-row__link { flex: 1; min-width: 0; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "ava name amount" "ava sub sub"; align-items: center; column-gap: 12px; row-gap: 3px; padding: 12px 8px 12px 14px; color: inherit; text-decoration: none; }
.bl-row__link:focus-visible { outline: 3px solid #91bfff; outline-offset: -3px; border-radius: 14px; }
.bl-row__link { -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; touch-action: manipulation; }
.bl-row:active, .bl-row.is-pressed { background: #eaf1fd; transition-duration: 0s; }
.bl-row.is-pressed .bl-row__link { opacity: .72; }
.bl-amount { position: relative; }
.bl-row.is-pressed .bl-amount::after { content: ""; position: absolute; right: 0; top: calc(100% + 5px); width: 14px; height: 14px; border-radius: 50%; border: 2px solid #c7d7f5; border-top-color: #2563eb; animation: bl-spin .7s linear infinite; }
@keyframes bl-spin { to { transform: rotate(360deg); } }
.bl-ava { grid-area: ava; width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; overflow: hidden; color: #fff; font-size: .82rem; font-weight: 700; letter-spacing: .02em; background: linear-gradient(135deg, #60a5fa, #2563eb); }
.bl-ava img { width: 100%; height: 100%; object-fit: cover; }
.bl-ava--1 { background: linear-gradient(135deg, #f9a8d4, #db2777); }
.bl-ava--2 { background: linear-gradient(135deg, #c4b5fd, #7c3aed); }
.bl-ava--3 { background: linear-gradient(135deg, #5eead4, #0d9488); }
.bl-ava--4 { background: linear-gradient(135deg, #fdba74, #ea580c); }
.bl-ava--5 { background: linear-gradient(135deg, #86efac, #16a34a); }
.bl-main { display: contents; }
.bl-name { grid-area: name; min-width: 0; font-size: .95rem; font-weight: 650; line-height: 1.25; color: var(--ui-text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bl-sub { grid-area: sub; min-width: 0; font-size: .78rem; line-height: 1.4; color: var(--ui-muted); }
.bl-sub:empty { display: none; }
.bl-sub > span { display: inline-block; white-space: nowrap; margin-right: 6px; }
.bl-sub > span:not(:last-child)::after { content: "\00a0·"; color: #b8c2d0; }
.bl-sub .is-warn { color: #b45309; }
.bl-sub .is-credit { color: #0f8a4f; font-weight: 600; }
.bl-amount { grid-area: amount; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; text-align: right; font-variant-numeric: tabular-nums; }
.bl-amount strong { font-size: 1rem; font-weight: 750; white-space: nowrap; }
.bl-amount small { font-size: .72rem; color: var(--ui-muted); }
.bl-amount.is-debt strong { color: #d61f45; }
.bl-amount.is-credit strong { color: #0f8a4f; }
.bl-amount.is-zero strong { color: var(--ui-faint); font-weight: 600; }
.bl-call { flex-shrink: 0; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: #edfbf3; border: 1px solid #cdeedb; color: #0f8a4f; text-decoration: none; }
.bl-call:hover { background: #dcf6e8; color: #0b6e3f; }
.bl-none { margin: 0; padding: 26px 16px; text-align: center; color: var(--ui-muted); }
@media (max-width: 575px) {
  .bl-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bl-kpi__tile.is-debt { grid-column: 1 / -1; }
  .bl-kpi__tile.is-debt b { font-size: 1.45rem; }
  .bl-search { flex-basis: 100%; }
  .bl-row { padding-right: 10px; }
  .bl-row__link { column-gap: 10px; padding: 11px 6px 11px 12px; }
  .bl-amount strong { font-size: .95rem; }
}

/* ── Баланс мастера (/balance/<id>/) и общие блоки платежей ──────────────── */
.bd-page { padding-bottom: 8px; }
.bd-head { display: flex; align-items: center; gap: 12px; margin: 2px 0 14px; }
.bd-ava { width: 48px; height: 48px; font-size: .95rem; }
.bd-head__text { min-width: 0; }
.bd-name { margin: 0; font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; color: var(--ui-text); }
.bd-phone { display: inline-flex; align-items: center; gap: 5px; margin-top: 3px; font-size: .86rem; color: #0f8a4f; text-decoration: none; font-variant-numeric: tabular-nums; }
.bd-hero { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; margin-bottom: 8px; border-radius: 18px; border: 1px solid var(--ui-line); background: #fff; box-shadow: var(--ui-shadow-sm); }
.bd-hero__label { font-size: .82rem; color: var(--ui-muted); }
.bd-hero__sum { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--ui-text); }
.bd-hero__meta { font-size: .82rem; color: var(--ui-muted); }
.bd-hero.is-debt { background: #fff2f4; border-color: #fbd6dd; }
.bd-hero.is-debt .bd-hero__sum { color: #d61f45; }
.bd-hero.is-credit { background: #edfbf3; border-color: #cdeedb; }
.bd-hero.is-credit .bd-hero__sum { color: #0f8a4f; }
.bd-kpi { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.bd-kpi__tile { min-width: 0; padding: 10px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--ui-line); box-shadow: var(--ui-shadow-xs); }
.bd-kpi__tile b { display: block; font-size: 1rem; font-weight: 700; line-height: 1.25; color: var(--ui-text); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-kpi__tile span { display: block; margin-top: 2px; font-size: .72rem; line-height: 1.3; color: var(--ui-muted); }
.bd-kpi__tile.is-paid b { color: #0f8a4f; }
.bd-note { margin: 0 0 12px; padding: 12px 14px; border-radius: 14px; background: #f5f7fb; border: 1px solid var(--ui-line); font-size: .86rem; line-height: 1.5; color: #334155; }
.bd-note.is-warn { background: #fff8e8; border-color: #fbe2b4; color: #7c4a03; }
.bd-note.is-ok { background: #edfbf3; border-color: #cdeedb; color: #14532d; }
.bd-note > div + div { margin-top: 4px; }
.bd-note__muted { font-size: .78rem; color: #92724a; }
.bd-card { margin-bottom: 12px; }
.bd-card--flush { padding: 0; overflow: hidden; }
.bd-card__head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 10px; }
.bd-h { margin: 0 0 10px; font-size: 1.02rem; font-weight: 700; color: var(--ui-text); }
.bd-card__head .bd-h { margin: 0; }
.bd-hint { margin: 6px 0 0; font-size: .78rem; line-height: 1.45; color: var(--ui-muted); }
.bd-hint.is-danger { color: #d61f45; }
.bd-empty { margin: 8px 0 0; color: var(--ui-muted); font-size: .88rem; }
.bd-form { display: flex; flex-direction: column; gap: 8px; }
.bd-form__row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 8px; }
.bd-input { width: 100%; min-width: 0; min-height: 46px; padding: 0 13px; border: 1px solid #dfe4ec; border-radius: 12px; background: #fff; color: var(--ui-text); font-size: 16px; line-height: 1.2; }
.bd-input:focus { outline: 0; border-color: #9ec5fe; box-shadow: 0 0 0 3px rgba(13,110,253,.12); }
select.bd-input { appearance: none; -webkit-appearance: none; padding-right: 32px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }
.bd-input--sum { font-weight: 700; }
.bd-input--static { display: flex; align-items: center; background: #f5f7fb; color: #334155; font-weight: 600; }
.bd-input--sm { min-height: 36px; width: auto; padding: 0 30px 0 10px; border-radius: 10px; }
.bd-submit { width: 100%; min-height: 46px; font-size: .95rem; }
.bd-btn-warn { background: #f59e0b; color: #fff; box-shadow: 0 4px 12px rgba(245,158,11,.25); }
.bd-btn-warn:hover { color: #fff; filter: brightness(1.05); }
.bd-adjust { margin-top: 14px; padding-top: 12px; border-top: 1px solid #eef1f5; }
.bd-adjust > summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; font-weight: 700; font-size: .95rem; color: var(--ui-text); min-height: 32px; }
.bd-adjust > summary::-webkit-details-marker, .bd-tech > summary::-webkit-details-marker, .rc-parts > summary::-webkit-details-marker { display: none; }
.bd-adjust > summary::after, .bd-tech > summary::after { content: ""; width: 9px; height: 9px; margin-left: auto; border-right: 2px solid #94a3b8; border-bottom: 2px solid #94a3b8; transform: rotate(45deg); transition: transform .15s; }
.bd-adjust[open] > summary::after, .bd-tech[open] > summary::after { transform: rotate(-135deg); }
.bd-adjust > form { margin-top: 10px; }
.bd-debts { border-top: 1px solid #eef1f5; }
.bd-debt { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 10px; row-gap: 8px; padding: 11px 16px; border-top: 1px solid #eef1f5; }
.bd-debt:first-child { border-top: 0; }
.bd-debt__main { display: flex; flex-direction: column; min-width: 0; color: inherit; text-decoration: none; }
.bd-debt__main b { color: #1d4ed8; font-size: .95rem; }
.bd-debt__main span { font-size: .78rem; color: var(--ui-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-debt__sum { color: #d61f45; font-size: .98rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bd-debt__paid { color: #0f8a4f; font-size: .85rem; }
.bd-debt__pay { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin: 0; }
.bd-debt__method { font-size: .8rem; color: #0f8a4f; font-weight: 600; }
.bd-mini-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid #cdeedb; background: #edfbf3; color: #0f8a4f; font-size: .84rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.bd-mini-btn:hover { background: #dcf6e8; }
.bd-mini-btn.is-danger { border-color: #fbd6dd; background: #fff2f4; color: #d61f45; }
.bd-mini-btn.is-danger:hover { background: #ffe4e9; }
.bd-tech > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; }
.bd-tech > summary .bd-h { margin: 0; }
.bd-txs { margin-top: 10px; border-top: 1px solid #eef1f5; }
.bd-tx { padding: 10px 0; border-bottom: 1px solid #eef1f5; }
.bd-tx:last-child { border-bottom: 0; }
.bd-tx.is-void { opacity: .6; }
.bd-tx__top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.bd-tx__type { font-size: .88rem; font-weight: 600; color: var(--ui-text); }
.bd-tx__sum { font-size: .92rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bd-tx__sum.is-plus { color: #d61f45; }
.bd-tx__sum.is-minus { color: #0f8a4f; }
.bd-tx__meta { display: flex; flex-wrap: wrap; column-gap: 10px; font-size: .76rem; color: var(--ui-muted); margin-top: 2px; }
.bd-tx__comment { margin-top: 3px; font-size: .8rem; color: #475569; overflow-wrap: anywhere; }
.bd-tx__void { margin-top: 3px; font-size: .78rem; color: #d61f45; }
.bd-tx__muted { font-size: .76rem; color: var(--ui-muted); }
.bd-tx__actions:empty { display: none; }
.bd-tx__actions { margin-top: 6px; }
.bd-tx__actions form { margin: 0; }
.bd-curator__nums { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bd-curator__nums > div { padding: 10px 12px; border-radius: 12px; background: #f5f7fb; }
.bd-curator__nums span { display: block; font-size: .74rem; color: var(--ui-muted); }
.bd-curator__nums b { font-size: 1rem; font-variant-numeric: tabular-nums; }
.bd-curator__nums b.is-credit { color: #0f8a4f; }
.bd-curator__link { margin-top: 12px; }
.rc-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.rc-card { padding: 13px 14px; border-radius: 14px; border: 1px solid #e8ecf2; background: #fbfcfe; overflow-wrap: anywhere; }
.rc-card.is-void { opacity: .68; }
.rc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.rc-head__text { min-width: 0; display: flex; flex-direction: column; }
.rc-title { font-size: .95rem; font-weight: 700; color: var(--ui-text); }
.rc-date { font-size: .76rem; color: var(--ui-muted); font-variant-numeric: tabular-nums; }
.rc-sum { font-size: 1.15rem; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ui-text); }
.rc-card.is-pay .rc-sum { color: #0f8a4f; }
.rc-card.is-debt .rc-sum { color: #d61f45; }
.rc-card.is-void .rc-sum { color: var(--ui-muted); text-decoration: line-through; }
.rc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.rc-meta { margin: 4px 0 0; font-size: .8rem; color: #475569; }
.rc-meta--strong { font-weight: 600; }
.rc-meta--ok { color: #0f8a4f; }
.rc-meta--warn { color: #b45309; }
.rc-comment { margin: 6px 0 0; padding: 8px 10px; border-radius: 10px; background: #fff; border: 1px solid #eef1f5; font-size: .85rem; white-space: pre-wrap; }
.rc-parts { margin-top: 8px; }
.rc-parts > summary { cursor: pointer; list-style: none; font-size: .84rem; font-weight: 600; color: #1d4ed8; }
.rc-parts > summary::before { content: "▸ "; }
.rc-parts[open] > summary::before { content: "▾ "; }
.rc-parts ul { margin: 6px 0 0; padding-left: 16px; font-size: .8rem; color: #475569; }
.rc-parts li + li { margin-top: 3px; }
.rc-actions { margin: 10px 0 0; }
.rc-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.rc-pager__n { font-size: .82rem; color: var(--ui-muted); }
.mw-card .rc-section { margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
@media (max-width: 575px) {
  .bd-name { font-size: 1.25rem; }
  .bd-hero__sum { font-size: 1.7rem; }
  .bd-kpi { gap: 6px; }
  .bd-kpi__tile { padding: 9px 10px; }
  .bd-kpi__tile b { font-size: .92rem; }
}

/* ── Мониторинг источников (/reports/sources-watch/) ─────────────────────── */
.sw-card { margin-bottom: 12px; }
.sw-card.is-green { box-shadow: inset 4px 0 0 #22c55e, var(--ui-shadow-sm); }
.sw-card.is-amber { box-shadow: inset 4px 0 0 #f59e0b, var(--ui-shadow-sm); }
.sw-card.is-red { box-shadow: inset 4px 0 0 #ef4444, var(--ui-shadow-sm); border-color: #fbd6dd; }
.sw-card.is-gray { box-shadow: inset 4px 0 0 #cbd5e1, var(--ui-shadow-sm); }
.sw-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sw-name { font-size: 1.12rem; font-weight: 800; color: var(--ui-text); text-decoration: none; letter-spacing: -.01em; }
.sw-status { padding: 4px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.sw-status.is-green { background: #e8f8ef; color: #047857; }
.sw-status.is-amber { background: #fff4e0; color: #b45309; }
.sw-status.is-red { background: #fdecef; color: #c81e3f; }
.sw-status.is-gray { background: #f1f3f8; color: #64748b; }
.sw-sub { margin: 4px 0 10px; font-size: .8rem; color: var(--ui-muted); }
.sw-nums { display: grid; grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr)); gap: 8px; }
.sw-num { min-width: 0; padding: 9px 11px; border-radius: 12px; background: #f5f7fb; }
.sw-num b { display: block; font-size: 1.15rem; font-weight: 800; line-height: 1.2; color: var(--ui-text); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sw-num span { display: block; font-size: .72rem; color: var(--ui-muted); }
.sw-num small { display: block; font-size: .7rem; color: #64748b; margin-top: 1px; }
.sw-num.is-main { background: #eef4ff; }
.sw-num.is-main b { color: #1d4ed8; font-size: 1.35rem; }
.sw-nums--page { margin-bottom: 12px; }
.sw-hours { display: flex; align-items: flex-end; gap: 2px; height: 42px; margin-top: 12px; padding: 0 1px; border-bottom: 1px solid #e6e9f0; }
.sw-bar { flex: 1; height: 3px; border-radius: 3px 3px 0 0; background: #e6e9f0; }
.sw-bar.has { height: max(6px, var(--h)); background: linear-gradient(180deg, #60a5fa, #2563eb); }
.sw-hours__axis { display: flex; justify-content: space-between; font-size: .66rem; color: var(--ui-faint); margin-top: 2px; }
.sw-money { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 10px; font-size: .84rem; color: #475569; }
.sw-money b { color: var(--ui-text); font-variant-numeric: tabular-nums; }
.sw-spend { padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: #f1f3f8; color: #64748b; }
.sw-spend.is-running { background: #e8f8ef; color: #047857; }
.sw-spend.is-stopped { background: #fdecef; color: #c81e3f; }
.sw-actions { margin-top: 12px; padding-top: 10px; border-top: 1px solid #eef1f5; }
.sw-actions > summary { cursor: pointer; list-style: none; font-size: .88rem; font-weight: 600; color: #1d4ed8; }
.sw-actions > summary::-webkit-details-marker { display: none; }
.sw-actions > summary::before { content: "▸ "; }
.sw-actions[open] > summary::before { content: "▾ "; }
.sw-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.sw-form__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sw-label { display: flex; flex-direction: column; gap: 4px; font-size: .76rem; color: var(--ui-muted); }
.sw-spend-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; font-size: .82rem; color: #475569; }
.sw-spend-actions form, .sw-stop { margin: 0; }
.sw-stop { margin-top: 12px; }
.sw-link { padding: 0; border: 0; background: none; color: #c81e3f; font-size: .82rem; text-decoration: underline; cursor: pointer; }
.sw-add { margin-top: 4px; }
.sw-stopped { margin-top: 10px; }
.sw-stopped__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid #eef1f5; }
.sw-stopped__row form { margin: 0; }
.sw-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid #eef1f5; font-size: .86rem; }
.sw-row:first-of-type { border-top: 0; }
.sw-event { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid #eef1f5; }
.sw-event__ic { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; font-size: .9rem; background: #eef4ff; color: #1d4ed8; }
.sw-event__ic.is-lead { background: #f2ecff; color: #6d28d9; }
.sw-event__ic.is-order { background: #e8f8ef; color: #047857; font-weight: 700; }
.sw-event__main { min-width: 0; display: flex; flex-direction: column; }
.sw-event__main b, .sw-event__main a { font-size: .92rem; }
.sw-event__main small { font-size: .76rem; color: var(--ui-muted); overflow-wrap: anywhere; }
.sw-event__at { font-size: .76rem; color: var(--ui-faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sw-pad { padding: 4px 16px 14px; }
@media (max-width: 575px) {
  .sw-nums { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .sw-num.is-main { grid-column: 1 / -1; }
  .sw-num { padding: 8px 10px; }
  .sw-form__row { grid-template-columns: 1fr; }
}

/* Красная кнопка в рабочем месте мастера (блокировка доступа) */
.mw-button--red { background: #e11d48; color: #fff !important; border-color: #e11d48; }
.bl-blocked { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: #fdecef; color: #c81e3f; font-size: .7rem; font-weight: 600; vertical-align: middle; }
/* Баланс мастера: заказ в пользу мастера (клиент оплатил на р/с) и сверка суммы */
.bd-debt.is-credit { background: #f6fbf8; }
.bd-debt__sum--credit { color: #0f8a4f; }
.bd-debts-total { margin: 0; padding: 10px 16px 12px; border-top: 1px solid #eef1f5; font-size: .82rem; color: var(--ui-muted); font-variant-numeric: tabular-nums; }
.bd-debts-total b { color: var(--ui-text); font-weight: 600; }
/* Баланс мастеров: фильтр по куратору */
.bl-curators { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 0 12px; padding-bottom: 2px; }
.bl-curators::-webkit-scrollbar { display: none; }
.bl-curators a { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; background: #fff; border: 1px solid var(--ui-line); color: #334155; font-size: .86rem; text-decoration: none; white-space: nowrap; -webkit-tap-highlight-color: transparent; }
.bl-curators a span { font-size: .76rem; font-weight: 600; color: var(--ui-muted); }
.bl-curators a.is-active { background: var(--ui-text); border-color: var(--ui-text); color: #fff; }
.bl-curators a.is-active span { color: rgba(255,255,255,.75); }
.bl-curators a:active { transform: scale(.97); }
