html{scroll-behavior:smooth; height:100%; -webkit-text-size-adjust:100%;}
:root{
  --tabsH: 78px;
  --bg0:#061018;
  --bg1:#071a24;
  --ink:#eaf2f6;
  --muted:#b9c8d2;
  --muted2:#8ea3b3;
  --card:rgba(10,25,34,.72);
  --card2:rgba(13,32,44,.72);
  --line:rgba(210,235,255,.16);
  --line2:rgba(210,235,255,.10);
  --accent:#7ad0ff;
  --accent2:#83e0c1;
  --warn:#ffd27a;
  --bad:#ff8aa5;
  --ok:#87f0a6;
  --shadow: 0 14px 42px rgba(0,0,0,.35);
  --shadow2: 0 10px 26px rgba(0,0,0,.28);
  --radius:18px;
  --radius2:22px;
}

*{box-sizing:border-box}
body{
  margin:0;
  min-height:100%;
  padding-top: calc(var(--tabsH, 64px) + 12px + env(safe-area-inset-top));
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
  color:var(--ink);
  background: radial-gradient(1100px 700px at 30% 5%, rgba(122,208,255,.15), transparent 55%),
              radial-gradient(900px 600px at 90% 15%, rgba(131,224,193,.12), transparent 60%),
              linear-gradient(180deg, var(--bg1), var(--bg0));
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

.bg{position:fixed; inset:0; pointer-events:none; overflow:hidden;}
.bg::after{content:""; position:absolute; inset:0; background: radial-gradient(780px 520px at 50% 40%, rgba(0,0,0,.52) 0%, rgba(0,0,0,.30) 42%, rgba(0,0,0,0) 74%);}
.bg-photo{
  position:absolute; inset:0;
  width:100%; height:100%;
  object-fit:cover;
  opacity:1;
  filter:none;
}


.bg-svg{
  position:absolute; inset:-2%;
  width:104%; height:104%;
  opacity:.03;
  filter:none;
}
.fog{
  position:absolute;
  opacity:.08; inset:-10%;
  background:
    radial-gradient(700px 380px at 20% 12%, rgba(240,250,255,.10), transparent 65%),
    radial-gradient(760px 420px at 60% 30%, rgba(240,250,255,.08), transparent 62%),
    radial-gradient(820px 460px at 85% 14%, rgba(240,250,255,.10), transparent 62%),
    radial-gradient(920px 520px at 35% 75%, rgba(240,250,255,.07), transparent 66%),
    linear-gradient(180deg, rgba(10,25,34,.25), rgba(6,16,24,.40));
  filter: blur(1px);
}


.brand{display:flex; gap:12px; align-items:center}
.brand-mark{
  width:46px; height:46px; border-radius:14px;
  display:grid; place-items:center;
  background: linear-gradient(135deg, rgba(122,208,255,.18), rgba(131,224,193,.12));
  border:1px solid var(--line);
  box-shadow: var(--shadow2);
  font-size:20px;
}
.brand-title{
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing:.04em;
  font-variant: small-caps;
  font-size: 18px;
  line-height: 1.1;
}
.brand-sub{color:var(--muted2); font-size:12px}

.top-actions{display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end}
.btn{
  transition: filter .18s ease, transform .18s ease, box-shadow .18s ease, border-color .18s ease;

  border:1px solid var(--line);
  color:var(--ink);
  background: linear-gradient(180deg, rgba(122,208,255,.14), rgba(10,25,34,.75));
  padding:10px 12px;
  border-radius: 14px;
  box-shadow: var(--shadow2);
  cursor:pointer;
  font-weight:600;
}
.btn:hover{filter:none; transform:none; border-color: rgba(122,208,255,.55); background: linear-gradient(180deg, rgba(122,208,255,.26), rgba(10,25,34,.72));}
.btn:active{transform:translateY(1px)}
.btn.ghost{
  background: rgba(10,25,34,.40);
  box-shadow:none;
}
.btn.ghost:hover{background: rgba(122,208,255,.10); border-color: rgba(122,208,255,.35);}

.btn.danger{
  border-color: rgba(255,138,165,.35);
  background: linear-gradient(180deg, rgba(255,138,165,.14), rgba(10,25,34,.75));
}
.icon-btn{
  border:1px solid var(--line);
  background: rgba(10,25,34,.55);
  color:var(--ink);
  width:40px; height:40px;
  border-radius: 14px;
  cursor:pointer;
}
.icon-btn:hover{filter:brightness(1.05)}

.tabs{
  position:fixed; top:0; left:0; right:0; z-index:60;
  display:grid;
  grid-template-columns: 1fr auto 1fr;
  align-items:center;
  gap:10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: linear-gradient(180deg, rgba(6,16,24,.72), rgba(6,16,24,.32));
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--line2);
  overflow:hidden;
  isolation:isolate;
}
.tab{
  transition: filter .18s ease, transform .18s ease;

  border:1px solid var(--line2);
  color:var(--muted);
  background: rgba(10,25,34,.38);
  padding:10px 12px;
  border-radius: 999px;
  cursor:pointer;
  white-space:nowrap;
}
.tab:hover{filter:none; transform:none; color:var(--ink); border-color: rgba(122,208,255,.28); background: rgba(122,208,255,.10);}
.tab.is-active{
  color:var(--ink);
  border-color: rgba(122,208,255,.35);
  background: linear-gradient(180deg, rgba(122,208,255,.18), rgba(10,25,34,.55));
}

