/* TCG House-dashboard. Licht en donker: prefers-color-scheme, of data-theme van het Teams-thema (wint altijd). */
:root {
  color-scheme: light;
  --bg: #f4f5f7; --panel: #ffffff; --panel-2: #f7f8fa; --fg: #171a21; --muted: #5b6472; --faint: #8a93a1; --line: #e3e6eb; --grid: #edf0f3;
  --brand: #14161c; --gold: #ffc425; --gold-ink: #7a5c0e;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a;
  --ok: #1d7f52; --ok-bg: #e6f4ec; --bad: #b8322b; --bad-bg: #fbeceb; --warn: #9a5208; --warn-bg: #fcf1e1; --info: #2a63b8; --info-bg: #eaf1fb;
  --rel: #7c5cc4; --chip: #eef0f3; --shadow: 0 1px 2px rgba(20, 22, 28, .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111318; --panel: #191c23; --panel-2: #1e222a; --fg: #e9ecf1; --muted: #a0a9b6; --faint: #78818e; --line: #2a2f39; --grid: #232731;
    --brand: #262b35; --gold: #ffc425; --gold-ink: #ffc425;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70;
    --ok: #4cc59b; --ok-bg: #15302a; --bad: #f08079; --bad-bg: #3a1f1f; --warn: #f0a35a; --warn-bg: #36281a; --info: #7aa7f0; --info-bg: #1b2840;
    --rel: #ab8ff0; --chip: #232832; --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111318; --panel: #191c23; --panel-2: #1e222a; --fg: #e9ecf1; --muted: #a0a9b6; --faint: #78818e; --line: #2a2f39; --grid: #232731;
  --brand: #262b35; --gold: #ffc425; --gold-ink: #ffc425;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70;
  --ok: #4cc59b; --ok-bg: #15302a; --bad: #f08079; --bad-bg: #3a1f1f; --warn: #f0a35a; --warn-bg: #36281a; --info: #7aa7f0; --info-bg: #1b2840;
  --rel: #ab8ff0; --chip: #232832; --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 "Segoe UI", -apple-system, BlinkMacSystemFont, Inter, Roboto, "Helvetica Neue", sans-serif; }
main { max-width: 1240px; margin: 0 auto; padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 28px; }
[hidden] { display: none !important; }
.num, table, .val { font-variant-numeric: tabular-nums; }

/* Kop van de pagina */
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 20px; flex-wrap: wrap; }
.merk { display: flex; align-items: center; gap: 12px; }
.logo { width: 36px; height: 36px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; flex: none; }
.logo span { width: 14px; height: 18px; border-radius: 3px; background: var(--gold); transform: rotate(-8deg); box-shadow: 4px 2px 0 -1px var(--brand), 4px 2px 0 0 var(--gold); }
h1 { margin: 0; font: 400 24px/1.15 Georgia, "Iowan Old Style", serif; letter-spacing: -.01em; }
.merk .sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.stand { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.status { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.status.oud::before { background: var(--warn); }
.status.oud { color: var(--warn); }
.status.laden::before { background: var(--faint); }

/* Periodekeuze */
.seg { display: inline-flex; background: var(--chip); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; padding: 4px 12px; border-radius: 6px; cursor: pointer; min-height: 30px; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--fg); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.seg button:focus-visible, .knop:focus-visible, summary:focus-visible { outline: 2px solid var(--s1); outline-offset: 2px; }

/* Secties */
section > h2 { margin: 0 0 2px; font-size: 17px; font-weight: 600; }
section > .note { margin: 0 0 12px; }
.note { color: var(--muted); font-size: 12.5px; margin: 0; }
h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; box-shadow: var(--shadow); }
.card > h3 + .note { margin-top: 2px; }
.card > .note:not(:last-child) { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* Kopcijfers */
.tegels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1000px) { .tegels { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .tegels { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tegels .tegel:last-child { grid-column: 1 / -1; } }
.tegel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; box-shadow: var(--shadow); }
.lbl { font-size: 12px; color: var(--muted); }
.val { font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; margin: 6px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.val.neg { color: var(--bad); }
.val.warn { color: var(--warn); }
.dlt { font-size: 12px; color: var(--muted); }
.dlt b { font-weight: 600; }
.up { color: var(--ok); } .down { color: var(--bad); }
.uitleg { font-size: 12px; color: var(--faint); margin-top: 2px; }

/* Mini-cijfers in een kaart */
.mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 12px 0; }
.mini > div { background: var(--panel); padding: 10px 12px; min-width: 0; }
.mini .v { font-size: 18px; font-weight: 600; margin-top: 2px; white-space: nowrap; }
.mini .s { font-size: 11.5px; color: var(--faint); }

/* Tabellen */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
td { white-space: nowrap; }
td.naam { white-space: normal; min-width: 180px; max-width: 420px; }
td.l, th.l { text-align: left; }
tfoot td { font-weight: 600; border-bottom: 0; }
tbody tr:last-child td { border-bottom-color: var(--line); }
.mob { display: none; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.sw.s1 { background: var(--s1); } .sw.s2 { background: var(--s2); } .sw.s3 { background: var(--s3); }
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 4px 0; }
details[open] summary { margin-bottom: 6px; }

/* Badges */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap; background: var(--chip); color: var(--muted); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.wait { background: var(--info-bg); color: var(--info); }
.badge.act { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); font-weight: 600; }

/* Fouten en niet-gekoppelde bronnen */
.fout { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; background: var(--bad-bg); color: var(--bad); font-size: 13px; }
.fout::before { content: "!"; flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--bad); color: var(--panel); font-weight: 700; font-size: 12px; display: grid; place-items: center; margin-top: 1px; }
.fout b { font-weight: 600; }
.grijs { border: 1px dashed var(--line); background: var(--panel-2); border-radius: 12px; padding: 14px 16px; color: var(--muted); min-width: 0; }
.grijs .kop { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.grijs h3 { color: var(--fg); font-weight: 600; }
.grijs p { margin: 6px 0 0; font-size: 13px; }
.leeg { color: var(--muted); font-size: 13px; margin: 0; padding: 14px; background: var(--panel-2); border-radius: 8px; text-align: center; }

/* Grafieken */
.grafiek { position: relative; }
.grafiek svg { display: block; width: 100%; overflow: visible; }
.grafiek text { fill: var(--faint); font-size: 11px; }
.legenda { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.legenda .rel { display: inline-block; width: 12px; border-top: 2px dashed var(--rel); vertical-align: 3px; margin-right: 6px; }
.legenda .vandaag { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; border: 1.5px dashed var(--faint); }
.tip { position: absolute; z-index: 5; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: 0 4px 16px rgba(0, 0, 0, .16); min-width: 150px; }
.tip b { display: block; margin-bottom: 4px; font-weight: 600; }
.tip .r { display: flex; justify-content: space-between; gap: 14px; white-space: nowrap; }
.tip .r span:last-child { font-variant-numeric: tabular-nums; }
.tip .t { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; font-weight: 600; }
.tip .x { color: var(--muted); margin-top: 4px; }

/* Reviews */
ul.reviews { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
ul.reviews li { border-top: 1px solid var(--line); padding-top: 10px; }
.sterren { color: #c98a12; letter-spacing: 1px; }
:root[data-theme="dark"] .sterren { color: #e5b04a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sterren { color: #e5b04a; } }
.meta { font-size: 12px; color: var(--faint); }
.regel { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }

/* Melding over de hele pagina (inloggen, geen toegang) */
.melding { max-width: 520px; margin: 12vh auto 0; text-align: center; }
.melding h2 { font: 400 22px/1.3 Georgia, serif; margin: 0 0 8px; }
.melding p { color: var(--muted); margin: 0 0 16px; }
.knop { font: inherit; font-size: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); border-radius: 8px; padding: 8px 16px; cursor: pointer; }
.knop:hover { border-color: var(--faint); }
a.knop { display: inline-block; text-decoration: none; }
.melding .meta { margin-top: 16px; }
.laden { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--s1); animation: draai .9s linear infinite; vertical-align: middle; }
@keyframes draai { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .laden { animation: none; } }

footer { font-size: 12px; color: var(--faint); }

@media (max-width: 520px) {
  main { padding: 14px 16px 32px; gap: 22px; }
  h1 { font-size: 21px; }
  .val { font-size: 21px; }
  .tegel { padding: 12px; }
  .card { padding: 14px 12px; }
  th, td { padding: 6px 4px; font-size: 13px; }
  th { font-size: 11.5px; }
  .opt { display: none; }
  .mob { display: inline; }
  .mini { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  td.naam { min-width: 0; width: 45%; }
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#inhoud > .stack { gap: 32px; }
#campagneKaart, #adsFouten:not(:empty) + .grid2 { margin-top: 12px; }

/* Teamsecties: tegels die zich naar de breedte schikken, en eenvoudige lijsten */
.tegels.auto { grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)); }
.tegels.auto .tegel:last-child { grid-column: auto; }
ul.lijst { margin: 8px 0 0; padding-left: 18px; }
ul.lijst li { margin: 2px 0; overflow-wrap: anywhere; }
td a { color: var(--info); }
td.naam.l { text-align: left; }
.card > .mini:first-of-type { margin-top: 12px; }
