/* CMPNest dashboard. Plain CSS, no framework. Colours meet WCAG 2.2 AA (4.5:1 text, 3:1 UI). */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f0f2f5;
  --text: #16181d;
  --text-muted: #4a5160;
  --border: #c9ced8;
  --border-strong: #8a93a3;
  /* Hairlines between areas and around cards (decorative; fields keep --border). */
  --line: #e4e7ec;
  /* Light accent tint: current page, selected tiles, the preview canvas. */
  --tint: #ebeefd;
  --canvas: #eef0fb;
  --primary: #1f4fd1;
  --primary-hover: #183fa8;
  --primary-text: #ffffff;
  --danger: #b42318;
  --danger-hover: #912018;
  --danger-text: #ffffff;
  --success-bg: #e8f5ec;
  --success-text: #14532d;
  --info-bg: #e8effc;
  --info-text: #1e3a8a;
  --warning-bg: #fff4e0;
  --warning-text: #7a3e00;
  --error-bg: #fdecea;
  --error-text: #8a1c12;
  --focus: #1f4fd1;
  --radius: 8px;
  --radius-card: 14px;
  /* Width of the centred frame: sidebar and content. */
  --frame: 86rem;
  --shadow: 0 1px 2px rgb(16 24 40 / 4%), 0 2px 8px rgb(16 24 40 / 6%);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

/* Dark mode (S4): the account setting wins (data-theme), "system" follows the device. Every pair
   below keeps WCAG 2.2 AA contrast (checked with axe in the e2e suite). */
:root[data-theme='dark'] {
  --bg: #0f1216;
  --surface: #171b21;
  --surface-muted: #222831;
  --text: #e8ebf0;
  --text-muted: #aeb6c2;
  --border: #3b434e;
  --border-strong: #7c8696;
  --line: #2a313b;
  --tint: #1c2742;
  --canvas: #141a27;
  --primary: #8eb0ff;
  --primary-hover: #b0c8ff;
  --primary-text: #0b1020;
  --danger: #ff8f86;
  --danger-hover: #ffb0a9;
  --danger-text: #1d0605;
  --success-bg: #10291b;
  --success-text: #93e2ad;
  --info-bg: #15233f;
  --info-text: #b3cbff;
  --warning-bg: #2e2108;
  --warning-text: #f6c873;
  --error-bg: #3a1412;
  --error-text: #ffb8b0;
  --focus: #b0c8ff;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 1px 3px rgb(0 0 0 / 50%);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme='system'] {
    --bg: #0f1216;
    --surface: #171b21;
    --surface-muted: #222831;
    --text: #e8ebf0;
    --text-muted: #aeb6c2;
    --border: #3b434e;
    --border-strong: #7c8696;
    --line: #2a313b;
    --tint: #1c2742;
    --canvas: #141a27;
    --primary: #8eb0ff;
    --primary-hover: #b0c8ff;
    --primary-text: #0b1020;
    --danger: #ff8f86;
    --danger-hover: #ffb0a9;
    --danger-text: #1d0605;
    --success-bg: #10291b;
    --success-text: #93e2ad;
    --info-bg: #15233f;
    --info-text: #b3cbff;
    --warning-bg: #2e2108;
    --warning-text: #f6c873;
    --error-bg: #3a1412;
    --error-text: #ffb8b0;
    --focus: #b0c8ff;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 1px 3px rgb(0 0 0 / 50%);
    color-scheme: dark;
  }
}

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

html {
  font-family: var(--font);
  font-size: 100%;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.75rem;
}

h1 {
  font-size: 1.75rem;
}

h2 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
}

h3 {
  font-size: 1.05rem;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--primary);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--primary-hover);
}

code,
pre,
kbd {
  font-family: var(--mono);
  font-size: 0.875rem;
}

pre {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  overflow-x: auto;
  white-space: pre;
}

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

/* `hidden` always wins over component display rules (.help, .alert, flex rows, ...). */
[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  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: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
}

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

/* ---- Shell ---------------------------------------------------------------------------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}

.public-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
}

.public-main {
  flex: 1;
  padding: 2rem 1rem;
}

/* Dashboard shell (ADR 0026, light since ADR 0029): a top bar across the page, a light sidebar
   with icon links, the current page as a tinted pill. */
.app-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 4rem;
  /* Aligned with the centred frame below: the brand sits above the sidebar. */
  padding: 0 max(2rem, calc((100% - var(--frame)) / 2 + 2rem));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar .brand {
  font-size: 1.15rem;
}