.main{
  padding: 16px;
  max-width: 1320px;
  margin: 0 auto 64px;
}

.grid{
  display:grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap:14px;
}
@media (max-width: 940px){
  .grid{grid-template-columns:1fr}
  }

/* Variantes de grid internas (2 columnas) */
.grid.grid--2{
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 860px){
  .grid.grid--2{ grid-template-columns: 1fr; }
}

.card{
  background: var(--card);
  border: 1px solid var(--line2);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
  overflow:hidden;
  position:relative;
}
.card::before{
  content:"";
  position:absolute; inset:0;
  background:
    radial-gradient(500px 250px at 15% 0%, rgba(122,208,255,.14), transparent 65%),
    radial-gradient(520px 280px at 80% 0%, rgba(131,224,193,.11), transparent 62%),
    linear-gradient(180deg, rgba(255,255,255,.02), transparent 30%);
  pointer-events:none;
}
.card-head{
  padding: 14px 14px 10px;
  display:flex; align-items:flex-start; justify-content:space-between; gap:10px;
  border-bottom: 1px solid var(--line2);
  position:relative;
}
.card-title{
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing:.04em;
  font-variant: small-caps;
  font-size: 16px;
}
.card-sub{color:var(--muted2); font-size:12px; margin-top:4px}
.card-body{padding:14px; position:relative}
.card-foot{padding:12px 14px; border-top:1px solid var(--line2); position:relative}

.row{display:flex; gap:10px; flex-wrap:wrap; align-items:center}
.stack{display:grid; gap:10px}

.kbd{
  padding:2px 8px;
  border-radius:999px;
  border:1px solid var(--line2);
  background: rgba(10,25,34,.35);
  color: var(--muted);
  font-size:12px;
}

.field{display:grid; gap:6px; min-width: 220px}
.label{color:var(--muted); font-size:12px}
.input, input[type="text"], input[type="number"], input[type="search"], textarea{
  width:100%;
  border:1px solid var(--line2);
  background: rgba(6,16,24,.40);
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 14px;
  outline:none;
}
textarea{min-height: 110px; resize: vertical}
.input:focus, input:focus, textarea:focus{
  border-color: rgba(122,208,255,.35);
  box-shadow: 0 0 0 3px rgba(122,208,255,.12);
}
.pill{
  display:inline-flex; align-items:center; gap:8px;
  border:1px solid var(--line2);
  background: rgba(10,25,34,.38);
  padding:8px 10px;
  border-radius: 999px;
  color: var(--ink);
  cursor:pointer;
}
.pill:hover{filter:brightness(1.05)}

.badge{
  display:inline-flex; align-items:center; gap:8px;
  border:1px solid var(--line2);
  background: rgba(10,25,34,.32);
  padding:7px 10px;
  border-radius: 999px;
  font-size:12px;
  color: var(--muted);
}
.badge.ok{border-color: rgba(135,240,166,.25); color: rgba(210,255,230,.95)}
.badge.warn{border-color: rgba(255,210,122,.25); color: rgba(255,235,200,.95)}
.badge.bad{border-color: rgba(255,138,165,.25); color: rgba(255,210,225,.95)}

.hr{height:1px; background: var(--line2); margin: 10px 0}

