/* Liquid glass: the cards are panes of frosted glass over a soft light that tints them.
   Everything hangs from html:not([data-transparency="reduced"]); with "Reducir transparencia" on
   (Configuración → Apariencia) none of it applies and the solid cards of styles.css come back.
   The light cards use :where() so they keep the specificity of .dash-card and any card that brings its
   own background still wins. */

:root {
  --glass-fill: linear-gradient(155deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.58) 100%);
  --glass-blur: blur(24px) saturate(165%);
  --glass-edge: rgba(255, 255, 255, 0.7);
  --glass-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 0 0 1px rgba(14, 21, 38, 0.05),
    0 12px 32px -14px rgba(14, 21, 38, 0.16),
    0 2px 6px -2px rgba(14, 21, 38, 0.05);
  --glass-sheet: linear-gradient(155deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.78) 100%);
  /* The dark cards (heroes): smoked glass, still dark enough for white text. */
  --glass-dark-fill: linear-gradient(155deg, rgba(24, 34, 60, 0.95) 0%, rgba(10, 15, 28, 0.9) 100%);
  --glass-dark-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 20px 48px -18px rgba(8, 12, 24, 0.55);
  /* The light behind the glass: the four glasses' colours, very faint. */
  --glass-ambient:
    radial-gradient(48vw 42vw at 8% -6%, rgba(57, 135, 229, 0.18), transparent 70%),
    radial-gradient(40vw 36vw at 96% 10%, rgba(144, 133, 233, 0.17), transparent 70%),
    radial-gradient(46vw 40vw at 72% 104%, rgba(25, 158, 112, 0.14), transparent 70%),
    radial-gradient(34vw 30vw at 18% 92%, rgba(242, 185, 75, 0.13), transparent 70%);
  /* The view filter's pill: a drop of glass that swells under the finger (motion.js drags it). */
  --glass-thumb-fill: linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.35));
  --glass-thumb-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(255, 255, 255, 0.3),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 4px 10px -4px rgba(14, 21, 38, 0.25);
  --glass-thumb-shadow-lift:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 -1px 0 rgba(255, 255, 255, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.5),
    0 10px 20px -6px rgba(14, 21, 38, 0.32);
  --glass-thumb-lens: rgba(255, 255, 255, 0.35);
  --glass-thumb-lens-lift: rgba(255, 255, 255, 0.6);
  --glass-rail-fill: color-mix(in srgb, var(--surface-2) 70%, transparent);
}

html[data-theme="dark"] {
  --glass-thumb-fill: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
  --glass-thumb-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 4px 10px -4px rgba(0, 0, 0, 0.5);
  --glass-thumb-shadow-lift:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    0 10px 20px -6px rgba(0, 0, 0, 0.6);
  --glass-thumb-lens: rgba(255, 255, 255, 0.22);
  --glass-thumb-lens-lift: rgba(255, 255, 255, 0.34);
  --glass-rail-fill: rgba(255, 255, 255, 0.06);
  --glass-fill: linear-gradient(155deg, rgba(30, 40, 66, 0.72) 0%, rgba(20, 28, 48, 0.56) 100%);
  --glass-edge: rgba(255, 255, 255, 0.1);
  --glass-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 14px 36px -16px rgba(0, 0, 0, 0.6);
  --glass-sheet: linear-gradient(155deg, rgba(28, 38, 62, 0.92) 0%, rgba(18, 26, 44, 0.86) 100%);
  --glass-dark-fill: linear-gradient(155deg, rgba(28, 40, 72, 0.78) 0%, rgba(12, 18, 34, 0.72) 100%);
  --glass-ambient:
    radial-gradient(48vw 42vw at 8% -6%, rgba(57, 135, 229, 0.16), transparent 70%),
    radial-gradient(40vw 36vw at 96% 10%, rgba(144, 133, 233, 0.14), transparent 70%),
    radial-gradient(46vw 40vw at 72% 104%, rgba(25, 158, 112, 0.1), transparent 70%),
    radial-gradient(34vw 30vw at 18% 92%, rgba(242, 185, 75, 0.06), transparent 70%);
}

/* The light stays put while the page scrolls under it, as behind a window. */
html:not([data-transparency="reduced"]) body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--glass-ambient);
  pointer-events: none;
}

:where(html:not([data-transparency="reduced"])) .dash-card {
  background: var(--glass-fill);
  border-color: var(--glass-edge);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}

html:not([data-transparency="reduced"]) .dash-hero {
  background: var(--glass-dark-fill);
  border: 0;
  box-shadow: var(--glass-dark-shadow);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}

/* The top bar lets the light through too. */
html:not([data-transparency="reduced"]) .content-topbar {
  background: color-mix(in srgb, var(--bg) 58%, transparent);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}

