/* Справочник штрафов (T5) и карточка состава (T4).
   Только то, чего нет в main.css. Mobile-first, брейкпоинты 768 и 1200. */

/* Высота залипания под шапкой: 56 + 1 px границы; на деске + строка разделов */
:root { --dir-top: 57px; }
@media (min-width: 768px) { :root { --dir-top: 113px; } }

/* ─── Справочник: раскладка ──────────────────────────────────────── */
.dir { display: flex; flex-direction: column; gap: 12px; }
.dir__body { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.dir__intro { gap: 8px; }

/* Sticky-панель фильтров: при 21 строке она обязательна (NOTES.dir) */
.dir__filters {
  position: sticky; top: var(--dir-top); z-index: 20;
  display: flex; flex-direction: column; gap: 9px;
  padding: 10px 0 11px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.dir__search { gap: 9px; }
.dir__search input { min-width: 0; }
.dir__go { flex: 0 0 auto; }

.dir__chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.dir__chips::-webkit-scrollbar { display: none; }
.dir__chips .chip { flex: 0 0 auto; white-space: nowrap; gap: 6px; }
.chip__n { display: none; font-size: 12px; color: var(--ink-4); font-weight: 600; }
.chip[aria-pressed="true"] .chip__n { color: #C9CBD1; }

.dir__meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.dir__count { margin: 0; }
.dir__sort { flex: 0 0 auto; }
.dir__noscript { margin: 2px 0 0; }

/* ─── Таблица ≥768 / карточки-строки <768 ────────────────────────── */
.dir__table { display: none; }
@media (min-width: 768px) {
  .dir__table {
    display: block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-card);
  }
  .dir__rows { display: none; }
  .dir__table .table caption { padding: 0 14px 12px; }
  .dir__table .table th, .dir__table .table td { padding: 12px 10px; }
  .dir__table .table thead th:first-child,
  .dir__table .table tbody tr > *:first-child { padding-left: 14px; }
  .dir__table .table thead th:last-child,
  .dir__table .table tbody tr > *:last-child { padding-right: 14px; }
}
@media (min-width: 1200px) {
  .dir__table .table th, .dir__table .table td { padding: 13px 14px; }
}

/* Зебру считает JS, чтобы она не ломалась при скрытых строках */
.dir__table .table tbody tr:nth-child(even) { background: transparent; }
.dir__table .table tbody tr.is-alt { background: #FBFAF8; }
.dir__table .table tbody tr:hover { background: var(--bg); }

.dir__art { color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.dir__nm { font-weight: 500; font-size: 14.5px; line-height: 1.35; }
.dir__nm a { color: var(--ink); text-decoration: none; }
.dir__nm a:hover { color: var(--acc); text-decoration: underline; }
.dir__alt { display: block; margin-top: 3px; font-size: 12px; font-weight: 400; color: var(--warn-ink); }
.dir__disc { color: var(--ok); }
.dir__nodisc { color: var(--ink-4); font-weight: 500; }
.dir__ap { white-space: nowrap; }
.dir__apnote { display: block; margin-top: 4px; font-size: 11.5px; color: var(--ink-4); white-space: normal; }
.dir__fix { font-size: 13px; color: var(--ink-2); }
.dir__src { line-height: 1.5; }

/* Строки, отсеянные фильтром: одинаково для таблицы и карточек */
.is-hidden { display: none !important; }

.rowcard__name, .rowcard__k, .rowcard__v { display: block; }
.rowcard__v--txt { font-weight: 500; }
.rowcard__alt { margin-top: 8px; font-size: 12px; color: var(--warn-ink); line-height: 1.4; }
.dir__rows .rowcard .badge { flex: 0 0 auto; }
.dir__empty { margin: 4px 0; }
.dir__empty[hidden] { display: none; }

@media (min-width: 1200px) {
  /* Фильтры уезжают в левую колонку 260 — как в десктопном макете */
  .dir { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; align-items: start; }
  .dir__filters {
    top: calc(var(--dir-top) + 15px);
    gap: 16px; padding: 0; border-bottom: 0; background: none;
  }
  .dir__chips { flex-direction: column; flex-wrap: nowrap; overflow: visible; gap: 2px; }
  .dir__chips .chip {
    width: 100%; min-height: 44px; justify-content: space-between;
    border-color: transparent; background: none; border-radius: var(--r-ctl);
  }
  .dir__chips .chip:hover { background: var(--bg-2); border-color: transparent; }
  .dir__chips .chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); }
  .chip__n { display: inline; }
  .dir__meta { flex-direction: column; align-items: stretch; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
  .dir__sort { align-self: flex-start; }
}

/* ─── Карточка состава (T4) ──────────────────────────────────────── */
.fine { display: block; }
.fine__col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.fine__head { display: flex; flex-direction: column; gap: 7px; }
.fine__h1 { font-size: 25px; line-height: 1.16; }
.fine__lead { margin: 0; }
.fine__src { line-height: 1.5; }
/* До 1200 правая колонка идёт в потоке следом за карточкой: на телефоне
   соседние составы нужны не меньше, чем на десктопе. */
.fine__side { display: flex; flex-direction: column; gap: 16px; margin-top: 22px; }

/* Ответ в первых 320 px: сумма, скидка, три плитки (NOTES.fine) */
.fine-sum { display: flex; flex-direction: column; gap: 0; }
.fine-sum__v { margin: 5px 0 4px; }
.fine-sum__note { margin: 0; }
.fine-sum__alt { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; color: var(--ink-2); }

.fine-disc {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 13px; padding: 11px 12px;
  background: var(--ok-soft); border-radius: 9px;
}
.fine-disc__title { font-size: 13.5px; font-weight: 700; color: var(--ok); line-height: 1.3; }
.fine-disc__d { margin: 3px 0 0; font-size: 12px; line-height: 1.4; color: #2F6B4F; }
.fine-disc__v { flex: 0 0 auto; color: var(--ok); }
.fine-disc--no { background: var(--bg); }
.fine-disc--no .fine-disc__title { color: var(--ink); }
.fine-disc--no .fine-disc__d { color: var(--ink-3); }
.fine-disc--no .fine-disc__v { color: var(--ink-4); }

.fine-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.fine-tile { background: var(--bg); border-radius: 9px; padding: 10px 11px; min-width: 0; }
.fine-tile__k { display: block; font-size: 11px; color: var(--ink-3); margin-bottom: 3px; }
.fine-tile__v { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.fine-tile--ok { background: var(--ok-soft); }
.fine-tile--ok .fine-tile__v { color: var(--ok); }
.fine-tile--warn { background: var(--warn-soft); }
.fine-tile--warn .fine-tile__v { color: var(--warn-ink); }
.fine-tile--err { background: var(--err-soft); }
.fine-tile--err .fine-tile__v { color: var(--err); }

.alert__ico { flex: 0 0 auto; margin-top: 1px; display: flex; }

.fine-tool { display: flex; flex-direction: column; gap: 7px; }
.fine-tool__k { margin: 0; }
.fine-tool__t { font-size: 15.5px; font-weight: 700; line-height: 1.35; }
.fine-tool .btn { margin-top: 5px; }

.fine-how { display: flex; flex-direction: column; gap: 9px; }
.fine-how__badge { display: flex; }
.fine-fix { display: grid; gap: 8px; margin-top: 8px; }
.fine-fix__t { font-size: 14px; font-weight: 700; margin-bottom: 4px; }

.fine-terms { padding: 2px 14px; }
.fine-term { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.fine-term:first-child { border-top: 0; }
.fine-term__n { flex: 0 0 74px; font-size: 14px; font-weight: 700; }
.fine-term__n--acc { color: var(--acc); }
.fine-term__n--ink { color: var(--ink); }
.fine-term__n--err { color: var(--err); }
.fine-term__d { font-size: 13px; line-height: 1.45; color: var(--ink-25); }

.fine-appeal { display: flex; flex-direction: column; gap: 10px; }
.fine-appeal__head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.fine-appeal p { margin: 0; }
.fine-appeal .btn { align-self: flex-start; margin-top: 2px; }

.fine-remind { display: flex; flex-direction: column; gap: 8px; }
.fine-remind .btn { align-self: flex-start; margin-top: 4px; }

/* A6 · sticky-низ: высота зарезервирована паддингом body, CLS 0 (§12) */
.ad--a6 {
  position: fixed; left: 8px; right: 8px;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 6px);
  height: 50px; z-index: 35;
}
body.has-a6 { padding-bottom: calc(var(--tabbar-h) + 62px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 768px) {
  .ad--a6 { display: none; }
  body.has-a6 { padding-bottom: 0; }
}

@media (min-width: 768px) {
  .fine__col { gap: 26px; }
  .fine__h1 { font-size: 36px; line-height: 1.1; }
  .fine-sum__v { margin: 6px 0 6px; font-size: 56px; letter-spacing: -.035em; }
  .fine-tiles { grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
  .fine-tile { padding: 12px 14px; border-radius: 10px; }
  .fine-tile__k { font-size: 11.5px; }
  .fine-tile__v { font-size: 15px; }
  .fine-disc { margin-top: 18px; padding: 14px 16px; border-radius: 11px; }
  .fine-disc__title { font-size: 15px; }
  .fine-tool__t { font-size: 20px; }
  .fine-fix { grid-template-columns: 1fr 1fr; gap: 16px; }
  .fine-fix__t { font-size: 16px; }
  .fine-terms { padding: 4px 20px; }
  .fine-term { gap: 20px; padding: 15px 0; align-items: baseline; }
  .fine-term__n { flex: 0 0 96px; font-size: 19px; }
  .fine-term__d { font-size: 15px; line-height: 1.5; }
}

@media (min-width: 1200px) {
  .fine { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; }
  .fine__side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: calc(var(--dir-top) + 15px); }
  .fine__col { max-width: 780px; }
}

/* Печать: sticky и колонки не нужны (§14 Print) */
@media print {
  .dir__filters, .dir__rows, .dir__empty, .fine__side { display: none !important; }
  .dir, .fine { display: block !important; }
  .dir__table { display: block !important; border: 0; }
}

/* ─── Действия на карточке состава: закладка и напоминание ─────────
   До августа 2026 «В закладки» жило только на шести страницах журнала.
   Человек, пришедший из поиска на карточку штрафа — самый частый вход на
   сайт, — не мог сохранить ничего. Теперь может. */
.fine__actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.fine__actions > * { flex: 1 1 auto; }
@media (min-width: 768px) {
  .fine__actions { gap: 10px; margin: 18px 0 6px; }
  .fine__actions > * { flex: 0 0 auto; }
}