.app-frame {
  flex: 1;
  display: flex;
  width: 100%;
  max-width: var(--frame);
  min-height: 0;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.sidebar {
  flex: 0 0 17rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 2rem 0.75rem;
  position: sticky;
  top: 4rem;
  height: calc(100vh - 4rem);
  overflow-y: auto;
}

.sidebar__toggle {
  display: none;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.sidebar__heading {
  margin: 0 0 0.4rem;
  padding: 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.sidebar__nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sidebar__nav a {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-height: 2.75rem;
  padding: 0.4rem 0.75rem;
  border-radius: 10px;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}

.sidebar__nav a .icon {
  color: var(--text-muted);
}

.sidebar__nav a:hover {
  background: var(--surface-muted);
}

.sidebar__nav a[aria-current='page'] {
  background: var(--tint);
  color: var(--primary);
  font-weight: 600;
}

.sidebar__nav a[aria-current='page'] .icon {
  color: var(--primary);
}

.icon {
  flex: none;
}

/* Site switcher and account menu: <details> drop-downs. */
.menu {
  position: relative;
}

.menu > summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  list-style: none;
}

.menu > summary::-webkit-details-marker {
  display: none;
}

.menu > summary .icon {
  margin-left: auto;
  color: var(--text-muted);
  transition: transform 0.15s;
}

.menu[open] > summary .icon {
  transform: rotate(180deg);
}

.site-switch > summary {
  min-height: 3.25rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.site-switch > summary:hover {
  border-color: var(--border);
}

.site-switch__avatar,
.account-menu__avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: var(--tint);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
}

.account-menu {
  margin-left: auto;
}

.account-menu > summary {
  gap: 0.35rem;
  min-height: 2.75rem;
  padding: 0.25rem;
  border-radius: 999px;
}

.account-menu > summary .icon {
  margin-left: 0;
}

.account-menu__avatar {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-text);
}

.site-switch__name {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.site-switch__name > * {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-switch__name span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.menu__list {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  margin: 0.35rem 0 0;
  padding: 0.35rem;
  list-style: none;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgb(15 23 41 / 16%);
  display: flex;
  flex-direction: column;
}

.account-menu .menu__list {
  left: auto;
  right: 0;
  width: 17rem;
}

.account-menu__who {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.6rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.account-menu__who span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.menu__list a,
.menu__button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.45rem 0.6rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu__list a:hover,
.menu__button:hover,
.menu__list a[aria-current] {
  background: var(--surface-muted);
}

.menu__separator {
  border-top: 1px solid var(--line);
  margin-top: 0.3rem;
  padding-top: 0.3rem;
}

.menu__list .org-switch {
  flex-direction: column;
  align-items: stretch;
  padding: 0.45rem 0.6rem;
}

.org-switch__row {
  display: flex;
  gap: 0.4rem;
}

.app-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: 76rem;
  padding: 2rem 0 2rem clamp(1rem, 3vw, 3rem);
}

.app-main--wide {
  max-width: none;
}

/* Small screens: the sidebar folds behind "Menu" in the top bar. */
@media (max-width: 60rem) {
  .app-frame {
    flex-direction: column;
  }

  .app-frame {
    padding: 0 1rem;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-basis: auto;
    padding: 1rem 0;
    border-bottom: 1px solid var(--line);
  }

  .app-main {
    padding-left: 0;
  }

  .app-shell[data-collapsible] .sidebar__toggle {
    display: inline-flex;
  }

  .app-shell[data-collapsible]:not([data-open]) .sidebar {
    display: none;
  }
}

.site-footer {
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
}

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

.page-header h1 {
  margin: 0;
}

/* Large page title of the list pages. */
.page-title {
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.02em;
}

.page-header__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.page-header__meta {
  margin: 0.4rem 0 0;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

/* Status pills (live, draft, unsaved changes). */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.1rem 0.65rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.pill--success {
  background: var(--success-bg);
  color: var(--success-text);
}

.pill--warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.pill--neutral {
  background: var(--surface-muted);
  color: var(--text-muted);
}

.breadcrumb {
  margin: 0 0 0.5rem;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.breadcrumb li + li::before {
  content: '/';
  margin-right: 0.25rem;
  color: var(--text-muted);
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card--narrow {
  max-width: 28rem;
  margin: 0 auto;
}

.card > :last-child {
  margin-bottom: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1rem 1.5rem;
}

.stack > * + * {
  margin-top: 1rem;
}

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

.small {
  font-size: 0.875rem;
}

/* ---- Buttons ---------------------------------------------------------------------------- */

.button,
button {
  font: inherit;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0.45rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.button--primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-text);
}

.button--primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--primary-text);
}

.button--danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--danger-text);
}

.button--danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
  color: var(--danger-text);
}

.button--link {
  border: 0;
  background: none;
  padding: 0;
  min-height: auto;
  color: var(--primary);
  font-weight: 400;
  text-decoration: underline;
}

.button--link:hover {
  background: none;
  color: var(--primary-hover);
}

.button--small {
  min-height: 2rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.875rem;
}

.button[disabled],
.button[aria-disabled='true'] {
  opacity: 0.6;
  cursor: not-allowed;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.inline-form {
  display: inline;
}

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

.field {
  margin-bottom: 1.1rem;
}

.field > label,
.field legend,
.label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem 0.25rem;
  margin: 0 0 1.25rem;
}

legend {
  padding: 0 0.25rem;
  font-weight: 600;
}

input[type='text'],
input[type='email'],
input[type='password'],
input[type='url'],
input[type='number'],
input[type='search'],
input[type='date'],
select,
textarea {
  display: block;
  width: 100%;
  max-width: 40rem;
  min-height: 2.5rem;
  padding: 0.45rem 0.65rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}

textarea {
  min-height: 5rem;
  resize: vertical;
}

