/* Единый вид (аудит 17.10): группа u-records. Префикс html[data-theme] body, грузится после unify.css */
/* «Встречи», «Компании», «PL»: одна панель фильтров, одна строка «Найдено», одна раскладка карточки и формы. */

/* --- Списки: фильтр и на телефоне одной строкой «Поиск · Фильтр · Найти» (на компьютере — u-common.css) --- */
@media(max-width:767px){
  html[data-theme] body .records-filter .has-mfilter>.search-field{flex:1 1 0!important;min-width:0}
  html[data-theme] body .records-filter .has-mfilter>:is(.mf-toggle,.mf-submit){flex:0 0 auto!important;width:auto;min-width:0;padding:0 14px}
}

/* --- Списки: строка «Найдено: N» · сортировка · «Список / Доска» --- */
html[data-theme] body .list-bar-end>.scope-switch{flex:none;height:44px}
html[data-theme] body .records-foot-help{margin-top:18px}

/* --- «Встречи», «Компании» на компьютере: строки-ссылки (нажатие — открыть, свайп влево — удалить) --- */
@media(min-width:768px){
  html[data-theme] body .rec-list{display:grid;gap:8px}
  html[data-theme] body :is(.rec-head,.rec-row){display:grid;gap:14px;align-items:center}
  html[data-theme] body .rec-head{padding:0 18px;font-size:11.5px;font-weight:800;color:var(--muted);text-transform:uppercase;letter-spacing:.03em}
  html[data-theme] body .rec-row{padding:12px 18px;border:1px solid var(--line);border-radius:14px;background:var(--surface);color:var(--ink);text-decoration:none;font-size:14px;line-height:1.4;-webkit-user-drag:none}
  html[data-theme] body .rec-row:hover{border-color:color-mix(in srgb,var(--primary) 30%,var(--line));box-shadow:var(--shadow)}
  html[data-theme] body .rec-row.is-cancelled{opacity:.7}
  html[data-theme] body .rec-row>span{min-width:0}
  html[data-theme] body .rec-co{display:flex;flex-direction:column;align-items:flex-start;gap:2px}
  html[data-theme] body .rec-co strong{font-weight:700;overflow-wrap:anywhere}
  html[data-theme] body .rec-co b{font-weight:600;overflow-wrap:anywhere}
  html[data-theme] body .rec-co small{color:var(--muted);font-size:12.5px;overflow-wrap:anywhere}
  html[data-theme] body .rec-co small.client-overdue{color:var(--danger,#e5484d)}
  html[data-theme] body .rec-date{font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--muted)}
  html[data-theme] body .rec-cell{overflow-wrap:anywhere}
  html[data-theme] body .rec-summary{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;color:var(--muted)}
  html[data-theme] body .rec-num{font-variant-numeric:tabular-nums}
  /* колонки «Встреч»: дата · компания · МКК · итог · стадия [· CSM] */
  html[data-theme] body .meeting-rows :is(.rec-head,.rec-row){grid-template-columns:88px minmax(0,1.6fr) minmax(0,1fr) minmax(0,2fr) 140px}
  html[data-theme] body .meeting-rows.has-csm :is(.rec-head,.rec-row){grid-template-columns:88px minmax(0,1.6fr) minmax(0,1fr) minmax(0,1.8fr) 140px minmax(0,1fr)}
  /* колонки «Компаний»: компания [· CSM] · ЛПР · ИД → РМ · встреч · последняя · стадия */
  html[data-theme] body .company-rows :is(.rec-head,.rec-row){grid-template-columns:minmax(0,2fr) minmax(0,1.4fr) minmax(0,1.3fr) 60px 100px 140px}
  html[data-theme] body .company-rows.has-csm :is(.rec-head,.rec-row){grid-template-columns:minmax(0,1.8fr) minmax(0,1fr) minmax(0,1.3fr) minmax(0,1.2fr) 60px 100px 140px}
}
@media(min-width:768px) and (max-width:1365px){
  html[data-theme] body .company-rows .rc-org{display:none}
  html[data-theme] body .company-rows :is(.rec-head,.rec-row){grid-template-columns:minmax(0,2fr) minmax(0,1.4fr) 60px 100px 140px}
  html[data-theme] body .company-rows.has-csm :is(.rec-head,.rec-row){grid-template-columns:minmax(0,1.8fr) minmax(0,1fr) minmax(0,1.3fr) 60px 100px 140px}
}
@media(min-width:768px) and (max-width:1100px){
  html[data-theme] body .meeting-rows :is(.rec-head,.rec-row)>:nth-child(3){display:none}
  html[data-theme] body .meeting-rows :is(.rec-head,.rec-row){grid-template-columns:88px minmax(0,1.6fr) minmax(0,2fr) 130px}
  html[data-theme] body .meeting-rows.has-csm :is(.rec-head,.rec-row){grid-template-columns:88px minmax(0,1.6fr) minmax(0,1.6fr) 130px minmax(0,1fr)}
}

/* --- Карточка: основная колонка + боковая (как у сделки PL) --- */
html[data-theme] body .record-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(300px,380px);gap:20px;align-items:start}
html[data-theme] body :is(.record-main,.record-side){display:flex;flex-direction:column;gap:16px;min-width:0}
html[data-theme] body .record-layout .card{margin:0}
html[data-theme] body .record-layout .card>h2{margin-top:0}
html[data-theme] body .record-side .client-contact-card{margin:0}
html[data-theme] body .record-side .contact-grid{grid-template-columns:1fr 1fr}
@media(max-width:1023px){
  html[data-theme] body .record-layout{display:flex;flex-direction:column;align-items:stretch;gap:16px}
  html[data-theme] body .record-layout .card{width:100%;max-width:none;box-sizing:border-box;align-self:stretch}
  html[data-theme] body .record-layout>:is(.record-main,.record-side){display:contents}
  html[data-theme] body .record-layout .client-contact-card{order:-1}
  html[data-theme] body .record-layout .record-next{order:-2}
}

