/* ============================================================
   АВТОБУСЫ (portal-v420): поездки по дням, «записано N из M».
   Свой слой, подключается последним; классы с приставкой bs-.
   ============================================================ */

:root {
  --bs-ok: #13795b; --bs-ok-bg: #e3f5ee;
  --bs-high: #9a5b00; --bs-high-bg: #fff3d6;
  --bs-full: #b4233c; --bs-full-bg: #fde8ec;
  --bs-kind: #1f9d6b; --bs-bonus: #d9822b; --bs-special: #3a55b8;
  --bs-soft: var(--surface-card-2, #f7f9fc);
}
[data-theme=dark] {
  --bs-ok: #6fd6ae; --bs-ok-bg: rgba(64, 190, 142, .16);
  --bs-high: #f2c15c; --bs-high-bg: rgba(231, 170, 50, .16);
  --bs-full: #f59aab; --bs-full-bg: rgba(233, 94, 120, .16);
  --bs-kind: #5fd3a3; --bs-bonus: #f0a860; --bs-special: #9db2ff;
  --bs-soft: rgba(255, 255, 255, .04);
}

.bs-ico { display: inline-flex; flex: none; width: 16px; height: 16px; }
.bs-ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bs-link { padding: 0; border: 0; background: none; color: var(--brand); font: inherit; font-weight: 700; cursor: pointer; }
.bs-link:hover { text-decoration: underline; }
[data-theme=dark] .bs-link { color: #f09bba; }

/* ---- Фильтры одной строкой ---- */
.bs-filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-card, 14px); background: var(--panel); box-shadow: var(--shadow);
}
.bs-filters select, .bs-filters input[type=date] {
  height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-control, 10px);
  background: var(--panel); color: var(--text); font: inherit; font-size: 13px;
}
.bs-filters select { min-width: 170px; }
.bs-dates { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.bs-filters .bs-link { margin-left: auto; font-size: 12.5px; }

/* ---- Сводка ---- */
.bs-summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 14px; padding: 12px 16px;
  border: 1px solid var(--line); border-radius: var(--r-card, 14px); background: var(--panel); box-shadow: var(--shadow);
  font-size: 13px; color: var(--text-soft, var(--muted));
}
.bs-sum-parts { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.bs-sum-parts b { color: var(--text); font-size: 15px; }
.bs-sum-full { color: var(--bs-full); font-weight: 700; }
.bs-sum-missing { font-size: 12.5px; }
.bs-fresh { margin-left: auto; font-size: 11.5px; color: var(--muted); }

/* ---- Дни и поездки ---- */
.bs-days { display: grid; gap: 14px; }
.bs-day { border: 1px solid var(--line); border-radius: var(--r-card, 14px); background: var(--panel); box-shadow: var(--shadow); overflow: hidden; }
.bs-day > h3 { display: flex; align-items: center; gap: 8px; margin: 0; padding: 11px 16px; font-size: 14px; background: var(--bs-soft); border-bottom: 1px solid var(--line); }
.bs-day > h3 em { font-style: normal; font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 999px; color: #fff; background: var(--brand); }
.bs-day.is-today { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.bs-trips { display: grid; }
.bs-trip {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) 200px auto; align-items: center; gap: 16px;
  padding: 12px 16px; border-top: 1px solid var(--line);
}
.bs-trip:first-child { border-top: 0; }
.bs-trip:hover { background: var(--bs-soft); }
.bs-trip.is-archived .bs-when b { color: var(--muted); }
.bs-when { display: grid; gap: 5px; justify-items: start; }
.bs-when b { font-size: 18px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.bs-type { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; color: var(--text-soft, var(--muted)); }
.bs-type i { width: 8px; height: 8px; border-radius: 50%; background: var(--bs-kind); }
.bs-type.is-bonus i { background: var(--bs-bonus); }
.bs-type.is-special i { background: var(--bs-special); }
.bs-main { display: grid; gap: 4px; min-width: 0; }
.bs-title {
  justify-self: start; padding: 0; border: 0; background: none; color: var(--text); text-align: left;
  font: inherit; font-size: 14px; font-weight: 700; line-height: 1.35; cursor: pointer;
}
button.bs-title:hover { color: var(--brand); text-decoration: underline; }
[data-theme=dark] button.bs-title:hover { color: #f09bba; }
.bs-title.is-plain { cursor: default; }
.bs-desc {
  margin: 0; font-size: 12px; line-height: 1.45; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.bs-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 2px; }
.bs-meta .bus-center-badge { font-size: 11px; }
.bs-code { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--muted); text-decoration: none; }
.bs-code .bs-ico { width: 13px; height: 13px; }
.bs-code:hover { color: var(--brand); }
[data-theme=dark] .bs-code:hover { color: #f09bba; }

/* «Записано N из M» */
.bs-occ { display: grid; gap: 4px; min-width: 0; }
.bs-occ-bar { height: 7px; border-radius: 999px; background: var(--bs-soft); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.bs-occ-bar i { display: block; height: 100%; border-radius: inherit; background: var(--bs-ok); }
.bs-occ b { font-size: 13.5px; color: var(--text); font-variant-numeric: tabular-nums; }
.bs-occ small { font-size: 11.5px; color: var(--muted); }
.bs-occ.is-ok small { color: var(--bs-ok); font-weight: 700; }
.bs-occ.is-high .bs-occ-bar i { background: var(--bs-high); }
.bs-occ.is-high small { color: var(--bs-high); font-weight: 700; }
.bs-occ.is-full .bs-occ-bar i { background: var(--bs-full); }
.bs-occ.is-full small { color: var(--bs-full); font-weight: 800; }
.bs-occ.is-unknown small, .bs-occ.is-none small { font-style: italic; }
.bs-occ.is-past b { color: var(--text-soft, var(--muted)); }

.bs-actions { display: flex; gap: 4px; justify-content: flex-end; }
.bs-act {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--text-soft, var(--muted)); cursor: pointer;
}
.bs-act:hover { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
[data-theme=dark] .bs-act:hover { color: #f09bba; }

.bs-pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.bs-pager button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--text); cursor: pointer; }
.bs-pager button:disabled { opacity: .45; cursor: default; }

/* ---- Узкие экраны ---- */
@media (max-width: 1100px) {
  .bs-trip { grid-template-columns: 84px minmax(0, 1fr) 170px; }
  .bs-actions { grid-column: 2 / -1; justify-content: flex-start; }
}
@media (max-width: 720px) {
  .bs-filters select { flex: 1 1 140px; min-width: 0; }
  .bs-dates { flex: 1 1 100%; }
  .bs-dates input[type=date] { flex: 1 1 0; min-width: 0; }
  .bs-filters .bs-link { margin-left: 0; }
  .bs-fresh { margin-left: 0; }
  .bs-trip {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "when actions" "main main" "occ occ";
    gap: 10px; padding: 12px;
  }
  .bs-when { grid-area: when; display: flex; align-items: center; gap: 10px; }
  .bs-actions { grid-area: actions; grid-column: auto; }
  .bs-main { grid-area: main; }
  .bs-occ { grid-area: occ; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; column-gap: 10px; }
  .bs-occ-bar { grid-column: 1; }
  .bs-act { width: 36px; height: 36px; }
}
