/*
  Structure and shared primitives. Every value is a var(--zm-*) from
  tokens.css; the only literals are 0, 1, 100% and fr, which are structure.
*/
body {
  font-family: var(--zm-font-family);
  font-size: var(--zm-font-size-body);
  line-height: var(--zm-line-height);
  color: var(--zm-color-ink);
  background: var(--zm-color-surface-sunken);
}

/* The screen: a top bar over four columns: steps, werklijst, dossier, result.
   data-fase on the shell narrows it to the stage being shown (below). */
.zm-shell {
  display: grid;
  grid-template-columns: var(--zm-width-steps) var(--zm-width-list) minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: var(--zm-height-topbar) 1fr;
  grid-template-areas:
    "top top top top"
    "steps list dossier result";
  min-height: 100vh;
  background: var(--zm-color-surface);
  /* A column sliding in from the right would stick out for a moment and
     flash scroll bars; clip, unlike hidden, makes no scroll container. */
  overflow-x: clip;
}
.zm-topbar { grid-area: top; }
.zm-lade--steps { grid-area: steps; }
.zm-lade--list { grid-area: list; }
.zm-dossier { grid-area: dossier; }
.zm-result { grid-area: result; }

/* Every column has a surface of its own, so no part of the page shows the
   body behind it: the steps column had none, and the dossier the sunken
   one, which read as empty grey space beside the werklijst. */
.zm-steps, .zm-werklijst, .zm-dossier, .zm-result {
  padding: var(--zm-space-4);
  border-right: var(--zm-border-width) solid var(--zm-color-border);
  overflow-y: auto;
  background: var(--zm-color-surface);
}
/* The columns under the top bar, as one element only to make them inert
   together while the server cannot be reached; it adds no box of its own. */
.zm-shell__work { display: contents; }
.zm-shell__work[inert] > * { opacity: var(--zm-opacity-inert); }
.zm-dossier > * + *, .zm-result > * + * { margin-top: var(--zm-space-4); }
/* The dossier's title, with where what it shows came from beside it. */
.zm-dossier__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--zm-space-3); }

/* The screen a stage at a time (Model/Fase): a list of cases or a werklijst,
   the steps folded to a rail (all cases is where it opens); the dossier and
   its result, the werklijst folded too. A folded column opens over the
   screen (Lade). */
.zm-shell[data-fase="lijst"] {
  grid-template-columns: var(--zm-width-rail) minmax(0, 1fr);
  grid-template-areas: "top top" "steps list";
}
.zm-shell[data-fase="dossier"] {
  grid-template-columns: var(--zm-width-rail) var(--zm-width-rail) minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "top top top top" "steps list dossier result";
}
/* A case from a list of cases has no result column: its dossier takes the room. */
.zm-shell--zonder-resultaat[data-fase="dossier"] {
  grid-template-areas: "top top top top" "steps list dossier dossier";
}
/* A list alone on a wide screen keeps a width that reads. */
.zm-shell[data-fase="lijst"] .zm-werklijst > * { max-width: var(--zm-width-keuze); }

/* Between stages (js/overgang.js): a choice slides the new screen in from
   the right and presses the old one together to the left, where it folds
   to a rail; going up does the reverse. The top bar has a view transition
   name of its own, so it stands still. */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: var(--zm-duration-stage);
  animation-timing-function: ease-in-out;
}
:root[data-overgang="dieper"]::view-transition-old(root) { animation-name: zm-indrukken; transform-origin: left; }
:root[data-overgang="dieper"]::view-transition-new(root) { animation-name: zm-van-rechts; }
:root[data-overgang="terug"]::view-transition-old(root) { animation-name: zm-naar-rechts; }
:root[data-overgang="terug"]::view-transition-new(root) { animation-name: zm-uitrekken; transform-origin: left; }
@keyframes zm-indrukken { to { transform: scaleX(0); opacity: 0; } }
@keyframes zm-van-rechts { from { transform: translateX(100%); } }
@keyframes zm-naar-rechts { to { transform: translateX(100%); } }
@keyframes zm-uitrekken { from { transform: scaleX(0); opacity: 0; } }

/* ✕: up a stage, at the top right of what the stage shows. The column
   there keeps room for it. */
