:root {
  --app-sidebar: 264px;
  --app-bg: #f4f7fb;
  --app-surface: #ffffff;
  --app-text: #172033;
  --app-muted: #6f7a8e;
  --app-line: #e6eaf0;
  --app-primary: #3d65dc;
  --app-primary-dark: #2f52ba;
  --app-primary-soft: #edf2ff;
  --app-danger-soft: #fff0f1;
  --app-radius: 16px;
  --app-shadow: 0 10px 28px rgba(29, 42, 78, .06);
}

* { box-sizing: border-box; }
body { color: var(--app-text); font-size: .94rem; }
.app-body { min-height: 100vh; background: var(--app-bg); }
.app-shell { min-height: 100vh; display: flex; }
.app-sidebar { width: var(--app-sidebar); flex: 0 0 var(--app-sidebar); min-height: 100vh; position: sticky; top: 0; flex-direction: column; background: #19243d; color: #fff; padding: 20px 14px 14px; }
.app-sidebar__brand, .app-mobile-header__brand, .auth-page__brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; letter-spacing: -.01em; }
.app-sidebar__brand { padding: 0 10px 24px; font-size: 1.08rem; }
.app-brand-mark { width: 34px; height: 34px; display: block; flex: 0 0 34px; object-fit: contain; }
.app-nav { display: flex; flex-direction: column; gap: 3px; }
.app-nav__caption { padding: 8px 11px 6px; color: #8f9bb7; font-size: .71rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.app-nav__company { margin: 0 8px 13px; padding: 9px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #bfcae5; background: rgba(255,255,255,.055); border-radius: 9px; font-size: .78rem; }
.app-nav__link { display: flex; align-items: center; gap: 10px; padding: 10px 11px; border-radius: 10px; color: #c8d1e3; text-decoration: none; transition: .18s ease; }
.app-nav__link:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-nav__link.is-active { color: #fff; background: rgba(103, 137, 255, .26); box-shadow: inset 3px 0 0 #9bb1ff; }
.app-nav__icon { width: 18px; text-align: center; font-weight: 700; line-height: 1; }
.app-nav__label { white-space: nowrap; }
.app-nav__divider { height: 1px; background: rgba(255,255,255,.11); margin: 11px 9px; }
.app-sidebar__footer { margin-top: auto; padding-top: 12px; }
.app-logout { width: 100%; border: 0; border-radius: 10px; padding: 10px 11px; background: transparent; color: #c8d1e3; text-align: left; display: flex; gap: 10px; align-items: center; }
.app-logout:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-main { width: min(100%, calc(100vw - var(--app-sidebar))); padding: 24px 32px 42px; overflow: hidden; }
.app-topbar { display: flex; align-items: center; justify-content: space-between; min-height: 34px; margin-bottom: 22px; }
.app-topbar__context { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-topbar__name { font-weight: 650; }
.app-company-pill { max-width: 250px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border: 1px solid #dfe6f4; border-radius: 999px; background: #fff; padding: 4px 9px; color: #587; font-size: .78rem; }
.app-mobile-header { height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--app-line); }
.app-mobile-header__brand { color: var(--app-text); font-size: 1rem; }
.offcanvas .app-nav__link { color: #4b5870; }
.offcanvas .app-nav__link:hover, .offcanvas .app-nav__link.is-active { color: var(--app-primary); background: var(--app-primary-soft); box-shadow: inset 3px 0 0 var(--app-primary); }
.offcanvas .app-nav__caption { color: #8791a3; }
.offcanvas .app-nav__company { color: #344363; background: #f4f7fb; }

h1, .h1, h2, .h2, h3, .h3 { letter-spacing: -.025em; font-weight: 720; color: var(--app-text); }
.card { border: 1px solid var(--app-line); border-radius: var(--app-radius); box-shadow: var(--app-shadow); background: var(--app-surface); overflow: hidden; }
.card-header { background: transparent; border-bottom: 1px solid var(--app-line); padding: 15px 18px; font-weight: 680; }
.card-body { padding: 18px; }
.card-footer { background: #fbfcff; border-top: 1px solid var(--app-line); padding: 12px 18px; }
.card-stat { border: 0; min-height: 118px; background: linear-gradient(145deg, #fff, #f6f8ff); }
.card-stat .display-6 { font-size: 1.72rem; font-weight: 740; margin-top: 6px; }
.metric-card__label { color: var(--app-muted); font-size: .8rem; font-weight: 650; }
.metric-card__value { font-size: 1.7rem; font-weight: 760; letter-spacing: -.035em; }
.btn { border-radius: 10px; font-weight: 620; padding: .5rem .82rem; }
.btn-sm { border-radius: 8px; }
.btn-primary { background: var(--app-primary); border-color: var(--app-primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--app-primary-dark); border-color: var(--app-primary-dark); }
.btn-outline-primary { color: var(--app-primary); border-color: #b7c5fa; }
.btn-outline-primary:hover { background: var(--app-primary); border-color: var(--app-primary); }
.form-control, .form-select { border-color: #dbe1ea; min-height: 40px; border-radius: 10px; }
.form-control:focus, .form-select:focus { border-color: #9aaff7; box-shadow: 0 0 0 .2rem rgba(61, 101, 220, .12); }
.form-label { margin-bottom: 6px; color: #4c5870; font-size: .85rem; font-weight: 630; }
.table-responsive { border: 1px solid var(--app-line); border-radius: var(--app-radius); box-shadow: var(--app-shadow); background: #fff; }
.table { margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .83rem .9rem; border-bottom-color: var(--app-line); }
.table thead th { color: #6c7891; font-size: .74rem; font-weight: 720; text-transform: uppercase; letter-spacing: .04em; background: #fafbfe; }
.table-hover > tbody > tr:hover > * { background: #f8faff; }
.badge { border-radius: 999px; padding: .37rem .58rem; font-weight: 650; }
.nav-tabs { gap: 5px; border-bottom: 0; overflow-x: auto; flex-wrap: nowrap; }
.nav-tabs .nav-link { border: 0; border-radius: 9px; color: #5d6980; white-space: nowrap; padding: .52rem .72rem; }
.nav-tabs .nav-link:hover { background: #eef2fb; }
.nav-tabs .nav-link.active { background: var(--app-primary-soft); color: var(--app-primary); font-weight: 680; }
.empty-state { border: 1px dashed #cfd8e8; border-radius: var(--app-radius); padding: 3.2rem 1rem; text-align:center; color: var(--app-muted); background: #fbfcff; }
.app-flash { border-radius: 14px; border: 0; box-shadow: var(--app-shadow); }
.text-muted { color: var(--app-muted) !important; }

.kanban { display: flex; gap: 14px; overflow-x: auto; padding: 2px 2px 14px; }
.kanban-column { min-width: 292px; max-width: 320px; background: #eef2f7; border: 1px solid #e1e7f0; border-radius: 15px; padding: 12px; }
.kanban-card { cursor: grab; background: white; border: 1px solid #e3e8f1; border-radius: 12px; padding: 13px; margin-bottom: 9px; box-shadow: 0 4px 11px rgba(28, 41, 76, .05); transition: transform .18s ease, box-shadow .18s ease; }
.kanban-card:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(28,41,76,.09); }
.kanban-card:active { cursor: grabbing; }

/* Календарь */
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.calendar-range-title { font-size: .95rem; font-weight: 700; color: #46516a; }
.calendar-shell { overflow-x: auto; border: 1px solid var(--app-line); border-radius: var(--app-radius); background: #fff; box-shadow: var(--app-shadow); }
.calendar-time-layout { min-width: 900px; display: flex; }
.calendar-time-axis { width: 66px; flex: 0 0 66px; padding-top: 52px; background: #fbfcff; border-right: 1px solid var(--app-line); }
.calendar-time-axis__hour { height: 60px; padding: 0 10px; transform: translateY(-8px); text-align: right; color: #8994a9; font-size: .73rem; }
.calendar-days { display: grid; grid-template-columns: repeat(var(--calendar-columns), minmax(130px, 1fr)); flex: 1; }
.calendar-day { min-width: 0; border-right: 1px solid var(--app-line); }
.calendar-day:last-child { border-right: 0; }
.calendar-day__header { min-height: 52px; display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 8px 10px; text-align: center; border-bottom: 1px solid var(--app-line); background: #fbfcff; }
.calendar-day__header small { color: #8791a6; text-transform: uppercase; font-size: .67rem; letter-spacing: .06em; }
.calendar-day__header strong { font-size: .94rem; }
.calendar-day__header.is-today strong { width: 26px; height: 26px; line-height: 26px; margin: 0 auto; border-radius: 50%; background: var(--app-primary); color: #fff; }
.calendar-day__body { min-height: 900px; position: relative; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 59px, #edf0f5 59px, #edf0f5 60px); }
.calendar-event { position: absolute; z-index: 2; left: calc(var(--calendar-event-left, 0%) + 5px); right: auto; width: calc(var(--calendar-event-width, 100%) - 9px); overflow: hidden; border-radius: 9px; border-left: 3px solid currentColor; padding: 5px 7px; color: #3252bd; background: #eaf0ff; box-shadow: 0 2px 5px rgba(35,54,112,.08); font-size: .74rem; line-height: 1.2; min-height: 48px; }
.calendar-event--call { color: #8a5b12; background: #fff4df; }
.calendar-event--meeting { color: #3f7654; background: #e8f7ee; }
.calendar-event--reminder { color: #7a4b9e; background: #f3ebfb; }
.calendar-event__time { display: block; margin-bottom: 2px; font-size: .67rem; font-weight: 700; opacity: .78; }
.calendar-event__title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; font-weight: 710; word-break: break-word; }
.calendar-month { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); min-width: 850px; }
.calendar-month__weekday { padding: 10px; border-right: 1px solid var(--app-line); border-bottom: 1px solid var(--app-line); background: #fbfcff; color: #778299; font-size: .72rem; font-weight: 700; text-align: center; text-transform: uppercase; }
.calendar-month__day { min-height: 132px; padding: 8px; border-right: 1px solid var(--app-line); border-bottom: 1px solid var(--app-line); background: #fff; }
.calendar-month__day:nth-child(7n) { border-right: 0; }
.calendar-month__day.is-outside { background: #fafbfe; color: #9ca6b7; }
.calendar-month__number { display: inline-flex; justify-content: center; align-items: center; width: 26px; height: 26px; margin-bottom: 6px; border-radius: 50%; font-size: .78rem; font-weight: 700; }
.calendar-month__day.is-today .calendar-month__number { background: var(--app-primary); color: #fff; }
.calendar-month-event { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 3px 0; padding: 3px 5px; border-radius: 6px; color: #3153bf; background: #edf2ff; font-size: .69rem; text-decoration: none; }
.calendar-month-event--call { color: #8a5b12; background: #fff4df; }
.calendar-month-event--meeting { color: #3f7654; background: #e8f7ee; }
.calendar-month-event--reminder { color: #7a4b9e; background: #f3ebfb; }
.calendar-events-summary .list-group-item { padding: 14px 18px; }

.settings-tabs { margin-bottom: 18px; }
.settings-section-heading { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 16px; }
.settings-section-heading p { margin: 3px 0 0; color: var(--app-muted); }
.role-permission-card details > summary { cursor: pointer; list-style: none; }
.role-permission-card details > summary::-webkit-details-marker { display: none; }
.permission-group { padding: 10px; border: 1px solid var(--app-line); border-radius: 11px; background: #fbfcff; }
.permission-group__title { margin-bottom: 7px; color: #4b5870; font-size: .82rem; font-weight: 700; }
.member-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--app-line); }
.member-row:last-child { border-bottom: 0; }
.member-avatar { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; aspect-ratio: 1 / 1; flex: 0 0 34px; overflow: hidden; border-radius: 50%; background: var(--app-primary-soft); color: var(--app-primary); font-size: .82rem; font-weight: 800; line-height: 1; }

.settings-profile-aside { align-self: flex-start; display: flex; flex-direction: column; gap: 1rem; }
.settings-profile-aside > .card { width: 100%; margin: 0; }
.settings-profile-plan-card .card-body { min-height: 0; }

.task-card { border-left: 4px solid #aebce7; overflow: visible; }
.task-card--high, .task-card--urgent { border-left-color: #db5967; }
.task-card--low { border-left-color: #98a2b3; }
.task-card__meta { color: var(--app-muted); font-size: .82rem; }
.task-check { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; margin: 2px 3px 2px 0; white-space: normal; text-align: left; }

.auth-page { min-height: 100vh; background: radial-gradient(circle at top left, #eaf0ff 0, transparent 35%), var(--app-bg); }
.auth-page__brand { width: min(100% - 48px, 1080px); margin: 0 auto; padding: 26px 0 4px; color: var(--app-text); }
.auth-page .card { box-shadow: 0 18px 44px rgba(31,48,97,.1); }
.password-field > .form-control { border-right: 0; }
.password-field__toggle { width: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-color: #dbe1ea; color: var(--app-muted); background: var(--app-surface); }
.password-field__toggle:hover, .password-field__toggle:focus-visible { color: var(--app-primary); background: var(--app-primary-soft); border-color: #9aaff7; }
.password-field__toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.password-field__toggle svg[hidden] { display: none; }

@media (max-width: 1199.98px) { .app-main { padding: 22px 24px 36px; } }
@media (max-width: 991.98px) { .app-main { width: 100%; padding: 18px 16px 30px; } .app-topbar { margin-bottom: 18px; } }
@media (max-width: 575.98px) { .app-main { padding: 16px 12px 28px; } .app-topbar__name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .app-company-pill { display: none; } .card-body, .card-header, .card-footer { padding-left: 14px; padding-right: 14px; } .calendar-toolbar form { width: 100%; } .calendar-toolbar .form-select, .calendar-toolbar .form-control { min-width: 0; } }

/* Адаптивная оболочка, логотип компании и интерфейс поддержки */
.company-identity { display: inline-flex; min-width: 0; align-items: center; gap: 8px; }
.company-identity__logo { width: 24px; height: 24px; flex: 0 0 24px; border-radius: 7px; object-fit: cover; background: #fff; border: 1px solid rgba(73, 91, 130, .16); }
.company-identity__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-identity--sidebar { width: 100%; color: inherit; }
.company-identity--sidebar .company-identity__logo { width: 27px; height: 27px; flex-basis: 27px; border-color: rgba(255, 255, 255, .18); }
.company-identity--topbar .company-identity__logo { width: 20px; height: 20px; flex-basis: 20px; border-radius: 6px; }
.company-identity--mobile-nav .company-identity__logo { width: 27px; height: 27px; flex-basis: 27px; }
.app-company-pill { display: inline-flex; min-width: 0; align-items: center; }
.app-company-pill .company-identity { max-width: 100%; }
.app-list-meta { float: right; color: var(--app-muted); font-size: .81rem; text-align: right; }
.error-card { border: 0; box-shadow: 0 18px 44px rgba(31, 48, 97, .10); }
.error-card__code { margin-bottom: 8px; color: var(--app-primary); font-size: clamp(3.8rem, 14vw, 6rem); line-height: .95; font-weight: 800; letter-spacing: -.08em; }
.support-ticket__body { white-space: pre-line; color: #4d5970; }

@media (max-width: 991.98px) {
  .app-shell { display: block; }
  .app-mobile-header { position: sticky; z-index: 1020; top: 0; width: 100%; height: 64px; flex: 0 0 64px; padding: 0 14px; box-shadow: 0 2px 12px rgba(29, 42, 78, .04); }
  .app-mobile-header__brand { min-width: 0; font-size: 1rem; }
  .app-mobile-header__brand > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app-mobile-header__menu { width: 44px; height: 42px; padding: 0; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 44px; font-size: 1.15rem; }
  .app-main { width: 100%; max-width: 100%; min-width: 0; overflow-x: clip; }
}

@media (max-width: 575.98px) {
  .app-main { padding: 14px 12px 28px; }
  .app-topbar { align-items: flex-start; gap: 8px; min-height: auto; margin-bottom: 16px; }
  .app-topbar__context { align-items: flex-start; flex-direction: column; gap: 4px; }
  .app-topbar__name { max-width: calc(100vw - 24px); font-size: .92rem; }
  .app-company-pill { max-width: calc(100vw - 24px); padding: 4px 8px; }
  .app-company-pill .company-identity { display: flex; }
  .app-page-header { gap: 12px !important; margin-bottom: 18px !important; }
  .app-page-header h1 { font-size: 1.55rem; }
  .app-page-header .btn { width: 100%; }
  .card-stat { min-height: auto; }
  .card-stat .card-body { min-height: 104px; display: flex; flex-direction: column; justify-content: space-between; }
  .metric-card__label { max-width: 18rem; font-size: .84rem; }
  .metric-card__value { font-size: 1.85rem; }
  .app-list-meta { float: none; display: block; margin-top: 4px; text-align: left; }
  .list-group-item > .badge { margin-top: 4px; }
  .kanban-column { min-width: min(86vw, 320px); }
  .calendar-shell { margin-left: -12px; margin-right: -12px; border-radius: 0; border-left: 0; border-right: 0; }
  .settings-section-heading { align-items: stretch; flex-direction: column; }
  .member-row { align-items: flex-start; flex-direction: column; }
  .member-row > .btn, .member-row form { width: 100%; }
  .member-row form .btn { width: 100%; }
  .support-ticket .badge { font-size: .71rem; }
}
.kanban-column.is-drop-target { outline: 2px solid rgba(61, 101, 220, .35); outline-offset: 2px; background: #e8efff; }
.app-toast-container { position: fixed; z-index: 1080; top: 16px; right: 16px; width: min(360px, calc(100vw - 32px)); }
.app-toast { margin-bottom: 8px; border: 0; border-radius: 12px; }

/* Адаптивные диалоги, переписка по тикетам и подгрузка длинных списков */
.modal-dialog { max-width: min(96vw, var(--bs-modal-width)); }
.modal-content { max-height: calc(100dvh - 1.5rem); }
.modal-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-footer { gap: .5rem; flex-wrap: wrap; }
.modal-footer .btn { min-width: 128px; }
.support-layout { align-items: stretch; }
.support-chat-card { min-height: min(720px, calc(100dvh - 160px)); }
.support-chat { display: flex; flex-direction: column; gap: 12px; max-height: min(58dvh, 560px); overflow-y: auto; background: #f7f9fd; }
.support-message { max-width: min(86%, 620px); }
.support-message--support { align-self: flex-end; }
.support-message--client { align-self: flex-start; }
.support-message__meta { margin: 0 8px 4px; color: var(--app-muted); font-size: .74rem; }
.support-message__bubble { padding: 11px 13px; border-radius: 16px; white-space: pre-line; background: #fff; border: 1px solid var(--app-line); box-shadow: 0 3px 10px rgba(31,48,97,.04); }
.support-message--support .support-message__bubble { color: #fff; background: var(--app-primary); border-color: var(--app-primary); }
.support-ticket-row.active .badge { border: 1px solid rgba(255,255,255,.35); }
.lazy-load-more { margin: 12px auto 0; display: flex; }
.lazy-load-sentinel { width: 100%; height: 1px; }
.task-date-group { border: 1px solid var(--app-line); border-radius: 14px; background: var(--app-surface); box-shadow: 0 4px 14px rgba(29, 42, 78, .035); }
.task-date-group + .task-date-group { margin-top: .75rem; }
.task-date-group__summary { display: flex; min-height: 52px; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; cursor: pointer; list-style: none; user-select: none; }
.task-date-group__summary::-webkit-details-marker { display: none; }
.task-date-group__summary:hover { background: var(--app-primary-soft); border-radius: 14px; }
.task-date-group[open] > .task-date-group__summary { border-bottom: 1px solid var(--app-line); border-radius: 14px 14px 0 0; }
.task-date-group__title { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--app-muted); font-size: .88rem; font-weight: 700; text-transform: uppercase; letter-spacing: .035em; }
.task-date-group__content { padding: 16px; }
.task-date-group__chevron { width: 9px; height: 9px; flex: 0 0 9px; border-right: 2px solid var(--app-muted); border-bottom: 2px solid var(--app-muted); transform: rotate(45deg); transition: transform .18s ease; }
.task-date-group[open] .task-date-group__chevron { transform: rotate(225deg); }

.admin-dynamic-list-controls {
  display: flex;
  min-height: 2rem;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin-top: .75rem;
}

/* Client metrics workspace */
.client-metrics__heading { display:flex; justify-content:space-between; align-items:flex-start; gap:1rem; margin-bottom:1rem; }
.client-metrics__heading > div:first-child { max-width:52rem; }
.client-metrics__total { flex:0 0 auto; padding:.55rem .75rem; border:1px solid var(--app-line); border-radius:.75rem; color:var(--app-muted); font-size:.82rem; white-space:nowrap; }
.client-metrics__total strong { color:var(--app-text); }
.client-metrics__total span { margin:0 .3rem; color:var(--app-line); }
.metric-entry-card .card-header > div { display:flex; flex-direction:column; gap:.12rem; }
.metric-entry-card .card-header small, .metric-history .card-header small { color:var(--app-muted); font-weight:400; }
.metric-bulk-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.55rem .75rem; max-height:15.5rem; padding-right:.25rem; overflow:auto; }
.metric-bulk-row { display:grid; grid-template-columns:minmax(7rem,1fr) minmax(5rem,7rem) 3.5rem; align-items:center; gap:.5rem; padding:.45rem .55rem; border:1px solid var(--app-line); border-radius:.7rem; background:var(--app-surface-subtle,#f8f9fb); }
.metric-bulk-row__name { min-width:0; overflow:hidden; text-overflow:ellipsis; font-size:.85rem; font-weight:650; }
.metric-bulk-row__name small { display:block; color:var(--app-muted); font-size:.68rem; font-weight:400; }
.metric-bulk-row .form-control { min-width:0; padding:.38rem .5rem; text-align:right; }
.metric-bulk-row__unit { overflow:hidden; color:var(--app-muted); font-size:.75rem; text-overflow:ellipsis; white-space:nowrap; }
.metric-bulk-count { flex:0 0 auto; padding-bottom:.55rem; font-size:.82rem; }
.client-metrics__toolbar { position:sticky; top:.5rem; z-index:5; }
.client-metrics__search { width:min(100%,20rem); }
.metric-filter-pills { display:flex; flex-wrap:wrap; gap:.35rem; }
.metric-series-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1rem; }
.metric-series-card { min-width:0; overflow:hidden; }
.metric-series-card__top { display:flex; justify-content:space-between; align-items:flex-start; gap:1rem; min-height:3.4rem; }
.metric-series-card__name { color:var(--app-text); font-size:1rem; font-weight:750; overflow-wrap:anywhere; }
.metric-series-card__value { color:var(--app-text); font-size:1.45rem; font-weight:780; letter-spacing:-.035em; white-space:nowrap; }
.metric-series-card__value small { color:var(--app-muted); font-size:.7rem; font-weight:600; letter-spacing:0; }
.metric-series-card__delta { margin-top:.1rem; font-size:.75rem; font-weight:700; white-space:nowrap; }
.metric-series-card__delta--up { color:#198754; }
.metric-series-card__delta--down { color:#d34b5b; }
.metric-series-card__delta--same { color:var(--app-muted); }
.metric-chart { display:block; width:100%; height:9rem; margin:.35rem 0 .2rem; overflow:visible; }
.metric-chart__grid { stroke:var(--app-line); stroke-width:.7; stroke-dasharray:2.5 2.5; }
.metric-chart__line { fill:none; stroke:#4169df; stroke-width:2.25; stroke-linecap:round; stroke-linejoin:round; }
.metric-chart__point { fill:#fff; stroke:#4169df; stroke-width:1.6; cursor:help; }
.metric-series-card__range { display:flex; justify-content:space-between; gap:.5rem; padding-top:.55rem; border-top:1px solid var(--app-line); color:var(--app-muted); font-size:.73rem; }
.metric-series-card__range strong { color:var(--app-text); font-weight:700; }
.metric-history { overflow:hidden; }
.metric-history > summary { display:flex; justify-content:space-between; align-items:center; cursor:pointer; list-style:none; }
.metric-history > summary::-webkit-details-marker { display:none; }
.metric-history > summary span:first-child { display:flex; flex-direction:column; }
.metric-history > summary::after { content:'⌃'; margin-left:.75rem; color:var(--app-muted); transition:transform .18s ease; }
.metric-history:not([open]) > summary::after { transform:rotate(180deg); }
html[data-theme="dark"] .metric-chart__point { fill:var(--app-surface,#182033); }
html[data-theme="dark"] .metric-bulk-row { background:#141c29; }
@media(prefers-color-scheme:dark) { html[data-theme="system"] .metric-bulk-row { background:#141c29; } }

@media (max-width:1199.98px) {
  .client-metrics__toolbar { position:static; }
}
@media (max-width:767.98px) {
  .client-metrics__heading { flex-direction:column; }
  .client-metrics__total { white-space:normal; }
  .metric-bulk-grid, .metric-series-grid { grid-template-columns:1fr; }
  .metric-series-card__top { gap:.5rem; }
  .client-metrics__search { width:100%; }
  .metric-filter-pills { width:100%; overflow:auto; flex-wrap:nowrap; padding-bottom:.15rem; }
  .metric-filter-pills .btn { white-space:nowrap; }
}
@media (max-width:420px) {
  .metric-bulk-row { grid-template-columns:minmax(5.5rem,1fr) 5rem 3rem; padding:.4rem; }
  .metric-series-card__value { font-size:1.2rem; }
  .metric-series-card__range { font-size:.68rem; }
}
.admin-dynamic-list-sentinel { width: 1px; height: 1px; }
.app-main > .row.g-3 + section.card { margin-top: 1rem; }
[data-lazy-hidden="true"] { display: none !important; }

@media (max-width: 575.98px) {
  .modal { --bs-modal-margin: .5rem; }
  .modal-dialog { width: calc(100vw - 1rem); max-width: calc(100vw - 1rem); margin: .5rem auto; }
  .modal-content { max-height: calc(100dvh - 1rem); border-radius: 18px; }
  .modal-header { align-items: flex-start; padding: 16px; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px 16px; flex-direction: column-reverse; align-items: stretch; }
  .modal-footer .btn { width: 100%; min-width: 0; }
  .support-chat-card { min-height: auto; }
  .support-chat { max-height: 56dvh; }
  .support-message { max-width: 96%; }
  .support-layout .list-group-item { padding-left: 12px; padding-right: 12px; }
}

/* Центр уведомлений */
.app-topbar__actions, .app-mobile-header__actions { display: inline-flex; align-items: center; gap: 10px; }
.notification-bell { position: relative; width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--app-line); border-radius: 11px; color: var(--app-text); background: #fff; font-size: 1.25rem; line-height: 1; text-decoration: none; transition: .18s ease; }
.notification-bell:hover { color: var(--app-primary); border-color: #aebcf0; background: var(--app-primary-soft); transform: translateY(-1px); }
.notification-bell__count { position: absolute; top: -7px; right: -7px; min-width: 19px; height: 19px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; border: 2px solid var(--app-bg); border-radius: 10px; color: #fff; background: #dc3545; font-size: .62rem; font-weight: 800; }
.notification-bell--mobile { width: 42px; height: 42px; flex: 0 0 42px; }
.notification-list-card { overflow: hidden; }
.notification-item { padding: 17px 20px; border-left: 3px solid transparent; }
.notification-item--unread { border-left-color: var(--app-primary); background: #f7f9ff; }
.notification-kind { width: 23px; height: 23px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; color: var(--app-primary); background: var(--app-primary-soft); font-size: .78rem; font-weight: 800; }
.notification-kind--task { color: #206c4c; background: #e8f7ee; }
.notification-kind--calendar { color: #7a4b9e; background: #f3ebfb; }
.notification-kind--support { color: #2e61b8; background: #eaf0ff; }
.notification-kind--mention { color: #925b12; background: #fff3df; }
.notification-kind--admin, .notification-kind--warning { color: #a04f20; background: #fff0e5; }

/* Рабочая область лидов */
.leads-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.leads-pipeline-card { border-radius: 16px; }
.lead-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pipeline-stage-row { display: grid; grid-template-columns: minmax(160px, 1.6fr) 100px 90px auto; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--app-line); }
.pipeline-stage-row:last-child { border-bottom: 0; }
.lead-modal__meta { color: var(--app-muted); font-size: .78rem; }

@media (max-width: 575.98px) {
  .app-topbar__actions { width: 100%; justify-content: flex-end; }
  .app-mobile-header__actions { gap: 8px; }
  .notification-item { padding: 14px; }
  .pipeline-stage-row { grid-template-columns: 1fr auto; }
  .pipeline-stage-row > :nth-child(2), .pipeline-stage-row > :nth-child(3) { grid-column: span 1; }
  .pipeline-stage-row > :last-child { grid-column: 1 / -1; width: 100%; }
  .lead-card-actions .btn { flex: 1 1 auto; }
}
.pipeline-stage-row { display: flex; flex-wrap: wrap; }
.pipeline-stage-row > form:first-child { min-width: min(100%, 660px); flex: 1 1 660px; }
.pipeline-stage-row > form:last-child { flex: 1 1 280px; align-self: center; }
@media (max-width: 575.98px) { .pipeline-stage-row > form:first-child, .pipeline-stage-row > form:last-child { flex-basis: 100%; min-width: 0; } }

/* Колокольчик уведомлений и компактный счётчик непрочитанного */
.notification-bell { box-shadow: 0 5px 16px rgba(39, 60, 118, .08); }
.notification-bell__icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s ease; }
.notification-bell:hover .notification-bell__icon { transform: rotate(8deg) scale(1.06); }
.notification-bell__count { min-width: 21px; height: 21px; padding: 0 6px; top: -8px; right: -8px; border-radius: 999px; border-color: #fff; box-shadow: 0 4px 10px rgba(185, 38, 51, .32); letter-spacing: -.02em; }
@media (max-width: 575.98px) { .notification-bell__count { top: -6px; right: -5px; } }

/* Роли, рабочие разделы и наглядные отчёты */
.role-summary-card { transition: transform .18s ease, box-shadow .18s ease; }
.role-summary-card:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(29, 42, 78, .09); }
.role-permissions-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.permission-group { min-width: 0; padding: 13px; border: 1px solid var(--app-line); border-radius: 13px; background: #fbfcff; }
.permission-group__heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.permission-group__title { float: none; width: auto; margin: 0; color: #33415d; font-size: .87rem; font-weight: 730; }
.permission-group__checks { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.permission-group__checks .form-check { margin-right: 0; }
.permission-group__checks .form-check-label { color: #536077; }

.pipeline-tabs { margin: 0 0 14px; }
.pipeline-tabs__scroll { display: flex; gap: 8px; overflow-x: auto; padding: 2px; scrollbar-color: #bcc9e4 transparent; }
.pipeline-tab { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid #c8d4f7; border-radius: 11px; color: var(--app-primary); background: #f7f9ff; font-weight: 670; text-decoration: none; white-space: nowrap; }
.pipeline-tab:hover { color: var(--app-primary-dark); background: #edf2ff; }
.pipeline-tab.is-active { border-color: var(--app-primary); color: #fff; background: var(--app-primary); box-shadow: 0 5px 14px rgba(61, 101, 220, .20); }
.lead-filter-bar, .task-filter-bar { display: grid; grid-template-columns: minmax(240px, 1.35fr) minmax(190px, .95fr) auto auto; align-items: center; gap: 9px; }
.task-filter-bar { grid-template-columns: minmax(240px, 1.2fr) minmax(180px, .8fr) minmax(180px, .8fr) auto auto; }
.lead-filter-bar__search, .lead-filter-bar__select { min-width: 0; }
.leads-workspace-header { overflow: visible; }
.leads-workspace-header .card-body { min-height: 78px; }
.view-toggle { display: inline-flex; overflow: hidden; border: 1px solid #c5d0e8; border-radius: 10px; background: #fff; }
.view-toggle__button { width: 38px; height: 36px; display: inline-flex; align-items: center; justify-content: center; color: #62708a; text-decoration: none; }
.view-toggle__button + .view-toggle__button { border-left: 1px solid #c5d0e8; }
.view-toggle__button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.view-toggle__button:hover { color: var(--app-primary); background: #f4f7ff; }
.view-toggle__button.is-active { color: #fff; background: var(--app-primary); }
.icon-button { width: 38px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid #c5d0e8; border-radius: 10px; color: #4e5d77; background: #fff; }
.icon-button:hover, .icon-button:focus { color: var(--app-primary); border-color: #aebcf0; background: var(--app-primary-soft); }
.icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button--small { width: 30px; height: 30px; border-radius: 8px; }
.icon-button--small svg { width: 17px; height: 17px; }
.kanban-scroll { position: relative; overflow: visible; padding: 2px 2px 0; }
.kanban-scroll .kanban { overflow: visible; padding-bottom: 2px; }
.kanban-column { display: flex; flex-direction: column; min-height: 370px; background: #eef3fa; }
.kanban-column__header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; color: #263651; }
.kanban-column__header b { display: flex; align-items: center; gap: 7px; min-width: 0; }
.stage-color { width: 11px; height: 11px; flex: 0 0 11px; border-radius: 50%; background: var(--stage-color, var(--app-primary)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--stage-color, var(--app-primary)) 15%, transparent); }
.kanban-card { cursor: grab; padding: 12px; }
.kanban-card.is-dragging { opacity: .54; transform: rotate(1deg) scale(.98); }
.kanban-card__header { display: flex; align-items: center; gap: 7px; min-width: 0; margin-bottom: 6px; }
.kanban-drag-handle { width: 26px; height: 30px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 26px; border-radius: 8px; color: #7583a0; background: #f0f3f9; cursor: grab; }
.kanban-drag-handle:hover { color: var(--app-primary); background: #e5ebfc; }
.kanban-drag-handle svg { width: 18px; height: 18px; fill: currentColor; }
.kanban-card__meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.kanban-column__drop-help { min-height: 38px; display: flex; align-items: center; justify-content: center; margin-top: auto; border: 1px dashed #c1cce0; border-radius: 10px; color: #8490a7; font-size: .76rem; }
.kanban-scroll-hint { display: none; align-items: center; justify-content: center; gap: 7px; margin-top: 8px; color: #697893; font-size: .79rem; }
.kanban-scroll-hint span { color: var(--app-primary); font-size: 1.2rem; font-weight: 800; }
.task-templates-panel { overflow: visible; }
.task-templates-panel__summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; list-style: none; user-select: none; }
.task-templates-panel__summary::-webkit-details-marker { display: none; }
.task-templates-panel__summary::after { content: '⌄'; color: var(--app-primary); font-size: 1.2rem; transition: transform .18s ease; }
.task-templates-panel[open] .task-templates-panel__summary::after { transform: rotate(180deg); }
.task-templates-panel__hint { color: var(--app-primary); font-size: .79rem; font-weight: 650; }
.task-templates-panel[open] .task-templates-panel__hint { display: none; }

.segmented-control { display: inline-flex; padding: 3px; border: 1px solid #cfd9ed; border-radius: 11px; background: #fff; }
.segmented-control__item { padding: 7px 11px; border-radius: 8px; color: #64718a; font-size: .83rem; font-weight: 680; text-decoration: none; }
.segmented-control__item:hover { color: var(--app-primary); background: #f1f4fb; }
.segmented-control__item.is-active { color: #fff; background: var(--app-primary); box-shadow: 0 3px 10px rgba(61,101,220,.18); }
.analytics-kpi { overflow: visible; }
.analytics-kpi__value { color: #172033; font-size: clamp(1.5rem, 2.6vw, 2.05rem); font-weight: 770; letter-spacing: -.04em; }
.analytics-kpi__change { display: inline-flex; align-items: center; min-height: 25px; padding: 0 8px; border-radius: 999px; font-size: .76rem; font-weight: 750; white-space: nowrap; }
.analytics-kpi__change--up { color: #17643f; background: #e5f6ec; }
.analytics-kpi__change--down { color: #a64049; background: #fdebee; }
.analytics-kpi__change--flat { color: #637189; background: #edf1f8; }
.analytics-card { overflow: hidden; }
.revenue-chart { height: 248px; padding-top: 13px; }
.revenue-chart__bars { height: 100%; display: flex; align-items: flex-end; gap: clamp(5px, 1vw, 13px); padding: 0 5px 22px; border-bottom: 1px solid #dce4f1; }
.analytics-card .card-body { display: block; }
.revenue-chart__slot { min-width: 0; height: 100%; flex: 1 1 0; position: relative; display: flex; align-items: flex-end; justify-content: center; }
.revenue-chart__bar { width: min(100%, 34px); min-height: 4px; border-radius: 9px 9px 4px 4px; background: linear-gradient(180deg, #7596ff, #3d65dc); box-shadow: 0 6px 13px rgba(61,101,220,.18); transition: opacity .18s ease, transform .18s ease; }
.revenue-chart__slot:hover .revenue-chart__bar { opacity: .85; transform: translateY(-2px); }
.revenue-chart__value { position: absolute; bottom: calc(var(--bar-height, 0%) + 5px); display: none; max-width: 86px; overflow: hidden; color: #52617d; font-size: .66rem; line-height: 1.1; text-align: center; white-space: nowrap; text-overflow: ellipsis; }
.revenue-chart__slot:hover .revenue-chart__value { display: block; bottom: calc(var(--bar-height, 0%) + 6px); }
.revenue-chart__label { position: absolute; bottom: -20px; max-width: 100%; overflow: hidden; color: #7a879e; font-size: .67rem; text-align: center; white-space: nowrap; text-overflow: ellipsis; }
.analytics-bars { display: grid; gap: 13px; }
.analytics-bars__track { height: 9px; overflow: hidden; border-radius: 999px; background: #edf1f7; }
.analytics-bars__fill { height: 100%; min-width: 4px; border-radius: inherit; background: var(--app-primary); transition: width .3s ease; }
.analytics-bars__fill--workload { background: linear-gradient(90deg, #42b879, #1f8e57); }
.problem-zone-list { display: grid; }
.problem-zone { display: flex; align-items: flex-start; gap: 12px; padding: 14px 17px; border-bottom: 1px solid var(--app-line); color: inherit; text-decoration: none; transition: background .18s ease; }
.problem-zone:last-child { border-bottom: 0; }
.problem-zone:hover { color: inherit; background: #f8faff; }
.problem-zone__count { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 32px; border-radius: 10px; color: #9d3541; background: #feecee; font-weight: 760; }
.problem-zone__count--service { color: #9a6415; background: #fff3df; }
.problem-zone__count--contact { color: #3b65b6; background: #eaf0ff; }
.problem-zone__items { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 5px; }
.problem-zone__items span { color: #75829a; font-size: .72rem; }
.problem-zone__arrow { margin-left: auto; color: #8b98ae; font-size: 1.35rem; line-height: 1; }

@media (max-width: 991.98px) {
  .role-permissions-grid { grid-template-columns: 1fr; }
  .lead-filter-bar, .task-filter-bar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .task-filter-bar > :nth-last-child(2) { grid-column: 1 / -1; }
}
@media (max-width: 575.98px) {
  .lead-filter-bar, .task-filter-bar { grid-template-columns: 1fr; }
  .lead-filter-bar .btn, .task-filter-bar .btn { width: 100%; }
  .leads-toolbar { align-items: flex-start; }
  .view-toggle__button, .icon-button { width: 42px; height: 40px; }
  .kanban-scroll { margin-right: -12px; padding-right: 12px; }
  .kanban-scroll-hint { display: flex; }
  .kanban-column { min-width: min(84vw, 318px); }
  .revenue-chart { height: 220px; }
  .revenue-chart__bars { gap: 4px; }
  .revenue-chart__label { font-size: .60rem; }
  .segmented-control { width: 100%; }
  .segmented-control__item { flex: 1; text-align: center; }
}

/* Прокрутка редактора роли и меню действий в таблицах */
.role-editor-dialog {
  height: calc(100dvh - 2rem);
  margin-top: 1rem;
  margin-bottom: 1rem;
}
.role-editor-dialog__content {
  display: flex;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}
.role-editor-dialog .modal-header,
.role-editor-dialog .modal-footer {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  background: #fff;
}
.role-editor-dialog form {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}
.role-editor-dialog .modal-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.role-editor-dialog .modal-footer {
  border-top: 1px solid var(--app-line);
  box-shadow: 0 -8px 18px rgba(31, 48, 97, .05);
}

.lead-table-actions { display: inline-flex; }
.lead-table-actions__menu {
  position: fixed;
  z-index: 1090;
  min-width: 184px;
  margin: 0;
}

@media (max-width: 575.98px) {
  .role-editor-dialog {
    height: calc(100dvh - 1rem);
    margin-top: .5rem;
    margin-bottom: .5rem;
  }
  .role-editor-dialog .modal-body { padding-bottom: 24px; }
}


/* Нулевое значение не рисуем как условный прогресс. */
.revenue-chart__bar.is-empty {
  min-height: 0;
  box-shadow: none;
  opacity: 0;
}
.analytics-bars__fill[style*="width: 0%"] { min-width: 0; }

/* Подсказки для упоминаний сотрудников в комментариях. */
.mention-host { position: relative; }
.mention-suggestions {
  position: absolute;
  z-index: 1080;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  max-height: 248px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid #d7e0f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(24, 44, 82, .18);
}
.mention-suggestions__item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  color: #263854;
  background: transparent;
  text-align: left;
}
.mention-suggestions__item:hover,
.mention-suggestions__item:focus { background: #eef3ff; outline: none; }
.mention-suggestions__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #7295ff, #3d65dc);
  font-size: .72rem;
  font-weight: 750;
}
.mention-suggestions__text { display: grid; gap: 1px; min-width: 0; }
.mention-suggestions__text strong { font-size: .87rem; }
.mention-suggestions__text small { color: #74839c; font-size: .72rem; }

/* Рабочее пространство администратора платформы */
.app-eyebrow { color: var(--app-primary); font-size: .75rem; font-weight: 790; letter-spacing: .09em; text-transform: uppercase; }
.admin-period-switcher { max-width: 100%; }
.admin-attention { padding: 17px; border: 1px solid #dce5f4; border-radius: 18px; background: linear-gradient(135deg, #f8faff 0%, #ffffff 58%); box-shadow: 0 10px 28px rgba(29, 53, 96, .045); }
.attention-card { min-height: 94px; display: flex; align-items: center; gap: 12px; padding: 13px; border: 1px solid #e1e8f5; border-radius: 14px; color: #25344f; background: #fff; text-decoration: none; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.attention-card:hover { color: #25344f; transform: translateY(-2px); border-color: #b9c9ec; box-shadow: 0 12px 26px rgba(35, 58, 105, .09); }
.attention-card__count { width: 37px; height: 37px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 37px; border-radius: 12px; color: #3155b8; background: #eaf0ff; font-size: 1.04rem; font-weight: 790; }
.attention-card--danger .attention-card__count { color: #a83d49; background: #fdebed; }
.attention-card--warning .attention-card__count { color: #a16c16; background: #fff3de; }
.attention-card--info .attention-card__count { color: #236aa2; background: #e8f4fd; }
.attention-card__body { display: grid; gap: 3px; min-width: 0; }
.attention-card__body strong { font-size: .86rem; }
.attention-card__body small { color: #73819a; font-size: .73rem; line-height: 1.25; }
.attention-card__arrow { margin-left: auto; color: #94a0b7; font-size: 1.35rem; }
.admin-all-clear { min-height: 68px; display: flex; align-items: center; gap: 12px; padding: 13px 15px; border: 1px solid #cdebd9; border-radius: 14px; background: #f4fcf7; color: #1d6745; }
.admin-all-clear__icon { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; background: #2da269; font-weight: 800; }
.admin-all-clear span:last-child { display: grid; gap: 1px; }
.admin-all-clear small { color: #5f8d75; }
.admin-dynamic-card { color: inherit; border-color: #e1e8f5; overflow: hidden; transition: transform .18s ease, box-shadow .18s ease; }
.admin-dynamic-card:hover { color: inherit; transform: translateY(-2px); box-shadow: 0 14px 28px rgba(31, 54, 102, .09); }
.admin-dynamic-card__value { color: #17233d; font-size: clamp(1.35rem, 2.2vw, 1.85rem); font-weight: 780; letter-spacing: -.035em; white-space: nowrap; }
.admin-company-table-card { overflow: visible; }
.admin-company-link { display: inline-grid; gap: 2px; color: #1f2d48; text-decoration: none; }
.admin-company-link:hover strong { color: var(--app-primary); }
.admin-company-link span { color: #6b7d9d; font-size: .72rem; }
.admin-usage-progress { width: 148px; height: 6px; margin-top: 6px; border-radius: 99px; background: #e9eef6; }
.admin-more-button { min-width: 34px; font-size: 1.18rem; font-weight: 760; line-height: 1; }
.admin-action-menu { min-width: 214px; padding: 6px; border-color: #dbe3f0; border-radius: 12px; box-shadow: 0 13px 32px rgba(29, 47, 86, .14); }
.admin-action-menu .dropdown-item { border-radius: 8px; padding: 8px 10px; font-size: .88rem; }
.admin-action-menu form { margin: 0; }

@media (max-width: 767.98px) {
  .admin-period-switcher { width: 100%; }
  .admin-period-switcher .segmented-control__item { padding-inline: 8px; font-size: .76rem; }
  .attention-card { min-height: 78px; }
  .admin-usage-progress { width: 110px; }
}

/* Меню действий администратора, тарифы и платежи CRM */
.admin-table-action { display: inline-flex; position: relative; }
.floating-action-menu {
  position: fixed;
  z-index: 1085;
  max-width: min(290px, calc(100vw - 16px));
  max-height: min(420px, calc(100vh - 16px));
  overflow-y: auto;
  overscroll-behavior: contain;
}
.floating-action-menu.show { display: block; }
.admin-action-menu { min-width: 224px; }
.admin-action-menu .dropdown-item { width: 100%; text-align: left; }
.admin-action-menu .dropdown-item:focus-visible { outline: 3px solid rgba(61, 101, 220, .28); outline-offset: -2px; }
.admin-page-head { min-height: 44px; }
.admin-summary-card {
  height: 100%;
  padding: 17px 18px;
  border: 1px solid #e2e8f3;
  border-radius: 16px;
  background: linear-gradient(145deg, #fff, #f8faff);
  box-shadow: 0 10px 25px rgba(37, 53, 86, .055);
}
.admin-summary-card > span { display: block; color: #697891; font-size: .79rem; font-weight: 650; }
.admin-summary-card > strong { display: block; margin-top: 5px; color: #1d2940; font-size: clamp(1.28rem, 2vw, 1.68rem); letter-spacing: -.035em; }
.admin-summary-card--success { border-color: #d8f0e2; background: linear-gradient(145deg, #fff, #f5fcf8); }
.admin-summary-card--success > strong { color: #17643f; }
.admin-summary-card--warning { border-color: #f6e2c1; background: linear-gradient(145deg, #fff, #fffaf1); }
.admin-summary-card--warning > strong { color: #956014; }
.admin-summary-card--danger { border-color: #f6dce0; background: linear-gradient(145deg, #fff, #fff7f8); }
.admin-summary-card--danger > strong { color: #a33e4b; }
.plan-card { overflow: visible; border-color: #e1e8f4; box-shadow: 0 10px 24px rgba(36, 53, 84, .055); transition: transform .18s ease, box-shadow .18s ease; }
.plan-card:hover { transform: translateY(-2px); box-shadow: 0 16px 29px rgba(36, 53, 84, .10); }
.plan-card__eyebrow { color: #71819b; font-size: .72rem; font-weight: 750; letter-spacing: .055em; text-transform: uppercase; }
.plan-card__price { color: #17233b; font-size: clamp(1.78rem, 3vw, 2.35rem); font-weight: 760; letter-spacing: -.05em; line-height: 1.1; }
.plan-card__price small { margin-left: 6px; color: #708099; font-size: .8rem; font-weight: 650; letter-spacing: 0; }
.plan-card__limit { display: inline-flex; align-items: center; min-height: 26px; padding: 3px 9px; border-radius: 999px; color: #445573; background: #eef3fb; font-size: .75rem; font-weight: 670; }
.plan-card__description { min-height: 44px; color: #596983; font-size: .88rem; line-height: 1.48; }
.plan-card__usage { display: flex; justify-content: space-between; gap: 12px; padding-top: 13px; border-top: 1px solid #e7edf6; color: #697891; font-size: .78rem; }
.plan-card__usage strong { color: #283750; }
.admin-filter-card { border-color: #e0e7f1; box-shadow: 0 8px 20px rgba(40, 55, 87, .045); }
.admin-payments-table-card { overflow: visible; }
.admin-payments-table-card .table-responsive { border: 0; border-radius: inherit; box-shadow: none; }

@media (max-width: 575.98px) {
  .admin-page-head .btn { width: 100%; }
  .plan-card__usage { align-items: flex-start; flex-direction: column; gap: 3px; }
  .floating-action-menu { min-width: min(250px, calc(100vw - 16px)); }
}


/* Тарифы: диалог должен помещаться на небольших ноутбуках и телефонах. */
.plan-modal-dialog {
  width: min(920px, calc(100vw - 24px));
  max-width: 920px;
  max-height: calc(100dvh - 24px);
  margin: 12px auto;
}
.plan-modal-content {
  max-height: calc(100dvh - 24px);
  overflow: hidden;
}
.plan-modal-form {
  display: flex;
  min-height: 0;
  max-height: calc(100dvh - 24px);
  flex-direction: column;
}
.plan-modal-form .modal-header,
.plan-modal-form .modal-footer {
  flex: 0 0 auto;
  background: #fff;
}
.plan-modal-form .modal-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.plan-modal-form .modal-footer {
  border-top: 1px solid var(--app-line);
  box-shadow: 0 -8px 20px rgba(31, 48, 97, .055);
}
.plan-option-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: flex-start;
  gap: 11px;
  min-height: 100%;
  padding: 14px;
  border: 1px solid #dbe4f2;
  border-radius: 12px;
  background: #fff;
}
.plan-option-card .form-check-input {
  width: 2.15em;
  height: 1.16em;
  float: none;
  margin: .16rem 0 0;
  cursor: pointer;
}
.plan-option-card__title {
  display: block;
  margin: 0;
  color: #243553;
  font-size: .9rem;
  font-weight: 730;
  cursor: pointer;
}
.plan-option-card__hint {
  margin: 5px 0 0;
  color: #6d7c94;
  font-size: .78rem;
  line-height: 1.45;
}

/* Экран приостановленного доступа: пользователь видит причину, а не пустую ошибку. */
.subscription-lock {
  max-width: 760px;
  margin: clamp(22px, 7vh, 88px) auto;
  padding: clamp(28px, 5vw, 52px);
  border: 1px solid #dce5f5;
  border-radius: 24px;
  background: linear-gradient(145deg, #fff 0%, #f7f9fe 100%);
  box-shadow: 0 18px 48px rgba(31, 50, 91, .11);
  text-align: center;
}
.subscription-lock__icon {
  width: 66px;
  height: 66px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  border-radius: 22px;
  color: #9c6511;
  background: #fff1d8;
  font-size: 2rem;
  font-weight: 800;
}
.subscription-lock__eyebrow {
  display: block;
  margin-bottom: 9px;
  color: #936116;
  font-size: .76rem;
  font-weight: 780;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.subscription-lock h1 {
  max-width: 620px;
  margin: 0 auto 12px;
  color: #18263e;
  font-size: clamp(1.55rem, 3.2vw, 2.25rem);
  font-weight: 790;
  letter-spacing: -.035em;
}
.subscription-lock > p {
  max-width: 610px;
  margin: 0 auto;
  color: #667791;
  line-height: 1.6;
}
.subscription-lock__overdue {
  margin-top: 13px !important;
  color: #a46b16 !important;
  font-weight: 700;
}
.subscription-lock__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  margin-top: 26px;
}
.subscription-lock__note {
  margin-top: 21px !important;
  font-size: .82rem;
}

@media (max-width: 767.98px) {
  .plan-modal-dialog {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
    margin: 6px auto;
  }
  .plan-modal-content,
  .plan-modal-form { max-height: calc(100dvh - 12px); }
  .plan-modal-form .modal-header { padding: 16px; }
  .plan-modal-form .modal-body { padding: 16px; }
  .plan-modal-form .modal-footer {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }
  .plan-modal-form .modal-footer .btn { width: 100%; }
  .plan-option-card { min-height: auto; }
  .subscription-lock { margin: 20px auto; border-radius: 18px; }
  .subscription-lock__actions .btn { width: 100%; }
}

/* Диалоговые уведомления */
.notification-item { padding: 0; border-left: 3px solid transparent; }
.notification-item__open { width: 100%; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 17px 20px; border: 0; color: inherit; background: transparent; text-align: left; transition: background .18s ease; }
.notification-item__open:hover, .notification-item__open:focus-visible { background: #f4f7ff; outline: 0; }
.notification-item__open:focus-visible { box-shadow: inset 0 0 0 2px var(--app-primary); }
.notification-item__content { min-width: 0; }
.notification-item__preview { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.notification-item__chevron { flex: 0 0 auto; margin-top: 1px; color: #8995ad; font-size: 1.8rem; line-height: 1; }
.notification-details__body { color: var(--app-text); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
@media (max-width: 575.98px) { .notification-item__open { padding: 14px; gap: 10px; } }


/* Релиз 1.12.0: единая иконография, CAPTCHA и корректная прокрутка рабочих элементов. */
.app-nav__icon { width: 20px; height: 20px; display: inline-flex; flex: 0 0 20px; align-items: center; justify-content: center; }
.app-nav__icon-svg, .app-mobile-header__menu .app-nav__icon-svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.app-mobile-header__menu .app-nav__icon-svg { width: 21px; height: 21px; }
.app-logout .app-nav__icon { width: 20px; height: 20px; }
.admin-more-button { display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.admin-more-button__icon { width: 18px; height: 18px; fill: currentColor; }

/* Горизонтальные меню остаются прокручиваемыми, но не рисуют лишние нативные полосы. */
.nav-tabs, .pipeline-tabs__scroll { overflow-y: hidden; scrollbar-width: none; -ms-overflow-style: none; }
.nav-tabs::-webkit-scrollbar, .pipeline-tabs__scroll::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* Self-hosted image CAPTCHA для публичных auth-форм. */
.captcha-card { padding: 16px; border: 1px solid #d9e5f8; border-radius: 16px; background: linear-gradient(180deg, #f8fbff 0%, #f4f8ff 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,.65); }
.captcha-card__heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.captcha-card__heading strong { display: block; color: #243856; font-size: .92rem; font-weight: 700; }
.captcha-card__heading small { display: block; margin-top: 4px; color: #6b7b96; font-size: .78rem; line-height: 1.45; max-width: 34rem; }
.captcha-card__refresh { width: 36px; height: 36px; display: inline-flex; flex: 0 0 36px; align-items: center; justify-content: center; border: 1px solid #c9d9f3; border-radius: 12px; color: #355fb2; background: #fff; text-decoration: none; box-shadow: 0 2px 10px rgba(58, 92, 156, .08); transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease; }
.captcha-card__refresh svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.captcha-card__refresh:hover, .captcha-card__refresh:focus-visible { color: #fff; background: var(--app-primary); border-color: var(--app-primary); transform: translateY(-1px); outline: 0; }
.captcha-card__challenge, .captcha-card__body { display: grid; grid-template-columns: minmax(180px, 220px) minmax(0, 1fr); gap: 14px; align-items: center; }
.captcha-card__image-wrap { display: flex; align-items: center; justify-content: center; min-height: 78px; padding: 8px; border: 1px dashed #c7d7f2; border-radius: 14px; background: rgba(255,255,255,.82); }
.captcha-card__image { display: block; width: 180px; max-width: 100%; height: auto; border-radius: 12px; }
.captcha-card__field-wrap, .captcha-card__field { min-width: 0; }
.captcha-card__field-wrap .form-label, .captcha-card__field .form-label { margin-bottom: 6px; color: #304363; font-weight: 600; }
.captcha-card__input, .captcha-card__field .form-control { text-transform: uppercase; letter-spacing: .18em; font-weight: 700; }
.captcha-card__field-wrap .form-text, .captcha-card__field .form-text { margin-top: 6px; color: #6b7c96; }
@media (max-width: 575.98px) { .captcha-card { padding: 14px; } .captcha-card__heading { flex-direction: column; align-items: stretch; } .captcha-card__refresh { align-self: flex-start; } .captcha-card__challenge, .captcha-card__body { grid-template-columns: 1fr; } .captcha-card__image-wrap { min-height: 72px; } }

/* Использование лимитов в настройках компании. */
.company-usage { display: grid; gap: 12px; }
.company-usage__row { display: grid; gap: 6px; color: #58677f; }
.company-usage__row strong { color: #263754; font-size: .8rem; }
.company-usage__progress { height: 8px; overflow: hidden; border-radius: 999px; background: #e9eef7; }
.company-usage__progress .progress-bar { border-radius: inherit; }

/* Переключатель роли не должен выходить за левую границу модального окна. */
.role-access-switch.form-check { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; column-gap: 12px; padding: 14px; border: 1px solid var(--app-line); border-radius: 12px; background: #fbfcff; }
.role-access-switch .form-check-input { width: 2.25em; height: 1.2em; float: none; margin: .2rem 0 0; cursor: pointer; }
.role-access-switch__content { min-width: 0; }
.role-access-switch__content .form-text { margin-top: 4px; }

/* Диалог редактирования компании полностью помещается в рабочую область. */
.admin-company-modal-dialog { width: min(1000px, calc(100vw - 24px)); max-width: 1000px; height: calc(100dvh - 24px); max-height: calc(100dvh - 24px); margin: 12px auto; }
.admin-company-modal-content { height: 100%; max-height: 100%; overflow: hidden; }
.admin-company-modal-form { display: flex; height: 100%; min-height: 0; flex-direction: column; }
.admin-company-modal-form .modal-header, .admin-company-modal-form .modal-footer { flex: 0 0 auto; background: #fff; }
.admin-company-modal-form .modal-body { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.admin-company-modal-form .modal-footer { border-top: 1px solid var(--app-line); box-shadow: 0 -8px 18px rgba(31, 48, 97, .05); }
@media (max-width: 767.98px) { .admin-company-modal-dialog { width: calc(100vw - 12px); height: calc(100dvh - 12px); max-height: calc(100dvh - 12px); margin: 6px auto; } .admin-company-modal-form .modal-header { padding: 16px; } .admin-company-modal-form .modal-body { padding: 16px; } }

/* Релиз 1.13.1: рабочие модальные окна адаптируются по содержимому и не создают лишнюю пустоту. */
.app-form-modal {
  width: min(1000px, calc(100vw - 24px));
  max-width: 1000px;
  margin: 12px auto;
}
.app-form-modal--compact { width: min(720px, calc(100vw - 24px)); max-width: 720px; }
.app-form-modal__content,
.modal-dialog.app-form-modal .modal-content {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 24px);
  min-height: 0;
  overflow: hidden;
}
.app-form-modal__content > .modal-header,
.app-form-modal__content > .modal-footer {
  flex: 0 0 auto;
  background: #fff;
}
.app-form-modal__form {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
}
.app-form-modal__content > .modal-body,
.app-form-modal__form > .modal-body {
  min-height: 0;
  flex: 0 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  max-height: calc(100dvh - 190px);
}
.app-form-modal__form > .modal-footer,
.app-form-modal__content > .modal-footer {
  border-top: 1px solid var(--app-line);
  box-shadow: 0 -8px 18px rgba(31, 48, 97, .05);
  margin-top: auto;
  position: relative;
  z-index: 2;
}
.related-object-selector {
  padding: 13px;
  border: 1px solid #dbe5f4;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfdff 0%, #f6f9ff 100%);
}
.related-object-selector__header { display: grid; gap: 2px; margin-bottom: 10px; }
.related-object-selector__header strong { color: #2a3b59; font-size: .87rem; }
.related-object-selector__header small { color: #71819b; font-size: .75rem; }
.related-object-selector .form-select:disabled { color: #9aa8bd; background-color: #eef3fa; border-color: #dbe4f2; cursor: not-allowed; }
.related-object-selector.has-client [data-related-lead] + * { opacity: .7; }
.calendar-event--task { color: #4a4e9b; background: #efefff; border-left-style: dashed; min-height: 40px; }
.calendar-month-event--task { color: #494e99; background: #efefff; border-left: 2px dashed currentColor; }
.calendar-event--task .calendar-event__title::first-letter { font-weight: 800; }
.related-object-selector.is-invalid { border-color: #dc3545; }
.related-object-selector__status { display: none; margin-top: 8px; color: #6b7c96; font-size: .78rem; }
.related-object-selector.has-client .related-object-selector__status--client,
.related-object-selector.has-lead .related-object-selector__status--lead { display: block; }
@media (max-width: 767.98px) {
  .app-form-modal { width: calc(100vw - 12px); max-width: calc(100vw - 12px); margin: 6px auto; }
  .app-form-modal__content,
  .modal-dialog.app-form-modal .modal-content { max-height: calc(100dvh - 12px); }
  .app-form-modal__content > .modal-header { padding: 16px; }
  .app-form-modal__content > .modal-body,
  .app-form-modal__form > .modal-body {
    padding: 16px;
    max-height: calc(100dvh - 172px);
  }
}
.related-object-selector .form-select[aria-disabled='true'] {
  pointer-events: none;
}


/* Релиз 1.13.2: список дополнительных статей себестоимости. */
.catalog-cost-list { padding: 13px; border: 1px solid #dce6f5; border-radius: 14px; background: #fbfdff; }
.catalog-cost-list__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.catalog-cost-list__rows { display: grid; gap: 8px; }
.catalog-cost-list__row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, .42fr) 38px; gap: 8px; align-items: center; }
.catalog-cost-list__remove { width: 38px; height: 38px; padding: 0; font-size: 1.35rem; line-height: 1; }
@media (max-width: 575.98px) {
  .catalog-cost-list__header { align-items: stretch; flex-direction: column; }
  .catalog-cost-list__header .btn { width: 100%; }
  .catalog-cost-list__row { grid-template-columns: minmax(0, 1fr) 44px; }
  .catalog-cost-list__row > :nth-child(2) { grid-column: 1; }
  .catalog-cost-list__row > :nth-child(3) { grid-column: 2; grid-row: 1 / span 2; align-self: stretch; height: auto; }
}


/* Автоподбор клиента в финансовых операциях. */
.client-autocomplete { position: relative; }
.client-autocomplete__control { position: relative; }
.client-autocomplete__control .form-control { padding-right: 40px; }
.client-autocomplete__clear { position: absolute; top: 50%; right: 8px; width: 28px; height: 28px; padding: 0; transform: translateY(-50%); border: 0; border-radius: 50%; color: #6b778d; background: #edf2fa; font-size: 1.2rem; line-height: 1; }
.client-autocomplete__clear:hover { color: #fff; background: var(--app-primary); }
.client-autocomplete__menu { position: absolute; z-index: 1080; top: calc(100% + 5px); right: 0; left: 0; max-height: 248px; overflow-y: auto; padding: 5px; border: 1px solid #d7e1f0; border-radius: 12px; background: #fff; box-shadow: 0 12px 28px rgba(30, 49, 91, .18); }
.client-autocomplete__option { display: grid; width: 100%; gap: 2px; padding: 9px 10px; border: 0; border-radius: 8px; text-align: left; color: #283852; background: transparent; }
.client-autocomplete__option:hover, .client-autocomplete__option:focus-visible { color: #173d8d; background: #edf3ff; outline: 0; }
.client-autocomplete__option small { color: #74829a; font-size: .76rem; }
.client-autocomplete__empty { padding: 10px; color: #76849b; font-size: .86rem; }

/* Персональная настройка колонок и безопасные файлы клиента. */
.client-columns-trigger { display: inline-flex; align-items: center; gap: 7px; }
.client-columns-trigger svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.client-columns-modal { width: min(680px, calc(100vw - 24px)); max-width: 680px; max-height: calc(100dvh - 24px); margin: 12px auto; }
.client-columns-modal__form { display: flex; flex-direction: column; min-height: 0; max-height: calc(100dvh - 24px); overflow: hidden; }
.client-columns-modal__form .modal-header,
.client-columns-modal__form .modal-footer { flex: 0 0 auto; background: #fff; }
.client-columns-modal__form .modal-body { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.client-columns-modal__form .modal-footer { border-top: 1px solid var(--app-line); box-shadow: 0 -8px 18px rgba(31, 48, 97, .05); }
.client-columns-editor { display: grid; gap: 8px; }
.client-columns-editor__row { display: grid; grid-template-columns: 18px 42px minmax(0, 1fr); align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid #e0e8f5; border-radius: 12px; background: #fbfcff; opacity: .68; transition: border-color .15s ease, background .15s ease, opacity .15s ease, transform .15s ease; }
.client-columns-editor__row.is-visible { opacity: 1; background: #fff; }
.client-columns-editor__row.is-dragging { opacity: .45; transform: scale(.99); }
.client-columns-editor__row.is-drag-target { border-color: var(--app-primary); background: #eef4ff; }
.client-columns-editor__handle { color: #8090aa; font-size: 1.05rem; cursor: grab; line-height: 1; user-select: none; width: 18px; text-align: center; }
.client-columns-editor__row[draggable='false'] .client-columns-editor__handle { visibility: hidden; }
.client-columns-editor__row .form-check { display: flex; align-items: center; min-height: 0; margin: 0; }
.client-columns-editor__row .form-check-input { margin-top: 0; }
.client-columns-editor__name { min-width: 0; display: grid; gap: 2px; }
.client-columns-editor__name strong { color: #253959; font-size: .88rem; }
.client-columns-editor__name small { color: #75849a; font-size: .74rem; }
.knowledge-tabs .nav-link { border-radius: 999px; }
.knowledge-article .card-body { padding: 1.25rem; }
.knowledge-section { height: 100%; padding: 14px 16px; border: 1px solid #e3ebf7; border-radius: 14px; background: #fbfcff; }
.knowledge-section h3 { margin: 0 0 10px; font-size: 1rem; color: #21385a; }
.knowledge-section ul { margin: 0; padding-left: 1.1rem; }
.knowledge-section li + li { margin-top: 6px; }
@media (max-width: 575.98px) { .client-columns-editor__row { grid-template-columns: 18px 42px minmax(0, 1fr); padding: 10px; } .client-columns-modal { width: calc(100vw - 12px); max-width: calc(100vw - 12px); max-height: calc(100dvh - 12px); margin: 6px auto; } .client-columns-modal__form { max-height: calc(100dvh - 12px); } }
.client-file-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.client-file-row__main { min-width: 0; display: grid; gap: 3px; }
.client-file-row__main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-file-row__actions { display: inline-flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
@media (max-width: 575.98px) { .client-file-row { align-items: stretch; flex-direction: column; } .client-file-row__actions { justify-content: flex-start; } }

/* Основные поля клиента всегда отделены от настраиваемых полей. */
.client-form-section + .client-form-section { padding-top: 18px; border-top: 1px solid var(--app-line); }
.client-form-section__title { margin-bottom: 12px; color: #273b5c; font-weight: 700; font-size: .9rem; }


/* Автоматическая подгрузка списка клиентов без кнопки «Загрузить ещё». */
.client-infinite-list__status { min-height: 0; padding: 0; color: var(--app-muted); font-size: .82rem; text-align: center; transition: padding .15s ease; }
.client-infinite-list__status.is-visible { min-height: 30px; padding: 8px 12px; }
.client-infinite-list__status.is-loading::before { content: ''; display: inline-block; width: 12px; height: 12px; margin: 0 7px -1px 0; border: 2px solid #cbd8ef; border-top-color: var(--app-primary); border-radius: 50%; animation: client-list-spin .7s linear infinite; }
.client-infinite-list__status.is-error { color: #a33b3b; }
.client-infinite-list__sentinel { width: 100%; height: 1px; }
@keyframes client-list-spin { to { transform: rotate(360deg); } }

/* Сортировка и массовое редактирование списка клиентов. */
.client-list-table__sortable { padding: 0 !important; white-space: nowrap; }
.client-list-table__sortable > a { display: inline-flex; align-items: center; gap: 6px; width: 100%; min-height: 44px; padding: .5rem; color: inherit; text-decoration: none; }
.client-list-table__sortable > a:hover { color: var(--app-primary); background: #f7f9ff; }
.client-list-table__sortable.is-sorted > a { color: var(--app-primary); background: #f3f7ff; }
.client-list-table__sort-icon { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; color: #8391aa; }
.client-list-table__sort-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; }
.client-list-table__sortable.is-sorted .client-list-table__sort-icon { color: inherit; }
#bulkClientEditModal .modal-content { max-height: calc(100dvh - 24px); }
#bulkClientEditModal .modal-body { overflow-y: auto; }
#bulkClientEditModal [data-client-bulk-value] > .form-control,
#bulkClientEditModal [data-client-bulk-value] > .form-select { min-height: 42px; }
@media (max-width: 575.98px) {
  .client-list-table__sortable > a { min-height: 40px; padding: .45rem; }
  #bulkClientEditModal .modal-content { max-height: calc(100dvh - 12px); }
}

.finance-table-wrap + .card-footer { border-top: 1px solid var(--app-line); }


/* Финансовые фильтры занимают одну рабочую строку на широком экране: поле
   поиска растягивается, а действия остаются справа без пустой колонки. */
.finance-filter-form .finance-filter-field { min-width: 0; }
.finance-filter-form .finance-filter-action { display: flex; align-items: flex-end; }
.finance-filter-form .finance-filter-action .btn { min-height: 40px; white-space: nowrap; }
.finance-filter-form .finance-filter-submit .btn { min-width: 142px; }

/* Финансовые действия используют ту же нейтральную SVG-иконографию, что и остальной интерфейс.
   Текстовые и иконочные кнопки имеют одну высоту, поэтому не «прыгают» в таблице. */
.finance-table-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; vertical-align: middle; }
.finance-table-actions form { display: inline-flex; margin: 0; }
.finance-table-actions .btn,
.finance-icon-button { min-width: 38px; height: 38px; min-height: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
.finance-action-button { padding-inline: .78rem !important; white-space: nowrap; }
.finance-icon-button svg { width: 18px; height: 18px; display: block; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; }
.finance-icon-button--danger svg { stroke-width: 1.75; }

/* Любой диалог остаётся в пределах видимой области. Тело прокручивается отдельно,
   поэтому нижняя панель с кнопками всегда доступна на смартфоне. */
.modal-dialog:not(.modal-fullscreen) { display: flex; flex-direction: column; max-height: calc(100dvh - 24px); }
.modal-dialog:not(.modal-fullscreen) > .modal-content { display: flex; flex: 0 1 auto; flex-direction: column; min-height: 0; max-height: calc(100dvh - 24px); overflow: hidden; }
.modal-dialog:not(.modal-fullscreen) > .modal-content > .modal-header,
.modal-dialog:not(.modal-fullscreen) > .modal-content > .modal-footer { flex: 0 0 auto; background: #fff; }
.modal-dialog:not(.modal-fullscreen) > .modal-content > .modal-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.modal-dialog:not(.modal-fullscreen) > .modal-content > form { display: flex; flex: 0 1 auto; min-height: 0; flex-direction: column; overflow: hidden; }
.modal-dialog:not(.modal-fullscreen) > .modal-content > form > .modal-body { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; }
.modal-dialog:not(.modal-fullscreen) > .modal-content > form > .modal-footer { flex: 0 0 auto; border-top: 1px solid var(--app-line); background: #fff; box-shadow: 0 -8px 18px rgba(31, 48, 97, .05); }

/* Финансовая навигация намеренно компактна и может прокручиваться по горизонтали. */
.finance-tabs { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.finance-tabs::-webkit-scrollbar { display: none; }
.finance-tabs .nav-link { flex: 0 0 auto; border-radius: 999px; }

@media (max-width: 575.98px) {
  .finance-filter-form .finance-filter-action .btn { width: 100%; }
  .finance-filter-form .finance-filter-submit .btn { min-width: 0; }
  .modal-dialog:not(.modal-fullscreen) { width: calc(100vw - 12px); max-width: calc(100vw - 12px); max-height: calc(100dvh - 12px); margin: 6px auto; }
  .modal-dialog:not(.modal-fullscreen) > .modal-content { max-height: calc(100dvh - 12px); }
  .modal-dialog:not(.modal-fullscreen) > .modal-content > .modal-header { padding: 16px; }
  .modal-dialog:not(.modal-fullscreen) > .modal-content > .modal-body,
  .modal-dialog:not(.modal-fullscreen) > .modal-content > form > .modal-body { padding: 16px; }
  .modal-dialog:not(.modal-fullscreen) > .modal-content > .modal-footer,
  .modal-dialog:not(.modal-fullscreen) > .modal-content > form > .modal-footer { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .modal-dialog:not(.modal-fullscreen) > .modal-content > .modal-footer .btn,
  .modal-dialog:not(.modal-fullscreen) > .modal-content > form > .modal-footer .btn { width: 100%; min-width: 0; }
}

/* Быстрые действия клиентов: компактная SVG-кнопка без emoji.
   Меню выносится скриптом в document.body и позиционируется относительно окна.
   Поэтому горизонтальная прокрутка таблицы не обрезает ни один пункт действия. */
.client-row-actions { display: inline-flex; }
.client-row-actions__toggle { width: 34px; height: 31px; padding: 5px; display: inline-flex; align-items: center; justify-content: center; }
.client-row-actions__toggle svg { width: 17px; height: 17px; fill: currentColor; }
.client-row-actions__menu {
  position: fixed;
  z-index: 1090;
  min-width: 224px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  margin: 0;
  overflow-y: auto;
}
.client-row-actions__menu .dropdown-item { white-space: normal; }

/* v1.14.15: direct funnel editing, drag order and compact custom scroll */
.pipeline-tab { cursor: grab; user-select: none; }
.pipeline-tab:active, .kanban-stage-drag-handle:active { cursor: grabbing; }
.pipeline-tab__drag { color: #8a97ab; margin-right: 3px; font-size: .95em; }
.pipeline-tab__budget { display: inline-flex; align-items: center; margin-left: 6px; padding: 2px 8px; border-radius: 8px; color: #35552a; background: rgba(177, 225, 176, .52); font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pipeline-tab.is-active .pipeline-tab__budget { color: #fff; background: rgba(255,255,255,.18); }
.kanban-scroll { overflow: visible; padding: 2px 2px 92px; }
.kanban-viewport { overflow-x: auto; overflow-y: visible; padding: 2px 2px 8px; scrollbar-width: none; -ms-overflow-style: none; }
.kanban-viewport::-webkit-scrollbar { width: 0; height: 0; display: none; }
.kanban-scroll .kanban { overflow: visible; }
.kanban-scroll-control { position: fixed; right: 22px; bottom: 20px; z-index: 1025; display: flex; align-items: center; gap: 10px; width: min(380px, calc(100vw - 28px)); margin: 0; padding: 8px 10px; background: rgba(255,255,255,.97); border: 1px solid #d9e1ef; border-radius: 14px; box-shadow: 0 10px 28px rgba(38,54,81,.14); }
.kanban-scroll-control__button { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid #d3ddee; border-radius: 10px; color: #46556f; background: #f7f9fd; font-size: 1.15rem; line-height: 1; }
.kanban-scroll-control__button:hover { color: var(--app-primary); border-color: #b8c6e7; background: #eef3ff; }
.kanban-scroll-control input[type="range"] { flex: 1 1 auto; min-width: 120px; margin: 0; appearance: none; -webkit-appearance: none; background: transparent; }
.kanban-scroll-control input[type="range"]::-webkit-slider-runnable-track { height: 8px; border-radius: 3px; background: linear-gradient(90deg, #dbe4f4, #cfd9ec); }
.kanban-scroll-control input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -5px; border: 2px solid #fff; border-radius: 5px; background: var(--app-primary); box-shadow: 0 3px 10px rgba(61,101,220,.28); }
.kanban-scroll-control input[type="range"]::-moz-range-track { height: 8px; border-radius: 3px; background: linear-gradient(90deg, #dbe4f4, #cfd9ec); }
.kanban-scroll-control input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border: 2px solid #fff; border-radius: 5px; background: var(--app-primary); box-shadow: 0 3px 10px rgba(61,101,220,.28); }
.kanban-stage-drag-handle { border: 0; padding: 0; color: #8090a8; background: transparent; line-height: 1; cursor: grab; }
.kanban-stage-description { margin: 7px 0 2px 34px; color: #697893; font-size: .76rem; line-height: 1.3; }
.kanban-stage-budget { margin: 4px 0 0 34px; color: #50617b; font-size: .78rem; font-variant-numeric: tabular-nums; }
.kanban-column { position: relative; overflow: hidden; }
.kanban-column::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--stage-accent, var(--app-primary)); border-radius: 14px 14px 0 0; }
.stage-menu-button, .task-card__menu { min-width: 30px; letter-spacing: 1px; }
.task-card__actions { display: inline-flex; }
.task-card__menu-panel { min-width: 252px; }
.task-card__menu-panel { padding: 6px; }
.task-card__menu-panel li { margin: 0; }
.task-card__menu-panel .dropdown-header { padding: 6px 10px 4px; font-size: .82rem; }
.task-card__menu-panel .dropdown-divider { margin: 6px 0; }
.task-card__menu-panel form { margin: 0; }
.task-card__menu-panel .dropdown-item { width: 100%; border: 0; text-align: left; background: transparent; white-space: normal; }
.task-card__menu-panel .dropdown-item.active, .task-card__menu-panel .dropdown-item:active { color: #fff; background: var(--app-primary); border-radius: 10px; font-weight: 600; }
.task-card__menu-panel .dropdown-item.active::after { content: "✓"; float: right; font-weight: 700; }
@media (max-width: 768px) { .kanban-scroll-control { right: 8px; left: 8px; bottom: 12px; width: auto; } .pipeline-tab__budget { display: none; } }


.dashboard-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.dashboard-grid__item { min-width: 0; grid-column: span 4; }
.dashboard-grid__item--sm { grid-column: span 3; }
.dashboard-grid__item--md { grid-column: span 4; }
.dashboard-grid__item--lg { grid-column: span 6; }
.dashboard-grid__item--xl { grid-column: span 12; }
.dashboard-layout-editor { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); gap: 16px; align-items: start; }
.dashboard-layout-editor__title { margin-bottom: 8px; color: #51627b; font-size: .84rem; font-weight: 700; }
.dashboard-layout-editor__canvas, .dashboard-layout-editor__panel { min-height: 220px; padding: 14px; border: 1px solid #d9e1ef; border-radius: 18px; background: linear-gradient(180deg, #fbfdff 0%, #f5f8fd 100%); }
.dashboard-layout-editor__canvas { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; }
.dashboard-layout-editor__panel { display: grid; gap: 10px; }
.dashboard-layout-editor__tile { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid #d9e1ef; border-radius: 16px; background: #fff; box-shadow: 0 6px 16px rgba(38,54,81,.06); cursor: grab; user-select: none; }
.dashboard-layout-editor__tile--sm { grid-column: span 3; }
.dashboard-layout-editor__tile--md { grid-column: span 4; }
.dashboard-layout-editor__tile--lg { grid-column: span 6; }
.dashboard-layout-editor__tile--xl { grid-column: span 12; }
.dashboard-layout-editor__tile--library { grid-column: auto; }
.dashboard-layout-editor__tile.is-dragging { opacity: .5; transform: scale(.98); }
.dashboard-layout-editor__tile.is-drop-target { outline: 2px dashed var(--app-primary); outline-offset: 2px; }
.dashboard-layout-editor__tile-handle { flex: 0 0 auto; color: #7384a2; font-size: 1rem; line-height: 1.1; }
.dashboard-layout-editor__tile-content { min-width: 0; display: grid; gap: 4px; }
.dashboard-layout-editor__tile-content strong { color: #243756; font-size: .9rem; }
.dashboard-layout-editor__tile-content small { color: #72829b; font-size: .76rem; line-height: 1.35; }
@media (max-width: 1199.98px) { .dashboard-grid__item--sm { grid-column: span 4; } .dashboard-grid__item--md { grid-column: span 6; } .dashboard-grid__item--lg { grid-column: span 12; } .dashboard-layout-editor { grid-template-columns: 1fr; } }
@media (max-width: 767.98px) { .dashboard-grid { grid-template-columns: 1fr; } .dashboard-grid__item, .dashboard-grid__item--sm, .dashboard-grid__item--md, .dashboard-grid__item--lg, .dashboard-grid__item--xl { grid-column: span 1; } .dashboard-layout-editor__canvas { grid-template-columns: 1fr; } .dashboard-layout-editor__tile, .dashboard-layout-editor__tile--sm, .dashboard-layout-editor__tile--md, .dashboard-layout-editor__tile--lg, .dashboard-layout-editor__tile--xl { grid-column: span 1; } }

/* v1.14.20 — compact accessible workspace and responsive fallbacks */
:root { --app-muted: #52627a; --app-line-strong: #bac7dc; --app-focus: #234cc7; }
html, body { overflow-x: hidden; }
body { font-size: 15px; }
.text-muted, .form-text, .app-list-meta, .table > :not(caption) > * > * > small { color: #52627a !important; }
.form-label, .table th { color: #34445e; font-weight: 650; }
.btn, .form-control, .form-select, .dropdown-item { min-height: 38px; }
.btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible, .form-check-input:focus-visible, .dropdown-item:focus-visible, a:focus-visible, button:focus-visible, [draggable="true"]:focus-visible { outline: 3px solid var(--app-focus); outline-offset: 2px; box-shadow: none; }
[title], [aria-label] { text-underline-offset: 3px; }
.status-badge { display: inline-flex; align-items: center; gap: 4px; font-weight: 650; }

/* Dashboard grid packs variable-sized widgets instead of retaining rows with gaps. */
.dashboard-grid { grid-auto-flow: row dense; align-items: start; }
.dashboard-grid__item .card { min-width: 0; }
.dashboard-grid__item--sm .metric-card__label { min-height: 2.5rem; }
.dashboard-grid__item--sm .metric-card__value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dashboard-layout-editor--v2 { grid-template-columns: minmax(0, 1.65fr) minmax(300px, .85fr); }
.dashboard-layout-editor__groups { display: grid; gap: 12px; }
.dashboard-layout-editor__group { display: grid; gap: 8px; padding: 10px; border: 1px solid #d8e1ef; border-radius: 14px; background: #fff; }
.dashboard-layout-editor__group h3 { margin: 0; color: #465977; font-size: .84rem; font-weight: 700; }
.dashboard-layout-editor__tile { position: relative; cursor: grab; }
.dashboard-layout-editor__tile-handle { border: 0; padding: 0; background: transparent; cursor: grab; }
.dashboard-layout-editor__tile-handle:focus-visible { border-radius: 6px; }
.dashboard-layout-editor__size { width: 94px; min-height: 32px; margin-left: auto; font-size: .76rem; }
.dashboard-layout-editor__hint { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-left: auto; border: 1px solid #b9c6da; border-radius: 50%; color: #385275; font-size: .75rem; font-weight: 800; }
.dashboard-layout-editor__canvas.is-drop-target, .dashboard-layout-editor__groups.is-drop-target { outline: 2px dashed var(--app-primary); outline-offset: 3px; }
.dashboard-layout-toolbar { display: grid; gap: 8px; }

/* Profile sections have a simple information hierarchy rather than a mixed form. */
.settings-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px; border: 1px solid #d7e0ee; border-radius: 12px; background: #f7f9fd; }
.settings-tabs__item { flex: 0 0 auto; padding: 9px 13px; border-radius: 9px; color: #445775; font-weight: 650; text-decoration: none; }
.settings-tabs__item:hover { color: #1e48bd; background: #eef3ff; }
.settings-tabs__item.is-active { color: #fff; background: var(--app-primary); box-shadow: 0 3px 9px rgba(38,76,199,.2); }
.profile-settings__avatar { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; aspect-ratio: 1 / 1; flex: 0 0 44px; overflow: hidden; border-radius: 50%; color: #1d3f9e; background: #eaf0ff; font-weight: 800; line-height: 1; }

/* Tables keep desktop density, then turn into labelled cards on phones. */
.client-list-table-wrap { max-height: min(70dvh, 760px); overflow: auto; border: 1px solid #e0e7f1; border-radius: 14px; }
.client-list-table thead th { position: sticky; top: 0; z-index: 2; background: #f8faff; box-shadow: 0 1px 0 #d9e2ef; }
.client-list-table__row { cursor: default; }
.client-list-table__row:hover { background: #f5f8ff; }
.client-name-link { display: inline-grid; gap: 2px; color: inherit; text-decoration: none; }
.client-name-link:hover strong { color: var(--app-primary); text-decoration: underline; }
.client-name-link__hint { color: #60718d; font-size: .75rem; }
.client-list-table__actions { min-width: 54px; }
.client-form-card { padding-bottom: 68px; }
.client-form-actions { position: sticky; bottom: 0; z-index: 5; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid #d9e1ef; background: rgba(255,255,255,.96); box-shadow: 0 -8px 20px rgba(31,48,97,.08); }

/* Task status is visible without opening an action menu. */
.task-card__status-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.task-card__status-form { flex: 0 0 auto; }
.task-card__status-select { min-width: 128px; font-weight: 650; }
.status-select--danger { color: #8b1f2d; border-color: #e3adb6; background-color: #fff6f7; }
.status-select--success { color: #24613b; border-color: #9dc9ad; background-color: #f3fbf5; }
.task-card__menu-panel--compact { min-width: 236px; max-height: none; overflow: visible; }

/* Standardised empty state; never render an unexplained empty chart grid. */
.empty-state--chart { min-height: 270px; display: grid; place-content: center; gap: 10px; text-align: center; }
.empty-state--chart h2, .empty-state--chart p { margin: 0; }
.empty-state__icon { margin: 0 auto; color: #5270b7; font-size: 2rem; line-height: 1; }

/* Global confirmation is readable and keyboard-safe. */
#confirmModal .modal-body { color: #34445e; line-height: 1.55; }
#confirmModal .btn-danger { min-width: 132px; }

/* Tablet: compact icon rail, with visible text tooltip from the title attribute. */
@media (min-width: 768px) and (max-width: 991.98px) {
  .app-sidebar { width: 74px; min-width: 74px; padding: 12px 8px; }
  .app-sidebar__brand > span, .app-sidebar .app-nav__label, .app-sidebar .app-nav__caption, .app-sidebar .company-identity__name, .app-sidebar .app-logout > span:last-child { display: none; }
  .app-sidebar__brand { justify-content: center; padding-inline: 0; }
  .app-sidebar .app-nav__link, .app-sidebar .app-logout { justify-content: center; padding-inline: 0; }
  .app-sidebar .app-nav__icon { margin: 0; }
  .app-sidebar__footer { align-items: center; }
  .app-main { width: calc(100% - 74px); padding: 18px; }
  .app-topbar { margin-inline: 0; }
  .app-topbar__context .app-company-pill { display: none; }
  .dashboard-grid__item--sm { grid-column: span 4; }
  .dashboard-grid__item--md { grid-column: span 6; }
  .dashboard-grid__item--lg, .dashboard-grid__item--xl { grid-column: span 12; }
  .client-form-card .col-md-6 { flex: 0 0 50%; max-width: 50%; }
  .kanban-column { min-width: 280px; }
}
@media (max-width: 991.98px) {
  .app-main { min-width: 0; }
  .app-page-header > div:last-child { width: 100%; }
  .app-page-header > div:last-child .btn, .client-list-actions .btn { min-height: 42px; }
  .dashboard-layout-editor--v2 { grid-template-columns: 1fr; }
  .kanban-column { min-width: 280px; }
}
@media (max-width: 767.98px) {
  body { font-size: 14px; }
  .btn, .form-control, .form-select { min-height: 44px; }
  .app-main { padding: 14px 12px 28px; }
  .app-topbar { display: none; }
  .client-list-table-wrap { max-height: none; border: 0; overflow: visible; }
  .client-list-table, .client-list-table tbody, .client-list-table tr, .client-list-table td { display: block; width: 100%; }
  .client-list-table thead { display: none; }
  .client-list-table tr { margin-bottom: 10px; padding: 12px; border: 1px solid #d9e2ef; border-radius: 14px; background: #fff; box-shadow: 0 3px 12px rgba(38,54,81,.04); }
  .client-list-table td { display: grid; grid-template-columns: minmax(96px, .7fr) minmax(0, 1.3fr); gap: 10px; padding: 7px 0; border: 0; text-align: left !important; white-space: normal; }
  .client-list-table td::before { content: attr(data-label); color: #536684; font-size: .78rem; font-weight: 700; }
  .client-list-table__actions { align-items: center; }
  .client-list-table__actions .client-row-actions { justify-self: end; }
  .client-name-link__hint { display: none; }
  .client-form-actions { display: grid !important; grid-template-columns: 1fr; }
  .client-form-actions .btn { width: 100%; }
  .task-card__status-row { align-items: stretch; flex-direction: column; }
  .task-card__status-form, .task-card__status-select { width: 100%; }
  .dashboard-layout-editor__tile { flex-wrap: wrap; }
  .dashboard-layout-editor__tile-content { flex: 1 1 180px; }
  .dashboard-layout-editor__size { width: 100%; margin-left: 0; }
  .settings-tabs { margin-inline: -2px; }
  .modal-dialog:not(.modal-fullscreen) { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; }
  .modal-dialog:not(.modal-fullscreen) > .modal-content { height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; }
}
.member-row--responsive { gap: 14px; }
.member-row__name { color: #253a5a; font-weight: 700; text-decoration: none; }
.member-row__name:hover { color: var(--app-primary); text-decoration: underline; }
@media (max-width: 767.98px) {
  .member-row--responsive { align-items: flex-start; flex-direction: column; }
  .member-row--responsive > .d-flex:last-child { width: 100%; justify-content: space-between !important; }
}

/* v1.14.20: compact client page actions without a second dropdown implementation */
.client-page-actions{position:relative;display:inline-block;margin:0}.client-page-actions>summary{list-style:none;cursor:pointer;min-height:38px;display:inline-flex;align-items:center;gap:.35rem}.client-page-actions>summary::-webkit-details-marker{display:none}.client-page-actions[open]>summary{box-shadow:0 0 0 3px rgba(44,88,204,.18)}.client-page-actions__menu{position:absolute;z-index:1050;right:0;top:calc(100% + .45rem);min-width:230px;margin:0;padding:.45rem 0;background:#fff;border:1px solid var(--bs-border-color);border-radius:.65rem;list-style:none}.client-page-actions__menu .dropdown-item{display:block;width:100%;padding:.5rem 1rem;color:inherit;text-decoration:none;background:transparent;border:0;text-align:left}.client-page-actions__menu .dropdown-item:hover,.client-page-actions__menu .dropdown-item:focus{background:var(--bs-tertiary-bg)}
@media(max-width:575.98px){.client-page-actions__menu{position:fixed;inset:auto .75rem .75rem .75rem;min-width:0;max-height:calc(100dvh - 8rem);overflow:auto}.client-page-actions>summary{min-width:44px;min-height:44px}}

/* Employee profile cards keep the row compact and preserve readable details in a modal. */
.member-row__name{border:0;background:transparent;padding:0;text-align:left;cursor:pointer}.employee-profile-list dt{color:#52627a;font-weight:650}.employee-profile-list dd{margin-bottom:.7rem}

/* v1.14.21: regression hotfixes for the dashboard editor, native controls and floating employee actions. */
.profile-settings { width: min(100%, 1440px); max-width: 1440px !important; }

/* Native checkboxes/switches keep their intended proportions. */
.form-check-input {
  box-sizing: border-box;
  flex: 0 0 auto;
  width: 1em;
  min-width: 1em;
  height: 1em;
  min-height: 1em;
  margin-top: .25em;
}
.form-switch .form-check-input {
  width: 2em;
  min-width: 2em;
  height: 1em;
  min-height: 1em;
}
.role-access-switch .form-check-input {
  width: 2.25em;
  min-width: 2.25em;
  height: 1.2em;
  min-height: 1.2em;
}
.permission-group__checks .form-check-input,
.client-columns-editor__row .form-check-input {
  width: 1.15rem;
  min-width: 1.15rem;
  height: 1.15rem;
  min-height: 1.15rem;
  margin-top: 0;
}
.permission-group__checks .form-check,
.client-columns-editor__row .form-check { min-width: 0; }

/* The preview has the same dense grid and same breakpoints as the saved dashboard. */
.dashboard-layout-editor__canvas {
  grid-auto-flow: row dense;
  align-items: start;
}
.dashboard-layout-editor__tile {
  min-width: 0;
  min-height: 104px;
}
.dashboard-layout-editor__tile-content { flex: 1 1 auto; }
.dashboard-layout-editor__tile--library { min-height: 0; }
.dashboard-layout-editor__panel-wrap { min-width: 0; }
@media (max-width: 1599.98px) {
  .dashboard-layout-editor--v2 { grid-template-columns: 1fr; }
}
@media (max-width: 1199.98px) {
  .dashboard-layout-editor__tile--sm { grid-column: span 4; }
  .dashboard-layout-editor__tile--md { grid-column: span 6; }
  .dashboard-layout-editor__tile--lg,
  .dashboard-layout-editor__tile--xl { grid-column: span 12; }
}
@media (max-width: 767.98px) {
  .dashboard-layout-editor__tile { min-height: 0; }
  .dashboard-layout-editor__tile--sm,
  .dashboard-layout-editor__tile--md,
  .dashboard-layout-editor__tile--lg,
  .dashboard-layout-editor__tile--xl { grid-column: span 1; }
}



/* v1.14.42: dense dashboard grid and visual drag-and-drop widget builder. */
.dashboard-grid,
.dashboard-layout-editor__canvas {
  grid-auto-flow: row dense;
  align-items: start;
}
.dashboard-grid__item {
  align-self: start;
}
.dashboard-grid__item > .card {
  height: auto !important;
}
.dashboard-layout-editor__groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dashboard-layout-editor__group {
  display: grid;
  gap: 8px;
}
.dashboard-layout-editor__group-items {
  display: grid;
  gap: 8px;
}
.dashboard-layout-editor__tile--library-mode {
  grid-column: auto !important;
  min-height: 0;
}
.dashboard-layout-editor__tile--library-mode [data-dashboard-size-picker] {
  display: none !important;
}
.dashboard-layout-editor__canvas .dashboard-layout-editor__tile {
  min-height: 118px;
  align-self: start;
}
.dashboard-layout-editor__section-heading {
  min-height: 46px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.dashboard-layout-editor__section-heading .dashboard-layout-editor__title {
  margin-bottom: 2px;
  color: var(--app-text);
  font-size: .92rem;
}
.dashboard-layout-editor__section-heading small,
.dashboard-layout-editor__section-heading > span {
  color: var(--app-muted);
  font-size: .76rem;
}
.dashboard-layout-editor__section-heading > span {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid var(--app-line);
  border-radius: 999px;
  background: var(--app-surface);
}
.dashboard-layout-editor__canvas {
  position: relative;
  min-height: 280px;
  padding: 14px;
  border-color: color-mix(in srgb, var(--app-primary) 18%, var(--app-line));
  background-color: color-mix(in srgb, var(--app-primary) 2.5%, var(--app-surface));
  background-image: repeating-linear-gradient(90deg, transparent 0, transparent calc(8.333% - 1px), color-mix(in srgb, var(--app-primary) 7%, transparent) calc(8.333% - 1px), color-mix(in srgb, var(--app-primary) 7%, transparent) 8.333%);
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.dashboard-layout-editor__canvas.is-drop-target {
  border-color: var(--app-primary);
  background-color: color-mix(in srgb, var(--app-primary) 7%, var(--app-surface));
  outline: 0;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--app-primary) 13%, transparent);
}
.dashboard-layout-editor__groups {
  max-height: 720px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--app-line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--app-primary) 2.5%, var(--app-surface));
  scrollbar-width: thin;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.dashboard-layout-editor__groups.is-drop-target {
  border-color: var(--app-primary);
  outline: 0;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--app-primary) 13%, transparent);
}
.dashboard-layout-editor__group {
  padding: 0;
  border: 0;
  background: transparent;
}
.dashboard-layout-editor__group + .dashboard-layout-editor__group {
  padding-top: 12px;
  border-top: 1px solid var(--app-line);
}
.dashboard-layout-editor__group h3 {
  color: var(--app-muted);
  font-size: .72rem;
  letter-spacing: .055em;
  text-transform: uppercase;
}
.dashboard-layout-editor__tile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px 10px;
  padding: 11px;
  border-color: var(--app-line);
  border-radius: 14px;
  background: var(--app-surface);
  box-shadow: 0 7px 20px rgba(37, 57, 89, .07);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease, opacity .16s ease;
}
.dashboard-layout-editor__tile:hover {
  border-color: color-mix(in srgb, var(--app-primary) 42%, var(--app-line));
  box-shadow: 0 10px 24px rgba(37, 57, 89, .11);
}
.dashboard-layout-editor__tile.is-dragging {
  opacity: .28;
  transform: scale(.985);
}
.dashboard-layout-editor__tile-handle {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--app-muted);
  background: transparent;
  cursor: grab;
  touch-action: none;
}
.dashboard-layout-editor__tile-handle:hover {
  color: var(--app-primary);
  border-color: color-mix(in srgb, var(--app-primary) 18%, var(--app-line));
  background: var(--app-primary-soft);
}
.dashboard-layout-editor__tile-handle:active { cursor: grabbing; }
.dashboard-layout-editor__tile-content {
  align-self: center;
}
.dashboard-layout-editor__tile-content strong {
  color: var(--app-text);
  line-height: 1.25;
}
.dashboard-layout-editor__tile-content small {
  color: var(--app-muted);
}
.dashboard-layout-editor__tile-controls {
  grid-column: 1 / -1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--app-line);
}
.dashboard-layout-editor [hidden] { display: none !important; }
.dashboard-layout-editor__size-picker {
  min-width: 132px;
  flex: 1 1 150px;
  display: grid;
  grid-template-columns: repeat(4, minmax(30px, 1fr));
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--app-line) 54%, transparent);
}
.dashboard-layout-editor__size-option {
  min-width: 0;
  min-height: 31px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 5px;
  border: 0;
  border-radius: 7px;
  color: var(--app-muted);
  background: transparent;
  font-size: .69rem;
  font-weight: 750;
}
.dashboard-layout-editor__size-option:hover {
  color: var(--app-primary);
  background: color-mix(in srgb, var(--app-surface) 78%, transparent);
}
.dashboard-layout-editor__size-option.is-active {
  color: #fff;
  background: var(--app-primary);
  box-shadow: 0 3px 9px color-mix(in srgb, var(--app-primary) 28%, transparent);
}
.dashboard-layout-editor__size-preview {
  position: relative;
  width: 18px;
  height: 9px;
  overflow: hidden;
  border: 1px solid currentColor;
  border-radius: 2px;
  opacity: .85;
}
.dashboard-layout-editor__size-preview::after {
  content: '';
  position: absolute;
  inset: 1px auto 1px 1px;
  width: calc((var(--widget-columns) * 8.333%) - 2px);
  min-width: 2px;
  border-radius: 1px;
  background: currentColor;
}
.dashboard-layout-editor__order-actions {
  flex: 0 0 auto;
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--app-line);
  border-radius: 9px;
}
.dashboard-layout-editor__order-actions button,
.dashboard-layout-editor__toggle {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  color: var(--app-muted);
  background: transparent;
  line-height: 1;
}
.dashboard-layout-editor__order-actions button + button { border-left: 1px solid var(--app-line); }
.dashboard-layout-editor__order-actions button:hover { color: var(--app-primary); background: var(--app-primary-soft); }
.dashboard-layout-editor__toggle {
  flex: 0 0 30px;
  border: 1px solid var(--app-line);
  border-radius: 9px;
  font-size: 1.15rem;
}
.dashboard-layout-editor__toggle--remove:hover { color: var(--bs-danger); border-color: color-mix(in srgb, var(--bs-danger) 40%, var(--app-line)); background: var(--app-danger-soft); }
.dashboard-layout-editor__toggle--add { color: var(--app-primary); border-color: color-mix(in srgb, var(--app-primary) 35%, var(--app-line)); background: var(--app-primary-soft); }
.dashboard-layout-editor__toggle--add:hover { color: #fff; background: var(--app-primary); }
.dashboard-layout-editor__tile--library-mode {
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 9px;
}
.dashboard-layout-editor__tile--library-mode .dashboard-layout-editor__tile-controls {
  grid-column: 3;
  grid-row: 1;
  align-self: center;
  padding: 0;
  border: 0;
}
.dashboard-layout-editor__tile--library-mode .dashboard-layout-editor__tile-content small {
  display: none;
}
.dashboard-layout-editor__placeholder {
  min-height: 112px;
  border: 2px dashed var(--app-primary);
  border-radius: 14px;
  background: color-mix(in srgb, var(--app-primary) 10%, transparent);
  animation: dashboard-placeholder-pulse .9s ease-in-out infinite alternate;
}
.dashboard-layout-editor__placeholder--sm { grid-column: span 3; }
.dashboard-layout-editor__placeholder--md { grid-column: span 4; }
.dashboard-layout-editor__placeholder--lg { grid-column: span 6; }
.dashboard-layout-editor__placeholder--xl { grid-column: span 12; }
@keyframes dashboard-placeholder-pulse {
  to { background: color-mix(in srgb, var(--app-primary) 17%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .dashboard-layout-editor__placeholder { animation: none; }
  .dashboard-layout-editor__tile { transition: none; }
}
.dashboard-layout-editor__pointer-ghost {
  position: fixed;
  z-index: 1090;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(1deg);
  opacity: .94 !important;
  box-shadow: 0 18px 45px rgba(21, 42, 77, .24);
}
.dashboard-layout-editor__empty {
  grid-column: 1 / -1;
  min-height: 220px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 4px;
  padding: 24px;
  color: var(--app-muted);
  text-align: center;
}
.dashboard-layout-editor__empty[hidden] { display: none; }
.dashboard-layout-editor__empty > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  border-radius: 13px;
  color: var(--app-primary);
  background: var(--app-primary-soft);
  font-size: 1.35rem;
}
.dashboard-layout-editor__counter {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid color-mix(in srgb, var(--app-primary) 20%, var(--app-line));
  border-radius: 999px;
  color: var(--app-primary);
  background: var(--app-primary-soft);
  font-size: .76rem;
  font-weight: 700;
}
.dashboard-layout-editor__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  color: var(--app-muted);
  font-size: .75rem;
}
.dashboard-layout-editor__legend span { display: inline-flex; align-items: center; gap: 5px; }
.dashboard-layout-editor__legend i {
  width: 30px;
  height: 8px;
  display: block;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--app-primary) 28%, var(--app-line));
  border-radius: 2px;
  background: linear-gradient(90deg, var(--app-primary) var(--legend-width), transparent var(--legend-width));
}
.dashboard-layout-editor__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
@media (max-width: 1199.98px) {
  .dashboard-layout-editor__placeholder--sm { grid-column: span 4; }
  .dashboard-layout-editor__placeholder--md { grid-column: span 6; }
  .dashboard-layout-editor__placeholder--lg,
  .dashboard-layout-editor__placeholder--xl { grid-column: span 12; }
  .dashboard-layout-editor__groups { max-height: 520px; }
}
@media (max-width: 767.98px) {
  .dashboard-layout-editor__placeholder--sm,
  .dashboard-layout-editor__placeholder--md,
  .dashboard-layout-editor__placeholder--lg,
  .dashboard-layout-editor__placeholder--xl { grid-column: span 1; }
  .dashboard-layout-editor__canvas { min-height: 220px; padding: 10px; background-image: none; }
  .dashboard-layout-editor__canvas .dashboard-layout-editor__tile { min-height: 0; }
  .dashboard-layout-editor__actions { align-items: stretch; flex-direction: column; }
}

/* v1.14.23: tablet shell, protected owner UI and consistent action triggers. */
@media (min-width: 768px) and (max-width: 991.98px) {
  /* The icon rail and content stay in one horizontal shell on tablets. */
  .app-shell { display: flex; align-items: stretch; }
  .app-sidebar { display: flex !important; flex: 0 0 74px; width: 74px; max-width: 74px; align-self: flex-start; height: 100dvh; min-height: 100dvh; overflow-y: auto; }
  .app-main { flex: 1 1 auto; width: calc(100% - 74px); min-width: 0; }
}

.app-actions-trigger {
  display: inline-flex;
  align-items: center;
  gap: .48rem;
  min-height: 42px;
  padding: .5rem .78rem .5rem .56rem;
  border: 1px solid #c9d5e7;
  border-radius: 11px;
  color: #3d4f6c;
  background: linear-gradient(180deg, #fff 0%, #f7f9fd 100%);
  box-shadow: 0 2px 5px rgba(35, 54, 94, .04);
  font-weight: 680;
  transition: border-color .16s ease, box-shadow .16s ease, color .16s ease, transform .16s ease;
}
.app-actions-trigger:hover,
.app-actions-trigger:focus-visible,
.client-page-actions[open] > .app-actions-trigger,
.dropdown.show > .app-actions-trigger {
  border-color: #92aae8;
  color: #284ebd;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(61, 101, 220, .12), 0 5px 13px rgba(35, 54, 94, .08);
}
.app-actions-trigger:hover { transform: translateY(-1px); }
.app-actions-trigger__icon {
  display: inline-grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 7px;
  color: var(--app-primary);
  background: var(--app-primary-soft);
  font-size: .79rem;
  font-weight: 800;
  letter-spacing: .04em;
  line-height: 1;
}
.client-page-actions > summary.app-actions-trigger { min-height: 42px; list-style: none; }
.client-page-actions > summary.app-actions-trigger::-webkit-details-marker { display: none; }
.client-page-actions[open] > summary.app-actions-trigger { box-shadow: 0 0 0 3px rgba(61, 101, 220, .12), 0 5px 13px rgba(35, 54, 94, .08); }

.owner-badge { vertical-align: middle; }
.role-summary-card__locked {
  display: block;
  width: 100%;
  padding: .56rem .68rem;
  border: 1px solid #d9e2f3;
  border-radius: 10px;
  color: #60718c;
  background: #f7f9fd;
  font-size: .8rem;
  line-height: 1.35;
}

@media (max-width: 575.98px) {
  .app-actions-trigger { width: 100%; justify-content: center; min-height: 44px; }
  .client-page-actions > summary.app-actions-trigger { min-width: 0; }
}


/* v1.14.25: full-height client workspace and canonical funnel responsibility UI. */
@media (min-width: 768px) {
  .client-list-page {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - 100px);
  }
  .client-list-page > .client-infinite-list {
    display: flex;
    flex: 1 1 auto;
    min-height: 300px;
    flex-direction: column;
  }
  .client-list-page .client-list-table-wrap {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
  }
}
.app-actions-trigger {
  padding-right: .66rem;
}


/* v1.14.26: restore a clear pill-style switch appearance. */
.form-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-left: 0;
}
.form-switch .form-check-input {
  margin-left: 0;
  margin-top: 0;
  width: 2.4rem;
  min-width: 2.4rem;
  height: 1.35rem;
  min-height: 1.35rem;
  border-radius: 999px;
  background-color: #d7dfef;
  border-color: #c1cde3;
  background-size: 1rem 1rem;
  background-position: left .12rem center;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .04);
  transition: background-color .18s ease, border-color .18s ease, background-position .18s ease, box-shadow .18s ease;
}
.form-switch .form-check-input:checked {
  background-color: var(--app-primary);
  border-color: var(--app-primary);
  background-position: right .12rem center;
}
.form-switch .form-check-input:focus {
  border-color: color-mix(in srgb, var(--app-primary) 56%, white);
  box-shadow: 0 0 0 .18rem rgba(37, 99, 235, .18);
}
.form-switch .form-check-label {
  margin-bottom: 0;
}
.client-columns-editor__row .form-switch .form-check-input,
.role-access-switch.form-switch .form-check-input {
  width: 2.4rem;
  min-width: 2.4rem;
  height: 1.35rem;
  min-height: 1.35rem;
}


/* v1.14.29: detailed, scannable client history. */
.client-history-entry { padding-block: 1rem; }
.client-history-entry__description { margin-top: .22rem; color: #4d607d; font-size: .9rem; }
.client-history-details { display: grid; gap: .35rem; max-width: 760px; }
.client-history-details .client-history-change { display: grid; grid-template-columns: minmax(150px, .38fr) minmax(0, 1fr); align-items: center; gap: .75rem; padding: .5rem .65rem; border: 1px solid #e0e7f2; border-radius: .55rem; background: #f9fbff; }
.client-history-details .client-history-change > div { min-width: 0; display: flex; align-items: center; gap: .5rem; overflow-wrap: anywhere; }
.client-history-details .client-history-change__old { color: #7a8aa4; text-decoration: line-through; }
@media (max-width: 575.98px) { .client-history-details .client-history-change { grid-template-columns: 1fr; gap: .25rem; } }

/* v1.14.33: one-column client form with an individual drag-and-drop field order. */
.client-form-layout-trigger { display: inline-flex; align-items: center; gap: .42rem; }
.client-form-layout-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #bed0f2;
  border-radius: 14px;
  color: #28436e;
  background: linear-gradient(135deg, #f3f7ff 0%, #fbfcff 100%);
}
.client-form-layout-toolbar > div:first-child { display: grid; gap: 3px; }
.client-form-layout-toolbar span { color: #607491; font-size: .82rem; line-height: 1.4; }
.client-form-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.client-form-field-row {
  display: grid;
  grid-template-columns: minmax(110px, auto) minmax(170px, 28%) minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid #dce5f2;
  border-radius: 14px;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease, opacity .15s ease, transform .15s ease;
}
.client-form-field-row--full { grid-column: 1 / -1; }
.client-form-field-row--half { grid-column: span 1; }
.client-form-field-row:focus-within { border-color: #9cb4ed; box-shadow: 0 0 0 3px rgba(56, 101, 222, .10); }
.client-form-field-row__tools { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.client-form-field-row__handle {
  width: 22px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: #8192ae;
  background: transparent;
  font-size: 1.05rem;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, color .15s ease, background .15s ease;
}
.client-form-fields.is-order-editing .client-form-field-row { cursor: grab; border-style: dashed; }
.client-form-fields.is-order-editing .client-form-field-row__handle { opacity: 1; pointer-events: auto; cursor: grab; }
.client-form-field-row__width { display: none; width: auto; min-width: 132px; font-size: .78rem; }
.client-form-fields.is-order-editing .client-form-field-row__width { display: inline-block; }
.client-form-fields.is-order-editing .client-form-field-row:hover { border-color: #9db4ee; background: #f8faff; }
.client-form-field-row.is-dragging { opacity: .46; transform: scale(.992); }
.client-form-field-row.is-drag-target { border-color: var(--app-primary); background: #edf4ff; box-shadow: 0 0 0 3px rgba(54, 99, 219, .10); }
.client-form-field-row__label { min-width: 0; }
.client-form-field-row__label label { margin: 0; color: #334866; font-size: .9rem; font-weight: 700; line-height: 1.35; }
.client-form-field-row__control { min-width: 0; }
.client-form-field-row__control .form-text { margin-top: 5px; }
.client-form-field-row__control .form-check { min-height: 38px; margin: 0; }
.client-form-field-row__control select[multiple] { min-height: 116px; }
@media (max-width: 767.98px) {
  .client-form-layout-toolbar { align-items: stretch; flex-direction: column; }
  .client-form-layout-toolbar .btn { width: 100%; }
  .client-form-fields { grid-template-columns: 1fr; }
  .client-form-field-row, .client-form-field-row--half, .client-form-field-row--full { grid-column: 1; }
  .client-form-field-row { grid-template-columns: minmax(0, 1fr); align-items: start; gap: 8px; padding: 12px; }
  .client-form-field-row__tools { order: -1; }
  .client-form-field-row__label, .client-form-field-row__control { grid-column: 1; }
  .client-form-field-row__label label { font-size: .86rem; }
}

/* v1.14.34: installment plans and human-readable money entry. */
input[data-money-input] {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.installment-plan-summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: .7rem .85rem;
  border: 1px dashed #c8d5eb;
  border-radius: .8rem;
  color: #536986;
  background: #f8fbff;
}
.installment-plan-summary strong { margin-left: .35rem; color: #233a5b; }
.installment-plan-label { color: #5d6f8a; }


/* v1.14.37: personal two-column client form placement. */
.client-form-field-row--half {
  grid-template-columns: minmax(96px, 24%) minmax(0, 1fr);
}
.client-form-field-row--half .client-form-field-row__tools {
  grid-column: 1 / -1;
}
@media (max-width: 1199.98px) {
  .client-form-field-row--half {
    grid-template-columns: minmax(0, 1fr);
  }
  .client-form-field-row--half .client-form-field-row__label,
  .client-form-field-row--half .client-form-field-row__control,
  .client-form-field-row--half .client-form-field-row__tools {
    grid-column: 1;
  }
}

/* v1.14.38: visual row-based client form layout constructor. */
.client-form-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.client-form-layout-toolbar__legend {
  display: block;
  margin-top: 3px;
  color: #34537f !important;
  font-weight: 600;
}
.client-form-layout-row {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.client-form-layout-row__content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}
.client-form-layout-row--single .client-form-field-row {
  grid-column: 1 / -1;
}
.client-form-layout-row--pair .client-form-field-row {
  grid-column: span 1;
}
.client-form-field-row,
.client-form-field-row--half,
.client-form-field-row--full {
  grid-column: auto;
}
.client-form-field-row {
  display: grid;
  grid-template-columns: 24px minmax(145px, 25%) minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid #dce5f2;
  border-radius: 14px;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease, opacity .15s ease, transform .15s ease;
}
.client-form-layout-row--pair .client-form-field-row {
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
}
.client-form-layout-row--pair .client-form-field-row__label,
.client-form-layout-row--pair .client-form-field-row__control {
  grid-column: 2;
}
.client-form-field-row__tools {
  display: inline-flex;
  justify-content: center;
  min-width: 0;
}
.client-form-field-row__handle {
  width: 24px;
  height: 32px;
}
.client-form-field-row__width { display: none !important; }
.client-form-fields.is-order-editing .client-form-field-row {
  cursor: grab;
  border-style: dashed;
}
.client-form-fields.is-order-editing .client-form-field-row:active { cursor: grabbing; }
.client-form-fields.is-order-editing .client-form-field-row__handle {
  opacity: 1;
  pointer-events: auto;
  cursor: grab;
}
.client-form-field-row.is-dragging {
  opacity: .42;
  transform: scale(.99);
}
.client-form-field-row.is-drag-target,
.client-form-layout-row.is-drop-row-active .client-form-field-row:not(.is-dragging) {
  border-color: #97b4ee;
  background: #f7faff;
}
.client-form-drop-zone {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px dashed #b9c9e8;
  border-radius: 12px;
  color: #416199;
  background: #f7faff;
  font-size: .84rem;
  font-weight: 700;
  transition: border-color .15s ease, background .15s ease, color .15s ease, transform .15s ease;
}
.client-form-fields.is-order-editing .client-form-drop-zone--before,
.client-form-fields.is-order-editing .client-form-drop-zone--after {
  display: flex;
  min-height: 18px;
  color: transparent;
  border-color: transparent;
  background: transparent;
}
.client-form-fields.is-order-editing .client-form-layout-row:hover .client-form-drop-zone--before,
.client-form-fields.is-order-editing .client-form-layout-row:hover .client-form-drop-zone--after,
.client-form-drop-zone.is-drop-zone-active {
  color: #2f55b6 !important;
  border-color: #8da8ef !important;
  background: #eef4ff !important;
}
.client-form-fields.is-order-editing .client-form-layout-row--single .client-form-drop-zone--aside {
  display: flex;
}
.client-form-layout-row--pair .client-form-drop-zone--aside { display: none !important; }
.client-form-drop-zone--aside {
  grid-column: span 1;
  min-height: 76px;
}
.client-form-drop-zone.is-drop-zone-active {
  transform: scale(1.01);
  box-shadow: 0 0 0 3px rgba(54, 99, 219, .10);
}
@media (max-width: 767.98px) {
  .client-form-layout-row__content { grid-template-columns: 1fr; }
  .client-form-layout-row--pair .client-form-field-row,
  .client-form-layout-row--single .client-form-field-row,
  .client-form-drop-zone--aside { grid-column: 1; }
  .client-form-field-row,
  .client-form-layout-row--pair .client-form-field-row {
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: start;
  }
  .client-form-field-row__label,
  .client-form-field-row__control,
  .client-form-layout-row--pair .client-form-field-row__label,
  .client-form-layout-row--pair .client-form-field-row__control {
    grid-column: 2;
  }
}


/* v1.14.39: compact client form visual builder, drop zones only while dragging. */
.client-form-fields.is-order-editing:not(.is-dragging-layout) .client-form-drop-zone {
  display: none !important;
}
.client-form-fields.is-order-editing:not(.is-dragging-layout) .client-form-layout-row {
  gap: 0;
}
.client-form-fields.is-order-editing .client-form-field-row {
  background: #fbfdff;
  border-style: dashed;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .035);
}
.client-form-fields.is-order-editing .client-form-field-row__control {
  pointer-events: none;
  opacity: .72;
}
.client-form-fields.is-order-editing .client-form-field-row__control .form-text {
  display: none;
}
.client-form-fields.is-order-editing .client-form-field-row__label label {
  color: #20395f;
}
.client-form-fields.is-order-editing .client-form-field-row__handle {
  color: #5270a6;
  background: #edf4ff;
  opacity: 1;
}
.client-form-fields.is-order-editing .client-form-field-row:hover .client-form-field-row__handle,
.client-form-field-row.is-dragging .client-form-field-row__handle {
  color: #244bb8;
  background: #dfe9ff;
}
.client-form-fields.is-dragging-layout .client-form-layout-row {
  gap: 6px;
}
.client-form-fields.is-dragging-layout .client-form-drop-zone--before,
.client-form-fields.is-dragging-layout .client-form-drop-zone--after {
  display: flex;
  min-height: 14px;
  color: transparent;
  border-color: transparent;
  background: transparent;
}
.client-form-fields.is-dragging-layout .client-form-layout-row:hover .client-form-drop-zone--before,
.client-form-fields.is-dragging-layout .client-form-layout-row:hover .client-form-drop-zone--after,
.client-form-fields.is-dragging-layout .client-form-drop-zone.is-drop-zone-active {
  min-height: 28px;
  color: #365aa8 !important;
  border-color: #a9bbe4 !important;
  background: #f5f8ff !important;
}
.client-form-fields.is-dragging-layout .client-form-layout-row--single .client-form-drop-zone--aside {
  display: flex;
  min-height: 58px;
  border-color: #cad8ef;
  background: #f9fbff;
  color: #7185a7;
  font-size: .78rem;
}
.client-form-fields.is-dragging-layout .client-form-drop-zone--aside.is-drop-zone-active {
  color: #2f55b6;
  border-color: #8da8ef;
  background: #eef4ff;
}
.client-form-layout-row--pair .client-form-drop-zone--aside,
.client-form-fields:not(.is-dragging-layout) .client-form-drop-zone--aside {
  display: none !important;
}
.client-form-drop-zone {
  min-height: 24px;
  font-weight: 600;
}
.client-form-field-row.is-dragging {
  opacity: .38;
  transform: scale(.985);
  cursor: grabbing;
}
.client-form-field-row.is-drag-target {
  border-color: #7fa0ef;
  background: #eef4ff;
  box-shadow: 0 0 0 3px rgba(54, 99, 219, .12);
}
@media (max-width: 767.98px) {
  .client-form-fields.is-dragging-layout .client-form-layout-row--single .client-form-drop-zone--aside {
    min-height: 40px;
  }
}


/* v1.14.40: reliable drag handle for the client form layout builder. */
.client-form-fields.is-order-editing .client-form-field-row__handle {
  user-select: none;
  touch-action: none;
  -webkit-user-drag: element;
}
.client-form-fields.is-order-editing .client-form-field-row__handle:active,
.client-form-fields.is-order-editing .client-form-field-row__handle.is-handle-dragging {
  cursor: grabbing;
}
.client-form-fields.is-order-editing .client-form-field-row__label,
.client-form-fields.is-order-editing .client-form-field-row__control {
  user-select: none;
}

/* v1.14.41: pointer-based dragging for the client form layout builder. */
.client-form-fields.is-order-editing .client-form-field-row,
.client-form-fields.is-order-editing .client-form-field-row * {
  user-select: none;
}
.client-form-fields.is-order-editing .client-form-field-row__handle {
  touch-action: none;
  cursor: grab;
}
.client-form-fields.is-pointer-dragging,
.client-form-fields.is-pointer-dragging * {
  cursor: grabbing !important;
}
.client-form-field-row--ghost {
  opacity: .92;
  transform: rotate(.35deg) scale(.995);
  box-shadow: 0 18px 42px rgba(15, 23, 42, .18);
  border-color: color-mix(in srgb, var(--app-primary) 52%, #dbe5f5);
  background: #fff;
}
.client-form-field-row--ghost input,
.client-form-field-row--ghost select,
.client-form-field-row--ghost textarea {
  pointer-events: none;
}


/* v1.14.42: the client read-only profile uses the personal form layout, not table columns. */
.client-profile-layout {
  display: grid;
  gap: 12px;
}
.client-profile-row {
  display: grid;
  gap: 12px;
}
.client-profile-row--two {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.client-profile-field {
  min-width: 0;
  border: 1px solid var(--app-line);
  border-radius: 14px;
  background: #fff;
  padding: 12px 14px;
}
.client-profile-field__label {
  font-size: 12px;
  line-height: 1.25;
  color: var(--app-muted);
  font-weight: 700;
  margin-bottom: 6px;
}
.client-profile-field__value {
  color: var(--app-text);
  font-weight: 600;
  overflow-wrap: anywhere;
}
@media (max-width: 767.98px) {
  .client-profile-row--two {
    grid-template-columns: 1fr;
  }
}

/* v1.14.26: список клиентов — закреплённая горизонтальная прокрутка и изменение ширины колонок. */
.client-list-table { min-width: max-content; }
.client-list-table-wrap[data-client-table-scroll] { overflow-x: hidden; overflow-y: auto; scrollbar-gutter: stable; }
.client-list-table__sortable { position: sticky; }
.client-list-table__sortable > a { padding-right: 18px; }
.client-list-table__resize-handle {
  position: absolute;
  top: 0;
  right: -4px;
  bottom: 0;
  width: 9px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: col-resize;
  touch-action: none;
  z-index: 4;
}
.client-list-table__resize-handle::after {
  content: '';
  position: absolute;
  top: 10px;
  right: 4px;
  bottom: 10px;
  width: 1px;
  background: transparent;
}
.client-list-table__resize-handle:hover::after,
.client-list-table__resize-handle:focus-visible::after,
body.is-resizing-client-column .client-list-table__resize-handle::after { background: #9db1d7; }
.client-list-scrollbar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  height: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  margin-top: -1px;
  border: 1px solid #e0e7f1;
  border-top: 0;
  border-radius: 0 0 14px 14px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 -6px 18px rgba(31,48,97,.08);
}
.client-list-scrollbar > div { height: 1px; }
.text-preserve-lines { white-space: pre-line; }
.task-card__relations { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: .6rem; color: #60718d; font-size: .83rem; }
.task-card__relations a { color: inherit; }
@media (max-width: 767.98px) {
  .client-list-scrollbar, .client-list-table__resize-handle { display: none; }
  .client-list-table { min-width: 0; }
}
.client-profile-field__value, .client-history-entry__description { white-space: pre-line; }

/* v2.20: consistent compact priority badges in tasks and task templates. */
.priority-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  width: auto;
  min-width: 0;
  max-width: max-content;
  white-space: nowrap;
  line-height: 1;
  align-self: flex-start;
}

/* v2.20: keep week/day calendar columns aligned with the time axis. */
.calendar-time-layout,
.calendar-days,
.calendar-day,
.calendar-day__header,
.calendar-day__body { box-sizing: border-box; }
.calendar-days { align-items: stretch; }
.calendar-day { display: flex; flex-direction: column; min-width: 0; }
.calendar-day__header {
  height: 52px;
  min-height: 52px;
  flex: 0 0 52px;
}
.calendar-day__body { flex: 0 0 auto; }
.calendar-day__header.is-today strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Keep overlapping week events readable instead of squeezing them into slivers. */
.calendar-days--week .calendar-event--compact-overlap {
  left: 5px;
  width: calc(100% - 9px);
  padding-right: 44px;
}
.calendar-event-overflow {
  position: absolute;
  z-index: 4;
  right: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: #4a4e9b;
  background: #fff;
  box-shadow: 0 2px 5px rgba(35,54,112,.12);
  font-size: .68rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
}
.calendar-event-overflow:hover,
.calendar-event-overflow:focus-visible {
  z-index: 9;
  color: #fff;
  background: #4a4e9b;
}

/* Autocomplete with multiple values for client specialists and tags. */
.multi-autocomplete { position: relative; }
.multi-autocomplete__control { min-height: 42px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 40px 6px 10px; border: 1px solid #d8e1ef; border-radius: 10px; background: #fff; cursor: text; transition: border-color .15s ease, box-shadow .15s ease; }
.multi-autocomplete__control:focus-within { border-color: #8da8ff; box-shadow: 0 0 0 .2rem rgba(63, 102, 241, .14); }
.multi-autocomplete__chips { display: contents; }
.multi-autocomplete__chip { display: inline-flex; align-items: center; max-width: 100%; gap: 6px; padding: 4px 8px; border-radius: 999px; color: #284066; background: #eef3ff; font-size: .86rem; line-height: 1.2; }
.multi-autocomplete__chip button { display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; color: #52657f; background: transparent; line-height: 1; }
.multi-autocomplete__chip button:hover { color: #fff; background: #4f68df; }
.multi-autocomplete__quantity { width: 58px; height: 28px; padding: 2px 5px; border: 1px solid #c8d4ea; border-radius: 7px; color: #223653; background: #fff; text-align: center; }
.multi-autocomplete__quantity:focus { border-color: #7696ee; outline: 0; box-shadow: 0 0 0 .15rem rgba(63, 102, 241, .12); }
.multi-autocomplete__quantity-unit { color: #62728b; font-size: .78rem; }
.multi-autocomplete__input { flex: 1 1 160px; min-width: 130px; border: 0; outline: 0; background: transparent; color: #17213a; }
.multi-autocomplete__input::placeholder { color: #8492aa; }
.multi-autocomplete__clear { position: absolute; top: 21px; right: 9px; width: 28px; height: 28px; padding: 0; transform: translateY(-50%); border: 0; border-radius: 50%; color: #687996; background: #edf2fa; font-size: 1.2rem; line-height: 1; }
.multi-autocomplete__clear:hover { color: #fff; background: var(--app-primary); }
.multi-autocomplete__menu { position: absolute; z-index: 1080; top: calc(100% + 5px); right: 0; left: 0; max-height: 250px; overflow-y: auto; padding: 5px; border: 1px solid #d7e1f0; border-radius: 12px; background: #fff; box-shadow: 0 12px 28px rgba(30, 49, 91, .18); }
.multi-autocomplete__option { display: grid; width: 100%; gap: 2px; padding: 9px 10px; border: 0; border-radius: 8px; text-align: left; color: #283852; background: transparent; }
.multi-autocomplete__option:hover, .multi-autocomplete__option:focus-visible { color: #173d8d; background: #edf3ff; outline: 0; }
.multi-autocomplete__option small { color: #74829a; font-size: .76rem; }
.multi-autocomplete__option--create { color: #1d4ed8; font-weight: 600; }
.multi-autocomplete__empty { padding: 10px; color: #76849b; font-size: .86rem; }

/* v2.3.0: redesigned desktop sidebar with a persistent compact mode. */
@media (min-width: 992px) {
  :root { --app-sidebar: 286px; --app-sidebar-collapsed: 84px; }
  .app-shell { align-items: stretch; }
  .app-sidebar {
    position: relative;
    top: auto;
    align-self: stretch;
    width: var(--app-sidebar);
    flex-basis: var(--app-sidebar);
    min-height: 100vh;
    min-height: 100dvh;
    height: auto;
    max-height: none;
    padding: 24px 18px 18px;
    overflow: visible;
    background:
      radial-gradient(circle at 85% 4%, rgba(63, 143, 255, .22), transparent 27%),
      linear-gradient(165deg, #102b4f 0%, #16375e 48%, #102b4f 100%);
    border-right: 1px solid rgba(133, 190, 255, .14);
    box-shadow: 10px 0 34px rgba(13, 39, 72, .13);
    transition: width .24s ease, flex-basis .24s ease, padding .24s ease;
  }
  .app-sidebar__brand { min-height: 54px; padding: 0 10px 18px; gap: 12px; font-size: 1.22rem; }
  .app-sidebar__brand .app-brand-mark { width: 42px; height: 42px; flex-basis: 42px; }
  .app-sidebar__brand-text { white-space: nowrap; font-weight: 750; }
  .app-sidebar__brand-text em { color: #5aa4ff; font-style: normal; font-weight: 760; }
  .app-sidebar__profile {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 70px;
    margin-bottom: 22px;
    padding: 12px;
    border: 1px solid rgba(145, 194, 255, .10);
    border-radius: 15px;
    color: #fff;
    background: linear-gradient(135deg, rgba(69, 126, 193, .28), rgba(74, 122, 184, .12));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  }
  .app-sidebar__avatar { display: grid; place-items: center; width: 40px; height: 40px; aspect-ratio: 1 / 1; flex: 0 0 40px; overflow: hidden; border-radius: 50%; background: linear-gradient(145deg, #168bff, #326de3); box-shadow: 0 8px 18px rgba(8, 77, 169, .28); font-size: .84rem; font-weight: 800; line-height: 1; }
  .app-sidebar__profile-copy { min-width: 0; display: grid; gap: 3px; }
  .app-sidebar__profile-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .93rem; }
  .app-sidebar__profile-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #aebfda; font-size: .73rem; }
  .app-nav { gap: 6px; }
  .app-nav__caption { color: #8fa9ca; }
  .app-nav__company { margin: 0 5px 12px; padding: 9px 10px; color: #b9cce5; background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.045); border-radius: 12px; }
  .app-nav__link, .app-logout { min-height: 48px; gap: 14px; padding: 11px 13px; border-radius: 12px; color: #d6e3f4; }
  .app-nav__link:hover, .app-logout:hover { background: rgba(91, 158, 234, .13); }
  .app-nav__link.is-active { color: #fff; background: linear-gradient(135deg, #147bdc, #2767bc); box-shadow: 0 8px 22px rgba(4, 72, 155, .27), inset 0 1px 0 rgba(255,255,255,.14); }
  .app-nav__icon { width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; }
  .app-nav__icon-svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .app-nav__label { font-weight: 620; }
  .app-nav__divider { margin: 14px 5px; background: rgba(157, 193, 235, .15); }
  .app-sidebar__footer { display: grid; gap: 5px; margin-top: 8px; padding-top: 18px; }
  .app-sidebar__collapse { display: flex; align-items: center; gap: 13px; width: 100%; min-height: 46px; margin-top: 10px; padding: 9px 12px; border: 0; border-top: 1px solid rgba(157,193,235,.14); color: #c4d5e9; background: transparent; text-align: left; }
  .app-sidebar__collapse:hover { color: #fff; }
  .app-sidebar__collapse-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; background: rgba(94, 148, 216, .16); font-size: 1.25rem; transition: transform .24s ease; }
  .app-sidebar__collapse-label { white-space: nowrap; font-size: .82rem; font-weight: 650; }
  .app-main { flex: 1 1 auto; width: auto; min-width: 0; transition: width .24s ease; }
  .app-shell.is-sidebar-collapsed .app-sidebar { width: var(--app-sidebar-collapsed); flex-basis: var(--app-sidebar-collapsed); padding-inline: 12px; }
  .app-shell.is-sidebar-collapsed .app-sidebar__brand { justify-content: center; padding-inline: 0; }
  .app-shell.is-sidebar-collapsed .app-sidebar__brand-text,
  .app-shell.is-sidebar-collapsed .app-sidebar__profile-copy,
  .app-shell.is-sidebar-collapsed .app-sidebar .app-nav__label,
  .app-shell.is-sidebar-collapsed .app-sidebar .app-nav__caption,
  .app-shell.is-sidebar-collapsed .app-sidebar .company-identity__name,
  .app-shell.is-sidebar-collapsed .app-sidebar__collapse-label { display: none; }
  .app-shell.is-sidebar-collapsed .app-sidebar__profile { justify-content: center; padding-inline: 0; background: transparent; border-color: transparent; }
  .app-shell.is-sidebar-collapsed .app-sidebar__footer { justify-items: center; }
  .app-shell.is-sidebar-collapsed .app-nav__company { display: none; }
  .app-shell.is-sidebar-collapsed .app-nav__link,
  .app-shell.is-sidebar-collapsed .app-logout { justify-content: center; gap: 0; padding-inline: 0; }
  .app-shell.is-sidebar-collapsed .app-sidebar__collapse {
    display: grid;
    place-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
    margin-inline: auto;
    padding-inline: 0;
    text-align: center;
  }
  .app-shell.is-sidebar-collapsed .app-sidebar__collapse-icon { transform: rotate(180deg); }
}

/* Registration and sensitive custom fields */
.auth-register-card { border: 0; }
.registration-consents { padding: 1rem; border: 1px solid #dfe5ef; border-radius: .75rem; background: #f8fafc; }
.registration-consents .form-check-label { line-height: 1.45; }
.registration-code-input { font-size: 1.5rem; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.medical-field-info { display: inline-flex; align-items: center; justify-content: center; width: 1.15rem; height: 1.15rem; margin-left: .35rem; border: 1px solid currentColor; border-radius: 50%; color: #a15c00; font-size: .72rem; font-weight: 700; line-height: 1; cursor: help; vertical-align: .05rem; }
.medical-field-warning { margin-top: .4rem; padding: .55rem .7rem; border-left: 3px solid #e5a000; border-radius: .35rem; background: #fff8e6; color: #6f4b00; font-size: .82rem; }
.client-profile-field--medical { padding: .75rem; border: 1px solid #f0d69a; border-radius: .65rem; background: #fffcf4; }

.profile-settings__avatar img,.member-avatar img,.app-sidebar__avatar img{display:block;width:100%;height:100%;object-fit:cover;border-radius:inherit}.interaction-attachments{display:grid;gap:.45rem}.interaction-attachment{display:flex;gap:.65rem;align-items:center;flex-wrap:wrap;padding:.55rem .7rem;border:1px solid var(--app-line);border-radius:10px;background:var(--app-surface)}
html[data-theme="dark"],html[data-theme="system"] body[data-user-theme="dark"]{color-scheme:dark}
html[data-theme="dark"]{--app-bg:#101521;--app-surface:#18202e;--app-text:#edf2fa;--app-muted:#aab5c7;--app-line:#303a4a;--app-primary-soft:#202d50;--app-danger-soft:#3a2025;--app-shadow:0 10px 28px rgba(0,0,0,.24)}
html[data-theme="dark"] body,html[data-theme="dark"] .app-body{background:var(--app-bg);color:var(--app-text)}html[data-theme="dark"] .card,html[data-theme="dark"] .modal-content,html[data-theme="dark"] .list-group-item,html[data-theme="dark"] .dropdown-menu{background:var(--app-surface);color:var(--app-text);border-color:var(--app-line)}html[data-theme="dark"] .form-control,html[data-theme="dark"] .form-select{background-color:#111925;color:var(--app-text);border-color:#3a4659}html[data-theme="dark"] .text-muted,html[data-theme="dark"] .form-text{color:var(--app-muted)!important}html[data-theme="dark"] .btn-light{background:#273244;color:var(--app-text);border-color:#364257}html[data-theme="dark"] .table{--bs-table-bg:transparent;--bs-table-color:var(--app-text);--bs-table-border-color:var(--app-line)}
@media(prefers-color-scheme:dark){html[data-theme="system"]{--app-bg:#101521;--app-surface:#18202e;--app-text:#edf2fa;--app-muted:#aab5c7;--app-line:#303a4a;--app-primary-soft:#202d50;--app-danger-soft:#3a2025;color-scheme:dark}html[data-theme="system"] body,html[data-theme="system"] .app-body{background:var(--app-bg);color:var(--app-text)}html[data-theme="system"] .card,html[data-theme="system"] .modal-content,html[data-theme="system"] .list-group-item{background:var(--app-surface);color:var(--app-text);border-color:var(--app-line)}html[data-theme="system"] .form-control,html[data-theme="system"] .form-select{background-color:#111925;color:var(--app-text);border-color:#3a4659}}

/* --- v13.2: dark theme cleanup and readability fixes --- */
html[data-theme="dark"] {
    color-scheme: dark;
    --app-surface-2: #172235;
    --app-surface-3: #111b2c;
    --app-border-strong: rgba(255, 255, 255, 0.14);
    --bs-body-color: #e8eef8;
    --bs-secondary-color: #aebbd3;
    --bs-tertiary-color: #8fa0bc;
    --bs-border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] body {
    color: #e8eef8;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .offcanvas,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .accordion-item,
html[data-theme="dark"] .table-responsive,
html[data-theme="dark"] .support-thread,
html[data-theme="dark"] .support-reply-box {
    background-color: var(--app-surface) !important;
    color: #e8eef8;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-footer,
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] .support-thread__header,
html[data-theme="dark"] .support-reply-box__header {
    background-color: var(--app-surface-2) !important;
    color: #f4f8ff;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

html[data-theme="dark"] .table {
    --bs-table-color: #e8eef8;
    --bs-table-bg: transparent;
    --bs-table-border-color: rgba(255, 255, 255, 0.1);
    --bs-table-striped-color: #e8eef8;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
    --bs-table-hover-color: #ffffff;
    --bs-table-hover-bg: rgba(59, 130, 246, 0.08);
    color: #e8eef8;
}

html[data-theme="dark"] .table thead th {
    background: rgba(255, 255, 255, 0.04);
    color: #9eb0ce;
    border-bottom-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .table > :not(caption) > * > * {
    background-color: transparent !important;
    color: inherit;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .table tbody tr:hover td,
html[data-theme="dark"] .table tbody tr:hover th {
    background-color: rgba(59, 130, 246, 0.06) !important;
}

html[data-theme="dark"] .nav-tabs {
    border-bottom-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .nav-tabs .nav-link {
    color: #aebbd3;
    border-color: transparent;
}

html[data-theme="dark"] .nav-tabs .nav-link:hover,
html[data-theme="dark"] .nav-tabs .nav-link:focus {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .nav-tabs .nav-link.active,
html[data-theme="dark"] .nav-tabs .nav-item.show .nav-link {
    color: #ffffff;
    background: var(--app-accent-soft);
    border-color: rgba(59, 130, 246, 0.25);
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .input-group-text,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
    background-color: #0e1727;
    color: #eef4ff;
    border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] select:focus {
    background-color: #0f1a2c;
    color: #ffffff;
    border-color: rgba(59, 130, 246, 0.55);
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.15);
}

html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: #7f93b3;
}

html[data-theme="dark"] .form-text,
html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .text-secondary,
html[data-theme="dark"] .small.text-muted {
    color: #96a7c2 !important;
}

html[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-light,
html[data-theme="dark"] .alert-light {
    background-color: var(--app-surface-2) !important;
    color: #dfe8f7 !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

html[data-theme="dark"] .border,
html[data-theme="dark"] .border-top,
html[data-theme="dark"] .border-bottom,
html[data-theme="dark"] .border-start,
html[data-theme="dark"] .border-end {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

html[data-theme="dark"] .badge.bg-light {
    color: #dfe8f7 !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

html[data-theme="dark"] .badge.text-bg-light {
    color: #dfe8f7 !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

html[data-theme="dark"] .empty-state {
    background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.02));
    border: 1px dashed rgba(255, 255, 255, 0.1);
    color: #b0bed6;
}

html[data-theme="dark"] .empty-state .empty-state__icon {
    color: #7d90ae;
    background: rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .empty-state h6,
html[data-theme="dark"] .empty-state p {
    color: inherit;
}

html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .dashboard-grid .card,
html[data-theme="dark"] .ticket-view,
html[data-theme="dark"] .ticket-list {
    box-shadow: 0 16px 32px rgba(2, 8, 23, 0.35);
}

html[data-theme="dark"] .support-ticket-list__item {
    background: rgba(255, 255, 255, 0.01);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .support-ticket-list__item:hover,
html[data-theme="dark"] .support-ticket-list__item.active {
    background: rgba(59, 130, 246, 0.08);
}

html[data-theme="dark"] .support-ticket-list__meta,
html[data-theme="dark"] .support-thread__meta,
html[data-theme="dark"] .support-message__meta {
    color: #91a4c1;
}

html[data-theme="dark"] .support-message__bubble {
    background: #0f1b2d;
    color: #ecf3ff;
    border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .support-message--staff .support-message__bubble {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.28);
}

html[data-theme="dark"] .support-message__empty {
    color: #7f93b3;
}

html[data-theme="dark"] .support-reply-box textarea {
    min-height: 112px;
}

html[data-theme="dark"] .pagination .page-link {
    background: #0f1a2b;
    color: #dfe8f7;
    border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .pagination .page-link:hover,
html[data-theme="dark"] .pagination .page-link:focus {
    background: rgba(59, 130, 246, 0.12);
    color: #ffffff;
}

html[data-theme="dark"] .pagination .page-item.active .page-link {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: #fff;
}

html[data-theme="dark"] .btn-outline-secondary,
html[data-theme="dark"] .btn-outline-primary {
    border-color: rgba(255, 255, 255, 0.16);
}

html[data-theme="dark"] .btn-outline-secondary:hover,
html[data-theme="dark"] .btn-outline-primary:hover {
    color: #fff;
}

html[data-theme="dark"] .dropdown-item {
    color: #dfe8f7;
}

html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus {
    background: rgba(59, 130, 246, 0.12);
    color: #fff;
}

html[data-theme="dark"] .shadow-sm {
    box-shadow: 0 10px 24px rgba(2, 8, 23, 0.24) !important;
}

/* v1.15.4 — пользовательская Wiki-база знаний. */
.knowledge-wiki { --wiki-sidebar: 248px; --wiki-toc: 218px; max-width: 1540px; margin: 0 auto; }
.knowledge-hero { position: relative; overflow: hidden; margin-bottom: 18px; border: 1px solid #dbe5f5; border-radius: 22px; background: linear-gradient(135deg, #f7faff 0%, #edf3ff 52%, #f8fbff 100%); box-shadow: var(--app-shadow); }
.knowledge-hero::before { content: ''; position: absolute; width: 330px; height: 330px; top: -210px; right: -70px; border-radius: 50%; background: rgba(61, 101, 220, .10); }
.knowledge-hero::after { content: ''; position: absolute; width: 190px; height: 190px; right: 180px; bottom: -145px; border-radius: 50%; background: rgba(71, 176, 170, .09); }
.knowledge-hero__content { position: relative; z-index: 1; padding: 27px 30px 24px; }
.knowledge-eyebrow { margin-bottom: 7px; color: var(--app-primary); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.knowledge-hero__copy { max-width: 850px; }
.knowledge-hero h1 { margin: 0 0 7px; font-size: clamp(1.8rem, 3vw, 2.45rem); }
.knowledge-hero__copy > p { max-width: 780px; margin: 0; color: #58667d; font-size: 1rem; line-height: 1.65; }
.knowledge-hero__support { flex: 0 0 auto; background: rgba(255, 255, 255, .66); backdrop-filter: blur(6px); }
.knowledge-search { max-width: 920px; min-height: 54px; display: flex; align-items: center; gap: 11px; margin-top: 23px; padding: 0 14px; border: 1px solid #cdd9ed; border-radius: 15px; background: #fff; box-shadow: 0 9px 26px rgba(39, 62, 110, .08); transition: border-color .15s ease, box-shadow .15s ease; }
.knowledge-search:focus-within { border-color: #8fa8ee; box-shadow: 0 0 0 .22rem rgba(61, 101, 220, .12), 0 9px 26px rgba(39, 62, 110, .08); }
.knowledge-search__icon { width: 21px; height: 21px; flex: 0 0 21px; color: #72809a; }
.knowledge-search__icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.knowledge-search__input { min-width: 0; flex: 1 1 auto; height: 52px; border: 0; outline: 0; color: var(--app-text); background: transparent; font-size: .95rem; }
.knowledge-search__input::placeholder { color: #96a0b3; }
.knowledge-search__clear { width: 30px; height: 30px; flex: 0 0 30px; border: 0; border-radius: 50%; color: #66738b; background: #f0f3f8; font-size: 1.2rem; line-height: 1; }
.knowledge-search__clear:hover { color: var(--app-text); background: #e5eaf2; }
.knowledge-search-hints { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 12px; color: #77849a; font-size: .78rem; }
.knowledge-search-hints button { border: 0; border-bottom: 1px dashed #aebbd2; padding: 0; color: #4e6288; background: transparent; font: inherit; }
.knowledge-search-hints button:hover { color: var(--app-primary); border-color: currentColor; }

.knowledge-search-results { margin-bottom: 18px; padding: 18px; border: 1px solid var(--app-line); border-radius: 18px; background: var(--app-surface); box-shadow: var(--app-shadow); }
.knowledge-search-results__header { display: flex; justify-content: space-between; align-items: start; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--app-line); }
.knowledge-search-results__header h2 { margin: 0 0 3px; font-size: 1.1rem; }
.knowledge-search-results__header p { margin: 0; color: var(--app-muted); font-size: .82rem; }
.knowledge-search-results__list { display: grid; gap: 8px; padding-top: 12px; }
.knowledge-search-result { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 12px 13px; border: 1px solid transparent; border-radius: 13px; color: inherit; text-decoration: none; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.knowledge-search-result:hover { transform: translateY(-1px); border-color: #cdd9ee; background: #f7f9fd; color: inherit; }
.knowledge-search-result__badge { min-width: 82px; padding: 5px 8px; border-radius: 999px; color: #4862ac; background: #edf2ff; font-size: .68rem; font-weight: 750; text-align: center; }
.knowledge-search-result > div { min-width: 0; }
.knowledge-search-result strong { display: block; margin-bottom: 2px; color: #243653; font-size: .91rem; }
.knowledge-search-result small { display: block; overflow: hidden; color: #62718a; font-size: .76rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.knowledge-search-result p { margin: 5px 0 0; color: #77849a; font-size: .78rem; line-height: 1.45; }
.knowledge-search-result > b { color: #8b9ab3; font-size: 1.35rem; }
.knowledge-search-results__empty { display: grid; justify-items: center; gap: 5px; padding: 30px 15px 20px; color: var(--app-muted); text-align: center; }
.knowledge-search-results__empty strong { color: var(--app-text); }
.knowledge-search-results__empty a { margin-top: 6px; }

.knowledge-mobile-navigation { display: none; margin-bottom: 14px; }
.knowledge-mobile-navigation label { margin-bottom: 6px; color: #5a6880; font-size: .78rem; font-weight: 700; }
.knowledge-layout { display: grid; grid-template-columns: var(--wiki-sidebar) minmax(0, 1fr) var(--wiki-toc); align-items: start; gap: 18px; }
.knowledge-sidebar__inner, .knowledge-toc__inner { position: sticky; top: 18px; }
.knowledge-sidebar__inner { max-height: calc(100vh - 36px); overflow-y: auto; padding: 16px 12px; border: 1px solid var(--app-line); border-radius: 17px; background: var(--app-surface); box-shadow: var(--app-shadow); scrollbar-width: thin; }
.knowledge-sidebar__title, .knowledge-toc__title { padding: 0 8px 11px; color: #33435e; font-size: .82rem; font-weight: 800; }
.knowledge-nav-group + .knowledge-nav-group { margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--app-line); }
.knowledge-nav-group h2 { margin: 0 8px 7px; color: #8995aa; font-size: .66rem; font-weight: 800; letter-spacing: .075em; text-transform: uppercase; }
.knowledge-nav-group nav { display: grid; gap: 2px; }
.knowledge-nav-link { min-height: 38px; display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 9px; color: #52617a; font-size: .8rem; font-weight: 630; text-decoration: none; transition: color .15s ease, background .15s ease; }
.knowledge-nav-link:hover { color: var(--app-primary); background: #f3f6fc; }
.knowledge-nav-link.is-active { color: #274aa7; background: var(--app-primary-soft); font-weight: 750; }
.knowledge-nav-link__index { width: 25px; height: 25px; display: inline-flex; flex: 0 0 25px; align-items: center; justify-content: center; border: 1px solid #dbe3f1; border-radius: 8px; color: #71809a; background: #fff; font-size: .65rem; font-weight: 800; }
.knowledge-nav-link.is-active .knowledge-nav-link__index { border-color: #aebff2; color: var(--app-primary); background: #fff; }

.knowledge-content { min-width: 0; }
.knowledge-article { overflow: hidden; border: 1px solid var(--app-line); border-radius: 20px; background: var(--app-surface); box-shadow: var(--app-shadow); }
.knowledge-article__header { position: relative; padding: 25px 29px 24px; border-bottom: 1px solid var(--app-line); background: linear-gradient(180deg, #fff, #fbfcff); }
.knowledge-breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 17px; color: #8190a7; font-size: .73rem; }
.knowledge-breadcrumbs a { color: #627493; text-decoration: none; }
.knowledge-breadcrumbs a:hover { color: var(--app-primary); }
.knowledge-article__heading { display: flex; align-items: flex-start; gap: 15px; padding-right: 150px; }
.knowledge-article__number { width: 44px; height: 44px; display: inline-flex; flex: 0 0 44px; align-items: center; justify-content: center; border: 1px solid #cbd8f0; border-radius: 13px; color: #4566bd; background: #f0f4ff; font-size: .8rem; font-weight: 850; }
.knowledge-article__heading h2 { margin: 0 0 7px; font-size: clamp(1.4rem, 2.3vw, 1.95rem); }
.knowledge-article__heading p { max-width: 760px; margin: 0; color: #65738a; line-height: 1.6; }
.knowledge-article__meta { display: flex; flex-wrap: wrap; gap: 7px 13px; margin-top: 13px; color: #8794a9; font-size: .71rem; }
.knowledge-article__meta span { position: relative; }
.knowledge-article__meta span + span::before { content: '•'; position: absolute; left: -9px; color: #bdc5d1; }
.knowledge-article__action { position: absolute; top: 56px; right: 28px; }
.knowledge-mobile-toc { display: none; margin: 16px 18px 0; border: 1px solid var(--app-line); border-radius: 12px; background: #fbfcff; }
.knowledge-mobile-toc summary { padding: 12px 14px; cursor: pointer; color: #40516e; font-size: .82rem; font-weight: 750; }
.knowledge-mobile-toc nav { display: grid; gap: 3px; padding: 0 14px 13px; }
.knowledge-mobile-toc a { padding: 5px 0; color: #5e6f8c; font-size: .78rem; text-decoration: none; }
.knowledge-article__body { padding: 8px 29px 12px; }
.wiki-theory { margin: 21px 0 2px; padding: 21px 23px; border: 1px solid #d7e2f5; border-radius: 15px; background: linear-gradient(135deg, #f5f8ff, #fbfdff); }
.wiki-theory__label, .wiki-practice-label { display: block; margin-bottom: 7px; color: #5570bd; font-size: .68rem; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.wiki-theory h3 { margin: 0 0 8px; color: #2d4165; font-size: 1.05rem; }
.wiki-theory p { margin: 0; color: #5f6f88; font-size: .88rem; line-height: 1.72; }
.wiki-practice-label { margin: 0 0 9px 46px; color: #7b88a0; }
.wiki-section { scroll-margin-top: 20px; padding: 27px 0 29px; border-bottom: 1px solid var(--app-line); }
.wiki-section:last-child { border-bottom: 0; }
.wiki-section__heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.wiki-section__heading > span { width: 28px; height: 28px; display: inline-flex; flex: 0 0 28px; align-items: center; justify-content: center; margin-top: 1px; border-radius: 9px; color: #4664b2; background: #eef3ff; font-size: .72rem; font-weight: 850; }
.wiki-section__heading h3 { margin: 0; font-size: 1.15rem; }
.wiki-section__heading p { margin: 6px 0 0; color: #6c7990; font-size: .87rem; line-height: 1.62; }
.wiki-steps { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: wiki-step; }
.wiki-steps li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding: 13px 15px; border: 1px solid #e3e9f2; border-radius: 13px; background: #fbfcfe; }
.wiki-steps__number { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; background: #516fd0; font-size: .72rem; font-weight: 800; box-shadow: 0 4px 10px rgba(61, 101, 220, .18); }
.wiki-steps h4 { margin: 1px 0 4px; color: #2b3d5a; font-size: .88rem; font-weight: 760; }
.wiki-steps p { margin: 0; color: #68758b; font-size: .82rem; line-height: 1.58; }
.wiki-bullets { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.wiki-bullets li { position: relative; padding-left: 25px; color: #596981; font-size: .85rem; line-height: 1.62; }
.wiki-bullets li::before { content: ''; position: absolute; width: 8px; height: 8px; top: .48rem; left: 4px; border: 2px solid #6f8be0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px #eef3ff; }
.wiki-callout { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 11px; margin-top: 17px; padding: 14px 15px; border: 1px solid #cddbef; border-radius: 13px; background: #f5f8ff; }
.wiki-callout__icon { width: 29px; height: 29px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; color: #4866b9; background: #e4ecff; font-size: .78rem; font-weight: 850; }
.wiki-callout strong { display: block; margin-bottom: 3px; color: #334b7b; font-size: .84rem; }
.wiki-callout p { margin: 0; color: #62728d; font-size: .79rem; line-height: 1.55; }
.wiki-callout--warning { border-color: #ecd8a5; background: #fffaf0; }
.wiki-callout--warning .wiki-callout__icon { color: #8b6418; background: #f7e7b9; }
.wiki-callout--warning strong { color: #765718; }
.wiki-callout--success { border-color: #c7e4d4; background: #f3fbf6; }
.wiki-callout--success .wiki-callout__icon { color: #2c7048; background: #dcefe4; }
.wiki-callout--success strong { color: #316747; }

.knowledge-related { margin: 0 29px 25px; padding: 21px; border: 1px solid #dde6f4; border-radius: 16px; background: #f8faff; }
.knowledge-related__heading h3 { margin: 0 0 3px; font-size: 1rem; }
.knowledge-related__heading p { margin: 0 0 13px; color: var(--app-muted); font-size: .78rem; }
.knowledge-related__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.knowledge-related-card { min-width: 0; display: grid; grid-template-columns: 31px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 11px; border: 1px solid #dfe6f2; border-radius: 11px; color: inherit; background: #fff; text-decoration: none; transition: transform .15s ease, border-color .15s ease; }
.knowledge-related-card:hover { transform: translateY(-2px); border-color: #b9c9eb; color: inherit; }
.knowledge-related-card > span { width: 29px; height: 29px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; color: #526ab0; background: #eef3ff; font-size: .65rem; font-weight: 800; }
.knowledge-related-card div { min-width: 0; }
.knowledge-related-card strong { display: block; margin-bottom: 2px; color: #34445e; font-size: .78rem; }
.knowledge-related-card small { display: -webkit-box; overflow: hidden; color: #7a879b; font-size: .68rem; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.knowledge-related-card b { color: #9ba7ba; }
.knowledge-pager { min-height: 88px; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; border-top: 1px solid var(--app-line); background: var(--app-line); }
.knowledge-pager__link { display: grid; align-content: center; gap: 4px; padding: 18px 27px; color: inherit; background: #fbfcff; text-decoration: none; transition: background .15s ease; }
.knowledge-pager__link:hover { color: inherit; background: #f3f6fc; }
.knowledge-pager__link span { color: #8794a8; font-size: .7rem; }
.knowledge-pager__link strong { color: #40506b; font-size: .83rem; }
.knowledge-pager__link--next { text-align: right; }

.knowledge-toc__inner { max-height: calc(100vh - 36px); overflow-y: auto; padding: 16px 0; scrollbar-width: thin; }
.knowledge-toc__title { padding-left: 12px; }
.knowledge-toc nav { display: grid; gap: 1px; border-left: 1px solid #dce3ee; }
.knowledge-toc nav a { padding: 7px 10px 7px 13px; border-left: 2px solid transparent; color: #78859a; font-size: .74rem; line-height: 1.35; text-decoration: none; }
.knowledge-toc nav a:hover { color: #50658b; }
.knowledge-toc nav a.is-active { margin-left: -1px; border-left-color: var(--app-primary); color: var(--app-primary); font-weight: 700; }
.knowledge-help-card { margin-top: 18px; padding: 14px; border: 1px solid #dce4f1; border-radius: 13px; background: #fff; box-shadow: 0 6px 18px rgba(35, 52, 90, .04); }
.knowledge-help-card strong { display: block; margin-bottom: 5px; color: #34445f; font-size: .81rem; }
.knowledge-help-card p { margin: 0 0 9px; color: #7a879b; font-size: .72rem; line-height: 1.5; }
.knowledge-help-card a { font-size: .74rem; font-weight: 700; text-decoration: none; }

@media (max-width: 1260px) {
  .knowledge-wiki { --wiki-sidebar: 230px; }
  .knowledge-layout { grid-template-columns: var(--wiki-sidebar) minmax(0, 1fr); }
  .knowledge-toc { display: none; }
  .knowledge-mobile-toc { display: block; }
}
@media (max-width: 991.98px) {
  .knowledge-layout { display: block; }
  .knowledge-sidebar { display: none; }
  .knowledge-mobile-navigation { display: block; }
  .knowledge-hero__content { padding: 23px 22px 21px; }
  .knowledge-related__grid { grid-template-columns: 1fr; }
}
@media (max-width: 575.98px) {
  .knowledge-hero { border-radius: 16px; }
  .knowledge-hero__content { padding: 20px 16px; }
  .knowledge-hero__copy > p { font-size: .88rem; line-height: 1.55; }
  .knowledge-hero__support { width: 100%; }
  .knowledge-search { min-height: 50px; margin-top: 18px; padding: 0 11px; border-radius: 12px; }
  .knowledge-search__input { height: 48px; font-size: .84rem; }
  .knowledge-search-hints { display: none; }
  .knowledge-search-results { padding: 13px; border-radius: 14px; }
  .knowledge-search-result { grid-template-columns: 1fr auto; gap: 8px; padding: 10px; }
  .knowledge-search-result__badge { display: none; }
  .knowledge-search-result p { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
  .knowledge-article { border-radius: 16px; }
  .knowledge-article__header { padding: 19px 17px 18px; }
  .knowledge-article__heading { gap: 10px; padding-right: 0; }
  .knowledge-article__number { width: 38px; height: 38px; flex-basis: 38px; border-radius: 11px; }
  .knowledge-article__heading p { font-size: .82rem; }
  .knowledge-article__action { position: static; width: 100%; margin-top: 15px; }
  .knowledge-mobile-toc { margin: 13px 13px 0; }
  .knowledge-article__body { padding: 3px 17px 7px; }
  .wiki-section { padding: 23px 0 25px; }
  .wiki-section__heading { gap: 9px; }
  .wiki-section__heading h3 { font-size: 1.02rem; }
  .wiki-steps li { grid-template-columns: 30px minmax(0, 1fr); gap: 9px; padding: 11px; }
  .wiki-steps__number { width: 27px; height: 27px; }
  .knowledge-related { margin: 0 17px 18px; padding: 15px; }
  .knowledge-pager { min-height: 0; grid-template-columns: 1fr; }
  .knowledge-pager__link { padding: 15px 17px; }
  .knowledge-pager__link--next { text-align: left; }
}

/* Wiki article actions stay in normal flow so long translated titles never overlap buttons. */
.knowledge-article__heading { padding-right: 0; }
.knowledge-article__action { position: static; display: inline-flex; margin: 16px 0 0 59px; }
@media (max-width: 575.98px) { .knowledge-article__action { width: 100%; margin-left: 0; } }


.user-listing { display: flex; align-items: center; gap: 12px; min-width: 0; }
.user-listing__body { min-width: 0; }
.user-listing__name { display: block; color: inherit; }

.team-chat-stream { display: grid; gap: 14px; max-height: 460px; overflow: auto; padding: 16px; }
.team-chat-message { display: flex; align-items: flex-start; gap: 12px; }
.team-chat-message__avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; aspect-ratio: 1 / 1; flex: 0 0 36px; overflow: hidden; border-radius: 50%; background: var(--app-primary-soft); color: var(--app-primary); font-size: .85rem; font-weight: 800; line-height: 1; }
.team-chat-message__content { min-width: 0; flex: 1; }
.team-chat-message__meta { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 5px; }
.team-chat-message__meta strong { color: var(--app-text); font-size: .92rem; }
.team-chat-message__meta span { color: var(--app-muted); font-size: .76rem; white-space: nowrap; }
.team-chat-message__bubble { padding: 10px 12px; border: 1px solid var(--app-line); border-radius: 14px; background: #f7f9fc; }
.team-chat-form textarea { min-height: 94px; resize: vertical; }
.team-chat-message__avatar img { display:block; width:100%; height:100%; object-fit:cover; border-radius:inherit; }

@media (max-width: 575.98px) {
  .team-chat-message__meta { flex-direction: column; align-items: flex-start; gap: 2px; }
}


/* Compact action-only top bar after profile/company information moved to sidebar. */
.app-topbar--actions-only { min-height: auto; height: auto; margin-bottom: 12px; justify-content: flex-end; }
.app-topbar--actions-only .app-topbar__actions { position: static; margin-left: auto; }

.interaction-upload__message { min-height: 0; margin-top: 8px; color: #a13d49; font-size: .82rem; }
.interaction-upload__message:empty { display: none; }
.interaction-upload__queue { display: grid; gap: 8px; margin-top: 10px; }
.interaction-upload-item,
.interaction-file { display: flex; align-items: center; gap: 11px; padding: 10px 11px; border: 1px solid var(--app-line); border-radius: 12px; background: var(--app-surface); }
.interaction-upload-item__icon,
.interaction-file__icon { display: inline-grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 10px; font-size: 1rem; font-weight: 800; }
.interaction-upload-item--image .interaction-upload-item__icon,
.interaction-file--image .interaction-file__icon { color: #2866bd; background: #e9f2ff; }
.interaction-upload-item--video .interaction-upload-item__icon,
.interaction-file--video .interaction-file__icon { color: #7b48b7; background: #f1eafe; }
.interaction-upload-item--audio .interaction-upload-item__icon,
.interaction-file--audio .interaction-file__icon { color: #9b6516; background: #fff3dc; }
.interaction-upload-item--document .interaction-upload-item__icon,
.interaction-file--document .interaction-file__icon { color: #3e607c; background: #eaf0f5; }
.interaction-upload-item__body,
.interaction-file__body { min-width: 0; flex: 1; }
.interaction-upload-item__name,
.interaction-file__name { display: block; overflow: hidden; color: var(--app-text); font-weight: 700; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.interaction-file__name:hover { color: var(--app-primary); text-decoration: underline; }
.interaction-upload-item__body small,
.interaction-file__body small { display: block; margin-top: 2px; color: var(--app-muted); font-size: .75rem; }
.interaction-upload-item__remove { flex: 0 0 auto; }
.interaction-file__actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.interaction-file__actions form { margin: 0; }
.interaction-attachments { display: grid; gap: 8px; }

@media (max-width: 767.98px) {
  .app-topbar--actions-only { margin-bottom: 8px; }
  .interaction-file { align-items: flex-start; flex-wrap: wrap; }
  .interaction-file__actions { width: 100%; justify-content: flex-start; padding-left: 49px; }
}


.interaction-layout { align-items: start; }
.interaction-compose-card .card-header,
.interaction-log-card .card-header { align-items: center; }
.interaction-compose-form { display: grid; gap: 14px; }
.interaction-compose-form__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.interaction-upload { padding: 14px; border: 1px dashed #cbd7f2; border-radius: 14px; background: #f8fbff; }
.interaction-upload__picker { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.interaction-upload__trigger { white-space: nowrap; }
.interaction-upload__input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.interaction-upload__message { min-height: 0; margin-top: 10px; color: #a13d49; font-size: .82rem; }
.interaction-upload__message:empty { display: none; }
.interaction-upload__queue { display: grid; gap: 8px; margin-top: 12px; }
.interaction-upload-item,
.interaction-file { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--app-line); border-radius: 14px; background: var(--app-surface); }
.interaction-upload-item__icon,
.interaction-file__icon { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 12px; }
.interaction-file__icon-svg,
.interaction-upload-item__icon-svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.interaction-upload-item--image .interaction-upload-item__icon,
.interaction-file--image .interaction-file__icon { color: #2866bd; background: #e9f2ff; }
.interaction-upload-item--video .interaction-upload-item__icon,
.interaction-file--video .interaction-file__icon { color: #7b48b7; background: #f1eafe; }
.interaction-upload-item--audio .interaction-upload-item__icon,
.interaction-file--audio .interaction-file__icon { color: #9b6516; background: #fff3dc; }
.interaction-upload-item--document .interaction-upload-item__icon,
.interaction-file--document .interaction-file__icon { color: #3e607c; background: #eaf0f5; }
.interaction-upload-item__body,
.interaction-file__body { min-width: 0; display: grid; gap: 3px; }
.interaction-upload-item__name,
.interaction-file__name { display: block; color: var(--app-text); font-weight: 700; text-decoration: none; white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
.interaction-file__name:hover { color: var(--app-primary); text-decoration: underline; }
.interaction-upload-item__body small,
.interaction-file__body small { display: block; color: var(--app-muted); font-size: .75rem; }
.interaction-upload-item__remove { justify-self: end; }
.interaction-file__actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; max-width: 100%; }
.interaction-file__actions form { margin: 0; }
.interaction-attachments { display: grid; gap: 10px; margin-top: 12px; }
.interaction-entry { padding: 16px 18px; display: grid; gap: 12px; }
.interaction-entry__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.interaction-entry__meta { min-width: 0; display: grid; gap: 8px; }
.interaction-entry__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.interaction-entry__chip { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; background: var(--app-primary-soft); color: var(--app-primary); font-size: .76rem; font-weight: 700; }
.interaction-entry__chip--muted { background: #f2f5fa; color: #5f6d86; }
.interaction-entry__date { color: var(--app-muted); font-size: .78rem; }
.interaction-entry__actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.interaction-entry__body { color: var(--app-text); line-height: 1.52; }
.interaction-entry__next-step { display: grid; gap: 3px; padding: 10px 12px; border-radius: 12px; background: #f7f9fc; border: 1px solid var(--app-line); }
.interaction-entry__next-step span { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--app-muted); }
.interaction-entry__next-step strong { color: var(--app-text); }
.interaction-entry__footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--app-muted); font-size: .8rem; }
.interaction-entry__footer a { color: var(--app-primary); text-decoration: none; }
.interaction-entry__footer a:hover { text-decoration: underline; }

@media (max-width: 991.98px) {
  .interaction-compose-form__grid { grid-template-columns: 1fr; }
}

@media (max-width: 767.98px) {
  .interaction-upload-item,
  .interaction-file { grid-template-columns: 40px minmax(0, 1fr); }
  .interaction-upload-item__remove,
  .interaction-file__actions { grid-column: 2; justify-self: start; justify-content: flex-start; }
  .interaction-entry__head,
  .interaction-entry__footer { flex-direction: column; align-items: flex-start; }
  .interaction-entry__actions { justify-content: flex-start; }
}


.interaction-submit-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.interaction-submit-status { min-height: 20px; flex: 1 1 280px; color: var(--app-muted); font-size: .82rem; }
.interaction-submit-spinner { display: none; width: 16px; height: 16px; margin-left: 8px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: interaction-submit-spin .8s linear infinite; }
[data-interaction-submit-button].is-loading { cursor: wait; }
[data-interaction-submit-button].is-loading .interaction-submit-spinner { display: inline-block; }
form[data-interaction-submit-guard][aria-busy="true"] .interaction-upload__trigger,
form[data-interaction-submit-guard][aria-busy="true"] .interaction-upload-item__remove { pointer-events: none; opacity: .55; }
@keyframes interaction-submit-spin { to { transform: rotate(360deg); } }
@media (max-width: 575.98px) { .interaction-submit-row { align-items: stretch; flex-direction: column; } .interaction-submit-row .btn { width: 100%; } }
.client-finance-entry {
  cursor: pointer;
  transition: background-color .15s ease, box-shadow .15s ease;
}

.client-finance-entry:hover,
.client-finance-entry:focus-visible {
  background: var(--bs-tertiary-bg);
  box-shadow: inset 3px 0 0 var(--bs-primary);
  outline: none;
}