.list{
  display:grid; gap:8px;
}
.item{
  display:flex; gap:10px; align-items:center; justify-content:space-between;
  padding: 10px 10px;
  border:1px solid var(--line2);
  background: rgba(6,16,24,.30);
  border-radius: 16px;
}
.item-left{display:flex; gap:10px; align-items:center; min-width:0}
.item-title{font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.item-sub{color:var(--muted2); font-size:12px}
.item-right{display:flex; gap:8px; align-items:center; flex-wrap:wrap; justify-content:flex-end}

.icon{
  width:30px; height:30px;
  border-radius: 12px;
  border:1px solid var(--line2);
  background: rgba(10,25,34,.38);
  display:grid; place-items:center;
  overflow:hidden;
  flex:0 0 auto;
}
.icon img{width:24px; height:24px; opacity:.92}

.mini{
  font-size:12px;
  color: var(--muted);
}

.table{
  width:100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}
.table th{
  text-align:left;
  font-size:12px;
  color: var(--muted2);
  font-weight:600;
  padding: 0 10px;
}
.table td{
  padding: 10px 10px;
  background: rgba(6,16,24,.30);
  border-top:1px solid var(--line2);
  border-bottom:1px solid var(--line2);
}
.table td:first-child{
  border-left:1px solid var(--line2);
  border-radius: 16px 0 0 16px;
}
.table td:last-child{
  border-right:1px solid var(--line2);
  border-radius: 0 16px 16px 0;
}

.helper{
  color: var(--muted2);
  font-size:12px;
  line-height:1.5;
}

.notice{
  padding: 12px 12px;
  border-radius: 16px;
  border:1px dashed rgba(210,235,255,.22);
  background: rgba(10,25,34,.28);
  color: var(--muted);
}

.modal{
  position:fixed; inset:0; z-index:10;
  display:none;
}
.modal.is-open{display:block}
.modal-backdrop{
  position:absolute; inset:0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
}
.modal-card{
  position:relative;
  max-width: 560px;
  max-height: 84vh;
  display:flex;
  flex-direction:column;
  margin: 8vh auto;
  border-radius: 22px;
  overflow:hidden;
  border:1px solid rgba(210,235,255,.20);
  background: rgba(10,25,34,.90);
  box-shadow: var(--shadow);
}
.modal-card.wide{max-width: 820px}
.modal-head{
  padding: 12px 12px;
  border-bottom:1px solid var(--line2);
  display:flex; align-items:center; justify-content:space-between; gap:10px;
}
.modal-title{
  font-family: Georgia, "Times New Roman", serif;
  font-variant: small-caps;
  letter-spacing:.04em;
}
.modal-body{padding: 12px; overflow:auto; flex:1 1 auto;}
.modal-foot{padding: 12px; border-top: 1px solid var(--line2); display:flex; justify-content:flex-end}

.search{margin-bottom:10px}
.picker-list{
  max-height: 56vh;
  overflow:auto;
  display:grid; gap:8px;
}
.picker-opt{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px;
  padding: 10px 10px;
  border-radius: 16px;
  border:1px solid var(--line2);
  background: rgba(6,16,24,.30);
  cursor:pointer;
}
.picker-opt:hover{filter:brightness(1.06)}
.picker-opt .left{display:flex; gap:10px; align-items:center; min-width:0}
.picker-opt .name{font-weight:800; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.picker-opt .meta{color: var(--muted2); font-size:12px}

.small-link{
  color: rgba(122,208,255,.95);
  text-decoration:none;
}
.small-link:hover{text-decoration:underline}


/* ===== Ruta: tabla de reglas + tooltips (v6) ===== */
.table-wrap{ overflow:auto; border:1px solid rgba(255,255,255,.08); border-radius:14px; }
.tbl{ width:100%; border-collapse:separate; border-spacing:0; min-width:760px; }
.tbl thead th{
  position:sticky; top:0;
  background: rgba(10,22,35,.78);
  color: rgba(255,255,255,.92);
  padding:10px 10px;
  font-weight:700;
  text-align:left;
  border-bottom:1px solid rgba(255,255,255,.10);
}
.tbl tbody td{
  padding:10px 10px;
  border-bottom:1px solid rgba(255,255,255,.07);
  background: rgba(5,12,20,.18);
}
.tbl tbody tr:hover td{ background: rgba(5,12,20,.26); }
.td-name{ min-width:220px; }
.inp-mini{
  width:110px;
  padding:10px 10px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(10,22,35,.55);
  color: rgba(255,255,255,.95);
  outline:none;
}
.inp-mini:focus{ border-color: rgba(145,198,255,.55); box-shadow: 0 0 0 3px rgba(50,120,180,.18); }

select, #selPlanMode{
  padding:12px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(10,22,35,.55);
  color: rgba(255,255,255,.95);
}

.chk{ display:flex; align-items:center; gap:10px; user-select:none; }
.chk input{ transform: scale(1.15); }

.tip{
  display:inline-flex;
  margin-left:8px;
  width:20px; height:20px;
  border-radius:999px;
  background: url('./assets/icons/ui/ayuda.png') center/contain no-repeat;
  cursor:help;
  vertical-align:middle;
  position:relative;
  outline:none;
}
.tip:focus{ box-shadow: 0 0 0 3px rgba(122,208,255,.18); border-radius:999px; }

.tip::after{
  content: attr(data-tip);
  position:absolute;
  left:50%;
  transform:translateX(-50%);
  bottom: calc(100% + 10px);
  width: min(320px, 84vw);
  padding:10px 10px;
  border-radius:12px;
  background: rgba(10,22,35,.92);
  color: rgba(255,255,255,.95);
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.12);
  opacity:0;
  pointer-events:none;
  transition: opacity .12s ease;
  font-weight:600;
  z-index: 50;
}
.tip:hover::after,
.tip:focus::after,
.tip:active::after{ opacity:1; }

