/* === Блокируем прокрутку фона при открытой модалке === */
body.smm-modal-open {
  overflow: hidden;
}

/* === Модалка === */
.smm-modal {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9999;
}
.smm-modal.is-open {
  display: flex;
}

/* === Диалог модалки === */
.smm-modal__dialog {
  background: #f2f2f2;
  border-radius: 14px;
  width: min(950px, 95vw);
  height: 92vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

/* === Header / Footer === */
.smm-modal__header,
.smm-modal__footer {
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fafafa;
  border-bottom: 1px solid #eee;
}
.smm-modal__footer {
  border-top: 1px solid #eee;
}

/* === Контент === */
.smm-modal__body {
  overflow-y: auto;
  padding: 20px;
}

/* === Внутренняя форма с равными вертикальными отступами === */
.smm-mini-modal {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* === Первая линия: Водій / Авто / Логіст === */
/* Контейнер для каждой пары "подпись + селект" */
.smm-line-selects {
  display: flex;
  gap: 14px;
}

.smm-line-selects > div {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.smm-line-selects label {
  margin: 0;
  font-weight: 500;
  white-space: nowrap;
}

.smm-line-selects select {
  flex: 1;
  min-width: 0;
}



/* === Файловые блоки: Злеценіе / Док / Фактура === */
.smm-triple-group {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}
.smm-related-block {
  flex: 1;
  min-width: 0;
  background: #f5f5f5; /* вместо #fff */
  border: 1px solid #e0e0e0; /* вместо #ddd */
  border-radius: 14px; /* красиво круглее */
  padding: 14px; /* чуть больше воздуха */
}


/* Название секции */

/* Заголовок секции */
.smm-related-header {
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 1px solid #ccc;
  white-space: nowrap;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

/* Селекты в заголовках ДОК и ФАКТУРА */
.smm-related-header select {
  font-size: 10px !important;
  font-weight: 700 !important;
  padding: 2px 6px;
  width: auto !important;
  min-width: 60px;
  max-width: 85px;
  height: 28px;
  line-height: 22px;
  border-radius: 6px;
  border: 1px solid #666;
  background: #fff;
  cursor: pointer;
  text-align: center;
}

/* Уменьшаем поле Карта */
.smm-line-map input[data-field="Карта"] {
  width: 30% !important;
  max-width: 420px;
}






/* Файлы */
.smm-file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

/* Карточка файла */
.smm-file-tile {
  background: #eeeeee; /* светло-серый */
  border: 1px solid #464442; /* мягкая граница */
  border-radius: 14px; /* круглее */
  padding: 10px 12px; /* чуть больше воздуха */
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  transition: background 0.2s ease;
}
.smm-file-tile:hover {
  background: #e0e0e0; /* спокойный hover */
}


/* Кнопки на файлах */
.smm-file-actions {
  display: flex;
  gap: 6px;
}

/* === Кнопка удаления — только красный ✖, без фона === */
.smm-file-actions .smm-del {
  background: none !important;
  border: none !important;
  color: #d9534f !important;
  font-size: 22px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  padding: 0 !important;
  width: auto !important;
  height: auto !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* При наведении — ярче */
.smm-file-actions .smm-del:hover {
  color: #b52b27 !important;
  cursor: pointer;
  pointer-events: auto;
}


.smm-file-actions {
  pointer-events: none; /* отключаем клики по области иконок */
}

.smm-file-actions .smm-del {
  pointer-events: auto; /* включаем клики только на ✖ */
}

/* Символ */
.smm-file-actions .smm-del::before {
  content: "✖" !important;
  position: relative;
  top: -1px;
}





/* === Вигрузка / Країна / Пробіг — одна линия === */
.smm-line-inputs {
  display: flex;
  gap: 14px;
}

.smm-line-inputs > div {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.smm-line-inputs label {
  margin: 0;
  font-weight: 500;
  white-space: nowrap;
}

.smm-line-inputs input {
  flex: 1;
  min-width: 0;
}


/* === Карта === */
.smm-line-map {
  display: flex;
  align-items: center;
  gap: 14px;
}
.smm-line-map input {

  flex: 1;
}

/* === Сума / Витрати / Коефіцієнт === */
.smm-line-sums {
  display: flex;
  gap: 14px;
}
.smm-coef {
  padding: 9px 12px;
  background: #eee;
  border-radius: 6px;
  min-width: 65px;
  text-align: center;
}

/* === Примітка === */
.smm-line-note textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
}

/* === Inputs === */
.smm-mini-modal input,
.smm-mini-modal select,
.smm-mini-modal textarea {
  width: 100%;
  border: 1px solid #bbb;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 15px;
}

/* === Кнопки модалки === */
.smm-btn.smm-primary {
  background: #0275d8;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
}
.smm-btn.smm-ghost {
  background: #0275d8  !important;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
}
.smm-btn:hover {
  opacity: 0.85;
}




/* Финальный вид плитки */
.smm-related-block {
  position: relative !important;
  background: #D7DED7 !important;
  border: 1px solid #1E1C1B !important;
  border-radius: 14px !important;
  padding: 14px 14px 42px 14px !important; /* казна для кнопки + */
  min-height: 110px; /* чтобы блоки были одинаковой высоты */
}


/* Список файлов — аккуратнее */
.smm-file-list {
    gap: 10px;
}

/* Карточка файла — круглее, минимализм */
.smm-file-tile {
  cursor: pointer;
    border-radius: 14px !important;
    padding: 6px 10px !important;
  font-size: 14px !important;

}

.smm-file-tile a {
  flex: 1; /* чтобы линк занимал всё место */
  display: block;
}

/* Кнопка добавления файла: чистый плюс внутри круга — справа внизу */
.smm-add-file {
  position: absolute !important;
  right: 12px !important;
  bottom: 12px !important;
  width: 34px !important;
  height: 34px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  background: #28a745 !important;
  color: #fff !important;
  font-size: 20px !important;
  font-weight: 700 !important;
  line-height: 34px !important;
  text-align: center !important;
  display: inline-flex !important;
  justify-content: center !important;
  align-items: center !important;
  border: none !important;
  cursor: pointer !important;
  font-family: Arial, sans-serif !important;
}

.smm-add-file::before {
  content: "+" !important;
}

.smm-add-file:hover {
  background: #1d7c34 !important;
}

.smm-header-line {
  display: flex;
  align-items: center;
  justify-content: space-between; /* ⬅️ Раздвигаем элементы */
  gap: 14px;
}

.smm-header-line .smm-sent-block {
  display: flex;
  align-items: center;
  gap: 8px;
}


/* === Обёртка таблицы — вертикальный + горизонтальный скролл === */
.smm-wrap .smm-table-wrapper {
    overflow-x: auto !important;
    overflow-y: auto !important;
    max-height: calc(100vh - 200px) !important;
    width: 100% !important;
    -webkit-overflow-scrolling: touch;
}


/* === Таблица — фиксируем ширину по содержимому === */
.smm-wrap .smm-table {
    width: max-content !important;       
    table-layout: auto !important;
    border-collapse: separate !important;

}



/* === Ячейки таблицы === */
.smm-wrap .smm-table th,
.smm-wrap .smm-table td {
    padding: 10px 12px !important;
    border: 1px solid #413c3c !important;
    white-space: nowrap !important;
    font-size: 12px !important;
    background: #f7f4f4 !important;
    color: #111 !important;
}

/* === Шапка таблицы === */
.smm-wrap .smm-table thead th {
    background: #464d48 !important;
    color: #fff !important;
    font-weight: 700 !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 20 !important;
}

/* ✅ Sticky 1-й столбец */
.smm-wrap .smm-table th:first-child,
.smm-wrap .smm-table td:first-child {
    position: sticky !important;
    left: 0 !important;
    z-index: 21 !important;
}

/* ✅ Фиксация самой верхней левой ячейки */
.smm-wrap .smm-table thead th:first-child {
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 999 !important; /* самое большое */
    background: #464d48 !important; /* цвет шапки */
    color: #fff !important;
}

/* ✅ Первый столбец — для данных: цвет как у ячеек */
.smm-wrap .smm-table tbody td:first-child {
    background: #f7f4f4 !important;
}

/* ✅ Hover + корректный hover для sticky */
.smm-wrap .smm-table tbody tr:hover td {
    background: #d5eaf6 !important;
}

.smm-wrap .smm-table tbody tr:hover td:first-child {
    background: #d5eaf6 !important;
}

/* Ссылки */
.smm-wrap .smm-zlec-link,
.smm-wrap .smm-fakt-link {
    color: #0050d8 !important;
    font-weight: 700 !important;
    text-decoration: none !important;
}

.smm-wrap .smm-zlec-link:hover,
.smm-wrap .smm-fakt-link:hover {
    text-decoration: underline !important;
}

html, body {
    overflow-x: auto !important;
}

#smm-tbody.smm-cards-grid {
    display: block !important;
}

/* Контейнер ячейки */
.smm-zlec-td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    max-width: 200px;
    overflow: hidden;
}

/* Текст злецення — левый, обрезаем */
.smm-zlec-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    min-width: 0;
}

/* === D/P/F блок справа === */
.smm-dpf-box {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    border-radius: 6px;
    border: 2px solid transparent;
    flex-shrink: 0;
}

/* === Цвет галочек === */
.smm-d.green,
.green.smm-d,
.smm-p.green,
.green.smm-p,
.smm-f.green,
.green.smm-f 
 {
    color: #1dc03d !important; /* Зеленая галка */
}

.smm-d.gray,
.gray.smm-d,
.smm-p.gray,
.gray.smm-p,
.smm-f.gray,
.gray.smm-f {
    color: #d3d5d1 !important; /* Серая галка */
}

/* === Рамки состояний === */
.smm-dpf-box.border-green {
  border: 1px solid transparent;
    border-color: #28a745 !important; /* Оплачено */
}

.smm-dpf-box.border-red {
  border: 1px solid transparent;
    border-color: #c9302c !important; /* Просрочка или БО */
}

.smm-d, .smm-p, .smm-f {
  font-weight: 700;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 14

}

/* === ПІДСУМКИ — красивая компактная строка === */
.smm-summary {
  display: flex;
  gap: 28px;
  align-items: center;
  font-size: 15px;
  background: #f4f6f7;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid #d0d0d0;
  margin-bottom: 10px;
  white-space: nowrap;
}

.smm-summary strong {
  font-size: 15px;
  color: #000;
}

.smm-summary span b {
  font-weight: 700;
  color: #000;
}


.smm-group-modal {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    padding: 16px;
    border-radius: 10px;
    width: 420px;
    box-shadow: 0 4px 32px rgba(0,0,0,0.4);
    z-index: 99999;
}
.smm-group-list {
    max-height: 200px;
    overflow-y: auto;
    margin: 10px 0;
}
.smm-group-table td {
    padding: 4px 6px;
    font-size: 13px;
}
.smm-group-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
}

/* === Визуальный отступ и линия связи у дочерних строк === */
.smm-child-row td:first-child {
  position: relative !important;
  padding-left: 40px !important; /* чуть больше отступ */
}

/* Вертикальная линия между родителем и дочерней строкой */
.smm-child-row td:first-child::before {
  content: "";
  position: absolute;
  top: -20px;          /* чуть выше ячейки */
  height: 100%;         /* линия идёт только до середины */
  left: 16px;
  width: 2px;
  background: #9ea0a3;
  z-index: 1;
  opacity: 0.6;
}


/* Маленький горизонтальный сегмент к тексту */
.smm-child-row td:first-child::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 16px;
  width: 14px;
  height: 2px;
  background: #9ea0a3;
  transform: translateY(-50%);
  opacity: 0.6;
}

