/* =====================================================================
   menetrend.derke.hu - alap stiluslap (1-3. fazis)
   Mobile-first; torespontok: 600px, 900px (spec 4.)
   Arculat: a jelenlegi oldal kek-sarga DERKE szinei, letisztultan.
   ===================================================================== */

:root {
    /* mark */
    --c-brand:        #1878ba;   /* fejlec kek */
    --c-brand-dark:   #0e5c94;
    --c-accent:       #f9b000;   /* DERKE sarga sav */
    --c-bg:           #f2f5f8;
    --c-surface:      #ffffff;
    --c-text:         #1c2733;
    --c-text-soft:    #5a6b7c;
    --c-line:         #d8e0e8;
    --c-error:        #b3261e;

    /* jarmutipus-szinek (service_type) - a jelenlegi oldal szinei */
    --st-tram:        #f5a800;   /* 1 villamos */
    --st-trolley:     #e8402a;   /* 2 trolibusz */
    --st-bus:         #1d80c4;   /* 3 busz */
    --st-night:       #3b2a6b;   /* 4,5 ejszakai */
    --st-auchan:      #b04a17;   /* 10 */
    --st-ggy:         #7a1f1f;   /* 11 iranytaxi */
    --st-bu:          #4a6b52;   /* 50 Berettyoujfalu */
    --st-rail:        #2e7d32;   /* 100 kisvasut */
    --st-misc:        #5a6470;   /* 0 es negativ tipusok */

    --radius: 8px;
    --shadow: 0 1px 3px rgba(16, 42, 67, .12);
    --wrap: 1080px;
}

/* PT Sans - sajat kiszolgalas a public/fonts/ mappabol (leiras ott) */
@font-face {
    font-family: 'PT Sans';
    src: url('../fonts/pt-sans-400.woff2') format('woff2');
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'PT Sans';
    src: url('../fonts/pt-sans-700.woff2') format('woff2');
    font-weight: 700; font-style: normal; font-display: swap;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: "PT Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--c-text);
    background: var(--c-bg);
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 12px; }

a { color: var(--c-brand-dark); }

img { max-width: 100%; }

