/* =========================================================
   TransporteMX — Sistema de diseño (panel + sitio público)
   ========================================================= */
:root {
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ink: #0f172a;
  --ink-2: #1e293b;
  --text: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --line-2: #f1f5f9;
  --bg: #f1f5f9;
  --card: #ffffff;

  --blue: #1d4ed8;
  --blue-2: #2563eb;
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --navy: #1e3a8a;
  --green: #16a34a;
  --emerald: #059669;
  --green-50: #ecfdf5;
  --green-100: #d1fae5;
  --red: #dc2626;
  --red-50: #fef2f2;
  --red-100: #fee2e2;
  --orange: #ea580c;
  --orange-50: #fff7ed;
  --amber: #d97706;
  --amber-50: #fffbeb;
  --amber-100: #fef3c7;
  --purple: #7c3aed;
  --purple-50: #f5f3ff;
  --purple-100: #ede9fe;

  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 30px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, .18);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: var(--blue); text-decoration: none; }
h1, h2, h3, h4 { color: var(--ink); margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 800; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0; }
small, .small { font-size: 12.5px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.upper { text-transform: uppercase; letter-spacing: .06em; }
.strong { font-weight: 800; color: var(--ink); }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 26px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.gap-1 { gap: 6px; } .gap-2 { gap: 12px; }
.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* ---------- Layout del panel ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--ink); font-size: 16px; min-width: 0; }
.brand-logo { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--blue), #3b82f6); display: grid; place-items: center; flex: none; }
.brand-logo svg { width: 22px; height: 22px; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.topbar-user .who { text-align: right; line-height: 1.25; }
.topbar-user .who b { color: var(--ink); display: block; font-size: 13.5px; }
.container { max-width: 1180px; margin: 0 auto; padding: 22px 16px 60px; }
.container-sm { max-width: 760px; }

/* ---------- Tarjetas ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card + .card { margin-top: 18px; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 800; color: var(--ink); margin-bottom: 16px; }
.card-title .count { background: var(--line-2); color: var(--muted); font-size: 12px; border-radius: 999px; padding: 2px 9px; font-weight: 700; }
.card-flat { box-shadow: none; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head p { color: var(--muted); margin-top: 6px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 30px 0 14px; }
.section-title h2 { display: flex; align-items: center; gap: 8px; font-size: 19px; }

.grid { display: grid; gap: 18px; }
.grid-2 { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 18px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
  h1 { font-size: 25px; }
  .card { padding: 18px; }
}

/* ---------- Botones ---------- */
.btn {
  --b: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font: inherit; font-weight: 700; font-size: 14.5px;
  padding: 11px 18px; cursor: pointer; line-height: 1.2;
  transition: transform .06s ease, box-shadow .15s ease, background .15s ease, opacity .15s;
  text-align: center; white-space: nowrap; user-select: none;
}
.btn:active { transform: scale(.98); }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 6px 16px rgba(29, 78, 216, .25); }
.btn-primary:hover { background: #1e40af; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #020617; }
.btn-success { background: var(--emerald); color: #fff; box-shadow: 0 6px 16px rgba(5, 150, 105, .22); }
.btn-success:hover { background: #047857; }
.btn-green { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-light { background: #fff; color: var(--ink); border-color: var(--line); box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
.btn-light:hover { background: var(--line-2); }
.btn-soft { background: var(--blue-50); color: var(--blue); border-color: var(--blue-100); }
.btn-soft-red { background: var(--red-50); color: var(--red); border-color: var(--red-100); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--line-2); color: var(--ink); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 15px 22px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 10px; }
.btn-icon.edit { background: var(--amber-50); }
.btn-icon.del { background: var(--red-50); }

/* ---------- Formularios ---------- */
.label { display: block; font-size: 11.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 7px; }
.label.blue { color: var(--blue); }
.input, .select, textarea.input {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 14px; outline: none; transition: border-color .15s, box-shadow .15s;
  appearance: none; -webkit-appearance: none;
}
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
.input:focus, .select:focus { border-color: var(--blue-2); box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }
.input::placeholder { color: var(--faint); }
.input.filled { background: #fefce8; border-color: #fde68a; font-weight: 600; }
.field { margin-bottom: 14px; }
.field-row { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.help { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--text); cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--blue); flex: none; }

/* Switch */
.switch { position: relative; display: inline-block; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(20px); }
.switch input:disabled + span { opacity: .5; cursor: not-allowed; }

/* Chips de días */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 10px; padding: 7px 13px; font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.chip.active, .chip[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip-mini { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-size: 10.5px; font-weight: 800; background: var(--line-2); color: var(--faint); }
.chip-mini.on { background: var(--blue-100); color: var(--blue); }
.tag { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1.5px solid var(--line); border-radius: 9px; padding: 5px 10px; font-weight: 800; font-size: 13px; color: var(--ink); }
.tag .x { color: var(--red); cursor: pointer; font-weight: 800; border: 0; background: none; padding: 0 0 0 2px; font-size: 14px; }
.tag small { color: var(--muted); font-weight: 600; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 3px 10px; font-size: 11.5px; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
.badge-green { background: var(--green-100); color: #047857; }
.badge-blue { background: var(--blue-100); color: var(--blue); }
.badge-red { background: var(--red-100); color: var(--red); }
.badge-amber { background: var(--amber-100); color: #b45309; }
.badge-purple { background: var(--purple-100); color: var(--purple); }
.badge-gray { background: var(--line-2); color: var(--muted); }
.badge-dark { background: var(--ink); color: #fff; }
.pill-danger { color: var(--red); background: var(--red-50); border: 1px solid var(--red-100); border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 800; cursor: pointer; font-family: inherit; }

/* Alertas */
.alert { border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; border: 1px solid; margin-bottom: 16px; }
.alert-error { background: var(--red-50); border-color: var(--red-100); color: #b91c1c; }
.alert-ok { background: var(--green-50); border-color: var(--green-100); color: #047857; }
.alert-info { background: var(--blue-50); border-color: var(--blue-100); color: var(--blue); }
.alert-warn { background: var(--amber-50); border-color: #fde68a; color: #92400e; }

/* ---------- Dashboard ---------- */
.hello { border-left: 5px solid var(--blue); }
.hello h1 { font-size: 26px; }
.role { color: var(--blue); font-weight: 800; }
.tiles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.tile {
  position: relative; overflow: hidden; display: block;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; color: var(--text); min-height: 150px; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(15, 23, 42, .1); border-color: #cbd5e1; }
.tile .ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; margin-bottom: 16px; }
.tile .big { position: absolute; right: 16px; top: 14px; font-size: 54px; opacity: .13; filter: grayscale(.2); }
.tile h3 { font-size: 17px; font-weight: 800; }
.tile p { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.ico-amber { background: #fef3c7; } .ico-orange { background: #ffedd5; } .ico-purple { background: #ede9fe; }
.ico-green { background: #d1fae5; } .ico-blue { background: #dbeafe; } .ico-red { background: #fee2e2; } .ico-gray { background: #e2e8f0; }
.tile-hero { background: linear-gradient(135deg, #059669, #10b981 60%, #34d399); color: #ecfdf5; border: 0; min-height: 170px; }
.tile-hero h3 { color: #fff; font-size: 24px; }
.tile-hero p { color: #d1fae5; font-size: 14.5px; max-width: 420px; }
.tile-hero .go { display: inline-flex; margin-top: 16px; background: rgba(255, 255, 255, .2); color: #fff; font-weight: 800; padding: 8px 14px; border-radius: 10px; font-size: 13.5px; }
.tile-hero .big { opacity: .25; font-size: 80px; }
.tile.active-border { border: 1.5px solid #fdba74; }
.stats { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 800px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .k { font-size: 11.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat .v { font-size: 26px; font-weight: 800; color: var(--ink); margin-top: 4px; letter-spacing: -.02em; }
.stat .s { font-size: 12.5px; color: var(--muted); }
.super-badge { background: var(--red-50); color: var(--red); border-radius: 10px; padding: 5px 10px; font-size: 11px; font-weight: 800; line-height: 1.15; text-align: center; }

/* ---------- Precios ---------- */
.price-card { border-radius: 16px; padding: 18px 20px; border: 1.5px solid; position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.price-card + .price-card { margin-top: 14px; }
.price-card .k { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.price-card .v { font-size: 30px; font-weight: 800; color: var(--ink); letter-spacing: -.02em; }
.price-std { background: var(--blue-50); border-color: var(--blue-100); } .price-std .k { color: var(--blue); }
.price-promo { background: #fff; border-color: var(--line); } .price-promo .k { color: var(--muted); }
.price-promo.on { background: var(--green-50); border-color: #86efac; } .price-promo.on .k { color: var(--green); }
.price-rt { background: var(--purple-50); border-color: var(--purple-100); } .price-rt .k { color: var(--purple); }
.edit-link { border: 0; background: none; font: inherit; font-size: 13.5px; color: var(--muted); cursor: pointer; padding: 0; display: inline-flex; gap: 4px; align-items: center; }
.edit-link:hover { color: var(--ink); }
.price-edit { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.price-edit .input { width: 130px; font-size: 20px; font-weight: 800; padding: 8px 12px; }
.rule { display: flex; gap: 14px; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 14px; padding: 16px; cursor: pointer; background: #fff; }
.rule + .rule { margin-top: 12px; }
.rule input { width: 20px; height: 20px; accent-color: var(--blue); margin-top: 2px; flex: none; }
.rule b { color: var(--ink); display: block; }
.rule span { color: var(--muted); font-size: 13.5px; }
.rule.active { border-color: var(--blue-2); background: var(--blue-50); box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }

/* ---------- Listas / tablas ---------- */
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.list-row + .list-row { margin-top: 10px; }
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #f8fafc; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .e { font-size: 38px; margin-bottom: 8px; }

/* ---------- Rutas ---------- */
.route-card .od { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.route-card .od b { font-size: 18px; color: var(--ink); font-weight: 800; line-height: 1.2; }
.route-card .arrow { color: var(--faint); }
.route-card.off { opacity: .6; }
.mini-label { font-size: 11px; font-weight: 800; color: var(--muted); letter-spacing: .07em; text-transform: uppercase; margin: 14px 0 8px; }
.time-box { background: var(--blue-50); border: 1px solid var(--blue-100); border-radius: 14px; padding: 14px; }
.time-add { display: flex; gap: 8px; flex-wrap: wrap; }
.time-add .input { width: auto; flex: 1; min-width: 110px; }

/* ---------- Taquilla ---------- */
.zone-head { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 800; color: var(--ink); margin: 26px 0 12px; }
.zone-head .count { background: var(--line); font-size: 12px; border-radius: 999px; padding: 2px 9px; color: var(--muted); }
.departures { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.dep { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.dep.past { opacity: .7; }
.dep.cancel { background: #fff7f7; border-color: var(--red-100); }
.dep-time { font-size: 30px; font-weight: 800; color: var(--ink); letter-spacing: -.02em; line-height: 1; }
.dep-route { font-weight: 800; color: var(--ink); margin-top: 12px; font-size: 14.5px; }
.dep-sub { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.progress { height: 6px; background: var(--line-2); border-radius: 999px; margin: 12px 0 14px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue-2), #60a5fa); border-radius: 999px; }
.dep-actions { display: grid; gap: 8px; }
.date-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--line-2); border-radius: 12px; padding: 4px 6px 4px 14px; font-weight: 800; color: var(--ink); }
.date-chip input { border: 0; background: #fff; border-radius: 8px; padding: 7px 8px; font: inherit; font-weight: 700; color: var(--ink); }

/* ---------- Mapa de asientos (compartido) ---------- */
.seat-legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 16px; font-size: 11.5px; font-weight: 800; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; margin-bottom: 18px; }
.seat-legend span { display: inline-flex; align-items: center; gap: 6px; }
.seat-legend i { width: 15px; height: 15px; border-radius: 4px; display: inline-block; border: 2px solid; }
.lg-free { border-color: #10b981 !important; background: #fff; }
.lg-sel { border-color: var(--blue-2) !important; background: var(--blue-2); }
.lg-occ { border-color: #94a3b8 !important; background: #94a3b8; }
.lg-sold { border-color: var(--ink) !important; background: var(--ink); }
.lg-block { border-color: var(--red) !important; background: var(--red-100); }
.lg-hold { border-color: var(--amber) !important; background: var(--amber-100); }
.van {
  position: relative; margin: 0 auto; max-width: 330px;
  border: 4px solid var(--ink-2); border-radius: 46px 46px 34px 34px;
  padding: 44px 22px 26px; background: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, .12);
}
.van::before { content: ''; position: absolute; top: -4px; left: 50%; transform: translateX(-50%); width: 58%; height: 20px; background: var(--ink-2); border-radius: 0 0 14px 14px; }
.van-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; }
.seat {
  aspect-ratio: 1; border-radius: 10px; border: 2.5px solid #10b981; background: #fff;
  color: #047857; font: inherit; font-weight: 800; font-size: 15px; cursor: pointer;
  display: grid; place-items: center; transition: transform .08s, background .12s; padding: 0; position: relative;
}
.seat:hover:not(:disabled) { transform: scale(1.06); }
.seat.sel { background: var(--blue-2); border-color: var(--blue); color: #fff; box-shadow: 0 0 0 4px rgba(37, 99, 235, .2); }
.seat.occ { background: #94a3b8; border-color: #94a3b8; color: #fff; cursor: not-allowed; }
.seat.sold { background: var(--ink); border-color: var(--ink); color: #fff; }
.seat.block { background: var(--red-100); border-color: var(--red); color: var(--red); }
.seat.hold { background: var(--amber-100); border-color: var(--amber); color: #92400e; }
.seat.board::after { content: '✓'; position: absolute; right: -6px; top: -7px; width: 17px; height: 17px; border-radius: 50%; background: var(--green); color: #fff; font-size: 10px; display: grid; place-items: center; border: 2px solid #fff; }
.seat-driver { display: grid; place-items: center; color: var(--muted); }
.seat-driver svg { width: 34px; height: 34px; }
.seat-door { display: grid; place-items: center; writing-mode: vertical-rl; transform: rotate(180deg); font-size: 9.5px; font-weight: 800; letter-spacing: .3em; color: var(--faint); border-right: 3px dashed var(--line); }
.van-front { text-align: center; margin-top: 16px; font-size: 11.5px; font-weight: 800; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); backdrop-filter: blur(3px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 18px; animation: fade .15s ease; }
.modal { background: #fff; border-radius: 22px; width: 100%; max-width: 460px; max-height: calc(100vh - 36px); overflow: auto; box-shadow: var(--shadow-lg); animation: pop .18s ease; }
.modal.wide { max-width: 880px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px 0; }
.modal-head h3 { font-size: 20px; font-weight: 800; }
.modal-body { padding: 18px 20px 20px; }
.modal-close { border: 0; background: var(--line-2); width: 34px; height: 34px; border-radius: 10px; font-size: 18px; cursor: pointer; color: var(--muted); flex: none; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px 20px; border-top: 1px solid var(--line-2); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }
@media (max-width: 640px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { border-radius: 22px 22px 0 0; max-height: 94vh; }
}
.critical { background: var(--amber-50); border: 1px solid #fde68a; border-radius: 14px; padding: 14px 16px; }
.critical b { color: var(--ink); display: block; font-size: 16px; margin-bottom: 4px; }
.critical p { color: var(--text); font-size: 13.5px; }

/* Toast */
.toasts { position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); bottom: 22px; display: grid; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 16px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); animation: pop .2s ease; display: flex; gap: 10px; align-items: center; }
.toast.ok { background: #065f46; }
.toast.error { background: #991b1b; }

/* ---------- Boleto (compartido) ---------- */
.ticket { max-width: 380px; margin: 0 auto; background: #fff; border-radius: 22px; overflow: hidden; box-shadow: 0 18px 50px rgba(15, 23, 42, .25); position: relative; color: var(--text); }
.ticket-head { background: linear-gradient(135deg, #1d4ed8, #2563eb); color: #fff; text-align: center; padding: 22px 18px 24px; }
.ticket.rt .ticket-head { background: linear-gradient(120deg, #1d4ed8, #6d28d9); }
.ticket-head .brand-t { font-size: 20px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.ticket-head .sub { font-size: 13px; opacity: .85; margin-top: 2px; }
.ticket-notch { position: relative; height: 0; }
.ticket-notch::before, .ticket-notch::after { content: ''; position: absolute; top: -13px; width: 26px; height: 26px; border-radius: 50%; background: var(--notch, #0f172a); }
.ticket-notch::before { left: -13px; } .ticket-notch::after { right: -13px; }
.ticket-body { padding: 18px; }
.leg { border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; }
.leg.ida { background: var(--blue-50); border-left: 4px solid var(--blue-2); }
.leg.regreso { background: var(--purple-50); border-left: 4px solid var(--purple); }
.leg-title { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; display: flex; align-items: center; gap: 6px; }
.leg.ida .leg-title { color: var(--blue); } .leg.regreso .leg-title { color: var(--purple); }
.leg-od { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: end; margin-top: 6px; }
.leg-od small { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 800; }
.leg-od b { color: var(--ink); font-size: 14px; line-height: 1.2; display: block; }
.leg-od .r { text-align: right; }
.leg-od .arr { color: var(--faint); padding-bottom: 2px; }
.leg-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 13px; font-weight: 800; color: var(--ink); }
.leg-meta span { display: inline-flex; gap: 5px; align-items: center; }
.leg-meta .u { color: var(--muted); font-weight: 700; }
.ticket-pax { background: #f8fafc; border-radius: 14px; padding: 12px 14px; }
.ticket-pax .t { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }
.pax-row { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 4px 0; }
.pax-row b { color: var(--ink); font-size: 14px; }
.seat-tag { background: var(--blue-100); color: var(--blue); border-radius: 6px; padding: 2px 8px; font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.seat-tag.r { background: var(--purple-100); color: var(--purple); }
.ticket-qr { text-align: center; padding: 16px 0 4px; }
.ticket-qr .qr { display: inline-block; padding: 8px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; }
.ticket-qr .qr img, .ticket-qr .qr svg { display: block; width: 150px; height: 150px; }
.ticket-qr .id { font-size: 11.5px; color: var(--faint); margin-top: 6px; font-family: ui-monospace, Menlo, monospace; }
.ticket-qr .show { color: var(--red); font-size: 12px; font-weight: 800; }
.ticket-foot { border-top: 1px dashed var(--line); text-align: center; padding: 12px; font-size: 12px; color: var(--muted); background: #f8fafc; }
.ticket-foot b.ok { color: var(--green); } .ticket-foot b.bad { color: var(--red); } .ticket-foot b.warn { color: var(--amber); }

/* ---------- Validar (scanner) ---------- */
.scanner-page { background: #0f172a; min-height: 100vh; }
.scan-box { background: #fff; border-radius: 22px; overflow: hidden; }
#lector { width: 100%; }
#lector video { border-radius: 0; }
.result-banner { border-radius: 14px; color: #fff; font-weight: 800; font-size: 18px; padding: 14px; text-align: center; display: flex; gap: 8px; align-items: center; justify-content: center; letter-spacing: .02em; }
.rb-ok { background: var(--green); } .rb-used { background: var(--orange); } .rb-bad { background: var(--red); } .rb-warn { background: var(--amber); }
.info-dark { background: var(--ink); color: #fff; border-radius: 14px; padding: 14px; }
.info-dark small { color: #94a3b8; }
.validated { background: var(--amber-50); color: #b45309; font-size: 12.5px; font-weight: 800; border-radius: 8px; padding: 6px 10px; margin-top: 8px; }
.used-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- Lista de abordaje ---------- */
.manifest { background: #fff; color: var(--ink); }
.manifest-head { background: #000; color: #fff; text-align: center; padding: 22px 12px; }
.manifest-head .b { font-size: 22px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.manifest-head .s { font-size: 11px; letter-spacing: .2em; margin-top: 4px; opacity: .85; }
.manifest-body { padding: 18px; }
.manifest .hf { display: flex; justify-content: space-between; align-items: flex-end; }
.manifest .hf small { font-size: 10px; font-weight: 800; color: var(--faint); letter-spacing: .08em; }
.manifest .hf b { font-size: 26px; font-weight: 800; }
.manifest .od { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-top: 12px; font-weight: 800; font-size: 14px; }
.manifest .chofer { text-align: center; color: var(--blue); font-weight: 800; font-size: 13px; margin: 12px 0; letter-spacing: .04em; }
.manifest table { width: 100%; border-collapse: collapse; border-top: 2px dashed var(--line); }
.manifest th { font-size: 10px; letter-spacing: .1em; color: var(--faint); text-align: left; padding: 10px 6px; }
.manifest td { padding: 8px 6px; border-top: 1px solid var(--line-2); font-size: 13px; }
.manifest .n { width: 26px; height: 26px; background: #000; color: #fff; border-radius: 6px; display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.manifest .box { width: 16px; height: 16px; border: 1.5px solid #94a3b8; border-radius: 4px; display: inline-block; }
.manifest .box.on { background: var(--green); border-color: var(--green); }

/* ---------- Página de acceso / instalador ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 10% -10%, #1e3a8a 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #312e81 0%, transparent 55%), #0b1220; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { text-align: center; font-size: 26px; margin-bottom: 18px; }
.auth-foot { text-align: center; color: #94a3b8; font-size: 12.5px; margin-top: 16px; }
.auth-foot a { color: #cbd5e1; }

/* ---------- Utilidades de impresión ---------- */
@media print {
  .topbar, .no-print, .toasts { display: none !important; }
  body { background: #fff; }
  .container { padding: 0; }
}

/* Control segmentado (Vender / Bloquear) */
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--line-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; border-radius: 9px; padding: 10px; font: inherit; font-weight: 800; font-size: 12.5px; color: var(--muted); cursor: pointer; letter-spacing: .05em; }
.seg button.on { background: #fff; color: var(--emerald); box-shadow: 0 1px 3px rgba(15, 23, 42, .1); }
.seg button.on.red { color: var(--red); }
.manifest button.box { cursor: pointer; padding: 0; background: #fff; }
.manifest button.box.on { background: var(--green); }
.grid > .card, .grid-2 > .card, .grid-3 > .card, .grid-4 > .card { margin-top: 0; }

/* Apartado en línea, se cobra en taquilla */
.seat.debe { background: #ffedd5; border-color: var(--orange); color: #c2410c; border-style: dashed; }
.lg-debe { border-color: var(--orange) !important; background: #ffedd5; border-style: dashed !important; }
.rb-debe { background: var(--orange); }
.leg-dir { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; gap: 4px; }
.leg-dir a { color: var(--blue); font-weight: 700; }
.ticket-aviso { background: var(--amber-50); border: 1px solid #fde68a; color: #92400e; border-radius: 12px; padding: 10px 12px; font-size: 12.5px; font-weight: 700; margin-top: 12px; text-align: center; }

/* Logo de la empresa */
.brand-logo.has-img { background: #fff; border: 1px solid var(--line); overflow: hidden; padding: 2px; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Campana de pedidos nuevos */
.campana-btn { position: fixed; right: 18px; bottom: 18px; z-index: 90; width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; font-size: 26px; cursor: pointer; box-shadow: 0 12px 30px rgba(15, 23, 42, .35); }
.campana-btn.activa { background: var(--orange); animation: sacudir 1.2s ease-in-out infinite; }
.campana-n { position: absolute; top: -4px; right: -4px; min-width: 24px; height: 24px; border-radius: 12px; background: var(--red); color: #fff; font-size: 13px; font-weight: 800; display: grid; place-items: center; padding: 0 6px; border: 2px solid #fff; }
@keyframes sacudir { 0%, 60%, 100% { transform: rotate(0); } 10%, 30%, 50% { transform: rotate(-12deg); } 20%, 40% { transform: rotate(12deg); } }
.campana-activar { position: fixed; right: 18px; bottom: 88px; z-index: 90; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; font-size: 13.5px; max-width: calc(100vw - 36px); }
.pedido { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.pedido + .pedido { margin-top: 10px; }
.pedido.nuevo { border-color: var(--orange); background: var(--orange-50); }
@media print { .campana-btn, .campana-activar { display: none !important; } }