.notice.compact{ padding:12px 12px; }
.tinyicon img{ width:20px; height:20px; display:block; opacity:.95; }

select option{ background: rgba(10,22,35,.98); color: rgba(255,255,255,.95); }


/* ===== Ciudades: títulos de sección (v7) ===== */
.sectionTitle{
  height: 42px;
  display:flex;
  align-items:center;
  padding:0 12px;
  border-radius: 12px;
  border:1px solid var(--line2);
  background: rgba(10,25,34,.38);
  font-weight: 900;
  letter-spacing: .02em;
  color: rgba(255,255,255,.92);
  margin-bottom: 10px;
}
.sectionTitle--ok{ background: rgba(20,85,105,.40); }
.sectionTitle--warn{ background: rgba(125,90,25,.30); }


/* ===== Ruta: panel lateral + reglas por mercancía (v8) ===== */
.routeSide .card-body{ display:grid; gap:14px; }
.rulesList{ display:grid; gap:10px; }
.ruleItem{
  border:1px solid var(--line2);
  border-radius: 14px;
  background: rgba(6,16,24,.26);
  padding: 10px 10px;
}
.ruleHead{
  display:flex;
  align-items:center;
  gap:10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.ruleName{ font-weight: 900; font-size: 14px; line-height: 1.15; }
.ruleGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 10px;
}
.ruleCell{ display:grid; gap:6px; }
.ruleLbl{ font-size: 12px; color: var(--muted); font-weight: 700; }
.ruleCell .inp-mini{ width: 100%; }

@media (max-width: 940px){
  .ruleGrid{ grid-template-columns: 1fr; }
}


/* Tabla compacta (sin scroll horizontal forzado) */
.tbl-compact{ min-width: 0; table-layout: fixed; }
.tbl-compact th, .tbl-compact td{ padding: 8px 10px; }
.tbl-compact th:nth-child(1), .tbl-compact td:nth-child(1){ width: 50%; }
.tbl-compact th:nth-child(2), .tbl-compact td:nth-child(2){ width: 25%; }
.tbl-compact th:nth-child(3), .tbl-compact td:nth-child(3){ width: 25%; }
.tbl-compact .td-name b{ white-space: normal; }


/* Unificar encabezados: cualquier <h3> dentro de secciones se ve como sectionTitle */
.card-body h3{
  margin: 0 0 10px 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.10);
  font-weight: 900;
  font-size: 13px;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: rgba(255,255,255,.92);
}


/* Ruta: precio actual + OK/NO */
.pricecheck{
  display:flex;
  align-items:center;
  gap:8px;
  margin-left:auto;
}
.pricecheck .mini{ opacity:.75; font-size:11px; }
.pill{ display:inline-flex; align-items:center; justify-content:center; padding:4px 10px; border-radius:999px; font-weight:800; font-size:11px; border:1px solid rgba(255,255,255,.14); }
.pill.ghost{ background: rgba(0,0,0,.12); color: rgba(255,255,255,.75); }
.pill.ok{ background: rgba(40,160,110,.18); border-color: rgba(40,160,110,.35); color: rgba(180,255,220,.95); }
.pill.bad{ background: rgba(200,70,70,.16); border-color: rgba(200,70,70,.35); color: rgba(255,210,210,.95); }