input[type='color'] {
  width: 3rem;
  height: 2.5rem;
  padding: 0.15rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

input[aria-invalid='true'],
select[aria-invalid='true'],
textarea[aria-invalid='true'] {
  border-color: var(--danger);
  border-width: 2px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.check input {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.2rem;
  flex: none;
}

.check label {
  font-weight: 400;
}

.help {
  display: block;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.3rem;
}

.errors {
  margin: 0.3rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--error-text);
  font-size: 0.875rem;
  font-weight: 600;
}

.form-errors {
  margin-bottom: 1rem;
}

/* ---- Alerts, badges --------------------------------------------------------------------- */

.alert {
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.alert--success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: currentcolor;
}

.alert--info {
  background: var(--info-bg);
  color: var(--info-text);
  border-color: currentcolor;
}

.alert--warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: currentcolor;
}

.alert--error {
  background: var(--error-bg);
  color: var(--error-text);
  border-color: currentcolor;
}

.alert > :last-child {
  margin-bottom: 0;
}

.badge {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--border);
}

.badge--success {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: currentcolor;
}

.badge--warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: currentcolor;
}

/* ---- Tables ----------------------------------------------------------------------------- */

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

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

th,
td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  font-weight: 600;
  background: var(--surface-muted);
}

caption {
  text-align: left;
  font-weight: 600;
  padding-bottom: 0.5rem;
}

/* ---- Dialog ----------------------------------------------------------------------------- */

dialog {
  max-width: min(36rem, calc(100vw - 2rem));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 20px 40px rgb(16 24 40 / 25%);
}

dialog::backdrop {
  background: rgb(16 24 40 / 55%);
}

@media (prefers-reduced-motion: no-preference) {
  .button,
  .app-nav a,
  .tabs a {
    transition:
      background-color 120ms ease,
      color 120ms ease;
  }
}

@media (max-width: 40rem) {
  .app-main {
    padding: 1rem;
  }

  .card {
    padding: 1rem;
  }
}

.details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1.5rem;
  margin: 0 0 1rem;
}

.details dt {
  font-weight: 600;
}

.details dd {
  margin: 0;
}

.org-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.org-switch select {
  min-height: 2rem;
  padding: 0.2rem 0.5rem;
  width: auto;
}

.card > h1:first-child,
.card > h2:first-child,
section.card > h2:first-of-type {
  margin-top: 0;
}

.actions:not(:last-child) {
  margin-bottom: 1.25rem;
}

/* ---- Banner editor (ADR 0026, regrouped in ADR 0028) ----------------------------------- */

/* Header card: title, status and actions, the tabs along its bottom edge. It scrolls away (the
   preview stays); Ctrl/Cmd+S saves from anywhere. */
.editor-head {
  margin-bottom: 1.25rem;
  padding: 1rem 1.25rem 0;
}

.editor-head__top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.editor-head__top > :first-child {
  flex: 1 1 22rem;
  min-width: 0;
}

.editor-head .breadcrumb {
  margin-bottom: 0.15rem;
}

.editor-head__status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.editor-head__status h1 {
  margin: 0;
  font-size: 1.75rem;
}

.editor-head__subtitle {
  margin: 0.25rem 0 0;
}

.editor-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

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

.button--quiet:hover:not(:disabled) {
  background: var(--error-bg);
  color: var(--danger);
}

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

.editor-tabs {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.9rem;
  overflow-x: auto;
}

.editor-tabs [role='tab'] {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0 0.15rem;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.editor-tabs [role='tab']:hover {
  color: var(--text);
}

.editor-tabs [role='tab'][aria-selected='true'] {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Settings on the left, the preview on the right. */
.editor-body {
  display: grid;
  grid-template-columns: minmax(20rem, 25rem) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

/* Content is a page of its own, as in Cookiebot: languages and texts, no preview. */
.editor:has(#panel-content:not([hidden])) .editor-body {
  grid-template-columns: minmax(0, 1fr);
}

.editor:has(#panel-content:not([hidden])) .editor-preview {
  display: none;
}

/* Sticky while the settings scroll, never taller than the screen. */
.editor-preview {
  position: sticky;
  top: 5rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  margin: 0;
}

.editor-form {
  min-width: 0;
}

/* Collapsible blocks of settings, one open at a time, each with its icon. */
.editor-block {
  margin-bottom: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.editor-block > summary {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-height: 3.75rem;
  padding: 0.75rem 1.25rem;
  list-style: none;
  cursor: pointer;
}

.editor-block > summary::-webkit-details-marker {
  display: none;
}

.editor-block > summary .icon {
  color: var(--text-muted);
}

.editor-block > summary::after {
  content: '';
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  margin: 0 0.2rem 0 auto;
  border-right: 2px solid currentcolor;
  border-bottom: 2px solid currentcolor;
  transform: rotate(45deg);
  transition: transform 0.15s;
}

.editor-block[open] > summary {
  color: var(--primary);
}

.editor-block[open] > summary .icon {
  color: var(--primary);
}

.editor-block[open] > summary::after {
  transform: rotate(-135deg);
}

.editor-block > summary h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.editor-block > summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
  border-radius: var(--radius-card);
}

.editor-block[open] > .editor-block__body {
  border-top: 1px solid var(--line);
  margin: 0 1.25rem;
  padding: 1.25rem 0;
}

.editor-block__body {
  padding: 0 1.25rem 1.25rem;
}

/* (i) next to a label: the explanation opens on demand. */
.hint {
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  margin: -0.25rem 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  vertical-align: middle;
  cursor: pointer;
}

.hint:hover {
  color: var(--primary);
  background: var(--tint);
}

.hint__body {
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: min(24rem, calc(100vw - 2rem));
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 32px rgb(15 23 41 / 18%);
  font-weight: 400;
}

.hint__body:popover-open {
  display: block;
}

.editor-block__body > fieldset,
.editor-block__body > .field,
.editor-block__body > .check,
.editor-block__body > [data-controller] {
  margin-bottom: 1.25rem;
}

.editor-block__body h3 {
  margin: 1.25rem 0 0.6rem;
  font-size: 1rem;
}

.editor-form legend {
  font-weight: 600;
}

.editor-form .order-grid {
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}

@media (prefers-reduced-motion: reduce) {
  .editor-block > summary::after {
    transition: none;
  }
}

/* Layout tiles: Dialog, Compact, Bar — a picture with the name below, a check on the chosen. */
.layout-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.layout-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  text-align: center;
}

/* The radio covers the whole tile, invisible: clicks anywhere on the tile choose it. */
.tile-input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.layout-option label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  cursor: pointer;
}

.tile-picture {
  position: relative;
  display: block;
  width: 100%;
  padding: 0.45rem;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--surface-muted);
}

