:root {
  --primary: #FF6B00;
  --primary-2: #FF8A1F;
  --accent: #FFC400;
  --bg: #FFF8F1;
  --surface: #FFFFFF;
  --surface2: #FFF1E4;
  --text: #1E1B4B;
  --muted: #6B6890;
  --border: #F1DCC8;
  --ok: #16A34A;
  --warn: #D97706;
  --bad: #DC2626;
  --blue: #2563EB;
  --shadow: 0 6px 24px rgba(30, 27, 75, .08);
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #13112B;
    --surface: #1E1B3A;
    --surface2: #2A2650;
    --text: #F4F2FF;
    --muted: #A9A6CC;
    --border: #3A3566;
    --ok: #4ADE80;
    --warn: #FBBF24;
    --bad: #F87171;
    --blue: #60A5FA;
    --shadow: 0 6px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 Nunito, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
a { color: var(--primary); }
h1, h2, h3, .brand { font-family: "Baloo 2", Nunito, sans-serif; line-height: 1.15; margin: 0 0 .4em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.12rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.tiny { font-size: .82rem; }
.center { text-align: center; }
.hidden { display: none !important; }

/* ---------- Intro ---------- */
.intro {
  position: fixed; inset: 0; z-index: 100;
  background: radial-gradient(circle at 50% 40%, var(--primary-2), var(--primary) 70%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; opacity: 0; pointer-events: none; transition: opacity .35s;
}
.intro.on { opacity: 1; pointer-events: all; }
.intro-logo { position: relative; width: 132px; height: 132px; }
.intro-logo img { width: 100%; height: 100%; border-radius: 30px; box-shadow: 0 14px 40px rgba(0,0,0,.25); position: relative; animation: pop .7s cubic-bezier(.2,1.6,.4,1) both; }
.ring { position: absolute; inset: 0; border-radius: 34px; border: 4px solid var(--accent); opacity: 0; }
.intro.on .r1 { animation: ring 1.1s .35s ease-out infinite; }
.intro.on .r2 { animation: ring 1.1s .6s ease-out infinite; }
.intro-name { font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 2.6rem; margin-top: 18px; letter-spacing: .5px; animation: up .6s .25s both; }
.intro-tag { opacity: .9; font-weight: 700; animation: up .6s .4s both; }
@keyframes pop { from { transform: scale(.4) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ring { from { transform: scale(1); opacity: .9; } to { transform: scale(1.7); opacity: 0; } }
@keyframes up { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Botones y formularios ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 14px; padding: 13px 18px; min-height: 48px;
  background: var(--primary); color: #fff; font: 800 1rem Nunito, sans-serif; cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 107, 0, .3); transition: transform .1s, filter .2s;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--text); border: 1.5px solid var(--border); box-shadow: none; }
.btn.ok { background: var(--ok); box-shadow: none; }
.btn.bad { background: var(--bad); box-shadow: none; }
.btn.sm { min-height: 38px; padding: 8px 14px; font-size: .9rem; border-radius: 11px; }
.btn.google { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); box-shadow: none; width: 100%; }
.link { background: none; border: 0; color: var(--primary); font: 700 .92rem Nunito, sans-serif; cursor: pointer; padding: 6px 0; }
.icon-btn { background: none; border: 0; color: var(--text); font-size: 1.4rem; width: 44px; height: 44px; border-radius: 12px; cursor: pointer; }
.icon-btn:hover { background: var(--surface2); }

label.f { display: block; margin-bottom: 14px; font-weight: 700; font-size: .92rem; }
label.f > span.h { display: block; color: var(--muted); font-weight: 600; font-size: .8rem; margin-top: 3px; }
.input {
  width: 100%; margin-top: 6px; padding: 12px 14px; min-height: 48px;
  border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface);
  color: var(--text); font: 600 1rem Nunito, sans-serif;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,107,0,.18); }
textarea.input { resize: vertical; min-height: 90px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; margin: 6px 0 16px; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--primary); flex: none; }

.roles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 14px; }
.role-opt { position: relative; }
.role-opt input { position: absolute; opacity: 0; }
.role-opt span {
  display: block; text-align: center; padding: 14px 8px; border-radius: 14px; border: 2px solid var(--border);
  font-weight: 800; cursor: pointer; background: var(--surface);
}
.role-opt span b { display: block; font-size: 1.6rem; }
.role-opt input:checked + span { border-color: var(--primary); background: var(--surface2); }
.role-opt input:focus-visible + span { box-shadow: 0 0 0 3px rgba(255,107,0,.3); }

/* ---------- Estructura ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card.hero { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border: 0; }
.card.hero .muted { color: rgba(255,255,255,.88); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.auth { max-width: 440px; margin: 0 auto; padding: 32px 16px 40px; }
.auth-brand { text-align: center; margin-bottom: 18px; }
.auth-brand .logo { border-radius: 22px; box-shadow: 0 10px 30px rgba(255,107,0,.35); }
.auth-brand h1 { font-size: 2.3rem; margin: 10px 0 0; color: var(--primary); }

.tabs { display: flex; gap: 6px; background: var(--surface2); padding: 5px; border-radius: 14px; margin-bottom: 18px; }
.tabs button { flex: 1; border: 0; background: none; padding: 10px; border-radius: 10px; font: 800 .92rem Nunito, sans-serif; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tabs.scroll { overflow-x: auto; scrollbar-width: none; }
.tabs.scroll button { flex: none; }

.sep { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 16px 0; font-size: .85rem; }
.sep::before, .sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.top-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-family: "Baloo 2", sans-serif; font-weight: 800; font-size: 1.3rem; }
.top-brand .logo { border-radius: 9px; }
.role-chip { margin-left: auto; font-size: .78rem; font-weight: 800; padding: 5px 10px; border-radius: 999px; background: var(--surface2); color: var(--primary); }

main#view { max-width: 560px; margin: 0 auto; padding: 18px 16px 60px; }
main#view.wide { max-width: 1100px; }

.banner { padding: 10px 16px; font-size: .88rem; font-weight: 700; text-align: center; }
.banner.demo { background: var(--surface2); color: var(--muted); }
.banner.warn { background: rgba(217,119,6,.14); color: var(--warn); }

/* ---------- Menú lateral ---------- */
.scrim { position: fixed; inset: 0; background: rgba(10,8,30,.45); opacity: 0; pointer-events: none; transition: .25s; z-index: 40; }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; width: min(84vw, 320px); z-index: 41;
  background: var(--surface); transform: translateX(-102%); transition: transform .25s;
  display: flex; flex-direction: column; padding: 18px 12px; overflow-y: auto;
}
body.menu-on .drawer { transform: none; }
body.menu-on .scrim { opacity: 1; pointer-events: all; }
.drawer-head { display: flex; gap: 12px; align-items: center; padding: 6px 8px 16px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.drawer-head .logo { border-radius: 12px; }
.drawer a, .drawer button.item {
  display: flex; align-items: center; gap: 12px; padding: 13px 12px; border-radius: 12px;
  color: var(--text); text-decoration: none; font-weight: 700; background: none; border: 0; font-size: 1rem; text-align: left; cursor: pointer; width: 100%; font-family: Nunito, sans-serif;
}
.drawer a:hover, .drawer button.item:hover { background: var(--surface2); }
.drawer a.admin-link { color: var(--primary); background: var(--surface2); }
.drawer .salir { margin-top: auto; color: var(--bad); }

/* ---------- Pantallas ---------- */
.estado-box { text-align: center; padding: 28px 20px; }
.estado-box .big { font-size: 3rem; line-height: 1; margin-bottom: 10px; }
.pill { display: inline-block; font-size: .75rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: var(--surface2); color: var(--muted); white-space: nowrap; }
.pill.ok { background: rgba(22,163,74,.14); color: var(--ok); }
.pill.warn { background: rgba(217,119,6,.15); color: var(--warn); }
.pill.bad { background: rgba(220,38,38,.13); color: var(--bad); }
.pill.blue { background: rgba(37,99,235,.13); color: var(--blue); }

.fake-input { display: flex; gap: 10px; align-items: center; background: rgba(255,255,255,.95); color: #6B6890; border-radius: 14px; padding: 14px; font-weight: 700; margin-top: 10px; }
.mapa-pronto {
  height: 210px; border-radius: var(--radius); border: 1px dashed var(--border); margin-bottom: 16px;
  background:
    linear-gradient(var(--surface2) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, var(--surface2) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--surface);
  display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); font-weight: 700; padding: 20px;
}

.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.doc-up { border: 2px dashed var(--border); border-radius: 14px; padding: 10px; text-align: center; font-size: .82rem; font-weight: 700; cursor: pointer; position: relative; min-height: 112px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: var(--surface); }
.doc-up input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.doc-up.ok { border-style: solid; border-color: var(--ok); }
.doc-up img { width: 100%; height: 64px; object-fit: cover; border-radius: 8px; }
.doc-up .ico { font-size: 1.6rem; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumb { width: 84px; text-align: center; font-size: .7rem; color: var(--muted); cursor: pointer; background: none; border: 0; padding: 0; font-family: Nunito, sans-serif; }
.thumb img { width: 84px; height: 60px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; margin-bottom: 3px; }
.thumb .pdf { width: 84px; height: 60px; border-radius: 8px; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--bad); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .92rem; }
.kv dt { color: var(--muted); font-weight: 700; }
.kv dd { margin: 0; font-weight: 700; }

/* ---------- Mapa y viajes ---------- */
.mapa { height: 44vh; min-height: 260px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); margin-bottom: 12px; position: relative; z-index: 0; background: var(--surface2); }
.mapa.alto { height: 56vh; }
.mapa-aviso { position: absolute; left: 10px; right: 10px; top: 10px; z-index: 500; background: var(--surface); color: var(--text); border-radius: 12px; padding: 8px 12px; font-size: .82rem; font-weight: 700; box-shadow: var(--shadow); }
.mk-wrap { background: none; border: 0; }
.mk { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); border: 3px solid #fff; display: flex; align-items: center; justify-content: center; font-size: 19px; box-shadow: 0 4px 12px rgba(0,0,0,.3); transition: transform .3s; }
.mk.ocupado { background: #9CA3AF; }
.mk.propio { background: var(--ok); }
.mk.pas { background: var(--blue); }
.mk-yo { width: 22px; height: 22px; border-radius: 50%; background: #2563EB; border: 4px solid #fff; box-shadow: 0 0 0 7px rgba(37,99,235,.25); }
.mk-pin { font-size: 30px; line-height: 1; filter: drop-shadow(0 3px 3px rgba(0,0,0,.35)); }
.leaflet-container { font-family: Nunito, sans-serif; }
.mk-oferta { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.mk-oferta .burbuja { position: relative; background: #fff; color: #1E1B4B; font: 800 15px "Baloo 2", sans-serif; padding: 2px 10px; border-radius: 999px; border: 2px solid var(--primary); box-shadow: 0 3px 10px rgba(0,0,0,.25); white-space: nowrap; }
.mk-oferta .burbuja::after { content: ""; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--primary); border-bottom: 0; }
.mk-oferta .burbuja.mejor { background: var(--primary); color: #fff; }
.mk-oferta:hover .mk { transform: scale(1.1); }
.credito { display: flex; align-items: center; gap: 8px; background: rgba(22,163,74,.12); color: var(--ok); border-radius: 12px; padding: 8px 12px; font-weight: 800; font-size: .9rem; margin-bottom: 12px; }
.mini-link { background: none; border: 0; color: var(--primary); font: 800 .78rem Nunito, sans-serif; cursor: pointer; padding: 0; }

.ruta-box { border: 1px solid var(--border); border-radius: 14px; padding: 4px 12px; margin: 10px 0 12px; }
.ruta-box .pt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }
.ruta-box .pt + .pt { border-top: 1px dashed var(--border); }
.ruta-box small { display: block; color: var(--muted); font-weight: 700; font-size: .74rem; text-transform: uppercase; letter-spacing: .4px; }
.ruta-box .txt { font-weight: 700; }
.dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 6px; flex: none; }
.dot.o { background: #2563EB; }
.dot.d { background: var(--primary); }
.ruta-box .input { margin-top: 4px; }
.resultados { display: grid; gap: 4px; margin-top: 6px; }
.resultados button { text-align: left; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; padding: 9px 12px; font: 700 .9rem Nunito, sans-serif; cursor: pointer; }
.resultados button:hover { border-color: var(--primary); }

.chips { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.chip { flex: 1; min-width: 90px; border: 2px solid var(--border); background: var(--surface); color: var(--text); border-radius: 12px; padding: 10px; font: 800 .95rem Nunito, sans-serif; cursor: pointer; }
.chip.on { border-color: var(--primary); background: var(--surface2); }
.chip.sm { flex: none; min-width: 0; padding: 7px 12px; font-size: .88rem; }
.chip.proximo { border-style: dashed; color: var(--muted); }
.chip.sm.on { border-color: var(--primary); background: var(--surface2); color: var(--primary); }
.historial-item { display: block; width: 100%; text-align: left; cursor: pointer; font: inherit; color: inherit; padding: 14px 16px; }
.historial-item:hover { border-color: var(--primary); }
.btn.sos { background: var(--bad); box-shadow: 0 4px 14px rgba(220,38,38,.35); }
.alerta-sos { position: sticky; top: 64px; z-index: 30; display: flex; align-items: center; gap: 10px; justify-content: space-between; background: var(--bad); color: #fff; padding: 10px 14px; font-weight: 800; text-decoration: none; animation: latido 1.2s ease-in-out infinite; }
@keyframes latido { 50% { filter: brightness(1.2); } }

.oferta { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; margin-bottom: 8px; background: var(--surface); }
.oferta .av { width: 44px; height: 44px; border-radius: 50%; background: var(--surface2); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex: none; }
.oferta .precio { font-family: "Baloo 2", sans-serif; font-size: 1.5rem; font-weight: 800; margin-left: auto; white-space: nowrap; }
.oferta .btn { margin-left: 6px; }

.spin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--primary); animation: girar .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes girar { to { transform: rotate(360deg); } }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: rgba(255,255,255,.16); padding: 12px 14px; border-radius: 14px; cursor: pointer; font-weight: 800; }
.switch input { appearance: none; width: 54px; height: 30px; border-radius: 999px; background: rgba(0,0,0,.25); position: relative; cursor: pointer; flex: none; transition: .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { left: 27px; }
.switch input:disabled { opacity: .5; cursor: not-allowed; }

.solicitud { border: 1px solid var(--border); border-radius: 14px; padding: 12px; margin-bottom: 10px; background: var(--surface); }
.solicitud.mia { border-color: var(--ok); }
.solicitud .meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px; }
.oferta-form { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.oferta-form .input { margin: 0; max-width: 120px; }

.linea-estado { display: flex; gap: 4px; margin: 10px 0 14px; }
.linea-estado span { flex: 1; height: 6px; border-radius: 999px; background: var(--border); }
.linea-estado span.on { background: var(--primary); }
.estrellas { display: flex; gap: 6px; justify-content: center; margin: 8px 0 14px; }
.estrellas button { background: none; border: 0; font-size: 2rem; cursor: pointer; filter: grayscale(1); opacity: .5; }
.estrellas button.on { filter: none; opacity: 1; }
.big-precio { font-family: "Baloo 2", sans-serif; font-size: 2.2rem; font-weight: 800; color: var(--primary); line-height: 1; }

/* ---------- Admin ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.kpi b { display: block; font-size: 1.9rem; font-family: "Baloo 2", sans-serif; line-height: 1.1; }
.kpi span { color: var(--muted); font-weight: 700; font-size: .85rem; }
.kpi.hot b { color: var(--primary); }

.tabla-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
table.tabla { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 760px; }
.tabla th { text-align: left; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .4px; padding: 12px; border-bottom: 1px solid var(--border); background: var(--surface2); }
.tabla td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tabla tr:last-child td { border-bottom: 0; }

@media (max-width: 680px) {
  table.tabla { min-width: 0; }
  .tabla thead { display: none; }
  .tabla tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .tabla tr:last-child { border-bottom: 0; }
  .tabla td { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 3px 0; border: 0; }
  .tabla td[data-l]::before { content: attr(data-l); color: var(--muted); font-weight: 700; font-size: .8rem; }
  .tabla td.td-acts { padding-top: 10px; }
}

.chofer-card { display: grid; gap: 8px; }
.chofer-card .row.between h3 { margin: 0; }

.desglose { width: 100%; border-collapse: collapse; font-size: .9rem; }
.desglose td { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.desglose td:last-child { text-align: right; font-weight: 800; }
.desglose tr.total td { border-bottom: 0; font-size: 1rem; color: var(--primary); }

details.faq { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); margin-bottom: 8px; }
details.faq summary { padding: 14px 16px; font-weight: 800; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
details.faq summary::after { content: "+"; color: var(--primary); font-size: 1.2rem; line-height: 1; }
details.faq[open] summary::after { content: "–"; }
details.faq .a { padding: 0 16px 14px; color: var(--muted); }
.cat { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--primary); margin: 20px 0 8px; }

ol.pasos { padding-left: 0; list-style: none; counter-reset: p; }
ol.pasos li { counter-increment: p; position: relative; padding: 0 0 16px 46px; }
ol.pasos li::before { content: counter(p); position: absolute; left: 0; top: -2px; width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; }

.legal h3 { margin-top: 1.2em; }
.legal li { margin-bottom: 4px; }

/* ---------- Botones de panel (estándar de Carlos) ---------- */
.acts { display: flex; gap: 6px; flex-wrap: wrap; }
.abtn { border: 1px solid var(--border); background: var(--surface2); color: var(--text); border-radius: 8px; padding: 5px 9px; font-size: .72rem; cursor: pointer; white-space: nowrap; font-weight: 700; font-family: Nunito, sans-serif; }
.abtn:hover { border-color: var(--primary); }
.abtn.prem { background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; border: none; }
.abtn.comp { background: rgba(96,165,250,.18); color: #60a5fa; border-color: transparent; }
.abtn.pause { color: #d97706; }
.abtn.off { color: #f87171; }

/* ---------- Toast y modal ---------- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 12px; font-size: .9rem; font-weight: 700;
  opacity: 0; transition: .3s; z-index: 200; box-shadow: 0 10px 30px rgba(0,0,0,.3); max-width: calc(100vw - 32px); pointer-events: none;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.ok { background: var(--ok); color: #fff; }
#toast.bad { background: var(--bad); color: #fff; }
.modal-bg { position: fixed; inset: 0; background: rgba(10,8,30,.55); z-index: 150; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 20px; padding: 20px; width: 100%; max-width: 420px; max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.modal.ancho { max-width: 760px; }
.modal-txt { font-weight: 700; }
.modal .input { margin-bottom: 14px; }
.img-grande { width: 100%; border-radius: 12px; margin-top: 10px; }
.loading { padding: 40px; text-align: center; color: var(--muted); font-weight: 700; }

.page.narrow { max-width: 640px; margin: 0 auto; padding: 18px 16px 50px; }

@media (max-width: 420px) {
  .grid2 { grid-template-columns: 1fr; }
  .card { padding: 16px; }
}