/* Sheets and dialogs: more opaque, they carry forms. */
html:not([data-transparency="reduced"]) .modal-card {
  background: var(--glass-sheet);
  box-shadow: var(--glass-shadow), 0 30px 70px -20px rgba(14, 21, 38, 0.35);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}

html:not([data-transparency="reduced"]) .sheet-form > .modal-header,
html:not([data-transparency="reduced"]) .sheet-form > .sheet-actions {
  background: transparent;
}

html:not([data-transparency="reduced"]) .bp-banner {
  background: var(--glass-sheet);
  border-color: var(--glass-edge);
  box-shadow: var(--glass-shadow), 0 18px 44px rgba(14, 21, 38, 0.16);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}

/* Configuración → Apariencia: a pane of glass over the light, and the same card solid. */
.transparency-art { position: relative; align-items: center; justify-content: center; overflow: hidden; }
.transparency-art::before,
.transparency-art::after { content: ""; position: absolute; width: 30px; height: 30px; border-radius: 50%; }
.transparency-art::before { top: 6px; left: 8px; background: #3987e5; }
.transparency-art::after { right: 6px; bottom: 4px; background: #f2b94b; }
.transparency-art i { position: relative; z-index: 1; flex: none; width: 44px; height: 32px; border-radius: 8px; }
.transparency-art.full i {
  background: rgba(255, 255, 255, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  -webkit-backdrop-filter: blur(6px) saturate(160%);
  backdrop-filter: blur(6px) saturate(160%);
}
.transparency-art.reduced i { background: #f5f6f2; }

/* View filter (Hogar / miembros, Todos / Compartidos, Mensual / Anual): a glass rail with a drop of glass on
   it. The rail has no backdrop-filter of its own, so the drop blurs what lies behind the rail. At rest the
   drop is a pane; touched or dragged it swells and brightens. The labels sit above the drop, always sharp. */
html:not([data-transparency="reduced"]) :is(.view-filter .segmented, [data-pill]) {
  background: var(--glass-rail-fill);
  box-shadow: inset 0 0 0 1px var(--glass-edge);
}

html:not([data-transparency="reduced"]) :is(.view-filter .segmented, [data-pill]) > .segmented-thumb {
  background: var(--glass-thumb-fill);
  box-shadow: var(--glass-thumb-shadow);
  -webkit-backdrop-filter: blur(10px) saturate(180%) brightness(1.05);
  backdrop-filter: blur(10px) saturate(180%) brightness(1.05);
}

/* The lens: a soft elliptical highlight, top left. */
html:not([data-transparency="reduced"]) :is(.view-filter .segmented, [data-pill]) > .segmented-thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(ellipse 60% 70% at 22% 8%, var(--glass-thumb-lens), transparent 70%);
  pointer-events: none;
}

html:not([data-transparency="reduced"]) :is(.view-filter .segmented, [data-pill]).is-pressing .segmented-thumb,
html:not([data-transparency="reduced"]) :is(.view-filter .segmented, [data-pill]).is-dragging .segmented-thumb {
  -webkit-backdrop-filter: blur(6px) saturate(200%) contrast(1.05) brightness(1.15);
  backdrop-filter: blur(6px) saturate(200%) contrast(1.05) brightness(1.15);
}

html:not([data-transparency="reduced"]) :is(.view-filter .segmented, [data-pill]).is-pressing .segmented-thumb::before,
html:not([data-transparency="reduced"]) :is(.view-filter .segmented, [data-pill]).is-dragging .segmented-thumb::before {
  background: radial-gradient(ellipse 60% 70% at 22% 8%, var(--glass-thumb-lens-lift), transparent 70%);
}

/* The pressed state (swell and deeper shadow) also holds with "Reducir transparencia". */
:is(.view-filter .segmented, [data-pill]) > .segmented-thumb {
  transition:
    scale 300ms cubic-bezier(0.2, 0, 0, 1),
    box-shadow 300ms cubic-bezier(0.2, 0, 0, 1),
    -webkit-backdrop-filter 300ms cubic-bezier(0.2, 0, 0, 1),
    backdrop-filter 300ms cubic-bezier(0.2, 0, 0, 1);
}

:is(.view-filter .segmented, [data-pill]).is-pressing .segmented-thumb,
:is(.view-filter .segmented, [data-pill]).is-dragging .segmented-thumb {
  scale: 1.06;
  box-shadow: var(--glass-thumb-shadow-lift);
}

@media (prefers-reduced-motion: reduce) {
  :is(.view-filter .segmented, [data-pill]) > .segmented-thumb { transition: none; }
  :is(.view-filter .segmented, [data-pill]).is-pressing .segmented-thumb,
  :is(.view-filter .segmented, [data-pill]).is-dragging .segmented-thumb { scale: none; }
}