.layout-option label:hover .tile-picture {
  border-color: var(--border);
}

.tile-input:checked + label .tile-picture {
  border-color: var(--primary);
  background: var(--tint);
}

.tile-input:focus-visible + label .tile-picture {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.tile-check {
  position: absolute;
  left: -0.6rem;
  bottom: -0.6rem;
  display: none;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-text);
}

.tile-input:checked + label .tile-check {
  display: grid;
}

.layout-option .placement-thumb {
  border: 0;
  background: var(--surface);
}

.layout-option .badge {
  font-size: 0.75rem;
}

.placement-thumb.placement-thumb--small {
  width: 3rem;
  flex: none;
}

/* Colours: groups of round swatches with their code. */
.palette {
  margin-top: 0.75rem;
}

.colour-group {
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
}

.colour-group:first-of-type {
  border-top: 0;
}

.colour-group__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.colour-group__head h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

.colour-group .help {
  margin-top: 0;
}

.colour-field input[type='color'] {
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.colour-field input[type='color']::-webkit-color-swatch-wrapper {
  padding: 0;
}

.colour-field input[type='color']::-webkit-color-swatch {
  border: 0;
  border-radius: 50%;
}

.colour-field input[type='color']::-moz-color-swatch {
  border: 0;
  border-radius: 50%;
}

.colour-field__text {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.colour-field .errors {
  flex-basis: 100%;
}

.colour-hex {
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  text-transform: uppercase;
}

/* Logo: the upload area appears when "Display logo" is ticked. */
.logo-upload {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.logo-current {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
}

.logo-current img {
  max-width: 10rem;
  max-height: 3rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-muted);
}

.logo-current figcaption {
  margin: 0;
}

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1.5rem 1rem;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-muted);
  text-align: center;
  cursor: pointer;
}

.dropzone:hover,
.dropzone--over {
  border-color: var(--primary);
  background: var(--info-bg);
}

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

.dropzone[aria-busy='true'] {
  opacity: 0.6;
}

.dropzone__icon {
  color: var(--primary);
}

.dropzone__title {
  color: var(--primary);
  font-weight: 600;
}

.dropzone .help {
  margin: 0;
}

/* The real input covers the area, invisible, so clicking and dropping both reach it. */
.dropzone__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.field-error {
  margin: 0;
  color: var(--danger);
  font-weight: 600;
}

/* Content tab: a narrow Language card, the texts in a wide card next to it. */
.content-grid {
  display: grid;
  grid-template-columns: minmax(17rem, 22rem) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

.content-card {
  margin: 0;
}

.content-card h2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.15rem;
}

.content-languages h2 {
  margin: 0 0 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--primary);
}

.content-languages .check {
  align-items: center;
}

.content-languages__head {
  margin: 1.5rem 0 0.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
}

.language-list {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
}

.language-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.25rem 0.35rem 0.25rem 1rem;
  border-radius: 10px;
  background: var(--surface-muted);
}

.language-list li:has([aria-pressed='true']) {
  background: var(--tint);
  font-weight: 600;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.icon-button:hover,
.icon-button[aria-pressed='true'] {
  color: var(--primary);
}

.icon-button:hover {
  background: var(--surface);
}

.add-language > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0 1rem;
  border: 2px solid var(--primary);
  border-radius: 8px;
  color: var(--primary);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.add-language > summary::-webkit-details-marker {
  display: none;
}

.add-language[open] > summary {
  margin-bottom: 1rem;
}

.content-card .language-grid {
  grid-template-columns: minmax(0, 1fr);
}

.content-texts .intro-card {
  margin-bottom: 1.5rem;
}

.content-texts .intro-card h2 {
  font-size: 1.75rem;
}

.content-texts h3 {
  margin: 2rem 0 1rem;
  font-size: 1.2rem;
}

.content-texts .language-texts {
  margin: 0;
  padding: 0;
  border: 0;
}

.content-texts .language-texts > legend {
  margin-top: 2rem;
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  background: var(--tint);
  color: var(--primary);
  font-weight: 600;
}

/* Two columns of fields; long texts and titles take the full width. */
.text-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.text-grid__wide {
  grid-column: 1 / -1;
}

.consent-mode-mapping {
  margin-top: 1rem;
}

.consent-mode-mapping summary {
  cursor: pointer;
  font-weight: 600;
}

@media (max-width: 75rem) {
  .editor-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .content-grid,
  .text-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .editor-preview {
    position: static;
    max-height: none;
  }
}

/* Preview toolbar: switch for the settings window, language, device. */
.preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.field--inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.field--inline select {
  width: auto;
}

/* Segmented control from a radio group. */
.segmented {
  display: inline-flex;
  margin: 0;
  padding: 3px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-muted);
}

