/* ==================================================
   EINFACH ANPASSBARE DARSTELLUNG
   ================================================== */
:root {
  /* Seitenbreite und Abstände zwischen Abschnitten bzw. Karten. */
  --page-max-width: 1600px;
  --page-gap: 1.75rem;
  --card-gap: 1rem;
  --dashboard-gap: 1.5rem;

  /* Innenabstand und Rundung der Karten; kleine Werte für schmale Bildschirme. */
  --card-padding: 1.25rem;
  --card-padding-small: 1rem;
  --radius: 14px;
  --radius-small: 9px;
  --dashboard-radius: 18px;

  /* Pastellfarben für Mitarbeitende: kräftiger für Leitung, heller für Mithilfe. */
  --pastel-pink: #f4dfe8;
  --pastel-pink-light: #fcf2f6;
  --pastel-turquoise: #bfe8e1;
  --pastel-turquoise-light: #dcf3ef;

  /* Mitarbeitende „Im Gespräch“ werden orange; Pause, Workshop usw. bleiben grau. */
  --in-session-background: #fde6cf;
  --in-session-badge: #f8cd9c;
  --in-session-text: #8a4510;

  /* Zurückhaltende Texte, inaktive Mitarbeitende und nicht verfügbare Status. */
  --muted-text: #596b79;
  --muted-background: #eef1f3;
  --unavailable-background: #edf0f2;
  --unavailable-text: #5c6872;
  --disabled-opacity: .65; /* 0 = unsichtbar, 1 = vollständig sichtbar */
}

/* Weitere gemeinsame Gestaltungsregeln für Verwaltung und Anmeldung. */
:root {
  color-scheme: light;
  --background: #f4f6f8;
  --surface: #ffffff;
  --surface-subtle: #f8fafb;
  --border: #dce3e9;
  --control-border: #8294a1;
  --text: #253746;
  --primary: #285a68;
  --primary-hover: #1e4753;
  --primary-soft: #e9f2f3;
  --success: #285f47;
  --success-soft: #e9f3ed;
  --warning: #76551c;
  --warning-soft: #fbf2df;
  --danger: #983f43;
  --danger-soft: #fbeded;
  --info: #355f86;
  --info-soft: #eaf0f8;
  --female-leader: var(--pastel-pink);
  --female-support: var(--pastel-pink-light);
  --female-text: #6b3d51;
  --male-leader: var(--pastel-turquoise);
  --male-support: var(--pastel-turquoise-light);
  --male-text: #1d5c55;
  --shadow: 0 2px 8px rgb(32 53 69 / 4%);
  --focus: #266d9d;
}

/* Foundations and keyboard access. */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--text); font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: var(--primary); text-underline-offset: .2em; }
a:hover { color: var(--primary-hover); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
main:focus { outline: none; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4 { line-height: 1.25; overflow-wrap: anywhere; }
h2 { font-size: 1.2rem; }
h3, h4 { font-size: 1rem; }
p:last-child { margin-bottom: 0; }
form { margin: 0; }
strong { font-weight: 650; }
.muted, .helper-text, .field-help, .page-description { color: var(--muted-text); }
.helper-text, .field-help { font-size: .875rem; margin: .4rem 0 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -5rem; left: 1rem; z-index: 100; padding: .75rem 1rem; background: var(--surface); border: 2px solid var(--focus); border-radius: var(--radius-small); }
.skip-link:focus { top: 1rem; }

/* Application shell and navigation, outside all HTMX swap targets. */
.app-header { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { position: relative; max-width: var(--page-max-width); margin: auto; padding: 1rem 2rem 0; }
.app-brand { display: inline-flex; gap: .75rem; align-items: center; color: var(--text); font-size: 1.125rem; font-weight: 700; text-decoration: none; margin-bottom: 1rem; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--primary); color: white; font-size: 1.25rem; }
.brand-subtitle { display: block; font-size: .75rem; font-weight: 500; color: var(--muted-text); letter-spacing: .025em; }
#admin-navigation { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.nav-link { min-height: 48px; display: inline-flex; align-items: center; padding: .65rem .65rem .8rem; border-bottom: 3px solid transparent; font-weight: 550; font-size: .9375rem; color: var(--muted-text); text-decoration: none; }
.nav-link:hover { background: var(--surface-subtle); }
.nav-link.is-active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }
.app-main { max-width: var(--page-max-width); margin: auto; padding: 2rem; }
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: var(--page-gap); }
.page-title { margin: 0 0 .5rem; font-size: clamp(1.7rem, 3vw, 2.15rem); letter-spacing: -.035em; }
.page-description { margin: 0; max-width: 65ch; }
.eyebrow { margin-bottom: .45rem; color: var(--muted-text); text-transform: uppercase; letter-spacing: .12em; font-size: .7rem; font-weight: 700; }
.page-actions, .form-actions, .card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }

/* Reusable surfaces and content patterns. */
.section { min-width: 0; margin-bottom: var(--page-gap); }
.section-header, .card-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .65rem; margin-bottom: 1rem; }
.section-header h2, .section-header h3, .card-header h2, .card-header h3, .card-header h4 { margin: 0; }
.section-header > .badge { margin-left: auto; }
.section-link { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; font-size: .875rem; font-weight: 600; text-decoration: none; }
.card { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--card-padding); box-shadow: var(--shadow); overflow-wrap: anywhere; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: var(--card-gap); }
.card-grid > .empty-state { grid-column: 1 / -1; }
.card-actions { margin-top: 1.15rem; }
.card-actions form { max-width: 100%; }
.group-title { color: var(--muted-text); font-size: .875rem; margin: 1.1rem 0 .75rem; }
.empty-state { background: var(--surface-subtle); border: 1px dashed var(--border); border-radius: var(--radius); padding: 1.75rem 1.25rem; text-align: center; color: var(--muted-text); }
.detail-list { margin: 1rem 0; }
.detail-list > div { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .15rem 1rem; padding: .4rem 0; }
.detail-list dt { font-size: .8125rem; color: var(--muted-text); }
.detail-list dd { margin: 0; font-size: .9375rem; overflow-wrap: anywhere; }
.detail-list > dt { margin-top: .65rem; }
.gender-marker { color: var(--muted-text); font-size: .9em; white-space: nowrap; font-weight: 500; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); gap: var(--card-gap); }

