/* Admin console (/admin, Backoffice controllers). The form pieces are shared with /manage. */

.backoffice { min-height: 100vh; font-size: 15px; }

.backoffice header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px;
  padding: 20px 32px;
  background: var(--canvas);
  border-bottom: 1px solid var(--border);
}

.backoffice .wordmark {
  font-size: 22px; font-weight: 800; letter-spacing: -.045em;
  background: var(--aura);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  white-space: nowrap;
}

.backoffice .wordmark small {
  font-size: 13px; font-weight: 600; letter-spacing: 0;
  color: var(--ink-500); -webkit-text-fill-color: var(--ink-500);
}

.backoffice nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; color: var(--ink-700); }
.backoffice nav a,
.backoffice nav button { white-space: nowrap; }
.backoffice nav form { margin: 0; }

.backoffice a,
.backoffice button.link {
  color: var(--primary); font: inherit; font-weight: 600; text-decoration: none;
  background: none; border: 0; padding: 0; cursor: pointer;
}
.backoffice a:hover,
.backoffice button.link:hover { color: var(--primary-hover); }

.backoffice main { max-width: 880px; margin: 0 auto; padding: 32px 24px 64px; }

.backoffice .card {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
  margin-bottom: 24px;
}
.backoffice .card.narrow { max-width: 420px; margin: 48px auto; }

.backoffice h1 { font-size: 24px; margin: 0 0 20px; letter-spacing: -.02em; }
.backoffice h2 { font-size: 18px; margin: 0 0 16px; }
.backoffice .hint { color: var(--ink-500); margin: -12px 0 20px; }

.backoffice table { width: 100%; border-collapse: collapse; }
.backoffice th {
  text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-500);
}
.backoffice th,
.backoffice td { padding: 12px 8px; border-bottom: 1px solid var(--border); }
.backoffice tbody tr:last-child td { border-bottom: 0; }
.backoffice td.actions { text-align: right; }
.backoffice td.actions form { margin: 0; }
.backoffice .row-actions,
.manage .row-actions { display: inline-flex; align-items: center; gap: 8px; }
.backoffice .you { color: var(--ink-500); font-size: 13px; }
.backoffice .empty { color: var(--ink-500); margin: 0; }

.backoffice .pager {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 20px;
  padding-top: 16px; margin-top: 4px;
  border-top: 1px solid var(--border);
}
.backoffice .pager .range { margin-right: auto; color: var(--ink-500); font-size: 14px; }

.backoffice fieldset,
.manage fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

.backoffice .grid,
.manage .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 0 16px; }

/* Rails wraps invalid fields in .field_with_errors; keep them in the field layout. */
.backoffice .field_with_errors,
.manage .field_with_errors { display: contents; }
.backoffice .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.backoffice label { font-weight: 600; font-size: 14px; color: var(--ink-700); }
.backoffice input[type="email"],
.backoffice input[type="text"],
.backoffice input[type="tel"],
.backoffice input[type="search"],
.backoffice input[type="password"] {
  font: inherit;
  font-size: 16px; /* below 16px, iOS Safari zooms in on focus */
  width: 100%; min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--canvas);
}
.backoffice input:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }

.backoffice .button {
  font: inherit; font-weight: 700; color: #fff;
  background: var(--primary);
  border: 0; border-radius: var(--r-pill);
  padding: 10px 22px;
  cursor: pointer;
}
.backoffice .button:hover { background: var(--primary-hover); }
.backoffice .cancel,
.manage .cancel { margin-left: 16px; }

.backoffice button.danger,
.manage button.danger {
  font: inherit; font-size: 14px; font-weight: 600; color: var(--danger);
  background: none; border: 1px solid var(--border-strong); border-radius: var(--r-pill);
  padding: 6px 14px; cursor: pointer;
}
.backoffice button.danger:hover,
.manage button.danger:hover { border-color: var(--danger); }

.backoffice a.secondary,
.manage a.secondary {
  font-size: 14px; font-weight: 600; color: var(--ink-700);
  border: 1px solid var(--border-strong); border-radius: var(--r-pill);
  padding: 6px 14px;
}
.backoffice a.secondary:hover,
.manage a.secondary:hover { color: var(--ink-700); border-color: var(--ink-500); }

