@media screen {
  .crm-ui .tasks-page { max-width: 1080px; margin: 0 auto; padding: 0; background: var(--surface-data, #f8fafc); border: 1px solid var(--border, #dce3ec); border-radius: 20px; overflow: visible; }
  .crm-ui .task-list-controls { padding: 20px 24px; border-bottom: 1px solid #dce3ec; }
  .crm-ui .task-list-controls .task-toolbar { margin: 16px 0 0; }
  .crm-ui .task-list, .crm-ui .task-pagination { max-width: none; margin: 0; padding: 20px 24px; }
  .crm-ui .task-list .task-row { margin-bottom: 8px; border-radius: 12px; background: #fff; }
  .crm-ui .task-list .task-group { font-size: 15px; padding: 14px 0 10px; }
  .crm-ui .task-empty { padding: 48px 24px; min-height: 280px; }
  .crm-ui .task-empty svg { width: 76px; height: 72px; }
  .crm-ui .task-fields { padding: 24px; }
  .crm-ui .task-fields fieldset { padding: 18px; border: 1px solid #dce3ec; border-radius: 14px; background: #fff; }
  .crm-ui .lead-list-controls { padding: 18px; border: 1px solid #dce3ec; border-radius: 18px; background: var(--surface-data, #f8fafc); margin-bottom: 16px; }
  .crm-ui .lead-list-controls .lead-view { margin-bottom: 16px; flex-wrap: wrap; }
  .crm-ui .lead-list-controls .lead-badges { border-bottom: 1px solid #dce3ec; padding-bottom: 14px; }
  .crm-ui .lead-list-controls .lead-toolbar { gap: 8px; margin-bottom: 12px; }
  .crm-ui .lead-list-controls #lead-search { max-width: 680px; margin: 0; }
  .crm-ui .lead-board { height: calc(100dvh - 350px); min-height: 420px; gap: 14px; }
  .crm-ui .lead-column { flex: 1 0 280px; border-radius: 16px; background: #eef2f7; border: 1px solid #d7e0ea; }
  .crm-ui .lead-column h3 { font-weight: 600; color: #344357; }
  .crm-ui .lead-card { border-radius: 12px; background: #fff; }
  .crm-ui .lead-form-section { padding: 18px; margin: 18px 0; border: 1px solid #dce3ec; border-radius: 14px; background: #fff; }
  .crm-ui .lead-form-section legend { font-size: 16px; font-weight: 650; color: #26384b; padding: 0 6px; }
  .crm-ui .lead-form-section > :last-child { margin-bottom: 0; }
  .crm-ui .lead-channels { flex-wrap: wrap; }
  .crm-ui .lead-channels label { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; }
  .crm-ui .booking-table-workspace { border: 1px solid #dce3ec; border-radius: 18px; background: var(--surface-data, #f8fafc); padding: 18px; min-width: 0; }
  .crm-ui .booking-table-workspace .section-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-start; }
  .crm-ui .booking-column-picker { position: relative; }
  .crm-ui .booking-columns { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; display: flex; flex-direction: column; flex-wrap: nowrap; width: 260px; max-width: calc(100vw - 48px); max-height: min(420px, 60dvh); overflow: auto; padding: 8px; background: #fff; border: 1px solid #cdd8e5; border-radius: 14px; box-shadow: 0 12px 32px #1c345326; }
  .crm-ui .booking-columns label { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 10px; border-radius: 8px; }
  .crm-ui .booking-columns label:focus-within, .crm-ui .booking-columns label:hover { background: #edf4ff; }
  .crm-ui .booking-filter-panel { margin: 14px 0; }
  .crm-ui .booking-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; padding: 16px 0 0; }
  .crm-ui .booking-filters label { display: grid; gap: 6px; }
  .crm-ui .schedule-toolbar { background: var(--surface-data, #f8fafc); padding: 16px; border: 1px solid #dce3ec; border-radius: 18px 18px 0 0; margin: 0; }
  .crm-ui .schedule-scroll { background: #fff; border: 1px solid #dce3ec; border-top: 0; border-radius: 0 0 18px 18px; max-height: calc(100dvh - 235px); min-height: 340px; overflow: auto; }
  .crm-ui .schedule-grid { background: #fff; min-width: 950px; grid-template-columns: 64px repeat(7, minmax(126px, 1fr)); }
  .crm-ui .schedule-cell { min-height: 76px; border-color: #dde4ed; background: #fff; }
  .crm-ui .day-title, .crm-ui .time-title { background: #edf2f8; color: #344357; position: sticky; top: 0; z-index: 2; min-height: 56px; }
  .crm-ui .hour-title { background: #f6f8fb; color: #445264; font-size: 13px; }
  .crm-ui .schedule-event { border-radius: 8px; padding: 8px; background: #e5efff; border: 1px solid #bfd3f2; color: #243d63; }
}
@media screen and (max-width: 760px) {
  .crm-ui .task-list-controls, .crm-ui .task-list, .crm-ui .task-pagination { padding: 16px; }
  .crm-ui .task-list-controls .task-toolbar { flex-wrap: wrap; }
  .crm-ui .lead-list-controls { padding: 12px; }
  .crm-ui .lead-column { flex: 0 0 min(300px, calc(100vw - 48px)); }
  .crm-ui .lead-board { height: auto; }
  .crm-ui .lead-form-section { padding: 14px; }
  .crm-ui .booking-table-workspace { padding: 12px; }
  .crm-ui .booking-columns { left: auto; right: 0; }
  .crm-ui .booking-columns label { min-height: 44px; }
  .crm-ui .schedule-toolbar { gap: 10px; flex-wrap: wrap; }
  .crm-ui .schedule-toolbar .actions { flex-wrap: wrap; }
  .crm-ui .schedule-scroll { max-height: calc(100dvh - 250px); }
}
@media screen {
  .crm-ui .tasks-page > .task-list { border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .crm-ui .task-group { background: transparent; }
}
@media screen and (min-width: 761px) {
  .crm-ui .lead-drawer { width: min(720px, 94vw); }
  .crm-ui .lead-drawer.existing { width: min(1080px, 96vw); }
  .crm-ui .lead-drawer.history-collapsed { width: min(720px, 94vw); }
  .crm-ui .lead-editor { width: auto; }
  .crm-ui .task-drawer { width: min(640px, 94vw); }
  .crm-ui .task-drawer.task-existing { width: min(1000px, 96vw); }
  .crm-ui .task-existing .task-editor { width: calc(100% - 334px); }
  .crm-ui .task-existing > .task-drawer-head { width: calc(100% - 334px); }
  .crm-ui .task-existing.history-collapsed { width: min(680px, 94vw); }
  .crm-ui .task-existing.history-collapsed .task-editor { width: calc(100% - 34px); }
  .crm-ui .task-existing.history-collapsed > .task-drawer-head { width: calc(100% - 34px); }
}

@media screen {
  .crm-ui .booking-columns { left: var(--booking-menu-left, 0); right: auto; max-height: min(420px, calc(100dvh - var(--booking-menu-top, 240px) - 16px)); }
  .crm-ui .booking-columns > label { flex: 0 0 auto; width: 100%; box-sizing: border-box; white-space: normal; }
}
@media screen and (max-width: 760px) {
  .crm-ui .main:has(.page-communications) .topbar { padding: 8px 12px; gap: 6px; }
  .crm-ui .main:has(.page-communications) .top-actions { display: none; }
}