/* Actions: 44px minimum touch target; clear primary and destructive treatments. */
.button, .btn { display: inline-flex; justify-content: center; align-items: center; gap: .5rem; min-height: 44px; max-width: 100%; padding: .6rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-small); background: var(--surface); color: var(--text); font-weight: 600; font-size: .875rem; line-height: 1.35; cursor: pointer; text-decoration: none; text-align: center; }
.button:hover, .btn:hover { background: var(--surface-subtle); border-color: #a9b7c2; color: var(--text); }
.button-primary { background: var(--primary); border-color: var(--primary); color: white; }
.button-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: white; }
.button-secondary { background: var(--surface); color: var(--primary); }
.button-danger { color: var(--danger); border-color: #ebcfd1; background: var(--danger-soft); }
.button-danger:hover { color: var(--danger); background: #f6dfe0; border-color: #d8aeb1; }
.button-warning { color: var(--warning); background: var(--warning-soft); border-color: #e8d7b1; }
.button-warning:hover { color: var(--warning); background: #f5e8cc; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: var(--disabled-opacity); }
.button-block { width: 100%; }
.button-icon { width: 44px; padding: .6rem; flex-shrink: 0; }

/* Inline reveal for the booth rename action: a <details> disclosure whose
   summary is styled as an icon button, so no extra JS is needed. */
.booth-edit { position: relative; }
.booth-edit > summary { list-style: none; }
.booth-edit > summary::-webkit-details-marker,
.booth-edit > summary::marker { display: none; content: ""; }
.booth-edit-form { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .65rem; width: 100%; }
.booth-edit-form input { flex: 1 1 120px; min-width: 0; }

/* Operational badges always include a visible text label. */
.badge, .status-badge { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .65rem; border-radius: 7px; background: #edf1f4; color: #50616e; font-size: .75rem; font-weight: 650; line-height: 1.4; }
.status-free, .status-available, .status-completed { background: var(--success-soft); color: var(--success); }
.status-reserved, .status-assigned { background: var(--info-soft); color: var(--info); }
.status-active, .status-occupied { background: #dbece9; color: #255b53; }
.status-in_session { background: var(--in-session-badge); color: var(--in-session-text); }
.status-break, .status-waiting, .status-warning { background: var(--warning-soft); color: var(--warning); }
.status-workshop { background: #eeeaf5; color: #61507e; }
.status-task_force { background: #e5eff0; color: #3f6367; }
.status-blocked, .status-cancelled { background: var(--danger-soft); color: var(--danger); }
.status-unavailable, .status-archived { background: var(--unavailable-background); color: var(--unavailable-text); }
.live-indicator { color: var(--success); background: var(--success-soft); }
.live-indicator::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* Gender/role presentation uses the existing semantic staff classes. */
.staff-female { --staff-background: var(--female-support); --staff-text: var(--female-text); }
.staff-male { --staff-background: var(--male-support); --staff-text: var(--male-text); }
.staff-female.staff-role-leader { --staff-background: var(--female-leader); }
.staff-male.staff-role-leader { --staff-background: var(--male-leader); }
.member-card, .staff-person { background: var(--staff-background, var(--surface-subtle)); color: var(--staff-text, var(--text)); border-radius: var(--radius-small); padding: .8rem 1rem; }
.member-card { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .3rem .75rem; margin-top: .5rem; }
.member-card span { font-size: .8125rem; }
.member-list { display: grid; gap: .5rem; }
.member-list .member-card { margin: 0; }
.staff-person.inactive, .staff-person.staff-muted { color: var(--muted-text); --staff-background: var(--muted-background); --staff-text: var(--muted-text); }
.staff-person.staff-state-in_session { color: var(--in-session-text); --staff-background: var(--in-session-background); --staff-text: var(--in-session-text); }
.inactive .staff-person { color: var(--muted-text); }

/* Dashboard: full-width queue and compact booths above teams/conversations. */
/* Dashboard: three operational columns Angemeldet | Zugewiesen | Im Gespräch. */
.dashboard-grid { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 3fr); gap: var(--dashboard-gap); align-items: start; }
.dashboard-grid > .section { background: #eef2f5; border: 1px solid var(--border); border-radius: var(--dashboard-radius); padding: var(--card-padding); margin: 0; }
.dashboard-grid .card-grid { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
.dashboard-grid .card { padding: .9rem 1rem; }
.dashboard-grid .card h3 { margin-bottom: .35rem; }
.dashboard-grid .card-header { margin-bottom: .2rem; flex-wrap: nowrap; align-items: center; }
.dashboard-grid .session-location { margin: .2rem 0 .35rem; }
.dashboard-grid .detail-list { margin: .35rem 0 0; }
.dashboard-grid .detail-list > div { padding: .15rem 0; }
.dashboard-grid .card-actions { margin-top: .75rem; }
.booth-card h3 { margin-bottom: .65rem; }
.waiting-card .card-actions { flex-wrap: nowrap; }
.waiting-card .card-actions .button-primary { flex: 1 1 auto; }
.dashboard-expired { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.dashboard-expired .section-header { margin-bottom: .5rem; }
.expired-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .55rem .75rem; margin-bottom: .45rem; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--warning); border-radius: var(--radius-small); }
.expired-time { font-size: .8125rem; color: var(--warning); }
.expired-empty { font-size: .875rem; margin: 0; }
/* Whole waiting card opens the assignment page via the stretched name link. */
.waiting-card { position: relative; transition: border-color .15s, box-shadow .15s; }
.waiting-card:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgb(32 53 69 / 10%); }
.waiting-card-link { color: inherit; text-decoration: none; }
.waiting-card-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.waiting-card .card-actions { position: relative; z-index: 1; }

/* Assignment: counselee summary, selectable teams, selectable booths. */
.assign-layout { display: grid; grid-template-columns: minmax(0, 45fr) minmax(0, 35fr) minmax(0, 20fr); gap: var(--dashboard-gap); align-items: start; }
.assign-layout h2 { margin-bottom: 1rem; }
.assign-layout .card-header h2 { margin: 0; }
.assign-selection { display: contents; }
.assign-remark-label { font-size: .8125rem; color: var(--muted-text); margin-bottom: .35rem; }
.assign-remark { padding: .85rem 1rem; line-height: 1.6; }
.select-list { display: grid; gap: .65rem; }
.select-card { position: relative; display: grid; gap: .1rem; width: 100%; text-align: left; font: inherit; color: var(--text); cursor: pointer; border-width: 2px; transition: border-color .15s, background .15s, box-shadow .15s; }
.select-card:hover:not(:disabled):not(.is-selected) { border-color: var(--control-border); }
.select-card.is-selected { border-color: var(--primary); background: #e1eef0; box-shadow: 0 4px 12px rgb(40 90 104 / 18%); }
.select-card.is-selected::after { content: "✓"; position: absolute; top: -.6rem; right: -.6rem; display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--primary); color: #fff; font-size: .8rem; font-weight: 700; box-shadow: 0 0 0 2px var(--surface); }
.select-card:disabled { background: var(--muted-background); box-shadow: none; }
.select-title { font-size: 1rem; }
.booth-select { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .35rem .5rem; padding-block: .85rem; }

/* New team: gender tabs, Leiter | Anwärter/Assistenz staff rows, sticky summary. */
.team-select-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--dashboard-gap); align-items: start; }
.team-select-layout h2 { margin-bottom: 1rem; }
.team-select-layout .select-list, .team-teamed .select-list { gap: .25rem; }
/* Row colours and muting come from .staff-person (same as /admin/people). */
.staff-row { display: flex; flex-wrap: wrap; align-items: center; padding: .3rem 2.2rem .3rem .7rem; gap: .1rem .9rem; border: 2px solid var(--border); color: var(--staff-text, var(--text)); }
.staff-row-main, .staff-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .5rem; }
.staff-row-role { font-size: .8125rem; font-weight: 600; }
.staff-row-meta { gap: .15rem .35rem; font-size: .8125rem; }
.staff-row-meta .status-badge { padding: .05rem .45rem; }
.staff-row.is-selected { color: var(--text); }
.staff-row.is-selected::after { top: 50%; right: .6rem; transform: translateY(-50%); box-shadow: none; }
/* Sticky selection bars (new team, assignment): summary + actions stay in view. */
.team-select-summary, .assign-bar { grid-column: 1 / -1; position: sticky; bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem; box-shadow: 0 6px 20px rgb(32 53 69 / 12%); }
.team-summary-title, .assign-bar-title { margin: 0; font-weight: 650; }
.team-select-summary .detail-list, .assign-bar .detail-list { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; margin: 0; flex: 1 1 220px; }
.team-select-summary .detail-list > div, .assign-bar .detail-list > div { justify-content: flex-start; padding: 0; gap: .5rem; }
.team-select-summary .form-actions, .assign-bar .form-actions { margin: 0; padding: 0; border: 0; }
.session-location { margin: .75rem 0; font-weight: 650; font-size: .9375rem; }

/* Forms and filters. No external assets or script dependency. */
.form-card { max-width: 840px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.75rem; box-shadow: var(--shadow); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.field { min-width: 0; margin-bottom: 1.25rem; }
.form-grid > .field { margin-bottom: 0; }
.form-grid + .field { margin-top: 1.25rem; }
.field > .helper-text { margin-bottom: .75rem; }
.field-full, .form-grid > .form-actions, .form-grid > .alert { grid-column: 1 / -1; }
label, legend { font-weight: 600; font-size: .875rem; }
label { display: block; margin-bottom: .45rem; }
fieldset { min-width: 0; padding: 0; border: 0; margin: 0 0 1.25rem; }
legend { padding: 0; margin-bottom: .65rem; }
input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]), select, textarea { display: block; width: 100%; min-width: 0; min-height: 46px; border: 1px solid var(--control-border); border-radius: var(--radius-small); padding: .65rem .75rem; background: var(--surface); color: var(--text); }
select { padding-right: 1.5rem; }
textarea { min-height: 150px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 20px; height: 20px; flex-shrink: 0; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
.form-actions { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: .65rem; margin-bottom: 1.5rem; }
.filter-chip { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .55rem .95rem; border: 1px solid var(--border); border-radius: 24px; background: var(--surface); color: var(--muted-text); text-decoration: none; font-weight: 600; font-size: .875rem; }
.filter-chip:hover { border-color: var(--primary); }
.filter-chip.is-active, .filter-chip[aria-current="page"] { color: var(--primary); background: var(--primary-soft); border-color: var(--primary); }
.filter-bar .field { flex: 1 1 140px; margin: 0; }
.filter-bar .form-actions { margin: 0; padding: 0; border: 0; }
.filter-bar.form-card { max-width: none; }
.alert, .error { padding: 1rem 1.15rem; margin-bottom: 1.25rem; border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius-small); overflow-wrap: anywhere; }
.alert-error, .error { color: var(--danger); border-color: #e4c1c3; background: var(--danger-soft); }
.alert-warning { color: var(--warning); border-color: #dec996; background: var(--warning-soft); }
.alert-success { color: var(--success); border-color: #b9d7c6; background: var(--success-soft); }
.alert h2, .alert h3 { margin-bottom: .5rem; }
.alert ul { padding-left: 1.25rem; }

/* Semantic tables: scroll containment plus staff card layout on tablet. */
.table-container { overflow-x: auto; max-width: 100%; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .875rem; }
th { padding: .9rem 1rem; color: var(--muted-text); font-size: .75rem; font-weight: 650; background: var(--surface-subtle); }
td { padding: 1rem; vertical-align: middle; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.staff-table td:first-child { min-width: 165px; background: var(--staff-background); color: var(--staff-text); font-weight: 650; }
.staff-table td:nth-child(4) { min-width: 155px; }
.staff-table td:nth-child(6) { min-width: 165px; }
.staff-table select { font-size: .875rem; }

/* History and public registration. */
.history-list { display: grid; gap: var(--card-gap); }
.history-card { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 1.5rem; align-items: start; }
.history-time { font-variant-numeric: tabular-nums; }
.history-time p { margin-bottom: .3rem; }
.history-card .detail-list { margin-bottom: 0; }
.note-content { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-subtle); border-left: 3px solid var(--border); border-radius: var(--radius-small); padding: 1.25rem; line-height: 1.75; }
.registration-shell { max-width: 780px; margin: auto; padding: 2.5rem 1.5rem 4rem; }
.public-header { text-align: center; margin-bottom: 2rem; }
.public-header .brand-mark { margin: 0 auto 1rem; }
.registration-shell .form-card { padding: 2rem; }
.registration-shell input:not([type="radio"]):not([type="checkbox"]), .registration-shell select, .registration-shell .button { min-height: 52px; }
.registration-shell .button-primary { font-size: 1rem; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.choice-card { display: flex; align-items: center; gap: .75rem; min-height: 66px; padding: 1rem; border: 1px solid var(--control-border); border-radius: var(--radius-small); cursor: pointer; margin: 0; background: var(--surface); }
.choice-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.choice-card:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
.registration-shell .success-card { text-align: center; padding: 2.5rem; }

@media (min-width: 1280px) {
  .header-inner { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding-top: .8rem; }
  .app-brand { margin-bottom: .8rem; }
  #admin-navigation { gap: .25rem; align-self: stretch; }
  .nav-link { padding-inline: 1rem; }
}
@media (max-width: 1100px) {
  .app-main { padding: 1.5rem; }
  .dashboard-grid { gap: var(--card-gap); }
  .dashboard-grid > .section { padding: var(--card-padding-small); }
  .assign-layout { gap: var(--card-gap); }
  .staff-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .staff-table, .staff-table tbody { display: block; }
  .staff-table tbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--card-gap); padding: 1rem; }
  .staff-table tr { display: block; border: 1px solid var(--border); border-radius: var(--radius-small); overflow: hidden; min-width: 0; }
  .staff-table td { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .6rem .85rem; min-width: 0 !important; border: 0; }
  .staff-table td::before { content: attr(data-label); font-size: .75rem; color: var(--muted-text); font-weight: 500; flex-shrink: 0; }
  .staff-table td:first-child { font-size: 1rem; padding-block: 1rem; }
  .staff-table td select { width: auto; max-width: 70%; }
  .staff-table td .staff-person { padding: 0; }
}
@media (max-width: 800px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .assign-layout { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
  .assign-summary { grid-column: 1 / -1; }
  .history-card { grid-template-columns: 1fr; gap: .75rem; }
  .history-time { display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
}
@media (max-width: 560px) {
  .header-inner { padding: 1rem 1rem 0; }
  #admin-navigation { gap: 0 .4rem; }
  .nav-link { font-size: .8125rem; padding-inline: .45rem; }
  .app-main { padding: 1.25rem 1rem; }
  .page-header { align-items: start; }
  .page-actions { width: 100%; }
  .card { padding: var(--card-padding-small); }
  .form-card, .registration-shell .form-card { padding: 1.25rem; }
  .form-grid { grid-template-columns: 1fr; }
  .assign-layout { grid-template-columns: minmax(0, 1fr); }
  .team-select-layout { grid-template-columns: minmax(0, 1fr); }
  .staff-table tbody { grid-template-columns: 1fr; padding: .65rem; }
  .registration-shell { padding: 1.75rem 1rem 3rem; }
  .choice-grid { gap: .65rem; }
  .detail-list > div { gap: .15rem .75rem; }
  .card-actions .button, .form-actions .button { flex-grow: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}

/* Team tables with drag-and-drop ordering. */
.team-table tbody tr { cursor: grab; }
.team-table tbody tr.dragging { opacity: .45; }
.team-table .team-nr { white-space: nowrap; width: 5rem; font-variant-numeric: tabular-nums; }
.team-table .drag-handle { color: var(--muted-text); margin-right: .35rem; }
.team-table .team-actions { text-align: right; }
.team-table .team-actions form { display: inline; }

/* Compact staff and team tables. */
.staff-table th, .team-table th { padding: .45rem .7rem; }
.staff-table td, .team-table td { padding: .3rem .7rem; }
.staff-table .button, .team-table .button { min-height: 30px; padding: .2rem .65rem; font-size: .8125rem; }
.staff-table .button-icon { width: 30px; padding: .2rem; }
.staff-table .button-icon svg { width: 16px; height: 16px; }
.staff-table select { min-height: 28px; height: 28px; padding-top: 0; padding-bottom: 0; }
.staff-table td:first-child { min-width: 0; }
.staff-table .status-badge, .team-table .status-badge { padding: .1rem .5rem; }
.team-table { table-layout: fixed; }
.team-table th:nth-child(1) { width: 3.25rem; }
.team-table th:nth-child(4) { width: 8rem; }
.team-table .status-badge { white-space: nowrap; }
.team-table th:nth-child(5) { width: 8.25rem; }
.team-table .button { white-space: nowrap; }
.team-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--page-gap); align-items: start; }
.team-columns .team-group-wide { grid-column: 1 / -1; }
@media (max-width: 1200px) { .team-columns { grid-template-columns: minmax(0, 1fr); } }
.team-select-layout h2, .team-teamed h2 { margin-bottom: .6rem; }
.team-teamed { margin-top: var(--page-gap); }
.team-teamed .staff-row { padding-right: .7rem; }
.team-teamed .staff-row-action { margin-left: auto; }
.team-teamed .staff-row-action .button { min-height: 28px; padding: .15rem .65rem; font-size: .8125rem; white-space: nowrap; }

/* Staff profile photos. */
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--surface-subtle); }
.avatar-initial { display: inline-grid; place-items: center; font-size: .8125rem; font-weight: 700; color: var(--muted-text); background: #e3e9ee; }
.staff-identity { display: inline-flex; align-items: center; gap: .55rem; }
.conversation-count { color: #8b98a3; font-size: .75rem; font-weight: 500; }
.staff-edit-title .staff-identity { font-size: 1.5rem; gap: .8rem; }
.staff-edit-title .avatar { width: 72px; height: 72px; font-size: 1.75rem; }
.staff-edit-title .conversation-count { font-size: .95rem; }
.row-actions { display: flex; gap: .35rem; align-items: center; }
.row-actions form { margin: 0; }
.checkbox-inline { display: flex; align-items: center; gap: .5rem; margin-top: .5rem; font-weight: 400; }

/* Switch (e.g. compact staff list). */
.switch { display: inline-flex; align-items: center; gap: .55rem; margin: 0; cursor: pointer; font-size: .875rem; font-weight: 600; color: var(--muted-text); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 38px; height: 22px; border-radius: 11px; background: #c7d1d9; transition: background .15s; flex-shrink: 0; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 25%); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Compact staff list: Frauen and Männer side by side on wide screens. */
@media (min-width: 1201px) {
  .people-lists.is-compact { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--page-gap); align-items: start; }
  .people-lists.is-compact .staff-table th:nth-child(2), .people-lists.is-compact .staff-table td:nth-child(2),
  .people-lists.is-compact .staff-table th:nth-child(7), .people-lists.is-compact .staff-table td:nth-child(7) { display: none; }
  .people-lists.is-compact .staff-table th, .people-lists.is-compact .staff-table td { padding-left: .35rem; padding-right: .35rem; }
  .people-lists.is-compact .staff-table td { overflow-wrap: normal; white-space: nowrap; }
  .people-lists.is-compact .staff-table select { width: 8.5rem; max-width: none; padding-left: .4rem; padding-right: 1.1rem; }
  .people-lists.is-compact .row-actions { gap: .2rem; }
  .people-lists.is-compact .staff-table .status-badge { font-size: .7rem; padding: .1rem .4rem; }
}

/* Read-only staff views (/team/...). */
.team-view .team-overview-table { font-size: 1.05rem; }
.team-view .team-overview-table td { padding: .45rem .7rem; }
.team-view .team-overview-table .avatar { width: 34px; height: 34px; }
.team-overview-table tr.is-ready { box-shadow: inset 4px 0 0 var(--primary); font-weight: 600; }
.status-ready { background: var(--primary); color: #fff; }
.team-view .team-overview-table th:nth-child(4) { width: 9.5rem; }
.staff-gallery { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1.5rem 1rem; }
.staff-gallery-item { display: flex; flex-direction: column; align-items: center; gap: .6rem; text-align: center; font-weight: 600; }
.staff-gallery-item .avatar { width: 112px; height: 112px; font-size: 2.5rem; }

/* Frauen/Männer-first switch and phone layout for /team/... */
.first-switch { display: inline-flex; align-items: center; gap: .35rem; margin-bottom: 1rem; }
.first-switch-label { color: var(--muted-text); font-size: .875rem; font-weight: 600; margin-right: .15rem; }
.first-switch-option { min-height: 36px; padding: .3rem .9rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-weight: 600; font-size: .875rem; cursor: pointer; }
.first-switch-option[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
#team-first-root, #team-first-root > #team-overview { display: contents; }
#team-first-root.staff-groups { display: flex; flex-direction: column; }
#team-first-root .team-group-female { order: 1; }
#team-first-root .team-group-male { order: 2; }
#team-first-root .team-group-other, #team-first-root .team-group-busy { order: 3; }
#team-first-root[data-first="male"] .team-group-male { order: 1; }
#team-first-root[data-first="male"] .team-group-female { order: 2; }
.team-view .team-columns { display: flex; flex-wrap: wrap; gap: 0 var(--page-gap); }
.team-view .team-columns > .team-group { flex: 1 1 520px; min-width: 0; }
.team-view .team-columns > .team-group-wide { flex-basis: 100%; }
@media (max-width: 700px) {
  .team-view .app-main { padding-left: 12px; padding-right: 12px; }
  .team-view .page-title { font-size: 1.5rem; }
  .team-view .team-columns > .team-group { flex-basis: 100%; }
  .team-overview-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .team-overview-table, .team-overview-table tbody { display: block; }
  .team-overview-table { table-layout: auto; }
  .team-overview-table tr { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr) auto; grid-template-areas: "nr lead status" "nr assist status"; align-items: center; column-gap: .5rem; padding: .45rem .6rem; border-top: 1px solid var(--border); }
  .team-overview-table tr:first-child { border-top: 0; }
  .team-overview-table td { display: block; padding: .1rem 0; border: 0; min-width: 0; }
  .team-overview-table td[data-area="nr"] { grid-area: nr; width: auto; }
  .team-overview-table td[data-area="lead"] { grid-area: lead; }
  .team-overview-table td[data-area="assist"] { grid-area: assist; font-size: .9rem; }
  .team-overview-table td[data-area="status"] { grid-area: status; }
  .team-view .team-overview-table .avatar { width: 28px; height: 28px; }
  .staff-gallery { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 1rem .5rem; }
  .staff-gallery-item { font-size: .875rem; }
  .staff-gallery-item .avatar { width: 80px; height: 80px; font-size: 1.75rem; }
}

/* User circle and menu in the header. */
.user-menu { position: absolute; top: 1rem; right: 2rem; }
.user-summary { display: flex; align-items: center; gap: .55rem; list-style: none; cursor: pointer; padding: .2rem .2rem .2rem .2rem; border-radius: 999px; }
.user-summary::-webkit-details-marker { display: none; }
.user-circle { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; }
.user-name { font-size: .875rem; font-weight: 600; color: var(--muted-text); }
.user-summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.user-popover { position: absolute; right: 0; top: calc(100% + .35rem); min-width: 11rem; padding: .35rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-small); box-shadow: 0 8px 24px rgb(32 53 69 / 16%); display: grid; gap: .1rem; z-index: 30; }
.user-popover form { margin: 0; }
.user-item { display: block; width: 100%; padding: .55rem .75rem; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; font-size: .875rem; font-weight: 550; text-align: left; text-decoration: none; cursor: pointer; }
.user-item:hover { background: var(--surface-subtle); }
.header-simple { display: flex; align-items: center; justify-content: space-between; padding-bottom: .8rem; }
.header-simple .app-brand { margin-bottom: 0; }
.header-simple .user-menu { position: static; }
@media (min-width: 1280px) { .user-menu { position: static; } }
@media (max-width: 560px) { .user-menu { right: 1rem; } .user-name { display: none; } }
.login-shell { max-width: 400px; margin: auto; padding: 3rem 1.25rem; }
.login-shell .public-header { text-align: center; margin-bottom: 1.5rem; }
.login-shell .brand-mark { margin: 0 auto 1rem; }
.form-card h2 { font-size: 1.05rem; margin-bottom: .75rem; }
.form-card .form-grid + h2 { margin-top: 1.5rem; }

/* Staff names carry their gender colour wherever they appear. */
.person-chip { display: inline-block; padding: .1rem .6rem; border-radius: 6px; background: var(--staff-background); color: var(--staff-text); font-weight: 600; line-height: 1.5; }
.team-table td .person-chip, .detail-list .person-chip { max-width: 100%; }

/* Compact assignment lists. */
.assign-layout h2 { margin-bottom: .6rem; }
.assign-layout .select-list { gap: .35rem; }
.team-select { display: flex; flex-wrap: nowrap; gap: .35rem; padding: .35rem; }
.team-select .member-card { flex: 1 1 0; min-width: 0; margin: 0; padding: .35rem .6rem; gap: .1rem .5rem; }

/* Theme chooser in the settings. */
.settings-tabs { margin-bottom: 1.25rem; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--card-gap); margin-bottom: 1.25rem; }
.theme-card { position: relative; display: grid; gap: .5rem; padding: .85rem; margin: 0; border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.theme-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.theme-card.is-active, .theme-card:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.theme-card:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }
.theme-preview { display: grid; gap: .45rem; align-content: start; height: 120px; padding: .6rem; border-radius: var(--radius-small); border: 1px solid rgb(0 0 0 / 10%); }
.theme-preview-bar { display: flex; align-items: center; justify-content: flex-end; height: 18px; padding: 0 .4rem; border-radius: 6px; }
.theme-preview-bar i { display: block; width: 14px; height: 8px; border-radius: 4px; }
.theme-preview-card { display: grid; gap: .3rem; padding: .5rem; border-radius: 8px; }
.theme-preview-card i { display: block; height: 6px; width: 80%; border-radius: 3px; }
.theme-preview-button { width: 48px; height: 14px; border-radius: 7px; }
.theme-title { font-weight: 650; }
.theme-description { font-size: .875rem; }

/* Counselee edit page: form on the left, conversation panel on the right */
.edit-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.edit-layout:has(.session-panel) { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
@media (max-width: 900px) { .edit-layout:has(.session-panel) { grid-template-columns: minmax(0, 1fr); } }
.session-panel h3 { margin: 1.25rem 0 .5rem; font-size: 1rem; }

.page-actions { display: flex; gap: .5rem; }

.session-panel .button { white-space: nowrap; }
.panel-icon { width: 36px; height: 36px; padding: 0; font-size: 1.25rem; line-height: 1; }
.helper-dialog { border: 1px solid var(--border, #d9dee3); border-radius: 14px; padding: 1.25rem; width: min(26rem, calc(100vw - 2rem)); max-height: 80vh; }
.helper-dialog::backdrop { background: rgb(0 0 0 / .35); }
.helper-dialog-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.helper-dialog-header h3 { margin: 0; }
.helper-tabs { display: flex; gap: .5rem; margin-bottom: .75rem; }
.helper-tab.is-active { background: var(--primary, #2f5566); color: #fff; }
.helper-list { list-style: none; margin: 0; padding: 0; }
.helper-list[hidden] { display: none; }
.helper-option { display: flex; gap: .6rem; align-items: center; width: 100%; padding: .55rem .5rem; background: none; border: 0; border-radius: 8px; text-align: left; cursor: pointer; font: inherit; }
.helper-option:hover, .helper-option:focus-visible { background: rgb(0 0 0 / .06); }
.booth-picker { display: flex; flex-wrap: wrap; gap: .5rem; border: 0; padding: 0; margin: 0; }
.booth-tile { position: relative; display: inline-flex; min-width: 3rem; justify-content: center; padding: .5rem .7rem; border: 2px solid; border-radius: 10px; font-weight: 600; cursor: pointer; background: #fff; }
.booth-tile input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.booth-tile:has(input:disabled) { cursor: not-allowed; opacity: .6; }
.booth-tile:has(input:checked) { box-shadow: 0 0 0 3px rgb(0 0 0 / .18); }
.booth-tile:has(input:focus-visible) { outline: 2px solid currentColor; outline-offset: 2px; }
.booth-free { border-color: #2e9e5b; color: #1d6b3d; }
.booth-reserved, .booth-occupied { border-color: #e88a1a; color: #9a5608; }
.booth-blocked { border-color: #d64545; color: #a32828; }
.booth-legend .dot { display: inline-block; width: .7rem; height: .7rem; border: 2px solid; border-radius: 50%; margin: 0 .25rem 0 .75rem; vertical-align: -1px; background: transparent; }

/* Compact dashboard rows */
.dashboard-main { display: grid; gap: var(--dashboard-gap); min-width: 0; }
.dashboard-main > .section { background: #eef2f5; border: 1px solid var(--border); border-radius: var(--dashboard-radius); padding: var(--card-padding); margin: 0; }
.row-list { display: grid; gap: .5rem; }
.row-card { display: grid; align-items: center; gap: .5rem .85rem; padding: .55rem .8rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-small); }
.session-row { grid-template-columns: 4.5rem minmax(8rem, 1.2fr) minmax(10rem, 2fr) 4.5rem auto; }
.waiting-card.row-card { grid-template-columns: minmax(0, 1fr) auto; position: relative; }
.row-card h3 { margin: 0; font-size: .9375rem; }
.row-meta { margin: .1rem 0 0; font-size: .78rem; color: var(--muted-text); }
.row-main { min-width: 0; }
.row-team { display: flex; flex-wrap: wrap; gap: .3rem .4rem; min-width: 0; }
.row-time { text-align: right; font-size: .875rem; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: .35rem; }
.row-actions form { margin: 0; }
.row-actions .button { min-height: 34px; padding-block: .3rem; }
.row-icon { width: 34px; padding: .3rem; }
.booth-pill { display: inline-flex; justify-content: center; padding: .2rem .5rem; border-radius: 999px; background: var(--surface-subtle); border: 1px solid var(--border); font-size: .78rem; font-weight: 600; white-space: nowrap; }
@media (max-width: 1100px) { .dashboard-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 800px) {
  .session-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .session-row .row-team { grid-column: 1 / -1; order: 3; }
  .session-row .row-time { order: 2; }
  .session-row .row-actions { grid-column: 1 / -1; order: 4; justify-content: flex-start; }
}

.tab-bar { display: flex; gap: .25rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); }
.tab-link { padding: .55rem .9rem; margin-bottom: -1px; border-bottom: 3px solid transparent; color: var(--muted-text); text-decoration: none; font-weight: 550; }
.tab-link.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.no-show-row { grid-template-columns: minmax(0, 1fr) auto; }

button.booth-tile { font: inherit; font-weight: 600; background: #fff; }
.booth-tile.is-selected { box-shadow: 0 0 0 3px rgb(0 0 0 / .18); background: #e8f4ec; }
button.booth-tile:disabled { cursor: not-allowed; opacity: .6; }

/* Compact counselee form */
.edit-fields { gap: .75rem 1rem; }
.edit-fields .field, .edit-fields fieldset { margin: 0; }
.edit-fields legend { margin-bottom: .3rem; }
.edit-fields .helper-text { margin: -.25rem 0 0; font-size: .8rem; }
.choice-compact { gap: .5rem; }
.choice-compact .choice-card { min-height: 42px; padding: .45rem .8rem; }
.edit-layout .form-card { padding: 1.25rem; }

/* Dashboard columns get their own tint */
.dashboard-waiting { --column-tint: #e9eef7; }
.dashboard-assigned { --column-tint: #fdf3df; }
.dashboard-active { --column-tint: #e5f3ea; }
.dashboard-grid > .dashboard-waiting, .dashboard-main > .dashboard-assigned, .dashboard-main > .dashboard-active { background: var(--column-tint); }
.dashboard-waiting { --column-accent: #5b7fc7; }
.dashboard-assigned { --column-accent: #e0a21b; }
.dashboard-active { --column-accent: #2e9e5b; }
.dashboard-grid > .dashboard-waiting, .dashboard-main > .dashboard-assigned, .dashboard-main > .dashboard-active { border-top: 4px solid var(--column-accent); }

/* Start page: three big tiles */
.home-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 1.25rem; max-width: 900px; margin: 4vh auto 0; }
.home-tile { display: grid; place-items: center; min-height: 180px; padding: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 28px; box-shadow: var(--shadow); color: var(--text); font-size: 1.4rem; font-weight: 650; text-align: center; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.home-tile:hover, .home-tile:focus-visible { border-color: var(--primary); box-shadow: 0 8px 22px rgb(32 53 69 / 14%); transform: translateY(-2px); }
@media (max-width: 560px) { .home-tile { min-height: 110px; } }