.backoffice .button.danger,
.manage .button.danger { background: var(--danger); }
.backoffice .button.danger:hover,
.manage .button.danger:hover { background: var(--danger); filter: brightness(.92); }
.backoffice .button:disabled,
.manage .button:disabled { opacity: .45; cursor: not-allowed; filter: none; }

.backoffice dialog.confirm-delete,
.manage dialog.confirm-delete {
  width: min(420px, calc(100vw - 32px));
  padding: 28px;
  color: inherit; background: var(--canvas);
  border: 1px solid var(--border); border-radius: var(--r-lg);
}
.backoffice dialog.confirm-delete::backdrop,
.manage dialog.confirm-delete::backdrop { background: rgb(0 0 0 / .45); }
.backoffice dialog.confirm-delete p,
.manage dialog.confirm-delete p { margin: 0 0 20px; color: var(--ink-700); }
.backoffice dialog.confirm-delete label,
.manage dialog.confirm-delete label { font-weight: 400; }
.backoffice dialog.confirm-delete label strong,
.manage dialog.confirm-delete label strong { overflow-wrap: anywhere; }
.backoffice .dialog-actions,
.manage .dialog-actions { display: flex; align-items: center; gap: 16px; }

.backoffice .flash,
.backoffice .errors,
.backoffice td.email,
.manage .errors { overflow-wrap: anywhere; }

.backoffice .flash { padding: 12px 16px; border-radius: var(--r-md); margin: 0 0 24px; }
.backoffice .flash.notice { background: var(--primary-soft); color: var(--info); }
.backoffice .flash.alert { background: var(--coral-soft); color: var(--danger); }

.backoffice .errors,
.manage .errors {
  background: var(--coral-soft); color: var(--danger);
  border-radius: var(--r-md);
  padding: 12px 16px 12px 32px; margin: 0 0 20px;
}

.backoffice .visually-hidden,
.manage .visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* Tabs under the header: People and Churches. */
.backoffice header:has(+ .tabs-bar) { border-bottom: 0; padding-bottom: 8px; }
.backoffice .tabs-bar { background: var(--canvas); border-bottom: 1px solid var(--border); padding: 0 32px; }
.backoffice nav.tabs { gap: 4px 28px; flex-wrap: nowrap; overflow-x: auto; }
/* Phones: the tabs wrap onto a second row, rather than hiding Feedback and Timeline off the edge */
@media (max-width: 640px) {
  .backoffice nav.tabs { flex-wrap: wrap; overflow-x: visible; gap: 0 20px; }
}
.backoffice nav.tabs a {
  color: var(--ink-500); padding: 10px 0 12px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.backoffice nav.tabs a:hover { color: var(--ink-900); }
.backoffice nav.tabs a[aria-current="page"] { color: var(--ink-900); border-bottom-color: var(--primary); }

.backoffice .back,
.manage .back { display: inline-block; font-size: 14px; margin-bottom: 16px; }
.backoffice .back::before,
.manage .back::before { content: "← "; }

.backoffice .card-header,
.manage .card-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px;
  margin-bottom: 20px;
}
.backoffice .card-header h1,
.backoffice .card-header h2,
.manage .card-header h1,
.manage .card-header h2 { margin: 0; }
.backoffice .card > h2 + .hint { margin-top: -8px; }

.backoffice code { font-size: 13px; background: var(--surface-2); padding: 2px 6px; border-radius: var(--r-sm); }
.backoffice .subtle { color: var(--ink-500); margin: 4px 0 0; overflow-wrap: anywhere; }
.backoffice .note { color: var(--ink-700); background: var(--surface-2); border-radius: var(--r-md); padding: 10px 14px; margin: 0 0 16px; }

.backoffice .badge,
.manage .badge {
  display: inline-block; vertical-align: middle; margin-left: 6px;
  font-size: 12px; font-weight: 600; line-height: 1.6;
  color: var(--info); background: var(--primary-soft);
  border-radius: var(--r-pill); padding: 0 8px;
  white-space: nowrap;
}
.backoffice td .badge:first-child { margin-left: 0; }
.backoffice .badge.active,
.manage .badge.active { color: var(--success); background: color-mix(in srgb, var(--success) 14%, transparent); }
.backoffice .badge.on_break,
.manage .badge.on_break { color: var(--ink-700); background: color-mix(in srgb, var(--warning) 22%, transparent); }
.backoffice .badge.ended,
.manage .badge.ended { color: var(--ink-500); background: var(--surface-2); }