.zm-shell[data-fase] { position: relative; }
.zm-sluit {
  position: absolute;
  top: calc(var(--zm-height-topbar) + var(--zm-space-3));
  right: var(--zm-space-4);
  /* Level with the rails (Lade.razor.css, z-index 2), and after them in the
     page: on a narrow screen a rail is a bar across the full width, right
     under this button, and would take its clicks. Below the drawers (3). */
  z-index: 2;
  display: grid;
  place-items: center;
  width: var(--zm-size-knop);
  height: var(--zm-size-knop);
  padding: 0;
  border: var(--zm-border-width) solid var(--zm-color-border-strong);
  border-radius: var(--zm-radius-pill);
  background: var(--zm-color-surface);
  color: var(--zm-color-ink);
  font-size: var(--zm-font-size-subtitle);
  line-height: 1;
  cursor: pointer;
}
.zm-sluit:hover { border-color: var(--zm-color-accent); color: var(--zm-color-accent); }
.zm-shell[data-fase="lijst"] .zm-werklijst,
.zm-shell[data-fase="dossier"] .zm-result,
.zm-shell--zonder-resultaat[data-fase="dossier"] .zm-dossier {
  padding-right: calc(var(--zm-size-knop) + var(--zm-space-5));
}

/* Beside an open drawer: a click there closes it. */
.zm-lade-achtergrond {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: var(--zm-color-scrim);
}

@media (prefers-reduced-motion: reduce) {
  .zm-shell * { animation: none !important; }
}

/* The search's icons show on narrow screens only (TopBar, below). */
.zm-topbar__search-open, .zm-topbar__search-close { display: none; }

/* Narrow screens (below 900px, so half a Full HD screen still has the wide
   layout): the columns stack, in reading order. A media query cannot read a
   custom property, so this breakpoint is the one length set here;
   Lade.razor.css repeats it. */
@media (max-width: 56.25rem) {
  .zm-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas: "top" "steps" "list" "dossier" "result";
  }
  /* A stage at a time, its rails as bars across the top. */
  .zm-shell[data-fase] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "top" "steps" "list" "dossier" "result";
    /* The rows as high as their content: a rail stays a slim bar. */
    align-content: start;
  }
  .zm-steps, .zm-werklijst, .zm-dossier, .zm-result {
    border-right: 0;
    border-bottom: var(--zm-border-width) solid var(--zm-color-border);
  }
  /* ✕ in the row of the last bar, the one it goes back to: the steps' bar from
     a werklijst, the werklijst's bar from a dossier. Where the bars are more
     than one, a fixed place under the top bar would be on the first. */
  .zm-sluit {
    position: static;
    justify-self: end;
    align-self: center;
    margin-right: var(--zm-space-4);
  }
  .zm-shell[data-fase="lijst"] .zm-sluit { grid-area: steps; }
  .zm-shell[data-fase="dossier"] .zm-sluit { grid-area: list; }
  /* The search is an icon in the bar, opened across it (LIM-53). */
  .zm-topbar__search-open { display: inline-flex; }
  .zm-topbar__search { display: none; }
  .zm-topbar .zm-topbar__where, .zm-topbar .zm-account__subject { display: none; }
  .zm-topbar--searching > :not(.zm-topbar__search, .zm-topbar__user, .zm-topbar__offline) { display: none; }
  .zm-topbar--searching .zm-topbar__search {
    display: flex;
    flex: 1;
    align-items: center;
    gap: var(--zm-space-2);
    max-width: none;
  }
  .zm-topbar--searching .zm-topbar__search-close { display: inline-flex; }
  /* While searching the box takes the room of the gemeente, and its hits the
     width of the bar rather than of the box. */
  .zm-topbar--searching .zm-account__gemeente { display: none; }
  .zm-topbar--searching .zm-topbar__search .zm-search { position: static; }
}

