/* Panel de gestión · Volcanarias. Menú lateral azul oscuro con rayas naranjas, cabecera azul, fondo crema y tarjetas blancas.
   Ordenador: pantalla completa con menú lateral. Móvil: barra inferior y tablas desplazables. */
:root {
  --side: #101b4b; --band: #232f66; --band-2: #1a2557; --orange: #e0702a; --orange-2: #f08744;
  --bg: #efece4; --card: #fff; --card-2: #f7f5ef; --line: #e6e1d5; --line-2: #d6d0c0;
  --text: #1a2250; --muted: #6b7190; --faint: #9aa0b8;
  --ok: #2f7d3b; --ok-bg: #e1f1e4; --warn: #8a6d1f; --warn-bg: #f4ead0; --bad: #b03a3a; --bad-bg: #f7dcdc;
  --shadow: 0 1px 2px rgba(26, 34, 80, .06), 0 6px 20px -10px rgba(26, 34, 80, .18);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif; --head: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --sidew: 196px; --tabbar: 62px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; font-family: var(--head); letter-spacing: .01em; }
.hide { display: none !important; }
.muted { color: var(--muted); }

/* ---------- pantalla de espera ---------- */
#espera { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 24px; }
#espera .box { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 28px; text-align: center; max-width: 340px; width: 100%; box-shadow: var(--shadow); }
#espera img { height: 44px; margin-bottom: 8px; } #espera h2 { font-size: 24px; margin: 4px 0 6px; } #espera .btn { margin-top: 14px; }