/* ===== Iconos de ayuda (ayuda.png) ===== */
.help-ico{
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  border-radius: 999px;
}
.help-ico:hover{ filter: brightness(1.06); }
.help-ico:active{ transform: translateY(1px); }
.help-ico:focus-visible{ outline: none; box-shadow: 0 0 0 3px rgba(122,208,255,.18); }

.help-img{
  width: 22px;
  height: 22px;
  display:block;
}

.tbl-compact{ min-width:0; table-layout: fixed; }

.chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  background: rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.14);
  font-weight:700;
  font-size:12px;
}
.chip-x{
  width:22px;height:22px;border-radius:999px;
  border:1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.18);
  color: rgba(255,255,255,.9);
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.chip-x:hover{ background: rgba(0,0,0,.28); }

/*
  Nota responsive:
  - En móvil/tablet (<= 940px) el layout debe ser 1 columna.
  - Evitamos que un breakpoint más amplio sobreescriba ese comportamiento.
*/
@media (min-width: 941px) and (max-width: 1180px){
  .grid{ grid-template-columns: minmax(0,1fr) 280px; }
}

/* Resumen de ruta: dos columnas claras */
.plan-headbar{
  padding:12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
}
.plan-title{ font-weight: 900; }
.plan-grid{ display:grid; grid-template-columns: 1fr 1fr; gap:12px; }
.plan-col-title{
  font-weight: 900;
  font-size: 12px;
  letter-spacing: .2px;
  padding:8px 10px;
  border-radius: 10px;
  background: rgba(0,0,0,.18);
  border: 1px solid rgba(255,255,255,.10);
  margin-bottom:8px;
}
.plan-col-list{ display:flex; flex-direction:column; gap:8px; }
@media (max-width: 920px){
  .plan-grid{ grid-template-columns: 1fr; }
}

/* Back to top */
.top-anchor{ position:absolute; top:0; left:0; }
.backtop{
  position:fixed;
  left:auto;
  right: calc(18px + env(safe-area-inset-right));
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index:20;
  width:40px;
  height:40px;
  border-radius: 14px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  color: var(--ink);
  border:1px solid rgba(255,255,255,.16);
  background: linear-gradient(180deg, rgba(122,208,255,.18), rgba(10,25,34,.86));
  box-shadow: var(--shadow2);
  opacity:.92;
  transform: translateY(0);
  pointer-events:auto;
  transition: opacity .18s ease, transform .18s ease, filter .18s ease;
}
.backtop.is-visible{
  opacity:1;
  transform: translateY(0);
  pointer-events:auto;
}
.backtop:hover{ filter: brightness(1.08); }

.brand-mark{
  width:52px;
  height:52px;
  border-radius: 16px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.18);
  box-shadow: var(--shadow2);
  display:flex;
  align-items:center;
  justify-content:center;
}
.brand-mark img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.backtop-ico{
  width:22px;
  height:22px;
  fill: rgba(255,255,255,.92);
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.45));
}
.backtop:active{ transform: translateY(1px); }

@keyframes anchorPull{
  0%{ transform: translateY(0) rotate(0deg); }
  25%{ transform: translateY(-2px) rotate(-8deg); }
  55%{ transform: translateY(2px) rotate(10deg); }
  85%{ transform: translateY(-1px) rotate(-6deg); }
  100%{ transform: translateY(0) rotate(0deg); }
}
.backtop.is-pull .backtop-ico{
  animation: anchorPull .55s ease-in-out;
}

/* Nubes en cabecera (sutiles y sin molestar) */
.topbar{ position:relative; overflow:hidden; }
.bg-clouds{
  position:absolute;
  top:0; left:0; right:0;
  height:260px;
  pointer-events:none;
  overflow:hidden;
  opacity:.95;
  mix-blend-mode: screen;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 55%, rgba(0,0,0,0) 100%);
  mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) 55%, rgba(0,0,0,0) 100%);
}

.cloud{
  position:absolute;
  top:10px;
  left:-40%;
  width:200px;
  height:54px;
  background: rgba(255,255,255,.52);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px;
  filter: blur(.8px);
  box-shadow: 0 10px 26px rgba(0,0,0,.18);
}
.cloud::before, .cloud::after{
  content:"";
  position:absolute;
  background: inherit;
  border: inherit;
  border-radius: 999px;
}
.cloud::before{ width:70px; height:54px; left:22px; top:-28px; }
.cloud::after{ width:90px; height:64px; left:72px; top:-34px; }

