/* Members and families v2 (office): search first, then one family and one selected person.
   Design source: docs/design/mitglieder-v2 (approved tablet design). Colours and sizes come only from the shared tokens
   --ui-* in theme.css, so Kum-Gang / HAYO and light / dark follow the page. Main case: tablet landscape 1366 px (controls
   at least 64 px); also 1440 px and 375 px phone (controls at least 48 px). White text sits on every red surface via
   --ui-on-action. */
[hidden] { display: none !important; }
.ui .shell.mv {
  --mv-soft: var(--ui-soft);
  --mv-focus: var(--ui-focus);
  --mv-target: 3rem;
  width: min(100% - 2rem, 92rem);
  padding: 1rem 0 3rem;
  font-family: var(--ui-font);
  font-size: 17px;
  line-height: 1.45;
  color: var(--ui-ink);
}
@media (min-width: 48rem) { .ui .shell.mv { --mv-target: 4rem; font-size: 19px; width: min(100% - 4rem, 92rem); } }

.mv :is(a, button, input, select, summary, dialog, [tabindex="-1"]):focus-visible { outline: 4px solid var(--mv-focus); outline-offset: 3px; }
.mv h1:focus, .mv h2:focus, .mv-panel:focus, .mv-dialog h2:focus { outline: none; }
.ui .mv h1, .ui .mv h2, .ui .mv h3, .ui .mv h4, .ui .mv p { margin: 0; max-width: none; }
.ui .mv h1 { font-size: clamp(2.2rem, 4.3vw, 4rem); font-weight: 700; letter-spacing: -.04em; line-height: 1.05; overflow-wrap: anywhere; }
.ui .mv h2 { font-size: 1.7rem; letter-spacing: -.02em; line-height: 1.18; }
.ui .mv h3 { font-size: 1.25rem; line-height: 1.25; }
.ui .mv h4 { font-size: 1.05rem; }
.ui .mv .module-head { margin-bottom: 1.2rem; }

.mv-skip { position: fixed; top: -100px; left: 1rem; z-index: 30; padding: 1rem 1.2rem; background: var(--ui-action); color: var(--ui-on-action); font-weight: 700; }
.mv-skip:focus { top: .6rem; }
.mv-status { min-height: 1.5rem; font-weight: 700; margin: 0 0 .6rem; }
.ui .mv .mv-status[data-tone="error"] { color: var(--ui-danger); }
.ui .mv .mv-error { color: var(--ui-danger); font-weight: 700; margin-top: .6rem; }
.mv-error:empty { display: none; }
.mv-card { border: 1px solid var(--ui-line); border-radius: var(--ui-radius); padding: 1.2rem; background: var(--ui-surface); }
.mv-eyebrow { font-size: .85rem; letter-spacing: .11em; font-weight: 700; color: var(--ui-muted); margin-bottom: .55rem !important; text-transform: uppercase; }
.mv-eyebrow.quiet { margin-bottom: .3rem !important; }
.mv-muted, .mv-lead { color: var(--ui-muted); }
.ui .mv .mv-lead { margin-top: .5rem; }
.mv-small { color: var(--ui-muted); font-size: .9rem; margin-top: .6rem; }
.mv-small a { display: inline-flex; align-items: center; min-height: 48px; color: var(--ui-primary); }

/* Buttons */
.ui .mv .mv-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem; min-height: var(--mv-target);
  padding: .7rem 1.3rem; border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-surface); color: var(--ui-ink);
  font: inherit; font-weight: 700; line-height: 1.2; text-decoration: none; cursor: pointer; touch-action: manipulation;
}
.ui .mv .mv-btn:hover:not(:disabled) { border-color: var(--ui-primary); }
.ui .mv .mv-btn.primary { background: var(--ui-action); border-color: var(--ui-action); color: var(--ui-on-action); }
.ui .mv .mv-btn.quiet { background: transparent; border-color: transparent; padding-inline: 0; }
.ui .mv .mv-btn.danger { color: var(--ui-danger); border-color: var(--ui-danger); background: var(--ui-danger-bg); }
.ui .mv .mv-btn:disabled { opacity: .55; cursor: not-allowed; }
.ui .mv button.mv-link { min-height: var(--mv-target); padding: 0; border: 0; background: transparent; color: var(--ui-primary); font: inherit; font-weight: 700; text-decoration: underline; text-align: left; }
.mv-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.2rem; }

