/* ==========================================================================
   PIT — layout and components.

   Every colour, font and spacing value comes from tokens.css. Nothing is
   hard-coded here.

   Design intent: a dense, sober analyst's tool. Numbers are right aligned with
   tabular figures, hierarchy is carried by type and rules rather than colour,
   gold appears sparingly as an accent.
   ========================================================================== */

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--p-white);
  color: var(--p-black);
  font-family: var(--p-font-sans);
  font-size: var(--p-size-body);
  line-height: var(--p-line-body);
}

h1,
h2,
h3,
h4 {
  font-family: var(--p-font-serif);
  font-weight: normal;
  color: var(--p-black);
  margin: 0;
}

h1 { font-size: var(--p-size-h1); }
h2 { font-size: var(--p-size-h2); }
h3 { font-size: var(--p-size-h3); }

p {
  margin: 0 0 var(--p-space-3);
}

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

a {
  color: var(--p-gold);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

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

/* --------------------------------------------------------------------------
   Text helpers
   -------------------------------------------------------------------------- */

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.mono {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--p-gray);
}

.small {
  font-size: var(--p-size-small);
}

.tiny {
  font-size: var(--p-size-tiny);
}

.up {
  color: var(--p-gold);
  font-weight: bold;
}

.dn {
  color: var(--p-gray);
}

/* --------------------------------------------------------------------------
   Icons

   Vendored Lucide icons, inlined by the {% icon %} tag
   (common/templatetags/icons.py). An icon never carries a colour of its own --
   it inherits the text colour and is therefore correct inside a button, a link
   or a table cell without a rule of its own.
   -------------------------------------------------------------------------- */

.ico {
  flex: 0 0 auto;
  vertical-align: -0.16em;
}

/* A row of items on one line: an icon and its label, or a set of controls. */
.row {
  display: flex;
  align-items: center;
  gap: var(--p-space-2);
  flex-wrap: wrap;
}

.row.tight {
  gap: 5px;
}

/* --------------------------------------------------------------------------
   Application layout
   -------------------------------------------------------------------------- */

.app {
  display: flex;
  min-height: 100vh;
}

.side {
  width: var(--p-sidebar-width);
  flex: 0 0 var(--p-sidebar-width);
  border-right: var(--p-border);
  background: var(--p-white);
  padding-bottom: var(--p-space-6);
}

/* Logo on white ground with its protection zone. */
.brand {
  padding: var(--p-logo-guard) var(--p-space-4) var(--p-space-3);
  border-bottom: var(--p-border);
  text-align: center;
}

.brand img {
  width: var(--p-logo-width);
  height: auto;
  display: block;
  margin: 0 auto;
}

.brand .appname {
  font-family: var(--p-font-serif);
  font-size: var(--p-size-h3);
  letter-spacing: 0.12em;
  margin-top: 9px;
}

.brand .appsub {
  font-size: 9.5px;
  line-height: 1.3;
  color: var(--p-gray);
}

.navlabel {
  font-size: var(--p-size-tiny);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--p-gray);
  padding: var(--p-space-4) var(--p-space-4) 6px;
}

.nav {
  padding-top: var(--p-space-3);
}

.nav a {
  display: flex;
  align-items: center;
  gap: var(--p-space-2);
  padding: var(--p-space-2) var(--p-space-4);
  color: var(--p-black);
  font-size: var(--p-size-body);
  border-left: 3px solid transparent;
}

.nav a .ico {
  color: var(--p-gray);
}

.nav a.active .ico {
  color: var(--p-gold);
}

.nav a:hover {
  background: var(--p-gold-tint);
  text-decoration: none;
}

.nav a.active {
  border-left-color: var(--p-gold);
  color: var(--p-gold);
  font-weight: bold;
  background: var(--p-gold-tint);
}

/* Leads out of the application, into the Django admin. Marked so nobody is
   surprised by a different look and feel. */
.nav a.extern .ext {
  margin-left: auto;
  color: var(--p-gray);
}

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

