/* Vista de andén (usa los colores de styles.css, claro u oscuro) */
html, body.an-page { height: auto !important; min-height: 100%; overflow: auto !important; overscroll-behavior: auto !important; }
body.an-page { background: var(--bg); color: var(--text); font: 15px/1.45 var(--sans); }
body.sheet-open { overflow: hidden !important; }
.mono { font-family: var(--mono); }

.an-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--glass-2); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
.an-back { display: inline-flex; align-items: center; gap: 4px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px; padding: 8px 10px 8px 4px; border-radius: 8px; }
.an-back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.an-back:hover { color: var(--blue); }
.an-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; margin-right: auto; }
.an-tools { display: flex; gap: 8px; }

.an-main { max-width: 860px; margin: 0 auto; padding: 18px 16px 8px; }
.an-main h1 { font-size: 28px; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
.an-sub { color: var(--muted); margin: 6px 0 0; }
.an-h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 8px; }
.an-h3 { font-size: 15px; margin: 18px 0 8px; }
.an-msg { color: var(--muted); min-height: 1.2em; margin: 10px 0 0; }
.an-msg:empty { min-height: 0; margin: 0; }

/* Selector */
.an-searchrow { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.an-searchrow input { flex: 1 1 240px; min-height: 48px; padding: 0 14px; font: 16px var(--sans); color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; outline: none; }
.an-searchrow input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 25%, transparent); }
.an-near { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); font-weight: 600; }
.an-near svg { width: 20px; height: 20px; fill: none; stroke: var(--blue); stroke-width: 1.8; }
.an-near:hover { border-color: var(--blue); }
.an-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.an-results button { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 50px; padding: 0 14px; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.an-results button:hover, .an-results button:focus-visible { border-color: var(--blue); outline: none; }
.an-results button span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.an-none { color: var(--muted); padding: 10px 2px; }

/* Panel */
.an-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.an-link { background: none; border: 0; padding: 4px 0; color: var(--blue); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.an-clock { font: 700 30px/1 var(--mono); color: var(--text); letter-spacing: .02em; }
.an-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 16px 0 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; position: sticky; top: 63px; z-index: 5; }
.an-tabs button { min-height: 42px; border: 0; border-radius: 9px; background: transparent; font-weight: 700; font-size: 15px; color: var(--muted); }
.an-tabs button b { font-weight: 600; opacity: .7; margin-left: 4px; }
.an-tabs button[aria-selected="true"] { background: var(--on); color: var(--on-fg); }
.an-tabs button:focus-visible { outline: 3px solid var(--blue); outline-offset: 1px; }

.an-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.an-row { width: 100%; display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; text-align: left; padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; transition: border-color .15s, box-shadow .15s; }
.an-row:hover, .an-row:focus-visible { border-color: var(--blue); outline: none; box-shadow: 0 2px 10px var(--shadow); }
.an-row.here { border-left: 4px solid var(--blue); padding-left: 11px; }
.an-row.changed { animation: an-flash 2.4s ease-out 1; border-color: var(--amber); }
@keyframes an-flash { 0% { background: color-mix(in srgb, var(--amber) 28%, var(--panel)); } 100% { background: var(--panel); } }
.an-time { display: grid; line-height: 1.1; }
.an-time b { font: 700 20px/1.1 var(--mono); }
.an-time s { color: var(--faint); font: 13px var(--mono); margin-top: 2px; }
.an-mid { display: grid; min-width: 0; gap: 1px; }
.an-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.an-dest { font-size: 17px; line-height: 1.2; overflow-wrap: anywhere; }
.an-prod { color: var(--muted); font-size: 13px; }
.an-mark { font-style: normal; color: var(--grey); border: 1px dashed var(--grey); border-radius: 5px; padding: 0 4px; font-size: 11.5px; white-space: nowrap; }
.an-pos { color: var(--muted); font-size: 12.5px; }
.an-pos:empty { display: none; }
.an-chg { justify-self: start; margin-top: 3px; font-size: 11.5px; font-weight: 700; color: var(--amber); }
.an-right { display: grid; justify-items: end; gap: 4px; text-align: right; }
.an-cd { font-weight: 800; font-size: 17px; white-space: nowrap; }
.an-cd.soon { color: var(--amber); }
.an-cd.now { color: var(--blue); }
.an-plat { font-weight: 700; font-size: 13px; padding: 2px 8px; border-radius: 6px; background: var(--on); color: var(--on-fg); white-space: nowrap; }
.an-dl { font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: 999px; white-space: nowrap; border: 1px solid currentColor; }
.an-dl.green { color: var(--green); } .an-dl.amber { color: var(--amber); } .an-dl.red { color: var(--red); } .an-dl.grey { color: var(--grey); font-weight: 600; }
.an-empty { color: var(--muted); padding: 22px 16px; text-align: center; background: var(--panel); border: 1px dashed var(--line); border-radius: 14px; }
.an-upd { color: var(--faint); font-size: 12.5px; margin: 12px 0 0; }

/* Ventana de detalle: panel lateral en escritorio, hoja inferior en móvil */
.an-sheet-back { position: fixed; inset: 0; z-index: 40; background: var(--backdrop); }
.an-sheet { position: fixed; z-index: 41; top: 0; right: 0; bottom: 0; width: min(460px, 100%); display: flex; flex-direction: column;
  background: var(--modal-bg); border-left: 1px solid var(--line); box-shadow: -10px 0 40px var(--shadow); }
.an-sheet-head { display: flex; justify-content: space-between; gap: 10px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.an-sheet-head h2 { font-size: 20px; }
.an-x { flex: none; width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); font-size: 22px; line-height: 1; }
.an-sheet-body { overflow: auto; padding: 14px 18px 22px; -webkit-overflow-scrolling: touch; }
.an-now { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.an-now span { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.an-now b { font-size: 16px; }
.an-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.an-stat { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); display: grid; gap: 2px; }
.an-stat span { font-size: 12px; color: var(--muted); }
.an-stat b { font-size: 18px; } .an-stat b small { font-size: 13px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.an-stat b.green { color: var(--green); } .an-stat b.amber { color: var(--amber); } .an-stat b.red { color: var(--red); } .an-stat b.grey { color: var(--grey); font-size: 15px; }
.an-hint { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.an-stops { list-style: none; margin: 0; padding: 0; }
.an-stops .st { position: relative; display: flex; justify-content: space-between; gap: 10px; padding: 7px 0 7px 26px; border-left: 0; }
.an-stops .st i { position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--blue); }
.an-stops .st i::after { content: ""; position: absolute; left: -4px; top: 50%; margin-top: -5px; width: 10px; height: 10px; border-radius: 50%; background: var(--panel); border: 2px solid var(--blue); box-sizing: border-box; }
.an-stops .st:first-child i { top: 50%; } .an-stops .st:last-child i { bottom: 50%; }
.an-stops .st.passed { color: var(--faint); } .an-stops .st.passed i { background: var(--faint); } .an-stops .st.passed i::after { border-color: var(--faint); background: var(--faint); }
.an-stops .st.next .st-n { font-weight: 700; }
.an-stops .st.here { background: color-mix(in srgb, var(--blue) 10%, transparent); border-radius: 8px; }
.an-stops .st.here i::after { width: 14px; height: 14px; left: -6px; margin-top: -7px; border-width: 3px; border-color: var(--text); }
.an-stops .st.here .st-n { font-weight: 800; }
.an-stops em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--blue); margin-left: 4px; text-transform: uppercase; letter-spacing: .04em; }
.st-t { text-align: right; white-space: nowrap; font-family: var(--mono); font-size: 13px; display: grid; justify-items: end; }
.st-t s { color: var(--faint); } .st-t small { color: var(--muted); font-family: var(--sans); font-size: 11.5px; }
.an-mini { height: 220px; border-radius: 12px; border: 1px solid var(--line); margin-top: 16px; overflow: hidden; }
.an-tip { font: 600 12px var(--sans); }
.an-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.an-btn { flex: 1 1 160px; display: inline-flex; justify-content: center; align-items: center; min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); text-decoration: none; font-weight: 700; }
.an-btn.primary { background: var(--blue); border-color: var(--blue); color: var(--on-accent); }
.an-btn:hover { border-color: var(--blue); }

.an-foot { max-width: 860px; margin: 18px auto 0; padding: 14px 16px 28px; color: var(--faint); font-size: 12.5px; border-top: 1px solid var(--line); }
.an-foot p { margin: 4px 0; } .an-foot a { color: var(--muted); }
[hidden] { display: none !important; }

@media (max-width: 640px) {
  .an-main { padding-top: 14px; }
  .an-main h1 { font-size: 23px; }
  .an-clock { font-size: 22px; }
  .an-brand span { display: none; }
  .an-tabs { top: 59px; }
  .an-row { grid-template-columns: 54px 1fr auto; gap: 10px; padding: 11px 12px; }
  .an-time b { font-size: 17px; }
  .an-dest { font-size: 16px; }
  .an-cd { font-size: 15px; }
  .an-sheet { top: auto; left: 0; width: 100%; max-height: 88dvh; border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; box-shadow: 0 -10px 40px var(--shadow); }
  .an-sheet-body { padding-bottom: max(22px, env(safe-area-inset-bottom)); }
  .an-near { flex: 1 1 100%; justify-content: center; }
}
button.an-btn { font: inherit; font-weight: 700; cursor: pointer; }
