/* Client workspace: compact, accessible controls and isolated resource states. */
[hidden], .sidebar nav a em.nav-auto-count[hidden] { display: none !important; }
.resource-notice { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px 16px; margin:8px 16px 0; border:1px solid var(--border); border-radius:12px; background:var(--surface,#fff); font-size:13px; }
.resource-notice .button { flex-shrink:0; }
.chat-sync-error { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 14px; border-bottom:1px solid var(--line); background:var(--soft); color:var(--muted); font-size:12px; }
.chat-sync-error .button { flex:none; min-height:28px; padding:4px 8px; font-size:11px; }
.workspace-page { min-width:0; }
.workspace-progress { display:block; width:100%; height:7px; border:0; border-radius:999px; overflow:hidden; appearance:none; background:var(--soft); }
.workspace-progress::-webkit-progress-bar { background:var(--soft); border-radius:999px; }
.workspace-progress::-webkit-progress-value { background:linear-gradient(90deg,var(--accent),color-mix(in srgb,var(--accent) 62%,#fff)); border-radius:999px; }
.workspace-progress::-moz-progress-bar { background:linear-gradient(90deg,var(--accent),color-mix(in srgb,var(--accent) 62%,#fff)); border-radius:999px; }
.chat-list-head .chat-filters .segmented { grid-template-columns:max-content minmax(0,1fr); }
.chat-list-head .chat-filters .segmented:last-child { grid-template-columns:repeat(3,minmax(0,1fr)); }
.chat-list-head .chat-filters .segmented button { min-height:30px; padding:5px 4px; font-size:12px; }
.home-plan-strip { grid-column:1/-1; display:flex; align-items:center; gap:16px; padding:12px 18px; }
.home-plan-strip > span { flex:1; color:var(--muted); font-size:13px; }
.first-launch > .kpis, .first-launch > .activity, .first-launch > .attention-list, .first-launch > .onboarding { display:none; }
.first-launch > .onboarding { grid-column:1/-1; }
.home-grid.setup-complete > .onboarding .steps { display:none; }
.home-grid.setup-complete > .onboarding { padding:14px 18px; }
.assistant-switcher { min-width:0; overflow:visible; gap:8px; }
.topbar .assistant-chip, .topbar .assistant-chip.selected, .topbar .assistant-chip.has-alert, .topbar .assistant-chip.selected.has-alert { display:flex; flex-shrink:0; min-width:0; max-width:340px; height:44px; border:1px solid var(--line); border-radius:12px; padding:0; gap:0; box-shadow:none; background:var(--card); }
.topbar .assistant-chip-main { display:flex; align-items:center; gap:8px; min-width:0; width:auto; padding:6px 10px; border:0; background:transparent; box-shadow:none; }
.topbar .assistant-chip-copy { display:flex; flex:none; flex-direction:column; min-width:110px; max-width:190px; }
.topbar .assistant-chip-copy b { font-size:13px; line-height:16px; }
.topbar .assistant-chip-copy small { display:flex; font-size:11px; line-height:14px; }
.topbar .assistant-chip-icon { display:none; }
.topbar .assistant-chip-main-action { display:flex; font-size:11px; gap:4px; }
.topbar .assistant-chip-main-action svg { width:14px; height:14px; }
.topbar .assistant-chip-alert { display:flex; align-items:center; gap:5px; width:auto; padding:6px 9px; min-width:0; font-size:11px; border:0; border-left:1px solid var(--line); border-radius:0 11px 11px 0; box-shadow:none; }
.topbar .assistant-chip-alert span { display:inline; font-size:11px; }
.topbar .assistant-chip-alert b { font-size:12px; }
.editor-save-bar { min-height:56px; padding:10px 16px; gap:12px; }
.editor-save-bar small { display:none; }
.editor-save-bar b { font-size:13px; }
.editor-head-actions > [data-action="save-and-apply-editor"] { display:none; }
.editor-main :disabled { opacity:.65; }
.table-tools select { min-height:36px; width:auto; }
.lead-filter-tools { flex-wrap:wrap; align-items:center; }
.lead-filter-tools select { max-width:200px; }
.lead-overdue-filter { display:inline-flex; align-items:center; gap:6px; white-space:nowrap; font-size:12px; }
.lead-overdue-filter input { width:16px; min-height:16px; height:16px; margin:0; accent-color:var(--accent); }
.table-card { overflow-x:auto; }
.crm-layout > .card, .crm-layout .pipeline, .crm-layout .task-card { min-width:0; }
.crm-layout { align-items:start; }
.crm-layout .pipeline { grid-template-columns:minmax(0,1fr); }
.crm-layout .task-card { margin:0; overflow-wrap:anywhere; }
.crm-layout article.task-card { cursor:default; }
.crm-layout .pipeline .empty-workspace { min-width:0; padding:18px; text-align:left; }
.workspace-page:has(.plan-heading) { max-width:1200px; margin:auto; }
.broadcast-page-center { margin-top:20px; }
.broadcast-page-center .broadcast-history { padding:0; }
.broadcast-page-center .broadcast-assistant-filter { max-width:320px; }
.broadcast-page-center .broadcast-view-filters { display:flex; gap:6px; flex-wrap:wrap; margin:16px 0; }
.broadcast-page-center .broadcast-view-filters .active { background:var(--accent-soft); color:var(--accent); }
.broadcast-steps { display:flex; gap:8px; margin:16px 0; font-size:13px; }
.broadcast-steps { flex-wrap:wrap; }
.broadcast-steps span { padding:6px 10px; border-radius:8px; background:var(--bg); }
.broadcast-steps .active { color:var(--accent); background:var(--accent-soft); }
.analytics-controls { display:flex; flex-wrap:wrap; gap:8px; }
.analytics-controls select { width:auto; min-height:36px; }
.analytics-axis { display:grid; align-items:start; height:24px; margin:2px 0 8px; color:var(--muted); font-size:11px; }
.analytics-axis.hourly { grid-template-columns:repeat(5, minmax(0, 1fr)); }
.analytics-axis.daily { grid-template-columns:repeat(7, minmax(0, 1fr)); }
.analytics-axis span { white-space:nowrap; text-align:center; }
.analytics-axis span:first-child { text-align:left; }
.analytics-axis span:last-child { text-align:right; }
.first-path-compact { grid-column:1/-1; }
.first-path-compact ol { display:grid; grid-template-columns:repeat(4,1fr); gap:16px; padding-left:24px; }
.first-path-compact li { padding:8px; }
.first-path-compact small { display:block; color:var(--muted); margin-top:6px; }
@media(max-width:800px) {
  .topbar .assistant-chip { height:40px; max-width:270px; }
  .topbar .assistant-chip-copy, .topbar .assistant-chip:not(.selected) .assistant-chip-copy { display:flex; min-width:68px; max-width:120px; }
  .topbar .assistant-chip:not(.selected) { width:auto; min-width:100px; padding:0; }
  .home-plan-strip { flex-wrap:wrap; gap:8px; }
  .home-plan-strip > span { flex-basis:100%; }
  .topbar .assistant-chip-copy b { font-size:12px; }
  .topbar .assistant-chip-main-action { display:none; }
  .topbar .assistant-chip-alert { font-size:11px; }
  .editor-save-bar { flex-direction:row; align-items:center; padding:8px 12px; }
  .editor-save-bar .button { width:auto; white-space:nowrap; font-size:12px; }
  .editor-save-bar > div { min-width:0; }
  .resource-notice { margin:6px; padding:8px; }
  .first-path-compact ol { grid-template-columns:1fr 1fr; }
}
@media(max-width:520px) {
  .editor-save-bar { flex-direction:column; align-items:stretch; }
  .editor-save-bar .button { width:100%; min-width:0; white-space:normal; }
}
@media(max-width:760px) {
  .editor-layout .editor-nav { padding-right:8px; }
  .chat-workspace[data-pane=contact]>.contact { visibility:visible; opacity:1; pointer-events:auto; }
  .chat-workspace[data-pane=chat]>.chat { height:100%; overflow:hidden; }
  .person-actions { top:5px; right:5px; }
  .person-more, .person.selected .person-more { width:36px; height:36px; opacity:1; }
  .person-menu { top:38px; }
  .person time { right:46px; }
  .person-main { padding-right:44px; }
  .chat-sync-error { align-items:flex-start; flex-direction:column; gap:4px; }
  .crm-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .crm-kpis .card { min-width:0; padding:12px; }
  .crm-kpis strong { margin-top:5px; font-size:22px; }
  .crm-layout .table-card { overflow:visible; }
  .crm-layout .table-tools { flex-wrap:wrap; }
  .crm-layout .table-tools input { max-width:none; flex:1 1 100%; }
  .crm-layout table, .crm-layout tbody { display:block; width:100%; min-width:0; }
  .crm-layout thead { display:none; }
  .crm-layout tr[data-lead-id] { display:grid; grid-template-columns:1fr; gap:8px; margin:10px; padding:14px; border:1px solid var(--line); border-radius:12px; background:var(--card); cursor:pointer; }
  .crm-layout tr[data-lead-id] td { display:block; min-width:0; padding:0; border:0; overflow-wrap:anywhere; }
  .crm-layout tr[data-lead-id] td:first-child { grid-column:1/-1; font-size:15px; }
  .crm-layout tr[data-lead-id] td:nth-child(2) { grid-column:1/-1; }
  .crm-layout tr[data-lead-id] td:nth-child(3), .crm-layout tr[data-lead-id] td:nth-child(4) { grid-column:1/-1; }
  .crm-layout tr[data-lead-id] td:nth-child(4)::before { content:"Ответственный: "; color:var(--muted); }
  .crm-layout tr[data-lead-id] td:nth-child(5) { grid-column:1/-1; text-align:right; }
}
@media(max-height:700px) {
  .chat-workspace>.chat>.conversation-health { flex-shrink:1; min-height:0; max-height:76px; overflow-y:auto; }
  .chat-workspace>.chat>.composer { min-height:0; max-height:210px; overflow-y:auto; }
}
@media(max-width:760px) and (min-height:551px) and (max-height:700px) {
  .chat-workspace>.chat>.conversation-health { max-height:56px; }
  .chat-workspace>.chat>.composer { max-height:min(300px,48dvh); overflow:visible; }
}
@media(max-height:550px) {
  .chat-workspace>.chat>.messages { min-height:80px; }
  .chat-workspace>.chat>.conversation-health { max-height:56px; }
  .chat-workspace>.chat>.composer { max-height:160px; padding-bottom:28px; }
}
@media(min-width:761px) and (max-width:1350px) {
  .chat-workspace, .chat-workspace.contact-collapsed { position:relative; grid-template-columns:244px minmax(0,1fr); }
  .chat-workspace>.contact { display:none; }
  .chat-info-button, .contact .chat-back { display:inline-grid!important; }
  .contact-toggle { display:none; }
  .contact-collapse { display:inline-grid; }
  .chat-workspace[data-pane=contact]>.chat { display:flex; }
  .chat-workspace[data-pane=contact]>.contact { display:flex; flex-direction:column; visibility:visible; opacity:1; pointer-events:auto; position:absolute; inset:0 0 0 auto; width:min(340px,90%); z-index:10; background:var(--card); box-shadow:-12px 0 35px #0002; overflow:hidden; }
  .contact-head, .contact-tabs { flex:none; }
  .contact-head-buttons { flex:none; }
  .contact-head-buttons .button { flex:none; width:34px; min-height:36px; padding:0; }
  .contact-tabs { position:static; }
  .contact-content { flex:1; min-height:0; overflow-y:auto; }
}
@media(prefers-reduced-motion:reduce) {
  *, *::before, *::after { scroll-behavior:auto !important; animation:none !important; transition:none !important; }
}
.lead-conflict { margin: 12px 0; padding: 14px 16px; border: 1px solid #d9a25b; border-radius: 12px; background: #fff8eb; color: #574024; }
.lead-conflict p { margin: 6px 0; overflow-wrap: anywhere; }
.lead-conflict button { margin-top: 8px; }

@media(max-width:760px) {
  body.mobile-menu-open { overflow:hidden; }
  .editor-layout .switch { width:44px; height:44px; border-radius:12px; background:transparent; }
  .editor-layout .switch::before { content:""; position:absolute; left:1px; top:10px; width:42px; height:24px; border-radius:12px; background:#cbd4da; }
  .editor-layout .switch.on::before { background:var(--accent); }
  .editor-layout .switch::after { top:13px; left:4px; }
  .editor-layout .switch.on::after { left:22px; }
  body #sidebar {
    left:0; width:min(320px,calc(100vw - 56px)); height:100dvh;
    transform:translateX(-100%); visibility:hidden; pointer-events:none;
    padding-top:calc(18px + env(safe-area-inset-top));
    padding-bottom:calc(13px + env(safe-area-inset-bottom));
    transition:transform .18s ease,visibility .18s;
  }
  body #sidebar.open { transform:none; visibility:visible; pointer-events:auto; }
  #sidebar nav { overflow-y:auto; overscroll-behavior:contain; }
  #sidebar nav a { min-height:44px; flex-shrink:0; }
  #sidebar .sidebar-pin { display:none; }
  .modal-close { flex:none; width:44px; height:44px; }
  .modal-head > div, .modal-head h2 { min-width:0; overflow-wrap:anywhere; }
  .mobile-backdrop { position:fixed; inset:0; z-index:29; width:100%; height:100dvh; padding:0; border:0; background:#0b131a99; }
  body.mobile-menu-open .mobile-backdrop { display:block; }
}