/* Header and help strip */
.mv-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.mv-strip { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.3rem; margin: 1.4rem 0 1.6rem !important; background: var(--mv-soft); border-radius: 12px; }
.mv-bubble { display: inline-grid; place-items: center; width: 2rem; height: 2rem; flex: none; border: 2px solid var(--ui-primary); border-radius: 50%; color: var(--ui-primary); font-weight: 800; }
.mv-back { margin-bottom: .6rem; }

/* Search */
.mv-searchbox { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: end; }
.mv-field { display: grid; gap: .4rem; font-weight: 700; font-size: .95rem; min-width: 0; }
.ui .mv .mv-field input, .ui .mv .mv-field select { width: 100%; min-height: var(--mv-target); padding: .6rem .9rem; border: 1px solid var(--ui-muted); border-radius: 12px; background: var(--ui-surface); color: var(--ui-ink); font: inherit; font-weight: 400; }
.ui .mv .mv-searchbox input { background: var(--mv-soft); font-size: 1.2rem; }
.ui .mv .mv-field input[aria-invalid="true"], .ui .mv .mv-field select[aria-invalid="true"] { border: 2px solid var(--ui-danger); }
.ui .mv .mv-check { display: grid; grid-template-columns: auto 1fr; gap: .7rem; align-items: start; font-weight: 400; font-size: 1rem; }
.ui .mv .mv-check-text { display: grid; gap: .2rem; }
.ui .mv .mv-check-text .mv-small { margin-top: 0; }
.mv-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 1.8rem 0 .6rem; flex-wrap: wrap; }
.mv-section-head small { color: var(--ui-muted); }
.mv-people { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ui-line); }
.mv-people li { border-bottom: 1px solid var(--ui-line); }
.ui .mv button.mv-row {
  display: grid; grid-template-columns: auto minmax(0, 1.3fr) minmax(0, 1fr) 11.5rem 2rem; justify-items: start; gap: 1.1rem; align-items: center;
  width: 100%; min-height: 5.2rem; padding: .7rem .8rem; border: 0; border-radius: 0; background: transparent; color: var(--ui-ink);
  font: inherit; font-weight: 400; text-align: left; cursor: pointer;
}
.ui .mv button.mv-row:hover { background: var(--mv-soft); }
.mv-row-name { display: grid; gap: .1rem; min-width: 0; overflow-wrap: anywhere; }
.mv-row-name strong { font-size: 1.3rem; }
.mv-row-name small, .mv-row-family { color: var(--ui-muted); }
.mv-row-family { overflow-wrap: anywhere; font-weight: 400; }
.ui .mv button.mv-row .mv-row-family { color: var(--ui-ink); }
.mv-arrow { color: var(--ui-muted); justify-self: end; }
.mv-empty { display: flex; align-items: flex-start; gap: 1.2rem; margin-top: 1rem; padding: 1.6rem; border: 1px solid var(--ui-line); border-radius: var(--ui-radius); background: var(--mv-soft); }
.mv-empty.error, .mv-empty.offline { background: var(--ui-warn-bg); border-color: var(--ui-warn); }
.mv-empty-icon { display: grid; place-items: center; width: 3rem; height: 3rem; flex: none; border-radius: 50%; background: var(--ui-surface); border: 2px solid var(--ui-primary); color: var(--ui-primary); font-size: 1.4rem; font-weight: 800; }
.mv-empty p { color: var(--ui-muted); margin: .4rem 0 1rem; }
.mv-empty.error p, .mv-empty.offline p { color: var(--ui-ink); }

/* Photos and badges */
.mv-photo-slot { display: inline-grid; place-items: center; width: 3.6rem; height: 3.6rem; flex: none; }
.mv-photo-slot-head { width: 5.4rem; height: 5.4rem; }
.mv-photo-slot-large { width: min(100%, 14rem); height: auto; aspect-ratio: 1; }
.mv-photo { width: 100%; height: 100%; border-radius: 16%; object-fit: cover; background: var(--mv-soft); color: var(--ui-primary); }
.mv-photo-fallback { display: grid; place-items: center; font-weight: 800; letter-spacing: .04em; font-size: 1.3rem; }
.mv-photo-slot-large .mv-photo-fallback { font-size: 3rem; }
.mv-badges { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .45rem !important; }
.mv-badge { display: inline-block; width: fit-content; padding: .3rem .8rem; border-radius: 999px; font-size: .9rem; font-weight: 800; background: var(--ui-soft); color: var(--ui-ink); }
.mv-badge.active { background: var(--ui-success-bg); color: var(--ui-success); }
.mv-badge.paused { background: var(--ui-warn-bg); color: var(--ui-warn); }
.mv-badge.left { background: var(--ui-soft); color: var(--ui-muted); }

