/*
  Fyxdo — Klanten: lijst, toevoegen en bewerken, klant kiezen, dubbele klant, detail en archiveren.
  Laadvolgorde: brand/fonts/fonts.css → brand/tokens.css → brand/icons/icons.css
               → screens/auth/auth.css → screens/app/app.css → klanten.css
  Alleen variabelen uit tokens.css. Geen gradiënten, geen schaduwen.

  Breed scherm: in de app @media (min-width: 768px). Hier een container query,
  zodat mobiel en breed in de referentie naast elkaar staan.
*/

/* ---------- Statuslabel (GEARCHIVEERD, NIEUWE KLANT) ---------- */
.fx-tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--tint);
  color: var(--text);
  font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .3px;   /* text-label */
  text-transform: uppercase;
  white-space: nowrap;
  flex: none;
}
/* AFGEROND: groen betekent klaar. Gebruikt door Klant bekijken › Afspraken, Afspraakdetail en de facturen (BETAALD). */
.fx-tag--done { background: var(--green-tint); color: var(--green-text); }

/* ---------- Kop met hoofdactie ---------- */
.fx-page-head--row .fx-btn { flex: none; }

/* ---------- Klantenlijst ---------- */
.fx-row-main { display: block; min-width: 0; flex: 1; }
.fx-row-main > span:not(.fx-tag),
.fx-row-main .fx-row-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fx-row:hover { background: var(--bg); }
.fx-card > .fx-row:first-child { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.fx-card > .fx-row:last-child  { border-radius: 0 0 var(--radius-md) var(--radius-md); }
.fx-card > .fx-row:only-child  { border-radius: var(--radius-md); }
.fx-row:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.fx-row--archive { margin-top: var(--space-6); }

.fx-list-more { margin: var(--space-4) 0 0; }
.fx-list-more .fx-btn { width: 100%; }

/* Laadstaat: grijze balken, geen animatie. Pas na 0,4 s zichtbaar (zie README). */
.fx-skel { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); }
.fx-skel + .fx-skel { border-top: 1px solid var(--border); }
.fx-skel-line { height: 12px; border-radius: var(--radius-sm); background: var(--border); }
.fx-skel-line--meta { height: 10px; background: var(--border); opacity: .6; }

/* ---------- Formulier op een pagina ---------- */
.fx-form-page { max-width: 560px; }
.fx-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.fx-fieldset > legend { padding: 0; margin: 0 0 var(--space-2); }
.fx-fieldset-body { display: flex; flex-direction: column; gap: var(--space-4); }

.fx-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--space-4); }

.fx-textarea {
  height: auto;
  min-height: 120px;
  padding: var(--space-3) var(--space-4);
  resize: vertical;
}

/* Persoon of Bedrijf: twee radioknoppen als één schakelaar */
.fx-choice {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--card);
  align-self: flex-start;
}
.fx-choice label {
  position: relative;
  min-width: 112px;
  height: var(--size-touch);
  padding: 0 var(--space-4);
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--text);
  font-size: 14px; line-height: 20px; font-weight: 600;
  cursor: pointer;
}
.fx-choice input {
  position: absolute; inset: 0;
  margin: 0; opacity: 0; cursor: pointer;
}
.fx-choice label:has(input:checked) { background: var(--primary); color: var(--on-primary); }
.fx-choice label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (forced-colors: active) { .fx-choice label:has(input:checked) { outline: 2px solid CanvasText; } }

.fx-form-actions { display: flex; flex-direction: column; gap: var(--space-4); margin-top: var(--space-2); }

/* ---------- Hint: mogelijk dubbele klant (adviserend) ---------- */
.fx-dup {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--tint);
  color: var(--text);
  font-size: 14px; line-height: 20px;
}
.fx-dup > .fx-ico, .fx-dup > .fx-icon { flex: none; width: var(--size-icon-sm); height: var(--size-icon-sm); }
.fx-dup-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.fx-dup-body p { margin: 0; }
.fx-dup-title { font-weight: 600; }
.fx-dup-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.fx-dup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--card);
}
.fx-dup-item .fx-row-main span:first-child { font-weight: 600; }
.fx-dup-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); }
.fx-dup .fx-btn { width: auto; }

