/* Schwartzistan State Railways: a national operator's site. Flag green, signal yellow, white cards. */
html.shell-rail {
  --brand: #0d4b37; --brand-ink: #fff; --cta: #0d4b37; --link: #0b5a8a; --page: #eef1f0; --surface: #fff; --foot: #0a2e23;
  --signal: #f2c230; --font: 'Overpass', system-ui, sans-serif; --mono-font: 'Overpass Mono', ui-monospace, monospace; --radius: 8px;
  --rail: #0d4b37; --bus: #c2410c; --ferry: #1d4ed8; --tram: #7c3aed;
}
.rail-header { border-bottom: 4px solid var(--signal); }
.rail-mark { width: 38px; height: 38px; border-radius: 50%; background: var(--signal); position: relative; flex: none; }
.rail-mark i { position: absolute; left: 7px; right: 7px; top: 16px; height: 6px; background: var(--brand); border-radius: 3px; }
.rail-mark i::before, .rail-mark i::after { content: ""; position: absolute; width: 6px; height: 14px; background: var(--brand); top: -4px; border-radius: 2px; }
.rail-mark i::before { left: 3px; } .rail-mark i::after { right: 3px; }

.badge.mode-rail { background: var(--rail); color: #fff; }
.badge.mode-bus { background: var(--bus); color: #fff; }
.badge.mode-ferry { background: var(--ferry); color: #fff; }
.badge.mode-tram { background: var(--tram); color: #fff; }
.badge.big { font-size: 1.3rem; padding: .4rem .7rem; border-radius: 8px; }
.plat { display: inline-block; font: 600 .72rem/1.4 var(--mono-font); background: #111; color: #fff; padding: .05rem .4rem; border-radius: 3px; vertical-align: middle; margin-left: .3rem; }

/* home */
.rail-home .hero { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.25rem; margin-top: .5rem; }
.hero-card { background: var(--surface); border-radius: 12px; padding: 1.6rem 1.6rem 1.2rem; box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(13,75,55,.08); border-top: 6px solid var(--brand); }
.hero-card h1 { margin-bottom: .3rem; }
.planner { display: grid; grid-template-columns: 1fr 1fr 11rem auto; gap: .75rem; align-items: end; margin: 1.2rem 0 .8rem; }
.planner .btn { height: 46px; background: var(--signal); border-color: var(--signal); color: #111 !important; }
.hero-side { background: var(--brand); color: #fff; border-radius: 12px; padding: 1.4rem; }
.hero-side h2 { margin-top: 0; font-size: 1.05rem; color: #fff; }
.hero-side a { color: #fff; }
.quick { list-style: none; padding: 0; margin: 0 0 1rem; }
.quick li { border-bottom: 1px solid rgba(255,255,255,.18); margin: 0; }
.quick a { display: block; padding: .5rem 0; font-weight: 600; text-decoration: none; }
.quick a:hover { color: var(--signal); }
.hero-side .btn.ghost { color: #fff !important; border-color: #fff; }
.notices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1.5rem 0; }
.notice-card { background: var(--surface); border-radius: 10px; padding: 1rem 1.1rem; border-left: 5px solid var(--brand); }
.notice-card.warn { border-left-color: var(--signal); }
.notice-card h3 { margin: 0 0 .3rem; font-size: 1rem; }
.notice-card p { margin: 0; font-size: .9rem; color: var(--dim); }
.op-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .75rem; }
.op-card { display: flex; flex-direction: column; gap: .3rem; background: var(--surface); border-radius: 10px; padding: 1rem; text-decoration: none !important; color: var(--text) !important; border: 1px solid var(--line); }
.op-card:hover { border-color: var(--brand); box-shadow: 0 4px 14px rgba(0,0,0,.07); }
.op-card .badge { align-self: flex-start; }
.map figure { background: var(--surface); border-radius: 12px; padding: 1rem; margin: 0; }
.map img { width: 100%; border-radius: 6px; }

/* journey results */
.journey-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; background: var(--brand); color: #fff; border-radius: 12px; padding: 1.3rem 1.5rem; }
.journey-head h1 { margin: 0; color: #fff; }
.journey-head .kicker, .journey-head .muted { color: rgba(255,255,255,.8); margin: 0; }
.journey-head .arrow { color: var(--signal); }
.replan { display: flex; gap: .5rem; align-items: end; }
.replan .field { color: rgba(255,255,255,.8); }
.replan .btn { background: var(--signal); border-color: var(--signal); color: #111 !important; height: 46px; }
.daynav { display: flex; justify-content: space-between; gap: 1rem; margin: .75rem 0 1rem; font-weight: 600; font-size: .92rem; }
.daynav a { text-decoration: none; background: var(--surface); padding: .45rem .8rem; border-radius: 6px; border: 1px solid var(--line); }
.journey-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.25rem; align-items: start; }
.results-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.results-bar h2 { margin: 0; }
.classnav { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.classnav a { padding: .35rem .9rem; border-radius: 999px; text-decoration: none; font-weight: 700; font-size: .85rem; color: var(--dim); }
.classnav a.std { background: var(--brand); color: #fff; }
#first:target ~ .results-bar .classnav a.std { background: none; color: var(--dim); }
#first:target ~ .results-bar .classnav a.fst { background: var(--brand); color: #fff; }
.cards { list-style: none; padding: 0; margin: 1rem 0; display: flex; flex-direction: column; gap: .7rem; }
.jcard { background: var(--surface); border-radius: 10px; border: 1px solid var(--line); padding: .9rem 1.1rem; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "times fare" "meta fare" "services services" "detail detail"; gap: .35rem 1rem; margin: 0; }
.jcard:hover { border-color: var(--brand); }
.jc-times { grid-area: times; display: flex; align-items: center; gap: .6rem; font: 700 1.45rem/1 var(--font); }
.jc-times .line-dash { flex: 0 1 90px; height: 2px; background: repeating-linear-gradient(90deg, var(--dim) 0 6px, transparent 6px 10px); }
.jc-times sup { font-size: .6em; color: var(--bad); }
.jc-meta { grid-area: meta; display: flex; gap: .9rem; flex-wrap: wrap; font-size: .88rem; color: var(--dim); }
.jc-meta .status { font-weight: 700; }
.status-ontime .jc-meta .status { color: var(--ok); }
.status-late .jc-meta .status { color: var(--bad); }
.status-planned .jc-meta .status { color: var(--dim); font-weight: 600; }
.jc-services { grid-area: services; }
.jc-fare { grid-area: fare; text-align: right; align-self: center; font: 800 1.25rem/1.1 var(--font); }
.jc-fare small { display: block; font-size: .7rem; font-weight: 600; color: var(--dim); }
.fare-fst { display: none; }
#first:target ~ .cards .fare-std { display: none; }
#first:target ~ .cards .fare-fst { display: inline; }
.jc-detail { grid-area: detail; border-top: 1px dashed var(--line); padding-top: .4rem; font-size: .9rem; }
.jc-detail summary { cursor: pointer; font-weight: 700; color: var(--link); }
.legs { margin: .5rem 0 0; padding-left: 1.1rem; }
.legs li { margin-bottom: .5rem; }
.legs .time { font: 600 .95rem var(--mono-font); }
.route-card { background: var(--surface); border-radius: 12px; padding: 1.1rem 1.2rem; border: 1px solid var(--line); position: sticky; top: 1rem; }
.route-card h2 { margin-top: 0; }
ol.route { list-style: none; padding: 0; margin: 0; }
ol.route li { position: relative; padding: 0 0 .9rem 1.3rem; margin: 0; border-left: 4px solid var(--rail); margin-left: .35rem; }
ol.route li.mode-bus { border-left-color: var(--bus); } ol.route li.mode-ferry { border-left-color: var(--ferry); } ol.route li.mode-tram { border-left-color: var(--tram); }
ol.route li::before { content: ""; position: absolute; left: -9px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--text); }
ol.route .stop { font-weight: 700; }
ol.route .leg { font-size: .9rem; margin-top: .25rem; }
.stop.final { position: relative; font-weight: 700; padding-left: 1.3rem; margin-left: .35rem; }
.stop.final::before { content: ""; position: absolute; left: -7px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--text); }
.fare-table { margin: 1rem 0 .5rem; }
.fare-table th { text-transform: none; letter-spacing: 0; font-size: .85rem; }
.upsell { background: #fff9e0; border: 1px solid #f2d36b; border-radius: 10px; padding: .8rem 1rem; margin: 1rem 0; }
.upsell p { font-size: .88rem; margin: .2rem 0 .6rem; }
.upsell .btn { font-size: .85rem; padding: .55rem .9rem; }
.notes { margin-top: 2rem; }

/* line and operator */
.line-head, .op-head { display: flex; gap: 1rem; align-items: center; background: var(--surface); border-radius: 12px; padding: 1.2rem 1.4rem; border: 1px solid var(--line); }
.line-head h1, .op-head h1 { margin: 0; }
.line-head .muted, .op-head .muted { margin: .2rem 0 0; }
.op-logo { border-radius: 10px; background: var(--soft); }
.boards { margin-top: 1rem; }
.board { background: #10161b; color: #fff; border-radius: 12px; padding: 1rem 1.2rem; }
.board h2 { color: var(--signal); margin: 0 0 .2rem; font-size: 1.05rem; }
.board .muted { color: rgba(255,255,255,.65); }
.times { display: flex; flex-wrap: wrap; gap: .35rem; }
.times span { font: 600 .9rem/1 var(--mono-font); background: rgba(255,255,255,.08); padding: .4rem .45rem; border-radius: 4px; }
.lines-table td .badge { min-width: 3em; }
.op-list { list-style: none; padding: 0; columns: 2; }

/* ticket form */
.page-head { margin-bottom: 1rem; }
.ticket-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.ticket-form { background: var(--surface); border-radius: 12px; padding: 1.3rem 1.4rem; border-top: 6px solid var(--brand); }
.ticket-form fieldset { border: 0; padding: 0; margin: 0 0 1.2rem; display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.ticket-form legend { font-weight: 800; font-size: 1.05rem; margin-bottom: .6rem; }
.choices { display: flex; gap: 1rem; flex-wrap: wrap; grid-column: 1 / -1; }
.choices label, .check { display: flex; align-items: center; gap: .45rem; font-weight: 600; }
.check { grid-column: 1 / -1; }
.refline { font-size: 1.05rem; background: var(--soft); padding: .7rem 1rem; border-radius: 8px; }
.refline b { font-family: var(--mono-font); letter-spacing: .05em; }
.ticket-aside { background: var(--surface); border-radius: 12px; padding: 1.2rem 1.3rem; }
.ticket-aside h2 { margin-top: 0; }
.confirm-card { background: var(--surface); border-radius: 12px; padding: 2rem; border-top: 6px solid var(--ok); max-width: 760px; }
.ref-big { font-size: 1.2rem; }
.ref-big b { font-family: var(--mono-font); background: var(--soft); padding: .3rem .6rem; border-radius: 6px; letter-spacing: .06em; }
.next { padding-left: 1.2rem; }

@media (max-width: 900px) {
  .rail-home .hero, .journey-grid, .ticket-grid { grid-template-columns: 1fr; }
  .planner { grid-template-columns: 1fr 1fr; }
  .notices { grid-template-columns: 1fr; }
  .route-card { position: static; }
}
@media (max-width: 520px) { .planner, .ticket-form fieldset { grid-template-columns: 1fr; } .op-list { columns: 1; } }

/* booking flow */
.steps { list-style: none; display: flex; gap: 0; padding: 0; margin: 0 0 1.2rem; counter-reset: st; background: var(--surface); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.steps li { flex: 1; margin: 0; padding: .55rem .9rem; font-size: .85rem; font-weight: 700; color: var(--dim); counter-increment: st; text-align: center; }
.steps li::before { content: counter(st) ". "; }
.steps li.done { color: var(--brand); }
.steps li.current { background: var(--brand); color: #fff; }
.steps a { color: inherit; text-decoration: none; }
.planner { grid-template-columns: 1fr 1fr 11rem 9rem; }
.planner-foot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-top: 1px solid var(--line); padding-top: .8rem; color: var(--dim); }
.planner-foot .btn { min-width: 12rem; }
.jcard { grid-template-areas: "times fare" "meta select" "services select" "detail detail"; }
.jc-select { grid-area: select; align-self: end; justify-self: end; padding: .6rem 1.4rem; }
.basket-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.25rem; align-items: start; }
.basket-main h1 { margin-top: 0; }
.jcard.selected { border: 2px solid var(--brand); display: block; }
.jcard.selected .legs { margin-top: .8rem; }
.class-choice { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.class-choice .opt { display: flex; flex-direction: column; gap: .2rem; background: var(--surface); border: 2px solid var(--line); border-radius: 10px; padding: 1rem; color: var(--text); cursor: pointer; position: relative; }
.class-choice .opt input { position: absolute; top: 1rem; right: 1rem; accent-color: var(--brand); width: 1.1rem; height: 1.1rem; }
.class-choice .opt span { font-size: 1.4rem; font-weight: 800; }
.class-choice .opt small { color: var(--dim); }
.class-choice .opt:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.basket-grid:has(input[value="first"]:checked) .basket-summary .fare-std { display: none; }
.basket-grid:has(input[value="first"]:checked) .basket-summary .fare-fst { display: inline; }
.pax-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: .8rem; }
.pax-grid .field:last-child { grid-column: 1 / -1; }
.basket-summary { background: var(--surface); border-radius: 12px; padding: 1.2rem; border-top: 6px solid var(--signal); position: sticky; top: 1rem; }
.basket-summary h2 { margin-top: 0; }
.basket-summary .btn { width: 100%; margin: .6rem 0; background: var(--signal); border-color: var(--signal); color: #111 !important; }
dl.sum { display: grid; grid-template-columns: 1fr auto; gap: .35rem .8rem; margin: 0; font-size: .92rem; }
dl.sum dd { margin: 0; text-align: right; font-weight: 600; }
dl.sum .total { border-top: 2px solid var(--text); padding-top: .5rem; font-size: 1.15rem; font-weight: 800; }
.upsell.wide { max-width: none; }
@media (max-width: 900px) { .basket-grid, .class-choice, .pax-grid { grid-template-columns: 1fr; } .planner { grid-template-columns: 1fr 1fr; } }

/* e-ticket */
.eticket { background: var(--surface); border-radius: 14px; border: 1px solid var(--line); overflow: hidden; max-width: 860px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.et-head { display: flex; align-items: center; gap: .8rem; background: var(--brand); color: #fff; padding: .9rem 1.2rem; border-bottom: 4px solid var(--signal); }
.et-brand { display: flex; flex-direction: column; line-height: 1.1; } .et-brand small { opacity: .8; font-size: .75rem; }
.et-class { margin-left: auto; display: flex; align-items: center; gap: .5rem; font: 800 1.8rem/1 var(--font); background: #fff; color: var(--brand); border-radius: 6px; padding: .2rem .6rem; }
.et-class small { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.et-class.first { background: var(--signal); color: #111; }
.et-top { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 1.4rem; padding: 1.3rem 1.3rem .6rem; }
.et-code { text-align: center; }
.et-code .sz-qr { width: 100%; max-width: 190px; height: auto; display: block; margin: 0 auto; }
.et-ref { font: 600 1rem var(--mono-font); letter-spacing: .06em; margin: .4rem 0 0; }
.et-main h1 { margin: .1rem 0 .3rem; font-size: clamp(1.4rem, 3vw, 2rem); }
.et-main .arrow { color: var(--dim); font-weight: 400; }
.et-times { display: flex; align-items: center; gap: .6rem; font-size: 1.6rem; margin: .2rem 0; }
.et-times .line-dash { flex: 0 1 6rem; height: 2px; background: var(--line); }
.et-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem 1rem; margin: 1rem 0 0; }
.et-facts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); font-weight: 700; }
.et-facts dd { margin: 0; font-weight: 700; }
.et-ok { color: var(--ok); } .et-bad { color: var(--bad); }
.et-valid { margin: .6rem 1.3rem 0; padding: .7rem .9rem; background: #fff8e1; border-left: 5px solid var(--signal); border-radius: 4px; font-size: .92rem; }
.eticket h2 { margin: 1.4rem 1.3rem .6rem; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); }
.et-legs { list-style: none; margin: 0 1.3rem; padding: 0; }
.et-legs li { display: grid; grid-template-columns: 4rem minmax(0, 1fr) 8.5rem; gap: .8rem; padding: .8rem 0; border-top: 1px solid var(--line); margin: 0; }
.et-legs li:first-child { border-top: 0; }
.et-leg-times { display: flex; flex-direction: column; justify-content: space-between; font: 700 1.05rem var(--mono-font); }
.et-leg-body { border-left: 4px solid var(--rail); padding-left: .8rem; }
.et-legs li.mode-bus .et-leg-body { border-left-color: var(--bus); } .et-legs li.mode-ferry .et-leg-body { border-left-color: var(--ferry); }
.et-leg-body p { margin: .1rem 0; }
.et-seat { background: var(--soft); border-radius: 8px; padding: .5rem; text-align: center; display: flex; flex-direction: column; justify-content: center; font-size: .8rem; color: var(--dim); }
.et-seat b { font-size: 1.8rem; color: var(--text); line-height: 1.1; }
.et-fares { margin: 0 1.3rem; width: calc(100% - 2.6rem); border-collapse: collapse; }
.et-fares .num { text-align: right; white-space: nowrap; }
.et-fares tr.sub td { font-weight: 700; }
.et-fares tr.total td { border-top: 2px solid var(--text); border-bottom: 0; font-size: 1.15rem; font-weight: 800; }
.eticket > .small { margin: .6rem 1.3rem; }
.et-foot { display: flex; align-items: center; gap: 1rem; border-top: 2px dashed var(--line); margin-top: 1rem; padding: 1rem 1.3rem; font-size: .8rem; color: var(--dim); }
.et-foot .sz-barcode { width: 220px; height: 48px; flex: none; }
.et-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.2rem 0; }
.et-actions button.btn { font-family: var(--font); }
.sz-when-cancelled.alert { max-width: 860px; }
html.sz-cancelled .eticket { opacity: .55; filter: grayscale(1); }
@media (max-width: 640px) {
  .et-top { grid-template-columns: 1fr; }
  .et-code .sz-qr { max-width: 160px; }
  .et-legs li { grid-template-columns: 3.4rem minmax(0, 1fr); }
  .et-seat { grid-column: 1 / -1; flex-direction: row; gap: .5rem; align-items: baseline; justify-content: flex-start; }
  .et-seat b { font-size: 1.2rem; }
  .et-fares, .et-fares tbody { display: block; width: auto; }
  .et-fares thead { display: none; }
  .et-fares tr { display: grid; grid-template-columns: 1fr auto; gap: .1rem .6rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
  .et-fares td { border: 0; padding: 0; }
  .et-fares tr.leg { grid-template-columns: auto auto 1fr; }
  .et-fares tr.leg td:first-child { grid-column: 1 / -1; }
  .et-fares tr.leg td:nth-child(2), .et-fares tr.leg td:nth-child(3) { font-size: .8rem; color: var(--dim); text-align: left; }
  .et-fares tr.total { border-bottom: 0; border-top: 2px solid var(--text); }
  .et-fares tr.total td { border: 0; }
  .et-foot { flex-direction: column; align-items: flex-start; }
}
@media print {
  .rail-header, .rail-footer, .steps, .no-print { display: none !important; }
  body { background: #fff !important; }
  .eticket { box-shadow: none; border: 1px solid #000; max-width: none; }
}
