/* === Таблицы LT Optimizacija — v1.1 === */

/* --- Обёртка --- */
.lt-tbl-wrap{
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  margin:0 !important;
  padding:0 !important;
  border:1px solid #b9c4cf;
  border-radius:6px;
  background:#fff;
}

/* --- Таблица: базу снимаем, отступы задаём сами --- */
.lt-tbl{
  width:100%;
  border-collapse:collapse;
  font-size:16px;
  line-height:1.45;
  font-variant-numeric:tabular-nums;
  margin:0 !important;
  margin-block:0 !important;
}

/* --- Шрифт как на странице (наследуем от темы) --- */
.lt-tbl,
.lt-tbl th,
.lt-tbl td,
.lt-tbl caption{
  font-family:inherit !important;
  text-transform:inherit !important;
}

/* --- Заголовок таблицы: без светлой плашки и полосы --- */
.lt-tbl caption{
  caption-side:top;
  text-align:left;
  padding:.45em .9em;
  font-weight:600;
  font-size:18px;
  color:#004b7a;
  background:transparent;
  border-bottom:1px solid #d8dee5;
}

/* --- Ячейки: рамки + центрирование по горизонтали и вертикали --- */
.lt-tbl th,
.lt-tbl td{
  padding:.62em .9em;
  border:1px solid #c9d2db;
  text-align:center;
  vertical-align:middle;
}

.lt-tbl thead th{
  background:#004b7a;
  color:#fff;
  font-weight:600;
  white-space:nowrap;
  border-color:#00395f;
}