.segmented input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.segmented label {
  padding: 0.35rem 0.8rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.segmented input:checked + label {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.segmented input:focus-visible + label {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

/* A checkbox drawn as a switch (keeps the native input for keyboards and screen readers). */
.check--switch {
  align-items: center;
  margin: 0;
}

.check--switch input {
  appearance: none;
  flex: none;
  position: relative;
  width: 2.5rem;
  height: 1.45rem;
  margin: 0;
  border-radius: 999px;
  background: var(--border-strong);
  cursor: pointer;
  transition: background 0.15s;
}

.check--switch input::after {
  content: '';
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.15s;
}

.check--switch input:checked {
  background: var(--primary);
}

.check--switch input:checked::after {
  transform: translateX(1.05rem);
}

/* The preview frame as a browser window. */
.browser-chrome {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  height: 2.1rem;
  padding: 0 0.75rem;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
}

.browser-chrome > span:not(.browser-chrome__address) {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--border-strong);
}

.browser-chrome__address {
  flex: 1;
  margin-left: 0.6rem;
  padding: 0.05rem 0.7rem;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Look tab: colour styles as tiles. */
.style-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.style-option {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.25rem 0.5rem;
  padding: 0.6rem 0.7rem;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.style-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--tint);
}

.style-option input {
  margin: 0;
}

.style-option label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  cursor: pointer;
}

.style-option .help {
  grid-column: 1 / -1;
  margin: 0;
}

.style-swatch {
  flex: none;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
}

.style-swatch--light {
  background: #ffffff;
}

.style-swatch--dark {
  background: #18202e;
}

.style-swatch--device {
  background: linear-gradient(135deg, #ffffff 50%, #18202e 50%);
}

.style-swatch--custom {
  background: conic-gradient(#d4380d, #d4b106, #389e0d, #1f4fd1, #722ed1, #d4380d);
}

/* Cookie button tab: corners as tiles. */
.corner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.6rem;
}

.corner-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem;
  border: 2px solid var(--line);
  border-radius: 12px;
}

.corner-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--tint);
}

.corner-option input {
  margin: 0;
}

.corner-option label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.corner-thumb {
  position: relative;
  flex: none;
  width: 3rem;
  height: 2.2rem;
  border-radius: 5px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.corner-thumb > span {
  position: absolute;
  bottom: 0.25rem;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--primary);
}

.corner-thumb[data-position$='-start'] > span {
  left: 0.25rem;
}

.corner-thumb[data-position$='-end'] > span {
  right: 0.25rem;
}

.dialog {
  max-width: 28rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 1.5rem;
}

.dialog::backdrop {
  background: rgb(15 23 41 / 45%);
}

/* ---- Site overview (ADR 0026) ------------------------------------------------------------ */

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

.section-head h2 {
  margin: 0;
}

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

.setup__head h2,
.setup__head p {
  margin: 0;
}

.setup__bar {
  flex: 0 1 16rem;
  height: 0.5rem;
  accent-color: var(--success-text);
}

.setup__steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.setup-step {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--warning-bg);
}

.setup-step--done {
  background: var(--surface-muted);
}

.setup-step__title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}

.setup-step--done .setup-step__title {
  color: var(--success-text);
}

.setup-step__text {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.setup-step:not(.setup-step--done) .setup-step__text {
  color: var(--warning-text);
}

.overview-stats {
  margin-bottom: 1.5rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.75rem;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
  padding: 1rem;
}

.stat__label {
  color: var(--text-muted);
}

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

.stat__bar {
  width: 100%;
  height: 0.4rem;
}

.stat__bar--accept_all {
  accent-color: #1f7a3d;
}

.stat__bar--reject_all {
  accent-color: #1f4fd1;
}

.stat__bar--custom {
  accent-color: #8a5a00;
}

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

.overview-grid > .card {
  margin: 0;
}

.placement-thumb--large {
  width: 100%;
  max-width: 18rem;
  height: 7rem;
  margin-bottom: 1rem;
}

.change-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.change-list li {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}

.change-list li:last-child {
  border-bottom: 0;
}

.change-list time {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ---- Configurator ----------------------------------------------------------------------- */

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

.form-toolbar h2 {
  margin: 0;
}

.preview-notice {
  margin: 0.75rem 0 0;
}

/* Shown over the frame when the SDK could not render the banner (fail closed). */
.preview-unavailable {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 2rem;
  text-align: center;
  color: var(--warning-text);
  background: var(--warning-bg);
}

/* After a decision in the preview: what happened, and a restart. Top of the frame, so the
   "Cookie settings" button at the bottom stays visible and clickable. */
.preview-decision-region {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
}

.preview-decision {
  margin: 0;
  box-shadow: var(--shadow);
}

.preview-decision p {
  margin: 0 0 0.6rem;
}

.preview-decision[hidden],
.preview-decision p[hidden] {
  display: none;
}

.preview-unavailable[hidden] {
  display: none;
}

.preview-viewport {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-muted);
  margin: 0.75rem 0;
}

.preview-frame {
  display: block;
  width: 100%;
  height: 38rem;
  border: 0;
  background: #ffffff;
}

.preview-viewport--mobile {
  max-width: 390px;
  margin-left: auto;
  margin-right: auto;
}

.preview-issues ul {
  margin: 0.25rem 0 0.75rem;
  padding-left: 1.25rem;
}

.preview-issues .contrast {
  color: var(--warning-text);
}

/* Button order: each option is a mini banner in the site's colours (variables set per page). */
.order-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.order-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}

