/* Colors follow the GutscheinGeniessen corporate design (lib/theme.dart in em-marketing-gmbh/gutscheingeniessen). */
:root {
  --petrol: #237384;
  --petrol-dark: #1c5f6d;
  --petrol-light: #569fae;
  --petrol-lighter: #b5d2da;
  --petrol-tint: #e6f0f3;
  --brand-red: #d51317;

  --bg: #fafafa;
  --card: #fff;
  --text: #1f2627;
  --muted: #5e6566;
  --border: #dbe3e5;          /* decorative lines (cards, table rows) */
  --control-border: #4f8f9c;  /* form controls and buttons: >= 3:1 against white (WCAG 1.4.11) */
  --primary: var(--petrol);
  --primary-hover: var(--petrol-dark);
  --danger: var(--brand-red);
  --ok-bg: var(--petrol-tint);
  --ok-text: var(--petrol-dark);
  --err-bg: #fdecec;
  --err-text: #a10f12;

  /* Category colors from the app (lib/models/tags.dart) */
  --cat-shopping: #00355f;
  --cat-leisure: #757474;
  --cat-enjoyment: #32842a;  /* app: #3fa535, darkened for contrast */
  --cat-gastronomy: #aa6213; /* app: #e9963a, darkened for contrast */
}

/* Brand font as used in the app (licensed). */
@font-face { font-family: "Gisha"; src: url("fonts/gisha.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Gisha"; src: url("fonts/gisha-bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

* { box-sizing: border-box; }

/* Base size: 14px for this dense work UI on large screens (common for admin tools);
   16px on small screens, where iOS would otherwise zoom into form fields. All other
   sizes are in rem and scale with it. */
html { font-size: 14px; }
@media (max-width: 900px) { html { font-size: 16px; } }

body {
  margin: 0;
  font: 1rem/1.5 "Gisha", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--primary-hover); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--petrol); outline-offset: 2px; border-radius: 2px;
}
main:focus { outline: none; }

main { padding: 24px 32px 48px; min-width: 0; }
body > main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; } /* pages without navigation (login) */
h1 { font-size: 1.5rem; margin: 0 0 16px; }

/* Visually hidden, but read by screen readers. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 1000; padding: 8px 14px; border-radius: 8px;
  background: #fff; color: var(--petrol-dark); font-weight: 700; box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}
.skip-link:focus { top: 8px; }

/* --- App layout: navigation on the left, content uses the full remaining width --- */
:root { --sidebar-width: 232px; --sidebar-collapsed: 64px; --nav-w: var(--sidebar-width); }
.nav-collapsed { --nav-w: var(--sidebar-collapsed); }
.app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.nav-collapsed .app { grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr); }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Sticky to the top and left: the navigation stays in place when the page scrolls sideways. */
.sidebar {
  position: sticky; top: 0; left: 0; z-index: 10; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  background: var(--petrol); color: #fff;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px; }
.sidebar-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; color: #fff; }
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand img { display: block; height: 56px; width: auto; }
.sidebar .nav-close { display: none; }

/* Menu items span the full width of the navigation. */
.nav-list { list-style: none; margin: 8px 0; padding: 0; }
.nav-list a, .nav-list button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 2.85rem; padding: 8px 20px;
  border: 0; border-radius: 0; background: none; color: #fff; font: inherit; text-align: left; cursor: pointer;
}
.nav-list a:hover, .nav-list button:hover { background: rgba(255, 255, 255, .08); text-decoration: none; }
/* Active item: darker petrol band across the full width (white text 7.2:1). */
.nav-list a[aria-current="page"] { background: var(--petrol-dark); font-weight: 700; }
.sidebar :focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.nav-list form { margin: 0; }
/* Group heading in the sidebar (e.g. "Stammdaten"); a divider line when collapsed. */
.nav-heading {
  margin: 16px 20px 4px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .25);
  font-size: 0.79rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #fff;
}
.nav-collapsed .nav-heading { margin: 12px 12px 4px; padding-top: 0; }

