/* Фирменный стиль CRM: оранжевый, белый, чёрный (макет design/crm-desktop-mockup.html, вариант 5) */
:root {
  --bg: #F3F5F7; --card: #fff; --text: #111111; --muted: #555555; --faint: #777777;
  --line: #E5E5E5; --line-strong: #CCCCCC;
  --primary: #F39200; --primary-d: #B86E00; --primary-soft: #FFF5E5;
  --danger: #991B1B; --link: #B86E00; --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--link); }
h1 { font-size: 26px; margin: 0 0 12px; }
h2 { font-size: 17px; margin: 0 0 12px; }

/* Оболочка: светлое меню слева */
.shell { display: flex; min-height: 100vh; }
.side { width: 224px; flex: none; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.side__brand { display: flex; align-items: center; gap: 10px; padding: 4px 2px 24px; color: var(--text); font-weight: 700; font-size: 14px; text-decoration: none; }
.side__nav { display: flex; flex-direction: column; gap: 4px; }
.nav { position: relative; display: flex; justify-content: space-between; align-items: center; height: 46px; padding: 0 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; }
.nav:hover { background: #FAFAFA; }
.nav--active, .nav--active:hover { background: var(--primary-soft); color: var(--primary-d); }
.nav--active::before { content: ''; position: absolute; left: -14px; top: 7px; bottom: 7px; width: 4px; background: var(--primary); border-radius: 0 3px 3px 0; }
.nav--soon, .nav--soon:hover { color: var(--faint); background: none; }
.nav small { font-size: 11px; }
.side__user { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 4px 0; display: flex; flex-direction: column; gap: 10px; }
.side__user strong { display: block; font-size: 14px; }
.side__user span { font-size: 12px; color: var(--muted); }
.side__user form { margin: 0; }
.main { flex: 1; min-width: 0; }
.page { padding: 0 24px 24px; max-width: 1280px; }

.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; padding: 24px; }
.topbar h1 { margin: 0; font-size: 28px; }
.view-switch { display: flex; gap: 4px; padding: 4px; background: #E9EDF1; border-radius: 10px; }
.view-switch a { border-radius: 7px; color: var(--muted); padding: 8px 14px; font-weight: 600; text-decoration: none; }
.view-switch a[aria-current="page"] { background: #fff; color: var(--primary-d); box-shadow: 0 1px 4px #11111112; }
.search { flex: 1 1 260px; max-width: 640px; margin: 0; }
.search input { height: 44px; border-color: var(--line); padding-left: 14px; }

/* Вход */
/* Фон собран из design/assets/login-wallpaper-embossed.png (без потерь) с качеством 88: 1280 px для узких экранов, 2560 px для широких и плотных */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #F7F7F7 url('/static/login-bg-1280.jpg?v=2') center / cover no-repeat; background-image: image-set(url('/static/login-bg-1280.webp?v=2') type('image/webp'), url('/static/login-bg-1280.jpg?v=2') type('image/jpeg')); }
@media (min-width: 1100px), (min-resolution: 1.5dppx) {
  .login { background-image: url('/static/login-bg.jpg?v=2'); background-image: image-set(url('/static/login-bg.webp?v=2') type('image/webp'), url('/static/login-bg.jpg?v=2') type('image/jpeg')); }
}
.login__card { width: 100%; max-width: 480px; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--primary); border-radius: 12px; padding: 40px; box-shadow: 0 16px 48px rgba(31, 41, 51, .08); }
.login__brand { display: flex; align-items: center; gap: 16px; padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.login__wordmark { font-size: 26px; font-weight: 700; letter-spacing: .04em; line-height: 1.2; }
.login__title { font-size: 20px; font-weight: 600; margin-bottom: 16px; }
.login__form input { height: 50px; font-size: 16px; }
.login__form .btn { width: 100%; margin-top: 4px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.panel { margin: 0 24px 24px; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 16px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--text); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--text); font-weight: 600; }
.btn-primary:hover { background: #E08600; border-color: #E08600; }
.btn-lg { min-height: 50px; font-size: 16px; }
.btn-sm { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.btn-danger { color: var(--danger); border-color: #E5B4AE; }
.btn-ghost { border-color: transparent; background: transparent; }
.topbar .btn { min-height: 44px; }
form.inline { display: inline; margin: 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.muted { color: var(--muted); font-size: 13px; }
.nowrap { white-space: nowrap; }
.empty { color: var(--muted); padding: 24px; text-align: center; }
.back { display: inline-block; margin: 24px 0 8px; text-decoration: none; }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }
.alert.warn { background: #fff7e6; border: 1px solid #f5d38a; }
.alert.error { background: #fdecea; border: 1px solid #f3b4ad; }
.alert.ok { background: #e9f8ee; border: 1px solid #a7e0b8; }

.form { max-width: 760px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-weight: 500; }
.field > span { font-size: 14px; }
input, select, textarea { font: inherit; padding: 8px 12px; min-height: 42px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: 3px solid var(--primary-soft); }
.has-error input, .has-error select, input.has-error { border-color: #d93025; }
.error { color: #d93025; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.checkbox { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.checkbox input { width: auto; min-height: 0; accent-color: var(--primary); }
details summary { cursor: pointer; color: var(--link); margin: 8px 0; }

/* Стадии: --c — цвет текста, --cb — фон */
.stage-new { --c: #1D4ED8; --cb: #DBEAFE; } .stage-in_work { --c: #92400E; --cb: #FEF3C7; }
.stage-offer_sent { --c: #6D28D9; --cb: #EDE9FE; } .stage-negotiation { --c: #0F766E; --cb: #CCFBF1; }
.stage-contract { --c: #3730A3; --cb: #E0E7FF; } .stage-paid { --c: #166534; --cb: #DCFCE7; }
.stage-shipped { --c: #334155; --cb: #E2E8F0; } .stage-rejected { --c: #991B1B; --cb: #FEE2E2; }

/* Доска */
.board { display: flex; gap: 14px; overflow-x: auto; padding: 0 24px 24px; align-items: flex-start; }
.board__column { flex: 1 0 190px; background: #EAF0F4; border-radius: 10px; min-height: 320px; }
.board__heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0; padding: 14px 12px; min-height: 62px; font-size: 13px; background: var(--cb); border-radius: 10px 10px 0 0; }
.board__heading span { background: #FFFFFF99; border-radius: 20px; padding: 2px 8px; color: var(--c); flex: none; }
.board__cards { display: flex; flex-direction: column; gap: 10px; padding: 10px; }
.board__empty { text-align: center; padding: 24px 8px; color: var(--faint); font-size: 12px; margin: 0; }
.lead-tile { display: flex; flex-direction: column; gap: 6px; color: var(--text); text-decoration: none; background: #fff; border: 1px solid transparent; border-left: 3px solid var(--primary); border-radius: 8px; padding: 14px 12px; box-shadow: 0 2px 5px #17212B06; }
.lead-tile:hover { border-color: var(--primary); box-shadow: 0 3px 12px #17212B12; }
.lead-tile--changed { background: #FFFBEB; }
.lead-tile__name { font-weight: 600; }
.lead-tile__meta { color: var(--muted); font-size: 12px; }
.lead-tile__footer { display: flex; justify-content: space-between; gap: 8px; padding-top: 6px; font-size: 12px; color: var(--faint); }

/* Таблица */
.stage-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tab { padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: 14px; }
.tab b { color: var(--c, var(--text)); }
.tab.active { border-color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters select, .filters input[type=date] { width: auto; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; background: #F5F7F9; }
tr.changed td { background: #fffbe6; }
tr.changed td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--c, var(--text)); background: var(--cb, #eee); white-space: nowrap; }
.badge-admin { --c: var(--primary-d); --cb: var(--primary-soft); font-size: 12px; padding: 1px 8px; }
.back--tight { margin-top: 0; }
.badge.big { font-size: 15px; padding: 4px 14px; }

/* Карточка заявки */
.lead-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.lead-head h1 { margin: 0; }
.lead-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; }
.props { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0 0 12px; }
.props dt { color: var(--muted); }
.props dd { margin: 0; white-space: pre-wrap; }
.stage-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.stage-buttons form { margin: 0; }
.stage-btn { padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--text); font: inherit; font-weight: 500; cursor: pointer; }
.stage-btn:hover { border-color: var(--c); color: var(--c); }
.stage-btn.current { background: var(--cb); border-color: var(--c); color: var(--c); font-weight: 600; cursor: default; }
.reject-form, .comment-form, .inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.reject-form input { flex: 1 1 200px; width: auto; }
.comment-form textarea { flex: 1 1 260px; width: auto; }
.inline-form select { width: auto; }
.inline-form form { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 16px 0 0; }
.ev { padding: 10px 0; border-top: 1px solid var(--line); }
.ev-meta { font-size: 12px; color: var(--muted); }
.ev-text { white-space: pre-wrap; margin-top: 2px; }
.ev-comment .ev-text { background: #F6F7F9; padding: 8px 10px; border-radius: 8px; }

/* Настройки */
.settings-tabs { flex-wrap: wrap; }
.dict-table td { vertical-align: middle; }
.dict-table .inline-form input { flex: 1 1 200px; width: auto; }
.dict-table .inline-form { flex-wrap: nowrap; align-items: center; }
.dict-off td { background: #F8F9FA; }
.dict-add { margin-top: 12px; }
.dict-add .field { flex: 1 1 260px; margin: 0; }

.agent-pending { --c: #B86E00; } .agent-approved { --c: #166534; } .agent-rejected { --c: #6b7280; }

/* === Перенос макета design/crm-desktop-mockup.html === */
.card { border-radius: 12px; padding: 20px; }
.nav__label { display: inline-flex; align-items: center; gap: 12px; }
.nav__label svg { width: 20px; height: 20px; flex: none; }
.nav--settings { margin-top: auto; }
.badge-count { min-width: 20px; height: 20px; border-radius: 10px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.topbar__hint { flex: 1 1 auto; }
.topbar .view-switch + .search, .topbar h1 + .search { margin: 0 auto; }

/* Профиль в шапке (меню на <details>, без скриптов) */
.profile { position: relative; flex: none; margin-left: auto; }
.search + .btn + .profile, .search ~ .profile { margin-left: 0; }
.profile__trigger { display: flex; align-items: center; gap: 10px; padding: 4px; border-radius: 10px; cursor: pointer; list-style: none; color: var(--text); }
.profile__trigger::-webkit-details-marker { display: none; }
.profile__trigger:hover { background: #E9EDF1; }
.profile__avatar { width: 40px; height: 40px; border-radius: 50%; background: #E2E6EB; display: flex; align-items: center; justify-content: center; color: #606A78; font-weight: 600; flex: none; }
.profile__text { display: flex; flex-direction: column; gap: 2px; }
.profile__text strong { font-size: 14px; font-weight: 600; }
.profile__text span { font-size: 12px; color: var(--muted); }
.profile__menu { position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; width: 240px; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px #11111118; display: flex; flex-direction: column; gap: 8px; }
.profile__menu p { margin: 0 0 8px; }
.profile__menu form { margin: 0; }
.btn-ghost-line { width: 100%; background: #fff; color: #3E4C59; border-color: var(--line-strong); }

/* Таблица заявок */
.list-heading { display: flex; align-items: center; justify-content: space-between; padding: 4px 0 12px; }
.list-heading h2 { font-size: 15px; margin: 0; color: var(--primary-d); }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 34px; border-radius: 17px; padding: 0 14px; font-size: 13px; font-weight: 500; border: 1px solid var(--line-strong); background: #fff; color: #3E4C59; text-decoration: none; }
.pill span { opacity: .7; }
.pill--active { background: var(--primary-soft); border-color: var(--primary); color: var(--text); }

/* Карточка заявки: вариант 3 */
.detail { padding: 0 24px 32px; display: flex; flex-direction: column; gap: 24px; }
.detail-back { display: inline-flex; align-items: center; gap: 10px; padding: 11px 18px; background: #fff; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--text); font-weight: 600; text-decoration: none; box-shadow: 0 2px 4px #11111106; margin-bottom: 16px; }
.detail .detail-back { margin-bottom: 0; }
.detail-back:hover { border-color: var(--primary); background: var(--primary-soft); }
.detail-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.detail-heading > div:first-child { flex: 1; min-width: 0; }
.detail-heading h2 { font-size: 28px; margin: 6px 0 0; }
.detail-reject { position: relative; }
.detail-reject summary { list-style: none; }
.detail-reject summary::-webkit-details-marker { display: none; }
.detail-reject .reject-form { position: absolute; right: 0; top: calc(100% + 8px); z-index: 5; width: 420px; max-width: 80vw; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px #11111118; }
.detail-progress { overflow-x: auto; padding: 22px 20px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.detail-progress-info { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.detail-progress-info strong { font-size: 15px; }
.detail-progress-info > span { font-size: 12px; color: var(--muted); }
.detail-progress-info .progress-status { margin-left: auto; padding: 6px 12px; background: var(--cb, var(--primary-soft)); border-radius: 20px; color: var(--c, var(--primary-d)); font-weight: 600; }
.steps { display: flex; min-width: 800px; }
.step-form { flex: 1; display: flex; margin: 0; }
.step { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 8px; color: var(--muted); font: inherit; font-size: 12px; text-align: center; background: transparent; border: 0; border-radius: 8px; }
button.step { cursor: pointer; }
.step::before { content: ''; position: absolute; height: 4px; background: #E2E6EB; top: 26px; left: -50%; width: 100%; }
.steps > :first-child .step::before, .steps > .step:first-child::before { display: none; }
.step__dot { position: relative; z-index: 1; width: 40px; height: 40px; border-radius: 50%; background: #F5F7F9; border: 2px solid #D5DAE0; display: grid; place-items: center; color: var(--faint); font-weight: 700; font-size: 14px; }
.step--done::before { background: var(--primary); }
.step--done .step__dot { background: var(--primary); border-color: var(--primary); color: var(--text); }
.step--current { color: var(--primary-d); font-weight: 600; }
.step--current .step__dot { box-shadow: inset 0 0 0 5px #fff, 0 0 0 5px var(--primary-soft); }
button.step:hover .step__dot { border-color: var(--primary); }
.step__caption { max-width: 150px; }
.step__current-label { display: block; width: fit-content; margin: 6px auto 0; padding: 2px 7px; border-radius: 5px; background: var(--primary-soft); color: var(--primary-d); font-size: 10px; }
.detail-columns { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(300px, 1.55fr) minmax(220px, 1fr); gap: 16px; align-items: start; }
.detail-panel { background: #fff; border: 1px solid #E6E9ED; border-radius: 14px; padding: 22px; box-shadow: 0 4px 16px #18223005; }
.detail-panel h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 20px; font-size: 16px; }
.detail-panel h3 > svg { color: var(--primary-d); }
.detail-facts { margin: 0; }
.detail-panel > .badge + .detail-facts { margin-top: 12px; }
.detail-facts > div { position: relative; border-top: 1px solid #F0F2F4; padding: 16px 0 16px 34px; }
.fact-icon { position: absolute; left: 0; top: 19px; color: #8993A0; }
.detail-facts dt { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.detail-facts dd { margin: 0; overflow-wrap: anywhere; }
.detail-facts dd.pre { white-space: pre-wrap; }
.detail-feed { display: flex; flex-direction: column; min-height: 120px; }
.detail-feed .history { position: relative; margin-left: 17px; padding: 0 0 24px 32px; border-left: 2px solid #E8ECF0; }
.event-icon { position: absolute; left: -18px; top: 0; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-d); border: 4px solid #fff; }
.event-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.event-author { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; }
.event-initials { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #EBEEF2; color: #677281; font-size: 10px; font-weight: 600; flex: none; }
.event-text { margin-top: 10px; padding: 12px 14px; background: #F7F8FA; border: 1px solid #EDF0F3; border-radius: 0 10px 10px 10px; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; white-space: pre-wrap; }
.detail-composer { background: #F5F7F9; padding: 14px; border-radius: 8px; margin-top: 24px; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.detail-composer label { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.detail-aside { display: flex; flex-direction: column; gap: 16px; }
.detail-owner { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.manager { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.manager .event-initials { width: 44px; height: 44px; font-size: 14px; }
.owner-form select { flex: 1 1 160px; width: auto; }
.edit-form { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 24px; max-width: none; }
.edit-form > summary { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--text); font-weight: 600; }
details.edit-form[open] > summary { margin-bottom: 20px; }
.edit-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }

/* Агенты */
.agent-workspace { display: grid; grid-template-columns: minmax(400px, 1.05fr) minmax(380px, 1fr); gap: 18px; padding: 0 24px 24px; align-items: start; }
.agent-workspace--closed { grid-template-columns: minmax(0, 980px); }
.agent-directory, .agent-profile { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px; min-width: 0; }
.agent-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.agent-tabs .pill { font-size: 12px; padding: 0 10px; }
.agent-search { max-width: none; margin: 0 0 16px; }
.agent-directory__list { display: flex; flex-direction: column; }
.agent-row { display: flex; gap: 12px; align-items: center; width: 100%; background: #fff; border: 1px solid transparent; border-bottom-color: var(--line); padding: 18px 10px; border-radius: 9px; color: var(--text); text-decoration: none; }
.agent-row:hover { background: #FAFAFA; }
.agent-row--selected { background: var(--primary-soft); border-color: var(--primary); }
.agent-row__name { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.agent-row__count { display: flex; flex-direction: column; align-items: center; padding: 0 8px; font-weight: 600; }
.agent-face { display: inline-grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 50%; background: #FFF0D8; color: #9E5C00; font-weight: 600; font-size: 16px; }
.agent-face--large { width: 96px; height: 96px; font-size: 30px; }
.agent-status { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 7px; font-size: 12px; font-weight: 700; white-space: nowrap; line-height: 1.4; }
.agent-status--pending { background: #F39200; color: #111; }
.agent-status--pending::before { content: '◷'; }
.agent-status--active { background: #187A40; color: #fff; }
.agent-status--active::before { content: '✓'; }
.agent-status--rejected { background: #BF3030; color: #fff; }
.agent-status--rejected::before { content: '×'; }
.agent-status--blocked { background: #353D49; color: #fff; }
.agent-status--blocked::before { content: '⊘'; }
.agent-profile__close { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.icon-btn { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: flex; align-items: center; justify-content: center; color: var(--text); text-decoration: none; font-size: 18px; }
.agent-profile__header { display: flex; align-items: center; gap: 20px; padding-bottom: 24px; }
.agent-profile__header h2 { margin: 8px 0 4px; font-size: 24px; }
.agent-profile__section-title { color: var(--primary-d); border-bottom: 2px solid var(--primary); padding: 12px 0; margin: 0 0 20px; font-size: 14px; }
.agent-profile__details { display: grid; grid-template-columns: 1fr 170px; gap: 16px; }
.agent-profile h3 { font-size: 15px; margin-top: 0; }
.agent-profile__details p { font-size: 13px; overflow-wrap: anywhere; }
.agent-profile__details a { color: inherit; text-decoration: none; }
.agent-contract { display: flex; flex-direction: column; gap: 8px; padding: 16px; background: #F5F7F9; border-radius: 10px; }
.agent-contract strong { font-size: 20px; margin-bottom: 10px; overflow-wrap: anywhere; }
.agent-profile__actions { display: flex; gap: 10px; padding: 20px 0 10px; }
.agent-profile__actions form { flex: 1; margin: 0; }
.agent-profile__actions .btn { width: 100%; }
.agent-reject { margin-bottom: 20px; }
.agent-related { border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.agent-related__row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); color: var(--text); text-decoration: none; }
.agent-related__row > span:first-child { display: flex; flex-direction: column; gap: 4px; flex: 1; }

/* Настройки */
.settings { padding: 0 24px 24px; max-width: 980px; }
.staff-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.staff-row:first-child { border-top: 0; }
.staff-row__main { flex: 1 1 220px; min-width: 0; }
.staff-row__name { font-weight: 600; }
.staff-row__name a { color: var(--text); text-decoration: none; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 20px; background: var(--primary-soft); color: var(--primary-d); margin-left: 6px; }
.tag--off { background: #EEE; color: #555; }
.settings--wide { max-width: 1280px; }
.notify-event { margin-bottom: 20px; }
.notify-event h3 { font-size: 15px; margin: 0 0 8px; }
.notify-table td, .notify-table th { padding: 7px 12px; }
.notify-check { width: 90px; text-align: center !important; }
.notify-check input { width: 18px; min-height: 18px; accent-color: var(--primary); }
.notify-person td:first-child { padding-left: 28px; color: var(--muted); }
.rules-directions { margin-top: 12px; }
.journal-q { width: auto; flex: 1 1 180px; }
.pager { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 16px; }
.tag--login { background: #E9F8EE; color: #166534; } .tag--login_failed { background: #FDECEA; color: #991B1B; }
.tag--agent { background: #EDE9FE; color: #6D28D9; } .tag--stage { background: #DBEAFE; color: #1D4ED8; }
.tag--users, .tag--export { background: #EEF1F4; color: #334155; }
.tag[class*="tag--"] { margin-left: 0; }

/* Настройки: единая сетка всех вкладок, без влияния на заявки и агентов. */
.settings-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; }
.settings-header h1 { grid-column: 1; grid-row: 1; }
.settings-header > .profile { grid-column: 2; grid-row: 1; }
.settings-header .settings-tabs { grid-column: 1 / -1; grid-row: 2; width: 100%; gap: 4px; padding: 5px; }
.settings-tabs a { flex: 1 1 auto; text-align: center; white-space: nowrap; font-size: 13px; padding: 10px 12px; }
.settings-page, .settings.settings-page { width: 100%; max-width: 1248px; padding: 0 24px 32px; display: flex; flex-direction: column; gap: 20px; }
.settings-page > h2 { margin: 0; font-size: 21px; }
.settings-page > p { margin: -10px 0 0; max-width: 92ch; line-height: 1.65; }
.settings-page .card { width: 100%; min-width: 0; margin: 0; padding: 24px; border-radius: 12px; }
.settings-page .card > h2 { font-size: 17px; margin: 0 0 16px; }
.settings-page .card > p { margin: 0 0 20px; line-height: 1.65; max-width: 100ch; }
.settings-page .card > :last-child { margin-bottom: 0; }
.settings-page .form { max-width: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 20px 24px; }
.settings-page .form > :not(.field) { grid-column: 1 / -1; }
.settings-page .form > .field:has(textarea) { grid-column: 1 / -1; }
.settings-page .form > h2, .settings-page .form > p { margin: 0; }
.settings-page .form > h2:not(:first-child) { padding-top: 20px; border-top: 1px solid var(--line); }
.settings-page .form > .btn { justify-self: start; margin-top: 4px; min-width: 136px; }
.settings-page .field { min-width: 0; margin: 0; gap: 8px; }
.settings-page .field > span { min-height: 20px; }
.settings-page .field small { line-height: 1.5; }
.settings-page input:not([type=checkbox]):not([type=radio]), .settings-page select { height: 44px; min-width: 0; }
.settings-page textarea { min-height: 128px; resize: vertical; }
.settings-page .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; }
.settings-page .rules-directions { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.settings-page .checkbox { align-items: flex-start; gap: 10px; margin: 0; line-height: 1.6; }
.settings-page .checkbox input { flex: none; margin: 5px 0 0; width: 17px; height: 17px; }
.settings-page .table-wrap { width: 100%; }
.settings-page th, .settings-page td { padding: 13px 16px; vertical-align: middle; }
.settings-page tbody tr:last-child td { border-bottom: 0; }
.settings-page th { font-size: 12px; white-space: nowrap; }
.settings-page .dict-table { table-layout: fixed; min-width: 680px; }
.settings-page .dict-table th:first-child { width: 58%; }
.settings-page .dict-table th:nth-child(2) { width: 14%; }
.settings-page .dict-table th:nth-child(3) { width: 14%; }
.settings-page .dict-table th:last-child { width: 14%; }
.settings-page .dict-table .inline-form input { flex: 1 1 0; min-width: 0; }
.settings-page .dict-table .btn { white-space: nowrap; flex: none; min-height: 36px; }
.settings-page .dict-table td:last-child .btn { width: 100%; }
.settings-page .dict-add { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); flex-wrap: nowrap; gap: 12px; }
.settings-page .dict-add .field { flex: 1 1 0; }
.settings-page .dict-add .btn { min-width: 136px; height: 44px; }
.settings-page .lead-head { justify-content: space-between; align-items: center; margin: 0 0 20px; }
.settings-page .lead-head h2 { margin: 0; }
.settings-page .staff-row { display: grid; grid-template-columns: minmax(0, 1fr) 136px; gap: 20px; padding: 18px 0; }
.settings-page .staff-row > .btn, .settings-page .staff-row > .muted { justify-self: stretch; text-align: center; }
.settings-page .staff-row__name { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 4px; }
.settings-page .staff-row .tag { margin: 0; }
.settings-page .notify-events { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin: 24px 0; }
.settings-page .notify-event { min-width: 0; margin: 0; }
.settings-page .notify-event h3 { min-height: 22px; margin-bottom: 12px; }
.settings-page .notify-table { table-layout: fixed; }
.settings-page .notify-check { width: 76px; padding: 10px 8px; }
.settings-page .notify-table td { font-size: 13px; height: 44px; padding: 10px 12px; }
.settings-page .notify-sub td { background: #F6F8FA; font-size: 11px; height: 34px; }
.settings-page .notify-person td:first-child { padding-left: 20px; }
.settings-page .notify-check input { display: block; width: 18px; height: 18px; margin: 0 auto; }
.settings-page .filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; margin-bottom: 20px; }
.settings-page .filters > input, .settings-page .filters > select { width: 100%; }
.settings-page .filters > label { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.settings-page .filters input[type=date] { width: 100%; }
.settings-page .filters .btn { height: 44px; }
.settings-page .filter-actions { display: flex; align-items: center; gap: 8px; }
.settings-page .filter-actions .btn { flex: 1; min-width: 0; padding-inline: 10px; }
.settings-page .card > .inline-form + p { margin-top: 16px; }
.settings-page .filters + p { margin-bottom: 16px; }
.settings-page .pager { margin-top: 20px; }
@media (max-width: 1100px) { .settings-page .notify-events { grid-template-columns: 1fr; } .settings-tabs a { flex: 1 1 22%; } .settings-page .dict-table th:first-child { width: 50%; } .settings-page .dict-table th:last-child { width: 22%; } }
@media (max-width: 760px) { .settings-page, .settings.settings-page { padding: 0 16px 24px; gap: 16px; } .settings-page .card { padding: 18px; } .settings-page .form, .settings-page .grid, .settings-page .rules-directions { grid-template-columns: 1fr; } .settings-page .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .settings-tabs a { flex-basis: 40%; } .settings-page .dict-add { flex-wrap: wrap; } }
@media (max-width: 480px) { .settings-page .filters { grid-template-columns: 1fr; } .settings-page .staff-row { grid-template-columns: 1fr; gap: 12px; } }

@media (max-width: 1200px) {
  .detail-columns { grid-template-columns: minmax(200px, 1fr) minmax(280px, 1.5fr); }
  .detail-aside { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .agent-workspace { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .side { width: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side__brand { padding: 0 8px 0 0; }
  .side__nav { flex-direction: row; }
  .nav { height: 38px; }
  .nav--active::before, .nav--soon { display: none; }
  .side__user { margin: 0 0 0 auto; border: 0; padding: 0; flex-direction: row; align-items: center; }
  .side__user div span { display: none; }
}
@media (max-width: 760px) {
  .hide-sm { display: none; }
  .topbar { padding: 16px; gap: 12px; }
  .page { padding: 0 16px 16px; }
  .panel { margin: 0 16px 16px; }
  .board { padding: 0 16px 16px; }
  .lead-layout { grid-template-columns: 1fr; }
  .props { grid-template-columns: 1fr; }
  .props dt { margin-top: 6px; }
  .login__card { padding: 28px 20px; }
  .detail, .settings { padding: 0 16px 24px; }
  .detail-columns { grid-template-columns: 1fr; }
  .detail-aside { display: flex; }
  .detail-heading { align-items: flex-start; flex-direction: column; }
  .detail-heading h2 { font-size: 23px; }
  .agent-workspace { padding: 0 12px 20px; }
  .agent-row { flex-wrap: wrap; }
  .agent-profile__details { grid-template-columns: 1fr; }
  .agent-face--large { width: 64px; height: 64px; font-size: 22px; }
  .profile__text { display: none; }
}