.c1{ top:6px;  width:220px; height:52px; opacity:.60; animation: cloudMove 46s linear infinite; }
.c2{ top:26px; width:170px; height:44px; opacity:.52; animation: cloudMove 34s linear infinite; animation-delay:-10s; }
.c3{ top:14px; width:140px; height:38px; opacity:.46; animation: cloudMove 28s linear infinite; animation-delay:-18s; }
.c4{ top:34px; width:240px; height:56px; opacity:.40; animation: cloudMove 58s linear infinite; animation-delay:-25s; }

@keyframes cloudMove{
  0%{ transform: translateX(0); }
  100%{ transform: translateX(160%); }
}
/* Asegura que el contenido vaya por encima */
.topbar > .brand, .topbar > .top-actions{ position:relative; z-index:1; }

/* Top nav layout */
.topnav{ overflow:hidden; }
.tabs-left{
  display:flex;
  gap:8px;
  align-items:center;
  overflow:auto;
  padding: 2px 6px;
  scrollbar-width: none;
}
.tabs-left::-webkit-scrollbar{ display:none; }

.tabs-center.brand{
  display:flex;
  align-items:center;
  gap:10px;
  justify-self:center;
  position:relative;
  z-index:1;
}
.tabs-right{
  display:flex;
  gap:8px;
  align-items:center;
  justify-self:end;
  position:relative;
  z-index:1;
}

/* Make sure content sits above clouds */
.tabs-left, .tabs-center, .tabs-right{ position:relative; z-index:1; }
.bg-clouds{ position:absolute; inset:0; pointer-events:none; z-index:0; opacity:.92; overflow:hidden; }

/* Brand compact in top bar */
.brand-mark{
  width:46px; height:46px;
  border-radius: 14px;
  overflow:hidden;
  box-shadow: var(--shadow2);
  border:1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.20);
}
.brand-mark img{ width:100%; height:100%; object-fit:contain; display:block; }
.brand-title{ font-size:16px; font-weight:900; line-height:1.05; }
.brand-sub{ font-size:12px; opacity:.9; line-height:1.05; white-space:nowrap; }

@media (max-width: 860px){
  .brand-sub{ display:none; }
  .tabs{ grid-template-columns: 1fr auto 1fr; }
  .tabs-right{ gap:6px; }
}
@media (max-width: 520px){
  .brand-title{ font-size:14px; }
  .brand-mark{ width:40px; height:40px; }
}

/* On smaller screens, allow actions to scroll instead of disappearing */
.tabs-right{ overflow:auto; scrollbar-width:none; }
.tabs-right::-webkit-scrollbar{ display:none; }

@media (max-width: 860px){
  .btn{ padding: 8px 10px; }
  .tabs{ gap:8px; }
}
@media (max-width: 720px){
  .tabs{ grid-template-columns: 1fr auto 1fr; }
  .tabs-right .btn{ padding: 8px 9px; font-size: 12px; }
  .tabs-left{ gap:6px; }
}


/* Monedas (precios) */
.money-inline{
  display:inline-flex;
  align-items:center;
  gap:4px; /* deja unos píxeles entre número e icono */
  white-space:nowrap;
}
.coin{width:16px;
  height:16px;
  display:inline-block;
  vertical-align:-3px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.25));
  opacity:.95;;}
.coin-h{
  width:14px;
  height:14px;
  vertical-align:-2px;
  margin-right:6px;
  opacity:.95;
}
.inp-mini.money{
  padding-right:34px !important;
  background-image: url('./assets/icons/ui/monedas.png');
  background-repeat: no-repeat;
  background-position: calc(100% - 10px) 50%;
  background-size: 16px 16px;
}