.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--p-space-3);
  padding: var(--p-space-2) var(--p-space-5);
  border-bottom: var(--p-border);
  font-size: var(--p-size-small);
  color: var(--p-gray);
}

.topbar .who {
  color: var(--p-black);
}

/* Screen readers only: a label an icon-only control still needs. */
.nurvorleser {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- Info button in the top bar ------------------------------------------
   Opens with `details`, so the panel works without a script. The panel is
   anchored to the button, not to the bar, and therefore stays under it when
   the bar wraps on a narrow screen. */

.infobox {
  position: relative;
}

.infobox > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: var(--p-border);
  border-radius: 50%;
  color: var(--p-gray);
  cursor: pointer;
  /* No disclosure triangle. Two declarations, because WebKit ignores the
     standard one and needs its own marker switched off (rule below). */
  list-style: none;
}

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

.infobox > summary:hover,
.infobox[open] > summary {
  color: var(--p-gold);
  border-color: var(--p-gold);
}

.infobox > summary:focus-visible {
  outline: 2px solid var(--p-gold);
  outline-offset: 2px;
}

.infopanel {
  position: absolute;
  z-index: 30;
  top: calc(100% + var(--p-space-2));
  left: 0;
  min-width: 250px;
  padding: var(--p-space-3);
  background: var(--p-white);
  border: var(--p-border);
  border-radius: var(--p-radius-card);
  color: var(--p-black);
}

.infopanel > .serif {
  font-size: var(--p-size-h3);
  margin-bottom: var(--p-space-2);
}

.content {
  flex: 1;
  padding: 20px var(--p-space-5) var(--p-space-6);
}

.sitefoot {
  display: flex;
  justify-content: space-between;
  gap: var(--p-space-4);
  flex-wrap: wrap;
  padding: var(--p-space-3) var(--p-space-5);
  border-top: var(--p-border);
  font-size: var(--p-size-tiny);
  color: var(--p-gray);
}

.pagehead {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: var(--p-border);
  padding-bottom: var(--p-space-3);
  margin-bottom: var(--p-space-5);
  gap: var(--p-space-4);
  flex-wrap: wrap;
}

.pagehead .sub {
  color: var(--p-gray);
  font-size: var(--p-size-small);
  margin-top: var(--p-space-1);
}

.pagehead .actions {
  display: flex;
  gap: var(--p-space-2);
  align-items: center;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Grid
   -------------------------------------------------------------------------- */

.grid {
  display: grid;
  gap: var(--p-space-3);
}

.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* Main column with an accompanying column: detail view plus its context. */
.split {
  grid-template-columns: minmax(0, 1fr) var(--p-width-aside);
  gap: var(--p-space-5);
}

/* --------------------------------------------------------------------------
   Card
   -------------------------------------------------------------------------- */

.card {
  border: var(--p-border);
  border-radius: var(--p-radius-card);
  background: var(--p-white);
  padding: var(--p-space-3) var(--p-space-4);
}

.card > h2 {
  margin-bottom: var(--p-space-1);
}

.card > h3 {
  margin-bottom: var(--p-space-3);
}

/* A card whose content brings its own padding -- a table, for instance, which
   has to reach the card's edge. `cardhead` and `cardfoot` restore the padding
   for the text above and below it. */
.card.flush {
  padding: 0;
}

.card.flush .cardhead {
  padding: var(--p-space-4) var(--p-space-4) var(--p-space-2);
}

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

.card.flush .cardfoot {
  padding: var(--p-space-3) var(--p-space-4) var(--p-space-4);
}

/* --------------------------------------------------------------------------
   Key figure tile
   -------------------------------------------------------------------------- */

.kpi .l {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--p-size-small);
  color: var(--p-gray);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kpi .v {
  font-family: var(--p-font-serif);
  font-size: 30px;
  line-height: 1.1;
  margin-top: var(--p-space-1);
  font-variant-numeric: tabular-nums;
}

.kpi .d {
  font-size: var(--p-size-small);
  margin-top: 5px;
}

.kpi .v.empty {
  color: var(--p-gray);
  font-size: var(--p-size-h2);
}

/* --------------------------------------------------------------------------
   Table
   -------------------------------------------------------------------------- */

table {
  border-collapse: collapse;
  width: 100%;
  font-size: var(--p-size-table);
}

th {
  background: var(--p-gold);
  color: var(--p-white);
  font-weight: bold;
  text-align: left;
  padding: 7px 9px;
  font-size: var(--p-size-small);
  white-space: nowrap;
}

th.num {
  text-align: right;
}

td {
  padding: 6px 9px;
  border-bottom: var(--p-border);
}

tbody tr:nth-child(even) {
  background: var(--p-gray-light);
}

tbody tr:hover {
  background: var(--p-gold-tint-strong);
}

/* Horizontal scroll container. Wide tables scroll inside their own box; the
   page body must never scroll sideways. */
.tw {
  overflow-x: auto;
}

/* Definition list, label left, value right aligned with tabular figures. */
.dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px var(--p-space-3);
  font-size: var(--p-size-table);
  margin: 0;
}

