/* ILECO III — the GLASS look, as in i-Assist (adapted from its css/glass.css).
   Active when <html data-tema="glass"> (the PLAIN | GLASS switch, bottom-left). Not loaded on the login page.
   The menu is a floating frosted-glass panel; the chosen item is a glowing glass pill that pulses slowly;
   the page that opens fades in and its panels slide in one after the other; cards glow when the pointer is on them. */

html[data-tema='glass'] body {
  background:
    radial-gradient(900px 520px at 8% -8%, rgba(242, 169, 0, 0.26), transparent 62%),
    radial-gradient(800px 560px at 108% 4%, rgba(70, 120, 190, 0.22), transparent 58%),
    linear-gradient(165deg, #f1f3f6 0%, #f7f0e0 100%);
  background-attachment: fixed;
}

/* ---- soft colour behind the menu (amber, orange and a little blue): the glass has something to bend ---- */
html[data-tema='glass'] .shell {
  position: relative;
  isolation: isolate;
  align-items: flex-start;
}
html[data-tema='glass'] .shell::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: clamp(220px, 26vw, 340px);
  height: 100%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 32% 10%, rgba(255, 140, 20, 0.55), transparent 46%),
    radial-gradient(circle at 80% 44%, rgba(47, 123, 255, 0.4), transparent 50%),
    radial-gradient(circle at 26% 88%, rgba(255, 196, 40, 0.55), transparent 48%);
  filter: blur(24px);
}

/* ---- the menu: a floating frosted-glass panel ---- */
html[data-tema='glass'] nav.rail {
  position: sticky;
  top: 14px;
  align-self: flex-start;
  max-height: calc(100vh - 28px - 52px);
  overflow-y: auto;
  scrollbar-width: none;
  margin: 14px 0 14px 14px;
  padding: 14px 12px;
  gap: 8px;
  border-radius: 24px;
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.55),
    rgba(255, 226, 130, 0.28) 46%,
    rgba(255, 255, 255, 0.2)
  );
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow:
    0 18px 40px rgba(120, 70, 0, 0.22),
    inset 0 2px 0 rgba(255, 255, 255, 0.6),
    inset 0 -1px 0 rgba(255, 255, 255, 0.25);
  color: var(--navy, #12202e);
}
html[data-tema='glass'] nav.rail::-webkit-scrollbar {
  display: none;
}
html[data-tema='glass'] nav.rail button,
html[data-tema='glass'] nav.rail a {
  position: relative;
  border: 1px solid transparent;
  border-radius: 15px;
  background: transparent;
  color: var(--navy, #12202e);
  transition:
    background 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.18s ease,
    border-color 0.22s ease,
    color 0.22s ease;
}
/* the shine on the glass */
html[data-tema='glass'] nav.rail button::before,
html[data-tema='glass'] nav.rail a::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(120% 150% at 18% 0%, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 62%);
  transition: opacity 0.22s ease;
}
html[data-tema='glass'] nav.rail button:hover::before,
html[data-tema='glass'] nav.rail a:hover::before {
  opacity: 1;
}
html[data-tema='glass'] nav.rail button:hover,
html[data-tema='glass'] nav.rail a:hover {
  background: rgba(255, 255, 255, 0.34);
  border-color: rgba(255, 255, 255, 0.75);
  color: var(--navy, #12202e);
  box-shadow:
    0 6px 16px rgba(120, 70, 0, 0.14),
    0 0 14px rgba(255, 190, 40, 0.35);
}
html[data-tema='glass'] nav.rail button:active,
html[data-tema='glass'] nav.rail a:active {
  transform: scale(0.97);
}
html[data-tema='glass'] nav.rail button:active::before,
html[data-tema='glass'] nav.rail a:active::before {
  opacity: 1;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 70%);
}

