/* Calendario Sistemas - mismo estilo que el Portal Nutreco (reemplaza a Bootstrap + tema "Universal") */

:root {
  --azul: #005BAB; --azul-ui: #005BAB; --celeste: #6BCFF6; --oscuro: #2B2C36;
  --bg: #f4f6f9; --panel: #ffffff; --txt: #1c2330; --mut: #5f6b7a; --line: #e1e6ec;
  --sombra: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .06);
  --sombra-hover: 0 6px 24px rgba(0, 91, 171, .18);
  --radio: 14px;
  --hero-bg: linear-gradient(135deg, #DDF1FD 0%, #94D2F7 50%, #46A0E8 100%);
  --hero-txt: #0B2A4A; --hero-sub: #1d4a75;
  --hero-glow: rgba(255, 255, 255, .65); --hero-glow2: rgba(0, 91, 171, .22);
  --hoy: rgba(107, 207, 246, .22); --peligro: #c62828;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --azul-ui: #6BCFF6;
    --bg: #14171c; --panel: #1c2128; --txt: #e6e9ef; --mut: #98a2b3; --line: #2c333d;
    --sombra: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
    --sombra-hover: 0 6px 24px rgba(107, 207, 246, .16);
    --hero-bg: linear-gradient(135deg, #10283f 0%, #1a4f87 55%, #2d86d0 100%);
    --hero-txt: #ffffff; --hero-sub: #cfe3f5; --hero-glow: rgba(107, 207, 246, .20); --hero-glow2: rgba(0, 0, 0, .25);
    --hoy: rgba(107, 207, 246, .16); --peligro: #ff8a80;
  }
}
:root[data-theme="dark"] {
  --azul-ui: #6BCFF6;
  --bg: #14171c; --panel: #1c2128; --txt: #e6e9ef; --mut: #98a2b3; --line: #2c333d;
  --sombra: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
  --sombra-hover: 0 6px 24px rgba(107, 207, 246, .16);
  --hero-bg: linear-gradient(135deg, #10283f 0%, #1a4f87 55%, #2d86d0 100%);
  --hero-txt: #ffffff; --hero-sub: #cfe3f5; --hero-glow: rgba(107, 207, 246, .20); --hero-glow2: rgba(0, 0, 0, .25);
  --hoy: rgba(107, 207, 246, .16); --peligro: #ff8a80;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--txt); font: 15px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
body.modal-abierto { overflow: hidden; }
a { color: var(--azul-ui); }
.contenedor { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--celeste); outline-offset: 2px; }

/* ---------- Barra superior ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--panel) 88%, transparent);
          backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--line); }
.topbar .contenedor { display: flex; align-items: center; gap: 18px; min-height: 64px; }
.marca-txt { color: var(--txt); text-decoration: none; font-weight: 700; font-size: 17px; white-space: nowrap; }
.marca-txt:hover { color: var(--azul-ui); }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 9px; color: var(--txt); text-decoration: none;
         font-weight: 600; font-size: 14px; white-space: nowrap; }
.nav a:hover { background: color-mix(in srgb, var(--azul-ui) 12%, transparent); color: var(--azul-ui); }
.nav a .fa { color: var(--azul-ui); }
.nav a[aria-current="page"] { background: color-mix(in srgb, var(--azul-ui) 14%, transparent); color: var(--azul-ui); }
.btn-tema { border: 1px solid var(--line); background: var(--panel); color: var(--txt); width: 38px; height: 38px; border-radius: 10px;
            cursor: pointer; font-size: 16px; flex: none; }
.btn-tema:hover { border-color: var(--azul-ui); color: var(--azul-ui); }

/* ---------- Portada ---------- */
.hero { background: var(--hero-bg); color: var(--hero-txt); position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0; pointer-events: none;
                background: radial-gradient(60% 90% at 12% 0%, var(--hero-glow) 0%, transparent 60%),
                            radial-gradient(50% 80% at 100% 100%, var(--hero-glow2) 0%, transparent 65%); }
.hero .contenedor { padding-top: 34px; padding-bottom: 78px; position: relative; z-index: 1; }
.hero-cab { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 30px; }
.hero-logo { display: inline-flex; flex: none; background: #fff; border-radius: 18px; padding: 10px 20px; box-shadow: 0 8px 24px rgba(11, 56, 97, .18); }
.hero-logo img { display: block; height: 64px; width: auto; }
.hero-texto { flex: 1 1 320px; min-width: 0; }
.hero h1 { font-size: clamp(26px, 4vw, 36px); line-height: 1.15; margin: 0 0 8px; font-weight: 700; color: var(--hero-txt); }
.hero p { margin: 0; color: var(--hero-sub); max-width: 62ch; font-size: 16px; }

/* ---------- Calendario ---------- */
.cal-seccion { margin-top: -40px; position: relative; z-index: 2; padding-bottom: 96px; }
.cal-barra { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-bottom: 14px; }
.leyenda { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.chip-col { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 10px; border-radius: 99px; border: 1px solid var(--line);
            background: var(--panel); color: var(--txt); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; box-shadow: var(--sombra);
            transition: opacity .15s ease, border-color .15s ease; }
.chip-col:hover { border-color: var(--celeste); }
.chip-col .punto { width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: 2px solid var(--c); flex: none; }
.chip-col[aria-pressed="false"] { opacity: .55; }
.chip-col[aria-pressed="false"] .punto { background: transparent; }
.btn-nuevo, .btn-pri { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; cursor: pointer;
                       background: var(--azul); color: #fff; font: inherit; font-weight: 700; font-size: 15px; padding: 11px 20px;
                       box-shadow: 0 6px 16px rgba(0, 91, 171, .28); transition: background .18s ease, transform .18s ease; }
.btn-nuevo:hover, .btn-pri:hover, .btn-nuevo:focus-visible, .btn-pri:focus-visible { background: #004a8c; transform: translateY(-1px); }
.btn-sec { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--txt); font: inherit; font-weight: 600;
           font-size: 15px; padding: 11px 18px; cursor: pointer; }
.btn-sec:hover { border-color: var(--azul-ui); color: var(--azul-ui); }
.btn-peligro { border: 1px solid color-mix(in srgb, var(--peligro) 45%, var(--line)); border-radius: 12px; background: transparent; color: var(--peligro);
               font: inherit; font-weight: 700; font-size: 15px; padding: 11px 16px; cursor: pointer; margin-right: auto; }
.btn-peligro:hover { background: color-mix(in srgb, var(--peligro) 12%, transparent); }
.cal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--sombra); }
.cal-ayuda { margin: 12px 4px 0; color: var(--mut); font-size: 13px; }

/* Botón flotante (solo celular) */
.fab { display: none; position: fixed; right: 18px; bottom: 18px; z-index: 15; width: 58px; height: 58px; border-radius: 50%; border: 0;
       background: var(--azul); color: #fff; font-size: 26px; cursor: pointer; box-shadow: 0 8px 22px rgba(0, 91, 171, .45); }
.fab:active { transform: scale(.96); }

/* ---------- FullCalendar (v3) adaptado al estilo del portal ---------- */
.fc { font-family: inherit; color: var(--txt); }
.fc-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.fc-toolbar > .fc-left, .fc-toolbar > .fc-center, .fc-toolbar > .fc-right { float: none; display: flex; align-items: center; gap: 8px; }
.fc-toolbar > .fc-clear { display: none; }
.fc-toolbar h2 { margin: 0; font-size: 22px; font-weight: 700; text-transform: capitalize; }
.fc-button { height: auto; padding: 8px 14px; border: 1px solid var(--line); background: var(--panel); background-image: none; color: var(--txt);
             text-shadow: none; box-shadow: none; font: inherit; font-size: 14px; font-weight: 600; text-transform: capitalize; border-radius: 0; }
.fc-button:hover, .fc-button:focus { background: color-mix(in srgb, var(--azul-ui) 10%, var(--panel)); color: var(--azul-ui); border-color: var(--line); }
.fc-today-button { border-radius: 10px !important; }
.fc-button-group { display: inline-flex; }
.fc-button-group > .fc-button { float: none; margin: 0 0 0 -1px; }
.fc-button-group > .fc-button:first-child { margin-left: 0; border-radius: 10px 0 0 10px; }
.fc-button-group > .fc-button:last-child { border-radius: 0 10px 10px 0; }
.fc-button-group > .fc-button:only-child { border-radius: 10px; }
.fc-state-active, .fc-state-down, .fc-button.fc-state-active:hover { background: var(--azul) !important; color: #fff !important; border-color: var(--azul) !important; }
.fc-state-disabled { opacity: .45; cursor: default; }

.fc-unthemed th, .fc-unthemed td, .fc-unthemed thead, .fc-unthemed tbody, .fc-unthemed .fc-divider, .fc-unthemed .fc-row,
.fc-unthemed .fc-content, .fc-unthemed .fc-popover, .fc-unthemed .fc-list-view, .fc-unthemed .fc-list-heading td { border-color: var(--line); }
.fc-unthemed .fc-popover { background: var(--panel); border-radius: 12px; box-shadow: var(--sombra-hover); overflow: hidden; }
.fc-unthemed .fc-popover .fc-header { background: var(--bg); color: var(--txt); }
.fc-view-container { border-radius: 12px; overflow: hidden; }
.fc-day-grid { background: var(--panel); }
.fc-day-header { padding: 10px 0; color: var(--mut); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--bg); }
.fc-day-number { padding: 6px 8px; font-size: 13px; font-weight: 600; }
.fc-unthemed .fc-today, .fc-unthemed td.fc-today, td.fc-today.fc-state-highlight { background: var(--hoy) !important; }
.fc-day-grid .fc-today .fc-day-number { color: var(--azul-ui); font-weight: 800; }
.fc-other-month { opacity: .55; }
.fc-unthemed .fc-disabled-day { background: var(--bg); opacity: .5; }
.fc-event { border-radius: 7px; border-width: 0; padding: 2px 6px; font-size: 12.5px; font-weight: 600; line-height: 1.5; cursor: pointer; }
.fc-day-grid-event { margin: 1px 3px 0; }
.fc-more { font-weight: 700; color: var(--azul-ui); }
.fc-basicDay-view .fc-day-grid-event, .fc-basicWeek-view .fc-day-grid-event { padding: 5px 8px; font-size: 14px; }

/* vista de lista */
.fc-list-view { background: var(--panel); border-radius: 12px; }
.fc-list-heading td { background: var(--bg); color: var(--txt); font-weight: 700; padding: 8px 14px; }
.fc-list-heading-main, .fc-list-heading-alt { color: inherit; display: inline-block; }
.fc-list-heading-main::first-letter, .fc-list-heading-alt::first-letter { text-transform: uppercase; }
/* La lista crece según su contenido (FullCalendar la limita por proporción y la hace desplazar por dentro) */
.fc-list-view .fc-scroller { height: auto !important; overflow: visible !important; }
.fc-list-item-time { white-space: nowrap; width: 1%; }
.fc-list-item td { padding: 14px; color: var(--txt); }
.fc-list-item { cursor: pointer; }
.fc-list-item:hover td { background: color-mix(in srgb, var(--azul-ui) 9%, var(--panel)); }
.fc-list-item-title a { color: var(--txt); font-weight: 600; text-decoration: none; }
.fc-list-item-time { color: var(--mut); }
.fc-list-empty { background: var(--panel); color: var(--mut); padding: 40px 10px; }
.fc-list-empty-wrap2, .fc-list-empty-wrap1 { color: var(--mut); }

/* ---------- Ventanas (modales) ---------- */
.modal-fondo { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px;
               background: rgba(10, 18, 30, .55); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.modal-caja { width: 100%; max-width: 520px; max-height: calc(100dvh - 32px); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); color: var(--txt);
              border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); animation: entrar .18s ease; }
@keyframes entrar { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-cab h2 { margin: 0; font-size: 19px; }
.modal-x { border: 0; background: transparent; color: var(--mut); font-size: 26px; line-height: 1; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; }
.modal-x:hover { background: var(--bg); color: var(--txt); }
.modal-cuerpo { padding: 18px 20px; display: grid; gap: 16px; }
.modal-pie { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 14px 20px 18px; border-top: 1px solid var(--line); }
.campo { display: grid; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.campo > span, .campo > legend { font-size: 13px; font-weight: 700; color: var(--mut); padding: 0; }
.campo input[type="text"], .campo input[type="date"] { width: 100%; font: inherit; font-size: 16px; color: var(--txt); background: var(--bg);
              border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; min-height: 46px; }
.campo input:focus { outline: none; border-color: var(--azul-ui); box-shadow: 0 0 0 3px color-mix(in srgb, var(--azul-ui) 28%, transparent); }
.fila-fechas { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.radios { display: flex; flex-wrap: wrap; gap: 8px; }
.color-op { position: relative; }
.color-op input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.color-op span { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px 9px 10px; border-radius: 99px; border: 1.5px solid var(--line);
                 background: var(--bg); font-weight: 600; font-size: 14px; cursor: pointer; }
.color-op .punto { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--c); }
.color-op input:checked + span { border-color: var(--c); background: color-mix(in srgb, var(--c) 16%, var(--panel)); }
.color-op input:focus-visible + span { outline: 3px solid var(--celeste); outline-offset: 2px; }

/* Aviso breve */
.aviso { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 60; background: #1a7f37; color: #fff; font-weight: 600;
         padding: 11px 18px; border-radius: 12px; box-shadow: 0 10px 28px rgba(0, 0, 0, .3); opacity: 0; pointer-events: none;
         transition: opacity .2s ease, transform .2s ease; max-width: calc(100% - 32px); text-align: center; }
.aviso.on { opacity: 1; transform: translate(-50%, 0); }
.aviso.error { background: #c62828; }

/* ---------- Celular ---------- */
@media (max-width: 700px) {
  .topbar .contenedor { gap: 10px; }
  .nav a span.txt { display: none; }
  .hero .contenedor { padding-top: 26px; padding-bottom: 64px; }
  .hero-logo { padding: 8px 14px; }
  .hero-logo img { height: 48px; }
  .hero p { font-size: 15px; }
  .cal-seccion { margin-top: -36px; }
  .cal-card { padding: 10px; border-radius: 14px; }
  .btn-nuevo { display: none; }
  .fab { display: inline-flex; align-items: center; justify-content: center; }
  .leyenda { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 4px; scrollbar-width: none; }
  .leyenda::-webkit-scrollbar { display: none; }
  .chip-col { flex: none; }
  .cal-ayuda { display: none; }

  /* barra del calendario: título arriba, botones debajo */
  .fc-toolbar > .fc-center { order: -1; flex: 1 0 100%; justify-content: center; }
  .fc-toolbar h2 { font-size: 19px; }
  .fc-button { padding: 9px 12px; font-size: 13px; }
  .fc-day-header { font-size: 11px; padding: 8px 0; }
  .fc-day-number { padding: 3px 5px; font-size: 12px; }
  .fc-event { font-size: 11px; padding: 1px 3px; }
  .fc-list-item td { padding: 14px 12px; }

  /* ventana como hoja inferior */
  .modal-fondo { align-items: flex-end; padding: 0; }
  .modal-caja { max-width: none; border-radius: 20px 20px 0 0; max-height: 92vh; animation: subir .2s ease; }
  @keyframes subir { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
  .modal-pie .btn-pri, .modal-pie .btn-sec { flex: 1 1 40%; }
  .aviso { bottom: 90px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