.order-option:hover {
  border-color: var(--border-strong);
}

.order-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--tint);
}

.order-option input {
  flex: none;
  margin: 0;
}

.order-swatch {
  display: flex;
  flex: 1;
  gap: 0.3rem;
  min-width: 0;
  padding: 0.45rem;
  border: 1px solid var(--mini-line);
  border-radius: calc(var(--mini-radius) + 3px);
  background: var(--mini-bg);
}

.mini-btn {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  padding: 0.3rem 0.35rem;
  border: 1.5px solid var(--mini-btn-line, var(--mini-btn));
  border-radius: var(--mini-radius);
  background: var(--mini-btn);
  color: var(--mini-btn-fg);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-btn--outline {
  background: var(--mini-btn2, transparent);
  color: var(--mini-btn2-fg, var(--mini-fg));
  border-color: var(--mini-btn2-line, var(--mini-fg));
}

/* Layout + position tiles: a radio per combination, with a thumbnail of where the banner sits. */
.placement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.placement-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  height: 100%;
  padding: 0.6rem;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}

.placement-option:hover {
  border-color: var(--border-strong);
}

.placement-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--tint);
}

.placement-choice {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}

.placement-choice input {
  flex: none;
  margin: 0.2rem 0 0;
}

.placement-name {
  font-weight: 600;
  line-height: 1.3;
}

.placement-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface-muted);
}

.placement-thumb > span {
  position: absolute;
  border-radius: 2px;
  background: var(--primary);
}

.placement-thumb[data-layout='bar'] > span {
  left: 0;
  right: 0;
  height: 24%;
}

.placement-thumb[data-position='bottom'] > span,
.placement-thumb[data-position^='bottom-'] > span {
  bottom: 7%;
}

.placement-thumb[data-position='top'] > span,
.placement-thumb[data-position^='top-'] > span {
  top: 7%;
}

.placement-thumb[data-layout='bar'][data-position='bottom'] > span {
  bottom: 0;
}

.placement-thumb[data-layout='bar'][data-position='top'] > span {
  top: 0;
}

.placement-thumb[data-layout='box'] > span {
  width: 38%;
  height: 34%;
}

/* Left and right as seen in left-to-right languages (start/end in the config). */
.placement-thumb[data-position$='-start'] > span {
  left: 6%;
}

.placement-thumb[data-position$='-end'] > span {
  right: 6%;
}

.placement-thumb[data-layout='modal'] > span {
  top: 24%;
  left: 25%;
  width: 50%;
  height: 52%;
}

.localized {
  border-style: dashed;
}

.field--inline {
  display: grid;
  grid-template-columns: minmax(7rem, max-content) minmax(0, 1fr);
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.6rem;
}

.label--language {
  font-weight: 400;
}

.category {
  border-width: 2px;
}

.cookie {
  background: var(--surface-muted);
}

.cookies-heading {
  margin-top: 1rem;
}

.language-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0 1rem;
}

.language-texts {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}

.language-texts summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.25rem 0;
}

.theme-reset {
  margin-bottom: 1.25rem;
}

.custom-colours {
  margin-bottom: 1.25rem;
}

.custom-colours > .check {
  margin-bottom: 0.75rem;
}

/* Look tab, "light and dark": a segmented switch between the two palettes. */
.palette-tabs {
  display: inline-flex;
  gap: 0.25rem;
  margin: 0.25rem 0 0.5rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: var(--surface-muted);
}

.palette-tabs[hidden] {
  display: none;
}

