/* WorkLine 1.11.15 — Задачи (компактная 2-колоночная карточка 50/50, равные Название/Описание), Сверка остатков (точное центрирование иконок и подписей в кнопках) */

/* ================================================================
   12.1) Задачи: карточка «Новая задача / Редактировать задачу»
   ================================================================ */
#task-overlay .task-form-grid {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 10px !important;
  padding: 14px 16px 14px !important;
}

#task-overlay .task-field {
  display: flex;
  flex-direction: column;
  min-width: 0 !important;
  width: 100% !important;
  box-sizing: border-box;
}

#task-overlay .task-field > label {
  display: block;
  margin: 0 0 5px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  opacity: .72;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Скрываем нативные select, уже заменённые на .custom-select-trigger */
#task-overlay select[data-wl-select="1"] {
  display: none !important;
}

/* Название и Описание — одинаковой высоты и формы */
html #task-overlay #task-title,
html #task-overlay #task-description {
  width: 100% !important;
  min-width: 0 !important;
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  padding: 10px 12px !important;
  margin: 0 !important;
  font-size: 15px !important;
  line-height: 22px !important;
  border-radius: 10px !important;
  border: 1px solid rgba(127, 127, 127, .24) !important;
  background: var(--card-bg, #fff) !important;
  color: var(--text) !important;
  box-sizing: border-box !important;
  display: block !important;
  resize: none !important;
  overflow-y: auto;
  box-shadow: none !important;
}

/* Три парные строчки строго 50 / 50 на любых экранах (включая узкие мобильные) */
#task-overlay .task-form-row.task-pair-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  gap: 10px !important;
  align-items: end !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

@media (max-width: 600px) {
  #task-overlay .task-form-row.task-pair-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 10px !important;
  }
}

/* Единая высота, границы и ширина у всех контролов в парных строчках */
html #task-overlay .task-pair-row input:not([type="checkbox"]):not([type="hidden"]),
html #task-overlay .task-pair-row select:not([data-wl-select="1"]),
html #task-overlay .task-pair-row .wl-dt-trigger,
html #task-overlay .task-pair-row .custom-select-trigger,
html #task-overlay .task-pair-row .task-remind-switch-box {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 11px !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  border-radius: 10px !important;
  border: 1px solid rgba(127, 127, 127, .24) !important;
  background: var(--card-bg, #fff) !important;
  color: var(--text) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  line-height: 1.2 !important;
  opacity: 1 !important;
  box-shadow: none !important;
}

html #task-overlay .task-pair-row .wl-dt-trigger,
html #task-overlay .task-pair-row .custom-select-trigger,
html #task-overlay .task-pair-row .task-remind-switch-box {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 6px !important;
}

/* Единая поверхность всех полей карточки задачи в тёмной теме */
html[data-theme="dark"] #task-overlay #task-title,
html[data-theme="dark"] #task-overlay #task-description,
html[data-theme="dark"] #task-overlay .task-pair-row input:not([type="checkbox"]):not([type="hidden"]),
html[data-theme="dark"] #task-overlay .task-pair-row select:not([data-wl-select="1"]),
html[data-theme="dark"] #task-overlay .task-pair-row .wl-dt-trigger,
html[data-theme="dark"] #task-overlay .task-pair-row .custom-select-trigger,
html[data-theme="dark"] #task-overlay .task-pair-row .task-remind-switch-box {
  background: #23262c !important;
  border-color: rgba(255, 255, 255, .14) !important;
  color: var(--text) !important;
}

html #task-overlay #task-title:focus,
html #task-overlay #task-description:focus,
html #task-overlay .task-pair-row .wl-dt-trigger:focus-visible,
html #task-overlay .task-pair-row .custom-select-trigger:focus-visible {
  outline: none !important;
  border-color: var(--primary) !important;
}

#task-overlay .task-pair-row .wl-dt-trigger > span,
#task-overlay .task-pair-row .custom-select-trigger > span {
  min-width: 0 !important;
  flex: 1 1 auto !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  text-align: left !important;
}

/* Иконка часов для поля «Время» (вместо календаря) */
#task-overlay #task-time-trigger:after {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E") center / contain no-repeat !important;
}

/* Ячейка переключателя «Напомнить» в 3-й строчке */
#task-overlay .task-remind-switch-box {
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#task-overlay .task-remind-switch-text {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  opacity: .9;
}

#task-overlay .task-remind-switch-box .wl-switch {
  width: 42px;
  height: 24px;
  flex: 0 0 42px;
}

