/* assets/css/cash.css — «Бухгалтерия» → «Касса»
 * Переиспользует ms-* / fm-* (my_surveys.css, foreman.css). Здесь — только cash-*. */

.cash-root {
  width: 100%;
  box-sizing: border-box;
}

/* ── Плашка остатка (по мотивам .asmp-total-bar) ── */
.cash-balance-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 18px;
  padding: 10px 16px;
  margin: 10px 16px 0;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 10px;
  background: rgba(1, 105, 111, 0.05);
}

.cash-balance-main {
  font-size: 15px;
  font-weight: 600;
}

.cash-balance-main b {
  font-size: 18px;
}

.cash-balance-filtered {
  font-size: 13px;
  color: var(--muted, #666);
}

/* ── Остатки по кассам (мультикассы, 17.07.2026) ── */
.cash-balance-regs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 13px;
}

.cash-balance-reg b {
  font-size: 14px;
}

/* Приход / расход */
.cash-in  { color: var(--success, #1a7f37); font-weight: 600; }
.cash-out { color: var(--danger, #c62828);  font-weight: 600; }

/* ── Фильтр-бар ── */
/* Базовый .ms-filterbar — flex-КОЛОНКА (my_surveys.css); в кассе контролы — прямые
   дети бара, поэтому раскладываем в одну строку с переносом */
.cash-filterbar {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}

/* Панель фильтров кассы НЕ прилипает — служит «стражем» для StickyThead: когда
   она уходит за верх экрана, к экрану фиксируется клон шапки таблицы
   (.fm-thead-fixed). Базовый .ms-filterbar (my_surveys.css) — sticky; без этого
   override страж не уходит и шапка таблицы не закрепляется (баг от Максима
   26.07.2026). Аналогично .mp-root в measurement_payout.css. */
.cash-root > .ms-filterbar {
  position: relative;
  top: auto;
}

.cash-month-chk {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.cash-month-chk input {
  cursor: pointer;
}

.cash-filter-select {
  min-width: 170px;
  max-width: 230px;
}

.cash-date {
  width: 150px;
}

/* Кнопка «+ Операция» слева, блок фильтров прижат вправо */
.cash-filterbar #cash-f-emp {
  margin-left: auto;
}

/* ── Форма добавления (по мотивам .roz-add-form) ── */
.cash-add-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
  padding: 12px 16px;
  margin: 10px 16px 0;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 10px;
  background: var(--card-bg, #fff);
}

.cash-add-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.cash-field-label {
  color: var(--muted, #666);
  white-space: nowrap;
}

.cash-req {
  color: var(--danger, #c62828);
}

.cash-add-form #cash-a-amount { width: 110px; }
.cash-add-form #cash-a-date   { width: 150px; }
.cash-add-form #cash-a-deal   { width: 180px; }
.cash-add-form #cash-a-cat,
.cash-add-form #cash-a-emp    { min-width: 190px; max-width: 240px; }

.cash-cp-wrap {
  display: flex;
  gap: 6px;
}

.cash-cp-wrap #cash-a-cp     { min-width: 170px; max-width: 220px; }
.cash-cp-wrap #cash-a-cp-new { width: 180px; }

.cash-lbl-wide { flex: 1 1 220px; }
.cash-lbl-wide input { width: 100%; }

.cash-form-actions {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}

/* ── Таблица (внутренний скролл, как .mp-root) ── */
.cash-root > .ms-list > .fm-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 10px;
  background: var(--card-bg, #fff);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.cash-root > .ms-list > .fm-table-wrap::-webkit-scrollbar {
  display: none;
}

.cash-table td,
.cash-table th {
  white-space: nowrap;
}

.cash-cell-money { text-align: right; }
.cash-cell-money .fm-inline-num { max-width: 100px; }

.cash-inline-date    { width: 128px; font-size: 12px; padding: 5px 6px; }
.cash-inline-deal    { width: 95px; }
.cash-inline-sel     { min-width: 150px; max-width: 210px; font-size: 12px; }
.cash-inline-reg     { min-width: 110px; max-width: 140px; }
.cash-filter-reg     { min-width: 120px; max-width: 150px; }

/* ── Комментарий: фиксированная ширина, перенос слов, высота по содержимому ── */
.cash-cell-comment { white-space: normal; vertical-align: top; }

.cash-cell-comment .cash-comment {
  display: inline-block;
  width: 240px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  vertical-align: top;
}

.cash-inline-comment.cash-comment-ta {
  width: 240px;
  min-width: 240px;
  max-width: 240px;
  min-height: 30px;
  box-sizing: border-box;
  padding: 5px 6px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;      /* переносы, введённые пользователем, сохраняются */
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow: hidden;           /* высоту задаёт JS (_autoGrowComment) */
  resize: none;
}

.cash-cell-author { color: var(--muted, #666); font-size: 12px; }

/* Заблокированные (не same-day) строки — слегка приглушены */
.cash-row-locked td { color: inherit; }

/* Кнопка удаления */
.cash-del-btn {
  border: none;
  background: none;
  color: var(--danger, #c62828);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}

.cash-del-btn:hover {
  background: rgba(198, 40, 40, 0.1);
}

/* ── Поле «Сделка»: автоподсказка + карточка клиента ── */
.cash-deal-dd {
  position: fixed;
  z-index: 10600;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
  max-height: 280px;
  overflow-y: auto;
  font-size: 13px;
}

.cash-deal-dd-item {
  padding: 7px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border, #f0f0f0);
}

.cash-deal-dd-item:last-child { border-bottom: none; }

.cash-deal-dd-item:hover { background: var(--row-hover, #eef2f6); }

.cash-deal-dd-muted { color: var(--muted, #666); font-size: 12px; }

.cash-deal-picked {
  font-size: 11px;
  color: var(--muted, #666);
  margin-top: 2px;
  max-width: 220px;
}

.cash-cell-deal {
  white-space: normal;
  max-width: 240px;
}

.cash-deal-cell--edit { cursor: pointer; border-radius: 6px; padding: 2px 4px; }

.cash-deal-cell--edit:hover { background: rgba(1, 105, 111, .06); }

.cash-deal-inp { width: 160px; }

/* Контрагент: свободный текст с подсказками */
.cash-add-form #cash-a-cp { width: 200px; }
.cash-cp-inp { min-width: 150px; }

/* Сотрудник: текст с подсказками (выбор из списка) */
.cash-add-form #cash-a-emp { width: 200px; }
.cash-emp-inp { min-width: 150px; }
