/* Размеры, переносы и управление на телефоне, планшете и большом экране. */
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.nav-toggle { display: none; }
.list-sort { display: none; }
.filter-panel > summary { display: none; }
.filter-count { color: var(--brand); background: var(--ok-bg); padding: 3px 8px; border-radius: 999px; font-size: 12px; }
.filter-count[hidden] { display: none; }
.filter-panel:not([open]) > form { display: none; }
.workspace .container, .card, .fld, .invite-row, .table-wrap, .page-heading > div { min-width: 0; }
.workspace .container { width: auto; margin-right: 0; }
.workspace .sidebar { overflow-y: auto; }
.workspace .mainnav a { min-height: 44px; }
.workspace .breadcrumbs { min-width: 0; overflow-wrap: anywhere; }
.workspace .topbar-inner { min-height: 76px; height: auto; padding-top: 8px; padding-bottom: 8px; }
.workspace .bell summary, .workspace .usermenu summary { min-height: 44px; display: flex; align-items: center; }
.workspace .bell-drop, .workspace .usermenu-drop { max-height: min(480px, 70vh); overflow-y: auto; }
.btn-sm, button.btn, .toggle-on, .toggle-off, .linkbtn { min-height: 42px; line-height: 1.4; white-space: normal; }
.btn-sm { text-align: center; }
.workspace .filters label, .metric-label, .metric-caption, .page-subtitle, .contact-person, .lead-excerpt { font-size: 12px; }
.workspace .filters { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); align-items: end; gap: 16px; }
.workspace .filters .fld { width: auto; min-width: 0; }
.workspace .filters input, .workspace .filters select { min-width: 0; width: 100%; height: 44px; font-size: 14px; }
.workspace .filters .btn-sm { min-height: 44px; width: 100%; }
.workspace table.grid { font-size: 13px; }
.workspace table.grid th { font-size: 11px; }
.workspace table.grid .badge { font-size: 11px; }
.workspace .lead-contact strong { font-size: 13px; }
.workspace .lead-contact { overflow-wrap: anywhere; }
.invite-row { align-items: end; gap: 12px; }
.invite-row .fld { flex: 1 1 200px; min-width: 0; max-width: 100%; }
.invite-row input, .invite-row select { min-width: 0; width: 100%; max-width: 100%; min-height: 44px; }
.invite-row button { flex-shrink: 0; }
select, textarea, input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="file"] { max-width: 100%; }
.report-form .fld select { width: min(100%,360px); min-width: 0; min-height: 44px; }
.report-form input[type="date"] { width: min(100%,240px); min-width: 0; min-height: 44px; }
.report-form textarea, .action-block textarea { min-height: 150px; resize: vertical; }
.report-form input[type="file"] { width: min(100%,480px); min-width: 0; }
.btn-row { flex-wrap: wrap; gap: 10px; }
.kv { grid-template-columns: minmax(100px,160px) minmax(0,1fr); }
.kv dd { min-width: 0; overflow-wrap: anywhere; }
.kv dd.contact a { white-space: normal; overflow-wrap: anywhere; }
.copy-btn { min-width: 36px; min-height: 36px; }
.msg-body, .msg-author, .attachment, .tag, .flash { overflow-wrap: anywhere; }
.attachments { max-width: 100%; }
.attachment { max-width: 100%; white-space: normal; }
.msg-head { flex-wrap: wrap; gap: 6px 12px; }
.card pre { max-width: 100%; }
.quick-dates { flex-wrap: wrap; gap: 8px; }
.chip { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; white-space: normal; }
.summary { display: grid; grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); gap: 22px; }
.summary .stat { min-width: 0; }
.summary .stat .num { font-size: 28px; overflow-wrap: anywhere; }
.pie-wrap { flex-wrap: wrap; min-width: 0; }
.pie-wrap svg { flex-shrink: 0; max-width: 100%; }
.bars { overflow-x: auto; max-width: 100%; }
.bar-col { min-width: 42px; }
.pager { flex-wrap: wrap; gap: 10px; }
.pager a, .pager .current { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
#list-results { scroll-margin-top: 20px; }
#list-results[aria-busy="true"] { cursor: progress; }
.auth-wrap { min-height: 100vh; min-height: 100svh; }
.auth-card { min-width: 0; }
@media (min-width: 1600px) {
  .workspace .container { max-width: 1500px; margin-right: auto; margin-left: calc(var(--sidebar-width) + max(0px,(100vw - var(--sidebar-width) - 1500px) / 2)); }
}
@media (min-width: 1280px) {
  .workspace .filters { grid-template-columns: minmax(200px,1.8fr) repeat(3,minmax(120px,1fr)); }
}
@media (min-width: 1101px) {
  .workspace .filter-panel .filters { grid-template-columns: repeat(6,minmax(0,1fr)); }
  .workspace .filter-panel .filters .fld:has(input[name="search"]),
  .workspace .filter-panel .filters .fld:has(select[name="site_id"]),
  .workspace .filter-panel .filters .fld:has(select[name="tag"]) { grid-column: span 2; }
}
@media (max-width: 1100px) {
  .workspace .mainnav a { padding-left: 12px; padding-right: 12px; }
  .workspace .filters { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .list-sort { display: flex; align-items: center; margin: 0; min-width: 0; }
  .list-sort select { min-height: 44px; min-width: 0; max-width: 100%; font-size: 14px; }
  .workspace .filters-card { padding: 0; }
  .filter-panel > summary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 16px 18px; min-height: 56px; list-style: none; cursor: pointer; font-size: 14px; font-weight: 500; }
  .filter-panel > summary::-webkit-details-marker { display: none; }
  .filter-panel > summary::after { content: '+'; font-size: 24px; font-weight: 400; margin-left: auto; }
  .filter-panel[open] > summary::after { content: '−'; }
  .filter-panel > form { padding: 0 18px 18px; }
  /* На планшете семь колонок списка заменяются карточками, а не микротекстом. */
  #list-results table.grid, #list-results table.grid tbody, #list-results table.grid tr, #list-results table.grid td { display: block; width: 100%; }
  #list-results table.grid thead { display: none; }
  #list-results table.grid tbody { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
  #list-results > .card { background: transparent; border: 0; overflow: visible; box-shadow: none; }
  #list-results .table-wrap { background: transparent; border: 0; overflow: visible; }
  #list-results table.grid tr { margin: 0; padding: 16px; border: 1px solid var(--border); border-radius: 18px; background: var(--card); }
  #list-results table.grid td { position: static; max-width: 100%; padding: 6px 0; border: 0; text-align: left; min-height: 0; overflow-wrap: anywhere; }
  #list-results table.grid td[data-label]::before { content: attr(data-label); position: static; display: block; width: auto; margin-bottom: 3px; color: var(--muted); font-size: 10px; line-height: 1.4; text-transform: uppercase; letter-spacing: .4px; }
  #list-results table.grid tr.done { border-left: 3px solid #72a486; }
  #list-results table.grid tr.overdue { border-left: 3px solid #d49370; }
  #list-results table.grid td:first-child { box-shadow: none; }
  #list-results .lead-contact { min-width: 0; }
  #list-results .pager { background: var(--card); margin-top: 16px; border: 1px solid var(--border); border-radius: 16px; }
}
@media (max-width: 900px) {
  :root { --sidebar-width: 0px; }
  .workspace .sidebar { position: relative; width: 100%; padding: 16px 20px; border-right: 0; border-bottom: 1px solid var(--border); overflow: visible; }
  .sidebar-label, .sidebar-bottom { display: none; }
  .workspace-brand { padding: 0; }
  .ui-ready .nav-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 13px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
  .workspace .mainnav { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); margin: 14px 0 0; padding: 0; overflow: visible; gap: 8px; }
  .ui-ready .workspace .mainnav { display: none; }
  .ui-ready .workspace .sidebar.is-open .mainnav { display: grid; }
  .workspace .mainnav a { font-size: 14px; min-width: 0; white-space: normal; }
  .workspace .mainnav .nav-badge { flex-shrink: 0; }
  .workspace .container { margin-left: 0; padding: 22px 20px 40px; }
  .workspace .topbar { margin-left: 0; }
  .workspace .topbar-inner { min-height: 64px; height: auto; position: relative; flex-wrap: nowrap; padding: 8px 20px; gap: 12px; }
  .workspace .usermenu summary .uname { display: none; }
  .workspace .bell, .workspace .usermenu { position: static; }
  .workspace .bell-drop, .workspace .usermenu-drop { left: 12px; right: 12px; top: calc(100% - 2px); width: auto; min-width: 0; max-height: 60vh; }
  .workspace .usermenu summary { padding-left: 12px; }
  .workspace table.grid, .workspace table.grid tbody, .workspace table.grid tr, .workspace table.grid td { display: block; width: 100%; }
  .workspace table.grid thead { display: none; }
  .workspace .table-wrap { background: transparent; border: 0; overflow: visible; }
  .workspace table.grid tr { padding: 16px; border: 1px solid var(--border); border-radius: 16px; margin-bottom: 14px; background: var(--card); }
  .workspace table.grid td { min-width: 0; max-width: 100%; padding: 8px 0; border: 0; position: static; text-align: left; overflow-wrap: anywhere; }
  .workspace table.grid td[data-label] { padding-left: 0; min-height: 0; }
  .workspace table.grid td[data-label]::before { content: attr(data-label); position: static; display: block; width: auto; margin-bottom: 5px; font-size: 11px; line-height: 1.4; text-transform: uppercase; color: var(--muted); }
  .workspace table.grid td .btn-sm, .workspace table.grid td .toggle-form, .workspace table.grid td .toggle-form button { width: 100%; }
  .workspace table.grid td .invite-row { display: grid; grid-template-columns: 1fr; }
  .workspace table.grid td .invite-row .fld { width: 100%; }
  .workspace table.grid tr td:first-child { box-shadow: none; }
  .workspace table.grid tr.closed td { background: transparent; }
  .workspace .kv { grid-template-columns: minmax(100px,140px) minmax(0,1fr); }
}
@media (max-width: 760px) {
  .filters-card { padding: 0; }
  .filter-panel > summary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 16px 18px; min-height: 56px; list-style: none; cursor: pointer; font-size: 14px; font-weight: 500; }
  .filter-panel > summary::-webkit-details-marker { display: none; }
  .filter-panel > summary::after { content: '+'; font-size: 24px; font-weight: 400; margin-left: auto; }
  .filter-panel[open] > summary::after { content: '−'; }
  .filter-panel > form { padding: 0 18px 18px; }
  .workspace .filters { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px 12px; }
  .workspace .filter-panel .filters .fld:first-child { grid-column: 1 / -1; }
  .workspace .filters label { font-size: 12px; line-height: 1.5; }
  .workspace .filters input, .workspace .filters select { height: 46px; font-size: 16px; }
  .workspace input[type="text"], .workspace input[type="email"], .workspace input[type="password"], .workspace input[type="date"], .workspace select, .workspace textarea, .report-form select, .report-form textarea, .auth-card input { font-size: 16px; }
  .btn-sm, button.btn, .toggle-on, .toggle-off, .linkbtn { min-height: 44px; font-size: 14px; }
  .copy-btn { min-width: 44px; min-height: 44px; }
  .workspace .kv { grid-template-columns: 1fr; gap: 4px; }
  .workspace .kv dt { margin-top: 10px; font-size: 11px; }
  .workspace .kv dd { font-size: 14px; }
  .workspace .invite-row { flex-wrap: wrap; }
  .workspace .invite-row .fld { flex: 1 1 100%; }
  .workspace .invite-row select { width: 100%; min-width: 0; }
  .workspace .invite-row > button { width: 100%; }
  .report-form .fld select, .report-form input[type="date"], .report-form input[type="file"] { width: 100%; min-width: 0; }
  .report-form .btn-row button, .action-block .btn-row button { width: 100%; }
  .chip { min-height: 42px; padding: 8px 12px; }
  .tag-x { min-width: 44px; min-height: 44px; }
  .metric-grid { gap: 12px; margin: 18px 0 24px; }
  .metric-card { padding: 16px; }
  .metric-label { font-size: 12px; line-height: 1.5; align-items: flex-start; }
  .metric-caption { font-size: 11px; line-height: 1.5; }
  .metric-card > strong { font-size: 30px; }
  .list-toolbar { align-items: center; }
  .list-sort { order: 3; flex: 1 1 100%; }
  .list-sort select { width: 100%; font-size: 16px; }
  .list-toolbar .switch { min-height: 44px; font-size: 13px; padding: 8px 12px; }
  .list-toolbar .switch input { min-width: 20px; min-height: 20px; }
  .summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .summary .stat .num { font-size: 26px; }
  .workspace table.grid { font-size: 14px; }
  #list-results table.grid tbody { grid-template-columns: 1fr; }
  .workspace .lead-contact strong { font-size: 15px; }
  .workspace .badge { font-size: 12px; }
  .auth-wrap { padding: 20px; }
  .auth-card { padding: 26px; max-width: 420px; }
  .auth-card input { min-height: 46px; }
  .manager-brand .service-name { font-size: 20px; }
  body:not(.workspace) .topbar-inner { min-height: 74px; height: auto; align-items: center; gap: 10px; }
  body:not(.workspace) .topbar-user { max-width: 100%; overflow-wrap: anywhere; font-size: 12px; }
}
@media (max-width: 480px) {
  .workspace .sidebar { padding: 14px 16px; }
  .workspace .container { padding: 18px 16px 32px; }
  .workspace .topbar-inner { padding-left: 16px; padding-right: 16px; }
  .workspace .topbar .demo-pill { display: none; }
  .workspace .breadcrumbs { font-size: 11px; }
  .workspace .breadcrumbs > strong { display: block; margin-top: 3px; }
  .workspace .breadcrumbs span { margin: 0 5px; }
  .workspace h1.page-title { font-size: 24px; line-height: 1.3; }
  .workspace .page-subtitle { font-size: 13px; }
  .workspace .demo-notice { font-size: 11px; line-height: 1.6; }
  .workspace .mainnav { grid-template-columns: 1fr; }
  .workspace .mainnav a { min-height: 46px; }
  .metric-card { padding: 14px; }
  .metric-label .ui-icon { display: none; }
  .metric-caption { font-size: 11px; }
  .msg-head { font-size: 12px; }
  .auth-brand .service-name { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media (max-width: 380px) {
  .workspace .filters { grid-template-columns: minmax(0,1fr); }
}
