/* Администрирование. Палитра и логотип существующего экрана сохранены. */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
body.settings-dialog-open { overflow: hidden; }
.good { color: var(--positive) !important; }
.bad { color: var(--negative) !important; }
.settings-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 20px; padding: 5px; width: fit-content; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; }
.settings-tabs a { padding: 8px 14px; color: var(--muted); border-radius: 20px; }
.settings-tabs a[aria-current="page"] { background: var(--ground); color: var(--text); }
.settings-tabs a:hover { color: var(--text); }
.local-notice { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px; color: var(--muted); font-size: 12px; line-height: 18px; margin-bottom: 24px; }
.local-notice svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--accent-ink); }
.local-notice strong { color: var(--text); font-weight: 500; }
.settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; align-items: start; gap: 24px; max-width: 1160px; }
.settings-stack { display: grid; gap: 20px; min-width: 0; }
.settings-card { padding: 22px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); min-width: 0; }
.settings-card h2, .settings-section h2 { font-size: 16px; font-weight: 600; line-height: 22px; }
.settings-card h3 { font-size: 14px; line-height: 20px; font-weight: 500; }
.settings-intro { margin-top: 5px; font-size: 13px; line-height: 19px; color: var(--muted); }
.settings-form { display: grid; gap: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; margin-top: 22px; }
.form-grid .wide { grid-column: 1 / -1; }
.settings-form .input, .settings-modal .input { height: 42px; border-radius: 12px; min-width: 0; }
.settings-form textarea.input { height: 78px; padding-top: 10px; resize: vertical; }
.field small, .help-text { color: var(--muted); font-size: 12px; line-height: 18px; }
.save-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.settings-view .btn, .settings-modal .btn { min-height: 38px; height: auto; padding: 8px 14px; }
.save-feedback { color: var(--positive); font-size: 12px; line-height: 18px; }
.save-feedback.error { color: var(--negative); }
.aside-list { margin-top: 16px; display: grid; gap: 14px; }
.aside-list div { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; font-size: 13px; }
.aside-list dt { color: var(--muted); }
.aside-list dd { text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.aside-note { border-top: 1px solid var(--rule); margin-top: 18px; padding-top: 16px; color: var(--muted); font-size: 12px; line-height: 18px; }
.aside-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; color: var(--accent-ink); font-size: 13px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.section-heading .meta { color: var(--faint); font-size: 12px; }
.channel-list { margin-top: 8px; }
.channel-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 18px 0; }
.channel-row + .channel-row { border-top: 1px solid var(--rule); }
.channel-icon { width: 22px; height: 22px; color: #c7c7cc; stroke-width: 1.5; }
.channel-name { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-weight: 500; }
.channel-description { color: var(--muted); font-size: 12px; line-height: 18px; margin-top: 4px; }
.channel-state { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--faint); font-weight: 400; white-space: nowrap; }
.channel-state::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.channel-state.configured { color: var(--accent-ink); }
.channel-route { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.channel-route svg { width: 14px; height: 14px; color: var(--accent-ink); stroke-width: 1.5; }
.routing-form { display: grid; gap: 18px; margin-top: 20px; }
.setting-check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 20px; }
.setting-check input { width: 17px; height: 17px; margin: 2px 0 0; flex: none; accent-color: var(--primary); }
.setting-check small { display: block; font-size: 12px; color: var(--muted); line-height: 18px; margin-top: 3px; }
.sales-preview { margin: 20px 0 0; }
.sales-preview .kpi-value { font-size: 28px; line-height: 34px; font-weight: 600; margin: 6px 0 12px; }
.sales-preview .meta { color: var(--muted); font-size: 12px; }
.sales-bar { height: 6px; background: var(--raised); border-radius: 99px; overflow: hidden; margin: 14px 0 8px; }
.sales-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.allocation-row { display: grid; grid-template-columns: minmax(0, 1fr) 155px; align-items: center; gap: 12px; padding: 12px 0; }
.allocation-row + .allocation-row { border-top: 1px solid var(--rule); }
.allocation-row span { display: block; }
.allocation-row small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.allocation-row input { text-align: right; font-variant-numeric: tabular-nums; }
.allocation-total { display: flex; justify-content: space-between; gap: 14px; padding-top: 14px; margin-top: 4px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 13px; }
.allocation-total strong { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.team-toolbar { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 22px; }
.team-filters { display: flex; gap: 8px; flex: 1; max-width: 580px; }
.team-filters .input { height: 38px; border-radius: 14px; min-width: 0; }
.team-filters input { flex: 1; }
.team-filters select { width: 170px; }
.team-table { width: 100%; border-collapse: collapse; text-align: left; }
.team-table th { font-size: 12px; color: var(--muted); font-weight: 400; padding: 0 10px 14px; }
.team-table td { padding: 18px 10px; border-top: 1px solid var(--rule); font-size: 13px; vertical-align: middle; }
.team-table th:first-child, .team-table td:first-child { padding-left: 0; }
.team-table th:last-child, .team-table td:last-child { padding-right: 0; text-align: right; }
.team-person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.team-person .avatar { width: 34px; height: 34px; }
.team-person span:not(.avatar) { display: block; overflow-wrap: anywhere; }
.team-person small { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.team-empty { padding: 36px 16px; color: var(--muted); text-align: center; }
.team-summary { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 18px; font-size: 12px; color: var(--muted); }
.team-summary b { color: var(--text); font-weight: 500; }
.settings-modal { width: min(650px, 100%); max-height: calc(100svh - 32px); overflow-y: auto; overscroll-behavior: contain; border-radius: 22px; }
.settings-modal .modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.settings-modal .modal-head h2 { font-size: 18px; font-weight: 600; line-height: 24px; }
.icon-close { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border: 1px solid var(--border); border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.icon-close svg { width: 16px; height: 16px; stroke-width: 1.5; }
.settings-modal .form-grid { margin-top: 4px; }
.settings-modal form { margin-top: 20px; }
.settings-modal .modal-actions { margin-top: 8px; flex-wrap: wrap; }
.settings-modal .local-notice { margin: 4px 0 0; }
.permissions { display: grid; gap: 0; border-top: 1px solid var(--rule); margin-top: 14px; }
.permission-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 6px; }
.permission-heading h3 { font-size: 14px; font-weight: 500; }
.permission-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px 130px; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 13px; }
.permission-row .input { height: 34px; padding: 0 8px; font-size: 12px; }
.permission-row .scope-na { color: var(--faint); font-size: 12px; }
.user-status-row { padding: 12px 0; border-bottom: 1px solid var(--rule); }
.inbox-empty { min-height: 330px; display: grid; align-content: center; justify-items: start; gap: 16px; padding: 36px; }
.inbox-empty > svg { width: 30px; height: 30px; stroke-width: 1.3; color: var(--muted); }
.inbox-empty h2 { font-size: 20px; line-height: 26px; }
.inbox-empty p { color: var(--muted); max-width: 520px; font-size: 14px; line-height: 22px; }
.settings-footer { margin-top: 24px; font-size: 12px; color: var(--faint); line-height: 18px; }
.settings-modal .input:disabled { opacity: 0.7; }
.settings-view { max-width: 1220px; }
.company-toolbar { margin-bottom: 20px; }
.company-toolbar h2 .meta { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.company-actions { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-top: 18px; }
.company-actions .field { flex: 1; min-width: 0; max-width: 520px; }
.company-actions .input { height: 42px; }
.role-catalog { margin-top: 20px; }
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; margin-top: 20px; }
.role-grid article { padding: 16px 0; border-top: 1px solid var(--rule); }
.role-grid p { color: var(--muted); font-size: 13px; line-height: 20px; margin: 6px 0 12px; }
.permission-note { display: block; font-size: 11px; line-height: 16px; color: var(--muted); margin-top: 3px; }
@media (max-width: 1180px) {
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-aside { max-width: none; }
}
@media (max-width: 640px) {
  .settings-tabs { width: 100%; gap: 2px; }
  .settings-tabs a { flex: 1; text-align: center; padding: 8px 7px; font-size: 12px; }
  .settings-card { padding: 18px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .form-grid .wide { grid-column: auto; }
  .save-row .btn.primary { width: 100%; }
  .channel-row { gap: 10px; grid-template-columns: 22px minmax(0, 1fr); }
  .channel-row > .btn { grid-column: 2; justify-self: start; }
  .allocation-row { grid-template-columns: minmax(0, 1fr) 122px; }
  .team-toolbar { align-items: stretch; }
  .team-filters { flex-basis: 100%; flex-wrap: wrap; }
  .team-filters select { width: 100%; }
  .team-table, .team-table tbody, .team-table tr, .team-table td { display: block; }
  .team-table thead { display: none; }
  .team-table tr { padding: 16px 0; border-top: 1px solid var(--rule); }
  .team-table td { border: 0; padding: 5px 0; }
  .team-table td:not(:first-child) { margin-left: 46px; }
  .team-table td:last-child { text-align: left; }
  .settings-modal { padding: 18px; }
  .permission-row { grid-template-columns: minmax(0, 1fr) 120px; gap: 7px; }
  .permission-row > :last-child { grid-column: 2; }
  .permission-row > .input:last-child { margin-top: -2px; }
  .inbox-empty { padding: 22px; min-height: 300px; }
  .settings-view .btn, .settings-modal .btn { min-height: 44px; }
  .settings-modal .modal-head h2 { font-size: 16px; }
  .company-actions { align-items: stretch; flex-direction: column; }
  .company-actions .field { max-width: none; }
  .role-grid { grid-template-columns: 1fr; gap: 0; }
}
.sipuni-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--rule); }
.sipuni-section h3 { font-size: 14px; margin: 0 0 8px; font-weight: 600; }
.sipuni-users { display: grid; gap: 12px; margin-top: 12px; }
.sipuni-user { display: grid; grid-template-columns: 32px minmax(0,1fr) 100px; gap: 10px; align-items: center; }
.sipuni-user label { min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.sipuni-user label small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.sipuni-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #233958; color: #92b8ff; font-size: 14px; }
.sipuni-pending { padding: 11px 12px; border: 1px dashed #505050; border-radius: 9px; color: var(--muted); font-size: 13px; }
.sipuni-guide { margin: 20px 0 14px; font-size: 13px; line-height: 1.6; }
.sipuni-guide summary { color: #8bb4ff; cursor: pointer; }
.sipuni-guide ol { padding-left: 20px; margin-bottom: 10px; }
.sipuni-guide li + li { margin-top: 9px; }
.sipuni-guide a { color: #8bb4ff; text-decoration: underline; text-underline-offset: 3px; }
.sipuni-section .field-help { color: var(--muted); font-size: 12px; line-height: 1.6; }
.settings-modal .field-help { display: block; color: var(--muted); font-size: 12px; line-height: 18px; margin-top: 6px; }
.tg-brand { width: 36px; height: 36px; flex: none; }
.tg-intro { display: flex; align-items: center; gap: 12px; }
.tg-check { margin-top: 14px; }
.tg-modes { border: 0; margin: 16px 0; padding: 0; min-width: 0; }
.tg-modes legend { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.tg-mode { display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-top: 8px; font-size: 13px; cursor: pointer; }
.tg-mode input { margin-top: 3px; accent-color: var(--accent); flex: none; }
.tg-mode small { display: block; color: var(--muted); font-size: 12px; line-height: 18px; margin-top: 5px; }
.tg-modes:disabled { opacity: .55; }
.tg-mode:has(input:checked) { border-color: #4d80cf; background: rgb(51 111 208 / 10%); }
.tg-consent { border-left: 2px solid #4d80cf; padding-left: 12px; }
.tg-policy-link { color: #8bb4ff; text-decoration: underline; font-size: 12px; }
.tg-scenarios { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.tg-preview { background: rgb(51 111 208 / 9%); border: 1px solid #3b4b63; padding: 12px; border-radius: 12px; font-size: 13px; line-height: 20px; margin-bottom: 16px; }

/* ---------- Безопасность ---------- */
.security-switch { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 12px; background: rgba(255,255,255,.03); margin-bottom: 18px; max-width: 100%; }
.security-switch button { border: 0; background: transparent; color: var(--muted); border-radius: 9px; padding: 7px 12px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.security-switch button[aria-selected="true"] { background: var(--raised); color: var(--text); }
.security-switch button:hover { color: var(--text); }
.security-fields { display: grid; gap: 16px; margin-top: 20px; max-width: 420px; }
.pw-wrap { position: relative; }
.pw-wrap .input { height: 42px; padding-right: 42px; }
.pw-eye { position: absolute; right: 5px; top: 5px; width: 32px; height: 32px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.pw-eye svg { width: 18px; height: 18px; }
.pw-eye:hover, .pw-eye[aria-pressed="true"] { color: var(--text); background: rgba(255,255,255,.06); }
.input[aria-invalid="true"] { border-color: var(--negative); }
.field-error { color: var(--negative); font-size: 12px; line-height: 16px; }
.field-error:empty { display: none; }
.pw-rules { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 12px; }
.pw-rules li::before { content: "•"; margin-right: 6px; color: var(--faint); }
.pw-rules li.ok { color: var(--positive); }
.pw-rules li.ok::before { content: "✓"; color: var(--positive); }

@media (max-width: 640px) {
  .security-switch { display: flex; width: 100%; }
  .security-switch button { flex: 1; padding: 7px 6px; font-size: 12px; }
  .security-fields { max-width: none; }
  .pw-wrap .input { font-size: 16px; }
}

.security-layout .settings-stack { display: grid; gap: 20px; min-width: 0; }
.auth-connections-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.auth-mock-badge { display: inline-flex; flex: none; align-items: center; border: 1px solid rgba(82,136,245,.3); background: rgba(82,136,245,.1); color: #8bb5ff; border-radius: 999px; padding: 4px 9px; font-size: 11px; line-height: 16px; }
.auth-mock-note { color: var(--muted); font-size: 12px; line-height: 19px; margin: 15px 0 8px; }
.auth-connection { border-top: 1px solid var(--rule); }
.auth-connection summary { list-style: none; display: grid; grid-template-columns: 30px minmax(0,1fr) auto 12px; align-items: center; gap: 10px; padding: 18px 0; cursor: pointer; }
.auth-connection summary::-webkit-details-marker { display: none; }
.auth-connection summary:focus-visible { outline: 2px solid #5288f5; outline-offset: 3px; border-radius: 8px; }
.auth-provider-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: rgba(82,136,245,.12); color: #73a6ff; }
.auth-provider-icon svg { width: 17px; height: 17px; stroke-width: 1.5; }
.yandex-mark { background: #fc3f1d; color: #fff; font-size: 19px; font-weight: 600; }
.auth-provider-title { font-size: 13px; line-height: 19px; font-weight: 500; overflow-wrap: anywhere; }
.auth-provider-title small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; line-height: 17px; margin-top: 2px; }
.auth-provider-status { color: var(--muted); font-size: 11px; line-height: 17px; }
.auth-chevron { color: #73a6ff; font-size: 15px; }
.auth-connection[open] .auth-chevron { transform: rotate(180deg); }
.auth-connection-body { display: grid; gap: 15px; padding: 0 0 20px 40px; min-width: 0; }
.auth-connection-body .input { width: 100%; height: 42px; min-width: 0; border-radius: 10px; opacity: 1; color: var(--muted); cursor: not-allowed; }
.auth-connection-body input::placeholder { color: var(--muted); opacity: .8; }
.auth-connection-body .field { display: grid; gap: 7px; min-width: 0; }
.auth-connection-body .btn { width: fit-content; max-width: 100%; white-space: normal; text-align: center; }
.auth-mail-types { display: flex; flex-wrap: wrap; gap: 6px; }
.auth-mail-types span { border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; font-size: 11px; color: var(--muted); }
.auth-yandex-preview { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 12px; border-radius: 10px; background: #fc3f1d; font-size: 13px; font-weight: 500; text-align: center; }
.auth-email-preview { display: grid; gap: 18px; padding-top: 6px; line-height: 1.6; font-size: 13px; }
.auth-email-preview .auth-mock-badge { justify-self: start; }
.auth-email-password { background: rgba(82,136,245,.12); color: #8bb5ff; border: 1px solid rgba(82,136,245,.25); border-radius: 10px; padding: 16px; font-family: ui-monospace,monospace; overflow-wrap: anywhere; }
.auth-email-warning { border-left: 3px solid #edce79; background: rgba(234,179,8,.08); border-radius: 6px; padding: 13px 15px; color: #edce79; }
@media(max-width:640px) {
  .auth-connection summary { grid-template-columns: 30px minmax(0,1fr) 12px; column-gap: 9px; row-gap: 5px; }
  .auth-provider-status { grid-column: 2; }
  .auth-chevron { grid-column: 3; grid-row: 1 / 3; }
  .auth-provider-icon { grid-row: 1 / 3; }
  .auth-connection-body { padding-left: 0; }
  .auth-connections-heading { flex-wrap: wrap; }
  .auth-connection-body .input { font-size: 16px; }
}
.security-recovery-link { display: inline-block; color: var(--blue, #6eacff); font-size: 13px; margin: 8px 0 0; overflow-wrap: anywhere; }
.security-temporary-notice { background: rgba(234,179,8,.12); border: 1px solid rgba(234,179,8,.3); border-radius: 12px; padding: 14px 16px; color: #edce79; font-size: 13px; line-height: 1.6; margin-bottom: 20px; overflow-wrap: anywhere; }
.security-switch button { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.security-layout .settings-aside .btn { max-width: 100%; white-space: normal; text-align: center; }
.email-card .settings-intro b { color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.email-lock { margin: 16px 0 0; }
#emailForm .save-row .btn.ghost { white-space: nowrap; }
@media (max-width: 640px) { #emailForm .save-row .btn { width: 100%; justify-content: center; } }
