:root {
  color-scheme: light dark;
  --page: #f6f5f1;
  --surface: #ffffff;
  --ink: #1f1e1b;
  --muted: #64625b;
  --line: #e2dfd7;
  --line-strong: #cbc7bc;
  --field-border: #8a867b;
  --field-fill: #f6f5f1;
  --accent: #2c5a4e;
  --accent-ink: #ffffff;
  --accent-soft: #e5efeb;
  --danger: #9b3328;
  --danger-soft: #f8e9e6;
  --success: #2c5a4e;
  --success-soft: #e5efeb;
  --warning-soft: #f6efdc;
  --warning-ink: #6b4f12;
  --focus: #2f6fb3;
  --radius: 10px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #151513;
    --surface: #1d1d1a;
    --ink: #ecebe5;
    --muted: #a3a097;
    --line: #2f2e2a;
    --line-strong: #45433d;
    --field-border: #7d7a70;
    --field-fill: #151513;
    --accent: #8fc2b2;
    --accent-ink: #11201b;
    --accent-soft: #1f2f2a;
    --danger: #e79a8f;
    --danger-soft: #3a211d;
    --success: #8fc2b2;
    --success-soft: #1f2f2a;
    --warning-soft: #352c17;
    --warning-ink: #e6cf91;
    --focus: #8ab8ec;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
}

h1,
h2 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.2;
  margin: 0 0 0.5rem;
}

h1 {
  font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.25rem);
}

h2 {
  font-size: 1.35rem;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border-radius: var(--radius);
  z-index: 10;
}

.skip-link:focus {
  top: 1rem;
}

.brand {
  font-family: var(--serif);
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 1.1rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  color: var(--muted);
  font-size: 0.925rem;
}

.account-email {
  overflow-wrap: anywhere;
}

main {
  padding: clamp(1.5rem, 5vw, 3.5rem) clamp(1rem, 4vw, 2.5rem) 4rem;
}

.centred {
  display: grid;
  place-items: start center;
  padding-top: clamp(2rem, 10vh, 6rem);
}

.panel {
  width: 100%;
  max-width: 27rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 1.4);
  padding: clamp(1.5rem, 5vw, 2.5rem);
}

.panel .brand {
  display: block;
  margin-bottom: 2rem;
}

.lead {
  color: var(--muted);
}

.wide {
  max-width: 72rem;
  margin: 0 auto;
}

.section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 1.4);
  padding: clamp(1.25rem, 4vw, 2rem);
  margin-bottom: 2rem;
}

.section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
}

.section-heading h2 {
  margin: 0;
}

form {
  margin: 0;
}

.field {
  margin-bottom: 1.15rem;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.925rem;
  margin-bottom: 0.35rem;
}

.hint {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.35rem;
}

input {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--field-fill);
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  min-height: 2.9rem;
}

input:focus-visible {
  outline-offset: 0;
  border-color: var(--focus);
}

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

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  min-height: 2.75rem;
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}

.primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}

.danger {
  background: transparent;
  color: var(--danger);
  border-color: currentColor;
}

.quiet {
  background: transparent;
  color: var(--accent);
  padding-inline: 0.25rem;
  min-height: 2.25rem;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  font-weight: 500;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.full {
  width: 100%;
}

.stack {
  display: grid;
  gap: 0.75rem;
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.875rem;
  margin: 1.75rem 0 1rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--line);
}

.message {
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  margin: 0 0 1.15rem;
  background: var(--accent-soft);
  color: var(--ink);
  overflow-wrap: anywhere;
}

.message[data-tone="error"] {
  background: var(--danger-soft);
  border-left: 3px solid var(--danger);
}

.message[data-tone="success"] {
  background: var(--success-soft);
  border-left: 3px solid var(--success);
}

.message[data-tone="info"] {
  border-left: 3px solid var(--accent);
}

[hidden] {
  display: none !important;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th {
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0.75rem 0.6rem;
  border-bottom: 1px solid var(--line-strong);
}

td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th:first-child,
td:first-child {
  padding-left: 0;
}

th:last-child,
td:last-child {
  padding-right: 0;
}

.gallery-name {
  font-weight: 600;
}

.slug {
  white-space: nowrap;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.875rem;
  color: var(--muted);
}

.email-cell {
  overflow-wrap: break-word;
}

.tag {
  display: inline-block;
  justify-self: start;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--page);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  white-space: nowrap;
}

.tag[data-kind="accepted"],
.tag[data-kind="active"] {
  background: var(--success-soft);
  border-color: transparent;
  color: var(--success);
}

.tag[data-kind="pending"] {
  background: var(--warning-soft);
  border-color: transparent;
  color: var(--warning-ink);
}

.tag[data-kind="removed"] {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.row-message {
  max-width: 18rem;
  margin: 0.6rem 0 0 auto;
  font-size: 0.875rem;
  text-align: right;
}

.row-message[data-tone="error"] {
  color: var(--danger);
}

.empty {
  color: var(--muted);
  padding: 1.5rem 0 0.5rem;
  margin: 0;
}

dialog {
  max-width: min(30rem, calc(100vw - 2rem));
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * 1.4);
  padding: 1.75rem;
  background: var(--surface);
  color: var(--ink);
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.45);
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.placeholder-note {
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  margin-top: 1.5rem;
  margin-bottom: 0;
}

@media (max-width: 46rem) {
  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  table,
  tbody,
  tr,
  td {
    display: block;
  }

  tr {
    border-bottom: 1px solid var(--line-strong);
    padding: 0.9rem 0;
  }

  td {
    border: 0;
    padding: 0.2rem 0;
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    gap: 0.75rem;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.825rem;
  }

  td.gallery-name {
    display: block;
    font-size: 1.05rem;
    padding-bottom: 0.35rem;
  }

  td.gallery-name::before {
    content: none;
  }

  td.actions-cell {
    display: block;
    padding-top: 0.75rem;
  }

  td.actions-cell::before {
    content: none;
  }

  .row-actions {
    justify-content: flex-start;
  }

  .row-message {
    max-width: none;
    margin-left: 0;
    text-align: left;
  }

  .slug {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

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

.doc {
  max-width: 56rem;
}

.doc h3 {
  font-size: 1.05rem;
  margin: 1.5rem 0 0.35rem;
}

.doc code,
.code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.code {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  max-height: 32rem;
  overflow: auto;
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  white-space: pre;
  overflow-wrap: normal;
}

.addresses dt {
  font-weight: 600;
  margin-top: 1rem;
}

.addresses dd {
  margin: 0.35rem 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.address {
  flex: 1 1 18rem;
  min-width: 0;
  padding: 0.5rem 0.7rem;
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