/* Tinieblas suaves sobre el fondo (parte superior) */
.bg-clouds::before{
  content:"";
  position:absolute;
  inset:-30% -20%;
  background:
    radial-gradient(320px 160px at 12% 28%, rgba(20,40,55,.30), rgba(0,0,0,0) 70%),
    radial-gradient(360px 180px at 48% 18%, rgba(12,28,40,.22), rgba(0,0,0,0) 72%),
    radial-gradient(420px 220px at 82% 32%, rgba(18,36,50,.26), rgba(0,0,0,0) 74%);
  opacity:.65;
  filter: blur(10px);
  mix-blend-mode: multiply;
  animation: mistDrift 22s linear infinite;
  pointer-events:none;
}
.bg-clouds::after{
  content:"";
  position:absolute;
  inset:0;
  background: radial-gradient(900px 240px at 50% 40%, rgba(0,0,0,.38), rgba(0,0,0,.08) 55%, rgba(0,0,0,0) 78%);
  pointer-events:none;
}

@keyframes mistDrift{
  0%{ transform: translateX(-4%) translateY(0); }
  50%{ transform: translateX(4%) translateY(-1%); }
  100%{ transform: translateX(-4%) translateY(0); }
}


/* ===== Idioma (selector) ===== */
.lang select{
  appearance:none;
  border:1px solid var(--line2);
  background: rgba(10,25,34,.40);
  color: var(--ink);
  padding:10px 12px;
  border-radius: 999px;
  font-weight:800;
  cursor:pointer;
}
.lang select:hover{
  border-color: rgba(122,208,255,.35);
  background: rgba(122,208,255,.10);
}

/* ===== Footer ===== */
.footer{
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 16px 18px;
  color: rgba(230,245,255,.78);
  font-size: 13px;
}
.footer-inner{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  justify-content:center;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(10, 25, 34, .74);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow2);
}
.footer-link{
  color: rgba(122,208,255,.95);
  text-decoration:none;
  font-weight:800;
}
.footer-link:hover{ text-decoration: underline; }
.footer-sep{ opacity:.55; }

/* ===== Panel lateral móvil (widget) ===== */
.side-overlay{
  position:fixed; inset:0;
  background: rgba(0,0,0,.45);
  opacity:0; pointer-events:none;
  transition: opacity .18s ease;
  z-index:58;
}
.side-fab{
  position:fixed;
  left: calc(16px + env(safe-area-inset-left)); /* abajo izquierda */
  right:auto;
  bottom: calc(88px + env(safe-area-inset-bottom)); /* encima del back-to-top */
  z-index:62;
  display:none;
  align-items:center;
  justify-content:center;
  border-radius: 999px;
  padding: 10px 14px;
  border:1px solid rgba(122,208,255,.30);
  background: rgba(10,25,34,.55);
  color: var(--ink);
  box-shadow: var(--shadow2);
  font-weight:900;
  cursor:pointer;
}
.side-fab:hover{
  background: rgba(122,208,255,.10);
  border-color: rgba(122,208,255,.45);
}

@media (max-width: 940px){
  body.side-open .side-overlay{opacity:1; pointer-events:auto;}
  .side-fab{display:inline-flex;}
  /* convierte el aside derecho en un panel flotante */
  .route-grid > aside.card{
    position:fixed;
    right:12px;
    left:12px;
    top: calc(var(--tabsH) + 12px);
    bottom: 12px;
    z-index:61;
    width:auto;
    max-width: 520px;
    margin: 0 auto;
    transform: translateY(110%);
    opacity:0;
    visibility:hidden;
    pointer-events:none;
    transition: transform .22s ease, opacity .22s ease;
    overflow:auto;
  }
  body.side-open .route-grid > aside.card{
    transform: translateY(0);
    opacity:1;
    visibility:visible;
    pointer-events:auto;
  }
}

/* ===== Tabs responsive ===== */
@media (max-width: 940px){
  .tabs{
    grid-template-columns: 1fr;
    grid-template-areas:
      "center"
      "left"
      "right";
    gap:8px;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  }
  .tabs-left{ grid-area:left; justify-content:center; }
  .tabs-center{ grid-area:center; justify-content:center; }
  .tabs-right{ grid-area:right; justify-content:center; flex-wrap:wrap; }
}