/* При наведении на строку — подсвечиваем линию */
.smm-child-row:hover td:first-child::before,
.smm-child-row:hover td:first-child::after {
  background: #1b73d1; /* синий, как hover у текста */
  opacity: 0.9;
}


/* --- Блок добавления трат --- */
.smm-expense-add {
  margin-top: 6px;
  margin-bottom: 10px; /* 🔹 отступ перед "Примітка" */
}

.smm-expense-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  padding: 3px 6px;
  margin-bottom: 3px;
  border-radius: 5px;
  background: #f5f5f5;
}

.smm-expense-left {
  display: flex;
  align-items: center;
  gap: 6px;
  text-align: left;
  flex: 1;
}

.smm-expense-comment {
  font-style: italic;
  color: #555;
  white-space: normal;
  word-break: break-word;
  text-align: left;
}

.smm-expense-del {
  background: none;
  border: none;
  color: #b33;
  font-size: 14px;
  cursor: pointer;
  transition: color 0.2s;
}
.smm-expense-del:hover {
  color: #e00;
}


.smm-analytics-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display:flex; align-items:center; justify-content:center; z-index:9999;
}
.smm-modal-dialog {
  background:#1c1c1c; color:#fff; padding:20px; border-radius:12px;
  width:80%; max-width:800px; max-height:80vh; overflow:auto;
}
.smm-ana-table {
  width:100%; border-collapse:collapse; margin:10px 0;
}
.smm-ana-table th, .smm-ana-table td {
  border:1px solid #333; padding:6px 10px; text-align:center;
}
.smm-ana-table th {
  background:#2b2b2b;
}
.smm-dates {
  display:flex; gap:10px; align-items:center; margin-bottom:10px;
}