/* ---- the chosen item: dark blue glass with a cyan glow that keeps pulsing slowly ---- */
html[data-tema='glass'] nav.rail button.active,
html[data-tema='glass'] nav.rail button.active:hover {
  color: #ffd24d;
  background: linear-gradient(135deg, rgba(20, 33, 61, 0.8), rgba(48, 82, 150, 0.58));
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-color: rgba(255, 255, 255, 0.5);
  transform: none;
  box-shadow:
    0 10px 24px rgba(20, 33, 61, 0.38),
    0 0 0 1px rgba(95, 208, 255, 0.6),
    0 0 22px rgba(95, 208, 255, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -10px 18px rgba(95, 208, 255, 0.14);
  animation: brilloMenu 3.4s ease-in-out infinite;
}
html[data-tema='glass'] nav.rail button.active::before {
  opacity: 0.55;
}
html[data-tema='glass'] nav.rail button.active::after {
  content: '';
  position: absolute;
  left: -2px;
  top: 22%;
  bottom: 22%;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(#ffe27a, #5fd0ff);
  box-shadow: 0 0 12px #5fd0ff;
}
@keyframes brilloMenu {
  0%,
  100% {
    box-shadow:
      0 6px 14px rgba(20, 33, 61, 0.34),
      0 0 0 1px rgba(95, 208, 255, 0.65),
      0 0 12px rgba(95, 208, 255, 0.55),
      0 0 18px rgba(255, 194, 31, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.5),
      inset 0 -10px 18px rgba(95, 208, 255, 0.14);
  }
  50% {
    box-shadow:
      0 6px 16px rgba(20, 33, 61, 0.4),
      0 0 0 1px rgba(150, 228, 255, 0.9),
      0 0 22px rgba(95, 208, 255, 0.85),
      0 0 28px rgba(255, 194, 31, 0.34),
      inset 0 1px 0 rgba(255, 255, 255, 0.55),
      inset 0 -10px 18px rgba(95, 208, 255, 0.22);
  }
}

/* ---- the page that opens: a soft fade-in, and its panels slide in one after the other ---- */
html[data-tema='glass'] main > .view.active {
  animation: vidrioEntra 0.32s ease backwards;
}
html[data-tema='glass'] main > .view.active > * {
  animation: vidrioEntra 0.38s ease backwards;
}
html[data-tema='glass'] main > .view.active > *:nth-child(2) {
  animation-delay: 0.04s;
}
html[data-tema='glass'] main > .view.active > *:nth-child(3) {
  animation-delay: 0.08s;
}
html[data-tema='glass'] main > .view.active > *:nth-child(4) {
  animation-delay: 0.12s;
}
html[data-tema='glass'] main > .view.active > *:nth-child(5) {
  animation-delay: 0.16s;
}
html[data-tema='glass'] main > .view.active > *:nth-child(n + 6) {
  animation-delay: 0.2s;
}
@keyframes vidrioEntra {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---- frosted glass cards, and a warm glow when the pointer is on them ---- */
html[data-tema='glass']
  :is(fieldset, .table-wrap, main > .card, .panel, .card, .stat, .item, .st-card, .cov-card, .hl-card) {
  background: rgba(255, 255, 255, 0.62) !important;
  border-color: rgba(255, 255, 255, 0.78) !important;
  -webkit-backdrop-filter: blur(12px) saturate(1.35);
  backdrop-filter: blur(12px) saturate(1.35);
  box-shadow:
    0 8px 26px rgba(120, 70, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
  transition: box-shadow 0.22s ease;
}
html[data-tema='glass'] :is(fieldset, .table-wrap, .card, .stat, .item, .st-card, .cov-card, .hl-card):hover {
  box-shadow:
    0 14px 38px rgba(110, 55, 0, 0.18),
    0 0 22px rgba(255, 190, 40, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 1) !important;
}
html[data-tema='glass'] :is(header.letterhead, header.top) {
  background: linear-gradient(
    100deg,
    rgba(255, 210, 76, 0.94),
    rgba(255, 199, 44, 0.9) 55%,
    rgba(244, 174, 60, 0.88)
  ) !important;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
html[data-tema='glass'] footer.foot {
  background: rgba(20, 33, 61, 0.94) !important;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
html[data-tema='glass'] :is(input, select, textarea) {
  background-color: rgba(255, 255, 255, 0.82);
}
html[data-tema='glass'] tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.35);
}

/* ---- the switch PLAIN | GLASS: a little frosted-glass rectangle, the chosen part glows ---- */
html[data-tema='glass'] #temasw {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.26));
  -webkit-backdrop-filter: blur(16px) saturate(1.8);
  backdrop-filter: blur(16px) saturate(1.8);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 10px 26px rgba(110, 55, 0, 0.22),
    inset 0 1px 0 #fff;
}
html[data-tema='glass'] #temasw button {
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease,
    color 0.2s ease;
}
html[data-tema='glass'] #temasw button + button {
  border-left-color: rgba(255, 255, 255, 0.85);
}
html[data-tema='glass'] #temasw button:hover {
  box-shadow:
    inset 0 0 0 1px rgba(255, 214, 90, 0.95),
    0 0 12px rgba(255, 190, 40, 0.8);
}
html[data-tema='glass'] #temasw button[aria-pressed='true'] {
  background: linear-gradient(135deg, rgba(20, 33, 61, 0.84), rgba(48, 82, 150, 0.62));
  color: #ffd24d;
  box-shadow:
    0 0 14px rgba(95, 208, 255, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

/* ---- a phone: the menu is a glass bar above the page ---- */
@media (max-width: 760px) {
  html[data-tema='glass'] .shell::before {
    width: 100%;
    height: 240px;
  }
  html[data-tema='glass'] nav.rail {
    position: static;
    max-height: none;
    margin: 10px 10px 0;
    padding: 8px;
    border-radius: 22px;
    overflow: visible;
  }
}
@media (hover: none) {
  html[data-tema='glass'] nav.rail button:hover {
    transform: none;
  }
}

/* ---- less motion / old browsers / printing ---- */
@media (prefers-reduced-motion: reduce) {
  html[data-tema='glass'] nav.rail button,
  html[data-tema='glass'] nav.rail a,
  html[data-tema='glass'] nav.rail button::before,
  html[data-tema='glass'] #temasw button {
    transition: none;
  }
  html[data-tema='glass'] nav.rail button.active {
    animation: none;
  }
  html[data-tema='glass'] main > .view.active,
  html[data-tema='glass'] main > .view.active > * {
    animation: none;
  }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html[data-tema='glass'] nav.rail {
    background: linear-gradient(180deg, #ffe08a, #ffeeb4);
  }
  html[data-tema='glass'] :is(fieldset, .table-wrap, .card, .stat, .item, .st-card, .cov-card, .hl-card) {
    background: #fffffff2 !important;
  }
}
@media print {
  html[data-tema='glass'] body {
    background: #fff !important;
  }
  html[data-tema='glass'] main > .view.active,
  html[data-tema='glass'] main > .view.active > * {
    animation: none;
  }
}

html[data-tema='glass'] nav.rail::before {
  color: rgba(20, 33, 61, 0.72);
}