/* Knop die eruitziet als link (Opnieuw proberen in de kiezer) */
.fx-linkbtn {
  padding: 0; border: 0; background: none;
  font-family: var(--font-sans); font-size: inherit; line-height: inherit;
  color: var(--green-text); font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}
.fx-linkbtn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

/* ---------- Klant kiezen (combobox) ---------- */
.fx-combo { position: relative; }
.fx-combo .fx-input { padding-left: 44px; padding-right: 48px; }
.fx-combo-clear {
  position: absolute; top: 2px; right: 2px;
  width: var(--size-touch); height: var(--size-touch);
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted);
  cursor: pointer;
}
.fx-combo-clear:hover { background: var(--tint); color: var(--text); }
.fx-combo-clear:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

.fx-combo-pop {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + var(--space-1));
  z-index: 5;
  box-sizing: border-box;
  max-height: 344px;              /* zes opties van 56 px + ruimte: laat zien dat er meer is */
  overflow-y: auto;
  padding: var(--space-1) 0;
  background: var(--card);
  border: 1px solid var(--border-strong);   /* geen schaduw: de rand scheidt de lijst van wat eronder ligt */
  border-radius: var(--radius-md);
}
.fx-combo-pop[hidden] { display: none; }
.fx-combo-list { list-style: none; margin: 0; padding: 0; }
.fx-combo-group {
  padding: var(--space-2) var(--space-4) var(--space-1);
  font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .3px;   /* text-label */
  text-transform: uppercase;
  color: var(--text-muted);
}
.fx-option {
  min-height: 56px;
  padding: var(--space-2) var(--space-4);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text);
  cursor: pointer;
}
.fx-option .fx-row-main > span { font-size: 16px; line-height: 24px; }
.fx-option mark { background: transparent; color: inherit; font-weight: 600; }
.fx-option:hover { background: var(--bg); }
.fx-option[aria-selected="true"] { background: var(--tint); }
@media (forced-colors: active) { .fx-option[aria-selected="true"] { outline: 2px solid Highlight; outline-offset: -2px; } }
.fx-option--new { border-top: 1px solid var(--border); font-weight: 600; min-height: 48px; }
.fx-option--new .fx-ico, .fx-option--new .fx-icon { width: var(--size-icon-sm); height: var(--size-icon-sm); flex: none; }

.fx-combo-msg {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  font-size: 14px; line-height: 20px;
  color: var(--text-muted);
}
.fx-combo-msg .fx-spinner { width: 16px; height: 16px; border-color: var(--text-muted); border-right-color: transparent; margin-top: 2px; }
.fx-combo-msg--error { color: var(--danger); }
.fx-combo-msg > .fx-ico, .fx-combo-msg > .fx-icon { flex: none; width: 16px; height: 16px; margin-top: 2px; }

/* Gekozen klant */
.fx-picked {
  min-height: var(--size-control);
  box-sizing: border-box;
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
.fx-picked .fx-row-main > span:first-child { font-weight: 600; }
.fx-picked .fx-row-main .fx-tag { margin-top: 2px; }
.fx-picked .fx-btn { width: auto; flex: none; height: 40px; padding: 0 var(--space-3); font-size: 14px; line-height: 20px; }
.fx-picked[aria-invalid="true"], .fx-picked.is-invalid { border-color: var(--danger); }

/* Nieuwe klant in de kiezer: een paar extra velden */
.fx-picked-extra {
  margin-top: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ---------- Klant bekijken ---------- */
.fx-detail-head { margin: 0 0 var(--space-6); }
.fx-detail-head h1 { margin: 0; font-size: 28px; line-height: 34px; font-weight: 600; overflow-wrap: anywhere; }
.fx-detail-sub { margin: var(--space-1) 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); color: var(--text-muted); }

.fx-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: 0 0 var(--space-6); }
.fx-actions .fx-btn { width: auto; flex: 1 1 auto; }

