/* Banners on the festival change form.
 *
 * Unfold ships a prebuilt Tailwind stylesheet that does not contain every
 * utility. gap-x-4, break-all, font-mono, animate-pulse and the colour
 * variants used here are all absent, so the banner rendered without spacing,
 * border colour or background. These rules carry their own styling instead of
 * depending on classes that may or may not be in that build.
 *
 * Dark mode follows Unfold, which toggles a .dark class on the root element.
 */

.sf-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid;
  border-radius: 8px;
  font-size: 0.875rem;
  line-height: 1.45;
}

/* The outdated-plan and new-registrations banners are toggled with the hidden
   attribute, and display:flex would beat the user-agent rule for it. Unfold's
   build currently carries an !important rule that covers this, but relying on
   that is exactly the kind of assumption this file exists to avoid. */
.sf-banner[hidden] { display: none; }

@keyframes sf-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.sf-banner__action {
  margin-left: auto;
  padding: 0.25rem 0.75rem;
  border: 1px solid currentColor;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.sf-banner__action:hover { background: rgb(0 0 0 / 8%); }
.dark .sf-banner__action:hover { background: rgb(255 255 255 / 12%); }

/* The header's switches take the green of the "Online" pill beside the links
   while what they switch is online, through the state classes on the body. */
body.sf-schedule-on a[href$="/toggle_publish/"],
body.sf-registration-on a[href$="/toggle_registration/"] { color: #22c55e; }

.sf-banner--warn {
  border-color: #fb923c;
  background: rgb(249 115 22 / 10%);
  color: #9a3412;
}
.dark .sf-banner--warn { color: #fdba74; }

.sf-banner--info {
  border-color: #14b8a6;
  background: rgb(20 184 166 / 10%);
  color: #115e59;
}
.dark .sf-banner--info { color: #5eead4; }

.sf-banner__link {
  margin-left: auto;
  font-weight: 600;
  color: inherit;
  text-decoration: underline;
}

/* The generate and clear buttons are moved into the teams tab by the script in
   admin/festival/festival/change_form.html, so they need a strip of their own. */
.sf-team-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

/* The three "is it compulsory" switches, on the line under the registration
   link rather than three rows of their own.

   Unfold gives every field a fixed label column and a full-height row, which is
   right for a form field and wasteful for three related toggles. The row starts
   with an empty read-only field whose label heads it: that label sits in
   Unfold's own column, the same as "Anmeldelink" above, so the switches line up
   with the link. Selected through :has() on the row that contains the first
   switch, so the rule cannot reach any other row, and structurally rather than
   by Tailwind class names, which would break on the next Unfold release. */
.form-row:has(> .field-require_contact_name) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 0.25rem 0.75rem;
}

.form-row:has(> .field-require_contact_name) > .field-line {
  min-height: 0;
  padding: 0.35rem 0;
  border-bottom-width: 0;
  flex: 0 0 auto;
}

/* The heading: label only, the empty value beside it takes no room. Found by
   position, since Unfold gives read-only fields no field-<name> class. */
.form-row:has(> .field-require_contact_name) > .field-line:first-child > div:last-child {
  display: none;
}

/* Below lg Unfold puts every label above its field, and the heading's column
   loses its fixed width, so it would run straight into the first switch. It
   gets a line of its own there, like the labels around it. */
@media (max-width: 1023px) {
  .form-row:has(> .field-require_contact_name) > .field-line:first-child {
    flex-basis: 100%;
  }
}

/* The switches: switch before its label (row-reverse), a gap between them. */
.form-row:has(> .field-require_contact_name) > .field-line[class*="field-require_contact_"] {
  margin-right: 1.5rem;
}

.form-row:has(> .field-require_contact_name) > .field-line[class*="field-require_contact_"] > div {
  flex-direction: row-reverse;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0;
}

/* A switch's own label column: only as wide as its text here. */
.form-row:has(> .field-require_contact_name) > .field-line[class*="field-require_contact_"] > div > div:first-child {
  min-width: 0;
  width: auto;
  margin-left: 0;
  align-items: center;
}

/* Pushes everything after it to the right edge of the strip: the counts belong
   with the teams they count, the two destructive-ish buttons do not. */
.sf-level-counts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1rem;
  margin: 0 auto 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
}

.sf-level-counts > li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  list-style: none;
}

.sf-level-counts > li::marker { content: ""; }
.sf-level-counts__empty { opacity: 0.7; }

.sf-chip {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 0.35em;
  border-radius: 0.3em;
  font-size: 0.75em;
  font-weight: 700;
  line-height: 1.7;
  color: #fff;
  text-align: center;
}

.sf-chip.st-1 { background: #22a35a; }
.sf-chip.st-2 { background: #2f6fd6; }
.sf-chip.st-3 { background: #ea7a1b; }
.sf-chip.st-4 { background: #a855f7; }
.sf-chip.st-5 { background: #dc2626; }
.sf-chip.st-6 { background: #0891b2; }

/* The moved actions are <li>; without this they keep their bullets. */
.sf-team-actions > li {
  list-style: none;
  display: block;
}

.sf-team-actions > li::marker {
  content: "";
}

/* Icons only; the label is the tooltip. 36 inside a 1px border makes 38, the
   height the labelled buttons had and the size of the bins in the rows. */
.sf-team-actions > li > a,
.sf-team-actions > li > button {
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
}

/* The four tabs of a festival, numbered in the order of the work (the script
   in admin/festival/festival/change_form.html adds the numbers). */
.sf-step {
  display: inline-grid;
  place-items: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 999px;
  background: rgb(20 184 166 / 16%);
  color: #0f766e;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}
.dark .sf-step { color: #5eead4; }
/* On a phone the four do not fit on one line, and Unfold would move the last
   into a "more" menu, step 4 out of sight. Two by two instead, and wrapping
   wherever else they would not fit. */
@media (max-width: 767px) {
  .model-festival.change-form #tabs-items { flex-wrap: wrap; }
}
@media (max-width: 519px) {
  .model-festival.change-form #tabs-wrapper > div { width: 100%; }
  .model-festival.change-form #tabs-items {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex: 1 1 auto;
  }
}
/* Planung is not a tab Unfold counts errors on; shaped like its red count. */
.sf-tab-error {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* What to do on a tab, at its top (festival/admin_guide.html): the step's
   number, a heading and a sentence or two, and the button for the next step. */
.sf-guide {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem 0.9rem;
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgb(20 184 166 / 35%);
  border-radius: 8px;
  background: rgb(20 184 166 / 7%);
  font-size: 0.875rem;
  line-height: 1.5;
}
.sf-guide__step {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 999px;
  background: rgb(20 184 166 / 18%);
  color: #0f766e;
  font-size: 0.95rem;
  font-weight: 700;
}
.dark .sf-guide__step { color: #5eead4; }
/* Wide enough for a line of the guide to stay one on a computer, such as
   the first of the teams tab. */
.sf-guide__body { flex: 1 1 16rem; min-width: 0; max-width: 64rem; }
.sf-guide__title { display: block; margin-bottom: 0.1rem; font-size: 0.95rem; font-weight: 600; }
.sf-guide__body p { margin: 0; }
.sf-guide__link { font-weight: 600; text-decoration: underline; }
/* The levels a registration offers, switches in a row like the compulsory
   fields above them, wrapping where the row is narrow. */
#id_levels_offered { flex-wrap: wrap; row-gap: 0.5rem; }
#id_levels_offered label { font-weight: 600; }
/* The guides' buttons: light, in outline, being advice; "Deaktivieren" in
   grey beside the teal of the others. */
.sf-guide__actions {
  display: flex;
  flex-wrap: wrap;
  align-self: center;
  gap: 0.5rem;
  margin-left: auto;
}
.sf-guide__actions:empty { display: none; }
.sf-guide__action {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem;
  border: 1px solid #14b8a6;
  border-radius: 8px;
  background: transparent;
  color: #0f766e;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.dark .sf-guide__action { color: #5eead4; }
.sf-guide__action:hover { background: rgb(20 184 166 / 12%); }
.sf-guide__action .material-symbols-outlined { font-size: 1.2rem; }
.sf-guide__action--quiet { border-color: #9ca3af; color: #4b5563; }
.dark .sf-guide__action--quiet { border-color: #6b7280; color: #d1d5db; }
.sf-guide__action--quiet:hover { background: rgb(156 163 175 / 14%); }
.sf-guide__action.is-done { border-color: #22c55e; color: #22c55e; }

/* The foot of each tab (festival/admin_tab_foot.html) in place of the form's
   bar, in its look: its button bottom right, deleting the festival on the
   left. While the tab is longer than the window it stays at the bottom of
   the window, over the content; under a tab that fits it sits below it. */
.sf-tab-foot {
  position: sticky;
  bottom: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem -1rem 0;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--color-base-200);
  background: rgb(255 255 255 / 85%);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.dark .sf-tab-foot { border-top-color: var(--color-base-800); background: rgb(17 24 39 / 85%); }
.sf-tab-foot__end { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-left: auto; }

.sf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-base-200);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.dark .sf-btn { border-color: var(--color-base-700); background: transparent; }
.sf-btn:hover { background: rgb(128 128 128 / 10%); }
.sf-btn .material-symbols-outlined { font-size: 1.2rem; }
.sf-btn--primary { border-color: transparent; background: #0d9488; color: #fff; font-weight: 600; }
.dark .sf-btn--primary { background: #0d9488; }
.sf-btn--primary:hover { background: #0f766e; }
.sf-btn--danger { border-color: #ef4444; background: transparent; color: #dc2626; }
.dark .sf-btn--danger { border-color: #ef4444; color: #f87171; }
.sf-btn--danger:hover { background: rgb(239 68 68 / 10%); }

/* The import's dialog (change_form.html), in the editor's dialog look: the
   columns as chips, the points as a short list. */
.sf-import .ed-dialog__box > p + p,
.sf-import .ed-dialog__box > ul + p { margin-top: 0.6rem; }
.sf-import__columns { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.sf-import__columns code {
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--ed-line);
  border-radius: 6px;
  font-size: 0.8rem;
}
.sf-import__points { margin: 0.7rem 0 0; padding-left: 1.1rem; list-style: disc; line-height: 1.5; }
.sf-import__points li + li { margin-top: 0.25rem; }
.sf-import .ed-dialog__actions a.ed-btn { text-decoration: none; }

/* Enter in a field saves (change_form.html): a button no one sees or tabs to. */
.sf-default-submit {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* A switch that is a link: before the state of the public page, drawn like
   Unfold's switches (h-5 w-8, knob h-3 w-3), and the page loads again. */
.sf-switch {
  position: relative;
  flex: 0 0 auto;
  display: inline-block;
  width: 2rem;
  height: 1.25rem;
  border-radius: 999px;
  background: #d1d5db;
  cursor: pointer;
}
.dark .sf-switch { background: #4b5563; }
.sf-switch::after {
  content: "";
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 20%);
  transition: left 0.15s ease;
}
.sf-switch.is-on { background: #22c55e; }
.dark .sf-switch.is-on { background: #15803d; }
.sf-switch.is-on::after { left: 1rem; }
@media (prefers-reduced-motion: reduce) { .sf-switch::after { transition: none; } }

/* The link icon behind a line of help, like the one of the Terminliste. */
.sf-inline-tool {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 0.2rem;
  color: #14b8a6;
}
.sf-inline-tool .material-symbols-outlined { font-size: 1rem; }
.sf-inline-tool:hover { color: #0f766e; }
/* While the plan is edited the editor's bar says what to do. */
body:has(#spielplan-group.sf-plan--editing) .sf-guide--plan { display: none; }

/* The strength levels sit in a card of Planung headed "Spielstärken", with a
   line on what they are for (festival/admin_planning_fields.html); the
   inline's own heading would say it a second time. */
#levels-heading { display: none; }

/* The Spielplan tab (festival/admin_schedule_tab.html): a line about the plan,
   the Excel export and recomputing, three buttons of one size, above the
   editor. */
.sf-plan-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1rem;
}
.sf-plan-status { margin: 0 auto 0 0; font-size: 0.875rem; }
.sf-plan-status__warn { color: #d97706; }
/* The note from the computation, in yellow under the head. */
.sf-plan-note {
  margin: -0.25rem 0 1rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid rgba(217, 119, 6, 0.4);
  border-left: 4px solid #d97706;
  border-radius: 0.5rem;
  background: rgba(245, 158, 11, 0.12);
  font-size: 0.875rem;
  line-height: 1.5;
}
/* Recomputing in the head of the Plan tab: as big as "Bearbeiten" and
   "Excel-Export" beside it, drawn in outline in the teal of the others. */
.sf-plan-compute { border-color: #14b8a6; background: transparent; color: #0f766e; font-weight: 600; }
.dark .sf-plan-compute { border-color: #14b8a6; color: #5eead4; }
.sf-plan-compute:hover { background: rgb(20 184 166 / 12%); }

/* A tab with changes "Sichern" has not stored yet (js/unsaved_changes.js).
   Shaped like Unfold's red error count on the same tabs, in amber. */
.sf-unsaved-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  margin-left: 0.25rem;
  border-radius: 999px;
  background: #f59e0b;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* While the plan is edited (js/plan_editor.js sets the class), the editor's
   own bar takes over: the head with its buttons and its note step aside. */
.sf-plan--editing .sf-plan-head,
.sf-plan--editing .sf-plan-note { display: none; }

/* Row numbers in the team list. A counter rather than a value from the server:
   rows added by hand or by the import, and rows deleted on the spot, renumber
   themselves without a reload. Every form is a tbody of its own; the template
   for new rows is not displayed, and what is not displayed does not count. */
#teams-data { counter-reset: sf-team-row; }
#teams-data > tbody.form-group:not(.empty-form) { counter-increment: sf-team-row; }
#teams-data .sf-row-number::before { content: counter(sf-team-row); }
#teams-data .column-row_number,
#teams-data td.field-row_number {
  width: 1%;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
#teams-data td.field-row_number { opacity: 0.6; }

/* Tooltips on the toolbar actions.
 *
 * The native title attribute cannot be styled, wraps badly and appears on the
 * browser's own schedule. This one waits before it shows, so it never gets in
 * the way of someone who knows where they are going, and disappears at once.
 * The delay lives in transition-delay rather than a timer, so nothing has to
 * be cleaned up when the pointer leaves.
 */
[data-tip] {
  position: relative;
}

[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  z-index: 60;
  width: max-content;
  max-width: 22rem;
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  background: #1f2937;
  color: #f9fafb;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  box-shadow: 0 8px 24px rgb(0 0 0 / 35%);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-2px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0s linear 0.12s;
  pointer-events: none;
}

[data-tip]:hover::after,
[data-tip]:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  /* Show only after a deliberate pause; hide immediately. */
  transition-delay: 0.7s, 0.7s, 0s;
}

/* Near the right edge the box would run off screen. */
[data-tip]:last-child::after,
[data-tip].sf-tip-right::after {
  left: auto;
  right: 0;
}

/* Above the button where it sits at the bottom of the window, as "Weiter"
   in the foot of a tab does (festival/admin_tab_foot.html). */
[data-tip].sf-tip-up::after {
  top: auto;
  bottom: calc(100% + 0.5rem);
  transform: translateY(2px);
}

@media (prefers-reduced-motion: reduce) {
  [data-tip]::after { transition: opacity 0.12s ease, visibility 0s linear 0.12s; transform: none; }
  [data-tip]:hover::after,
  [data-tip]:focus-visible::after { transform: none; transition-delay: 0.7s, 0s; }
}

/* Touch has no hover, so a tap would leave the box hanging around. */
@media (hover: none) {
  [data-tip]::after { display: none; }
}

/* Messages as toasts.
 *
 * They used to sit in the flow and push the form down, often repeating what
 * the page already shows right below. Floating keeps the page still; they fade
 * out on their own and can be dismissed.
 */
.sf-toasts {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: min(26rem, calc(100vw - 2rem));
}

.sf-toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  border-left: 3px solid currentColor;
  background: #1f2937;
  color: #e5e7eb;
  font-size: 0.85rem;
  line-height: 1.45;
  box-shadow: 0 10px 30px rgb(0 0 0 / 40%);
  animation: sf-toast-in 0.18s ease both;
}

.sf-toast--success { border-left-color: #22c55e; }
.sf-toast--info { border-left-color: #14b8a6; }
.sf-toast--warning { border-left-color: #fb923c; }
/* An error has to be seen, and it stays until closed: a red ground, not only
   a red edge. */
.sf-toast--error { border-left: 4px solid #ef4444; background: #4a1d24; color: #fde8e8; }

.sf-toast__text { overflow-wrap: anywhere; }
.sf-toast__title { display: block; margin-bottom: 0.15rem; font-weight: 700; }
.sf-toast__actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.55rem; }
.sf-toast__action {
  padding: 0.2rem 0.7rem;
  border: 1px solid currentColor;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.sf-toast__action:hover { background: rgb(255 255 255 / 10%); }
.sf-toast__action--primary { border-color: #14b8a6; background: #0f766e; color: #fff; }
.sf-toast__action--primary:hover { background: #115e59; }

.sf-toast__close {
  margin-left: auto;
  border: 0;
  background: none;
  color: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
}

.sf-toast__close:hover { opacity: 1; }

.sf-toast.is-going { animation: sf-toast-out 0.25s ease both; }

@keyframes sf-toast-in {
  from { opacity: 0; transform: translateX(0.75rem); }
  to { opacity: 1; transform: none; }
}

@keyframes sf-toast-out {
  to { opacity: 0; transform: translateX(0.75rem); }
}

@media (prefers-reduced-motion: reduce) {
  .sf-toast, .sf-toast.is-going { animation: none; }
}

/* Delete icon in the festival list. Muted until pointed at, so a whole column
   of red does not read as a warning. */
.sf-row-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  color: #9ca3af;
}

.sf-row-delete:hover {
  background: rgb(239 68 68 / 12%);
  color: #ef4444;
}

.sf-row-delete .material-symbols-outlined { font-size: 1.1rem; }

/* A link with its state in front and its tools behind: copy, and for the
   public link the pencil (changing it is rare, so it gets no field of its
   own). The address is whole, host included, and may wrap anywhere: it has no
   spaces to break at. */
.sf-link-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.6rem; }

.sf-link {
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
  text-decoration: underline;
}

.sf-link-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: #9ca3af;
  cursor: pointer;
}

.sf-link-tool:hover { background: rgb(20 184 166 / 14%); color: #14b8a6; }
.sf-link-tool .material-symbols-outlined { font-size: 1rem; }
.sf-link-tool.is-done { color: #22c55e; }

/* Explanation on one line, the link and its state on the next.
 *
 * Together on a single line the link broke mid-token and the state sat buried
 * in the middle of a sentence, which is exactly where it must not be.
 */
.sf-stacked { display: flex; flex-direction: column; gap: 0.45rem; }
.sf-stacked__note { font-size: 0.8rem; line-height: 1.5; color: #9ca3af; }
.sf-state {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.sf-state__dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: currentColor; }
.sf-state--on { color: #22c55e; }
.sf-state--on .sf-state__dot { animation: sf-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.sf-state--off { color: #9ca3af; }

@media (prefers-reduced-motion: reduce) {
  .sf-state--on .sf-state__dot { animation: none; }
}

/* ----- phones and small tablets ---------------------------------------------

   The team list as one card per team below Unfold's lg breakpoint, where it
   hides the column headings anyway and the table ran off the screen with
   eight columns and no heading to say what an empty field was for. Every form
   is a tbody of its own; its first row only holds hidden inputs. The labels
   are here because the headings they replace are gone at this width. Three
   lines a team, two fields to a line: the name alone on the first, where it
   shared the width with the strength and neither could be read ("HSG
   Hammerw…"), then strength and contact person, then phone and e-mail. The
   dash of a team put in by hand is left out, it stood alone under every
   such team. */
@media (max-width: 1023px) {
  #teams-data,
  #teams-data > tbody.form-group:not(.empty-form) { display: block; width: 100%; }
  #teams-data > tbody.form-group:not(.empty-form) > tr:not(.form-row) { display: none; }
  #teams-data > tbody.form-group:not(.empty-form) > tr.form-row {
    display: grid;
    grid-template-columns: 1.6rem minmax(0, 1fr) minmax(0, 1fr) 2.4rem;
    gap: 0.5rem;
    align-items: end;
    padding: 0.75rem 0.75rem 0.9rem;
    border-bottom: 1px solid var(--color-base-200);
  }
  .dark #teams-data > tbody.form-group:not(.empty-form) > tr.form-row { border-bottom-color: var(--color-base-800); }
  #teams-data tr.form-row > td {
    display: block;
    min-height: 0;
    padding: 0 !important;
    border: 0 !important;
  }
  #teams-data tr.form-row > td.field-row_number { grid-column: 1; grid-row: 1; align-self: center; text-align: left; }
  #teams-data tr.form-row > td.field-name { grid-column: 2 / 4; grid-row: 1; }
  #teams-data tr.form-row > td.field-delete_now { grid-column: 4; grid-row: 1; }
  #teams-data tr.form-row > td.field-strength { grid-column: 2; grid-row: 2; }
  #teams-data tr.form-row > td.field-contact_name { grid-column: 3 / 5; grid-row: 2; }
  #teams-data tr.form-row > td.field-contact_phone { grid-column: 2; grid-row: 3; }
  #teams-data tr.form-row > td.field-contact_email { grid-column: 3 / 5; grid-row: 3; }
  #teams-data tr.form-row > td.field-registered { grid-column: 2 / 5; grid-row: 4; font-size: 0.75rem; opacity: 0.7; }
  #teams-data tr.form-row > td.field-name::before,
  #teams-data tr.form-row > td.field-strength::before,
  #teams-data tr.form-row > td.field-contact_name::before,
  #teams-data tr.form-row > td.field-contact_email::before,
  #teams-data tr.form-row > td.field-contact_phone::before {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0.65;
  }
  #teams-data tr.form-row > td.field-name::before { content: "Mannschaft"; }
  #teams-data tr.form-row > td.field-strength::before { content: "Spielstärke"; }
  #teams-data tr.form-row > td.field-contact_name::before { content: "Ansprechpartner"; }
  #teams-data tr.form-row > td.field-contact_email::before { content: "E-Mail"; }
  #teams-data tr.form-row > td.field-contact_phone::before { content: "Telefon"; }
  #teams-data tr.form-row > td.field-registered:empty,
  #teams-data tr.form-row > td.field-registered:has(> div:only-child:empty),
  #teams-data tr.form-row > td.field-registered:has(.sf-by-hand) { display: none; }
}

/* The strength levels the same way, below the same breakpoint: without
   their column heads the four inputs of a level had nothing to say which was
   the rank and which the badge. Label, badge and bin on top, the public name
   and the rank below. The row that says "Wird beim Sichern gelöscht" stays
   as it is: it covers the card from its own place. */
@media (max-width: 1023px) {
  #levels-data,
  #levels-data > tbody.form-group:not(.empty-form) { display: block; width: 100%; }
  #levels-data > tbody.form-group:not(.empty-form) > tr:not(.form-row):not(.form-delete) { display: none; }
  #levels-data > tbody.form-group:not(.empty-form) > tr.form-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 4.5rem 2.6rem;
    gap: 0.5rem 0.6rem;
    align-items: end;
    padding: 0.75rem 0.75rem 0.9rem;
    border-bottom: 1px solid var(--color-base-200);
  }
  .dark #levels-data > tbody.form-group:not(.empty-form) > tr.form-row { border-bottom-color: var(--color-base-800); }
  #levels-data tr.form-row > td {
    display: block;
    min-height: 0;
    padding: 0 !important;
    border: 0 !important;
  }
  #levels-data tr.form-row > td.field-label { grid-column: 1; grid-row: 1; }
  #levels-data tr.form-row > td.field-short { grid-column: 2; grid-row: 1; }
  #levels-data tr.form-row > td.delete { grid-column: 3; grid-row: 1; }
  #levels-data tr.form-row > td.field-alias { grid-column: 1; grid-row: 2; }
  #levels-data tr.form-row > td.field-rank { grid-column: 2; grid-row: 2; }
  #levels-data tr.form-row > td.field-label::before,
  #levels-data tr.form-row > td.field-short::before,
  #levels-data tr.form-row > td.field-alias::before,
  #levels-data tr.form-row > td.field-rank::before {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0.65;
  }
  #levels-data tr.form-row > td.field-label::before { content: "Bezeichnung (intern)"; }
  #levels-data tr.form-row > td.field-short::before { content: "Kürzel"; }
  #levels-data tr.form-row > td.field-alias::before { content: "Anzeige im Spielplan"; }
  #levels-data tr.form-row > td.field-rank::before { content: "Rang"; }
}

/* On a wider phone e-mail and phone share a line. */
@media (min-width: 480px) and (max-width: 1023px) {
  #teams-data tr.form-row > td.field-contact_email { grid-column: 2 / 3; }
  #teams-data tr.form-row > td.field-contact_phone { grid-column: 3 / 5; }
}

/* The festival list on a phone: a card per festival instead of nine
   columns running off the screen, with the date broken over two lines and
   the name over two more. Name and bin on top, date and hall time below,
   then teams and the three states, named here because the column heads are
   hidden. The two empty pseudo-elements of the row are the line breaks of
   its flex layout; order puts everything in its line. */
@media (max-width: 767px) {
  .model-festival.change-list #result_list thead { display: none; }
  .model-festival.change-list #result_list,
  .model-festival.change-list #result_list > tbody { display: block; width: 100%; }
  .model-festival.change-list #result_list tr.data-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem 0.5rem;
    padding: 0.75rem 0.9rem;
    border-top: 1px solid var(--color-base-200);
  }
  .dark .model-festival.change-list #result_list tr.data-row { border-top-color: var(--color-base-800); }
  .model-festival.change-list #result_list > tbody:first-of-type tr.data-row { border-top: 0; }
  .model-festival.change-list #result_list tr.data-row > th,
  .model-festival.change-list #result_list tr.data-row > td {
    display: block;
    /* Unfold gives every cell a fixed height, which made each line 45px. */
    height: auto !important;
    min-height: 0;
    padding: 0 !important;
    border: 0 !important;
    white-space: nowrap;
  }
  .model-festival.change-list #result_list tr.data-row::before,
  .model-festival.change-list #result_list tr.data-row::after {
    content: "";
    flex-basis: 100%;
    height: 0;
  }
  .model-festival.change-list #result_list tr.data-row > .field-name {
    order: 1;
    flex: 1 1 0;
    min-width: 0;
    white-space: normal;
    font-size: 1rem;
    font-weight: 600;
  }
  /* The whole card opens the festival, the bin stays its own target. */
  .model-festival.change-list #result_list tr.data-row { position: relative; }
  .model-festival.change-list #result_list tr.data-row > .field-name a::after { content: ""; position: absolute; inset: 0; }
  .model-festival.change-list #result_list tr.data-row > .field-delete_link { order: 2; position: relative; z-index: 1; }
  .model-festival.change-list #result_list tr.data-row::before { order: 3; }
  .model-festival.change-list #result_list tr.data-row > .field-date { order: 4; }
  .model-festival.change-list #result_list tr.data-row > .field-hall_time { order: 5; }
  .model-festival.change-list #result_list tr.data-row > .field-hall_time::before { content: "· "; opacity: 0.6; }
  .model-festival.change-list #result_list tr.data-row::after { order: 6; }
  .model-festival.change-list #result_list tr.data-row > .field-team_count { order: 7; }
  .model-festival.change-list #result_list tr.data-row > .field-team_count::after { content: " Mannschaften"; }
  .model-festival.change-list #result_list tr.data-row > .field-registration_badge { order: 8; }
  .model-festival.change-list #result_list tr.data-row > .field-registration_badge::before { content: "Anmeldung "; font-size: 0.75rem; opacity: 0.7; }
  .model-festival.change-list #result_list tr.data-row > .field-plan_badge { order: 9; }
  .model-festival.change-list #result_list tr.data-row > .field-plan_badge::before { content: "Plan "; font-size: 0.75rem; opacity: 0.7; }
  .model-festival.change-list #result_list tr.data-row > .field-status_badge { order: 10; }
  .model-festival.change-list #result_list tr.data-row > .field-owner { order: 11; font-size: 0.8rem; opacity: 0.7; }
  .model-festival.change-list #result_list tr.data-row > .field-owner::before { content: "von "; }
}

/* Shown on phones only, once: on the welcome a new organiser sees first
   (festival/admin_welcome.html), not again in every tab. */
.sf-mobile-note { display: none; }
@media (max-width: 767px) {
  /* The level counts one per line: wrapped side by side they came out as two,
     then one, then one. */
  .sf-level-counts { flex-direction: column; align-items: flex-start; gap: 0.3rem; }
  .sf-mobile-note {
    display: block;
    max-width: 42rem;
    margin: 0 auto 2rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid rgb(217 119 6 / 50%);
    border-radius: 8px;
    background: rgb(217 119 6 / 10%);
    font-size: 0.95rem;
    line-height: 1.5;
  }
}

/* Welcome in place of the empty festival list (festival/admin_welcome.html).
   The first page a new organiser sees, so it is set larger than the admin's
   14px body text. Sizes and the numbered badges live here: list-decimal and
   most of the larger text utilities are not in Unfold's build. */
.sf-welcome {
  padding: 4rem 2rem;
  font-size: 1rem;
}

.sf-welcome__icon {
  width: 7.5rem;
  height: 7.5rem;
  margin-bottom: 2rem;
}

.sf-welcome__icon .material-symbols-outlined { font-size: 4rem; }

.sf-welcome__title {
  margin-bottom: 0.5rem;
  font-size: 2rem;
  line-height: 1.2;
  text-align: center;
}

/* The name must not split at its hyphen: "Mini-" alone on a line reads wrong. */
.sf-welcome__brand { white-space: nowrap; }

.sf-welcome__lead {
  max-width: 40rem;
  margin-bottom: 2.25rem;
  font-size: 1.125rem;
  line-height: 1.5;
  text-align: center;
}

.sf-welcome__steps {
  counter-reset: sf-step;
  display: grid;
  gap: 1.25rem;
  max-width: 42rem;
  margin: 0 auto 2.5rem;
  padding: 0;
  list-style: none;
  font-size: 1.0625rem;
  line-height: 1.55;
}

.sf-welcome__steps li {
  counter-increment: sf-step;
  position: relative;
  padding-left: 3rem;
}

.sf-welcome__steps li::before {
  content: counter(sf-step);
  position: absolute;
  top: -0.1rem;
  left: 0;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background: rgb(20 184 166 / 15%);
  color: #0f766e;
  font-size: 1rem;
  font-weight: 600;
}

.dark .sf-welcome__steps li::before { color: #5eead4; }

.sf-welcome__button {
  min-height: 3rem;
  padding: 0.5rem 1.5rem;
  font-size: 1.0625rem;
}

@media (max-width: 640px) {
  .sf-welcome { padding: 2.5rem 1.25rem; }
  .sf-welcome__icon { width: 6rem; height: 6rem; margin-bottom: 1.5rem; }
  .sf-welcome__icon .material-symbols-outlined { font-size: 3.25rem; }
  .sf-welcome__title { font-size: 1.625rem; }
}

/* Mein Konto (admin/account.html): the facts beside their labels, the three
   dialogs below. Own rules again, grid and gap sizes being among what
   Unfold's build does not reliably carry. */
.sf-account { max-width: 42rem; }

.sf-account__facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.6rem 2rem;
  margin: 0;
  padding: 1.25rem 1.5rem;
  font-size: 0.9375rem;
}

.sf-account__facts dt { opacity: 0.65; }
.sf-account__facts dd { margin: 0; overflow-wrap: anywhere; }

.sf-account__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
}

/* The news switch is a form of its own; its button lines up with the others. */
.sf-account__actions form { display: contents; }
.sf-account__hint { display: block; margin-top: 0.2rem; font-size: 0.8125rem; opacity: 0.65; }

/* Deleting stands apart from the changes: what goes with the account on the
   left, the button on the right. */
.sf-account__delete {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 1rem 1.5rem;
}

.sf-account__delete p { margin: 0; font-size: 0.875rem; opacity: 0.65; }

@media (max-width: 640px) {
  /* Each label above its value: beside it, the values got a third of the
     width and the date broke in two. */
  .sf-account__facts { grid-template-columns: 1fr; gap: 0; padding: 1rem; }
  .sf-account__facts dt { margin-top: 0.8rem; font-size: 0.8125rem; }
  .sf-account__facts dt:first-child { margin-top: 0; }
  .sf-account__actions, .sf-account__delete { padding: 1rem; }
  /* One button per line and full width, as in Unfold's own button rows. */
  .sf-account__actions button, .sf-account__delete button { flex: 1 1 100%; }
}
