/* /opt/skynet-portal/app/static/css/customer-create.css */
/* v0.5.0 — компактнее и аккуратнее: поля 36 px, подписи без капса, меньше отступы, шапка/сегменты/карточка ниже */
/* 27.09.2026: v0.4.0 фото абонента; v0.3.1 окно поверх сайдбара и топбара; v0.3.0 перетаскивание, @container */

/* =====================================================================
   КОРЕНЬ: блокировка прокрутки страницы, слой окна, фон
   ===================================================================== */
html.cnew-lock,
html.cnew-lock body { overflow: hidden; }
/* Окно живёт в #main (внутри .app-shell), а .app-main — свой слой (isolation). Его перекрывали
   соседи: сайдбар (z-sidebar) и топбар (z-topbar, внутри .app-shell). Пока окно открыто —
   .app-shell над сайдбаром, .app-main над топбаром (так же сделано у окна заявок, tickets.css). */
html.cnew-lock .app-shell { z-index: calc(var(--z-sidebar, 300) + 1); }
html.cnew-lock .app-main { position: relative; z-index: calc(var(--z-topbar, 400) + 1); }

.cnew-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.cnew-modal[hidden] { display: none; }
.cnew-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 20, 0.74);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  touch-action: none;
  animation: cnewFade 0.22s ease both;
}

/* =====================================================================
   ПАНЕЛЬ. Цвет типа лица: --cnew-acc (физлицо — акцент портала,
   ԱՁ — янтарь, юрлицо — фиолет). Всё окно перекрашивается плавно.
   ===================================================================== */