.nav-user { margin-top: auto; padding: 8px 0 12px; border-top: 1px solid rgba(255, 255, 255, .25); }
.user-info { display: flex; flex-direction: column; margin: 8px 20px 0; line-height: 1.3; }
.user-name { font-weight: 700; overflow-wrap: anywhere; }
.user-role { font-size: 0.93rem; }
.collapse-toggle {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 2.6rem; margin: 4px 0 0; padding: 8px 20px;
  border: 0; border-radius: 0; background: none; color: #fff; font: inherit; font-size: 0.93rem; cursor: pointer;
}
.collapse-toggle:hover { background: rgba(255, 255, 255, .08); }
/* Small secondary link at the very bottom of the sidebar. */
.nav-hint {
  display: inline-block; margin: 6px 20px 0; padding: 4px 0; min-height: 24px;
  color: #fff; font-size: 0.79rem; text-decoration: underline; text-underline-offset: 2px; opacity: .9;
}
.nav-hint:hover { opacity: 1; }
.nav-collapsed .nav-hint { display: none; }

/* Collapsed: icons only; labels stay available to screen readers. */
.nav-collapsed .sidebar .nav-label {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap;
}
.nav-collapsed .sidebar-head { padding: 16px 8px 8px; justify-content: center; }
.nav-collapsed .sidebar-brand img { height: auto; width: 44px; }
.nav-collapsed .nav-list a, .nav-collapsed .nav-list button { justify-content: center; padding: 8px; }
.nav-collapsed .collapse-toggle { justify-content: center; }
.nav-collapsed .collapse-toggle .icon { transform: rotate(180deg); }

.mobile-bar { display: none; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border: 0; border-radius: 8px; background: none; color: inherit; cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, .12); }
.icon-btn .icon { width: 24px; height: 24px; }

/* Small screens: navigation becomes an off-canvas menu. */
@media (max-width: 900px) {
  .app, .nav-collapsed .app { grid-template-columns: minmax(0, 1fr); }
  .mobile-bar {
    display: flex; align-items: center; gap: 8px; position: sticky; top: 0; left: 0; z-index: 20;
    padding: 6px 12px; background: var(--petrol); color: #fff;
  }
  .mobile-bar :focus-visible { outline: 2px solid #fff; }
  .mobile-brand img { display: block; height: 40px; width: auto; }
  .sidebar {
    position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: min(300px, 85vw); height: auto;
    transform: translateX(-100%); transition: transform .2s ease; visibility: hidden;
  }
  .nav-open .sidebar { transform: none; visibility: visible; }
  .sidebar .nav-close { display: inline-flex; }
  .collapse-toggle { display: none; }
  /* The collapsed state only applies on wide screens. */
  .nav-collapsed .sidebar .nav-label { position: static; width: auto; height: auto; clip: auto; }
  .nav-collapsed .sidebar-brand img { width: auto; height: 48px; }
  .nav-collapsed .nav-list a, .nav-collapsed .nav-list button { justify-content: flex-start; padding: 8px 20px; }
  .nav-collapsed .sidebar-head { justify-content: space-between; padding: 16px 16px 8px; }
  .nav-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .4); }
  main { padding: 16px 16px 40px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* --- Page header --- */
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 24px; box-shadow: 0 2px 4px rgba(0, 0, 0, .06); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 2.6rem;
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--control-border);
  background: var(--card); color: var(--text); font: inherit; line-height: 1.2; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--petrol-tint); text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--petrol); outline-offset: 2px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--err-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { min-height: 2.3rem; padding: 4px 10px; font-size: 0.93rem; } /* >= 24px target size (WCAG 2.5.8) */
.btn.block { width: 100%; }
form.inline { display: inline; margin: 0; }

input, select, textarea {
  width: 100%; min-height: 2.6rem; padding: 8px 10px; border: 1px solid var(--control-border); border-radius: 8px;
  font: inherit; background: #fff; color: var(--text);
}
textarea { font-family: ui-monospace, Menlo, monospace; font-size: 0.93rem; }
::placeholder { color: #6b7375; opacity: 1; }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--petrol-lighter); outline-offset: 0; border-color: var(--petrol); }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--petrol); }
[aria-invalid="true"] { border-color: var(--brand-red); border-width: 2px; }

/* Form field: label, control, optional hint and error message. */
.field { margin-bottom: 16px; }
.field label, .field .label { display: block; font-weight: 700; margin-bottom: 4px; }
.check input[type=radio] { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--petrol); }
.checks .check label { display: inline; font-weight: 400; margin: 0; }
.hint { margin: 4px 0 0; color: var(--muted); font-size: 0.93rem; }
.field-error { margin: 4px 0 0; color: var(--err-text); font-size: 0.93rem; font-weight: 700; }
.field-error::before { content: "⚠ "; }
.req { color: var(--brand-red); font-weight: 700; }

