/* Каркас приложения: боковое меню разделов (на телефоне — нижняя панель), задачи, календарь, документы, контрагенты, звонки */

/* ---------- Каркас ---------- */
.shell {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  height: 100vh; height: 100dvh;
}
.sections { position: relative; min-width: 0; min-height: 0; }
.section { height: 100%; min-height: 0; display: flex; flex-direction: column; }
.section > * { flex: 1; min-height: 0; }

.rail {
  display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  padding: 10px 4px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--band); color: var(--band-muted);
  border-right: 1px solid rgba(255, 255, 255, .06);
  overflow-y: auto; scrollbar-width: none;
}
.rail-logo { display: grid; place-items: center; height: 44px; margin-bottom: 10px; color: var(--signal); }
.rail-logo svg { width: 28px; height: 28px; }
.rail-spacer { flex: 1; }
.rail-item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 7px; border: 0; border-radius: var(--radius-m);
  background: transparent; color: inherit; cursor: pointer; text-decoration: none;
  font-size: 10.5px; font-weight: 500; line-height: 1.15;
}
.rail-item:hover { background: rgba(255, 255, 255, .07); color: var(--band-text); }
.rail-item.active { color: var(--band-text); }
.rail-item .ri { display: grid; place-items: center; width: 44px; height: 30px; border-radius: 15px; transition: background .15s; }
.rail-item.active .ri { background: rgba(255, 255, 255, .14); }
.rail-item.active .ri { box-shadow: inset 0 -2px 0 var(--signal); }
.rail-item .ri svg { width: 22px; height: 22px; }
.rail-item .rl { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-item .badge { position: absolute; top: 3px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; }

/* ---------- Шапка раздела, переключатели ---------- */
.sec-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  min-height: 62px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.sec-head h1 { margin: 0; font-size: 20px; line-height: 1.2; }
.sec-head .btn span, .cal-actions .btn span, .docs-toolbar .btn span, .folder-head .btn span { display: inline-flex; }
.head-actions { display: flex; align-items: center; gap: 2px; }
.head-actions .icon-btn { color: var(--ink); }
.head-actions .btn { margin-left: 6px; }

.seg {
  display: flex; gap: 3px; padding: 3px;
  margin: 10px 12px 0;
  background: var(--paper); border-radius: var(--radius-m);
}
.seg button {
  flex: 1; min-width: 0;
  padding: 7px 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted);
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.seg button:hover:not(:disabled) { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.seg button:disabled { cursor: default; }
.seg button:disabled:not(.on) { opacity: .45; }
.seg.small button { padding: 5px 9px; font-size: 13px; }
.seg.scroll { overflow-x: auto; scrollbar-width: none; }
.seg.scroll::-webkit-scrollbar { display: none; }
.seg.scroll button { flex: none; }
.sec-head .seg, .cal-actions .seg, .docs-toolbar .seg { margin: 0; }

/* ---------- Две колонки: список и карточка (задачи, контрагенты) ---------- */
.pane-layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  height: 100%; min-height: 0;
}
.pane-list {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: var(--surface); border-right: 1px solid var(--line);
}
.pane-list > .seg + .seg { margin-top: 6px; }
.pane-list > .list { margin-top: 6px; border-top: 1px solid var(--line); }
.pane-list > .search { margin: 10px 12px 0; }
.pane-detail { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; background: var(--paper); }
.pane-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; height: 100%; padding: 24px; color: var(--muted); }
.pane-empty h2 { color: var(--text); font-size: 19px; margin: 0 0 6px; }
.pane-empty p { margin: 0; max-width: 340px; }