#task-overlay .task-remind-switch-box .wl-switch i::after {
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
}

#task-overlay .task-remind-switch-box .wl-switch input:checked + i::after {
  transform: translateX(18px);
}

#task-overlay .task-remind-pair-row:has(#task-reminder-enabled:not(:checked)) .task-remind-when-field {
  opacity: .5;
  transition: opacity .15s ease;
}

/* Компактные пояснения под формой, чтобы всё помещалось без лишней прокрутки */
#task-overlay .tasks-notify-status {
  padding: 2px 0 0 !important;
  margin: 0 !important;
  font-size: 11.5px;
  line-height: 1.3;
  opacity: .65;
}

#task-overlay .tasks-note {
  margin-top: 0 !important;
  font-size: 11px;
  line-height: 1.32;
  opacity: .56;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

/* ================================================================
   13.1) Сверка остатков: ровное центрирование иконок и подписей в кнопках
   ================================================================ */
body:not(#mbp) #residues .res-actions-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  gap: 6px !important;
  margin: 0 !important;
  padding: 0 !important;
}

body:not(#mbp) #residues .res-actions-row > .btn-main,
body:not(#mbp) #residues .res-actions-row > button.btn-main,
body:not(#mbp) #residues .res-actions-row > #btn-clear-res,
body:not(#mbp) #residues .res-actions-row > #btn-export-res {
  flex: 1 1 0% !important;
  min-width: 0 !important;
  width: auto !important;
  height: 62px !important;
  min-height: 62px !important;
  margin: 0 !important;
  padding: 6px 4px !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  text-align: center !important;
  font-size: 10.5px !important;
  font-weight: 700 !important;
  line-height: 1.15 !important;
  letter-spacing: -.1px;
  white-space: normal !important;
  border-radius: 12px !important;
}

/* Скрытые кнопки (например, «Скачать отчёт» до загрузки файла) остаются скрытыми */
body:not(#mbp) #residues .res-actions-row > #btn-export-res[style*="display:none"],
body:not(#mbp) #residues .res-actions-row > #btn-export-res[style*="display: none"],
body:not(#mbp) #residues .res-actions-row > button[style*="display:none"],
body:not(#mbp) #residues .res-actions-row > button[style*="display: none"],
body:not(#mbp) #residues .res-actions-row > button[hidden],
body:not(#mbp).wlp-no-residues-export #residues .res-actions-row > #btn-export-res,
body:not(#mbp).wlp-no-residues-export #residues .res-actions-row > #btn-inventa-res,
body:not(#mbp).wlp-no-residues-view #residues .res-actions-row > #btn-export-res,
body:not(#mbp).wlp-no-residues-view #residues .res-actions-row > #btn-inventa-res,
body:not(#mbp).wlp-no-residues-edit #residues #recount-card .res-actions-row > #rec-forecast-btn,
body:not(#mbp).wlp-no-residues-import #residues #recount-card .res-actions-row > [onclick*="wlRecountPick"],
body:not(#mbp).wlp-no-residues-export #residues #recount-card .res-actions-row > #rec-export-btn,
body:not(#mbp).wlp-no-residues-export #residues #recount-card .res-actions-row > #rec-tg-btn,
body:not(#mbp).wlp-no-residues-view #residues #recount-card .res-actions-row > #rec-export-btn,
body:not(#mbp).wlp-no-residues-view #residues #recount-card .res-actions-row > #rec-tg-btn,
body:not(#mbp).wlp-no-statement-import #residues #stmt-card .res-actions-row > [data-stmt="upload"],
body:not(#mbp).wlp-no-statement-export #residues #stmt-card .res-actions-row > [data-stmt="export"],
body:not(#mbp).wlp-no-statement-view #residues #stmt-card .res-actions-row > [data-stmt="upload"],
body:not(#mbp).wlp-no-statement-view #residues #stmt-card .res-actions-row > [data-stmt="export"] {
  display: none !important;
}

body:not(#mbp) #residues .res-actions-row > .btn-main .wl-icon,
body:not(#mbp) #residues .res-actions-row > .btn-main > svg {
  margin: 0 !important;
  padding: 0 !important;
  display: block !important;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  flex: 0 0 18px !important;
  align-self: center !important;
  vertical-align: middle !important;
}

body:not(#mbp) #residues .res-actions-row > .btn-main > span {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  min-height: 0 !important;
  height: auto !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  line-height: 1.15 !important;
}