/* --- Карточка: «Следующее действие» --- */
html[data-theme] body .record-next{padding:16px 18px;border-left:4px solid var(--primary,#5b5ce2)}
html[data-theme] body .record-next.is-late{border-left-color:#d93a42}
html[data-theme] body .record-next.is-today{border-left-color:#e2a400}
html[data-theme] body .record-next-sum{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:2px 12px;list-style:none;cursor:default}
html[data-theme] body summary.record-next-sum{cursor:pointer}
html[data-theme] body summary.record-next-sum::-webkit-details-marker{display:none}
html[data-theme] body .record-next-sum>*{grid-column:1}
html[data-theme] body .record-next-sum>.ui-icon{grid-column:2;grid-row:1/span 3;width:20px;height:20px;color:var(--muted);transition:transform .15s}
html[data-theme] body .record-next[open] .record-next-sum>.ui-icon{transform:rotate(180deg)}
html[data-theme] body .record-next-label{font-size:12px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--muted)}
html[data-theme] body .record-next-sum>strong{font-size:17px;line-height:1.35}
html[data-theme] body .record-next.is-late .record-next-sum>strong{color:#d93a42}
html[data-theme] body .record-next-sum>small{font-size:14px;line-height:1.45;color:var(--ink);overflow-wrap:anywhere}
html[data-theme] body .record-next-form{margin-top:14px;padding-top:14px;border-top:1px solid var(--line)}
html[data-theme] body .record-next-grid{display:grid;grid-template-columns:minmax(150px,200px) minmax(0,1fr) minmax(140px,170px);gap:12px;align-items:end}
html[data-theme] body .record-next-grid .field{margin:0}
@media(max-width:767px){
  html[data-theme] body .record-next-grid{grid-template-columns:1fr 1fr}
  html[data-theme] body .record-next-grid .record-next-text{grid-column:1/-1;order:-1}
}

/* --- Карточка: формы в блоках («Записать контакт», «Следующее действие») --- */
html[data-theme] body .record-form-actions{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:12px}
html[data-theme] body .record-form-actions.is-end{justify-content:flex-end;flex-wrap:wrap}
html[data-theme] body .record-form-actions .meta{margin:0}
html[data-theme] body .record-log form .field{margin:0}
html[data-theme] body .record-log>.meta{margin:0}
@media(max-width:767px){
  html[data-theme] body .record-form-actions{flex-wrap:wrap}
  html[data-theme] body .record-form-actions .button{flex:1 1 auto;min-height:44px}
  html[data-theme] body .record-form-actions .meta{flex:1 1 100%}
}

/* --- Карточка: встречи в истории — один компонент (meetings/components/meeting_card.html) --- */
html[data-theme] body .record-meeting-list{display:grid;gap:10px}
html[data-theme] body .record-meeting{display:grid;gap:6px;padding:12px 14px;border:1px solid var(--line);border-radius:12px;background:var(--surface);color:var(--ink);text-decoration:none}
html[data-theme] body .record-meeting:hover{border-color:var(--primary,#5b5ce2)}
html[data-theme] body .record-meeting.is-cancelled{opacity:.7}
html[data-theme] body .record-meeting-top{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px}
html[data-theme] body .record-meeting-top>.status{margin-left:auto}
html[data-theme] body .record-meeting-top .meta{margin:0}
html[data-theme] body .record-meeting-text,html[data-theme] body .record-meeting-agreement{font-size:14px;line-height:1.45;overflow-wrap:anywhere}
html[data-theme] body .record-meeting-agreement{color:var(--muted)}
html[data-theme] body .record-meeting-agreement b{font-weight:650;color:var(--ink)}
html[data-theme] body .record-more{display:inline-block;margin-top:12px}
html[data-theme] body .record-meetings .pagination{margin-top:14px}
html[data-theme] body .record-agreement .detail-copy{margin:8px 0 0}
html[data-theme] body .record-agreement .status{margin-top:12px}

/* --- Возвращено после редизайна (решение владельца) --- */
/* «Компании»: «Показать все на одной странице» под списком */
html[data-theme] body .list-all-toggle{margin:14px 0 0;text-align:center;font-size:14px}
/* «Компании» на телефоне: вся плитка открывает карточку (ссылка на названии растянута), телефон и почта ЛПР — поверх неё */
html[data-theme] body .client-tile{position:relative}
html[data-theme] body .client-tile .client-tile-link{color:inherit;text-decoration:none;-webkit-user-drag:none}
html[data-theme] body .client-tile .client-tile-link::after{content:"";position:absolute;inset:0;border-radius:inherit;z-index:0}
html[data-theme] body .client-tile-line{font-size:12.5px;line-height:1.45;color:var(--muted);overflow-wrap:anywhere}
html[data-theme] body .client-tile-contact{font-size:13px}
html[data-theme] body .client-tile .client-tile-tap{position:relative;z-index:1;color:var(--primary-strong,var(--primary));font-weight:600;text-decoration:none;-webkit-user-drag:none;padding:6px 0;margin:-6px 0}
html[data-theme] body .client-tile .client-tile-tap:active{opacity:.6}
/* История встреч в карточке: ссылка на встречу + «Подробнее» (ВКО, договорённости полностью) и «Добавить в PL» */
html[data-theme] body .record-meeting{gap:0;padding:0}
html[data-theme] body .record-meeting-link{display:grid;gap:6px;padding:12px 14px 8px;color:var(--ink);text-decoration:none;border-radius:12px 12px 0 0}
html[data-theme] body .record-meeting:has(.record-meeting-more[open]) .record-meeting-agreement{display:none}
html[data-theme] body .record-meeting-foot{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin:0 14px;border-top:1px solid var(--line)}
html[data-theme] body .record-meeting-more{flex:1;min-width:0}
html[data-theme] body .record-meeting-more>summary{display:inline-flex;align-items:center;gap:6px;min-height:40px;font-size:13px;font-weight:700;color:var(--primary-strong,var(--primary));cursor:pointer;list-style:none}
html[data-theme] body .record-meeting-more>summary::-webkit-details-marker{display:none}
html[data-theme] body .record-meeting-more>summary .ui-icon,html[data-theme] body .record-meeting-more>summary svg{width:16px;height:16px;transition:transform .2s}
html[data-theme] body .record-meeting-more[open]>summary :is(.ui-icon,svg){transform:rotate(180deg)}
html[data-theme] body .record-meeting-kv{display:grid;grid-template-columns:auto minmax(0,1fr);gap:6px 14px;margin:0 0 12px;font-size:14px;line-height:1.5}
html[data-theme] body .record-meeting-kv dt{color:var(--muted);font-weight:600;white-space:nowrap}
html[data-theme] body .record-meeting-kv dd{margin:0;overflow-wrap:anywhere}
html[data-theme] body .record-meeting-foot form{margin:0;padding:2px 0}
html[data-theme] body .record-meeting-foot .icon-button{width:36px;height:36px}
@media(max-width:767px){
  html[data-theme] body .record-meeting-kv{grid-template-columns:1fr;gap:2px}
  html[data-theme] body .record-meeting-kv dd+dt{margin-top:8px}
}