.skip-link {
    position: absolute; left: -9999px; top: 0;
    background: var(--c-surface); padding: 8px 16px; z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* --- Fejlec + nav ---------------------------------------------------- */

.site-header {
    background: var(--c-brand);
    color: #fff;
    border-bottom: 4px solid var(--c-accent);
    position: sticky; top: 0; z-index: 50;
}

.site-header__inner {
    display: flex; align-items: center; gap: 12px;
    min-height: 56px; padding-top: 6px; padding-bottom: 6px;
}

.site-header__brand { color: #fff; text-decoration: none; min-width: 0; }
.site-header__name { display: block; font-weight: 800; letter-spacing: .02em; }
.site-header__sub  {
    display: block; font-size: .72rem; opacity: .85;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.site-header__mod  { display: none; margin: 0 0 0 auto; font-size: .78rem; opacity: .9; }

.nav-toggle {
    margin-left: auto;
    width: 44px; height: 44px;
    background: transparent; border: 0; cursor: pointer;
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    padding: 10px;
}
.nav-toggle span { display: block; height: 3px; background: #fff; border-radius: 2px; }

.main-nav { display: none; background: var(--c-brand-dark); }
.main-nav.is-open { display: block; }
.main-nav ul { list-style: none; margin: 0; padding: 4px 0; }
.main-nav a {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 16px; color: #fff; text-decoration: none; font-weight: 600;
}
.main-nav a.is-active { background: rgba(255, 255, 255, .14); }
.main-nav .badge {
    background: var(--c-accent); color: #1c2733;
    font-size: .72rem; font-weight: 800;
    border-radius: 999px; padding: 1px 7px;
}

@media (min-width: 900px) {
    .site-header__mod { display: block; }
    .nav-toggle { display: none; }
    .main-nav { display: block; }
    .main-nav ul { display: flex; max-width: var(--wrap); margin: 0 auto; padding: 0 12px; }
    .main-nav a { padding: 10px 16px; }
}

/* --- Reklamhelyek (fix magassag, CLS ellen - spec 13.5) --------------- */

.ad-slot {
    max-width: var(--wrap); margin: 10px auto; padding: 0 12px;
    display: flex; align-items: center; justify-content: center;
    color: var(--c-text-soft); font-size: .72rem;
}
.ad-slot--top    { min-height: 100px; }
.ad-slot--bottom { min-height: 100px; }
@media (min-width: 900px) {
    .ad-slot--top    { min-height: 90px; }
    .ad-slot--bottom { min-height: 90px; }
}

/* --- Tartalom kozos elemek -------------------------------------------- */

main { padding-bottom: 24px; }

.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin: 16px 0 8px;
}
.page-head h1 { margin: 0; font-size: 1.35rem; }

.notice {
    background: var(--c-surface); border: 1px solid var(--c-line);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 14px 16px; margin: 12px 0;
}
.notice--error { border-color: var(--c-error); color: var(--c-error); }

/* --- verzio-savok (docs/vonal_verziokezeles.md 5.3) --- */
.notice--future  { border-color: #1d80c4; background: #eef6fc; }
.notice--preview { border-color: #b8860b; background: #fdf7e3; }
.notice--variant { border-color: #7a8a99; background: #f2f5f8; }
.notice--temp    { border-color: #c77b30; background: #fdf1e6; }
.notice__ico     { margin-right: .45rem; font-weight: 700; }
.notice--future a, .notice--preview a, .notice--variant a,
.notice--temp a { font-weight: 600; white-space: nowrap; }

.prose { background: var(--c-surface); border-radius: var(--radius);
         box-shadow: var(--shadow); padding: 16px; }

/* --- Chipek (vonalcsoport-jelvenyek) — az oldal "alairasa" ------------- */

.chip {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; min-width: 44px;
    padding: 6px 14px;
    border-radius: var(--radius);
    font-weight: 800; font-size: 1rem; letter-spacing: .01em;
    text-decoration: none; color: #fff;
    background: var(--st-misc);
    box-shadow: var(--shadow);
    transition: transform .08s ease, box-shadow .08s ease;
}
a.chip:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(16,42,67,.22); }

/* service_type -> szin */
.chip--st1   { background: var(--st-tram); color: #1c2733; }
.chip--st2   { background: var(--st-trolley); }
.chip--st3   { background: var(--st-bus); }
.chip--st4,
.chip--st5   { background: var(--st-night); }
.chip--st10  { background: var(--st-auchan); }
.chip--st11  { background: var(--st-ggy); }
.chip--st50  { background: var(--st-bu); }
.chip--st100 { background: var(--st-rail); }
.chip--st0, .chip--st-1, .chip--st-3, .chip--st-4 { background: var(--st-misc); }

.chip--multi {
    background: var(--c-surface); color: var(--c-brand-dark);
    border: 2px solid var(--c-brand-dark);
}

/* --- Nyito oldal: szekciok, racs es lista nezet ------------------------ */

.vehicle-section {
    background: var(--c-surface); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 12px; margin: 12px 0;
}
.vehicle-section__title {
    display: flex; align-items: center; gap: 8px;
    margin: 0 0 10px; font-size: 1.05rem;
    border-bottom: 2px solid var(--c-line); padding-bottom: 8px;
}

/* racs: div-alapu felsorolas, ami a szelessegtol fuggoen tordelodik */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* lista: a chip a ket utirany-sort atfogja, azok egyutt chip-magassaguak */
.grouplist__group {
    display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid var(--c-line); padding: 6px 0;
}
.grouplist__group:last-child { border-bottom: 0; }
.grouplist__chip { flex-shrink: 0; }
.grouplist__routes {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; justify-content: center;
}
.grouplist__row {
    display: block; padding: 1px 4px;
    line-height: 1.35; text-decoration: none; color: var(--c-text);
    border-radius: 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
a.grouplist__row:hover { background: var(--c-bg); }
.grouplist__row--back { color: var(--c-text-soft); }
.grouplist__row .arrow { color: var(--c-brand); font-weight: 700; }

/* nezetvaltas: a data-view attributum vezerli */
[data-view="grid"] .only-list { display: none; }
[data-view="list"] .only-grid { display: none; }

.view-toggle {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 44px; padding: 8px 14px;
    background: var(--c-surface); color: var(--c-brand-dark);
    border: 2px solid var(--c-brand-dark); border-radius: var(--radius);
    font: inherit; font-weight: 700; cursor: pointer;
}
[data-view="grid"] .view-toggle .ico--grid { display: none; }
[data-view="list"] .view-toggle .ico--list { display: none; }

/* --- Welcome blokk ------------------------------------------------------ */

.welcome {
    background: var(--c-surface); border-radius: var(--radius);
    box-shadow: var(--shadow); margin: 12px 0;
}
.welcome summary {
    cursor: pointer; padding: 12px 16px; font-weight: 700;
    color: var(--c-brand-dark);
}
.welcome__body { padding: 0 16px 12px; }

/* --- Footer ------------------------------------------------------------- */

.site-footer {
    background: var(--c-brand-dark); color: #fff;
    padding: 18px 0; margin-top: 12px; font-size: .9rem;
}
.site-footer a { color: var(--c-accent); }
.site-footer p { margin: 4px 0; }

/* --- Nyomtatas (spec 13.4) ---------------------------------------------- */

@media print {
    .site-header, .main-nav, .ad-slot, .site-footer,
    .view-toggle, .welcome { display: none !important; }
    body { background: #fff; }
    .vehicle-section { box-shadow: none; border: 1px solid #999; }
}

/* =====================================================================
   MENETREND OLDAL (spec 6.) - 4. fazis
   ===================================================================== */

.only-mobile { display: block; }
@media (min-width: 900px) { .only-mobile { display: none !important; } }

/* --- [Fejlec] --------------------------------------------------------- */

.tt-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 12px; margin: 14px 0 4px;
}
.tt-head__rows {
    display: grid;
    grid-template-columns: max-content max-content 1fr;
    gap: 4px 8px; align-items: center;
}
.tt-head__row { display: contents; font-weight: 700; }
.tt-head__row > * { margin: 2px 0; }
.tt-head__badges {
    display: flex; gap: 6px; justify-content: flex-end;
    align-items: center; flex-wrap: wrap;
}
.tt-head .line-badge { width: 45px; min-width: 45px; justify-content: center; }
.tt-head__arrow { color: var(--c-brand); font-size: 1.1em; }
.tt-head__target { font-size: 1.05rem; }

.line-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 34px; padding: 3px 8px;
    border-radius: 6px; font-weight: 800;
    border: 1px solid rgba(0, 0, 0, .18);
}
.line-badge--sm { min-width: 28px; padding: 1px 6px; font-size: .88rem; }
.line-badge--plain { background: var(--c-surface); color: var(--c-text); border: 1px solid var(--c-line); }

.dir-switch {
    flex-shrink: 0;
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 44px; padding: 8px 14px;
    background: var(--c-surface); border: 2px solid var(--c-brand-dark);
    border-radius: var(--radius); color: var(--c-brand-dark);
    font-weight: 700; text-decoration: none;
}
@media (max-width: 899px) {
    .dir-switch { min-width: 44px; padding: 6px 10px; justify-content: center; }
    .dir-switch__ico { font-size: 1.35rem; }
    .dir-switch__txt { display: none; }
}

.tt-valid { margin: 2px 0 10px; color: var(--c-text-soft); }

/* --- [Uzenetek] -------------------------------------------------------- */

.tt-alerts {
    background: #fff8e6; border: 1px solid #e8c268;
    border-radius: var(--radius); padding: 8px 12px; margin: 0 0 12px;
}
.tt-alerts__item {
    display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px;
    padding: 6px 0;
}
.tt-alerts__item + .tt-alerts__item { border-top: 1px dashed #e8c268; }
.tt-alerts__ico { color: #b07a00; }
.tt-alerts__msg { flex: 1; min-width: 200px; }

/* --- ketoszlopos elrendezes -------------------------------------------- */

@media (min-width: 900px) {
    .tt-layout {
        display: grid;
        grid-template-columns: minmax(260px, 380px) minmax(0, 1fr);
        gap: 12px; align-items: start;
    }
}

/* --- [Megallok] --------------------------------------------------------- */

.tt-stops {
    background: var(--c-surface); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 10px; overflow: auto;
}
/* mobilon: rejtett, teljes kepernyos panelkent nyilik (spec 6., mobil) */
@media (max-width: 899px) {
    .tt-stops { display: none; }
    .tt-stops.is-open {
        display: block; position: fixed; inset: 0; z-index: 90;
        border-radius: 0; overflow: auto;
    }
}
.stops-close {
    float: right; width: 40px; height: 40px;
    background: var(--c-bg); border: 1px solid var(--c-line);
    border-radius: 50%; font-size: 1rem; cursor: pointer;
}

/* menetido-valaszto: vekony csikka osszecsukva */
.tid-strip {
    margin-bottom: 6px; border: 1px solid var(--c-line);
    border-radius: 6px; background: var(--c-bg);
}
.tid-strip summary {
    cursor: pointer; padding: 3px 8px;
    font-size: .78rem; color: var(--c-text-soft);
    list-style-position: inside;
}
.tid-strip[open] summary { border-bottom: 1px solid var(--c-line); }

.tid-select {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    padding: 6px 8px; font-size: .85rem;
}
.tid-btn {
    min-width: 34px; min-height: 30px; padding: 2px 8px;
    background: var(--c-bg); border: 1px solid var(--c-line);
    border-radius: 6px; font: inherit; font-size: .85rem; cursor: pointer;
}
.tid-btn.is-active { background: var(--c-brand); color: #fff; border-color: var(--c-brand); }

.tt-stops__table { border-collapse: collapse; width: 100%; table-layout: auto; }
.tt-stops__table th, .tt-stops__table td { padding: 2px 3px; text-align: center; }
.tt-stops__table thead th { padding: 2px 2px 4px; }
.tt-stops__table .line-badge--sm { min-width: 20px; padding: 1px; font-size: .5rem; }
.tt-stops__table tbody tr:nth-child(odd) { background: #f7fafc; }
.tt-stops__table tbody tr.is-selected { background: #fff3c4; font-weight: 700; }

.tt-stops__time {
    font-variant-numeric: tabular-nums; color: var(--c-text-soft);
    width: 30px; font-size: .85rem; white-space: nowrap;
}
.tt-stops__time.is-passed { color: var(--c-line); }
.notserved { color: var(--c-line); }

.tt-stops__namehead button, .stop-btn {
    background: none; border: 0; padding: 4px 2px;
    font: inherit; cursor: pointer; color: var(--c-brand-dark);
}
.tt-stops__namehead button { font-weight: 800; text-decoration: underline; }
.tt-stops__name { text-align: left !important; }
.stop-btn { text-align: left; width: 100%; font-size: .92rem; line-height: 1.25; }
.stop-btn:hover { text-decoration: underline; }
.stop-btn.is-startstop { font-weight: 700; color: var(--c-text); background: #1878ba2e; }
.is-skipped .stop-btn { color: var(--c-text-soft); font-style: italic; }

/* --- [Indulasi idok] ----------------------------------------------------- */

.tt-deps {
    background: var(--c-surface); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 10px;
}
.tt-deps__bar {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 8px; margin-bottom: 8px;
}
.tt-deps__title {
    margin: 0; font-size: .82rem; font-weight: 600;
    color: var(--c-text-soft); text-transform: lowercase;
    display: flex; flex-direction: column; line-height: 1.2;
}
.tt-deps__stopbtn {
    display: inline-flex; align-items: baseline; gap: 6px;
    background: none; border: 0; padding: 0;
    font: inherit; text-align: left; cursor: default;
}
@media (max-width: 899px) {
    .tt-deps__stopbtn { cursor: pointer; }
    .tt-deps__pre { display: none; }   /* mobilon a 📍 + nev helyettesiti */
}
.tt-deps__stop {
    font-size: 1.35rem; font-weight: 800; letter-spacing: .02em;
    color: var(--c-text); text-transform: uppercase;
}
.tt-deps__suffix {
    font-size: .95rem; font-weight: 400; color: var(--c-text-soft);
    text-transform: none;
}

.day-filter { display: flex; gap: 4px; }
.day-btn {
    min-height: 36px; padding: 4px 12px;
    background: var(--c-bg); border: 1px solid var(--c-line);
    border-radius: 6px; font: inherit; font-weight: 600; cursor: pointer;
}
.day-btn.is-active { background: var(--c-brand); color: #fff; border-color: var(--c-brand); }
.day-pick { position: relative; overflow: hidden; }
.day-pick input[type="date"] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer;
    width: 100%; height: 100%;
}

.tt-deps__cols {
    display: flex; gap: 10px; align-items: flex-start;
    overflow-x: auto; /* mobilon vizszintesen gorgetheto */
    -webkit-overflow-scrolling: touch;
}
.dep-col { flex: 1 1 210px; min-width: 210px; }
@media (min-width: 900px) { .dep-col { max-width: 500px; } }
.dep-col__head {
    margin: 0 0 6px; padding: 2px 6px;
    height: 45px;
    display: flex; align-items: center; justify-content: center;
    background: var(--c-brand); color: #fff;
    border-radius: 6px 6px 0 0;
    font-size: .82rem; text-align: center; line-height: 1.3;
}
.dep-col__table {
    border-collapse: separate; border-spacing: 0 1px; /* 1px hezag fent-lent */
    width: 100%;
}
.dep-col__table thead th {
    font-size: .72rem; color: var(--c-text-soft);
    text-align: left; padding: 0 4px 4px;
}
.dep-col__table tbody tr:nth-child(odd) td { background: #f2f6fa; }
.dep-col__table tbody td, .dep-col__table tbody th {
    height: 38px; /* minden ora-sor egyforma magas, ures is */
}
@media (min-width: 900px) {
    .dep-col__table tbody td, .dep-col__table tbody th { height: 26px; }
}

.dep-hour {
    width: 26px;
    padding-right: 3px;
    background: var(--c-brand-dark); color: #fff;
    text-align: right; font-variant-numeric: tabular-nums;
    border-radius: 8px 0 0 8px;
    font-size: 1rem; font-weight: 500; line-height: 1.2;
}
.dep-mins {
    padding: 1px 6px; border-radius: 6px;
    font-size: 0; /* az inline-block elemek kozti whitespace kiiktatasa */
    white-space: nowrap; /* oran belul nincs sortores */
}
.dep-mins > * { font-size: 1.05rem; line-height: 1.3; }
.dep-none { color: var(--c-text-soft); }
.dep-min {
    display: inline-block;
    min-width: 20px; max-width: 20px;
    margin: 0 3px;
    padding: 0 0 0 1px;
    border: 0; border-radius: 2px;
    font-family: inherit;
    font-size: 1.05rem; font-weight: 700; line-height: 1.3;
    text-align: left; font-variant-numeric: tabular-nums;
    cursor: pointer;
    box-shadow: 1px 1px 2px 0 rgba(0, 0, 0, .6);
}
.dep-min:not([style]) { background: #e6edf4; color: var(--c-text); }
.dep-min.is-noacc { color: #b3261e; }
/* mar elhagyta a megallot (Ma nezet) */
.dep-min.is-past {
    background: #9c9c9c !important; color: #fff !important;
    box-shadow: none;
}
/* a kovetkezo indulo jarat */
.dep-min.is-next {
    box-shadow: 0 0 0 2px var(--c-text);
    font-weight: 900;
}
.dep-label td {
    font-size: .82rem !important; color: var(--c-text-soft);
    padding: 4px 6px; white-space: normal;
}
.wholeday-btn {
    margin-left: 6px; padding: 1px 8px;
    background: var(--c-bg); border: 1px solid var(--c-line);
    border-radius: 999px; font: inherit; font-size: .72rem;
    cursor: pointer; display: inline-block;
}
.wholeday-btn.is-active { background: var(--c-brand); color: #fff; border-color: var(--c-brand); }
@media (min-width: 900px) { .wholeday-btn { display: none; } }
.tt-deps__nodep {
    margin: 0 0 8px; padding: 8px 10px;
    background: var(--c-bg); border: 1px dashed var(--c-line);
    border-radius: 6px; font-weight: 700;
}
.dep-min:hover { outline: 2px solid var(--c-brand-dark); }

/* naptipus-tabok: csak mobilon, az "Osszes" gombra bokve (2x2 racsban) */
.dep-tabs { display: none; }
@media (max-width: 899px) {
    .dep-hour { font-size: 1.2rem; }
    .dep-tabs:not([hidden]) {
        display: flex; flex-wrap: wrap; gap: 4px;
        margin: 0 0 8px;
    }
    .dep-tab {
        flex: 0 0 calc(50% - 2px); min-height: 36px; padding: 4px 8px;
        background: var(--c-bg); border: 1px solid var(--c-line);
        border-radius: 8px; font: inherit; font-size: .82rem;
        font-weight: 600; cursor: pointer;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .dep-tab.is-active { background: var(--c-brand); color: #fff; border-color: var(--c-brand); }
    /* egy oszlop a kepernyo szelessegeben */
    .dep-col { flex: 1 0 100%; min-width: 0; max-width: none; }

    /* Ma/Holnap nezet: visszafogott oszlopfejlec a day-filter alatt */
    .mode-simple .dep-col__head {
        background: transparent; color: #444;
        height: auto; padding: 2px 0; margin: 0 0 2px;
        justify-content: flex-start; text-align: left;
        border-radius: 0; font-weight: 700;
    }
}

/* viszonylatjelzes felso indexben - csak .show-sfx modban latszik;
   bekapcsolva a percgombok koze tobb hely kell */
.dep-sfx { display: none; font-size: .62em; font-weight: 800; margin-left: 2px; }
.show-sfx .dep-sfx { display: inline; }
.show-sfx .dep-min { margin-right: 8px; max-width: none; padding-right: 2px; }
.sfx-toggle sup { font-size: .62em; }

.tt-deps__accnote {
    margin: 0 0 6px; padding: 3px 8px;
    font-size: .78rem; color: #b3261e;
    background: #fdecea; border-radius: 6px;
}

.tt-deps__note {
    margin: 10px 0 0; font-size: .82rem; color: var(--c-text);
    border-top: 1px solid var(--c-line); padding-top: 8px;
}
.tt-notice { margin: 4px 0; }
.tt-notice__extra {
    display: inline-block; min-width: 22px; text-align: center;
    border: 1px solid #9c9c9c; border-radius: 4px;
    padding: 0 6px; margin-right: 6px; font-weight: 700;
}

/* --- Jarat-nezet (a megallolista helyen jelenik meg) --------------------- */

body.modal-open { overflow: hidden; }

.tt-trip__head {
    position: sticky; top: 0; background: var(--c-surface);
    padding: 4px 0 8px; border-bottom: 1px solid var(--c-line);
    margin-bottom: 6px;
}
.tt-trip__title {
    margin: 4px 0; font-size: 1rem;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.tt-trip__day { margin: 0; font-size: .82rem; color: var(--c-text-soft); }

.trip-route { list-style: none; margin: 0; padding: 0; }
.trip-route li { border-left: 3px solid var(--c-brand); }
.trip-route li:nth-child(odd) { background: #f7fafc; }
.trip-stop {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 5px 6px;
    background: none; border: 0; font: inherit; text-align: left;
    cursor: pointer; color: var(--c-text);
}
.trip-stop:hover .trip-route__name { text-decoration: underline; }
.trip-route__off {
    width: 26px; flex-shrink: 0; text-align: right;
    font-variant-numeric: tabular-nums; color: var(--c-text-soft);
    font-size: .85rem;
}
.trip-route__name { flex: 1; min-width: 0; }
.trip-route li.is-startstop .trip-route__name { font-weight: 700; }
.trip-route li.is-current { background: #fff3c4; }
.trip-route li.is-current .trip-route__name,
.trip-route li.is-current .trip-route__time { font-weight: 800; }
.trip-route li.is-passed { border-left-color: var(--c-line); }
.trip-route li.is-passed .trip-route__name,
.trip-route li.is-passed .trip-route__time {
    color: var(--c-text-soft); font-weight: 400; opacity: .75;
}
.trip-route__time {
    font-variant-numeric: tabular-nums; font-weight: 700;
    width: 52px; flex-shrink: 0; text-align: right;
}

/* menetrend nyomtatasban: csak a tablazatok */
@media print {
    .day-filter, .tid-select, .dir-switch, #tripView { display: none !important; }
    .tt-layout { display: block; }
    .tt-stops, .tt-deps { box-shadow: none; border: 1px solid #999; margin-bottom: 8px; }
}


/* =====================================================================
   MEGALLOK OLDAL (spec 7. + GPS) - 5. fazis
   ===================================================================== */

.stopsearch {
    background: var(--c-surface); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 12px; margin: 12px 0;
}
.stopsearch__fold summary { list-style-position: inside; }
.stopsearch__foldsum {
    cursor: pointer; font-weight: 700; color: var(--c-brand-dark);
    padding: 4px 0;
}
@media (min-width: 900px) {
    /* desktopon nem csukhato: a summary rejtett, a tartalom mindig latszik */
    .stopsearch__foldsum { display: none; }
    .stopsearch__fold:not([open]) > *:not(summary) { display: block; }
}
.stopsearch__form { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.stopsearch__field { position: relative; }
.stopsearch__field label { display: block; font-size: .82rem; color: var(--c-text-soft); }
.stopsearch__field input[type="text"] {
    width: 100%; min-height: 44px; padding: 8px 10px;
    border: 2px solid var(--c-line); border-radius: var(--radius);
    font: inherit; font-size: 1.05rem;
}
.stopsearch__field input[type="text"]:focus { border-color: var(--c-brand); outline: none; }

.stopsearch__drop {
    position: absolute; left: 0; right: 0; top: 100%; z-index: 40;
    background: var(--c-surface); border: 1px solid var(--c-line);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 6px 16px rgba(16, 42, 67, .18);
    max-height: 320px; overflow: auto;
}
.stopsearch__opt {
    display: block; padding: 10px 12px;
    text-decoration: none; color: var(--c-text);
    border-bottom: 1px solid var(--c-bg);
}
.stopsearch__opt:hover, .stopsearch__opt:focus { background: var(--c-bg); }
.stopsearch__opt[data-first] { font-weight: 700; }

.stopsearch__when { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.stopsearch__when label {
    display: flex; flex-direction: column; font-size: .82rem;
    color: var(--c-text-soft); gap: 2px;
}
.stopsearch__when input {
    min-height: 44px; padding: 6px 8px; font: inherit;
    border: 2px solid var(--c-line); border-radius: var(--radius);
}
.stopsearch__go {
    min-height: 44px; padding: 8px 18px;
    background: var(--c-brand); color: #fff; border: 0;
    border-radius: var(--radius); font: inherit; font-weight: 700;
    cursor: pointer;
}

.stopsearch__geo {
    margin-top: 10px; min-height: 44px; padding: 8px 14px;
    background: var(--c-surface); border: 2px solid var(--c-brand-dark);
    border-radius: var(--radius); color: var(--c-brand-dark);
    font: inherit; font-weight: 700; cursor: pointer;
}
.stopsearch__geo.is-busy { opacity: .6; }
.stopsearch__near ul { list-style: none; margin: 8px 0 0; padding: 0; }
.stopsearch__near li { border-bottom: 1px solid var(--c-bg); }
.stopsearch__nearitem {
    display: block; padding: 8px 4px;
    text-decoration: none; color: var(--c-text);
}
.stopsearch__nearitem:hover { background: var(--c-bg); }
.stopsearch__nearhead {
    display: flex; gap: 6px; align-items: baseline;
}
.stopsearch__nearhead strong { font-weight: 700; }
.stopsearch__nearhead .stopsearch__dist { margin-left: auto; }
.stopsearch__wc { font-size: .9em; }
.stopsearch__nearsub {
    display: block; font-size: .82rem; color: var(--c-text-soft);
    margin: 1px 0 3px;
}
.stopsearch__memlines { display: flex; flex-wrap: wrap; gap: 3px; }
.stopsearch__neartitle { margin: 10px 0 0; font-size: 1rem; }
.stopsearch__dist { color: var(--c-text-soft); font-variant-numeric: tabular-nums; }
.stopsearch__geoerr { color: var(--c-error); margin: 8px 0 0; }

.stophits { background: var(--c-surface); border-radius: var(--radius);
            box-shadow: var(--shadow); padding: 12px; margin: 12px 0; }
.stophits__list { margin: 0; padding-left: 20px; }
.stophits__list li { padding: 4px 0; }

.stopgroup__title {
    display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
    margin: 14px 0 8px; font-size: 1.25rem;
}
.stopgroup__when { font-size: .85rem; font-weight: 400; color: var(--c-text-soft); }

.stopcards { display: grid; gap: 12px; }
@media (min-width: 900px) { .stopcards { grid-template-columns: 1fr 1fr; } }

.stopcard {
    background: var(--c-surface); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 12px;
}
.stopcard__name { margin: 0 0 2px; font-size: 1.05rem;
    display: flex; justify-content: space-between; gap: 8px; }
.stopcard__id { font-size: .75rem; font-weight: 400; color: var(--c-text-soft); }
.stopcard__dir { margin: 0 0 2px; font-size: .88rem; color: var(--c-text-soft); }
.stopcard__street { margin: 0 0 4px; font-size: .85rem; color: var(--c-text-soft); }
.stopcard__lines {
    display: flex; flex-wrap: wrap; gap: 4px;
    margin: 0 0 8px; padding-bottom: 8px;
    border-bottom: 1px solid var(--c-bg);
}
.chip--mini { min-height: 26px; min-width: 32px; padding: 1px 7px; font-size: .82rem; }
.stopcard__none { color: var(--c-text-soft); font-size: .9rem; }

.stopcard__deps { list-style: none; margin: 0; padding: 0; }
.stopcard__dep {
    display: flex; align-items: center; gap: 10px;
    padding: 5px 2px; border-bottom: 1px solid var(--c-bg);
}
.stopcard__dep:last-child { border-bottom: 0; }
.chip--dep { min-height: 32px; min-width: 44px; padding: 2px 8px;
             font-size: .95rem; flex-shrink: 0; }
.stopcard__mid {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; line-height: 1.25;
}
.stopcard__target {
    min-width: 0; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; font-size: .9rem;
}
.stopcard__time {
    font-variant-numeric: tabular-nums; font-weight: 700; font-size: .95rem;
}
.stopcard__time.is-noacc { color: #b3261e; }
.stopcard__wc { font-size: .85em; }
.stopcard__eta {
    flex-shrink: 0; margin-left: auto; text-align: right;
    display: flex; flex-direction: column; align-items: flex-end;
    line-height: 1.05;
}
.stopcard__eta b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.stopcard__eta small { font-size: .68rem; color: var(--c-text-soft); }
/* a jarat vegallomasa itt van: szurkitett sor */
.stopcard__dep.is-last .stopcard__target,
.stopcard__dep.is-last .stopcard__time,
.stopcard__dep.is-last .stopcard__eta b,
.stopcard__dep.is-last .stopcard__eta small { color: #9c9c9c; }
.stopcard__dep.is-last .chip--dep { opacity: .55; }

/* =====================================================================
   FORGALMI HIREK (6. fazis) - dkvhirek integracio
   ===================================================================== */

.news-badge {
    display: inline-block; padding: 1px 8px;
    border-radius: 999px; font-size: .72rem; font-weight: 700;
    vertical-align: middle;
}
.news-badge--planned { background: #e3ecf7; color: #1f5c96; border: 1px solid #a9c8e8; }
.news-badge--updated { background: #fff3d6; color: #8a6100; border: 1px solid #e8c268; }
.news-badge--archived { background: var(--c-bg); color: var(--c-text-soft); border: 1px solid var(--c-line); }

/* --- lista --- */
.newslist { margin: 14px 0; }
.newslist__title { margin: 0 0 8px; font-size: 1.1rem; }
.newscard {
    display: flex; flex-direction: column; gap: 4px;
    background: var(--c-surface); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 12px;
    margin-bottom: 10px; text-decoration: none; color: var(--c-text);
}
.newscard:hover { outline: 2px solid var(--c-brand); }
.newscard--planned { border-left: 4px solid #1f5c96; }
.newscard__head { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.newscard__title { font-size: 1.02rem; line-height: 1.3; }
.newscard__excerpt { font-size: .88rem; color: var(--c-text-soft); line-height: 1.35; }
.newscard__meta { font-size: .78rem; color: var(--c-text-soft); font-variant-numeric: tabular-nums; }
.newslist__archive { margin: 12px 0; }

/* --- reszletek --- */
.newsitem {
    background: var(--c-surface); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 14px; margin: 14px 0;
}
.newsitem__back { margin: 0 0 8px; font-size: .88rem; }
.newsitem__title { margin: 0 0 6px; font-size: 1.35rem; line-height: 1.25; }
.newsitem__meta { margin: 0 0 8px; color: var(--c-text-soft);
    font-variant-numeric: tabular-nums; font-size: .9rem; }
.newsitem__lines { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 10px; }
.newsitem__changed {
    background: #fff8e6; border: 1px solid #e8c268; border-radius: 6px;
    padding: 8px 10px; margin: 0 0 10px; font-size: .9rem;
}
.newsitem__body { line-height: 1.55; overflow-wrap: break-word; }
.newsitem__body img { max-width: 100%; height: auto; }
.newsitem__body table { max-width: 100%; overflow-x: auto; display: block; }
.newsitem__skipped {
    margin-top: 14px; padding-top: 10px;
    border-top: 1px solid var(--c-line);
}
.newsitem__skipped h2 { font-size: 1rem; margin: 0 0 6px; }
.newsitem__skipped ul { margin: 0; padding-left: 20px; }
.newsitem__skipped li { padding: 2px 0; }
.newsitem__skipdesc { color: var(--c-text-soft); font-size: .9rem; }
.newsitem__source { margin: 14px 0 0; font-size: .82rem; color: var(--c-text-soft); }
.newsitem__edited { font-style: italic; }

.tt-alerts__msg a { color: inherit; font-weight: 600; }

/* =====================================================================
   TERKEP (7. fazis) - Leaflet + OSM
   ===================================================================== */

.mapwrap { margin: 14px 0; }

/* --- fo terkep vezerlok --- */
.map-toolbar {
    display: flex; flex-wrap: wrap; gap: 10px 18px;
    align-items: center; margin: 0 0 10px;
}
.map-dirs { display: inline-flex; border: 1px solid var(--c-line);
            border-radius: 999px; overflow: hidden; }
.map-dir {
    min-height: 38px; padding: 6px 16px; border: 0;
    background: var(--c-surface); font: inherit; font-weight: 600;
    cursor: pointer; color: var(--c-text);
}
.map-dir + .map-dir { border-left: 1px solid var(--c-line); }
.map-dir.is-active { background: var(--c-brand); color: #fff; }
.map-allrow { display: inline-flex; align-items: center; gap: 6px;
              font-weight: 600; cursor: pointer; }

/* --- elrendezes: panel + vaszon --- */
.map-body { display: flex; gap: 12px; align-items: stretch; }
.map-panel {
    flex: 0 0 240px; max-height: 70vh; overflow: auto;
    background: var(--c-surface); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 8px;
}
/* a vaszon + a rajta lebego jelmagyarazat kozos kerete */
.map-canvas-wrap { flex: 1; position: relative; display: flex; }
.map-canvas {
    flex: 1; min-height: 70vh; height: 70vh;
    border-radius: var(--radius); box-shadow: var(--shadow);
    background: #e8eef3; z-index: 0;
}
.map-canvas--embed { height: 420px; min-height: 420px; }

/* --- jelmagyarazat a terkepen: az egyes vonalak ki-be kapcsolasa --- */
.map-legend {
    position: absolute; top: 10px; right: 10px; z-index: 500;
    max-width: 260px; max-height: calc(70vh - 20px); overflow: auto;
    background: var(--c-surface); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 8px 10px;
}
.map-legend__head { display: flex; align-items: center; justify-content: space-between;
                    gap: 8px; margin-bottom: 6px; }
.map-legend__title { font-size: .8rem; font-weight: 700; color: var(--c-text-soft); }
.map-legend__clear {
    border: 0; background: none; cursor: pointer; font-size: 1.2rem; line-height: 1;
    color: var(--c-text-soft); padding: 0 2px;
}
.map-legend__clear:hover { color: #c33; }
.map-legend__chips { display: flex; flex-wrap: wrap; gap: 4px; }
.map-legend__chip {
    border: 0; cursor: pointer; min-width: 30px; text-align: center;
    padding: 3px 8px; border-radius: 6px; font-size: .85rem; font-weight: 700;
    font-family: inherit;
}
.map-legend__chip.is-off { opacity: .35; text-decoration: line-through; }
.map-legend__chip:focus-visible { outline: 2px solid var(--c-brand); outline-offset: 1px; }
.map-legend__hint { font-size: .7rem; color: var(--c-text-soft); margin: 6px 0 0; }

@media (max-width: 899px) {
    .map-body { flex-direction: column; }
    .map-panel { flex: none; max-height: 240px; width: 100%; }
    .map-canvas { height: 70vh; }
    .map-canvas--embed { height: 320px; min-height: 320px; }
    /* mobilon a jelmagyarazat ne takarja a terkep felet */
    .map-legend { max-width: 60%; max-height: 40%; font-size: .9em; }
}

/* --- vonalvalaszto (csoportonkent) --- */
.map-group { border-bottom: 1px solid var(--c-bg); }
.map-group__head { cursor: pointer; padding: 6px 4px; font-weight: 700; }
.map-group__toggle { display: inline-flex; align-items: center; gap: 6px; }
.map-lines { list-style: none; margin: 0 0 6px; padding: 0 0 0 4px;
             display: flex; flex-wrap: wrap; gap: 4px; }
.map-lines li { flex: 0 0 auto; }
.map-line { display: inline-flex; align-items: center; gap: 4px;
            cursor: pointer; padding: 2px; }
.map-line__badge {
    display: inline-block; min-width: 30px; text-align: center;
    padding: 2px 8px; border-radius: 6px; font-size: .85rem; font-weight: 700;
}
.map-group-cb:focus-visible + .map-line__badge { outline: 2px solid var(--c-brand); }

/* --- beagyazott terkepek cimei --- */
.tt-map__title, .stops-map__title { font-size: 1.1rem; margin: 0 0 8px; }

/* --- popupok --- */
.map-pop-name a { font-weight: 700; }
.map-pop-dir { color: var(--c-text-soft); }
.map-pop-street { color: var(--c-text-soft); font-size: .9em; }
.leaflet-popup-content { margin: 8px 12px; line-height: 1.4; }
.leaflet-popup-content .chip { margin: 2px 2px 0 0; }
.map-error { padding: 20px; text-align: center; color: var(--c-text-soft); }

/* --- vonalvaltozat-kapcsolo a menetrend fejlecben --- */
.line-toggle {
    border: 0; cursor: pointer; font-family: inherit; font-size: inherit;
    transition: opacity .12s ease;
}
.line-toggle:hover { filter: brightness(1.08); }
.line-toggle:focus-visible { outline: 2px solid var(--c-brand); outline-offset: 2px; }
.line-toggle.is-off { opacity: .3; text-decoration: line-through; }
.line-toggle.is-shake { animation: tt-shake .3s; }
@keyframes tt-shake {
    0%,100% { transform: translateX(0); }
    25%     { transform: translateX(-3px); }
    75%     { transform: translateX(3px); }
}
/* az elrejtett vonal indulasai / menetido-oszlopa */
.is-line-off { display: none !important; }

/* --- indulas alsó indexe: a TT_departure.Extra jel --- */
/* A felso index (.dep-sfx) a VONALVALTOZAT betuje, az also (.dep-x) a
   megjegyzes-jel — a ketto egyszerre is megjelenhet ugyanazon az indulason. */
.dep-x {
    font-size: .62em; font-weight: 700; line-height: 1;
    vertical-align: sub; margin-left: 1px; opacity: .95;
}
.tt-notice__extra {
    display: inline-block; min-width: 1.1em; text-align: center;
    font-weight: 700; margin-right: .35rem;
    border: 1px solid currentColor; border-radius: 3px; padding: 0 3px;
    font-size: .8em;
}

/* --- forgalmi hirek: osszecsukhato kartyak --- */
.newscard { display: block; margin-bottom: 10px; }
.newscard__summary {
    cursor: pointer; list-style: none; padding: 12px 14px;
    background: var(--c-surface); border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.newscard__summary::-webkit-details-marker { display: none; }
.newscard__summary::after {
    content: '▾'; float: right; margin-left: 8px;
    color: var(--c-text-soft); transition: transform .15s ease;
}
.newscard[open] > .newscard__summary::after { transform: rotate(180deg); }
.newscard[open] > .newscard__summary { border-radius: var(--radius) var(--radius) 0 0; }
.newscard__summary:hover { filter: brightness(.985); }
.newscard__head { display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
                  margin-bottom: 4px; }
.newscard__title { display: block; }
.newscard__meta, .newscard__excerpt {
    display: block; color: var(--c-text-soft); font-size: .85rem; margin-top: 2px;
}
.newscard[open] > .newscard__summary .newscard__excerpt { display: none; }
.newscard__body {
    background: var(--c-surface); border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow); padding: 2px 14px 14px;
}
.newscard__loading, .newscard__error { color: var(--c-text-soft); padding: 8px 0; }
.news-badge--pinned { background: none; padding: 0 2px; }

/* a ?alertid= linkkel nyitott hir ne bujjon a fejlec ala */
.newscard { scroll-margin-top: 12px; }
.newslist__foot { margin: 18px 0; }

/* --- indulasi megjegyzesek (TT_notice) --- */
/* felul: Extra-val jelolt, indulas-specifikus | alul: altalanos, jel nelkul */
.tt-deps__note--top {
    margin: 0 0 10px; padding: 8px 10px;
    background: #fbf7ec; border-left: 3px solid #c9a227; border-radius: 4px;
}
.tt-notice { margin: 2px 0; font-size: .85rem; line-height: 1.45;
             display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px; }
.tt-notice__txt { flex: 1 1 auto; min-width: 12ch; }