/* ---------- botones y campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-2); background: var(--card-2); color: var(--text); border-radius: 8px; padding: 8px 14px; font-weight: 600; font-size: 13px; text-decoration: none; transition: filter .15s, background .15s; }
.btn:hover { background: #efeadd; } .btn.pri { background: var(--orange); border-color: var(--orange); color: #fff; } .btn.pri:hover { background: var(--orange-2); }
.btn.dar { background: var(--band); border-color: var(--band); color: #fff; } .btn.dan { color: var(--bad); } .btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn[disabled] { opacity: .5; pointer-events: none; } .btn.block { display: flex; width: 100%; }
.input, select.input { width: 100%; border: 1px solid var(--line-2); background: #fff; border-radius: 8px; padding: 9px 12px; outline: none; font-size: 13.5px; }
.input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(224, 112, 42, .18); }
select.input { appearance: auto; padding-right: 6px; }
label.campo { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }

/* ---------- estructura ---------- */
.shell { display: grid; grid-template-columns: var(--sidew) 1fr; height: 100vh; }
.side { background: var(--side); color: #c9d0ea; display: flex; flex-direction: column; padding: 14px 8px 12px; min-height: 0; }
.side .logo { background: #f3f0e8; border-radius: 10px; padding: 8px 10px; margin: 0 6px 14px; display: grid; place-items: center; }
.side .logo img { max-width: 100%; max-height: 52px; display: block; object-fit: contain; }
.side h1 { color: #fff; font-size: 21px; font-weight: 700; padding: 0 8px 8px; }
.side .raya { height: 6px; margin: 0 -8px 12px; background: repeating-linear-gradient(115deg, var(--orange) 0 12px, transparent 12px 20px); }
.side nav { display: grid; gap: 3px; }
.side .nav { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 8px; color: #c9d0ea; text-decoration: none; font-weight: 600; font-size: 13px; border: 0; background: transparent; text-align: left; width: 100%; }
.side .nav::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .6; flex: none; }
.side .nav:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side .nav.on { background: var(--orange); color: #fff; } .side .nav.on::before { opacity: 1; }
.side .nav .ic-m { display: none; }
.side .sp { flex: 1; }
.side .pie { font-size: 10.5px; color: #8e97bd; padding: 10px 8px; line-height: 1.35; border-top: 1px solid rgba(255, 255, 255, .08); }
.side .pie .btn { background: transparent; border-color: rgba(255, 255, 255, .35); color: #fff; margin-top: 8px; font-size: 11.5px; padding: 6px 10px; }
.main { min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.cab { background: var(--band); color: #fff; padding: 12px 22px; display: flex; align-items: center; gap: 16px; min-height: 62px; flex: none; }
.cab .tt { flex: 1; min-width: 0; } .cab h2 { font-size: 26px; line-height: 1.1; font-weight: 700; } .cab small { display: block; color: #b4bde0; font-size: 12px; }
.cab .estado { display: flex; align-items: center; gap: 10px; font-size: 12px; color: #c9d0ea; white-space: nowrap; flex-wrap: wrap; justify-content: flex-end; }
.cab .estado .quien b { color: #fff; font-weight: 600; } .cab .estado .punto { width: 8px; height: 8px; border-radius: 50%; background: #4ec27c; display: inline-block; margin-right: 6px; } .cab .estado .punto.off { background: #e05a5a; }
.vista { flex: 1; overflow-y: auto; padding: 20px 22px 40px; -webkit-overflow-scrolling: touch; }
.barra-fecha { background: var(--band-2); color: #fff; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 10px 16px; flex: none; }
.barra-fecha h3 { font-size: 17px; font-weight: 600; min-width: 220px; text-align: center; }
.rd { width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .4); background: transparent; color: #fff; font-size: 16px; line-height: 1; display: grid; place-items: center; padding: 0; }
.rd:hover { background: rgba(255, 255, 255, .14); }
.barra-fecha .btn.pri { padding: 5px 12px; font-size: 12px; }

.seg { display: inline-flex; background: #fff; border: 1px solid var(--line-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 7px; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--band); color: #fff; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.card.p { padding: 20px 22px; } .card h3 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.sub { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; }

/* ---------- agenda: semana ---------- */
.dia { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; overflow: hidden; box-shadow: var(--shadow); }
.dia.hoy { border: 2px solid var(--orange); }
.dia-cab { background: var(--band); color: #fff; display: flex; align-items: center; gap: 10px; padding: 9px 16px; flex-wrap: wrap; }
.dia-cab b { font-family: var(--head); font-size: 18px; letter-spacing: .03em; text-transform: uppercase; } .dia-cab .f { color: #b4bde0; font-size: 13px; }
.dia-cab .hoy-b { background: var(--orange); color: #fff; font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 4px; letter-spacing: .06em; }
.dia-cab .res { margin-left: auto; font-size: 12px; color: #dfe4f7; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 8px 12px; background: #fbfaf6; }
table.t td { padding: 7px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.dia table.t td { font-size: 13px; }
.dia table.t th:nth-child(1) { width: 26%; } .dia table.t th:nth-child(2) { width: 176px; } .dia table.t th:nth-child(4) { width: 150px; } .dia table.t th:nth-child(5) { width: 44px; }
.dia tr.fila { cursor: default; } .dia tr.fila.ed { cursor: pointer; } .dia tr.fila.ed:hover td { background: #fbf9f3; }
.placa { display: inline-flex; align-items: stretch; border: 2px solid var(--band); border-radius: 6px; background: #fff; overflow: hidden; font-family: 'Courier New', ui-monospace, monospace; font-weight: 800; font-size: 13.5px; letter-spacing: .06em; }
.placa i { background: var(--band); color: #fff; font-style: normal; font-size: 8px; padding: 2px 5px; display: grid; place-items: center; font-family: var(--font); font-weight: 700; }
.placa b { padding: 2px 14px; min-width: 100px; text-align: center; }
.asis { border: 1px solid transparent; border-radius: 7px; padding: 5px 8px; font-size: 12.5px; font-weight: 600; width: 118px; cursor: pointer; }
.asis.si { background: var(--ok-bg); color: var(--ok); } .asis.pendiente { background: var(--warn-bg); color: var(--warn); } .asis.no { background: var(--bad-bg); color: var(--bad); }
.asis[disabled] { opacity: 1; cursor: default; appearance: none; text-align: center; }
.xb { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-2); background: #fff; color: var(--muted); font-size: 12px; line-height: 1; padding: 0; display: grid; place-items: center; }
.xb:hover { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.anadir { display: block; width: 100%; text-align: center; border: 0; border-top: 1px solid var(--line); background: #fcfbf8; color: var(--muted); padding: 9px; font-size: 12.5px; font-weight: 600; }
.anadir:hover { background: #f6f3ea; color: var(--text); }
.dia-vacio { padding: 8px 16px; color: var(--faint); font-size: 12.5px; }

/* ---------- agenda: mes ---------- */
.mes { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.mes-g { display: grid; }
.mes-h { background: var(--band); color: #fff; font-family: var(--head); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-align: center; padding: 9px 4px; text-transform: uppercase; }
.mes-c { min-height: 54px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); padding: 6px 4px; text-align: center; background: #fff; cursor: pointer; }
.mes-c:nth-child(-n+7) { border-top: 0; }
.mes-c.otro { background: #f7f5ef; color: var(--faint); } .mes-c b { display: block; font-family: var(--head); font-size: 15px; font-weight: 700; }
.mes-c.hoy { outline: 2px solid var(--orange); outline-offset: -2px; } .mes-c:hover { background: #fbf9f3; }
.chip { display: inline-block; background: #ebe6d8; color: #6f6a58; border-radius: 99px; padding: 0 8px; font-size: 11px; font-weight: 600; margin-top: 2px; }

/* ---------- campañas ---------- */
.tipos { display: flex; gap: 16px; flex-wrap: wrap; }
.tipo-c { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px 28px; min-width: 210px; box-shadow: var(--shadow); text-align: left; cursor: pointer; }
.tipo-c:hover { border-color: var(--orange); } .tipo-c h3 { font-size: 26px; } .tipo-c span { color: var(--muted); font-size: 12.5px; }
.camp-cab { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
.camp-cab .tt { flex: 1; min-width: 180px; } .camp-cab h3 { font-size: 26px; margin-top: 14px; }
.camp-cab .acc { display: grid; gap: 8px; justify-items: stretch; }
.filtros { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 6px; } .filtros .input { width: auto; } .filtros .grow { flex: 1; min-width: 220px; }
.cuenta { font-size: 12px; color: var(--muted); margin: 8px 0; }
.tw { overflow-x: auto; border-radius: 8px; }
.tabla-v { min-width: 1180px; }
table.tv { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tv th { background: var(--band); color: #fff; text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 10px 10px; position: sticky; top: 0; z-index: 2; white-space: nowrap; }
table.tv td { padding: 7px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
table.tv tr:hover td { background: #fbf9f3; } table.tv td.num { font-variant-numeric: tabular-nums; }
.mini { border: 1px solid var(--line-2); border-radius: 6px; background: #f6f3ea; padding: 4px 6px; font-size: 12px; max-width: 120px; }
.mini.si { background: var(--ok-bg); color: var(--ok); border-color: #bcdcc2; } .mini.no { background: var(--bad-bg); color: var(--bad); border-color: #ecbcbc; }
input.mini[type=date] { max-width: 128px; } .mini[disabled] { opacity: .85; }
.camp-chips { display: flex; gap: 4px; flex-wrap: wrap; } .camp-chips span { background: #ebe6d8; border-radius: 5px; padding: 0 6px; font-size: 11.5px; font-weight: 600; }
tr.clic { cursor: pointer; }

/* ---------- histórico ---------- */
.stats4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px 10px; text-align: center; box-shadow: var(--shadow); }
.stat b { display: block; font-family: var(--head); font-size: 40px; line-height: 1; font-weight: 700; } .stat span { font-size: 12px; color: var(--muted); }
.barra-as { display: flex; height: 20px; border-radius: 6px; overflow: hidden; margin: 12px 0 10px; background: #eee; }
.barra-as i { display: block; height: 100%; } .leyenda { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.leyenda span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--c, #999); }
.mes-fila { display: grid; grid-template-columns: 64px 1fr 40px; gap: 12px; align-items: center; margin: 6px 0; font-size: 12px; color: var(--muted); }
.mes-fila .bar { height: 12px; background: #eee9dc; border-radius: 4px; overflow: hidden; } .mes-fila .bar i { display: block; height: 100%; background: var(--orange); border-radius: 4px; }
.mes-fila b { color: var(--text); text-align: right; }
.lista-cl { margin-top: 6px; } .lista-cl div { display: flex; justify-content: space-between; padding: 7px 4px; border-top: 1px solid var(--line); font-size: 13px; } .lista-cl div:first-child { border-top: 0; }
.vacio { text-align: center; color: var(--muted); padding: 30px; }

/* ---------- ajustes ---------- */
.aj-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; align-items: start; margin-bottom: 18px; }
.logo-prev { width: 120px; height: 70px; border: 1px solid var(--line-2); border-radius: 10px; background: #f3f0e8; display: grid; place-items: center; margin: 6px 0 10px; } .logo-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.copias { margin-top: 12px; } .copias div { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; } .copias div:first-child { border-top: 0; } .copias .f { flex: 1; } .copias small { color: var(--faint); }
.cl-fila { display: flex; align-items: center; gap: 10px; background: #f3f0e8; border-radius: 8px; padding: 9px 12px; margin: 6px 0; font-size: 13px; font-weight: 600; } .cl-fila .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .cl-fila small { color: var(--muted); font-weight: 400; }
.cl-fila.oc { opacity: .6; }
.cl-lista { max-height: 460px; overflow-y: auto; }

/* ---------- ventana (capa) ---------- */
#capa { position: fixed; inset: 0; z-index: 60; background: rgba(16, 27, 75, .55); display: none; align-items: center; justify-content: center; padding: 20px; }
#capa.on { display: flex; }
.hoja { background: #fff; width: 100%; max-width: 520px; max-height: 90vh; border-radius: 16px; box-shadow: 0 30px 80px -20px rgba(16, 27, 75, .6); display: flex; flex-direction: column; overflow: hidden; }
.hoja.ancha { max-width: 760px; }
.hoja .cabh { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); } .hoja .cabh h3 { flex: 1; font-size: 22px; }
.hoja .cuerpo { padding: 6px 20px 16px; overflow-y: auto; flex: 1; } .hoja .pie { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: #fbfaf6; }
.hoja .pie .izq { margin-right: auto; }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .ac { position: relative; }
.sug { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; background: #fff; border: 1px solid var(--line-2); border-radius: 8px; box-shadow: var(--shadow); margin-top: 2px; max-height: 220px; overflow-y: auto; }
.sug button { display: flex; justify-content: space-between; gap: 10px; width: 100%; border: 0; background: #fff; padding: 8px 12px; text-align: left; font-size: 13px; } .sug button:hover, .sug button.on { background: #fbf1e8; } .sug small { color: var(--faint); }
.mapa { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; align-items: center; margin: 10px 0; } .mapa label { font-size: 13px; font-weight: 600; }
.previa { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; margin: 10px 0; } .previa table { border-collapse: collapse; font-size: 12px; width: 100%; } .previa th, .previa td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; } .previa th { background: #f6f3ea; }
.resumen-imp { background: #f6f3ea; border-radius: 10px; padding: 10px 14px; margin: 10px 0; font-size: 13px; } .resumen-imp b { font-family: var(--head); font-size: 18px; }
.aviso-w { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 8px 12px; font-size: 12.5px; margin: 8px 0; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); background: var(--band); color: #fff; padding: 11px 18px; border-radius: 10px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: all .25s; z-index: 90; font-weight: 500; font-size: 13px; max-width: min(92vw, 460px); }
#toast.on { opacity: 1; transform: translate(-50%, 0); } #toast.err { background: var(--bad); }

/* ---------- móvil ---------- */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 1fr var(--tabbar); height: 100dvh; }
  .side { grid-row: 2; flex-direction: row; padding: 0; background: var(--side); border-top: 3px solid var(--orange); }
  .side .logo, .side h1, .side .raya, .side .pie, .side .sp { display: none; }
  .side nav { display: flex; flex: 1; gap: 0; } .side .nav { flex: 1; flex-direction: column; justify-content: center; gap: 2px; padding: 6px 2px; border-radius: 0; font-size: 10.5px; text-align: center; } .side .nav::before { display: none; }
  .side .nav .ic-m { display: block; font-size: 17px; line-height: 1; } .side .nav.on { background: rgba(224, 112, 42, .95); }
  .cab { padding: 10px 14px; min-height: 54px; } .cab h2 { font-size: 22px; } .cab .estado { font-size: 11px; max-width: 46%; }
  .vista { padding: 14px 12px 24px; }
  .barra-fecha h3 { min-width: 0; font-size: 14px; flex: 1; }
  .dia-cab .res { margin-left: 0; width: 100%; font-size: 11.5px; }
  .dia table.t thead { display: none; }
  .dia table.t, .dia table.t tbody { display: block; } .dia table.t tr.fila { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 10px 14px; border-top: 1px solid var(--line); }
  .dia table.t td { display: block; border: 0; padding: 0; } .dia table.t td:nth-child(1) { font-weight: 700; } .dia table.t td:nth-child(3) { grid-column: 1 / -1; color: var(--muted); } .dia table.t td:nth-child(2) { grid-row: 2; }
  .dia table.t td:nth-child(4) { grid-row: 1 / 3; grid-column: 2; align-self: center; } .dia table.t td:nth-child(5) { display: none; }
  .asis { width: 108px; }
  .mes-c { min-height: 46px; padding: 4px 2px; } .chip { padding: 0 5px; font-size: 10px; }
  .aj-grid { grid-template-columns: 1fr; } .f2 { grid-template-columns: 1fr; } .mapa { grid-template-columns: 1fr; }
  #capa { align-items: flex-end; padding: 0; } .hoja { max-width: none; border-radius: 16px 16px 0 0; max-height: 92dvh; }
  .camp-cab .acc { grid-auto-flow: column; }
}
@media print { .side, .cab, .barra-fecha { display: none; } .shell { display: block; height: auto; } .vista { overflow: visible; } }