.fx-prop {
  min-height: 56px;
  padding: var(--space-3) var(--space-4);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  color: var(--text);
  text-decoration: none;
}
.fx-prop + .fx-prop { border-top: 1px solid var(--border); }
.fx-prop dl, .fx-prop-text { margin: 0; min-width: 0; flex: 1; }
.fx-prop dt { font-size: 14px; line-height: 20px; color: var(--text-muted); }
.fx-prop dd { margin: 0; font-size: 16px; line-height: 24px; overflow-wrap: anywhere; white-space: pre-line; }
.fx-prop dd.is-empty { color: var(--text-muted); }
.fx-prop > .fx-ico, .fx-prop > .fx-icon { width: var(--size-icon-sm); height: var(--size-icon-sm); color: var(--text-muted); flex: none; }
a.fx-prop:hover { background: var(--bg); }
a.fx-prop:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
a.fx-prop dd { color: var(--green-text); text-decoration: underline; text-underline-offset: 3px; }

.fx-archive { margin-top: var(--space-10); display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); }
.fx-archive .fx-btn { width: auto; }

/* Bevestiging archiveren, in de pagina (geen pop-up) */
.fx-confirm {
  padding: var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-self: stretch;
}
.fx-confirm h2 { margin: 0; font-size: 16px; line-height: 24px; font-weight: 600; }
.fx-confirm h2:focus { outline: none; }
.fx-confirm p { margin: 0; font-size: 14px; line-height: 20px; color: var(--text); }
.fx-confirm-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.fx-confirm-actions .fx-btn { width: auto; flex: 1 1 auto; }

/* ---------- Klant bekijken › Afspraken (KD9–KD12) ----------
   Twee groepen, Komend en Eerder, elk een kaart met rijen.
   Mobiel:  Donderdag 12 november          >        Breed:  Donderdag 12 november
            09:30–10:30 · Coaching                          09:30–10:30 · Coaching       GEANNULEERD  >
            GEANNULEERD                                                                                  */
.fx-hist-head {
  margin: var(--space-4) 0 var(--space-2);
  font-size: 14px; line-height: 20px; font-weight: 600;          /* text-small, 600 */
  color: var(--text);
}
.fx-hist-head:first-of-type { margin-top: 0; }
.fx-hist-head span { font-weight: 400; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.fx-hist + .fx-hist-head, .fx-list-more + .fx-hist-head { margin-top: var(--space-6); }

.fx-hist-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 var(--space-3);          /* .fx-row heeft 16 px gap; tussen de regels hier geen */
  align-items: center;
}
.fx-hist-row > .fx-row-main { grid-column: 1; }
.fx-hist-row > .fx-row-main .fx-row-meta { font-variant-numeric: tabular-nums; }
.fx-hist-row > .fx-tag { grid-column: 1; grid-row: 2; justify-self: start; margin-top: var(--space-2); }
.fx-hist-row > :is(svg, .fx-icon) { grid-column: 2; grid-row: 1 / -1; }

.fx-hist-msg { margin: 0; display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-4); font-size: 14px; line-height: 20px; }
.fx-hist-msg--error { color: var(--danger); }
.fx-hist-msg > :is(.fx-ico, .fx-icon) { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.fx-hist-msg .fx-linkbtn { color: inherit; }

/* ---------- Breed scherm ---------- */
@container (min-width: 768px) {
  .fx-hist-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .fx-hist-row > .fx-tag { grid-column: 2; grid-row: 1; margin-top: 0; }
  .fx-hist-row > :is(svg, .fx-icon) { grid-column: 3; }
  .fx-list-more .fx-btn { width: auto; }
  .fx-form-actions { flex-direction: row; align-items: center; }
  .fx-form-actions .fx-btn { width: auto; }
  .fx-actions .fx-btn, .fx-confirm-actions .fx-btn { flex: none; }
  .fx-prop dl { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--space-4); align-items: baseline; }
  .fx-prop dt { font-size: 16px; line-height: 24px; }
  .fx-confirm { max-width: 560px; }
}

/* Meer treffers in de kiezer (D5): knop onder de klant, zodat "Terugzetten en kiezen" de naam niet wegdrukt */
.fx-dup-item--stack { flex-wrap: wrap; row-gap: var(--space-2); }
.fx-dup-item--stack > .fx-row-main { flex: 1 1 100%; }
.fx-dup-item--stack > .fx-row-main .fx-tag { margin-top: var(--space-1); }
.fx-dup-item--stack > .fx-btn { flex: none; }