.dl dt {
  color: var(--p-gray);
}

.dl dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Button
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--p-gold);
  color: var(--p-white);
  border: 1px solid var(--p-gold);
  padding: 6px 13px;
  font-size: var(--p-size-table);
  font-family: var(--p-font-sans);
  border-radius: var(--p-radius);
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
}

.btn:hover,
.btn:focus-visible {
  text-decoration: none;
  filter: brightness(0.94);
}

.btn.ghost {
  background: var(--p-white);
  color: var(--p-gold);
}

.btn.plain {
  background: var(--p-white);
  color: var(--p-black);
  border-color: var(--p-gray-light);
}

.btn[disabled],
.btn.disabled {
  opacity: 0.5;
  cursor: default;
}

.btn.block {
  width: 100%;
  justify-content: center;
  text-align: center;
}

/* Sits in a table row or a pagination bar without pushing the line apart. */
.btn.small {
  padding: 3px 9px;
  font-size: var(--p-size-small);
}

/* Icon only. Needs `titel` on the icon -- there is no label to carry the
   meaning (common/templatetags/icons.py). */
.btn.icon {
  padding: 5px;
}

/* --------------------------------------------------------------------------
   Status marker
   -------------------------------------------------------------------------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 2px;
  font-size: var(--p-size-tiny);
  font-weight: bold;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.tag.solid {
  background: var(--p-gold);
  color: var(--p-white);
}

.tag.light {
  background: var(--p-gold-light);
  color: var(--p-black);
}

.tag.neutral {
  background: var(--p-gray-light);
  color: var(--p-black);
}

.tag.outline {
  background: var(--p-white);
  color: var(--p-gold);
  border: 1px solid var(--p-gold);
}

.tag.quiet {
  background: var(--p-white);
  color: var(--p-gray);
  border: 1px solid var(--p-gray);
}

/* Machine-generated values are marked as such until an analyst confirms them.
   Deliberately visually distinct from every analyst marker. */
.tag.ki {
  background: var(--p-white);
  color: var(--p-blue-gray);
  border: 1px solid var(--p-blue-gray);
}

/* --------------------------------------------------------------------------
   Note box
   -------------------------------------------------------------------------- */

.note {
  display: flex;
  gap: var(--p-space-2);
  align-items: flex-start;
  background: var(--p-gold-tint);
  border-left: 3px solid var(--p-gold-light);
  padding: 9px var(--p-space-3);
  font-size: var(--p-size-small);
  margin: var(--p-space-3) 0;
}

.note .ico {
  margin-top: 1px;
  color: var(--p-gray);
}

.note .titel {
  font-weight: bold;
  display: block;
  margin-bottom: 2px;
}

.note.plain {
  border-left-color: var(--p-gray-light);
  background: var(--p-white);
  border: var(--p-border);
}

/* An open point that has to be decided, not a mere remark. Set apart by the
   marker, not by a colour -- there is no red in the corporate identity. */
.note.offen {
  border-left-color: var(--p-black);
  background: var(--p-white);
  border: var(--p-border);
  border-left: 3px solid var(--p-black);
}