.muted { color: var(--muted); }
.small { font-size: 0.86rem; font-weight: 400; }
.center { text-align: center; }

.flash, .notice {
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
  background: var(--ok-bg); color: var(--ok-text); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border-left: 4px solid var(--petrol);
}
.notice { background: #fff8e6; color: #5c4200; border-left-color: var(--cat-gastronomy); }
.alert { background: var(--err-bg); color: var(--err-text); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border-left: 4px solid var(--brand-red); }
.alert ul { margin: 0; padding-left: 18px; }
.error-summary h2 { font-size: 1rem; margin: 0 0 6px; }
.error-summary a { color: var(--err-text); text-decoration: underline; font-weight: 700; }

.login { max-width: 360px; margin: 10vh auto 0; border-top: 4px solid var(--petrol); }
.login-logo { display: block; width: 200px; height: auto; margin: 0 auto 20px; }

.filters { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: flex-end; margin-bottom: 4px; }
.filters .field { flex: 1 1 260px; margin-bottom: 12px; }
.filters .field + .field { flex: 0 1 240px; }
.filter-buttons { display: flex; gap: 8px; margin-bottom: 12px; }
.result-count { margin: 0; }
.list-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin: 0 0 12px; }
.per-page { display: flex; align-items: center; gap: 8px; }
.per-page label { font-weight: 400; color: var(--muted); }
.per-page select { width: auto; min-height: 2.3rem; padding: 4px 8px; }