/* Invites tab */
.backoffice .badge.unused,
.manage .badge.unused { color: var(--success); background: color-mix(in srgb, var(--success) 14%, transparent); }
.backoffice .badge.expired,
.backoffice .badge.revoked,
.manage .badge.expired,
.manage .badge.revoked { color: var(--ink-500); background: var(--surface-2); }
.backoffice code.invite { font-size: 15px; font-weight: 600; letter-spacing: .04em; }
.backoffice button.copy {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--primary);
  background: none; border: 1px solid var(--border-strong); border-radius: var(--r-pill);
  padding: 2px 10px; margin-left: 6px; cursor: pointer; vertical-align: middle;
}
.backoffice button.copy:hover { border-color: var(--primary); }
.backoffice table.invite-codes tr.new { background: var(--primary-soft); }
/* Codes, names and dates stay on one line. Only the label wraps, and notes go on their own line */
.backoffice table.invite-codes td { white-space: nowrap; vertical-align: top; }
.backoffice table.invite-codes td.church-cell { white-space: normal; min-width: 8em; }
.backoffice table.invite-codes .code-cell .badge { margin-left: 6px; }
.backoffice table.invite-codes .cell-note { display: block; color: var(--ink-500); font-size: 12px; margin-top: 2px; }
.backoffice .invite-form { margin-top: 20px; }

/* A church's page */
.backoffice .identity { display: flex; align-items: center; gap: 16px; min-width: 0; }
.backoffice .identity h1 { overflow-wrap: anywhere; }
.backoffice .logo {
  width: 56px; height: 56px; flex: none; border-radius: var(--r-md);
  object-fit: contain; background: var(--surface-2);
}
.backoffice .logo.placeholder {
  display: grid; place-items: center;
  font-size: 24px; font-weight: 800; color: #fff; background: var(--aura);
}
.backoffice dl.facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 16px;
  margin: 0; padding-top: 20px; border-top: 1px solid var(--border);
}
.backoffice dl.facts dt { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-500); }
.backoffice dl.facts dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.backoffice .swatches { display: flex; gap: 8px; }
.backoffice .swatch {
  width: 24px; height: 24px; border-radius: var(--r-pill);
  background: var(--swatch); border: 1px solid var(--border-strong);
}

.backoffice .filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 12px; margin-bottom: 8px; }
.backoffice .filters .field { flex: 1 1 180px; }
.backoffice .filters .secondary-button { margin-bottom: 16px; }

/* A few fields and a button on one line, like adding a church's manager */
.backoffice .inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 12px; margin-top: 16px; }
.backoffice .inline-form .field { flex: 1 1 200px; }
.backoffice .inline-form .button { margin-bottom: 16px; }

/* Forms with several cards */
.backoffice .stacked-form .card h2,
.manage .stacked-form .card h2 { margin-bottom: 16px; }
.backoffice .form-actions,
.manage .form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 0; margin-bottom: 24px; }

.backoffice select,
.backoffice textarea,
.backoffice input[type="number"],
.backoffice input[type="url"],
.backoffice input[type="date"],
.backoffice input[type="time"],
.backoffice input[type="datetime-local"],
.manage select,
.manage textarea {
  font: inherit; font-size: 16px; color: inherit;
  width: 100%; min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--canvas);
}
/* Dropdowns draw their own chevron, inset from the edge, where the browser's sat against it. It
   takes the theme's --ink-500, light and dark. Not list boxes (multiple or size), which have no
   chevron. More specific than the plain select rules, so it wins over their background shorthand
   whichever stylesheet loads last. */