.detail { min-height: 100%; background: var(--surface); max-width: 900px; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.detail-head {
  position: sticky; top: 0; z-index: 3;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px 10px 20px; padding-top: max(10px, env(safe-area-inset-top));
  min-height: 62px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.detail-head .seg { margin: 0; flex: 1; max-width: 520px; }
.detail-head > .icon-btn { color: var(--muted); }
.detail-head > .icon-btn:last-child:not(.back-mobile) { margin-left: auto; }
.detail-head .seg + .icon-btn { margin-left: auto; }
.dh-title { flex: 1; min-width: 0; }
.dh-title h2 { margin: 0; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dh-title .muted-text { font-size: 13px; }
.detail-body { padding: 18px 24px 40px; }
.detail-body > .btn { margin-bottom: 4px; }
.detail-body > .btn span, .comment-form .btn span { display: inline-flex; }
.back-mobile { display: none !important; }

/* ---------- Задачи ---------- */
.task-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 14px; cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.task-row:hover { background: var(--surface-2); }
.task-row.active { background: var(--ink-soft); }
.task-row .body { flex: 1; min-width: 0; }
.task-row .title { display: flex; align-items: center; gap: 6px; font-weight: 600; overflow-wrap: anywhere; }
.task-row.done .title { color: var(--muted); text-decoration: line-through; font-weight: 500; }
.task-row .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 5px; font-size: 13px; color: var(--muted); }
.prio { display: inline-grid; color: var(--danger); flex: none; }
.prio svg { width: 16px; height: 16px; }
.task-check {
  display: grid; place-items: center; flex: none;
  width: 24px; height: 24px; margin-top: 1px; padding: 0;
  border: 2px solid var(--muted); border-radius: 50%;
  background: transparent; color: #fff; cursor: pointer;
}
.task-check:hover:not(:disabled) { border-color: var(--ok); background: var(--ok-soft); }
.task-check.progress { border-color: var(--ink); box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 12px var(--ink-soft-2); }
.task-check.done { background: var(--ok); border-color: var(--ok); }
.task-check svg { width: 15px; height: 15px; }
.task-check:disabled { cursor: default; opacity: .6; }
.person { display: inline-flex; align-items: center; gap: 6px; min-width: 0; color: var(--text); }
.person > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.from { display: inline-flex; align-items: center; gap: 4px; }

.status-seg button.on.s-new { color: var(--ink); }
.status-seg button.on.s-in_progress { color: var(--r-admin); }
.status-seg button.on.s-done { color: var(--ok); background: var(--ok-soft); }
.status-seg button.on.s-cancelled { color: var(--muted); }

.title-input {
  display: block; width: calc(100% + 16px); margin: -6px -8px 14px; padding: 6px 8px;
  border: 0; border-radius: var(--radius-s); resize: none; overflow: hidden;
  background: transparent; font-size: 22px; font-weight: 700; line-height: 1.3;
}
.title-input:hover { background: var(--surface-2); }
.title-input:focus { outline: none; background: var(--surface-2); box-shadow: 0 0 0 2px var(--ink); }
.detail-title { margin: 0 0 14px; font-size: 22px; line-height: 1.3; overflow-wrap: anywhere; }

dl.props { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 20px; align-items: center; margin: 0 0 18px; }
dl.props dt { color: var(--muted); font-size: 14px; }
dl.props dd { margin: 0; min-width: 0; }
dl.props dd a { display: inline-flex; align-items: center; gap: 6px; }
dl.props dd a svg { width: 16px; height: 16px; }
.prop-val { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.prop-val .icon-btn { width: 34px; height: 34px; color: var(--ink); }
.prop-val .icon-btn svg { width: 19px; height: 19px; }
.input.compact, .select.compact { width: auto; max-width: 100%; padding: 6px 10px; }
.check-row.compact { margin: 0; }

.desc { white-space: pre-wrap; overflow-wrap: anywhere; padding: 12px 14px; margin: 0 0 16px; border-radius: var(--radius-m); background: var(--surface-2); font-size: 14.5px; }
.desc-edit { display: grid; gap: 8px; justify-items: start; margin-bottom: 8px; }
.quick-row { display: flex; gap: 6px; flex-wrap: wrap; }

.comments { display: grid; gap: 12px; }
.comment { display: flex; gap: 10px; align-items: flex-start; }
.comment .body { flex: 1; min-width: 0; padding: 8px 12px; border-radius: 4px var(--radius-l) var(--radius-l) var(--radius-l); background: var(--surface-2); }
.c-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.c-head strong { font-size: 14px; }
.c-head span { font-size: 12px; color: var(--muted); }
.c-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; margin-top: 2px; }
.comment-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 14px; }
.comment-form .textarea { flex: 1; min-height: 46px; resize: vertical; }

/* ---------- Календарь ---------- */
.cal { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.cal-nav { display: flex; align-items: center; gap: 2px; }
.cal-nav h1 { min-width: 170px; text-align: center; }
.cal-nav .icon-btn { color: var(--ink); }
.cal-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px 20px; }

.month {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: auto repeat(6, minmax(104px, 1fr));
  gap: 1px; min-height: 100%;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden;
}
.month .wd { padding: 8px 10px; background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.month .wd.we { color: var(--danger); }
.day-cell {
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
  padding: 5px 6px 6px; background: var(--surface); cursor: pointer;
}
.day-cell:hover { background: var(--surface-2); }
.day-cell.we { background: var(--surface-3); }
.day-cell.other .dnum { color: var(--muted); opacity: .6; }
.day-cell .dnum { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 13px; font-weight: 600; flex: none; }
.day-cell.today .dnum { background: var(--btn); color: #fff; }
.day-cell .more { padding-left: 6px; font-size: 12px; color: var(--muted); }
.ev-chip {
  display: flex; align-items: center; gap: 5px; width: 100%; min-width: 0;
  padding: 2px 6px; border: 0; border-radius: 5px;
  background: var(--ink-soft); color: var(--ink);
  font-size: 12.5px; text-align: left; cursor: pointer; line-height: 1.35;
}
.ev-chip:hover { filter: brightness(.96); }
.ev-chip .ev-time { flex: none; font-weight: 600; font-variant-numeric: tabular-nums; }
.ev-chip .ev-title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-chip.allday { background: var(--btn); color: #fff; }
.ev-chip.task { background: var(--warn-soft); color: var(--warn); }
.ev-chip.task.done { opacity: .6; text-decoration: line-through; }
.ev-chip .ev-ico { display: grid; flex: none; }
.ev-chip .ev-ico svg { width: 13px; height: 13px; }
.modal .agenda-items { display: grid; gap: 6px; margin-bottom: 8px; }
.modal .ev-chip { padding: 10px 12px; font-size: 15px; border-radius: var(--radius-m); }
.modal .ev-chip .ev-ico svg { width: 18px; height: 18px; }

.agenda { display: grid; gap: 16px; max-width: 780px; margin: 0 auto; }
.agenda-day { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 14px; }
.agenda-day.past { opacity: .65; }
.agenda-date { padding-top: 8px; }
.agenda-date strong { display: block; font-size: 15px; }
.agenda-date span { font-size: 13px; color: var(--muted); }
.agenda-day.today .agenda-date strong { color: var(--ink); }
.agenda-items { display: grid; gap: 6px; }
.agenda-item {
  display: flex; align-items: flex-start; gap: 12px; width: 100%;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-m);
  background: var(--surface); text-align: left; cursor: pointer; color: inherit;
}
.agenda-item:hover { border-color: var(--ink); }
.agenda-item .a-time { flex: none; min-width: 96px; font-weight: 600; font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; padding-top: 1px; }
.agenda-item .a-time svg { width: 18px; height: 18px; }
.agenda-item.task .a-time { color: var(--warn); }
.agenda-item .a-body { display: flex; flex-direction: column; min-width: 0; }
.agenda-item .a-body strong { overflow-wrap: anywhere; }
.agenda-item .a-meta { font-size: 13px; color: var(--muted); }

.ev-facts { display: grid; gap: 8px; margin-bottom: 14px; font-size: 15px; }
.ev-facts > div { display: flex; align-items: center; gap: 10px; }
.ev-facts > div > span:first-child { display: grid; color: var(--muted); flex: none; }
.ev-facts svg { width: 18px; height: 18px; }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chips-row .btn span { display: inline-flex; }
.person-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 3px 3px 3px 4px; border-radius: 999px;
  background: var(--ink-soft); color: var(--ink); font-size: 13.5px;
}
.person-chip button { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.person-chip button:hover { background: var(--chip-bg-hover); }
.person-chip button svg { width: 14px; height: 14px; }

/* ---------- Документы ---------- */
.docs { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.docs-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px max(16px, calc((100% - 1040px) / 2)) 28px; }
.docs-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.docs-toolbar .input { flex: 1; min-width: 200px; width: auto; padding: 9px 12px; }
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.folder-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-l);
  background: var(--surface); color: inherit; text-align: left; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.folder-card:hover { border-color: var(--ink); box-shadow: var(--shadow); }
.folder-ico { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 4px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); }
.folder-ico svg { width: 26px; height: 26px; }
.folder-card .f-name { font-weight: 600; font-size: 15.5px; overflow-wrap: anywhere; }
.folder-card .f-meta { font-size: 13px; color: var(--muted); }
.folder-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.folder-head > .icon-btn { color: var(--ink); }
.fh-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; flex-wrap: wrap; }
.fh-title h2 { margin: 0; font-size: 20px; overflow-wrap: anywhere; }
.docs .progress { margin-bottom: 12px; }
.folder-files, .chat-files {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden;
}
.folder-files.droppable.over { outline: 3px dashed var(--ink); outline-offset: 3px; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px 10px 14px; border-bottom: 1px solid var(--line); }
.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: var(--surface-2); }
.file-row .f-main { flex: 1; min-width: 0; display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.file-row .f-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row .f-meta { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row .icon-btn { color: var(--muted); }
.file-row .icon-btn:hover { color: var(--ink); }
.file-row .thumb { width: 40px; height: 44px; flex: none; object-fit: cover; border-radius: 6px; background: var(--paper); }

/* ---------- Контрагенты ---------- */
.mini-list { display: grid; gap: 4px; }
.mini-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--radius-m);
  background: var(--surface-2); color: inherit; text-decoration: none;
}
.mini-row:hover { background: var(--chip-bg-hover); }
.mini-row > span:first-child { display: grid; color: var(--muted); }
.mini-row > span:first-child svg { width: 18px; height: 18px; }
.mini-row .mr-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.mini-row .mr-meta { font-size: 13px; color: var(--muted); white-space: nowrap; }
.notes { display: grid; gap: 10px; margin-top: 12px; }
.note { padding: 10px 6px 10px 14px; border-radius: var(--radius-m); background: var(--surface-2); border-left: 3px solid var(--signal); }
.n-head { display: flex; align-items: center; gap: 8px; }
.n-head strong { font-size: 14px; }
.n-head span { flex: 1; font-size: 12.5px; color: var(--muted); }
.n-head .icon-btn { width: 30px; height: 30px; color: var(--muted); }
.n-head .icon-btn svg { width: 16px; height: 16px; }
.n-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; padding-right: 8px; }
.detail-body .member-row .icon-btn { color: var(--muted); }
.detail-body .member-row .icon-btn:hover { color: var(--ink); }