.cnew-panel {
  --cnew-acc: var(--accent, #7c5cfc);
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  container: cnew / inline-size;
  width: min(1120px, 100%);
  height: min(88vh, 860px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: var(--surface-gradient, var(--bg-surface));
  border: var(--border-thin, 1px) solid var(--border-default);
  border-radius: 18px;
  box-shadow:
    0 30px 80px -20px rgba(0, 0, 0, 0.65),
    0 0 0 1px color-mix(in srgb, var(--cnew-acc) 14%, transparent),
    0 0 70px -34px var(--cnew-acc);
  overflow: hidden;
  animation: cnewIn 0.34s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  transition: box-shadow 0.35s ease, width 0.28s ease, height 0.28s ease, border-radius 0.28s ease;
}
.cnew-panel[data-lf="sole_proprietor"] { --cnew-acc: #f59e0b; }
.cnew-panel[data-lf="legal_entity"] { --cnew-acc: #8b5cf6; }
.cnew-panel::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  z-index: 3;
  background: linear-gradient(90deg, transparent, var(--cnew-acc), transparent);
  opacity: 0.9;
}
.cnew-panel [hidden] { display: none !important; }

/* Тянут за шапку / уголок — без анимаций размера, окно «приподнято» */
.cnew-panel.is-dragging,
.cnew-panel.is-resizing { transition: none; user-select: none; }
.cnew-panel.is-dragging {
  box-shadow:
    0 44px 110px -24px rgba(0, 0, 0, 0.78),
    0 0 0 1px color-mix(in srgb, var(--cnew-acc) 30%, transparent),
    0 0 90px -30px var(--cnew-acc);
}

/* Уголок размера (справа внизу): тянуть — размер, двойной щелчок — по умолчанию */
.cnew-resize {
  position: absolute;
  right: 3px;
  bottom: 3px;
  z-index: 7;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  color: var(--text-muted);
  cursor: nwse-resize;
  touch-action: none;
  opacity: 0.8;
  transition: color 0.15s ease, opacity 0.15s ease;
}
.cnew-resize:hover,
.cnew-panel.is-resizing .cnew-resize { color: var(--cnew-acc); opacity: 1; }
.cnew-modal.is-max .cnew-resize { display: none; }

/* Клик по фону окно не закрывает — окно слегка «вздрагивает» */
@keyframes cnewNudge {
  0% { scale: 1; }
  35% { scale: 1.012; }
  70% { scale: 0.997; }
  100% { scale: 1; }
}
@media (min-width: 721px) {
  .cnew-panel.is-nudge { animation: cnewIn 0.34s cubic-bezier(0.2, 0.8, 0.2, 1) both, cnewNudge 0.32s ease; }
}

/* «Развернуть»: окно на весь экран с полями 12px */
.cnew-modal.is-max { padding: 12px; }
.cnew-modal.is-max .cnew-panel { width: 100%; height: 100%; border-radius: 14px; }

/* =====================================================================
   ШАПКА
   ===================================================================== */
.cnew-head {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px 10px;
  user-select: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--cnew-acc) 9%, transparent), transparent);
}
@media (min-width: 721px) {
  .cnew-modal:not(.is-max) .cnew-head { cursor: grab; touch-action: none; }
  .cnew-panel.is-dragging .cnew-head { cursor: grabbing; }
}
.cnew-head-ic {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--cnew-acc), color-mix(in srgb, var(--cnew-acc) 55%, #000));
  box-shadow: 0 10px 24px -10px var(--cnew-acc), inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  transition: background 0.35s ease, box-shadow 0.35s ease;
}
.cnew-head-ic svg { width: 18px; height: 18px; }
.cnew-head-txt { min-width: 0; flex: 1 1 auto; }
.cnew-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.cnew-sub {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Сервер, на котором появится абонент (main / filial2) */
.cnew-srv {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--text-secondary);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.cnew-srv-dot {
  width: 7px; height: 7px; flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.cnew-srv[data-srv="main"] .cnew-srv-dot { color: var(--success-text, #22c55e); }
.cnew-srv[data-srv="filial2"] .cnew-srv-dot { color: #f59e0b; }
.cnew-srv-val { font-weight: 700; color: var(--text-primary); }
.cnew-srv.is-down {
  color: var(--danger-text, #ef4444);
  border-color: color-mix(in srgb, var(--danger-text, #ef4444) 55%, transparent);
}
.cnew-srv.is-down .cnew-srv-dot { color: var(--danger-text, #ef4444); animation: cnewBlink 1.2s ease-in-out infinite; }
.cnew-srv.is-down .cnew-srv-val { color: var(--danger-text, #ef4444); }

.cnew-head-acts { display: flex; gap: 6px; flex: 0 0 auto; }
.cnew-hbtn {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-default);
  background: var(--bg-surface-2);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.cnew-hbtn:hover { color: var(--text-primary); border-color: var(--cnew-acc); }
.cnew-hbtn svg { width: 14px; height: 14px; }
.cnew-max-btn .cnew-ic-restore { display: none; }
.cnew-modal.is-max .cnew-max-btn .cnew-ic-max { display: none; }
.cnew-modal.is-max .cnew-max-btn .cnew-ic-restore { display: inline; }
.cnew-hbtn.is-x:hover { color: var(--danger-text, #ef4444); border-color: var(--danger-text, #ef4444); }

/* =====================================================================
   ПЕРЕКЛЮЧАТЕЛЬ ТИПА ЛИЦА (сегменты + едущая подложка)
   ===================================================================== */
.cnew-typebar { padding: 2px 18px 11px; }
.cnew-seg {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border-radius: 12px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
}
.cnew-seg-ink {
  position: absolute;
  top: 3px; bottom: 3px; left: 3px;
  width: 0;
  border-radius: 9px;
  background: color-mix(in srgb, var(--cnew-acc) 18%, var(--bg-surface));
  border: 1px solid color-mix(in srgb, var(--cnew-acc) 55%, transparent);
  box-shadow: 0 8px 22px -12px var(--cnew-acc), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: left 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), width 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
              background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  pointer-events: none;
}
.cnew-seg-btn {
  position: relative;
  z-index: 1;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 5px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease;
}
.cnew-seg-btn svg { width: 15px; height: 15px; flex: 0 0 auto; opacity: 0.85; transition: color 0.2s ease, opacity 0.2s ease; }
.cnew-seg-btn:hover { color: var(--text-primary); }
.cnew-seg-btn.is-on { color: var(--text-primary); }
.cnew-seg-btn.is-on svg { opacity: 1; color: var(--cnew-acc); }
.cnew-seg-btn:focus-visible { outline: 2px solid var(--cnew-acc); outline-offset: 2px; }
.cnew-seg-short { display: none; }

/* =====================================================================
   ТЕЛО: форма + живая карточка
   ===================================================================== */
.cnew-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-areas: "form aside";
  border-top: 1px solid var(--border-subtle);
}
.cnew-form {
  grid-area: form;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.cnew-aside {
  grid-area: aside;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-left: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, color-mix(in srgb, var(--cnew-acc) 5%, transparent), transparent 45%);
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

/* =====================================================================
   СЕКЦИИ ФОРМЫ
   ===================================================================== */
.cnew-sec {
  --cnew-sec-acc: var(--cnew-acc);
  position: relative;
  padding: 11px 13px 13px 15px;
  border-radius: 13px;
  border: 1px solid color-mix(in srgb, var(--cnew-sec-acc) 20%, var(--border-subtle));
  background:
    radial-gradient(120% 70% at 0% 0%, color-mix(in srgb, var(--cnew-sec-acc) 11%, transparent), transparent 62%),
    color-mix(in srgb, var(--bg-surface-2) 62%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  animation: cnewReveal 0.3s ease both;
  transition: border-color 0.3s ease;
}
/* светящаяся полоса цвета секции слева */
.cnew-sec::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: linear-gradient(180deg, var(--cnew-sec-acc), color-mix(in srgb, var(--cnew-sec-acc) 15%, transparent));
  box-shadow: 0 0 12px color-mix(in srgb, var(--cnew-sec-acc) 55%, transparent);
  pointer-events: none;
}
.cnew-sec:focus-within { border-color: color-mix(in srgb, var(--cnew-sec-acc) 38%, var(--border-subtle)); }
.cnew-sec-h {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 9px;
}
.cnew-sec-ic {
  width: 24px; height: 24px; flex: 0 0 auto;
  border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--cnew-sec-acc), color-mix(in srgb, var(--cnew-sec-acc) 52%, #000));
  box-shadow: 0 4px 12px -5px var(--cnew-sec-acc), inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.cnew-sec-ic svg { width: 13px; height: 13px; }
.cnew-sec-t {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.005em;
  white-space: nowrap;
  color: var(--text-primary);
  background: linear-gradient(90deg, var(--text-primary) 35%, color-mix(in srgb, var(--cnew-sec-acc) 78%, var(--text-primary)));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.cnew-sec-line {
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--cnew-sec-acc) 60%, transparent), transparent);
}
.cnew-sec-note { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; }

/* Сворачиваемая секция «Լրացուցիչ» */
.cnew-fold-h {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.cnew-sec.is-fold:not(.is-open) .cnew-fold-h { margin-bottom: 0; }
.cnew-fold-chev { flex: 0 0 auto; width: 16px; height: 16px; color: var(--text-muted); transition: transform 0.25s ease, color 0.2s ease; }
.cnew-sec.is-open .cnew-fold-chev { transform: rotate(180deg); color: var(--cnew-sec-acc); }
.cnew-fold-h:hover .cnew-sec-t { filter: brightness(1.2); }
.cnew-fold-body { animation: cnewReveal 0.25s ease both; }

/* =====================================================================
   СЕТКА ПОЛЕЙ (12 колонок) И ПОЛЯ
   ===================================================================== */
.cnew-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 9px 11px;
}
.cnew-f { grid-column: span 12; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cnew-f.s-3 { grid-column: span 3; }
.cnew-f.s-4 { grid-column: span 4; }
.cnew-f.s-5 { grid-column: span 5; }
.cnew-f.s-6 { grid-column: span 6; }
.cnew-f.s-8 { grid-column: span 8; }
.cnew-f.s-9 { grid-column: span 9; }
.cnew-f.s-12, .cnew-or.s-12 { grid-column: span 12; }

.cnew-l {
  display: flex; align-items: center; gap: 4px;
  min-height: 15px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--text-secondary);
}
.cnew-l-ghost { visibility: hidden; }
.cnew-req { color: var(--danger-text, #ef4444); font-weight: 700; text-shadow: 0 0 6px rgba(239, 68, 68, 0.45); }
.cnew-l-hint {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-tertiary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.cnew-form .input,
.cnew-form .select,
.cnew-form .textarea {
  width: 100%;
  min-height: 36px;
  height: 36px;
  padding-top: 6px;
  padding-bottom: 6px;
  border-radius: 9px;
  font-size: 13.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.cnew-form .textarea { min-height: 64px; height: auto; resize: vertical; padding-top: 8px; line-height: 1.45; }
.cnew-sec .input,
.cnew-sec .select,
.cnew-sec .textarea {
  background-color: color-mix(in srgb, var(--bg-surface) 94%, var(--cnew-sec-acc));
  border-color: color-mix(in srgb, var(--border-default) 82%, var(--cnew-sec-acc));
}
.cnew-form .input::placeholder,
.cnew-form .textarea::placeholder {
  color: color-mix(in srgb, var(--text-muted) 65%, var(--text-secondary));
  opacity: 1;
}
.cnew-form .input:focus,
.cnew-form .select:focus,
.cnew-form .textarea:focus {
  outline: none;
  border-color: var(--cnew-acc);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cnew-acc) 20%, transparent);
}
.cnew-form .select:disabled { opacity: 0.5; cursor: not-allowed; }
.cnew-mono { font-family: var(--font-mono); letter-spacing: 0.02em; }
.cnew-form .dp-display { cursor: pointer; }
/* Календарь портала (datepicker.css) рисуется в <body> — поверх открытого окна */
html.cnew-lock .dp-popup { z-index: 1105; }

/* Поле с иконкой слева (и дополнением справа) */
.cnew-ifx { position: relative; display: flex; align-items: center; }
.cnew-ifx > svg:first-child {
  position: absolute; left: 11px;
  width: 15px; height: 15px;
  color: color-mix(in srgb, var(--cnew-sec-acc, var(--cnew-acc)) 72%, var(--text-tertiary));
  pointer-events: none;
  transition: color 0.15s ease;
}
.cnew-ifx > svg.cnew-ic-viber { color: #8b7cf6; }
.cnew-ifx > svg.cnew-ic-wa { color: #25d366; }
.cnew-ifx .input { padding-left: 34px; }
.cnew-ifx:focus-within > svg:first-child:not(.cnew-ic-viber):not(.cnew-ic-wa) { color: var(--cnew-acc); }
.cnew-ifx.has-addon .input { padding-right: 92px; }
.cnew-addon { position: absolute; right: 5px; display: inline-flex; align-items: center; gap: 4px; }
.cnew-copy {
  height: 24px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.cnew-copy:hover { color: var(--text-primary); border-color: var(--cnew-acc); }
.cnew-okmark {
  position: absolute; right: 11px;
  width: 15px; height: 15px;
  color: var(--success-text, #22c55e);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.cnew-f.is-ok .cnew-okmark { opacity: 1; transform: scale(1); }

/* Подсказка, ошибка, предупреждение */
.cnew-hint { font-size: 11px; line-height: 1.35; color: var(--text-tertiary); }
.cnew-msg { display: none; font-size: 11px; line-height: 1.35; color: var(--danger-text, #ef4444); }
.cnew-msg a { color: inherit; font-weight: 700; text-decoration: underline; }
.cnew-f.is-err .cnew-msg,
.cnew-f.is-warn .cnew-msg { display: block; animation: cnewReveal 0.2s ease both; }
.cnew-f.is-err .input,
.cnew-f.is-err .select {
  border-color: var(--danger-text, #ef4444);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
}
.cnew-f.is-warn .cnew-msg { color: var(--warning-text, #f59e0b); }
.cnew-f.is-warn .input { border-color: color-mix(in srgb, var(--warning-text, #f59e0b) 70%, transparent); }
.cnew-f.is-shake { animation: cnewShake 0.38s ease; }

/* Мини-сегменты (пол, язык) */
.cnew-mseg {
  display: flex; gap: 3px;
  min-height: 36px;
  padding: 3px;
  border-radius: 9px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
}
.cnew-mseg button {
  flex: 1 1 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.cnew-mseg button:hover { color: var(--text-primary); }
.cnew-mseg button.is-on {
  color: var(--text-primary);
  background: color-mix(in srgb, var(--cnew-acc) 18%, var(--bg-surface-2));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cnew-acc) 45%, transparent);
}

/* Строка с переключателем (ԱԱՀ) */
.cnew-switch-row {
  display: flex; align-items: center; gap: 9px;
  min-height: 36px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.cnew-switch-row:has(input:checked) {
  color: var(--text-primary);
  border-color: color-mix(in srgb, var(--cnew-acc) 55%, transparent);
}

/* =====================================================================
   ВЫПАДАЮЩИЕ СПИСКИ ОКНА (cnew-dd): кнопка вида .select + свой список
   ===================================================================== */
.cnew-dd { position: relative; min-width: 0; }
/* обычный <select> остаётся источником значения, но не виден и не ловит клики */
.cnew-dd .cnew-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}
.cnew-form .cnew-dd-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  text-align: left;
  cursor: pointer;
}
.cnew-dd-val {
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}
.cnew-dd-val.is-ph { color: var(--text-muted); }
.cnew-form .cnew-dd-btn:focus-visible,
.cnew-form .cnew-dd-btn.is-open {
  outline: none;
  border-color: var(--cnew-acc);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cnew-acc) 20%, transparent);
}
.cnew-form .cnew-dd-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.cnew-dd-spin {
  display: none;
  width: 14px; height: 14px;
  flex: 0 0 auto;
  margin-right: 18px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--cnew-acc) 30%, transparent);
  border-top-color: var(--cnew-acc);
  animation: cnewSpin 0.7s linear infinite;
}
.cnew-dd-btn.is-loading .cnew-dd-spin { display: inline-block; }

/* Раскрытый список: рисуется в .cnew-modal поверх панели (position: fixed, координаты — JS) */
.cnew-dd-pop {
  position: fixed;
  z-index: 5;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: 14px;
  background: var(--surface-gradient, var(--bg-surface));
  border: 1px solid color-mix(in srgb, var(--cnew-acc, var(--accent)) 30%, var(--border-default));
  box-shadow:
    0 22px 50px -14px rgba(0, 0, 0, 0.62),
    0 0 0 1px rgba(255, 255, 255, 0.02),
    0 0 36px -18px var(--cnew-acc, var(--accent));
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px) scale(0.985);
  transform-origin: top center;
  transition: opacity 0.14s ease, transform 0.16s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.cnew-dd-pop.is-up { transform: translateY(6px) scale(0.985); transform-origin: bottom center; }
.cnew-dd-pop.is-in { opacity: 1; transform: none; }
.cnew-dd-search {
  position: relative;
  flex: 0 0 auto;
  padding: 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.cnew-dd-search svg {
  position: absolute;
  left: 19px; top: 50%;
  width: 15px; height: 15px;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.cnew-dd-q {
  width: 100%;
  height: 32px;
  padding: 0 10px 0 34px;
  border-radius: 9px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-primary);
  font: inherit;
  font-size: 13.5px;
}
.cnew-dd-q:focus {
  outline: none;
  border-color: var(--cnew-acc, var(--accent));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cnew-acc, var(--accent)) 18%, transparent);
}
.cnew-dd-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 6px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.cnew-dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 32px;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.cnew-dd-item + .cnew-dd-item { margin-top: 2px; }
.cnew-dd-item:hover,
.cnew-dd-item.is-active { background: color-mix(in srgb, var(--cnew-acc, var(--accent)) 14%, transparent); }
.cnew-dd-item.is-sel { font-weight: 700; color: var(--cnew-acc, var(--accent)); }
.cnew-dd-item.is-clear { color: var(--text-muted); }
.cnew-dd-txt { min-width: 0; flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cnew-dd-txt mark {
  background: color-mix(in srgb, var(--cnew-acc, var(--accent)) 30%, transparent);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}
.cnew-dd-check { width: 16px; height: 16px; flex: 0 0 auto; }
.cnew-dd-empty { padding: 14px 12px; text-align: center; font-size: 12.5px; color: var(--text-muted); }

/* =====================================================================
   АДРЕС: поиск строкой, каскад, итоговая плашка
   ===================================================================== */
.cnew-addr-search { position: relative; }
.cnew-addr-list {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 6px);
  z-index: 20;
  max-height: 300px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 14px;
  background: var(--surface-gradient, var(--bg-surface));
  border: 1px solid var(--border-default);
  box-shadow: 0 18px 44px -12px rgba(0, 0, 0, 0.55);
  animation: cnewReveal 0.16s ease both;
}
.cnew-addr-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}
.cnew-addr-item:hover,
.cnew-addr-item.is-active { background: color-mix(in srgb, #38bdf8 14%, transparent); }
.cnew-addr-item svg { width: 16px; height: 16px; flex: 0 0 auto; color: #38bdf8; }
.cnew-addr-item-txt { min-width: 0; display: flex; flex-direction: column; }
.cnew-addr-main { font-size: 13px; font-weight: 700; }
.cnew-addr-main mark { background: color-mix(in srgb, #38bdf8 30%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.cnew-addr-sub { font-size: 11.5px; color: var(--text-muted); }
.cnew-addr-empty { padding: 12px; text-align: center; font-size: 12.5px; color: var(--text-muted); }

.cnew-or {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-tertiary);
}
.cnew-or::before,
.cnew-or::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--border-subtle); }

.cnew-addr-chip {
  display: flex; align-items: center; gap: 9px;
  min-height: 36px;
  padding: 4px 6px 4px 11px;
  border-radius: 9px;
  border: 1px dashed var(--border-default);
  font-size: 12.5px;
  color: var(--text-muted);
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.cnew-addr-chip > svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--text-muted); }
.cnew-addr-chip.is-set {
  border-style: solid;
  border-color: color-mix(in srgb, #38bdf8 55%, transparent);
  background: color-mix(in srgb, #38bdf8 9%, transparent);
  color: var(--text-primary);
}
.cnew-addr-chip.is-set > svg { color: #38bdf8; }
.cnew-addr-chip-txt { min-width: 0; flex: 1 1 auto; }
.cnew-addr-full { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cnew-addr-chip:not(.is-set) .cnew-addr-full { font-weight: 500; }
.cnew-addr-insp { font-size: 11.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cnew-addr-x {
  width: 24px; height: 24px; flex: 0 0 auto;
  border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--text-tertiary);
  cursor: pointer;
}
.cnew-addr-x:hover { color: var(--danger-text, #ef4444); border-color: var(--danger-text, #ef4444); }

/* =====================================================================
   ЖИВАЯ КАРТОЧКА (справа)
   ===================================================================== */
.cnew-card {
  position: relative;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--cnew-acc) 32%, var(--border-subtle));
  background:
    radial-gradient(130% 90% at 50% 0%, color-mix(in srgb, var(--cnew-acc) 16%, transparent), transparent 70%),
    var(--bg-surface-2);
  box-shadow: 0 18px 40px -26px var(--cnew-acc);
  overflow: hidden;
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}
.cnew-card-top { display: flex; align-items: center; gap: 11px; }
.cnew-av {
  width: 48px; height: 48px; flex: 0 0 auto;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(135deg, var(--cnew-acc), color-mix(in srgb, var(--cnew-acc) 50%, #000));
  box-shadow: 0 10px 24px -10px var(--cnew-acc), inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  transition: background 0.35s ease, box-shadow 0.35s ease;
}
.cnew-av.is-pop { animation: cnewPop 0.3s ease; }

/* Аватар — место для фото: щелчок выбирает файл, фото перекрывает инициалы */
.cnew-av-wrap { position: relative; flex: 0 0 auto; }
button.cnew-av {
  position: relative;
  padding: 0;
  border: 0;
  overflow: hidden;
  font-family: inherit;
  cursor: pointer;
}
button.cnew-av:hover { filter: brightness(1.08); box-shadow: 0 10px 24px -10px var(--cnew-acc), 0 0 0 3px color-mix(in srgb, var(--cnew-acc) 35%, transparent); }
button.cnew-av:focus-visible { outline: 2px solid var(--cnew-acc); outline-offset: 3px; }
.cnew-av-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cnew-av.has-photo .cnew-av-ini { visibility: hidden; }
.cnew-av-cam {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--cnew-acc), color-mix(in srgb, var(--cnew-acc) 55%, #000));
  border: 2px solid var(--bg-surface-2);
  box-shadow: 0 4px 10px -3px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.cnew-av-cam svg { width: 10px; height: 10px; }
.cnew-av-wrap:hover .cnew-av-cam { transform: scale(1.1); }
.cnew-av-x {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 2px solid var(--bg-surface-2);
  color: #fff;
  background: var(--danger-text, #ef4444);
  box-shadow: 0 4px 10px -3px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.cnew-av-wrap:hover .cnew-av-x,
.cnew-av-x:focus-visible { opacity: 1; transform: none; }
@media (hover: none) { .cnew-av-x { opacity: 1; transform: none; } }

/* Фото тянут на карточку — подсветка и подсказка «отпустите здесь» */
.cnew-card.is-drop {
  outline: 2px dashed var(--cnew-acc);
  outline-offset: -8px;
}
.cnew-card.is-drop::after {
  content: attr(data-drop);
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
  background: color-mix(in srgb, var(--cnew-acc) 16%, color-mix(in srgb, var(--bg-surface) 70%, transparent));
  border-radius: inherit;
  pointer-events: none;
}
.cnew-card-id { min-width: 0; flex: 1 1 auto; }
.cnew-card-name {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cnew-card-name.is-empty { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.cnew-card-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.cnew-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--cnew-acc);
  background: color-mix(in srgb, var(--cnew-acc) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--cnew-acc) 35%, transparent);
  white-space: nowrap;
}
.cnew-badge.is-srv-main { color: var(--success-text, #22c55e); background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.35); }
.cnew-badge.is-srv-filial2 { color: #f59e0b; background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.35); }
.cnew-badge.is-down { color: var(--danger-text, #ef4444); background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.4); }

/* Кольцо заполненности обязательных полей */
.cnew-ring { position: relative; width: 42px; height: 42px; flex: 0 0 auto; }
.cnew-ring svg { width: 42px; height: 42px; transform: rotate(-90deg); }
.cnew-ring circle { fill: none; stroke-width: 5; }
.cnew-ring-bg { stroke: var(--border-subtle, rgba(148, 163, 184, 0.2)); }
.cnew-ring-bar {
  stroke: var(--cnew-acc);
  stroke-linecap: round;
  stroke-dasharray: 125.66;
  stroke-dashoffset: 125.66;
  transition: stroke-dashoffset 0.45s ease, stroke 0.35s ease;
}
.cnew-ring.is-full .cnew-ring-bar { stroke: var(--success-text, #22c55e); }
.cnew-ring b {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--text-primary);
}

.cnew-card-rows {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px solid var(--border-subtle);
}
.cnew-cr { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; line-height: 1.35; color: var(--text-secondary); }
.cnew-cr svg { width: 14px; height: 14px; margin-top: 1px; flex: 0 0 auto; color: var(--cnew-acc); transition: color 0.35s ease; }
.cnew-cr span { min-width: 0; word-break: break-word; }
.cnew-cr .is-empty { color: var(--text-muted); }

/* Чек-лист готовности */
.cnew-check {
  list-style: none;
  margin: 11px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--border-subtle);
  display: grid;
  gap: 6px;
}
.cnew-check li { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); }
.cnew-check i {
  width: 16px; height: 16px; flex: 0 0 auto;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  color: transparent;
  border: 1.5px solid var(--border-default);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.cnew-check li.is-done { color: var(--text-primary); }
.cnew-check li.is-done i { border-color: var(--success-text, #22c55e); background: var(--success-text, #22c55e); color: #fff; }
.cnew-check li.is-opt i { border-style: dashed; }
.cnew-check li.is-opt.is-done i { border-style: solid; }
.cnew-check li.is-bad i { border-color: var(--danger-text, #ef4444); background: var(--danger-text, #ef4444); color: #fff; }

/* =====================================================================
   СОВПАДЕНИЯ (дубли телефона / паспорта)
   ===================================================================== */
.cnew-dups {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.07);
  animation: cnewReveal 0.25s ease both;
}
.cnew-dups.is-block { border-color: rgba(239, 68, 68, 0.5); background: rgba(239, 68, 68, 0.07); }
.cnew-dups-h {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--warning-text, #f59e0b);
}
.cnew-dups.is-block .cnew-dups-h { color: var(--danger-text, #ef4444); }
.cnew-dups-n {
  margin-left: auto;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0;
  color: #1c1204;
  background: var(--warning-text, #f59e0b);
}
.cnew-dups.is-block .cnew-dups-n { color: #fff; background: var(--danger-text, #ef4444); }
.cnew-dup {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.cnew-dup + .cnew-dup { margin-top: 6px; }
.cnew-dup:hover { border-color: var(--cnew-acc); transform: translateY(-1px); }
.cnew-dup.is-block { border-color: rgba(239, 68, 68, 0.45); }
.cnew-dup-srv {
  flex: 0 0 auto;
  min-width: 26px; height: 22px;
  padding: 0 5px;
  border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--success-text, #22c55e);
  background: rgba(34, 197, 94, 0.13);
}
.cnew-dup-srv.is-filial2 { color: #f59e0b; background: rgba(245, 158, 11, 0.13); }
.cnew-dup-body { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
.cnew-dup-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cnew-dup-why {
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cnew-dup.is-block .cnew-dup-why { color: var(--danger-text, #ef4444); }
.cnew-dup-go { width: 16px; height: 16px; flex: 0 0 auto; color: var(--text-muted); }

/* =====================================================================
   ПОДВАЛ
   ===================================================================== */
.cnew-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px;
  border-top: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--bg-surface-2) 60%, transparent);
}
.cnew-foot-hint {
  margin-right: auto;
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}
.cnew-foot-hint kbd {
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-secondary);
}
.cnew-foot-sep { margin: 0 4px; }
.cnew-submit {
  position: relative;
  min-width: 170px;
  min-height: 36px;
  padding: 7px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  justify-content: center;
  gap: 8px;
  border-color: transparent;
  background: linear-gradient(135deg, var(--cnew-acc), color-mix(in srgb, var(--cnew-acc) 68%, #000));
  box-shadow: 0 10px 26px -12px var(--cnew-acc);
  transition: filter 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.cnew-submit:hover:not(:disabled) { filter: brightness(1.08); box-shadow: 0 12px 30px -10px var(--cnew-acc); }
.cnew-submit:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.cnew-submit svg { width: 15px; height: 15px; }
.cnew-submit-spin {
  display: none;
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: cnewSpin 0.7s linear infinite;
}
.cnew-submit.is-busy .cnew-submit-spin { display: inline-block; }
.cnew-submit.is-busy svg { display: none; }

/* =====================================================================
   ЭКРАН УСПЕХА
   ===================================================================== */
.cnew-done {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg-surface) 86%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: cnewFade 0.25s ease both;
}
.cnew-done-card {
  width: min(470px, 100%);
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
  padding: 24px 22px 20px;
  text-align: center;
  border-radius: 18px;
  background: var(--surface-gradient, var(--bg-surface));
  border: 1px solid color-mix(in srgb, var(--success-text, #22c55e) 40%, var(--border-default));
  box-shadow: 0 30px 70px -30px rgba(34, 197, 94, 0.55);
  animation: cnewIn 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.cnew-done-svg { width: 62px; height: 62px; }
.cnew-done-c {
  fill: none;
  stroke: var(--success-text, #22c55e);
  stroke-width: 2.5;
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  animation: cnewDraw 0.55s ease forwards;
}
.cnew-done-p {
  fill: none;
  stroke: var(--success-text, #22c55e);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: cnewDraw 0.35s 0.45s ease forwards;
}
.cnew-done-title { font-size: 17px; font-weight: 800; color: var(--text-primary); }
.cnew-done-name { font-size: 14px; font-weight: 700; color: var(--text-primary); word-break: break-word; }
.cnew-done-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.cnew-done-warn {
  list-style: none;
  width: 100%;
  margin: 4px 0 0;
  padding: 10px 12px;
  display: grid; gap: 4px;
  border-radius: 12px;
  text-align: left;
  font-size: 12.5px;
  color: var(--warning-text, #f59e0b);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.cnew-done-acts { display: flex; gap: 8px; width: 100%; margin-top: 12px; }
.cnew-done-acts .btn { flex: 1 1 auto; justify-content: center; }

/* =====================================================================
   ДОК СВЁРНУТЫХ ЧЕРНОВИКОВ
   ===================================================================== */
.cnew-dock {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 590;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  max-width: min(92vw, 1100px);
  padding: 8px;
  border-radius: 16px;
  background: var(--surface-gradient, var(--bg-surface));
  border: 1px solid var(--border-default);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: cnewDockIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.cnew-dock[hidden] { display: none; }
.cnew-dock-chip {
  --cnew-acc: var(--accent, #7c5cfc);
  display: inline-flex; align-items: center; gap: 9px;
  max-width: 280px;
  padding: 7px 8px;
  border-radius: 12px;
  background: var(--bg-surface-2);
  border: 1px solid color-mix(in srgb, var(--cnew-acc) 55%, transparent);
  box-shadow: 0 6px 20px -6px rgba(0, 0, 0, 0.5), 0 0 18px -6px color-mix(in srgb, var(--cnew-acc) 60%, transparent);
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, color 0.15s ease;
}
.cnew-dock-chip[data-lf="sole_proprietor"] { --cnew-acc: #f59e0b; }
.cnew-dock-chip[data-lf="legal_entity"] { --cnew-acc: #8b5cf6; }
.cnew-dock-chip:hover { color: var(--text-primary); transform: translateY(-2px); }
.cnew-dock-av {
  width: 28px; height: 28px; flex: 0 0 auto;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--cnew-acc), color-mix(in srgb, var(--cnew-acc) 50%, #000));
}
.cnew-dock-av { overflow: hidden; }
.cnew-dock-av img { width: 100%; height: 100%; object-fit: cover; }
.cnew-dock-txt { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.cnew-dock-lbl { font-size: 12.5px; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cnew-dock-sub { font-size: 10.5px; color: var(--text-muted); }
.cnew-dock-x {
  width: 20px; height: 20px; flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.18);
  color: inherit;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.cnew-dock-x:hover { background: var(--danger-text, #ef4444); color: #fff; }

/* =====================================================================
   ПОДТВЕРЖДЕНИЕ ЗАКРЫТИЯ
   ===================================================================== */
.cnew-confirm {
  position: fixed;
  inset: 0;
  z-index: 1010;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.cnew-confirm[hidden] { display: none; }
.cnew-confirm-backdrop {
  position: absolute; inset: 0;
  background: rgba(4, 8, 20, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.cnew-confirm-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  display: flex; flex-direction: column; align-items: center;
  gap: 10px;
  padding: 26px 24px 22px;
  text-align: center;
  border-radius: 20px;
  background: var(--surface-gradient, var(--bg-surface));
  border: 1px solid var(--border-default);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  animation: cnewIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.cnew-confirm-ic {
  width: 54px; height: 54px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--warning-text, #f59e0b);
  background: rgba(245, 158, 11, 0.14);
  box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.06);
}
.cnew-confirm-title { font-size: 17px; font-weight: 800; color: var(--text-primary); }
.cnew-confirm-msg { font-size: 13.5px; line-height: 1.45; color: var(--text-secondary); }
.cnew-confirm-acts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
}
.cnew-confirm-acts .btn { justify-content: center; padding: 11px 14px; border-radius: 11px; font-weight: 600; }
.cnew-confirm-discard {
  grid-column: span 2;
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  box-shadow: 0 8px 22px rgba(225, 29, 72, 0.35);
}
.cnew-confirm-discard:hover { filter: brightness(1.08); }

/* =====================================================================
   АНИМАЦИИ
   ===================================================================== */
@keyframes cnewFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cnewIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
@keyframes cnewUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}
@keyframes cnewReveal {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
@keyframes cnewShake {
  0%, 100% { transform: none; }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}
@keyframes cnewPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
@keyframes cnewSpin { to { transform: rotate(360deg); } }
@keyframes cnewDraw { to { stroke-dashoffset: 0; } }
@keyframes cnewBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes cnewDockIn {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* =====================================================================
   АДАПТИВ
   ===================================================================== */
/* Планшет и узкий ноутбук: окно во всю ширину */
@media (max-width: 1100px) {
  .cnew-panel { width: 100%; height: min(94vh, 1000px); }
}
/* Узкое окно (планшет или окно, сжатое уголком): одна колонка, карточка — полосой сверху */
@container cnew (max-width: 1000px) {
  .cnew-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "aside" "form";
    grid-template-rows: auto auto;
    align-content: start;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .cnew-form,
  .cnew-aside { overflow: visible; }
  .cnew-aside {
    padding: 10px 18px;
    border-left: 0;
    border-bottom: 1px solid var(--border-subtle);
  }
  .cnew-card { padding: 10px 12px; }
  .cnew-card-rows,
  .cnew-check { display: none; }
  .cnew-av { width: 40px; height: 40px; border-radius: 12px; font-size: 15px; }
}
@container cnew (max-width: 820px) {
  .cnew-f.s-3,
  .cnew-f.s-4 { grid-column: span 6; }
  .cnew-f.s-5,
  .cnew-f.s-8,
  .cnew-f.s-9 { grid-column: span 12; }
}
/* Телефон: окно на весь экран, поля в одну колонку, кнопки внизу */
@media (max-width: 720px) {
  .cnew-modal,
  .cnew-modal.is-max { padding: 0; align-items: stretch; }
  .cnew-panel {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    animation: cnewUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }
  .cnew-modal.is-max .cnew-panel { border-radius: 0; }
  .cnew-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "ic txt acts" "ic srv acts";
    column-gap: 10px;
    row-gap: 1px;
    padding: 12px 14px 8px;
    padding-top: calc(12px + env(safe-area-inset-top));
  }
  .cnew-head-ic { grid-area: ic; width: 34px; height: 34px; border-radius: 10px; }
  .cnew-head-ic svg { width: 17px; height: 17px; }
  .cnew-head-txt { grid-area: txt; }
  .cnew-head-acts { grid-area: acts; }
  .cnew-max-btn,
  .cnew-resize { display: none; }
  .cnew-title { font-size: 15.5px; }
  .cnew-sub,
  .cnew-srv-lbl { display: none; }
  .cnew-srv {
    grid-area: srv;
    justify-self: start;
    gap: 6px;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 11.5px;
  }
  .cnew-srv-dot { width: 7px; height: 7px; }
  .cnew-typebar { padding: 4px 14px 10px; }
  .cnew-seg-btn { gap: 6px; min-height: 36px; padding: 5px; font-size: 12.5px; }
  .cnew-seg-btn svg { width: 15px; height: 15px; }
  .cnew-seg-long { display: none; }
  .cnew-seg-short { display: inline; }
  .cnew-aside { padding: 10px 14px; }
  .cnew-form { padding: 12px 14px 20px; }
  .cnew-sec { padding: 12px; border-radius: 14px; }
  .cnew-grid { gap: 10px; }
  .cnew-f.s-3,
  .cnew-f.s-4,
  .cnew-f.s-5,
  .cnew-f.s-6,
  .cnew-f.s-8,
  .cnew-f.s-9 { grid-column: span 12; }
  .cnew-l-ghost { display: none; }
  .cnew-form .input,
  .cnew-form .select,
  .cnew-form .textarea { font-size: 16px; min-height: 40px; height: 40px; }
  .cnew-form .textarea { height: auto; }
  .cnew-form .cnew-dd-btn,
  .cnew-mseg,
  .cnew-switch-row,
  .cnew-addr-chip { min-height: 40px; }
  .cnew-foot { gap: 8px; padding: 10px 14px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .cnew-foot-hint { display: none; }
  .cnew-foot .btn-ghost { flex: 0 0 auto; }
  .cnew-submit { flex: 1 1 auto; min-width: 0; }
  .cnew-done-acts { flex-direction: column-reverse; }
  .cnew-dock { left: 8px; right: 8px; bottom: 8px; transform: none; max-width: none; animation: none; }
  .cnew-dock-chip { max-width: 100%; }
  .cnew-confirm-acts { grid-template-columns: 1fr; }
  .cnew-confirm-discard { grid-column: auto; }
}
/* Низкий экран ноутбука */
@media (max-height: 620px) and (min-width: 721px) {
  .cnew-panel { height: 96vh; }
  .cnew-head { padding-top: 10px; padding-bottom: 7px; }
  .cnew-typebar { padding-bottom: 8px; }
}
/* Без анимаций по системной настройке */
@media (prefers-reduced-motion: reduce) {
  .cnew-backdrop, .cnew-panel, .cnew-sec, .cnew-fold-body, .cnew-addr-list, .cnew-dups,
  .cnew-done, .cnew-done-card, .cnew-confirm-card, .cnew-dock, .cnew-av.is-pop, .cnew-f.is-shake,
  .cnew-panel.is-nudge {
    animation: none !important;
  }
  .cnew-seg-ink, .cnew-ring-bar, .cnew-dd-pop, .cnew-panel { transition: none !important; }
  .cnew-dd-spin { animation-duration: 1.6s !important; }
  .cnew-done-c, .cnew-done-p { stroke-dashoffset: 0; animation: none !important; }
}