:root { --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23717171' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
[data-theme="dark"] { --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239A95A1' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.backoffice select:not([multiple], [size]),
.manage select:not([multiple], [size]) {
  appearance: none;
  padding-right: 40px;
  background-image: var(--select-chevron);
  background-position: right 14px center;
  background-size: 12px 8px;
  background-repeat: no-repeat;
  text-overflow: ellipsis;
}
.backoffice select:not([multiple], [size]):disabled,
.manage select:not([multiple], [size]):disabled { opacity: .6; cursor: not-allowed; }
.backoffice textarea,
.manage textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
.backoffice select:focus,
.backoffice textarea:focus,
.manage select:focus,
.manage textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
.backoffice input[type="file"] { font: inherit; font-size: 14px; max-width: 100%; color: var(--ink-700); }
.backoffice input[type="file"]::file-selector-button,
.manage input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600; color: var(--ink-700); cursor: pointer;
  background: var(--canvas); border: 1px solid var(--border-strong); border-radius: var(--r-pill);
  padding: 6px 14px; margin-right: 12px;
}

/* Invalid fields: what the server refused, and what the browser is about to refuse. */
.backoffice .field_with_errors input,
.backoffice .field_with_errors select,
.backoffice .field_with_errors textarea,
.backoffice input:user-invalid,
.backoffice select:user-invalid,
.backoffice textarea:user-invalid,
.manage .field_with_errors input,
.manage .field_with_errors select,
.manage .field_with_errors textarea,
.manage input:user-invalid,
.manage select:user-invalid,
.manage textarea:user-invalid { border-color: var(--danger); }
.backoffice .field_with_errors label,
.manage .field_with_errors label { color: var(--danger); }

.backoffice .hint-inline,
.manage .hint-inline { color: var(--ink-500); font-size: 13px; margin: 0; }
.backoffice legend.label,
.manage legend.label { font-weight: 600; font-size: 14px; color: var(--ink-700); margin-bottom: 4px; padding: 0; }

.backoffice label.check,
.manage label.check {
  display: inline-flex; align-items: flex-start; gap: 10px;
  font-weight: 600; font-size: 15px; color: var(--ink-900); cursor: pointer;
}
.backoffice label.check input,
.manage label.check input { accent-color: var(--primary); width: 18px; height: 18px; margin: 2px 0 0; flex: none; }
.backoffice label.check small,
.manage label.check small { display: block; font-weight: 400; font-size: 13px; color: var(--ink-500); margin-top: 2px; }

.backoffice .choices,
.manage .choices { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 20px; }
.backoffice .choices legend,
.manage .choices legend { font-weight: 600; font-size: 14px; color: var(--ink-700); margin-bottom: 8px; padding: 0; }
.backoffice .choices label,
.manage .choices label { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 400; color: var(--ink-900); cursor: pointer; }
.backoffice .choices input,
.manage .choices input { accent-color: var(--primary); width: 18px; height: 18px; margin: 0; }

.backoffice .image-picker,
.manage .image-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.backoffice .image-picker .preview,
.manage .image-picker .preview {
  width: 96px; height: 96px; border-radius: var(--r-md); object-fit: cover;
  background: var(--surface-2); border: 1px solid var(--border);
}
.backoffice .image-controls,
.manage .image-controls { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

/* Cropping a cover to the app's shape before upload */
.backoffice .image-crop,
.manage .image-crop { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; max-width: 480px; }
.backoffice .image-crop[hidden],
.manage .image-crop[hidden] { display: none; }
.backoffice .crop-stage,
.manage .crop-stage {
  position: relative; overflow: hidden; width: 100%; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border); cursor: grab; touch-action: none;
}
.backoffice .crop-stage:active,
.manage .crop-stage:active { cursor: grabbing; }
.backoffice .crop-stage:focus-visible,
.manage .crop-stage:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.backoffice .crop-stage img,
.manage .crop-stage img { position: absolute; left: 50%; top: 50%; max-width: none; user-select: none; pointer-events: none; }
.backoffice .crop-zoom,
.manage .crop-zoom { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 600; color: var(--ink-700); }
.backoffice .crop-zoom input,
.manage .crop-zoom input { flex: 1; accent-color: var(--primary); }

.backoffice .color-input,
.manage .color-input { display: flex; align-items: center; gap: 10px; }
.backoffice .color-input input[type="color"],
.manage .color-input input[type="color"] {
  width: 44px; height: 44px; flex: none; padding: 2px; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--canvas);
}
.backoffice .color-input input[type="text"],
.manage .color-input input[type="text"] { flex: 1; text-transform: uppercase; }
.backoffice .color-input input[type="text"]::placeholder,
.manage .color-input input[type="text"]::placeholder { text-transform: none; }

