/*
 * Admin console styling — neutral, classic, and deliberately separate from the
 * invitation's ornate look. Plain CSS, no framework.
 *
 * Mobile-first. Base rules target a ~320px phone; layers are added with
 * min-width queries. The ONLY breakpoints in this file (rem, so they follow the
 * user's font size) are:
 *
 *   40rem  (640px)   large phones / small tablets: forms go two-column, headers
 *                    and action bars sit on one row, definition lists go
 *                    side by side.
 *   52rem  (832px)   tablets: multi-column KPI / metric grids.
 *   64rem  (1024px)  desktop: the nav drawer becomes the fixed sidebar (and
 *                    pointer-precise devices get compact controls).
 *                    nav_controller.js mirrors this value in a matchMedia query.
 *   75rem  (1200px)  wide desktop: the stacked "card" tables become real tables
 *                    (a 6-column table does not fit beside the sidebar below
 *                    this width).
 *
 * Fixed/sticky bars pad themselves with env(safe-area-inset-*) (the layouts set
 * viewport-fit=cover), and transitions honor prefers-reduced-motion.
 */

:root {
  --admin-bg: #f5f6f8;
  --admin-surface: #ffffff;
  --admin-ink: #1f2430;
  --admin-muted: #6b7280;
  --admin-line: #e3e6eb;
  --admin-accent: #b8835c;
  --admin-green: #2f855a;
  --admin-topbar-h: 3.5rem;
}

* {
  box-sizing: border-box;
}

body.admin {
  margin: 0;
  background: var(--admin-bg);
  color: var(--admin-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  overflow-wrap: break-word;
}

img,
svg {
  max-width: 100%;
}

/* ---- Sidebar layout -----------------------------------------------------
   Below 64rem the sidebar is an off-canvas drawer under a sticky top bar,
   toggled by nav_controller.js (.is-nav-open on .admin-layout). */

.admin-layout {
  min-height: 100vh;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  height: calc(var(--admin-topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(1rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left));
  background: var(--admin-surface);
  border-bottom: 1px solid var(--admin-line);
}

.admin-topbar__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  background: var(--admin-surface);
  color: var(--admin-ink);
  cursor: pointer;
}

.admin-topbar__bars,
.admin-topbar__bars::before,
.admin-topbar__bars::after {
  display: block;
  width: 1.25rem;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.admin-topbar__bars {
  position: relative;
}

.admin-topbar__bars::before,
.admin-topbar__bars::after {
  content: "";
  position: absolute;
  left: 0;
}

.admin-topbar__bars::before { top: -0.4rem; }
.admin-topbar__bars::after { top: 0.4rem; }

.is-nav-open .admin-topbar__bars { background: transparent; }
.is-nav-open .admin-topbar__bars::before { transform: translateY(0.4rem) rotate(45deg); }
.is-nav-open .admin-topbar__bars::after { transform: translateY(-0.4rem) rotate(-45deg); }

.admin-backdrop {
  display: none;
  position: fixed;
  z-index: 20;
  inset: calc(var(--admin-topbar-h) + env(safe-area-inset-top)) 0 0 0;
  background: rgba(31, 36, 48, 0.45);
}

.is-nav-open .admin-backdrop {
  display: block;
}

.admin-sidebar {
  position: fixed;
  z-index: 30;
  top: calc(var(--admin-topbar-h) + env(safe-area-inset-top));
  bottom: 0;
  left: 0;
  width: min(20rem, 85vw);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  background: var(--admin-surface);
  border-right: 1px solid var(--admin-line);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 0.2s ease, visibility 0s linear 0.2s;
}

.is-nav-open .admin-sidebar {
  transform: none;
  visibility: visible;
  transition: transform 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
  .admin-sidebar,
  .is-nav-open .admin-sidebar,
  .admin-topbar__bars,
  .admin-topbar__bars::before,
  .admin-topbar__bars::after {
    transition: none;
  }
}

/* The top bar already shows the brand on small screens. */
.admin-sidebar__brand {
  display: none;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.5rem 1.25rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--admin-line);
}

/* Push the signed-in user block to the bottom of the sidebar. */
.admin-sidebar__user {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--admin-line);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.admin-sidebar__email {
  font-size: 0.85rem;
  color: var(--admin-muted);
  overflow-wrap: anywhere;
}

.admin__brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--admin-ink);
  text-decoration: none;
}