/* === Кнопки АНАЛІТИКА и ЗАКРИТИ — стиль как у ПОКАЗАТИ === */
#smm-analytics-btn.smm-btn,
#smm-ana-close.smm-btn {
  background: #0275d8 !important;  /* тот же синий */
  color: #fff !important;
  border: none !important;
  padding: 8px 14px !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  font-weight: 700 !important;
  font-family: inherit !important;
  transition: opacity 0.2s ease;
}

#smm-analytics-btn.smm-btn:hover,
#smm-ana-close.smm-btn:hover {
  opacity: 0.85 !important;
}


.smm-multi-links {
  display: none;
  position: absolute;
  background: #fff;
  border: 1px solid #ccc;
  padding: 6px 10px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  z-index: 999;
}
.smm-dpf-box {
  position: relative;
  margin-left: 6px;
}
.smm-dpf-box:hover .smm-multi-links {
  display: block;
}
.smm-multi-links ul {
  list-style: none;
  padding: 0;
  margin: 4px 0 0 0;
}
.smm-multi-links li {
  margin: 2px 0;
}
.smm-zlec-link {
  color: #0073aa;
  text-decoration: none;
  font-weight: 500;
}
.smm-zlec-link:hover {
  text-decoration: underline;
}

.smm-row-flash {
  animation: smmRowFlash 1.8s ease;
}

@keyframes smmRowFlash {
  0% {
    background-color: #fff3a3;
  }
  100% {
    background-color: inherit;
  }
}