.backoffice .steps,
.manage .steps { display: flex; flex-direction: column; gap: 0; margin: 12px 0 4px; }
.backoffice .step,
.manage .step {
  display: grid; grid-template-columns: minmax(96px, 140px) minmax(0, 1fr) auto; align-items: end; gap: 0 12px;
}
.backoffice .step button,
.manage .step button { margin-bottom: 20px; }

.backoffice ul.photos,
.manage ul.photos {
  list-style: none; padding: 0; margin: 0 0 20px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 16px;
}
.backoffice ul.photos li,
.manage ul.photos li { display: flex; flex-direction: column; gap: 8px; }
.backoffice ul.photos img,
.manage ul.photos img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border);
}
.backoffice ul.photos label.check,
.manage ul.photos label.check { font-weight: 400; font-size: 14px; }

.backoffice .danger-zone h2,
.manage .danger-zone h2 { color: var(--danger); }

/* A pill button that isn't the page's main action, matching a.secondary. */
.backoffice .secondary-button,
.manage .secondary-button {
  font: inherit; font-size: 14px; font-weight: 600; color: var(--ink-700); cursor: pointer;
  background: none; border: 1px solid var(--border-strong); border-radius: var(--r-pill);
  padding: 6px 14px;
}
.backoffice .secondary-button:hover,
.manage .secondary-button:hover { border-color: var(--ink-500); }
.backoffice .secondary-button:disabled,
.manage .secondary-button:disabled { opacity: .45; cursor: not-allowed; }

.backoffice a.button { display: inline-block; }
.backoffice a.button,
.backoffice a.button:hover { color: #fff; }
.backoffice a.secondary,
.manage a.secondary { display: inline-block; white-space: nowrap; }

/* Phones: stack the header and turn each admin and church manager row into a small card. */
@media (max-width: 640px) {
  .backoffice header { padding: 16px 20px; }
  .backoffice nav { width: 100%; font-size: 14px; gap: 6px 16px; }
  .backoffice nav .signed-in { flex-basis: 100%; }

  .backoffice main { padding: 20px 12px 48px; }
  .backoffice .card { padding: 20px; }
  .backoffice .card.narrow { margin: 16px auto; }

  .backoffice thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .backoffice table,
  .backoffice tbody { display: block; }
  .backoffice tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 12px;
    grid-template-areas: "name actions" "email actions" "added actions";
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
  }
  .backoffice tbody tr:last-child { border-bottom: 0; }
  .backoffice tbody td { display: block; padding: 0; border: 0; }
  .backoffice td.name { grid-area: name; font-weight: 600; }
  .backoffice td.email { grid-area: email; color: var(--ink-700); }
  .backoffice .managers tbody tr { grid-template-areas: "name actions" "email actions" "church actions" "status actions"; }
  .backoffice td.church { grid-area: church; color: var(--ink-700); }
  .backoffice td.status { grid-area: status; color: var(--ink-500); font-size: 13px; }
  .backoffice td.added { grid-area: added; color: var(--ink-500); font-size: 13px; }
  .backoffice td.added::before { content: "Added "; }
  .backoffice td.actions { grid-area: actions; }
}

/* /admin lists: an email breaks after its @ (breakable_email), and only mid-word if even that
   won't fit, so it can't push its table out of the card. What members said, and who asked, keep a
   readable width instead of being squeezed to a word a line. */
.backoffice td:is(.email, [data-label="Email"]) { min-width: 12em; overflow-wrap: anywhere; }
.backoffice .list td:first-child { overflow-wrap: anywhere; min-width: 9em; }
.backoffice .list td.feedback-body { min-width: 12em; }
.backoffice .list td[data-label="Asked by"] { min-width: 9em; }
/* A table that still can't fit, with someone's very long name or email in it, scrolls in its card
   rather than widening the page. Relative, so its visually hidden headings scroll with it. */