.palette-tabs [role='tab'] {
  min-height: 2.25rem;
  padding: 0.35rem 0.9rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.palette-tabs [role='tab'][aria-selected='true'] {
  border-color: var(--primary);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.palette-tabs [role='tab']:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.colour-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.25rem 1rem;
}

.colour-field {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.colour-field label {
  font-weight: 400;
  margin: 0;
}

@media (max-width: 64rem) {
  .configurator {
    grid-template-columns: minmax(0, 1fr);
  }

  .configurator__preview {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
}

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

.plan--current {
  border: 2px solid var(--primary);
}

.plan__price {
  font-size: 1.25rem;
  font-weight: 700;
}

/* ---- Consent log ------------------------------------------------------------------------ */

.chart {
  margin: 0 0 1rem;
}

.chart svg {
  width: 100%;
  height: auto;
  max-height: 16rem;
  color: var(--text-muted);
}

.legend,
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.choices {
  flex-direction: column;
  gap: 0;
  font-size: 0.9rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1rem;
  align-items: flex-end;
}

.filters .field input,
.filters .field select {
  width: auto;
}

.pagination {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
}

.proof {
  max-width: 50rem;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  background: var(--surface);
}

@media print {
  .no-print,
  .skip-link {
    display: none;
  }

  body,
  .proof {
    background: #ffffff;
    color: #000000;
  }

  pre {
    white-space: pre-wrap;
    word-break: break-all;
  }
}

.secret {
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  word-break: break-all;
}

.recovery-codes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.25rem 1rem;
  padding: 0;
  list-style: none;
  font-size: 1.05rem;
}

.inline-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.inline-row select {
  width: auto;
}

/* ---- "Add a site" setup and install guides (ADR 0027) --------------------------------- */

.focus-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 4vw, 3rem);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.focus-header__end {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.focus-header__user {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-text);
  font-weight: 700;
}

.focus-main {
  flex: 1;
  width: 100%;
  padding: 2rem clamp(1rem, 4vw, 3rem) 3rem;
}

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

.onboarding__head {
  text-align: center;
  margin-bottom: 2rem;
}

.onboarding__head h1 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  margin-bottom: 0.4rem;
}

.onboarding__head .setup-stepper {
  justify-content: center;
  margin-bottom: 1.25rem;
}

.onboarding__grid {
  display: grid;
  grid-template-columns: minmax(0, 26rem) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: center;
}

.onboarding__grid--setup {
  grid-template-columns: minmax(0, 27rem) minmax(0, 1fr);
  align-items: start;
}

.onboarding__form input[type='text'] {
  min-height: 3rem;
  font-size: 1.05rem;
}

.onboarding__label {
  font-size: 1rem;
  margin: 1.5rem 0 0.75rem;
}

.onboarding__art {
  display: grid;
  place-items: center;
}

.onboarding__art svg {
  max-width: 100%;
  height: auto;
}

.art-orbit {
  transform-origin: 180px 160px;
  animation: art-spin 40s linear infinite;
}

.art-shield {
  animation: art-float 4s ease-in-out infinite;
}

@keyframes art-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes art-float {
  50% {
    translate: 0 -6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .art-orbit,
  .art-shield {
    animation: none;
  }
}

.onboarding__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 2rem;
}

.button--large {
  min-height: 3rem;
  min-width: 14rem;
  font-size: 1.05rem;
}

.link-button {
  border: 0;
  padding: 0.25rem;
  background: none;
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* Setup stepper: 1 ─ 2 ─ 3. */
.setup-stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.setup-stepper__step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
}

.setup-stepper__dot {
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  font-size: 0.85rem;
  font-weight: 700;
  transition:
    background 0.3s,
    border-color 0.3s,
    color 0.3s;
}

.setup-stepper__step[data-state='active'] {
  color: var(--text);
  font-weight: 600;
}

.setup-stepper__step[data-state='active'] .setup-stepper__dot {
  border-color: var(--primary);
  color: var(--primary);
}

.setup-stepper__step[data-state='done'] .setup-stepper__dot {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-text);
}

.onboarding__form .setup-stepper {
  gap: 0.5rem 0.9rem;
  font-size: 0.92rem;
}

/* Preparation steps: waiting, working (spinner), done (check). */
.scan-findings {
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.scan-findings li {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  transition: opacity 0.3s;
}

.scan-findings li::before {
  content: '' / '';
  flex: none;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  translate: 0 0.15rem;
}

.scan-findings li[data-state='todo'] {
  opacity: 0.45;
}

.scan-findings li[data-state='active']::before {
  border-color: var(--primary);
  border-right-color: transparent;
  animation: scan-spin 0.8s linear infinite;
}

.scan-findings li[data-state='done']::before {
  content: '✓' / '';
  display: grid;
  place-items: center;
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-text);
  font-size: 0.7rem;
  font-weight: 700;
}

@keyframes scan-spin {
  to {
    rotate: 360deg;
  }
}

/* Recommendation card. */
.recommend {
  margin: 0;
}

.recommend__title {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
}

