.beheer-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
  }

  /* Header: brand, nav and who's logged in; wraps on phones. */
  .beheer-header {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 1rem 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.5rem;
    border-bottom: 1px solid var(--line);
  }
  .beheer-brand {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding-bottom: 0.5rem;
  }
  .beheer-brand .brand {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--accent);
    text-decoration: none;
  }
  .beheer-brand .brand-sub {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold);
  }
  .beheer-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.125rem;
    order: 3;
    width: 100%;
  }
  .beheer-header nav a {
    display: inline-block;
    padding: 0.6rem 0.6rem;
    color: var(--fg);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-size: 1rem;
  }
  .beheer-header nav a[aria-current='page'] {
    color: var(--accent);
    font-weight: 600;
    border-bottom-color: var(--accent);
  }
  .who {
    margin: 0 0 0.5rem auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }
  .who-chip {
    display: inline-flex;
    gap: 0.5rem;
    align-items: baseline;
    padding: 0.3rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.95rem;
  }
  @media (min-width: 900px) {
    .beheer-header nav {
      order: 0;
      width: auto;
      flex: 1;
    }
    .who {
      margin-bottom: 0.5rem;
    }
  }

  /* Working area: wider than the guest pages, slightly smaller type for dense tables. */
  main.beheer {
    flex-grow: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
    font-size: 17px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }
  .beheer-head {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }
  .beheer-head h1 {
    font-size: clamp(2rem, 4.5vw, 2.75rem);
    margin: 0;
  }
  .beheer-head .lede {
    color: var(--muted);
    margin: 0;
    max-width: 680px;
  }
  main.beheer h2 {
    font-size: 1.75rem;
    margin: 0 0 0.25rem;
  }
  main.beheer h3 {
    font-size: 1.35rem;
    margin: 0 0 0.25rem;
  }
  main.beheer section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }
  main.beheer section > p,
  main.beheer section > h2 {
    margin: 0;
  }
  main.beheer code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9em;
    padding: 0.1em 0.4em;
    border-radius: 4px;
    background: var(--accent-soft);
    white-space: nowrap;
  }

  /* Tables sit on a surface card and scroll sideways on phones instead of widening the page. */
  main.beheer .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
  }
  main.beheer table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.95rem;
  }
  main.beheer th,
  main.beheer td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
  }
  main.beheer th {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gold);
    background: var(--bg);
    white-space: nowrap;
  }
  main.beheer tbody th {
    font-size: inherit;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: inherit;
    background: none;
    white-space: normal;
  }
  main.beheer tbody tr:last-child td {
    border-bottom: 0;
  }
  main.beheer tbody tr:hover td {
    background: #faf7f1;
  }
  main.beheer td .muted {
    font-size: 0.9em;
  }
  main.beheer td.num,
  main.beheer th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
  }

  /* Forms */
  main.beheer label {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
  }
  main.beheer label > input,
  main.beheer label > select,
  main.beheer label > textarea {
    margin-top: 0.25rem;
    font-weight: 400;
  }
  main.beheer label.inline,
  main.beheer label:has(> input[type='checkbox']),
  main.beheer label:has(> input[type='radio']) {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
  }
  main.beheer input[type='checkbox'],
  main.beheer input[type='radio'] {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: var(--accent);
    margin: 0;
  }
  main.beheer input[type='text'],
  main.beheer input[type='tel'],
  main.beheer input[type='url'],
  main.beheer input[type='date'],
  main.beheer input[type='number'],
  main.beheer input[type='password'],
  main.beheer select,
  main.beheer textarea {
    width: 100%;
    min-height: 44px;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #fff;
    font-size: 1rem;
  }
  main.beheer textarea {
    line-height: 1.45;
  }
  main.beheer fieldset {
    min-width: 0;
    margin: 0;
    padding: 1rem 1.25rem 1.25rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    display: grid;
    gap: 0.75rem;
  }
  main.beheer legend {
    padding: 0 0.4rem;
    font-family: var(--font-display);
    font-size: 1.3rem;
  }
  main.beheer .field-row {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
  main.beheer .form {
    display: grid;
    gap: 0.75rem;
    max-width: 680px;
  }
  main.beheer .toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
  }
  main.beheer .toolbar > input,
  main.beheer .toolbar > select {
    width: auto;
    flex: 1 1 160px;
    max-width: 320px;
  }
  main.beheer .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
  }

  /* Buttons: the global accent button, plus outline and danger variants and link-styled ones. */
  main.beheer button,
  main.beheer .btn {
    min-height: 44px;
    padding: 0.45rem 1.1rem;
    font-size: 1rem;
  }
  main.beheer button.secondary,
  main.beheer .btn-outline {
    min-height: 44px;
    background: transparent;
    color: var(--accent);
    border: 1.5px solid var(--accent);
  }
  main.beheer button.danger {
    background: var(--error);
    color: #fff;
  }
  main.beheer button.small {
    min-height: 36px;
    padding: 0.25rem 0.75rem;
    font-size: 0.9rem;
  }
  main.beheer button.link,
  .beheer-header button.link {
    min-height: auto;
    padding: 0;
    background: none;
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
  }
  main.beheer button[disabled] {
    opacity: 0.55;
    cursor: default;
  }

  /* Tabs, badges, stat tiles, details */
  main.beheer .tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.25rem;
    border-bottom: 1px solid var(--line);
  }
  main.beheer .tabs a,
  main.beheer .tabs button {
    min-height: auto;
    padding: 0.5rem 0.75rem;
    background: none;
    color: var(--fg);
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    text-decoration: none;
    font-weight: 400;
  }
  main.beheer .tabs a[aria-current='page'],
  main.beheer .tabs button[aria-pressed='true'] {
    color: var(--accent);
    font-weight: 600;
    border-bottom-color: var(--accent);
  }
  .badge {
    display: inline-block;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    background: var(--accent-soft);
    color: var(--accent);
    white-space: nowrap;
  }
  .badge.ok {
    background: #e3eee0;
    color: var(--ok);
  }
  .badge.warn {
    background: #f3e9d2;
    color: var(--gold);
  }
  .badge.off {
    background: var(--error-bg);
    color: var(--error);
  }
  .badge.muted {
    background: #ece7de;
    color: var(--muted);
  }
  .stats {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
  .stat {
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
  }
  .stat .value {
    font-family: var(--font-display);
    font-size: 2.25rem;
    line-height: 1.05;
    margin: 0;
  }
  .stat .sub {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
  }
  main.beheer details {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 0.75rem 1.25rem;
  }
  main.beheer details[open] {
    padding-bottom: 1.25rem;
  }
  main.beheer summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--accent);
  }
  main.beheer .error {
    color: var(--error);
  }
  main.beheer .ok {
    color: var(--ok);
  }
  main.beheer .cols {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    align-items: start;
  }
  main.beheer .list {
    margin: 0;
    padding-left: 1.25rem;
    display: grid;
    gap: 0.4rem;
  }
  main.beheer .grow {
    flex-grow: 1;
  }
  main.beheer .actions a,
  main.beheer .toolbar a {
    font-weight: 600;
  }
  main.beheer .actions a:has(> button) {
    text-decoration: none;
  }
  main.beheer .card h4 {
    margin: 0;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gold);
  }
  main.beheer pre.message {
    margin: 0;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    background: var(--accent-soft);
    font-family: var(--font-body);
    font-size: 0.95rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }