/* =========================================================
   Briefly V34.1 — Functional controls + deterministic contrast
   ========================================================= */

/* Unselected preference cards: always readable */
.v25TopicGrid label,
.v26TeamCard,
.v25Segment label,
.v11TopicGrid label,
.v11Modes label,
.v25Rows label,
.control,
.mini{
  color:var(--b34-text,#071923)!important;
}

/* Actual selected states must never use the legacy navy fill.
   Use a light accent wash + dark text in light mode. */
.v25TopicGrid label:has(input:checked),
.v25TopicGrid label.is-checked,
.v26TeamCard:has(input:checked),
.v26TeamCard.is-checked,
.v25Segment label:has(input:checked),
.v25Segment label.is-checked,
.v11TopicGrid label:has(input:checked),
.v11TopicGrid label.is-checked,
.v11Modes label:has(input:checked),
.v11Modes label.is-checked,
[aria-checked="true"].control,
[aria-checked="true"].mini{
  background:rgba(var(--briefly-accent-rgb),.18)!important;
  border-color:var(--briefly-accent)!important;
  color:var(--b34-text,#071923)!important;
  box-shadow:inset 0 0 0 1px rgba(var(--briefly-accent-rgb),.18)!important;
}

/* Text inside selection cards always follows the parent contrast. */
.v25TopicGrid label *,
.v26TeamCard *,
.v25Segment label *,
.v11TopicGrid label *,
.v11Modes label *,
.v25Rows label *,
.control *,
.mini *{
  color:inherit!important;
  -webkit-text-fill-color:currentColor!important;
  opacity:1!important;
}

/* Secondary descriptive text remains muted only when it is not dangerously dark. */
.v25TopicGrid label small,
.v26TeamCard small,
.v25Segment label small,
.v11TopicGrid label small,
.v11Modes label small{
  color:var(--b34-muted,#6f818c)!important;
  -webkit-text-fill-color:currentColor!important;
}

/* Dark mode selected cards */
html[data-theme="dark"] .v25TopicGrid label:has(input:checked),
html[data-theme="dark"] .v25TopicGrid label.is-checked,
html[data-theme="dark"] .v26TeamCard:has(input:checked),
html[data-theme="dark"] .v26TeamCard.is-checked,
html[data-theme="dark"] .v25Segment label:has(input:checked),
html[data-theme="dark"] .v25Segment label.is-checked,
html[data-theme="dark"] .v11TopicGrid label:has(input:checked),
html[data-theme="dark"] .v11TopicGrid label.is-checked,
html[data-theme="dark"] .v11Modes label:has(input:checked),
html[data-theme="dark"] .v11Modes label.is-checked{
  background:rgba(var(--briefly-accent-rgb),.16)!important;
  color:#f6f8f9!important;
}

/* Any legacy navy preference tile that is NOT selected is reset to a surface.
   This directly fixes Sport/Wirtschaft/Kompakt/Vertieft in the screenshot. */
.v25TopicGrid label:not(:has(input:checked)),
.v26TeamCard:not(:has(input:checked)),
.v25Segment label:not(:has(input:checked)),
.v11TopicGrid label:not(:has(input:checked)),
.v11Modes label:not(:has(input:checked)){
  background:var(--b34-surface,#fff)!important;
  border-color:rgba(var(--briefly-accent-rgb),.38)!important;
  color:var(--b34-text,#071923)!important;
}

/* Robust fallback for Safari versions that may not style :has() as expected.
   JS adds .is-checked, so the base style remains readable regardless. */
.v25TopicGrid label,
.v26TeamCard,
.v25Segment label,
.v11TopicGrid label,
.v11Modes label{
  min-height:58px;
}

/* Buttons */
button,
input[type="submit"],
a.button,
a.btn,
[role="button"]{
  text-decoration:none;
}

/* White / outlined secondary buttons */
.secondary,
button.secondary,
.v25PushActions .secondary{
  background:var(--b34-surface,#fff)!important;
  color:var(--b34-text,#071923)!important;
  border-color:var(--b34-line,rgba(7,25,35,.11))!important;
}
.secondary *,
button.secondary *,
.v25PushActions .secondary *{
  color:inherit!important;
}

/* Dark filled action buttons — always white text */
.btn-dark,
.button.dark,
[data-variant="dark"],
[data-action="live"],
.v10IntroActions > :nth-child(2):not(.primary){
  background:var(--b34-dark,#062332)!important;
  color:#fff!important;
  border-color:var(--b34-dark,#062332)!important;
}
.btn-dark *,
.button.dark *,
[data-variant="dark"] *,
[data-action="live"] *,
.v10IntroActions > :nth-child(2):not(.primary) *{
  color:inherit!important;
  -webkit-text-fill-color:currentColor!important;
  opacity:1!important;
}

/* Save / primary actions */
.v25Save,
.v11Save,
button[type="submit"],
input[type="submit"],
.primary,
.btn-primary{
  background:var(--briefly-accent)!important;
  border-color:var(--briefly-accent)!important;
  color:#07131d!important;
  font-weight:800!important;
}
.v25Save *, .v11Save *, .primary *, .btn-primary *{color:inherit!important}

/* Native checkbox/radio visibility: hidden custom inputs can remain hidden,
   but any visible native control follows accent. */
input[type="checkbox"],
input[type="radio"]{
  accent-color:var(--briefly-accent)!important;
}

/* Push settings rows */
.v25Rows input[type="checkbox"]:checked,
.v25Rows input[type="radio"]:checked{
  accent-color:var(--briefly-accent)!important;
}
.v25Rows label{
  cursor:pointer;
}

/* Accent picker itself */
.v27Accent{
  cursor:pointer!important;
}
.v27Accent.active{
  border-color:var(--briefly-accent)!important;
  box-shadow:0 0 0 2px rgba(var(--briefly-accent-rgb),.22)!important;
}

/* Appearance switch buttons */
.v26Appearance button{
  background:var(--b34-surface,#fff)!important;
  color:var(--b34-text,#071923)!important;
  border-color:var(--b34-line,rgba(7,25,35,.11))!important;
}
.v26Appearance button.active{
  background:rgba(var(--briefly-accent-rgb),.18)!important;
  color:var(--b34-text,#071923)!important;
  border-color:var(--briefly-accent)!important;
}

/* Inputs must be legible in light theme. */
input[type="text"],
input[type="search"],
input[type="time"],
input[type="email"],
select,
textarea{
  background:var(--b34-surface,#fff)!important;
  color:var(--b34-text,#071923)!important;
  border-color:var(--b34-line,rgba(7,25,35,.12))!important;
}
input::placeholder,textarea::placeholder{
  color:var(--b34-muted,#6f818c)!important;
  opacity:1!important;
}