.recommend__list {
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.recommend__list > div {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
}

.recommend__list dt {
  color: var(--text-muted);
}

.recommend__list dd {
  margin: 0;
  font-weight: 600;
}

.recommend__edit {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.recommend__edit summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chip {
  padding: 0.1rem 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.chip--strong {
  border-color: var(--primary);
  color: var(--primary);
}

.colour-input {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.colour-input input[type='color'] {
  width: 3rem;
  height: 2.5rem;
  padding: 0.15rem;
}

.colour-input input[type='text'] {
  width: 8rem;
  font-family: var(--mono);
}

.recommend-preview .preview-viewport {
  margin-top: 0.5rem;
}

@media (max-width: 60rem) {
  .onboarding__grid,
  .onboarding__grid--setup {
    grid-template-columns: minmax(0, 1fr);
  }

  .onboarding__art {
    display: none;
  }
}

/* Install guides: the way the site is built on the left, the steps on the right. */
.guides {
  display: grid;
  grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr);
  gap: 1.5rem;
}

.guides__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-right: 1px solid var(--border);
  padding-right: 1rem;
}

.guides__nav [role='tab'] {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 2.6rem;
  padding: 0.4rem 0.75rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.guides__nav [role='tab']::after {
  /* Decorative chevron, kept out of the tab's accessible name. */
  content: '›' / '';
  color: var(--text-muted);
}

.guides__nav [role='tab']:hover {
  background: var(--surface-muted);
}

.guides__nav [role='tab'][aria-selected='true'] {
  background: var(--info-bg);
  color: var(--info-text);
}

.guides__divider {
  margin: 0.6rem 0 0.2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.guides__all {
  margin-top: 0.6rem;
  border-top: 1px solid var(--border) !important;
  border-radius: 0 !important;
}

.guides__status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  padding: 0.6rem 0;
  margin-bottom: 1rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.guides__status form {
  margin-left: auto;
}

.guide h3 {
  margin-top: 0;
}

.guide__steps {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.guide__step {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.75rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.guide__step p {
  margin: 0 0 0.5rem;
}

.guide__step p:last-child {
  margin-bottom: 0;
}

.guide__number {
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.85rem;
}

.code-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.code-box pre {
  width: 100%;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
  background: var(--surface);
}

.guide__example {
  margin-top: 0.75rem;
}

.guide__example summary {
  cursor: pointer;
  font-weight: 600;
}

.placement-example mark {
  display: block;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--info-bg);
  color: var(--info-text);
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-grid__item {
  width: 100%;
  min-height: 3.25rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.guide-grid__item:hover {
  border-color: var(--primary);
}

.share-box {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--info-bg);
  color: var(--info-text);
}

.share-box .help {
  color: inherit;
  margin: 0.2rem 0 0;
}

.share-box__form summary {
  list-style: none;
  color: var(--info-text);
}

.share-box__form summary::-webkit-details-marker {
  display: none;
}

.share-box__form form {
  margin-top: 0.75rem;
}

@media (max-width: 50rem) {
  .guides {
    grid-template-columns: minmax(0, 1fr);
  }

  .guides__nav {
    border-right: 0;
    padding-right: 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
  }
}

/* Inside editor blocks, groups of fields need no frame of their own: the block is the frame. */
.editor-block fieldset,
.content-card fieldset {
  min-width: 0;
  margin: 0 0 1.5rem;
  padding: 0;
  border: 0;
}

.editor-block fieldset > legend,
.content-card fieldset > legend {
  margin-bottom: 0.6rem;
  padding: 0;
}

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

.editor-block .corner-option label {
  min-width: 0;
}

/* ---- All sites (ADR 0029) --------------------------------------------------------------- */

.intro-card {
  margin-bottom: 1.25rem;
  padding: 1.75rem 2rem;
  border-radius: var(--radius-card);
  background: var(--surface-muted);
}

.intro-card h2 {
  margin: 0 0 0.6rem;
  font-size: 1.4rem;
}

.intro-card p {
  max-width: 48rem;
  margin: 0;
}

.limit-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.25rem;
  margin-bottom: 1.75rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-card);
  background: var(--tint);
}

.limit-card__icon {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 10px;
  background: var(--surface);
  color: var(--primary);
}

.limit-card__icon .icon {
  width: 1.6rem;
  height: 1.6rem;
}

.limit-card__text {
  flex: 1 1 18rem;
}

.limit-card h2 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

.limit-card p {
  margin: 0;
}

.list-search {
  position: relative;
  max-width: 24rem;
  margin-bottom: 1rem;
}

.list-search input {
  width: 100%;
  min-height: 3rem;
  padding-right: 3rem;
}

.list-search__button {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  transform: translateY(-50%);
  cursor: pointer;
}

.list-search__button:hover {
  background: var(--surface-muted);
}

/* Rows as light cards; the whole row opens the site (the name link covers it). */
.site-table {
  border-collapse: separate;
  border-spacing: 0 0.5rem;
}

.site-table th {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
}

.site-table tbody tr {
  position: relative;
  background: var(--surface);
}

.site-table tbody tr:hover {
  background: var(--tint);
}

.site-table td {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 1rem;
  vertical-align: middle;
}

.site-table td:first-child {
  border-left: 1px solid var(--line);
  border-radius: 12px 0 0 12px;
}

.site-table td:last-child {
  border-right: 1px solid var(--line);
  border-radius: 0 12px 12px 0;
}

.site-table td .small {
  display: block;
}

.site-table__link {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.site-table__link::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
}

.site-table__link:focus-visible {
  outline: none;
}

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

.site-table__chevron {
  width: 3rem;
  color: var(--text-muted);
  text-align: right;
}

/* Preview state: banner or "after a decision"; the explanation shows with the second. */
.preview-state-help {
  display: none;
  margin: -0.25rem 0 0.5rem;
}

.editor-preview:has(#preview-state-decided:checked) .preview-state-help {
  display: block;
}

/* In the editor the whole preview page fits the screen, so its bottom corners (where the cookie
   button sits) are always visible, also on laptops. */
.editor .preview-frame {
  height: clamp(18rem, calc(100vh - 26rem), 38rem);
}

/* After a decision only the cookie button is left: a short page keeps its corner in sight. */
.editor-preview:has(#preview-state-decided:checked):not(:has(#preview-layer:checked))
  .preview-frame {
  height: 20rem;
}

.editor-preview .preview-toolbar {
  margin-bottom: 0.6rem;
}

.editor-preview .field--inline {
  margin: 0;
}

.editor-preview .preview-notice {
  margin: 0 0 0.6rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.9rem;
}