/* Family view */
.mv-family-layout { display: grid; grid-template-columns: minmax(14rem, 18rem) minmax(0, 1fr); gap: 2rem; align-items: start; }
.mv-sidebar { display: grid; gap: .9rem; padding-right: 1.6rem; border-right: 1px solid var(--ui-line); }
.mv-chooser { display: grid; gap: .5rem; }
.ui .mv .mv-sidebar h2 { font-size: 1.2rem; }
.mv-chooser button[aria-pressed="true"] { border-color: var(--ui-primary); background: var(--mv-soft); }
.mv-family-choices { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.ui .mv button.mv-family-choice {
  display: flex; align-items: center; justify-content: flex-start; gap: .9rem; width: 100%; min-height: var(--mv-target); padding: .7rem .9rem; border: 1px solid transparent;
  border-radius: 14px; background: transparent; color: var(--ui-ink); font: inherit; font-weight: 400; text-align: left; cursor: pointer;
}
.mv-family-choice > span:last-child { display: grid; min-width: 0; overflow-wrap: anywhere; }
.mv-family-choice small { color: var(--ui-muted); }
.ui .mv button.mv-family-choice[aria-pressed="true"] { border: 1px solid var(--ui-primary); border-left: 5px solid var(--ui-action); background: var(--mv-soft); }
.mv-family-choice .mv-photo-slot { width: 3rem; height: 3rem; }
.mv-person-head { display: flex; gap: 1.2rem; align-items: center; margin-bottom: 1.4rem; }
.mv-person-head h2 { font-size: 2.2rem; overflow-wrap: anywhere; }
.mv-main { min-width: 0; }
#mv-family-view[data-summary="yes"] .mv-sidebar,
#mv-family-view[data-summary="yes"] .mv-tabs,
#mv-family-view[data-summary="yes"] .mv-more { display: none; }
#mv-family-view[data-summary="yes"] .mv-family-layout { grid-template-columns: 1fr; }

.mv-tabs { display: flex; flex-wrap: wrap; gap: .2rem 1.4rem; border-bottom: 1px solid var(--ui-line); margin-bottom: 1.4rem; }
.ui .mv button.mv-tab { min-height: var(--mv-target); padding: .5rem .1rem; border: 0; border-bottom: 4px solid transparent; border-radius: 0; background: transparent; color: var(--ui-ink); font: inherit; font-weight: 700; cursor: pointer; }
.ui .mv button.mv-tab[aria-current="page"] { color: var(--ui-primary); border-bottom-color: var(--ui-action); }
.mv-notice { margin: 0 0 1rem !important; padding: .8rem 1.1rem; border-radius: 12px; background: var(--ui-success-bg); color: var(--ui-success); font-weight: 700; }
.mv-panel { min-width: 0; }
.mv-panel > h2 { margin-bottom: .3rem; }
.mv-data { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem 2rem; margin: 1.2rem 0 0; }
.mv-data dt { color: var(--ui-muted); font-size: .95rem; }
.mv-data dd { margin: .15rem 0 0; font-size: 1.35rem; font-weight: 700; overflow-wrap: anywhere; }
.mv-line { display: flex; align-items: center; justify-content: space-between; gap: 1.2rem; margin-top: 1.6rem; padding-top: 1.4rem; border-top: 1px solid var(--ui-line); flex-wrap: wrap; }
.mv-card-row { display: flex; align-items: center; justify-content: space-between; gap: 1.2rem; padding: 1.2rem 0; border-bottom: 1px solid var(--ui-line); flex-wrap: wrap; }
.mv-card-row > div { min-width: 0; flex: 1 1 14rem; }
.mv-value { font-size: 1.3rem; font-weight: 700; margin-top: .3rem !important; overflow-wrap: anywhere; }
.mv-value.muted { color: var(--ui-muted); font-weight: 400; font-size: 1.1rem; }
.mv-value-row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.mv-relation { padding: 1.1rem 0; border-bottom: 1px solid var(--ui-line); }
.ui .mv .mv-subhead { margin-top: 1.6rem; }
.mv-note { padding: 1rem 1.2rem; border-radius: 12px; border-left: 6px solid var(--ui-warn); background: var(--ui-warn-bg); color: var(--ui-ink); margin-bottom: 1.2rem; }
.mv-note p { margin-top: .3rem !important; }
.mv-history { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .9rem; }
.mv-history li { display: grid; gap: .1rem; padding-left: 1rem; border-left: 4px solid var(--ui-line); }
.mv-history small { color: var(--ui-muted); }
.mv-photo-layout { display: grid; grid-template-columns: minmax(10rem, 14rem) minmax(0, 1fr); gap: 1.6rem; margin-top: 1.2rem; align-items: start; }
.mv-photo-controls { display: grid; gap: .9rem; }
.ui .mv .mv-photo-controls input[type="file"] { min-height: var(--mv-target); padding: .8rem; }

/* "?" help: inline next to the heading (assets/hints.js adds the button and the text) */
.ui .mv [data-hint] { position: relative; }
.mv-heading-row { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .7rem; }
.ui .mv [data-hint] > .hint-btn { position: static; width: 2.2rem; height: 2.2rem; min-height: 0; padding: 0; border-radius: 50%; flex: none; }
.ui .mv [data-hint] > .hint-text { flex-basis: 100%; }
.mv-value-row[data-hint] > .hint-text { flex-basis: 100%; font-weight: 400; font-size: 1rem; }

/* More (rare tasks) */
.mv-more { margin-top: 2rem; border-top: 1px solid var(--ui-line); padding-top: 1rem; }
.mv-more summary { cursor: pointer; min-height: var(--mv-target); display: flex; align-items: center; font-weight: 800; font-size: 1.1rem; }
.mv-more-content { display: flex; flex-wrap: wrap; gap: .8rem; padding: .6rem 0 0; }

/* Dialog */
.ui .mv-dialog { width: min(calc(100% - 2rem), 40rem); max-height: calc(100dvh - 2rem); padding: 0; border: 1px solid var(--ui-line); border-radius: 20px; background: var(--ui-surface); color: var(--ui-ink); box-shadow: var(--ui-shadow); overflow: auto; }
.mv-dialog::backdrop { background: rgb(10 20 38 / 72%); }
.mv-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.3rem 1.5rem; border-bottom: 1px solid var(--ui-line); }
.ui .mv-dialog .mv-dialog-head h2 { font-size: 1.7rem; }
.ui .mv-dialog button.mv-close { min-height: var(--mv-target); min-width: var(--mv-target); padding: 0; border-radius: 50%; border: 0; background: var(--ui-soft); color: var(--ui-ink); font-size: 1.6rem; cursor: pointer; }
.mv-dialog-body { display: grid; gap: 1rem; padding: 1.4rem 1.5rem 1.6rem; }
.mv-dialog h3 { margin-top: .4rem; }
.mv-form { display: grid; gap: 1rem; }
.mv-form-grid { display: grid; gap: 1rem; }
.mv-dialog .mv-card-row { padding: .6rem 0; border-bottom: 0; }