.admin__tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #fff;
  background: var(--admin-accent);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

/* ---- Account/event switcher --------------------------------------------- */

.admin-switcher {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0 0.5rem 1rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--admin-line);
}

.admin-switcher__form,
.admin-switcher__static,
.admin-switcher__empty {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.admin-switcher__label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--admin-muted);
}

.admin-switcher__value {
  font-size: 0.9rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.admin-switcher select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--admin-surface);
  color: var(--admin-ink);
}

.admin-switcher__empty p.empty {
  padding: 0;
  margin: 0;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.admin-nav__link {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.55rem 0.6rem;
  border-radius: 8px;
  color: var(--admin-muted);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
}

.admin-nav__link:hover {
  background: var(--admin-bg);
  color: var(--admin-ink);
}

.admin-nav__link.is-active {
  background: var(--admin-accent);
  color: #fff;
}

.admin__main {
  min-width: 0;
  max-width: 60rem;
  margin: 0 auto;
  padding: 1.25rem max(1rem, env(safe-area-inset-right)) calc(2.5rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

@media (min-width: 40rem) {
  .admin__main {
    padding-top: 1.75rem;
    padding-right: max(1.5rem, env(safe-area-inset-right));
    padding-left: max(1.5rem, env(safe-area-inset-left));
  }
}

@media (min-width: 64rem) {
  .admin-layout {
    display: flex;
    align-items: flex-start;
  }

  .admin-layout .admin-topbar,
  .admin-layout .admin-backdrop {
    display: none;
  }

  .admin-sidebar {
    position: sticky;
    top: 0;
    z-index: auto;
    flex: 0 0 15rem;
    width: 15rem;
    height: 100vh;
    padding: 1.25rem 1rem;
    transform: none;
    visibility: visible;
    transition: none;
  }

  .admin-sidebar__brand {
    display: flex;
  }

  .admin-switcher select {
    min-height: 0;
    font-size: 0.9rem;
  }

  .admin-nav__link {
    min-height: 0;
    font-size: 0.95rem;
  }

  .admin__main {
    flex: 1 1 auto;
  }
}

/* ---- Flash messages ----------------------------------------------------- */

.flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

.flash--notice {
  background: #e6f4ec;
  color: var(--admin-green);
}

.flash--alert {
  background: #fdf0dd;
  color: #92400e;
}

/* ---- Headings ---------------------------------------------------------- */

.admin__title {
  margin: 0 0 1.25rem;
  font-size: 1.35rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

@media (min-width: 40rem) {
  .admin__title {
    font-size: 1.5rem;
  }
}

.admin__section-title {
  margin: 2rem 0 0.75rem;
  font-size: 1.05rem;
  color: var(--admin-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---- Stat cards -------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* The per-event cards on events#index nest .stats inside .card__body, which
   supplies its own padding -- the standalone spacing would double up there. */
.card__body .stats {
  margin-bottom: 0;
}

.stat {
  background: var(--admin-surface);
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  padding: 0.9rem 1rem;
}

.stat__value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat__label {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: var(--admin-muted);
}

.stat__sub {
  color: var(--admin-muted);
  font-weight: 400;
  font-size: 1.1rem;
}

/* ---- Event overview metrics (events/show) --------------------------------
   KPI cards link to the filtered invitation lists; the status accent reuses the
   .badge--* palette. events#index keeps using .stats/.stat above. */

.kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.kpi {
  display: block;
  background: var(--admin-surface);
  border: 1px solid var(--admin-line);
  border-left: 4px solid var(--admin-muted);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  color: var(--admin-ink);
  text-decoration: none;
}

.kpi:hover,
.kpi:focus-visible {
  box-shadow: 0 2px 8px rgba(31, 36, 48, 0.1);
}

.kpi__value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.kpi__label {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: var(--admin-muted);
}

.kpi--total { border-left-color: var(--admin-accent); }
.kpi--confirmed { border-left-color: var(--admin-green); }
.kpi--confirmed .kpi__value { color: var(--admin-green); }
.kpi--pending { border-left-color: #d97706; }
.kpi--pending .kpi__value { color: #92400e; }
.kpi--declined { border-left-color: #b91c1c; }
.kpi--declined .kpi__value { color: #b91c1c; }

.metrics {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  align-items: stretch;
  margin-bottom: 0;
}

.metric-card .card__body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.metric__value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
}

.metric__label {
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: var(--admin-muted);
}

.progress {
  display: flex;
  height: 0.9rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--admin-line);
}

.progress--empty {
  opacity: 0.6;
}

.progress__segment {
  height: 100%;
}

.progress__segment--confirmed { background: var(--admin-green); }
.progress__segment--pending { background: #d97706; }
.progress__segment--declined { background: #b91c1c; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
  color: var(--admin-muted);
}

.legend__item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend__swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
}

.legend__swatch--confirmed { background: var(--admin-green); }
.legend__swatch--pending { background: #d97706; }
.legend__swatch--declined { background: #b91c1c; }

@media (min-width: 52rem) {
  .kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
  }

  .kpi__value { font-size: 2.25rem; }

  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- Invitation lists ------------------------------------------------------- */

/* Shared by the invitations and memberships tables. Below 75rem each row is
   stacked into a "card": the header row is visually hidden and every cell shows
   its own label from its data-label attribute. From 75rem it is a normal table. */
.invitation-table,
.invitation-table tbody,
.invitation-table tr,
.invitation-table td {
  display: block;
}

.invitation-table {
  width: 100%;
}

.invitation-table thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.invitation-table tbody {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.invitation-table tr {
  background: var(--admin-surface);
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  padding: 0.75rem 1rem;
}

.invitation-table td {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
  padding: 0.3rem 0;
  font-size: 0.95rem;
  text-align: right;
  overflow-wrap: anywhere;
}

.invitation-table td::before {
  content: attr(data-label);
  flex: 0 0 auto;
  color: var(--admin-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.invitation-table td:empty {
  display: none;
}

.invitation-table td.cell--primary {
  display: block;
  padding-top: 0;
  padding-bottom: 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: left;
}

.invitation-table td.cell--primary::before,
.invitation-table td.actions::before {
  display: none;
}

.cell--primary .badge {
  margin-left: 0.4rem;
}

.invitation-table td.actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
  gap: 0.5rem;
  margin-top: 0.4rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--admin-line);
  text-align: left;
}

.invitation-table td.actions a {
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 0.85rem;
  text-decoration: none;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  font-size: 0.9rem;
}

.invitation-table th {
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--admin-line);
  background: #fafbfc;
  color: var(--admin-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.invitation-table td.num {
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-block;
  white-space: nowrap;
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-weight: 600;
}

.badge--confirmed {
  color: var(--admin-green);
  background: #e6f4ec;
}

.badge--pending {
  color: #92400e;
  background: #fdf0dd;
}

.badge--declined {
  color: #b91c1c;
  background: #fbe9e9;
}

.badge--active {
  color: #fff;
  background: var(--admin-accent);
}

.badge--owner {
  color: #fff;
  background: var(--admin-accent);
}

.badge--admin {
  color: var(--admin-green);
  background: #e6f4ec;
}

.badge--member {
  color: var(--admin-muted);
  background: var(--admin-line);
}

.badge--queued {
  color: var(--admin-muted);
  background: var(--admin-line);
}

.badge--sent {
  color: var(--admin-accent);
  background: #e7edfb;
}

.badge--delivered {
  color: var(--admin-green);
  background: #e6f4ec;
}

.badge--failed {
  color: #92400e;
  background: #fdf0dd;
}

.empty {
  color: var(--admin-muted);
  font-style: italic;
  padding: 0.5rem 0;
}

@media (min-width: 75rem) {
  .invitation-table {
    display: table;
    border-collapse: collapse;
    background: var(--admin-surface);
    border: 1px solid var(--admin-line);
    border-radius: 10px;
    overflow: hidden;
  }

  .invitation-table thead {
    position: static;
    display: table-header-group;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
  }

  .invitation-table tbody {
    display: table-row-group;
  }

  .invitation-table tr {
    display: table-row;
    background: none;
    border: 0;
    border-radius: 0;
    padding: 0;
  }

  .invitation-table td,
  .invitation-table td:empty,
  .invitation-table td.cell--primary,
  .invitation-table td.actions {
    display: table-cell;
    padding: 0.6rem 0.7rem;
    border: 0;
    border-bottom: 1px solid var(--admin-line);
    font-size: 0.95rem;
    font-weight: 400;
    text-align: left;
    overflow-wrap: break-word;
  }

  .invitation-table td::before {
    content: none;
    display: none;
  }

  .invitation-table td.num {
    text-align: right;
  }

  .invitation-table tr:last-child td {
    border-bottom: none;
  }

  .invitation-table td.actions {
    margin: 0;
  }

  .invitation-table td.actions {
    white-space: nowrap;
  }

  .invitation-table td.actions a {
    min-height: 0;
    margin-right: 0.6rem;
    padding: 0;
    border: 0;
    font-size: 0.85rem;
  }
}

/* ---- Icons -------------------------------------------------------------- */

.icon {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 2.75rem;
  padding: 0 0.5rem;
}

.icon-link .icon {
  width: 0.95rem;
  height: 0.95rem;
}

.icon-link--danger {
  color: #b91c1c;
}

.icon-link--danger:hover {
  color: #991b1b;
}

/* ---- Header / actions / buttons ----------------------------------------- */

.admin__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.admin__header .admin__title {
  flex: 1 1 100%;
  margin: 0;
}

/* On phones the header buttons take their own full-width row(s). */
.admin__header > .button {
  flex: 1 1 100%;
}

.admin__header-actions {
  flex: 1 1 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.admin__header-actions .button {
  width: 100%;
}

.admin__header-actions .button--primary {
  grid-column: 1 / -1;
  order: -1;
}

.admin__header-actions .button:last-child:not(:only-child) {
  grid-column: 1 / -1;
}

@media (min-width: 40rem) {
  .admin__header .admin__title {
    flex: 1 1 12rem;
  }

  .admin__header > .button {
    flex: 0 0 auto;
  }

  .admin__header-actions {
    flex: 0 1 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .admin__header-actions .button {
    width: auto;
  }

  .admin__header-actions .button--primary {
    order: 0;
  }
}

/* .admin__actions has a single consumer (events/show.html.slim). Centering it
   visually balances the button row against the full-width Detalles card that
   auto-fit grid produces in .card-grid--tight directly below it. */
.admin__actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 40rem) {
  .admin__actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
  }
}

/* Shared button component. Works uniformly across links (<a>), <button>, and
   submit/button inputs so every action in the console looks the same. */
.button,
button.button,
input[type="submit"].button,
input[type="button"].button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid var(--admin-line);
  color: var(--admin-ink);
  background: var(--admin-surface);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.button .icon {
  width: 1rem;
  height: 1rem;
}

/* Compact pointer-precise controls on desktop; touch devices of any width keep
   the 44px targets. */
@media (min-width: 64rem) and (pointer: fine) {
  .button,
  button.button,
  input[type="submit"].button,
  input[type="button"].button {
    min-height: 0;
  }

  .icon-link {
    min-height: 0;
    padding: 0;
  }
}

.button--primary,
button.button--primary,
input[type="submit"].button--primary {
  background: var(--admin-accent);
  border-color: var(--admin-accent);
  color: #fff;
}

/* Full-width variant for stacked contexts (sidebar sign-out, login submit). */
.button--block {
  width: 100%;
}

/* button_to renders a wrapping <form>; keep it from adding layout/spacing so the
   button behaves like any other .button in flex/stacked containers. */
form.button_to {
  margin: 0;
  display: contents;
}

/* ---- Forms --------------------------------------------------------------- */

.form-field {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--admin-muted);
}

/* 16px+ text keeps iOS Safari from zooming the page when a field is focused. */
.form-field :where(input, textarea, select) {
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  background: var(--admin-surface);
  color: var(--admin-ink);
  font: inherit;
  font-size: 1rem;
}

.form-field textarea {
  min-height: 6rem;
  resize: vertical;
}

.form-field input[type="file"] {
  padding: 0.5rem;
}

.form-errors {
  background: #fdf0dd;
  border: 1px solid #f0d3a8;
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.25rem;
  color: #92400e;
  overflow-wrap: anywhere;
}

.form-errors h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

.form-errors ul {
  margin: 0;
  padding-left: 1.1rem;
}

/* ---- Invitation details --------------------------------------------------- */

.invitation-details {
  background: var(--admin-surface);
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  overflow: hidden;
}

.invitation-details__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--admin-line);
  overflow-wrap: anywhere;
}

.invitation-details__row:last-child {
  border-bottom: none;
}

.invitation-details__label {
  color: var(--admin-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ---- Cards -------------------------------------------------------------- */

.card {
  background: var(--admin-surface);
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(31, 36, 48, 0.04), 0 6px 16px rgba(31, 36, 48, 0.05);
  overflow: hidden;
}

.card--link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.card--link:hover {
  border-color: var(--admin-accent);
}

.card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1rem;
  background: #fafbfc;
  border-bottom: 1px solid var(--admin-line);
}

.card__title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--admin-muted);
  min-width: 0;
  overflow-wrap: anywhere;
}

.card__body {
  padding: 1rem;
}

.card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.75rem 1rem;
  background: #fafbfc;
  border-top: 1px solid var(--admin-line);
}

.card__footer .button {
  flex: 1 1 8rem;
}

@media (min-width: 40rem) {
  .card__header,
  .card__footer {
    padding-right: 1.25rem;
    padding-left: 1.25rem;
  }

  .card__header {
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
  }

  .card__body {
    padding: 1.25rem;
  }

  .card__footer .button {
    flex: 0 0 auto;
  }
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 1.25rem;
  align-items: start;
}

/* Wider minimum for the operational band (Detalles / Invitaciones), so those
   two cards sit side by side rather than wrapping to three narrow columns. */
.card-grid--tight {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
}

/* ---- Page head (show / edit) ------------------------------------------- */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.page-head__main {
  display: flex;
  align-items: center;
  gap: 0.5rem 0.75rem;
  flex-wrap: wrap;
  min-width: 0;
}

.page-head__main .admin__title {
  margin: 0;
}

.page-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  width: 100%;
}

.page-head__actions .button {
  flex: 1 1 8rem;
}

@media (min-width: 40rem) {
  .page-head__actions {
    width: auto;
    flex-shrink: 0;
  }

  .page-head__actions .button {
    flex: 0 0 auto;
  }
}

/* ---- Definition-list details ------------------------------------------- */

.detail-list {
  margin: 0;
}

.detail-list__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.15rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--admin-line);
}

.detail-list__row:first-child {
  padding-top: 0;
}

.detail-list__row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.detail-list dt {
  color: var(--admin-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-list dd {
  margin: 0;
  font-size: 0.98rem;
  overflow-wrap: anywhere;
}

@media (min-width: 40rem) {
  .detail-list__row {
    grid-template-columns: 8rem minmax(0, 1fr);
    gap: 0.75rem;
    align-items: baseline;
  }
}

.detail-list dd.is-muted {
  color: var(--admin-muted);
  font-style: italic;
}

/* Freeform copy (intro quote, greeting, dress-code note) keeps its authored
   line breaks without needing a helper to turn them into <br>. */
.detail-list dd.is-copy {
  white-space: pre-line;
}

.detail-count {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}

.detail-count__unit {
  color: var(--admin-muted);
  font-size: 0.9rem;
  margin-left: 0.3rem;
}

/* ---- Public link box --------------------------------------------------- */

.link-box {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  color: var(--admin-ink);
  background: var(--admin-bg);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  overflow-wrap: anywhere;
  word-break: break-all;
  margin: 0.5rem 0 1rem;
}

/* ---- Read-only content overview (admin/events/show) --------------------- */

/* Honest inline note — e.g. "this content isn't editable from the console
   yet". Deliberately not a .flash: it's a permanent property of the page, not
   the result of an action. */
.callout {
  margin: 0 0 1.25rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--admin-line);
  border-left: 3px solid var(--admin-accent);
  border-radius: 8px;
  background: var(--admin-surface);
  color: var(--admin-muted);
  font-size: 0.85rem;
}

/* Generic name + supporting-lines list, shared by hosts, venues and lodgings. */
.content-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.content-list__item {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--admin-line);
}

.content-list__item:first-child {
  padding-top: 0;
}

.content-list__item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.content-list__title,
.content-list__meta,
.content-copy {
  overflow-wrap: anywhere;
}

.content-list__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.content-list__meta {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--admin-muted);
}

/* Agenda entries keep their authored order; the fixed time column is what
   makes the list read as a timeline. */
.agenda-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.agenda-list__item {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--admin-line);
}

.agenda-list__item:first-child {
  padding-top: 0;
}

.agenda-list__item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.agenda-list__time {
  color: var(--admin-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.agenda-list__label {
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.swatch {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  border: 1px solid var(--admin-line);
}

/* Thumbnails are sized down with object-fit rather than Active Storage
   variants, so the overview never depends on image processing being
   available. */
.content-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.content-thumbs:last-child {
  margin-bottom: 0;
}

.content-thumb {
  max-width: 100%;
  width: 4.5rem;
  height: 4.5rem;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--admin-line);
  background: var(--admin-bg);
}

.content-copy {
  margin: 0;
  font-size: 0.95rem;
  white-space: pre-line;
}

/* ---- Button hover + form polish ---------------------------------------- */

.button:hover {
  border-color: var(--admin-muted);
}

.button--primary:hover {
  filter: brightness(0.95);
  border-color: var(--admin-accent);
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--admin-accent);
  box-shadow: 0 0 0 3px rgba(184, 131, 92, 0.16);
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0 1rem;
}

@media (min-width: 40rem) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.form-help {
  font-size: 0.8rem;
  color: var(--admin-muted);
  margin: 0.15rem 0 0;
}

/* ---- Pagination (Kaminari default theme) ------------------------------- */

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  margin-top: 1.5rem;
}

.pagination a,
.pagination .current,
.pagination .gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  height: 2.75rem;
  padding: 0 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--admin-line);
  background: var(--admin-surface);
  color: var(--admin-ink);
}