/* --------------------------------------------------------------------------
   Empty state — shown where data does not exist yet. Never a fabricated number.
   -------------------------------------------------------------------------- */

.empty {
  color: var(--p-gray);
  font-size: var(--p-size-table);
}

/* --------------------------------------------------------------------------
   Progress bar
   -------------------------------------------------------------------------- */

.bar {
  height: 7px;
  background: var(--p-gray-light);
  border-radius: var(--p-radius);
  overflow: hidden;
  min-width: 56px;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--p-gold);
}

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

label {
  display: block;
  font-size: var(--p-size-small);
  color: var(--p-gray);
  margin-bottom: var(--p-space-1);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="month"],
input[type="file"],
select,
textarea {
  font-family: var(--p-font-sans);
  font-size: var(--p-size-table);
  padding: 6px var(--p-space-2);
  border: var(--p-border);
  border-radius: var(--p-radius);
  background: var(--p-white);
  color: var(--p-black);
  width: 100%;
}

textarea {
  line-height: var(--p-line-body);
}

.field {
  margin-bottom: var(--p-space-3);
}

.field .help {
  font-size: var(--p-size-small);
  color: var(--p-gray);
  margin-top: var(--p-space-1);
}

.field .errors {
  font-size: var(--p-size-small);
  color: var(--p-gold);
  margin-top: var(--p-space-1);
  list-style: none;
  padding: 0;
}

.formactions {
  display: flex;
  gap: var(--p-space-2);
  align-items: center;
  flex-wrap: wrap;
  margin-top: var(--p-space-4);
}

/* Directly under the block it belongs to, without the usual distance. */
.formactions.flush {
  margin-top: 0;
}

/* --------------------------------------------------------------------------
   Messages
   -------------------------------------------------------------------------- */

.messages {
  list-style: none;
  margin: 0 0 var(--p-space-4);
  padding: 0;
}

.messages li {
  border: var(--p-border);
  border-left: 3px solid var(--p-gold);
  padding: 9px var(--p-space-3);
  font-size: 11.5px;
  margin-bottom: var(--p-space-2);
}

.messages li.error {
  border-left-color: var(--p-black);
}

/* --------------------------------------------------------------------------
   Login page — white ground, centred card, logo above
   -------------------------------------------------------------------------- */

.loginpage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--p-space-5);
  background: var(--p-white);
}

.loginbox {
  width: 340px;
  max-width: 100%;
}

.loginbox .brandblock {
  text-align: center;
  margin-bottom: var(--p-space-5);
  padding: var(--p-logo-guard) 0;
}

.loginbox .brandblock img {
  width: 180px;
  height: auto;
}

.loginbox .brandblock .appname {
  font-family: var(--p-font-serif);
  font-size: var(--p-size-h2);
  letter-spacing: 0.12em;
  margin-top: var(--p-space-3);
}

.loginbox .brandblock .appsub {
  font-size: var(--p-size-small);
  color: var(--p-gray);
}

.loginfoot {
  margin-top: var(--p-space-4);
  text-align: center;
  font-size: var(--p-size-tiny);
  color: var(--p-gray);
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Timeline
   -------------------------------------------------------------------------- */

.timeline {
  border-left: 2px solid var(--p-gray-light);
  padding-left: var(--p-space-3);
  margin-left: var(--p-space-1);
}

.timeline .ev {
  margin-bottom: var(--p-space-3);
  position: relative;
}

.timeline .ev::before {
  content: "";
  position: absolute;
  left: -19px;
  top: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--p-gold);
}

/* --------------------------------------------------------------------------
   Section heading

   Separates the blocks of a page. Rendered by components/abschnitt.html so the
   spacing above a heading is not decided anew on every screen.
   -------------------------------------------------------------------------- */

.abschnitt {
  margin: var(--p-space-6) 0 var(--p-space-3);
}

.abschnitt:first-child {
  margin-top: 0;
}