.backoffice .card:has(> table) { position: relative; overflow-x: auto; }

/* Phones: list rows become small cards, with the name and actions on top and the details below. */
@media (max-width: 640px) {
  .backoffice .tabs-bar { padding: 0 20px; }
  .backoffice header:has(+ .tabs-bar) { padding-bottom: 4px; }

  .backoffice table.list tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
  .backoffice table.list td.name { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
  .backoffice table.list td.actions { order: 1; }
  .backoffice table.list td[data-label] { order: 2; flex-basis: 100%; color: var(--ink-700); font-size: 14px; }
  .backoffice table.list td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-500); }
  /* On a card, an invite's notes sit next to their value instead of under it */
  .backoffice table.invite-codes td { white-space: normal; }
  .backoffice table.invite-codes .cell-note { display: inline; margin: 0 0 0 4px; }

  .backoffice .step,
  .manage .step { grid-template-columns: minmax(0, 1fr) auto; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
  .backoffice .step .field:last-of-type,
  .manage .step .field:last-of-type { grid-column: 1 / -1; grid-row: 2; margin-bottom: 0; }
  .backoffice .step button,
  .manage .step button { grid-column: 2; grid-row: 1; margin-bottom: 16px; }
  .backoffice .steps .step:last-child,
  .manage .steps .step:last-child { border-bottom: 0; }

  .backoffice .form-actions .button,
  .manage .form-actions .button { flex: 1 1 auto; text-align: center; }
  .backoffice .filters .secondary-button { width: 100%; }

  /* Taps: buttons at least 40px tall, and text links with a taller hit area that doesn't move them */
  .backoffice .button,
  .backoffice .secondary-button,
  .backoffice a.secondary,
  .backoffice button.danger { padding-top: 11px; padding-bottom: 11px; }
  .backoffice header nav a,
  .backoffice header nav button.link,
  .backoffice .back,
  .backoffice .cancel,
  .backoffice .kind-filter a,
  .backoffice .dialog-actions button.link { position: relative; }
  .backoffice header nav a::after,
  .backoffice header nav button.link::after,
  .backoffice .back::after,
  .backoffice .cancel::after,
  .backoffice .kind-filter a::after,
  .backoffice .dialog-actions button.link::after { content: ""; position: absolute; inset: -10px -8px; }
  /* Over the header's, so a tab keeps the whole of its own hit area */
  .backoffice .tabs-bar { position: relative; }
}

/* Reports tab and group chats */
.backoffice nav.tabs .count {
  display: inline-block; min-width: 20px; margin-left: 4px; padding: 0 6px;
  font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
  color: #fff; background: var(--danger); border-radius: var(--r-pill);
}
.backoffice .badge.reason-harassment,
.backoffice .badge.reason-unsafe,
.manage .badge.reason-harassment,
.manage .badge.reason-unsafe { color: var(--danger); background: var(--coral-soft); }
.backoffice .badge.reason-inappropriate,
.manage .badge.reason-inappropriate { color: var(--ink-700); background: color-mix(in srgb, var(--warning) 22%, transparent); }
.backoffice .badge.reason-spam,
.backoffice .badge.reason-other,
.manage .badge.reason-spam,
.manage .badge.reason-other { color: var(--ink-700); background: var(--surface-2); }

.backoffice ol.reports,
.backoffice ol.chat-log { list-style: none; margin: 0; padding: 0; }
.backoffice .report,
.backoffice .chat-log li { padding: 16px 0; border-bottom: 1px solid var(--border); }
.backoffice .report:first-child,
.backoffice .chat-log li:first-child { padding-top: 0; }
.backoffice .chat-log-photo { max-width: 240px; max-height: 240px; border-radius: 8px; display: block; }
.backoffice .report:last-child,
.backoffice .chat-log li:last-child { border-bottom: 0; padding-bottom: 0; }
/* What an edited message said before, in the chat log and on reports */
.backoffice .earlier-versions { margin: 4px 0 8px; }
.backoffice .earlier-versions summary { cursor: pointer; font-size: 13px; }
.backoffice .earlier-version { margin: 8px 0 0; padding-left: 12px; border-left: 2px solid var(--border); }
.backoffice .earlier-version p { margin: 0; }
.backoffice .earlier-version .subtle { font-size: 12px; }
.backoffice .report-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.backoffice .report-meta .badge { margin-left: 0; }
.backoffice .report-meta .subtle { margin: 0; }
.backoffice .report-by { margin: 0 0 12px; color: var(--ink-700); overflow-wrap: anywhere; }
.backoffice .report .row-actions { flex-wrap: wrap; }
.backoffice .report .row-actions form { margin: 0; }