/* ===== Splash ===== */
.splash{
  position:fixed;
  inset:0;
  z-index:90;
  display:none;
  align-items:center;
  justify-content:center;
  padding: 18px;
}
body.splash-open .splash{display:flex;}
.splash::before{
  content:"";
  position:absolute;
  inset:0;
  background:
    radial-gradient(1200px 520px at 50% -10%, rgba(255,255,255,.06), rgba(0,0,0,0)),
    linear-gradient(180deg, rgba(0,0,0,.62), rgba(0,0,0,.78));
  pointer-events:none;
}
.splash-card{
  position:relative;
  z-index:2;
  width:min(560px, 92vw);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(6,16,22,.62);
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
  padding: 18px 18px 16px;
  text-align:center;
  backdrop-filter: blur(6px);
}
.splash-logo{
  width: 160px;
  height:auto;
  display:block;
  margin: 8px auto 8px;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,.45));
}
.splash-title{
  font-size: 26px;
  font-weight: 900;
  letter-spacing: .4px;
  color: rgba(255,255,255,.96);
}
.splash-sub{
  margin-top: 4px;
  color: rgba(230,245,255,.80);
  font-weight: 700;
}
.splash-actions{
  margin-top: 14px;
  display:flex;
  gap:10px;
  justify-content:center;
  flex-wrap:wrap;
}
.splash-note{
  margin-top: 12px;
  font-size: 13px;
  color: rgba(230,245,255,.70);
}

/* Nubes / penumbra realistas (sin molestar) */
.splash-clouds{
  position:absolute;
  inset:0;
  overflow:hidden;
  z-index:1;
  pointer-events:none;
}
.scloud{
  position:absolute;
  top: 10%;
  width: 120%;
  height: 220px;
  left: -20%;
  filter: blur(18px);
  opacity: .42;
  background:
    radial-gradient(closest-side at 20% 60%, rgba(255,255,255,.22), rgba(255,255,255,0)),
    radial-gradient(closest-side at 45% 45%, rgba(255,255,255,.18), rgba(255,255,255,0)),
    radial-gradient(closest-side at 70% 62%, rgba(255,255,255,.20), rgba(255,255,255,0)),
    radial-gradient(closest-side at 85% 50%, rgba(255,255,255,.14), rgba(255,255,255,0));
  mix-blend-mode: screen;
}
.scloud.s1{ top: 10%; height: 240px; animation: scloudMove1 22s linear infinite; }
.scloud.s2{ top: 22%; height: 260px; opacity:.34; animation: scloudMove2 30s linear infinite; }
.scloud.s3{ top: 6%; height: 210px; opacity:.26; animation: scloudMove3 36s linear infinite; }
.scloud.s4{ top: 32%; height: 220px; opacity:.22; animation: scloudMove4 40s linear infinite; }

@keyframes scloudMove1{ from{transform: translateX(-8%);} to{transform: translateX(8%);} }
@keyframes scloudMove2{ from{transform: translateX(10%);} to{transform: translateX(-10%);} }
@keyframes scloudMove3{ from{transform: translateX(-12%);} to{transform: translateX(12%);} }
@keyframes scloudMove4{ from{transform: translateX(14%);} to{transform: translateX(-14%);} }




/* Modal scroll + lock body scroll when open */
body.modal-open{ overflow: hidden; }
.modal-card{
  max-height: 86vh;
  display: flex;
  flex-direction: column;
}
.modal-body{
  overflow: auto;
  max-height: calc(86vh - 130px);
}
@media (max-width: 720px){
  .modal-card{ max-height: 88vh; }
  .modal-body{ max-height: calc(88vh - 130px); }
}


/* Splash hides app/nav/footer */
body.splash-open #app{visibility:hidden;}
body.splash-open .topnav, body.splash-open .footer{opacity:0; pointer-events:none;}

.plan-item{display:flex; gap:10px; align-items:center;}
.plan-item .tinyicon{flex:0 0 auto; width:18px; height:18px;}
.plan-item .tinyicon img{width:18px; height:18px; display:block;}
.plan-item .plan-txt{min-width:0;}
.plan-item b{display:inline-flex; align-items:center; gap:6px;}


/* ===== Mejoras responsive (móvil / tablet) ===== */
@media (max-width: 720px){
  .main{ padding: 12px; }
  .card-head{ flex-wrap:wrap; }
  .field{ min-width: 0; width: 100%; }
  .item{ flex-direction:column; align-items:flex-start; }
  .item-right{ width:100%; justify-content:flex-start; }
  .tbl{ min-width: 680px; }
}

@media (max-width: 520px){
  .main{ padding: 10px; }
  .card-body{ padding: 12px; }
  .card-head{ padding: 12px 12px 9px; }
  .btn{ padding: 8px 10px; font-size: 13px; }
  .tab{ padding: 8px 10px; font-size: 12px; }
  .tbl{ min-width: 600px; }
  .modal-card{ margin: 12px; max-width: none; width: calc(100% - 24px); }
  .modal-body{ max-height: calc(100vh - 190px); }
}