.abschnitt .sub {
  color: var(--p-gray);
  font-size: var(--p-size-small);
  margin-top: var(--p-space-1);
}

/* --------------------------------------------------------------------------
   Tabs

   Sections of one object -- the title detail view has five of them. Plain links:
   every tab is its own URL, so it can be linked to and bookmarked.
   -------------------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: var(--p-space-4);
  border-bottom: var(--p-border);
  margin-bottom: var(--p-space-4);
  overflow-x: auto;
}

.tabs a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--p-space-2) 2px var(--p-space-2);
  color: var(--p-black);
  font-size: var(--p-size-body);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}

.tabs a:hover {
  text-decoration: none;
  color: var(--p-gold);
}

.tabs a.active {
  border-bottom-color: var(--p-gold);
  color: var(--p-gold);
  font-weight: bold;
}

/* --------------------------------------------------------------------------
   Toolbar

   The filter and action row above a table. Wraps rather than scrolls.
   -------------------------------------------------------------------------- */

.toolbar {
  display: flex;
  align-items: flex-end;
  gap: var(--p-space-3);
  flex-wrap: wrap;
  margin-bottom: var(--p-space-3);
}

.toolbar .field {
  margin-bottom: 0;
}

.toolbar .field input,
.toolbar .field select {
  min-width: 150px;
  width: auto;
}

/* Pushes everything after it to the right edge. */
.toolbar .spacer {
  margin-left: auto;
}

/* --------------------------------------------------------------------------
   Sortable column header

   The sort direction is visible in the header, and the sorted column is the one
   the URL names -- reload and deep link keep the order.
   -------------------------------------------------------------------------- */

th a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--p-white);
}

th a:hover {
  text-decoration: none;
  opacity: 0.85;
}

th.num a {
  flex-direction: row-reverse;
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */

.paginierung {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--p-space-3);
  flex-wrap: wrap;
  margin-top: var(--p-space-3);
}

.paginierung .lage {
  font-size: var(--p-size-small);
  color: var(--p-gray);
}

/* --------------------------------------------------------------------------
   Empty state

   Shown wherever data does not exist yet. Never a zero, never a guess
   (CLAUDE.md, rule 8).
   -------------------------------------------------------------------------- */

.leer {
  display: flex;
  gap: var(--p-space-3);
  align-items: flex-start;
  color: var(--p-gray);
  font-size: var(--p-size-table);
  padding: var(--p-space-3) 0;
}

.leer .ico {
  margin-top: 1px;
}

.leer .hinweis {
  margin-top: var(--p-space-1);
  font-size: var(--p-size-small);
}

/* --------------------------------------------------------------------------
   Utilities

   Deliberately few, and each with a reason. Everything a screen needs beyond
   this belongs in a component, not in a style attribute -- the check in
   common/tests/test_designsystem.py enforces that.
   -------------------------------------------------------------------------- */

/* Distance below a block that is followed by the next section. */
.section {
  margin-bottom: var(--p-space-5);
}

/* A column of blocks with even spacing -- cards in an accompanying column. */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--p-space-3);
}

/* Items pushed to both edges of one line. */
.spread {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--p-space-3);
  flex-wrap: wrap;
}

/* Metadata line directly beneath a heading: edition, date, size. */
.meta {
  font-size: var(--p-size-small);
  color: var(--p-gray);
  margin-bottom: var(--p-space-3);
}

/* A closing remark under a block. */
.hint {
  font-size: var(--p-size-small);
  color: var(--p-gray);
  margin: var(--p-space-2) 0 0;
}

/* A line set in the heading face without being a heading. */
.serif {
  font-family: var(--p-font-serif);
  font-size: var(--p-size-h3);
}

.bullets {
  margin: 0;
  padding-left: var(--p-space-5);
}

.bullets li {
  margin-bottom: var(--p-space-1);
}

/* Reading widths. A form or a paragraph does not run the width of a 27" screen. */
.w-s { max-width: var(--p-width-s); }
.w-m { max-width: var(--p-width-m); }
.w-l { max-width: var(--p-width-l); }