/* Text */
.zm-title { font-size: var(--zm-font-size-title); font-weight: var(--zm-font-weight-strong); }
.zm-subtitle { font-size: var(--zm-font-size-subtitle); font-weight: var(--zm-font-weight-strong); }
.zm-kicker {
  font-size: var(--zm-font-size-small);
  font-weight: var(--zm-font-weight-strong);
  letter-spacing: var(--zm-letter-spacing-kicker);
  text-transform: uppercase;
  color: var(--zm-color-ink-muted);
  margin-bottom: var(--zm-space-2);
}
.zm-muted { color: var(--zm-color-ink-muted); font-size: var(--zm-font-size-small); }
.zm-count { font-weight: var(--zm-font-weight-normal); }
.zm-visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.zm-loading, .zm-notfound { padding: var(--zm-space-6); color: var(--zm-color-ink-muted); }

/* Facts: label and value, as the context and the result show them. */
.zm-facts {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: var(--zm-space-2) var(--zm-space-4);
}
.zm-facts dt { color: var(--zm-color-ink-muted); }

.zm-table { width: 100%; font-size: var(--zm-font-size-small); }
.zm-table caption { text-align: left; }
.zm-table th, .zm-table td {
  text-align: left;
  padding: var(--zm-space-1) var(--zm-space-2);
  border-bottom: var(--zm-border-width) solid var(--zm-color-border);
}

/* Controls */
.zm-input {
  width: 100%;
  padding: var(--zm-space-2) var(--zm-space-3);
  border: var(--zm-border-width) solid var(--zm-color-border-strong);
  border-radius: var(--zm-radius);
  background: var(--zm-color-surface);
}
.zm-input--number, .zm-input--date { width: auto; }
.zm-input--multiline { resize: vertical; }
.zm-input[aria-invalid="true"] {
  border-color: var(--zm-color-danger);
  background: var(--zm-color-danger-surface);
}

.zm-button {
  padding: var(--zm-space-2) var(--zm-space-4);
  border: var(--zm-border-width) solid var(--zm-color-border-strong);
  border-radius: var(--zm-radius);
  background: var(--zm-color-surface);
}
.zm-button--primary {
  background: var(--zm-color-accent);
  border-color: var(--zm-color-accent);
  color: var(--zm-color-accent-ink);
  font-weight: var(--zm-font-weight-strong);
}
.zm-button--quiet { border-color: transparent; background: transparent; text-decoration: underline; }
.zm-button:disabled { opacity: 0.6; cursor: default; }

:focus-visible { outline: var(--zm-focus-width) solid var(--zm-color-focus); outline-offset: var(--zm-focus-width); }

.zm-badge {
  min-width: var(--zm-width-number);
  padding: 0 var(--zm-space-2);
  border-radius: var(--zm-radius-pill);
  background: var(--zm-color-accent-soft);
  color: var(--zm-color-accent-ink);
  font-size: var(--zm-font-size-small);
  font-weight: var(--zm-font-weight-strong);
  text-align: center;
}

.zm-problem { color: var(--zm-color-danger); font-size: var(--zm-font-size-small); margin-top: var(--zm-space-1); }
.zm-notice {
  padding: var(--zm-space-3);
  border-radius: var(--zm-radius);
  background: var(--zm-color-notice-surface);
}

/* Forms */
.zm-form > * + * { margin-top: var(--zm-space-4); }
.zm-form__problems {
  padding: var(--zm-space-3);
  border-radius: var(--zm-radius);
  background: var(--zm-color-danger-surface);
}
.zm-form__actions, .zm-choice, .zm-money {
  display: flex; align-items: center; gap: var(--zm-space-2);
}
.zm-form__submit {
  padding-top: var(--zm-space-4);
  border-top: var(--zm-border-width) solid var(--zm-color-border);
}
.zm-choices { display: flex; flex-direction: column; gap: var(--zm-space-1); }
.zm-choices--inline { flex-direction: row; gap: var(--zm-space-4); }
.zm-field { display: flex; flex-direction: column; gap: var(--zm-space-1); }
.zm-field__label { font-weight: var(--zm-font-weight-strong); color: var(--zm-color-ink-soft); }
.zm-field__required { color: var(--zm-color-danger); margin-left: var(--zm-space-1); }

.zm-signin {
  max-width: var(--zm-width-signin);
  margin: var(--zm-space-6) auto;
  padding: var(--zm-space-5);
  background: var(--zm-color-surface);
  border-radius: var(--zm-radius);
}
.zm-signin > * + * { margin-top: var(--zm-space-4); }