.lt-tbl tbody th{ font-weight:600; color:#20303f; }
.lt-tbl tbody tr:nth-child(even){ background:#f7f9fb; }
.lt-tbl tbody tr:hover{ background:#eef4fa; }

/* --- Белые поля: аккуратные отступы только по вертикали --- */
.entry-content > .lt-tbl-wrap{ margin:.3em 0 .7em !important; }

/* --- Пустые абзацы от wpautop вокруг шорткода --- */
.entry-content p:empty,
.entry-content p:blank,
.entry-content > p:has(> br:only-child){
  display:none !important;
  margin:0 !important;
  padding:0 !important;
}

/* --- Gutenberg: разрыв между блоками --- */
.entry-content > .lt-tbl-wrap,
.entry-content .wp-block-shortcode{ margin-block:0 !important; }

/* --- Сортировка по клику (при sort="1") --- */
.lt-tbl--sortable thead th{
  cursor:pointer;
  user-select:none;
  padding-right:2em;
  position:relative;
}
.lt-tbl--sortable thead th::after{
  content:"\2195";
  position:absolute;
  right:.7em;
  top:50%;
  transform:translateY(-50%);
  opacity:.45;
  font-size:.9em;
}
.lt-tbl--sortable thead th[data-dir="asc"]::after{ content:"\2191"; opacity:1; }
.lt-tbl--sortable thead th[data-dir="desc"]::after{ content:"\2193"; opacity:1; }
.lt-tbl--sortable thead th:focus-visible{ outline:2px solid #f0dca6; outline-offset:-2px; }

/* --- Печать --- */
@media print{
  .lt-tbl{ font-size:11pt; }
  .lt-tbl thead{ display:table-header-group; }
  .lt-tbl thead th{ background:#eee !important; color:#000 !important; }
  .lt-tbl tbody tr{ background:#fff !important; }
  .lt-tbl tr{ page-break-inside:avoid; }
}

/* --- Мобильные: строки → карточки --- */
@media (max-width:600px){

  /* Обёртка: вернуть на всю ширину и убрать центрирование */
  .entry-content .lt-tbl-wrap{
    display:block !important;
    width:100% !important;
    max-width:100% !important;
    margin-left:0 !important;
    margin-right:0 !important;
    overflow:visible;
    border:none;
    background:none;
  }

  .lt-tbl{ background:none; }
  .lt-tbl thead{ display:none; }
  .lt-tbl caption{ background:none; border:none; padding:.3em 0 .8em; font-size:17px; }

  .lt-tbl tbody tr{
    display:block;
    border:1px solid #c9d2db;
    border-radius:6px;
    padding:.3em .85em .5em;
    margin:0 0 .7em;
    background:#fff !important;
  }

  .lt-tbl tbody th{
    display:block;
    width:auto;
    padding:.55em 0 .4em;
    font-size:18px;
    color:#004b7a;
    text-align:center;
    border:none;
    border-bottom:1px dashed #e6ebf0;
  }

  .lt-tbl tbody td{
    display:flex;
    justify-content:space-between;
    gap:1em;
    padding:.45em 0;
    border:none;
    border-bottom:1px dashed #e6ebf0;
    text-align:left;
  }

  .lt-tbl tbody td:last-child{ border-bottom:none; }
  .lt-tbl tbody td::before{
    content:attr(data-label);
    font-weight:600; color:#55606b; text-align:left;
  }
}

/* Защита от перебивания темой и кастомным CSS */
.entry-content .lt-tbl,
.entry-content .lt-tbl th,
.entry-content .lt-tbl td,
.entry-content .lt-tbl caption{
  font-size: 17px !important;
}

/* ============ УЗКАЯ ТАБЛИЦА ПО ЦЕНТРУ ============ */

/* Обёртка: сжимается по содержимому и центрируется */
.entry-content .lt-tbl-wrap{
  display:block !important;
  width:-moz-fit-content !important;
  width:fit-content !important;
  max-width:100% !important;
  margin-left:auto !important;
  margin-right:auto !important;
}

/* Таблица: не 100%, а по содержимому */
.entry-content .lt-tbl{
  width:auto !important;
  min-width:0 !important;
}

/* Боковые отступы в ячейках — главный «распиратель» ширины */
.entry-content .lt-tbl th,
.entry-content .lt-tbl td{
  padding:.62em .7em !important;
}
/* Заголовок таблицы по центру */
.entry-content .lt-tbl caption{
  text-align:center !important;
}

/* ===== Tablicka svobodnyx mest v telefone ===== */
@media (max-width: 600px){

  .entry-content .lt-tbl-wrap{
    display:block !important; width:100% !important;
    max-width:100% !important; overflow:visible !important;
  }
  .entry-content .lt-tbl{
    display:block !important; width:100% !important; max-width:100% !important;
    border:0 !important; background:none !important;
    font-size:14px !important; line-height:1.35 !important;
  }

  .entry-content .lt-tbl thead{ display:none !important; }

  .entry-content .lt-tbl tbody,
  .entry-content .lt-tbl tbody tr{ display:block !important; width:auto !important; }

  .entry-content .lt-tbl tbody td,
  .entry-content .lt-tbl tbody th{
    display:block !important; width:auto !important;
    border:0 !important; padding:0 !important; margin:0 !important;
    text-align:left !important; overflow-wrap:anywhere !important;
    font-size:14px !important;
  }

  .entry-content .lt-tbl tbody tr{
    box-sizing:border-box !important;
    background:#fff !important;
    border:1px solid #e4eaf0 !important;
    border-left:3px solid #93a89b !important;
    border-radius:8px !important;
    padding:7px 11px 8px !important;
    margin:0 0 6px !important;
  }
  .entry-content .lt-tbl tbody tr:last-child{ margin-bottom:0 !important; }

  .entry-content .lt-tbl tbody tr > :first-child{
    text-align:center !important;
    font-size:15px !important; font-weight:700 !important; line-height:1.2 !important;
    color:#12263a !important;
    padding:0 0 4px !important; margin:0 0 5px !important;
    border-bottom:1px dashed #e8edf3 !important;
  }
  .entry-content .lt-tbl tbody tr > :first-child strong{
    font-size:inherit !important; font-weight:inherit !important; color:inherit !important;
    text-transform:none !important; letter-spacing:normal !important;
  }

  .entry-content .lt-tbl tbody tr > *:nth-child(n+2){
    display:flex !important; align-items:baseline !important; flex-wrap:wrap !important;
    gap:2px 12px !important; font-weight:700 !important; color:#1c2b3a !important;
  }
  .entry-content .lt-tbl tbody tr > *:nth-child(n+2) strong{
    display:inline !important; margin:0 auto 0 0 !important;
    font-size:10px !important; line-height:1.4 !important;
    letter-spacing:.06em !important; text-transform:uppercase !important;
    color:#7c8a98 !important; font-weight:600 !important;
  }
  .entry-content .lt-tbl tbody tr > *:nth-child(n+2) br{ display:none !important; }
  .entry-content .lt-tbl tbody tr > *:empty{ display:none !important; }

  /* ---- название таблицы — по центру ---- */
  .entry-content .lt-tbl caption{
    display:block !important; width:100% !important; box-sizing:border-box !important;
    text-align:center !important;
    font-size:15px !important; font-weight:700 !important; line-height:1.3 !important;
    color:#12263a !important;
    margin:0 0 8px !important; padding:0 !important;
  }
}