/* --------------------------------------------------------------------------
   Navigation toggle

   Below the tablet breakpoint the sidebar becomes a bar with a menu button.
   The toggle is a checkbox, not a script: the application ships no JavaScript
   yet (DECISIONS.md D-007), and a menu that needs a script to open is a menu
   that fails when the script does not load.

   The input stays in the document rather than being display:none, so it can be
   reached with the keyboard; the label carries its focus ring.
   -------------------------------------------------------------------------- */

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

.navbtn {
  display: none;
}

/* --------------------------------------------------------------------------
   Responsive

   Desktop first -- the analyst's workplace is a wide screen. Below that the
   layout narrows in three steps, down to a phone: the grids collapse, the
   sidebar becomes a menu bar, and wide tables keep scrolling inside their own
   box so the page body never scrolls sideways.
   -------------------------------------------------------------------------- */

@media (min-width: 861px) {
  /* No keyboard stop for a control that does nothing at this width. */
  .navtoggle {
    display: none;
  }
}

@media (max-width: 1400px) {
  .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .g5,
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

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

  /* The accompanying column moves below the main column. */
  .split { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Tablet and below: the sidebar becomes a menu bar ------------------- */

@media (max-width: 860px) {
  .app {
    flex-direction: column;
    min-height: 100vh;
  }

  .side {
    width: 100%;
    flex: 0 0 auto;
    border-right: none;
    border-bottom: var(--p-border);
    padding-bottom: 0;
  }

  .brand {
    display: flex;
    align-items: center;
    gap: var(--p-space-3);
    text-align: left;
    padding: var(--p-space-2) var(--p-space-4);
    border-bottom: none;
  }

  .brand a {
    display: flex;
  }

  .brand img {
    width: 116px;
    margin: 0;
  }

  .brand .brandtext {
    line-height: 1.2;
  }

  .brand .appname {
    margin-top: 0;
  }

  .navbtn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 0 auto;
    padding: 6px 11px;
    border: var(--p-border);
    border-radius: var(--p-radius);
    font-size: var(--p-size-small);
    color: var(--p-black);
    cursor: pointer;
  }

  .navbody {
    display: none;
    border-top: var(--p-border);
    padding-bottom: var(--p-space-3);
  }

  .navtoggle:checked ~ .app .navbody {
    display: block;
  }

  .navtoggle:focus-visible ~ .app .navbtn {
    outline: 2px solid var(--p-gold);
    outline-offset: 2px;
  }

  .navlabel {
    padding-top: var(--p-space-3);
  }

  .nav {
    padding-top: var(--p-space-2);
  }

  .topbar {
    justify-content: flex-start;
    flex-wrap: wrap;
    padding: var(--p-space-2) var(--p-space-4);
  }

  .content {
    padding: var(--p-space-4) var(--p-space-4) var(--p-space-5);
  }

  .sitefoot {
    padding: var(--p-space-3) var(--p-space-4);
  }
}

/* ---- Phone ------------------------------------------------------------- */

@media (max-width: 560px) {
  .g5,
  .g4 { grid-template-columns: minmax(0, 1fr); }

  h1 { font-size: 22px; }

  .brand .appsub {
    display: none;
  }

  .content {
    padding: var(--p-space-3) var(--p-space-3) var(--p-space-5);
  }

  .card {
    padding: var(--p-space-3);
  }

  .card.flush .cardhead,
  .card.flush .cardfoot {
    padding-left: var(--p-space-3);
    padding-right: var(--p-space-3);
  }

  .pagehead {
    flex-direction: column;
    align-items: stretch;
  }

  .kpi .v {
    font-size: 25px;
  }

  /* Full width, so a control is large enough to hit with a thumb. */
  .toolbar,
  .toolbar .field,
  .toolbar .field input,
  .toolbar .field select {
    width: 100%;
  }

  .formactions .btn,
  .pagehead .actions .btn {
    flex: 1 1 auto;
    justify-content: center;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .paginierung {
    justify-content: center;
  }

  .paginierung .row {
    width: 100%;
  }

  .paginierung .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}