/* ---------- Профиль ---------- */
.profile-avatar { flex: none; }
.push-box { display: grid; gap: 8px; justify-items: start; }
.push-box p { margin: 0; }
.icon-btn.small-x { width: 30px; height: 30px; }
.icon-btn.small-x svg { width: 16px; height: 16px; }

/* ---------- Звонок ---------- */
.call-screen {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 250;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  background: radial-gradient(circle at 50% 30%, #24375f 0%, #0b1222 70%);
  color: #fff; overflow: hidden;
}
.remote-video { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; background: #000; display: none; }
.call-screen.has-video .remote-video { display: block; }
.call-info { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: max(14vh, env(safe-area-inset-top)); padding: 0 20px; text-align: center; }
.call-info .avatar { --c: #fff; box-shadow: 0 0 0 6px rgba(255, 255, 255, .08), 0 0 0 14px rgba(255, 255, 255, .04); }
.call-name { font-size: 26px; font-weight: 600; line-height: 1.2; }
.call-status { font-size: 16px; color: rgba(255, 255, 255, .75); font-variant-numeric: tabular-nums; }
.call-screen.has-video .call-info { margin-top: max(18px, env(safe-area-inset-top)); flex-direction: row; gap: 10px; padding: 6px 14px; border-radius: 999px; background: rgba(0, 0, 0, .45); }
.call-screen.has-video .call-info .avatar { display: none; }
.call-screen.has-video .call-name { font-size: 16px; }
.call-screen.has-video .call-status { font-size: 14px; }
.local-video {
  position: absolute; z-index: 2; right: 16px; top: max(16px, env(safe-area-inset-top));
  width: 120px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px;
  background: #000; box-shadow: 0 4px 18px rgba(0, 0, 0, .45);
  transform: scaleX(-1); display: none;
}
.call-screen.local-on .local-video { display: block; }
.call-controls {
  position: relative; z-index: 1;
  display: flex; justify-content: center; gap: 22px; flex-wrap: wrap;
  width: 100%; padding: 28px 16px calc(36px + env(safe-area-inset-bottom));
}
.call-screen.has-video .call-controls { background: linear-gradient(transparent, rgba(0, 0, 0, .6)); }
.call-btn { display: flex; flex-direction: column; align-items: center; gap: 7px; width: 76px; padding: 0; border: 0; background: transparent; color: #fff; cursor: pointer; }
.call-btn > span { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: rgba(255, 255, 255, .16); transition: transform .1s, background .15s; }
.call-btn:hover > span { background: rgba(255, 255, 255, .26); }
.call-btn:active > span { transform: scale(.94); }
.call-btn svg { width: 28px; height: 28px; }
.call-btn small { font-size: 12.5px; color: rgba(255, 255, 255, .85); line-height: 1.2; text-align: center; }
.call-btn.red > span { background: #e0453a; }
.call-btn.red:hover > span { background: #c9372d; }
.call-btn.green > span { background: #2fb36d; }
.call-btn.green:hover > span { background: #26995c; }
.call-btn.off > span { background: #fff; color: #0b1222; }
@media (min-width: 761px) { .local-video { width: 200px; } }

/* ---------- Телефон: нижняя панель разделов, один экран за раз ---------- */
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .sections { grid-row: 1; }
  .rail {
    grid-row: 2; flex-direction: row; gap: 0;
    padding: 4px 2px; padding-bottom: max(4px, env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line);
    background: var(--surface); color: var(--muted);
    overflow: visible;
  }
  .rail-logo, .rail-spacer, .rail-admin { display: none !important; }
  .rail-item { flex: 1; min-width: 0; padding: 4px 1px 3px; font-size: 10.5px; }
  .rail-item:hover { background: transparent; color: inherit; }
  .rail-item.active { color: var(--ink); }
  .rail-item.active .ri { background: var(--ink-soft); box-shadow: none; }
  .rail-item .ri { width: 52px; height: 28px; }
  .rail-item .badge { right: calc(50% - 26px); top: 1px; }
  body.in-detail .rail, body.in-call .rail { display: none; }

  .pane-layout { grid-template-columns: minmax(0, 1fr); }
  .pane-layout[data-view="list"] .pane-detail { display: none; }
  .pane-layout[data-view="detail"] .pane-list { display: none; }
  .back-mobile { display: inline-grid !important; margin-left: -6px; }
  .detail { border: 0; }
  .detail-head { padding-left: 8px; }
  .detail-head { flex-wrap: wrap; row-gap: 6px; padding-bottom: 8px; }
  .detail-head .seg { order: 5; flex: 1 1 100%; max-width: none; }
  .detail-head .seg button { padding: 6px 4px; font-size: 13px; }
  .detail-body { padding: 16px 16px 32px; }
  dl.props { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  dl.props dt { margin-top: 10px; font-size: 13px; }

  .sec-head { padding-left: 14px; padding-right: 10px; }
  .sec-head h1 { font-size: 19px; }
  .cal-head { gap: 8px; }
  .cal-nav { width: 100%; justify-content: space-between; }
  .cal-nav h1 { min-width: 0; }
  .cal-actions { width: 100%; }
  .cal-actions .seg { flex: 1; }
  .cal-body { padding: 10px 10px 16px; }
  .month { grid-template-rows: auto repeat(6, minmax(64px, 1fr)); }
  .month .wd { padding: 6px 4px; text-align: center; font-size: 11px; }
  .day-cell { padding: 3px 2px; align-items: center; }
  .day-cell .dnum { width: 24px; height: 24px; font-size: 12.5px; }
  .day-cell .ev-chip { padding: 0; height: 6px; width: 6px; border-radius: 50%; font-size: 0; flex: none; }
  .day-cell .ev-chip > * { display: none; }
  .day-cell .more { padding: 0; font-size: 10.5px; }
  .agenda-day { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .agenda-date { padding-top: 0; display: flex; align-items: baseline; gap: 8px; }
  .agenda-item .a-time { min-width: 84px; }

  .docs .sec-head .seg { flex: 1; }
  .docs-body { padding: 12px 10px 24px; }
  .folder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .folder-card { padding: 12px; }
  .file-row { padding-left: 10px; gap: 10px; }
  .file-row .icon-btn { width: 36px; height: 36px; }

  .call-controls { gap: 14px; }
  .call-btn { width: 70px; }
  .call-btn > span { width: 60px; height: 60px; }
  .local-video { width: 96px; }
}
@media (max-width: 380px) {
  .rail-item .rl { font-size: 9.5px; }
  .rail-item .ri { width: 44px; }
}
body.in-call .toast { bottom: auto; top: calc(16px + env(safe-area-inset-top)); }

/* ---------- Контрагенты: участки, кто обслуживает, приглашение ---------- */
.crm-filter { margin: 8px 12px 0; }
.crm-filter .select { width: 100%; }
.area-ico { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.area-ico svg { width: 22px; height: 22px; }
.detail-head .area-ico { width: 34px; height: 34px; }
.detail-head .area-ico svg { width: 18px; height: 18px; }
.section-hint { margin: -4px 0 10px; }
.warn-note { margin: 0 0 10px; padding: 10px 12px; border-radius: var(--radius-m); background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.service-area { margin-bottom: 10px; }
.member-row .name .tag { font-weight: 500; }
.mini-row a.mr-title { color: inherit; text-decoration: none; }
.mini-row a.mr-title:hover { text-decoration: underline; }
.mini-row .icon-btn { width: 30px; height: 30px; color: var(--muted); }
.mini-row .icon-btn svg { width: 16px; height: 16px; }
.invite-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.invite-qr { width: 100%; border-radius: var(--radius-m); border: 1px solid var(--line); background: #fff; image-rendering: pixelated; }
.invite-lead { margin-top: 0; }
.invite-layout .inline-form { margin-bottom: 12px; }
.invite-layout .inline-form .input { font-size: 14px; }
.invite-actions .btn span { display: inline-flex; }
.invite-layout .check-row { margin: 6px 0 4px; }
.invite-layout .btn.ghost span { display: inline-flex; }
@media (max-width: 600px) {
  .invite-layout { grid-template-columns: minmax(0, 1fr); }
  .invite-qr { max-width: 240px; justify-self: center; }
}