.backoffice blockquote.chat-message {
  margin: 12px 0; padding: 12px 16px; border-radius: var(--r-md);
  background: var(--surface-2); border-left: 3px solid var(--primary);
}
.backoffice blockquote.chat-message p { margin: 0 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.backoffice blockquote.chat-message footer { font-size: 14px; }

.backoffice .chat-log-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-weight: 600; }
.backoffice .chat-log-meta .badge { margin-left: 0; }
.backoffice .chat-log-meta .subtle { margin: 0; font-weight: 400; font-size: 13px; }
.backoffice .chat-log p { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.backoffice .chat-log li.deleted > p:not(.subtle) { color: var(--ink-500); text-decoration: line-through; }
.backoffice .chat-log form { margin: 8px 0 0; }

/* Location pickers: the map under a place's fields, with suggestions over its top as the address is typed */
.backoffice .place-map,
.manage .place-map { grid-column: 1 / -1; position: relative; display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.backoffice .place-map-canvas,
.manage .place-map-canvas {
  height: 300px; border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-2);
}
.backoffice .place-suggestions,
.manage .place-suggestions {
  position: absolute; top: 8px; left: 8px; right: 8px; z-index: 2;
  margin: 0; padding: 4px; list-style: none;
  background: var(--canvas); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-md);
}
.backoffice .place-suggestions button,
.manage .place-suggestions button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: var(--r-sm); background: none;
  color: var(--ink-900); font: inherit; text-align: left; cursor: pointer;
}
.backoffice .place-suggestions button:hover,
.manage .place-suggestions button:hover { background: var(--primary-soft); }
.backoffice .place-suggestions small,
.manage .place-suggestions small { color: var(--ink-500); font-size: 13px; }
.backoffice .place-back,
.manage .place-back { align-self: flex-start; font-size: 13px; }

/* Feedback tab: All, Problems, Suggestions */
.backoffice .kind-filter { display: flex; gap: 16px; margin: 4px 0 16px; }
.backoffice .kind-filter a[aria-current="page"] { font-weight: 700; text-decoration: none; }

/* Support requests and removals: how to reach someone, and what was said, kept as written */
.backoffice .list .contact { margin-top: 2px; font-size: var(--fs-14); font-weight: 400; color: var(--ink-500); overflow-wrap: anywhere; }
.backoffice .list .feedback-body { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 60ch; }

/* Text in both consoles: headings wrap evenly instead of leaving a word on a line of its own, and
   paragraphs, hints and labels end on more than one word where the browser can manage it. A long
   unbroken word, like someone's name, breaks rather than widening the page. */
.backoffice :is(h1, h2, h3),
.manage :is(h1, h2, h3) { text-wrap: balance; overflow-wrap: break-word; }
.backoffice,
.manage { text-wrap: pretty; }

/* Column headings and buttons stay on one line. A button with someone's long name in it ends in
   an ellipsis instead of growing taller than its pill. */
.backoffice th,
.manage .dt th { white-space: nowrap; }
.backoffice .secondary-button,
.manage .secondary-button,
.manage .button,
.backoffice .button { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* Dates in tables stay whole: "Nov 28, 2026", not "Nov 28," over "2026" */
.backoffice td.added,
.backoffice td[data-label="Added"],
.backoffice td[data-label="Sent"],
.manage .dt td:is([data-label="Since"], [data-label="Sent"], [data-label="Set up"], [data-label="When"], [data-label="Role"]) { white-space: nowrap; }

/* A color's text field gives way to the swatch and Clear on the narrowest phones */
.backoffice .color-input input[type="text"],
.manage .color-input input[type="text"] { flex: 1 1 0; min-width: 0; }
