* { box-sizing: border-box; }
html { font-size: clamp(0.875rem, 0.7rem + 0.5vw, 1.25rem); }
body { font-family: Arial, sans-serif; margin: 0; padding: 1rem 1.25rem;
       background: #f4f6f8; color: #222; }
h1 { font-size: 1.35rem; margin: 0 0 1rem; font-weight: normal; }
.wrap { max-width: 100rem; margin: 0 auto; }

/* Верхняя панель: кнопки года + действия */
.topline { margin-bottom: 0.75rem; }
.year-row { display: flex; flex-wrap: wrap; gap: 0.375rem; align-items: center; margin-bottom: 0.5rem; }
.year-label { font-size: 0.8125em; color: #555; margin-right: 0.25rem; }
.year-btn { display: inline-block; padding: 0.3em 0.9em; border: 1px solid #1a73a8;
            border-radius: 1rem; color: #1a73a8; text-decoration: none; font-size: 0.8125em; }
.year-btn:hover { background: #dceaf3; }
.year-btn.active { background: #1a73a8; color: #fff; }
.topline-actions { display: flex; gap: 0.75rem; }

.export-link { display: inline-block; padding: 0.375em 0.75em; border: 1px solid #1a73a8;
               border-radius: 0.25rem; color: #1a73a8; text-decoration: none; font-size: 0.8125em; }
.export-link:hover { background: #1a73a8; color: #fff; }
.reset-link { color: #b03a2e; border-color: #b03a2e; }
.reset-link:hover { background: #b03a2e; color: #fff; }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid #d8dee4; border-radius: 0.375rem; }
table { border-collapse: collapse; table-layout: fixed; width: 100%; font-size: 0.875rem; }
th, td { border: 1px solid #d8dee4; padding: 0.55em 0.6em; text-align: left; vertical-align: top;
         overflow-wrap: break-word; word-break: break-word; }
thead th { background: #eef2f5; position: sticky; top: 0; z-index: 5;
           font-weight: bold; font-size: 0.8125em; line-height: 1.3; }

/* Ширины колонок: № / код / наименование / уровень / срок / форма / документы */
table th:nth-child(1), table td:nth-child(1) { width: 2.2rem; text-align: center; }
table th:nth-child(2), table td:nth-child(2) { width: 4.5rem; }
table th:nth-child(3), table td:nth-child(3) { width: 24%; }
table th:nth-child(4), table td:nth-child(4) { width: 13%; }
table th:nth-child(5), table td:nth-child(5) { width: 11%; }
table th:nth-child(6), table td:nth-child(6) { width: 11%; }
table th:nth-child(7), table td:nth-child(7) { width: 9rem; text-align: center; }

/* Строка фильтров под шапкой */
.filter-row th { background: #f7f9fb; padding: 0.4em 0.5em; }
.col-filter {
  width: 100%;
  padding: 0.3em 0.4em;
  font-size: 0.8125em;
  font-family: inherit;
  border: 1px solid #c8d0d7;
  border-radius: 0.25rem;
  background: #fff;
  color: #222;
}
.col-filter:focus { outline: none; border-color: #1a73a8; }

.file-btn { background: #1a73a8; color: #fff; border: none; border-radius: 0.25rem;
            padding: 0.333em 0.833em; cursor: pointer; font-size: 0.8125em; white-space: nowrap; }
.file-btn:hover { background: #155a82; }
.file-btn.empty { background: #8a99a3; }
.file-btn.empty:hover { background: #6f808b; }
.empty-note { text-align: center; padding: 2rem; color: #777; }

/* Модальное окно */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45);
           display: none; align-items: center; justify-content: center; z-index: 10; }
.overlay.open { display: flex; }
.modal { background: #fff; border-radius: 0.5rem; width: min(45rem, 92vw);
         max-height: 82vh; display: flex; flex-direction: column; }
.modal-head { padding: 0.875rem 1.125rem; border-bottom: 1px solid #e3e8ec;
              display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 1rem; font-weight: bold; }
.modal-close { border: none; background: none; font-size: 1.375rem; cursor: pointer; color: #555;
               line-height: 1; padding: 0.25em; }
.modal-filter { margin: 0.625rem 1.125rem; padding: 0.5em 0.625em; border: 1px solid #c8d0d7;
                border-radius: 0.25rem; font-size: 0.875rem; width: calc(100% - 2.25rem); }
.modal-body { overflow-y: auto; padding: 0.25rem 1.125rem 1rem; }
.group-header { margin: 0.875rem 0 0.25rem; font-weight: bold; font-size: 0.875em; color: #444;
                border-bottom: 1px solid #e3e8ec; padding-bottom: 0.25rem; }
.group-header:first-child { margin-top: 0.25rem; }
.group-empty { padding: 0.25rem 0.5rem 0.375rem; color: #999; font-size: 0.8125em; font-style: italic; }
.file-item { display: block; padding: 0.4375rem 0.5rem; border-radius: 0.25rem;
             color: #1a5c8a; text-decoration: none; word-break: break-all; }
.file-item:hover { background: #eef4f9; }
.no-files { padding: 1.125rem; color: #666; text-align: center; }
footer { margin-top: 1.25rem; color: #777; font-size: 0.8125em; text-align: center; }

/* Подсказки: отдельный слой поверх страницы */
.th-tip { cursor: help; }
.tip-box {
  position: fixed;
  z-index: 100;
  padding: 0.625rem 0.75rem;
  background: #2b3a44;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: normal;
  line-height: 1.45;
  text-align: left;
  border-radius: 0.375rem;
  opacity: 0;
  transform: translateY(-0.25rem);
  transition: opacity .15s ease, transform .15s ease;
  box-shadow: 0 0.25rem 0.875rem rgba(0,0,0,.25);
  pointer-events: none;
}
.tip-box.show { opacity: 1; transform: translateY(0); }

/* Ноутбуки 1366×768 и уже */
@media (max-width: 1600px) {
  body { padding: 0.75rem; }
  table th:nth-child(3), table td:nth-child(3) { width: 26%; }
  table th:nth-child(4), table td:nth-child(4) { width: 13%; }
  table th:nth-child(5), table td:nth-child(5) { width: 11%; }
  table th:nth-child(6), table td:nth-child(6) { width: 11%; }
  table th:nth-child(7), table td:nth-child(7) { width: 8rem; }
  th, td { padding: 0.45em 0.5em; }
}
@media (max-width: 1100px) {
  table { min-width: 62rem; }
  .wrap { max-width: none; }
}