@media (max-width: 64rem) {
  .mv-family-layout { grid-template-columns: 1fr; gap: 1.2rem; }
  .mv-sidebar { padding-right: 0; border-right: 0; padding-bottom: 1rem; border-bottom: 1px solid var(--ui-line); }
  .mv-family-choices { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
}
@media (max-width: 47.99rem) {
  .ui .shell.mv { width: calc(100% - 2rem); }
  .ui .mv h1 { font-size: 2.2rem; }
  .ui .mv h2 { font-size: 1.4rem; }
  .mv-searchbox { grid-template-columns: 1fr; }
  .mv-searchbox .mv-btn, .mv-actions .mv-btn, .mv-more-content .mv-btn { width: 100%; }
  .ui .mv button.mv-row { grid-template-columns: auto minmax(0, 1fr); gap: .3rem .9rem; min-height: 4.4rem; }
  .mv-row .mv-row-family, .mv-row .mv-badge { grid-column: 2; }
  .mv-row .mv-arrow { display: none; }
  .mv-person-head { align-items: flex-start; }
  .mv-person-head h2 { font-size: 1.7rem; }
  .mv-photo-slot-head { width: 4rem; height: 4rem; }
  .mv-data { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
  .mv-data dd { font-size: 1.15rem; }
  .mv-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
  .ui .mv button.mv-tab { text-align: left; justify-content: flex-start; }
  .mv-card-row { align-items: stretch; }
  .mv-card-row > .mv-btn { width: 100%; }
  .mv-photo-layout { grid-template-columns: 1fr; }
  .mv-empty { flex-direction: column; }
  .mv-hero .mv-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* KGP-V9: identity-check note; the ID photo is shown only after an explicit click */
.mv-idc { margin-top: 1.6rem; padding-top: 1.2rem; border-top: 1px solid var(--ui-line); }
.mv-idc h3 { margin: 0 0 .4rem; }
.mv-idc-photo img { display: block; max-width: min(100%, 32rem); height: auto; margin-top: 1rem; border: 1px solid var(--ui-line); border-radius: 12px; }