.pagination { margin: 16px 0 8px; }
.pagination ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 2.6rem; min-height: 2.6rem; padding: 0 10px;
  border-radius: 8px; color: var(--petrol-dark); font-weight: 700;
}
.pagination a { border: 1px solid transparent; }
.pagination a:hover { background: var(--petrol-tint); text-decoration: none; }
.pagination a[aria-current="page"] { background: var(--petrol); color: #fff; }
.pagination .disabled { color: var(--muted); font-weight: 400; }
.pagination .gap { min-width: 24px; color: var(--muted); }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.86rem; font-weight: 700; white-space: nowrap; }
.badge.ok { background: #e3f3e1; color: #1f5c1a; }
.badge.off { background: #ececec; color: #4a4a4a; }
.badge.info { background: var(--petrol-tint); color: var(--petrol-dark); }
/* Participant status workflow: offen -> freigabe -> aktiv -> inaktiv. */
.badge.status-offen { background: #fff1d6; color: #6b4300; }
.badge.status-freigabe { background: #e1ecf7; color: #00355f; }
.badge.status-aktiv { background: #e3f3e1; color: #1f5c1a; }
.badge.status-inaktiv { background: #ececec; color: #4a4a4a; }

/* All scrolling is left to the browser: a table wider than the screen widens the page.
   The logo and name columns then stay next to the navigation, the actions at the right edge. */
.table-wrap {
  width: max-content; min-width: 100%;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 2px 4px rgba(0, 0, 0, .06);
}
table.list { width: 100%; border-collapse: separate; border-spacing: 0; }
table.list .col-logo { position: sticky; left: var(--nav-w); z-index: 1; background: var(--card); width: 68px; min-width: 68px; }
table.list .col-name { position: sticky; left: var(--nav-w); z-index: 1; background: var(--card); min-width: 220px; }
table.list.has-logo .col-name { left: calc(var(--nav-w) + 68px); }
/* Participant number as first sticky column; logo and name move right by its width. */
table.list .col-num { position: sticky; left: var(--nav-w); z-index: 1; background: var(--card); width: 64px; min-width: 64px; box-sizing: border-box; }
table.list.has-num .col-logo { left: calc(var(--nav-w) + 64px); }
table.list.has-num.has-logo .col-name { left: calc(var(--nav-w) + 64px + 68px); }
table.list thead .col-num { z-index: 3; background: var(--petrol-tint); }
table.list tbody tr:hover .col-num { background: #f4f8f9; }
/* Row actions stay visible on the right while scrolling horizontally. */
table.list .actions { position: sticky; right: 0; z-index: 1; background: var(--card); }
table.list thead .col-logo, table.list thead .col-name, table.list thead .actions { z-index: 3; background: var(--petrol-tint); }
table.list tbody tr:hover .col-logo, table.list tbody tr:hover .col-name, table.list tbody tr:hover .actions { background: #f4f8f9; }
table.list tbody th { font-weight: 400; text-align: left; }
table.list th, table.list td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.list th { font-size: 0.93rem; color: var(--petrol-dark); font-weight: 700; background: var(--petrol-tint); white-space: nowrap; }
table.list th a.sort { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; color: inherit; }
table.list th .sort-icon { font-size: 0.8rem; opacity: .6; }
table.list th[aria-sort] .sort-icon { opacity: 1; }
table.list td.empty { padding: 32px 12px; text-align: center; color: var(--muted); }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr:hover { background: #f4f8f9; }
table.list tbody tr:has(.col-name a.name) { cursor: pointer; } /* row click opens the edit page */
table.list .num { text-align: right; }
table.list .name { font-weight: 700; color: var(--text); }
/* Links in table cells get at least 24px height (WCAG 2.5.8 target size). */
table.list .col-name a { display: inline-block; min-height: 24px; line-height: 24px; }
table.list .col-name { max-width: 360px; overflow-wrap: anywhere; }
table.list .col-name a { max-width: 320px; }
table.list a.name:hover { color: var(--primary-hover); }
table.list td.col-logo img { display: block; width: 44px; height: 44px; object-fit: contain; border-radius: 6px; background: #fff; border: 1px solid var(--border); }
/* As narrow as the icons, so they follow the last column directly. */
table.list .actions { width: 1%; white-space: nowrap; }
table.list .actions form { display: inline; }

/* Icon actions in table rows. The tooltip appears to the left, inside the row, so neither
   the table header nor the window edge can cover it. */
.icon-action {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: 1px solid transparent; border-radius: 8px;
  background: none; color: var(--petrol-dark); cursor: pointer; vertical-align: middle;
}
.icon-action:hover { background: var(--petrol-tint); border-color: var(--petrol-lighter); }
.icon-action.danger { color: var(--danger); }
.icon-action.danger:hover { background: var(--err-bg); border-color: #f0b9ba; }
.page-actions .btn .icon { width: 18px; height: 18px; margin-right: 6px; }
.icon-action .icon { width: 20px; height: 20px; }
.icon-action::after {
  content: attr(data-tooltip); position: absolute; right: calc(100% + 6px); top: 50%; transform: translateY(-50%);
  padding: 4px 8px; border-radius: 6px; background: var(--text); color: #fff; font-size: 0.86rem; font-weight: 400;
  white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .1s; z-index: 5;
}
.icon-action:hover::after, .icon-action:focus-visible::after { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .icon-action::after { transition: none; } }

/* Category badges as in the app: category colour, white bold text, white pictogram.
   Green and orange are darker than in the app so white text reaches 4.5:1 (WCAG AA). */
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; margin: 1px 4px 1px 0;
  border-radius: 8px; background: var(--tag-bg, var(--petrol)); color: #fff;
  font-size: 0.86rem; font-weight: 700; line-height: 1.3; white-space: nowrap;
}
.coupon-tag { --tag-bg: var(--brand-red); }
.tag .icon { width: 14px; height: 14px; }
.tag img { display: block; width: 14px; height: 14px; object-fit: contain; flex: none; }
.tag[data-cat="Einkaufen"] { --tag-bg: var(--cat-shopping); }
.tag[data-cat="Freizeit und Erholen"] { --tag-bg: var(--cat-leisure); }
.tag[data-cat="Geniessen und Mehr"] { --tag-bg: var(--cat-enjoyment); }
.tag[data-cat="Gastronomie"] { --tag-bg: var(--cat-gastronomy); }

.form { max-width: 820px; }
.form.narrow { max-width: 480px; }
.form.wide { max-width: 960px; }
.grid.address { grid-template-columns: 9rem 1fr; }
.grid.address .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .grid.address { grid-template-columns: 1fr; } }
textarea.notes { font-family: inherit; font-size: inherit; min-height: 14rem; resize: vertical; }
.linked { margin: 0 0 12px; }
.h1-sub { font-size: 1rem; font-weight: 400; }
textarea.notes.short { min-height: 0; }

/* Coupons (Gutscheine) */
/* Coupons stacked so the time editor has room for one line per time span. */
.coupon-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.coupon .coupon-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.coupon .coupon-fields .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .coupon .coupon-fields { grid-template-columns: 1fr; } }
.coupon { border-radius: 8px; padding: 12px 16px; background: #f4f8f9; min-width: 0; }
.coupon-title { font-size: 1rem; margin: 0 0 12px; color: var(--petrol-dark); }
.times-field.invalid { border-left: 3px solid var(--brand-red); padding-left: 8px; }
.times-summary { margin: 4px 0 0; padding-left: 18px; }
.times-days { margin-top: 8px; border-top: 1px solid var(--border); }
.times-day { display: grid; grid-template-columns: 6.5rem 1fr auto; gap: 8px; align-items: start; padding: 6px 0; border-bottom: 1px solid var(--border); }
.times-day-name { font-weight: 700; line-height: 2.3rem; }
.times-ranges { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.times-ranges > .muted { line-height: 2.3rem; }
.times-range { display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; }
@media (max-width: 640px) { .times-range { flex-wrap: wrap; } }
.times-range input.time { width: 4.6rem; min-height: 2.3rem; padding: 4px 6px; }
.times-range input.quota { width: 4.6rem; min-height: 2.3rem; padding: 4px 6px; }
.times-range .icon-action { width: 32px; height: 32px; font-size: 1.2rem; }
.times-actions { padding-top: 8px; }
@media (max-width: 640px) { .times-day { grid-template-columns: 1fr; } }
.token-once { display: block; }
.table-wrap + .card { margin-top: 24px; }
.token-once .password-input { margin-top: 8px; max-width: 720px; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 0.93em; background: var(--petrol-tint); padding: 1px 4px; border-radius: 4px; }
.card.related { margin-top: 16px; }
.related-list { margin: 0; padding-left: 20px; }
.related-list li { margin-bottom: 4px; }
.related-list a { display: inline-block; min-height: 24px; line-height: 24px; }
.coupons-cell { font-size: 0.93rem; white-space: nowrap; }
.cell-link { display: inline-block; min-height: 24px; line-height: 24px; }
.card.form + .card.form { margin-top: 16px; }
.card-title { font-size: 1.1rem; margin: 0 0 16px; color: var(--petrol-dark); }
.password-input { display: flex; flex-wrap: wrap; gap: 8px; }
.password-input input { flex: 1 1 260px; width: auto; font-family: ui-monospace, Menlo, monospace; }
.password-actions { display: flex; gap: 8px; }
.password-actions[hidden] { display: none; }
.password-status:empty { display: none; }
input[readonly] { background: #f3f5f5; color: var(--muted); }
dl.meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; max-width: 820px; margin: 16px 0 0; color: var(--muted); font-size: 0.93rem; }
dl.meta dt { font-weight: 700; }
dl.meta dd { margin: 0; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }
/* Form sections: a thin divider and a heading instead of nested boxes. */
fieldset { border: 0; border-top: 1px solid var(--border); padding: 20px 0 4px; margin: 0 0 8px; min-width: 0; }
.form > fieldset:first-of-type, .form > .pform-cols fieldset:first-child { border-top: 0; padding-top: 0; }
legend { float: left; width: 100%; padding: 0; margin: 0 0 12px; font-weight: 700; font-size: 1.05rem; color: var(--petrol-dark); }
legend + * { clear: both; }
fieldset.invalid { border-left: 3px solid var(--brand-red); padding-left: 14px; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 24px; margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 8px; min-height: 2.3rem; }
.check label { font-weight: 400; cursor: pointer; }
.preview { display: block; margin-top: 8px; max-height: 140px; max-width: 100%; border-radius: 6px; border: 1px solid var(--border); }
.preview.logo { max-height: 80px; }

/* Postal code and city share one grid cell; the postal code field is narrow. */
.field-pair { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); column-gap: 12px; align-items: start; }
.field-pair .field-error { grid-column: 1 / -1; margin-top: -4px; }

/* Image list: one row per image with thumbnail, label and move/remove buttons (the link itself is hidden). */
.image-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.image-item { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.image-item .preview { margin: 0; width: 120px; height: 86px; object-fit: cover; }
.image-item .preview[hidden] + .image-field { grid-column: 1 / 3; }
.image-item .image-label { display: block; font-weight: 600; margin-bottom: 4px; }
.image-item input { width: 100%; }
.image-actions { display: flex; gap: 4px; }
.image-actions[hidden] { display: none; }
.image-actions .icon-action:disabled { opacity: .35; cursor: default; }
.image-actions [data-remove] { color: var(--danger); }
@media (max-width: 640px) {
  .image-item { grid-template-columns: 88px minmax(0, 1fr) auto; gap: 8px; }
  .image-item .preview { width: 88px; height: 63px; }
  .image-actions { gap: 0; }
}
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 8px; }
.form-actions .push-right { margin-left: auto; }

/* File upload next to the logo/image URL: the native input is visually hidden but
   stays focusable; its label looks like a button and shows the focus ring. */
.upload { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 8px; }
.upload .file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.upload label.btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; margin: 0; }
.upload label.btn .icon { width: 18px; height: 18px; }
.upload .file-input:focus-visible + label { outline: 3px solid var(--petrol-lighter); outline-offset: 2px; }
.upload .upload-msg { flex-basis: 100%; margin: 0; min-height: 1.2em; }
.upload[aria-busy="true"] label { opacity: .6; pointer-events: none; }

/* Participant form: the save bar stays visible at the bottom of the window. */
#participant-form .form-actions {
  position: sticky; bottom: 0; z-index: 5; margin: 0 -24px -24px; padding: 12px 24px;
  background: var(--card); border-top: 1px solid var(--border); border-radius: 0 0 8px 8px;
}
/* Elements scrolled into view (keyboard focus, error links) stay above the sticky bar (WCAG 2.4.11). */
html:has(#participant-form) { scroll-padding-bottom: 88px; }
/* Wide screens: master data left, coupons right; locations and actions span both. */
@media (min-width: 1400px) {
  .form.pform-split { max-width: 1400px; }
  .pform-split .pform-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(560px, 1fr); gap: 0 24px; align-items: start; }
  .pform-split .pform-coupons .coupon .coupon-fields { grid-template-columns: 1fr; }
  /* Keep each time span on one line in the narrower coupon column. */
  .pform-split .times-range { gap: 4px; }
  .pform-split .times-range input.time, .pform-split .times-range input.quota { width: 4rem; }
}
/* The remove button of a time span must not shrink below the 24px target size. */
.times-range .icon-action { flex: none; min-width: 28px; }

.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 8px; padding: 0; font-size: 0.93rem; }
.breadcrumb li + li::before { content: "›"; margin-right: 6px; color: var(--muted); }
.breadcrumb [aria-current] { color: var(--muted); }

details.coords-text { margin: 4px 0 12px; }
details.coords-text summary { cursor: pointer; color: var(--primary-hover); font-weight: 700; min-height: 2.3rem; display: flex; align-items: center; }
details.coords-text[open] summary { margin-bottom: 8px; }
.loc-heading { font-size: 1rem; margin: 0 0 6px; }

#map { height: 420px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; }
.map-search { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 4px; }
.map-search .field { flex: 1; margin-bottom: 0; }
.map-msg { min-height: 1.5em; margin: 0 0 8px; color: var(--muted); }
.loc-list { margin: 0; padding-left: 22px; }
.loc-list li { margin-bottom: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.loc-list input.loc-address { flex: 1 1 260px; width: auto; min-height: 2.3rem; padding: 4px 8px; }
.loc-list li.empty { list-style: none; margin-left: -22px; }
button.link {
  border: 0; background: none; padding: 0; min-height: 2.3rem; font: inherit; color: var(--primary-hover);
  font-family: ui-monospace, Menlo, monospace; font-size: 0.93rem; cursor: pointer;
}
button.link:hover { text-decoration: underline; }
[hidden] { display: none !important; }

/* Small screens: no pinned columns, they would cover most of the width. */
@media (max-width: 900px) {
  table.list .col-num, table.list .col-logo, table.list .col-name, table.list .actions { position: static; }
}

.mono { font-family: ui-monospace, Menlo, monospace; }

/* Live filtering (list-filter.js): results update while typing, so the submit buttons are not needed. */
.filters.live .filter-buttons,
#results.live .per-page button[type="submit"] { display: none; }
.reset-link { display: inline-block; min-height: 24px; line-height: 24px; }
#results[aria-busy="true"] { opacity: .6; transition: opacity .15s; }