.pagination a:hover {
  border-color: var(--admin-muted);
  background: var(--admin-bg);
}

.pagination .current {
  background: var(--admin-accent);
  border-color: var(--admin-accent);
  color: #fff;
}

.pagination .gap {
  border-color: transparent;
  background: transparent;
  color: var(--admin-muted);
  min-width: auto;
  padding: 0 0.25rem;
}

@media (min-width: 64rem) and (pointer: fine) {
  .pagination a,
  .pagination .current,
  .pagination .gap {
    min-width: 2.1rem;
    height: 2.1rem;
    padding: 0 0.6rem;
  }
}

.table-caption {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--admin-muted);
  text-align: center;
}

/* ---- Invitation search -------------------------------------------------- */

.invitation-search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.invitation-search__input {
  flex: 1 1 100%;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.45rem 0.75rem;
  font: inherit;
  font-size: 1rem;
  color: var(--admin-ink);
  background: var(--admin-surface);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
}

.invitation-search .button {
  flex: 1 1 auto;
}

.invitation-search__clear {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.5rem;
  font-size: 0.85rem;
  color: var(--admin-muted);
}

@media (min-width: 40rem) {
  .invitation-search__input {
    flex: 1 1 16rem;
    max-width: 28rem;
  }

  .invitation-search .button {
    flex: 0 0 auto;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Invitation status filters ------------------------------------------ */

.invitation-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.1rem;
}

.invitation-filters a {
  display: inline-flex;
  flex: 1 1 calc(50% - 0.35rem);
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--admin-muted);
  border: 1px solid var(--admin-line);
  background: var(--admin-surface);
  transition: border-color 0.1s, color 0.1s;
}

.invitation-filters a:hover {
  border-color: var(--admin-muted);
  color: var(--admin-ink);
}

.invitation-filters a.is-active {
  background: var(--admin-accent);
  border-color: var(--admin-accent);
  color: #fff;
}

@media (min-width: 64rem) and (pointer: fine) {
  .invitation-filters a {
    flex: 0 0 auto;
    min-height: 0;
  }
}

/* ---- Auth / login screen ------------------------------------------------ */

.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.auth__card {
  width: 100%;
  max-width: 22rem;
  background: var(--admin-surface);
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(31, 36, 48, 0.04), 0 6px 16px rgba(31, 36, 48, 0.05);
  padding: 1.25rem;
}

@media (min-width: 40rem) {
  .auth__card {
    padding: 1.75rem;
  }
}

.auth__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.auth__title {
  margin: 0 0 1.25rem;
  font-size: 1.25rem;
}

.auth__remember {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.25rem 0 1rem;
  min-height: 2.75rem;
  font-size: 0.95rem;
  color: var(--admin-muted);
}

.auth__remember input {
  width: 1.25rem;
  height: 1.25rem;
}

.auth__actions {
  margin-top: 0.25rem;
}
