/* SPDX-License-Identifier: AGPL-3.0-or-later */
/* Shell of the interface (U2, U3): sidebar with group switch, navigation, administration and
   user block, slim top bar on phones, focus. Colors only come from the --nw-* tokens of
   /theme/{accent}.css, so light, dark and every accent work without rules of their own. */

:root {
  --nw-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --nw-radius: 8px;
  --nw-touch: 44px;
  /* Height of what sticks to the top of the page: nothing on tablet and desktop, the top bar on phones */
  --nw-header-height: 0px;
  --bs-body-font-family: var(--nw-font);
  --bs-border-radius: var(--nw-radius);
  /* Paper behind QR codes and label previews, white in both themes so codes stay scannable */
  --nw-paper: #fff;
}

/* The scrollbar track is always there, so the page does not jump sideways by its width between a
   short page and one that scrolls. A reserved gutter (scrollbar-gutter) would leave an empty strip
   where the header line ends early on short pages. */
html { overflow-y: scroll; }

/* Media elements are blocks that never overflow their box. Inline ones sit on the text baseline and
   leave a gap below them (an iframe in a card grew by 6 px); the pages were built with this reset
   of the former Tailwind stylesheet, Bootstrap's reboot only aligns them in the middle. */
img, svg, iframe, video, canvas { display: block; }
img, video { max-width: 100%; height: auto; }

/* The sheets of the mark: accent in light mode, accent as text (lighter) in dark mode */
:root, [data-bs-theme=light] { --nw-mark: var(--nw-accent); }
[data-bs-theme=dark] { --nw-mark: var(--nw-accent-text); }

/* Chart colors (#373), checked against the surfaces of both modes; alert is only for the overdue column, which carries its label */
:root, [data-bs-theme=light] { --nw-chart-1: #257de0; --nw-chart-2: #f47230; --nw-chart-3: #00b894; --nw-chart-alert: #dc3c3d; }
[data-bs-theme=dark] { --nw-chart-1: #338ced; --nw-chart-2: #e76624; --nw-chart-3: #00a888; --nw-chart-alert: #dc3c3d; }

body.nw-body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--nw-bg);
  color: var(--nw-text);
  font-family: var(--nw-font);
}

/* Visible focus with at least 3:1 in both modes instead of Bootstrap's translucent ring */
:focus-visible {
  outline: 2px solid var(--nw-accent-text);
  outline-offset: 2px;
}
.btn:focus-visible, .form-control:focus, .form-select:focus, .dropdown-item:focus-visible {
  box-shadow: none;
  outline: 2px solid var(--nw-accent-text);
  outline-offset: 2px;
}

/* Primary buttons use the accent surface with white text in both modes */
.btn-primary {
  --bs-btn-bg: var(--nw-accent);
  --bs-btn-border-color: var(--nw-accent);
  --bs-btn-hover-bg: var(--nw-accent-hover);
  --bs-btn-hover-border-color: var(--nw-accent-hover);
  --bs-btn-active-bg: var(--nw-accent-hover);
  --bs-btn-active-border-color: var(--nw-accent-hover);
  --bs-btn-disabled-bg: var(--nw-accent);
  --bs-btn-disabled-border-color: var(--nw-accent);
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
  --bs-btn-active-color: #fff;
}
/* Bootstrap keeps the light-mode text color of outline buttons in dark mode: 3.9:1 and 4.0:1 on
   the dark surfaces, below the 4.5:1 of WCAG AA (#80). Muted text and the danger emphasis color
   are readable on all dark surfaces; hover fills with the raised surface instead of the text color. */
[data-bs-theme=dark] .btn-outline-secondary {
  --bs-btn-color: var(--nw-text-muted);
  --bs-btn-border-color: var(--nw-border);
  --bs-btn-hover-color: var(--nw-text);
  --bs-btn-hover-bg: var(--nw-bg-3);
  --bs-btn-hover-border-color: var(--nw-text-muted);
  --bs-btn-active-color: var(--nw-text);
  --bs-btn-active-bg: var(--nw-bg-3);
  --bs-btn-active-border-color: var(--nw-text-muted);
  --bs-btn-disabled-color: var(--nw-text-muted);
  --bs-btn-disabled-border-color: var(--nw-border);
}
[data-bs-theme=dark] .btn-outline-danger {
  --bs-btn-color: var(--bs-danger-text-emphasis);
  --bs-btn-border-color: var(--bs-danger-text-emphasis);
  --bs-btn-hover-color: var(--nw-bg);
  --bs-btn-hover-bg: var(--bs-danger-text-emphasis);
  --bs-btn-hover-border-color: var(--bs-danger-text-emphasis);
  --bs-btn-active-color: var(--nw-bg);
  --bs-btn-active-bg: var(--bs-danger-text-emphasis);
  --bs-btn-active-border-color: var(--bs-danger-text-emphasis);
  --bs-btn-disabled-color: var(--bs-danger-text-emphasis);
  --bs-btn-disabled-border-color: var(--bs-danger-text-emphasis);
}
/* As tall as the form fields (--nw-touch), a button next to a field would sit 4 px lower (#86) */
.btn { min-height: var(--nw-touch); }

.nw-skip {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 1100;
  background: var(--nw-bg);
  padding: 8px 12px;
  border-radius: var(--nw-radius);
}

.nw-brand {
  display: inline-flex;
  align-items: center;
  min-width: var(--nw-touch);
  min-height: var(--nw-touch);
  flex: none;
}
.nw-mark { width: 32px; height: 32px; }
.nw-mark-sheet { fill: var(--nw-mark); }

/* Group switch (#126): name of the active group, long names are cut with an ellipsis */
.nw-group-switch { flex: 0 1 auto; min-width: 0; }
.nw-group-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: var(--nw-touch);
  padding: 0 10px;
  border: 1px solid var(--nw-border);
  border-radius: var(--nw-radius);
  background: transparent;
  color: var(--nw-text);
  font-weight: 600;
}
.nw-group-button:hover { background: var(--nw-bg-3); }
.nw-group-button .bi { flex: none; color: var(--nw-text-muted); }
.nw-group-name { min-width: 0; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Long names wrap inside the list instead of running out of the screen */
.nw-group-switch .dropdown-item { white-space: normal; overflow-wrap: anywhere; }
.nw-group-switch .nw-menu { max-width: calc(100vw - 32px); }
.nw-avatar {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--nw-accent-border);
  background: var(--nw-accent-subtle);
  color: var(--nw-accent-text);
  font-size: 13px;
  font-weight: 600;
}
/* A picture fills the circle; the initials stay for people without one */
img.nw-avatar { object-fit: cover; background: var(--nw-bg-3); }
.nw-avatar-lg { width: 72px; height: 72px; font-size: 24px; }
/* Choice of the accent: a radio per color, the whole label is the target (at least 44 px high).
   The color of each swatch comes from /theme/swatches.css, the CSP forbids inline styles. */
.nw-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.nw-swatch-choice { position: relative; }
.nw-swatch-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.nw-swatch-choice label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--nw-touch);
  padding: 6px 12px;
  border: 1px solid var(--nw-border);
  border-radius: 10px;
  background: var(--nw-bg);
}
.nw-swatch { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1px solid var(--nw-border); }
.nw-swatch-input:checked + label { border-color: var(--nw-accent-text); background: var(--nw-accent-subtle); color: var(--nw-accent-text); font-weight: 600; }
.nw-swatch-input:checked + label::after { content: "\2713"; margin-left: auto; }
.nw-swatch-input:focus-visible + label { outline: 2px solid var(--nw-accent-text); outline-offset: 2px; }

/* Profile head: picture, name and the note where the picture comes from */
.nw-profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.nw-profile-head .nw-grow strong { font-size: 1.15rem; }
/* Addresses break at <wbr> after @ and dots (breakable_address); this catches a part that is too long on its own (#81) */
.nw-profile-head .nw-grow small { overflow-wrap: anywhere; }
.nw-menu {
  --bs-dropdown-bg: var(--nw-bg);
  --bs-dropdown-border-color: var(--nw-border);
  --bs-dropdown-link-color: var(--nw-text);
  --bs-dropdown-link-hover-bg: var(--nw-bg-3);
  --bs-dropdown-link-hover-color: var(--nw-text);
  --bs-dropdown-link-active-bg: var(--nw-accent-subtle);
  --bs-dropdown-link-active-color: var(--nw-accent-text);
  --bs-dropdown-header-color: var(--nw-text-muted);
  min-width: 260px;
  padding: 6px;
  box-shadow: 0 8px 28px rgb(0 0 0 / 0.16);
}
.nw-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--nw-touch);
  border-radius: 6px;
}
.nw-menu .dropdown-item[aria-current] { color: var(--nw-accent-text); }
.nw-menu .dropdown-header {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0;
}
.nw-check { color: var(--nw-accent-text) !important; }
.nw-modes { display: flex; gap: 4px; padding: 2px 8px 6px; }
.nw-modes button {
  flex: 1;
  min-height: 36px;
  border: 1px solid var(--nw-border);
  border-radius: 6px;
  background: transparent;
  color: var(--nw-text);
  font-size: 13px;
}
.nw-modes button[aria-pressed="true"] {
  background: var(--nw-accent);
  border-color: var(--nw-accent);
  color: #fff;
}

.nw-card {
  padding: 16px;
  border: 1px solid var(--nw-border);
  border-radius: 12px;
  background: var(--nw-bg);
  color: var(--nw-text);
}
a.nw-card { display: block; text-decoration: none; }
a.nw-card:hover { background: var(--nw-bg-2); border-color: var(--nw-accent-border); }

/* Content */
.nw-main {
  flex: 1;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px));
}

/* ---------- Components shared by all areas (U6) ---------- */

/* Page head: title with a short description on the left, actions on the right */
.nw-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.nw-page-head h1 { margin: 0; font-size: 1.6rem; font-weight: 700; letter-spacing: -0.015em; text-wrap: balance; }
.nw-page-head p { margin: 2px 0 0; color: var(--nw-text-muted); overflow-wrap: anywhere; }
.nw-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.nw-actions form { margin: 0; }

.nw-crumbs {
  --bs-breadcrumb-divider: "›";
  --bs-breadcrumb-item-active-color: var(--nw-text);
  --bs-breadcrumb-divider-color: var(--nw-text-muted);
  margin-bottom: 8px;
  font-size: 14px;
}
.nw-crumbs a { text-decoration: none; }

.nw-muted { color: var(--nw-text-muted); }
.nw-count { color: var(--nw-text-muted); font-size: 14px; margin: 16px 0 8px; }
.nw-section { margin-top: 32px; }
.nw-section h2 { font-size: 1.15rem; font-weight: 600; margin: 0 0 12px; }
.nw-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.nw-section-head h2 { margin: 0; }

/* Area tabs of the inventory list (#466): one link per area below the page head. On a phone the row
   scrolls inside itself, labels never wrap; the active tab looks like the active sidebar entry. */
.nw-area-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  border-bottom: 1px solid var(--nw-border);
}
.nw-area-tabs a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--nw-touch);
  padding: 0 14px;
  border-radius: 8px 8px 0 0;
  color: var(--nw-text-muted);
  text-decoration: none;
  white-space: nowrap;
}
.nw-area-tabs a:hover { background: var(--nw-bg-3); color: var(--nw-text); }
.nw-area-tabs a[aria-current="page"] { background: var(--nw-accent-subtle); color: var(--nw-accent-text); font-weight: 600; }
/* From tablet width the tabs wrap instead of scrolling, so no area hides beyond the edge */
@media (min-width: 768px) { .nw-area-tabs { flex-wrap: wrap; overflow-x: visible; } }

/* Search with filters */
.nw-filters { display: grid; gap: 12px; }
.nw-search { position: relative; }
.nw-search .bi { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--nw-text-muted); }
.nw-search .form-control { padding-left: 40px; min-height: var(--nw-touch); }
.form-control, .form-select { min-height: var(--nw-touch); }
textarea.form-control { min-height: auto; }
/* The browser's own "Datei auswählen" button must fill the 44 px field, else a white strip
   shows below it (#89). The 2 px are the borders of the field. */
.form-control[type=file] { padding-block: 0; }
.form-control[type=file]::file-selector-button {
  box-sizing: border-box;
  height: calc(var(--nw-touch) - 2px);
  margin-block: 0;
  padding-block: 0;
}

/* Tables: header on a raised surface, numbers aligned */
.nw-table { border: 1px solid var(--nw-border); border-radius: 10px; overflow-x: auto; }
.nw-table .table {
  --bs-table-bg: var(--nw-bg);
  --bs-table-color: var(--nw-text);
  --bs-table-border-color: var(--nw-border);
  --bs-table-hover-bg: var(--nw-bg-2);
}
.nw-table th { background: var(--nw-bg-2); color: var(--nw-text-muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.nw-table tr:last-child td { border-bottom: 0; }
.nw-table td a { font-weight: 500; text-decoration: none; }
.nw-num { font-variant-numeric: tabular-nums; color: var(--nw-text-muted); white-space: nowrap; }

/* Lists of rows: links or rows with actions, at least 56 px high for touch */
/* No bullets or indent: Bootstrap's reboot would add them, the rows bring their own spacing */
.nw-list { margin-bottom: 0; padding-left: 0; list-style: none; border: 1px solid var(--nw-border); border-radius: 10px; overflow: hidden; }
.nw-list > li { border-bottom: 1px solid var(--nw-border); }
.nw-list > li:last-child { border-bottom: 0; }
.nw-list > li > a, .nw-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 8px 14px;
  color: var(--nw-text);
  text-decoration: none;
}
.nw-list > li > a:hover { background: var(--nw-bg-2); }
/* Cards with a checkbox (#435): the box sits in its own 44 px tap area beside the link, never
   inside it; a row without a box keeps the same space so the cards stay aligned */
.nw-list > li.nw-list-pick { display: flex; align-items: stretch; }
.nw-list > li.nw-list-pick > a { flex: 1; min-width: 0; padding-left: 4px; }
.nw-list-pick-box { display: flex; flex: none; align-items: center; justify-content: center; width: 44px; margin: 0; cursor: pointer; }
.nw-list-pick-box .form-check-input { margin: 0; width: 1.25rem; height: 1.25rem; }
.nw-row form { margin: 0; }
.nw-grow { flex: 1; min-width: 0; }
/* Figures of the statistics (#331): the label keeps room for a word, a value that does not fit
   beside it moves below and stays right-aligned instead of squeezing the label to nothing */
.nw-stat-row { flex-wrap: wrap; }
.nw-stat-row > .nw-grow { flex: 1 1 10rem; }
.nw-stat-row > :last-child { margin-left: auto; text-align: end; }
/* Part rows with an edit option (#284): the row wraps, the open details take the full row below the buttons */
.nw-file-row { flex-wrap: wrap; }
.nw-file-edit { flex: none; }
.nw-file-edit[open] { flex: 1 1 100%; order: 1; }
/* A summary does not take the text color the outline buttons next to it show; match them */
.nw-file-edit > summary { cursor: pointer; color: var(--nw-text); }
/* Safari still draws the disclosure triangle on a summary styled as a button */
.nw-file-edit > summary::-webkit-details-marker { display: none; }
.nw-file-edit[open] > summary { margin-bottom: 12px; }
.nw-file-edit-form { padding-bottom: 8px; }
.nw-grow strong { display: block; font-weight: 600; }
.nw-grow small { display: block; color: var(--nw-text-muted); }
.nw-note { padding: 10px 14px; }
.nw-note-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--nw-text-muted); }
.nw-note p { margin: 4px 0 0; white-space: pre-line; }
.nw-history-changes { margin: 4px 0 0; padding-left: 18px; overflow-wrap: anywhere; }
.nw-danger-link { color: var(--bs-danger-text-emphasis); padding: 0; }

/* Badges: text carries the meaning, color only supports it */
.nw-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--nw-bg-3);
  color: var(--nw-text-muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.nw-badge-ok { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.nw-badge-warn { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); }
.nw-badge-danger { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.nw-badge-accent { background: var(--nw-accent-subtle); color: var(--nw-accent-text); }
/* Badge with a long reason text (e.g. why a row is skipped): may wrap instead of widening the page */
.nw-badge-wrap { white-space: normal; max-width: 100%; border-radius: 12px; overflow-wrap: anywhere; }
/* Status and loan of an entry in a phone list: stacked on the right, the title keeps the width */
.nw-list-badges { display: flex; flex: none; flex-direction: column; align-items: flex-end; gap: 4px; }
/* Progress of an import job; the native element needs no inline style */
/* Review of an import: thumbnails of the pages of a part, uncertain parts stand out */
.nw-part { margin-bottom: 16px; }
.nw-part-uncertain { border-color: var(--bs-warning); }
.nw-pages { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0 0; padding: 0; list-style: none; }
/* The column is at least as wide as the preview but grows with the select, so long part names stay readable (#270); max-width keeps it inside a phone screen */
.nw-pages li { min-width: 130px; max-width: 100%; }
.nw-pages .form-select { width: auto; max-width: 100%; }
.nw-pages img { display: block; width: 130px; max-width: 100%; height: auto; margin-bottom: 6px; border: 1px solid var(--nw-border); background: #fff; }
/* Track and fill come from the tokens, otherwise the browser draws its light default track in dark mode */
.nw-progress {
  display: block;
  width: 100%;
  height: 8px;
  margin-top: 6px;
  appearance: none;
  border: 0;
  border-radius: 4px;
  overflow: hidden;
  background: var(--nw-bg-3);
  color: var(--nw-accent);
  accent-color: var(--nw-accent);
}
.nw-progress::-webkit-progress-bar { background: var(--nw-bg-3); border-radius: 4px; }
.nw-progress::-webkit-progress-value { background: var(--nw-accent); border-radius: 4px; }
.nw-progress::-moz-progress-bar { background: var(--nw-accent); border-radius: 4px; }

/* Facts of an object as label and value */
.nw-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0 24px;
  margin: 0;
  padding: 8px 16px;
  border: 1px solid var(--nw-border);
  border-radius: 12px;
}
.nw-facts > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--nw-border); }
.nw-facts dt { font-weight: 400; color: var(--nw-text-muted); }
.nw-facts dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
/* A fact with a long value (an address) spans every column */
.nw-facts > .nw-facts-wide { grid-column: 1 / -1; }

/* Empty state with a hint to the next step */
.nw-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 40px 16px;
  text-align: center;
  border: 1px dashed var(--nw-border);
  border-radius: 12px;
}
.nw-empty .bi { font-size: 32px; color: var(--nw-accent-text); }
.nw-empty p { margin: 0; max-width: 42ch; color: var(--nw-text-muted); }

/* Forms in cards with a legend as heading */
.nw-form { display: grid; gap: 16px; }
.nw-form fieldset legend { font-size: 1.05rem; font-weight: 600; float: none; margin-bottom: 12px; }

.nw-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; }
.nw-pager-info { color: var(--nw-text-muted); font-size: 14px; padding: 0 8px; font-variant-numeric: tabular-nums; }

/* Labels next to icons only from tablet width on, the icon stays with a hidden label */
@media (max-width: 767.98px) {
  .nw-label-md { display: none; }
}

/* File inputs: Safari keeps a light system button in dark mode without these colors */
.form-control::file-selector-button {
  background-color: var(--nw-bg-3);
  color: var(--nw-text);
}
.form-control:hover:not(:disabled):not([readonly])::file-selector-button { background-color: var(--nw-border); }

/* Setlists: numbered entries with a drag handle, headings set apart, inline forms */
.nw-icon { color: var(--nw-accent-text); font-size: 20px; flex: none; }
.nw-entry-heading { background: var(--nw-bg-2); }
/* Brief highlight of a piece that was added twice in a folder */
.nw-entry-flash { background: var(--nw-accent-subtle); outline: 2px solid var(--nw-accent); outline-offset: -2px; }
.nw-entry-heading strong { text-transform: uppercase; letter-spacing: 0.04em; font-size: 13px; color: var(--nw-text-muted); }
.nw-entry-text { display: flex; gap: 8px; padding: 0 14px 10px 48px; }
.nw-drag {
  display: inline-grid;
  place-items: center;
  width: var(--nw-touch);
  min-height: var(--nw-touch);
  margin-left: -10px;
  flex: none;
  color: var(--nw-text-muted);
  cursor: grab;
  touch-action: none;
  user-select: none;
  font-size: 20px;
}
.sortable-ghost { opacity: 0.4; }
.nw-inline { display: flex; flex-wrap: wrap; gap: 8px; }
.nw-inline .form-control { flex: 1 1 200px; width: auto; }
/* A file input has a wide natural size; in a growing column it fills the column and never reaches the button */
.nw-inline .nw-grow .form-control { width: 100%; flex: none; }
/* The growing column asks for room before the button gets its own: on a phone the button wraps below */
.nw-inline .nw-grow { flex: 1 1 260px; }
.nw-share code {
  display: block;
  padding: 10px 12px;
  border-radius: var(--nw-radius);
  background: var(--nw-bg-2);
  color: var(--nw-text);
  word-break: break-all;
}
@media (max-width: 767.98px) {
  .nw-entry-text { padding-left: 14px; }
}

/* Edit mode of a setlist: actions stay reachable, unsaved changes are announced */
.nw-edit-head { position: sticky; top: var(--nw-header-height); z-index: 10; background: var(--nw-bg); padding: 8px 0; margin-bottom: 8px; }
.nw-edit-foot { justify-content: flex-end; margin-top: 24px; }
.nw-unsaved { color: var(--bs-warning-text-emphasis); font-size: 14px; margin: 0 0 12px; }
.nw-hint { font-size: 14px; }
.nw-move { display: inline-flex; gap: 4px; }
.nw-entries .form-control-sm { min-height: 36px; }
.nw-danger-item { color: var(--bs-danger-text-emphasis) !important; }
@media (pointer: fine) {
  /* With a mouse dragging is enough; touch and keyboard users keep the arrows */
  .nw-move { opacity: 0.6; }
}

/* ---------- Administration (U4) ---------- */

/* The swatch of a color field gets its own outline, a dark color would vanish on the dark card.
   Bootstrap sets the border to 0 with !important, so this needs it too */
.form-control-color::-webkit-color-swatch { border: 1px solid var(--nw-text-muted) !important; border-radius: 4px; }
.form-control-color::-moz-color-swatch { border: 1px solid var(--nw-text-muted) !important; border-radius: 4px; }
/* Members: avatar, name with details, role and actions; the actions wrap below on phones */
.nw-member { flex-wrap: wrap; }
/* The name keeps a readable width; when the actions do not fit beside it they wrap below */
.nw-member > .nw-grow { flex: 1 1 14rem; }
.nw-member > .nw-grow small { overflow-wrap: anywhere; }
/* Usage table of an account */
.nw-usage { max-width: 48rem; }
.nw-usage th[scope="row"] { font-weight: 600; }
/* Permission groups of the role editor */
.nw-permissions { border: 0; margin: 16px 0; padding: 0; }
.nw-permissions legend { font-size: 1rem; font-weight: 600; }
.nw-member .nw-actions { margin-left: auto; }
.nw-member .nw-inline { flex-wrap: nowrap; }
.nw-member .nw-inline .form-select { width: auto; flex: none; }
/* Filter of the history (#252): event and page size side by side, as wide as their text from
   the small breakpoint on, sharing the row on phones */
.nw-history-filter { flex-wrap: nowrap; }
.nw-history-filter .form-select { width: auto; flex: 1 1 0; min-width: 0; }
@media (min-width: 576px) { .nw-history-filter .form-select { flex: none; } }

/* Instrument list: name, synonyms as badges, forms */
.nw-instrument { display: grid; gap: 10px; padding: 12px 14px; }
.nw-instrument-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nw-synonyms { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.nw-synonyms .nw-badge { display: inline-flex; align-items: center; gap: 4px; }
.nw-synonyms form { margin: 0; }
.nw-badge-remove {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
}
.nw-badge-remove:hover { background: var(--nw-border); }

/* Print design: the logo is judged on white, because the printout stays light in dark mode */
.nw-logo-preview {
  align-self: flex-start;
  max-width: 100%;
  max-height: 96px;
  padding: 8px;
  border: 1px solid var(--nw-border);
  border-radius: var(--nw-radius);
  background: #fff;
}
.nw-print-preview, .nw-font-sample { width: 100%; border: 1px solid var(--nw-border); border-radius: 10px; background: #fff; }
.nw-print-preview { height: 190px; }
.nw-font-sample { height: 230px; }
.nw-font-name { overflow-wrap: anywhere; }

/* ---------- Breakpoints (last, so they win over the components above) ----------
   Phone    below 768 px:  bottom bar, one column, icons instead of labels in tight rows
   Tablet   768-1199 px:   iPad; header nav, avatar without name, wider margins.
                           Portrait (768-991) puts filters and forms in two columns,
                           landscape (from 992, Bootstrap "lg") already in one row
   Desktop  from 1200 px:  name next to the avatar, wider content */

/* Tablet (iPad) */
@media (min-width: 768px) and (max-width: 1199.98px) {
  .nw-main { padding: 28px max(32px, env(safe-area-inset-right, 0px)) 40px max(32px, env(safe-area-inset-left, 0px)); }
  .nw-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Desktop */
@media (min-width: 1200px) {
  .nw-main { max-width: 1100px; }
}

/* Touch screens (phone and iPad): small buttons keep a touch target of 44 px */
@media (pointer: coarse) {
  .btn-sm { min-height: var(--nw-touch); min-width: var(--nw-touch); }
  .nw-modes button, .nw-entries .form-control-sm { min-height: var(--nw-touch); }
  .nw-badge-remove { min-width: var(--nw-touch); min-height: var(--nw-touch); }
}

/* Choice of the score list columns: a checkbox per field, the whole row is at least 44 px high */
.nw-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 16px; }
.nw-checks .form-check { display: flex; align-items: center; gap: 10px; min-height: var(--nw-touch); margin: 0; padding: 0; }
.nw-checks .form-check-input { margin: 0; flex: none; width: 1.25rem; height: 1.25rem; }
.nw-checks .form-check-label { flex: 1; padding: 10px 0; }
/* Color mode on the profile page of a phone: the buttons sit in a card, not in the menu */
.nw-card.nw-modes { padding: 8px; }
/* Checked boxes follow the accent of the user, not the Bootstrap default blue */
.nw-checks .form-check-input:checked { background-color: var(--nw-accent); border-color: var(--nw-accent); }
/* One choice per row with a description under the label, e.g. the modules of a group */
.nw-checks-list { grid-template-columns: 1fr; gap: 8px; }
.nw-checks-list .form-check { align-items: flex-start; min-height: 0; padding: 4px 0; }
.nw-checks-list .form-check-input { margin-top: 2px; }
.nw-checks-list .form-check-label { padding: 0; }
.nw-check-text { flex: 1; min-width: 0; }

/* Tiles of the start page and the group overview: whole tile is the link, at least 56 px high */
.nw-tiles { display: grid; grid-template-columns: 1fr; gap: 12px; list-style: none; padding: 0; margin: 0; }
.nw-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 12px 16px;
  border: 1px solid var(--nw-border);
  border-radius: 12px;
  background: var(--nw-bg);
  color: var(--nw-text);
  font-weight: 600;
  text-decoration: none;
}
.nw-tile:hover { background: var(--nw-bg-3); color: var(--nw-text); }
.nw-tile .bi { color: var(--nw-accent-text); flex: none; }
/* Tile with icon, title and a short description (inventory types) */
.nw-tile-lead { justify-content: flex-start; align-items: flex-start; height: 100%; }
/* Room between a list of tiles and what follows it on the page */
.nw-tiles-spaced { margin-bottom: 24px; }
.nw-tile-lead > .bi:first-child { font-size: 1.25rem; line-height: 1.3; }
.nw-tile-body { display: grid; gap: 2px; min-width: 0; }
.nw-tile-desc { color: var(--nw-text-muted); font-weight: 400; font-size: 0.9rem; }
@media (min-width: 768px) {
  .nw-tiles { grid-template-columns: repeat(2, 1fr); }
}

/* Figures on a module start page: big value with its label, two columns on a phone, as many as fit above */
.nw-figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; list-style: none; padding: 0; margin: 0 0 24px; }
.nw-figure {
  display: grid;
  gap: 2px;
  height: 100%;
  min-height: var(--nw-touch);
  padding: 12px 16px;
  border: 1px solid var(--nw-border);
  border-radius: 12px;
  background: var(--nw-bg);
  color: var(--nw-text);
  text-decoration: none;
}
a.nw-figure:hover { background: var(--nw-bg-3); color: var(--nw-text); }
.nw-figure-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.nw-figure-label { color: var(--nw-text-muted); font-size: 0.9rem; overflow-wrap: anywhere; }
@media (min-width: 768px) {
  .nw-figures { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* Error and logout page: a single centered notice instead of a page of content */
.nw-notice { max-width: 560px; margin: 48px auto 0; padding: 48px 24px; }
.nw-notice h1 { margin: 0; font-size: 1.4rem; font-weight: 700; }
.nw-notice .btn { margin-top: 8px; }

/* Toasts after an action (tutti.flash): bottom right on all widths. The container never blocks clicks, only the toasts themselves do. */
.nw-toasts {
  position: fixed;
  z-index: 1090;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.nw-toast {
  pointer-events: auto;
  border: 1px solid var(--nw-border);
  border-left: 4px solid var(--nw-toast-color);
  border-radius: var(--nw-radius);
  background: var(--nw-bg-2);
  color: var(--nw-text);
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.15);
}
.nw-toast-success { --nw-toast-color: var(--bs-success); }
.nw-toast-info { --nw-toast-color: var(--nw-accent); }
.nw-toast-warning { --nw-toast-color: var(--bs-warning); }
.nw-toast-danger { --nw-toast-color: var(--bs-danger); }
.nw-toast-body {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--nw-touch);
  padding: 8px 8px 8px 16px;
}
.nw-toast-body .bi { flex: none; color: var(--nw-toast-color); }
.nw-toast-body > span { flex: 1; }

/* ---------- Sidebar ----------
   Desktop (from 1200 px): a fixed column, always expanded (256 px). Tablet: the icon rail (72 px),
   expanded on demand, chosen by sidebar.js. Phone: a slim top bar and the same sidebar as a drawer. */
:root { --nw-side-w: 256px; --nw-side-rail: 72px; --nw-topbar-height: 56px; }

.nw-shell { display: flex; flex: 1; min-width: 0; }
.nw-page { flex: 1; min-width: 0; display: flex; flex-direction: column; }
/* Top bar: shown on phones, and on every width where there is no sidebar (#261) */
.nw-topbar {
  display: none;
  align-items: center;
  gap: 8px;
  min-height: var(--nw-topbar-height);
  padding: env(safe-area-inset-top, 0px) max(8px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px));
  background: var(--nw-bg-2);
  border-bottom: 1px solid var(--nw-border);
}
.nw-topbar .nw-mark { width: 28px; height: 28px; }
.nw-topbar-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.nw-scrim { display: none; }

.nw-sidebar {
  position: sticky;
  top: 0;
  z-index: 1030;
  flex: none;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: var(--nw-side-w);
  height: 100dvh;
  padding: 12px 12px max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  background: var(--nw-bg-2);
  border-right: 1px solid var(--nw-border);
  transition: width 0.15s ease;
}
html[data-nw-sidebar="collapsed"] .nw-sidebar { width: var(--nw-side-rail); }
.nw-sidebar-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: var(--nw-touch); }
.nw-sidebar .nw-brand { gap: 10px; min-width: 0; color: var(--nw-text); font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; text-decoration: none; }
.nw-side-toggle, .nw-side-close, .nw-topbar-button {
  display: inline-grid;
  place-items: center;
  width: var(--nw-touch);
  height: var(--nw-touch);
  flex: none;
  border: 0;
  border-radius: var(--nw-radius);
  background: transparent;
  color: var(--nw-text-muted);
  font-size: 18px;
}
.nw-side-toggle:hover, .nw-side-close:hover, .nw-topbar-button:hover { background: var(--nw-bg-3); color: var(--nw-text); }
.nw-side-close { display: none; }
/* Desktop: the sidebar is fixed, only tablets can collapse or expand it */
@media (min-width: 1200px) { .nw-side-toggle { display: none; } }

/* Group block: initial in a rounded square, name, chevron */
.nw-sidebar .nw-group-switch { position: relative; flex: none; }
.nw-sidebar .nw-group-button { width: 100%; gap: 10px; padding: 0 8px; text-align: left; background: var(--nw-bg); }
.nw-group-static { cursor: default; }
.nw-group-static:hover { background: var(--nw-bg); }
.nw-group-initial {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 7px;
  background: var(--nw-accent-subtle);
  border: 1px solid var(--nw-accent-border);
  color: var(--nw-accent-text);
  font-size: 14px;
  font-weight: 700;
}
.nw-sidebar .nw-group-name { flex: 1; max-width: none; }
.nw-sidebar .nw-group-chevron { margin-left: auto; }
/* Lists open below the block, as wide as the sidebar */
.nw-sidebar .nw-group-switch .nw-menu { min-width: 0; width: 100%; max-width: none; }
.nw-sidebar .nw-group-switch .nw-menu { left: 0; margin-top: 4px; }

/* Navigation: takes all free space and scrolls inside the column when there are many entries. It keeps a
   usable minimum (a heading and four entries), so the entries to the administration and the open user
   menu below can never squeeze it away (#315). On low screens the minimum gives way to the rows that must
   stay reachable: head, group switch, the administration entries and the folded user block need about
   310 px together (more in the icon rail, whose head is taller). */
.nw-sidebar-body {
  flex: 1 1 0;
  min-height: min(calc(var(--nw-touch) * 4 + 36px), max(0px, 100% - 310px));
  overflow-y: auto;
  scrollbar-width: thin;
  margin: 0 -4px;
  padding: 4px;
}
.nw-side-heading {
  margin: 18px 0 4px;
  padding: 0 12px;
  color: var(--nw-text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.nw-sidebar-body > nav:first-child > .nw-side-heading:first-child { margin-top: 4px; }
.nw-side-list { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.nw-side-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--nw-touch);
  padding: 0 12px;
  border-radius: var(--nw-radius);
  color: var(--nw-text-muted);
  font-weight: 500;
  text-decoration: none;
}
.nw-side-list .bi { flex: none; width: 20px; font-size: 18px; text-align: center; }
.nw-side-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nw-side-list a:hover { background: var(--nw-bg-3); color: var(--nw-text); }
.nw-side-list a[aria-current="page"] { background: var(--nw-accent-subtle); color: var(--nw-accent-text); font-weight: 600; }

/* Foot with the user block, which folds out upwards. It only takes the space the navigation leaves
   (shrinkable, never below its summary row) and scrolls on its own when the user menu is open on a low
   screen (#315). The administration entries have the higher shrink factor and give way much more, so
   the version line below the user stays visible as long as possible. */
.nw-sidebar-foot {
  flex: 0 1 auto;
  min-height: calc(var(--nw-touch) + 9px);
  overflow-y: auto;
  scrollbar-width: thin;
  padding-top: 8px;
  border-top: 1px solid var(--nw-border);
}
/* With the user menu folded the foot is small and keeps its full height (user and version line), so it
   never shows a scrollbar for a few pixels. Without :has() support the rule is ignored and it shrinks. */
.nw-sidebar-foot:not(:has(.nw-side-user[open])) { flex-shrink: 0; }

/* Tablet and desktop: content area and icon rail */
@media (min-width: 768px) {
  /* Collapsed: icons only, group block and user shrink to their symbol, menus open to the side */
  html[data-nw-sidebar="collapsed"] .nw-brand-name,
  html[data-nw-sidebar="collapsed"] .nw-side-label,
  html[data-nw-sidebar="collapsed"] .nw-group-name,
  html[data-nw-sidebar="collapsed"] .nw-group-chevron,
  html[data-nw-sidebar="collapsed"] .nw-user-name { display: none; }
  html[data-nw-sidebar="collapsed"] .nw-sidebar-head { flex-direction: column; justify-content: center; gap: 4px; }
  html[data-nw-sidebar="collapsed"] .nw-side-list a,
  html[data-nw-sidebar="collapsed"] .nw-sidebar .nw-group-button { justify-content: center; padding: 0; }
  html[data-nw-sidebar="collapsed"] .nw-side-heading { height: 1px; margin: 12px 8px; padding: 0; background: var(--nw-border); }
  html[data-nw-sidebar="collapsed"] .nw-side-heading span { display: none; }
  html[data-nw-sidebar="collapsed"] .nw-sidebar .nw-group-switch .nw-menu { left: calc(100% + 8px); top: 0; width: 280px; margin: 0; }
  .nw-main { max-width: 1100px; }
}
@media (min-width: 1200px) { .nw-main { max-width: 1200px; } }

/* Without a user (logout, errors) there is no sidebar: top bar with the mark on every width */
.nw-no-sidebar .nw-topbar { display: flex; }

/* Phone: top bar and drawer */
@media (max-width: 767.98px) {
  :root { --nw-header-height: var(--nw-topbar-height); }
  .nw-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
  }
  .nw-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(320px, 86vw) !important;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: none;
  }
  html[data-nw-drawer="open"] .nw-sidebar { transform: none; box-shadow: 0 0 40px rgb(0 0 0 / 0.35); }
  .nw-side-toggle { display: none; }
  .nw-side-close { display: inline-grid; }
  html[data-nw-drawer="open"] .nw-scrim { display: block; position: fixed; inset: 0; z-index: 1025; background: rgb(0 0 0 / 0.45); }
  .nw-toasts { bottom: max(16px, env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) { .nw-sidebar { transition: none; } }

/* The way to the administration: pinned above the user menu as plain entries (#466), the sections
   themselves replace the menus on the pages of the administration. Never competes with the main
   entries: shrinkable, never below one row, scrolls inside itself when the space is short (#315). */
.nw-side-admin {
  flex: 0 10 auto;
  min-height: calc(var(--nw-touch) + 9px);
  overflow-y: auto;
  scrollbar-width: thin;
  padding-top: 8px;
  border-top: 1px solid var(--nw-border);
}
.nw-side-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--nw-touch);
  padding: 0 12px;
  border-radius: var(--nw-radius);
  color: var(--nw-text-muted);
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}
.nw-side-summary::-webkit-details-marker { display: none; }
.nw-side-summary:hover { background: var(--nw-bg-3); color: var(--nw-text); }
.nw-side-summary > .bi:first-child { flex: none; width: 20px; font-size: 18px; text-align: center; }
.nw-side-caret { margin-left: auto; flex: none; transition: transform 0.15s ease; }
.nw-side-group[open] > .nw-side-summary .nw-side-caret { transform: rotate(180deg); }
.nw-side-group .nw-side-list { margin-top: 2px; }
/* Menus of the daily work (Für mich, Noten, Inventar, Ausleihe), inside the scrolling part of the
   sidebar. Entries are indented and tied to the menu by a line, in the icon rail they stay centered. */
.nw-side-group { margin-top: 8px; }
.nw-side-group .nw-side-list { margin-left: 22px; padding-left: 4px; border-left: 1px solid var(--nw-border); }
/* The sidebar foot needs no separator of its own below the administration block, which has one */
.nw-side-admin + .nw-sidebar-foot, .nw-side-admin ~ .nw-sidebar-foot { min-height: var(--nw-touch); border-top: 0; padding-top: 0; }
@media (min-width: 768px) {
  html[data-nw-sidebar="collapsed"] .nw-side-caret { display: none; }
  html[data-nw-sidebar="collapsed"] .nw-side-summary { justify-content: center; padding: 0; }
  html[data-nw-sidebar="collapsed"] .nw-side-group .nw-side-list { margin-left: 0; padding-left: 0; border-left: 0; }
  /* In the icon rail a line above each module menu and a muted menu icon keep the menus apart */
  html[data-nw-sidebar="collapsed"] .nw-side-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--nw-border); }
  html[data-nw-sidebar="collapsed"] .nw-side-group > .nw-side-summary { color: var(--nw-text-muted); }
}

/* Group list: one line per group, long names end with an ellipsis (full name in the tooltip) */
.nw-group-switch .dropdown-item { white-space: nowrap; }
.nw-group-switch .dropdown-item .nw-grow { overflow: hidden; text-overflow: ellipsis; }

/* User block: folds out upwards like the administration, no popup (sizing: see .nw-sidebar-foot) */
/* Same right edge as the other summaries (12 px), so the carets line up */
.nw-user-summary { padding: 0 12px 0 8px; }
.nw-user-summary .nw-user-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--nw-text); }
.nw-side-user[open] .nw-side-caret { transform: rotate(180deg); }
.nw-side-user-body { padding-top: 4px; }
.nw-side-user-head { margin: 0; padding: 4px 12px 2px; color: var(--nw-text-muted); font-size: 12px; overflow-wrap: anywhere; }
.nw-side-list button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: var(--nw-touch);
  padding: 0 12px;
  border: 0;
  border-radius: var(--nw-radius);
  background: transparent;
  color: var(--nw-text-muted);
  font-weight: 500;
  text-align: left;
}
.nw-side-list button:hover { background: var(--nw-bg-3); color: var(--nw-text); }
.nw-side-logout { margin: 8px 0 0; }
/* Color mode: three buttons in a row with icon and text */
.nw-side-modes { display: flex; gap: 4px; padding: 0 4px; margin: 0; }
.nw-side-modes button {
  flex: 1;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  min-height: var(--nw-touch);
  padding: 6px 2px;
  border: 1px solid var(--nw-border);
  border-radius: var(--nw-radius);
  background: transparent;
  color: var(--nw-text);
  font-size: 12px;
}
.nw-side-modes button .bi { font-size: 16px; line-height: 1; }
.nw-side-modes button[aria-pressed="true"] { background: var(--nw-accent); border-color: var(--nw-accent); color: #fff; }
@media (min-width: 768px) {
  /* Icon rail: symbols only, the color modes stack, name and mail are hidden */
  html[data-nw-sidebar="collapsed"] .nw-side-user-head,
  html[data-nw-sidebar="collapsed"] .nw-mode-text { display: none; }
  html[data-nw-sidebar="collapsed"] .nw-side-modes { flex-direction: column; padding: 0; }
  html[data-nw-sidebar="collapsed"] .nw-side-modes button { padding: 0; }
  html[data-nw-sidebar="collapsed"] .nw-side-list button { justify-content: center; padding: 0; }
}

/* Version line below the user block: muted, opens the changelog modal. In the icon rail only the
   symbol remains (title carries the version). */
.nw-side-version {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: var(--nw-touch);
  padding: 0 12px;
  border: 0;
  border-radius: var(--nw-radius);
  background: none;
  color: var(--nw-text-muted);
  font-size: 13px;
  text-align: left;
}
.nw-side-version:hover { background: var(--nw-bg-3); color: var(--nw-text); }
.nw-side-version .bi { flex: none; width: 20px; font-size: 16px; text-align: center; }
.nw-side-version-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Release stage pill next to the version (sidebar and changelog modal) */
.nw-stage-badge {
  flex: none;
  padding: 1px 8px;
  border: 1px solid var(--nw-border);
  border-radius: 999px;
  background: var(--nw-accent-subtle);
  color: var(--nw-text);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
}
@media (min-width: 768px) {
  html[data-nw-sidebar="collapsed"] .nw-stage-badge { display: none; }
  html[data-nw-sidebar="collapsed"] .nw-side-version { justify-content: center; padding: 0; }
  html[data-nw-sidebar="collapsed"] .nw-side-version-text { display: none; }
}

/* Changelog modal: surfaces and text from the tokens, so dark mode and accents match the rest */
.nw-changelog .modal-content { background: var(--nw-bg); color: var(--nw-text); border-color: var(--nw-border); }
.nw-changelog .modal-header, .nw-changelog .modal-footer { border-color: var(--nw-border); }
.nw-changelog .modal-body { overflow-wrap: anywhere; }
.nw-changelog-meta { margin: 0 0 12px; color: var(--nw-text-muted); font-size: 14px; }
.nw-changelog-list { margin: 0; padding-left: 20px; }
.nw-changelog-list li { margin-bottom: 6px; }
.nw-changelog-commit { margin-left: 6px; color: var(--nw-text-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.nw-changelog-license { flex-basis: 100%; margin: 0; color: var(--nw-text-muted); font-size: 13px; }
.nw-changelog-license a { color: var(--nw-accent-text); }
.nw-changelog .modal-footer { justify-content: space-between; }

/* QR code block (templates/_link.html): image left, link and actions right, stacked on phones */
.nw-qr { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
/* White frame keeps the code scannable in dark mode */
.nw-qr-img { width: 160px; height: 160px; max-width: 100%; padding: 6px; border-radius: 8px; background: var(--nw-paper); border: 1px solid var(--nw-border); }
.nw-qr-body { flex: 1 1 220px; min-width: 0; }
.nw-qr-url { overflow-wrap: anywhere; word-break: break-all; color: var(--nw-text); }

/* Label printing page: form beside the preview on wide screens, stacked on phones */
.nw-labels { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 992px) { .nw-labels { grid-template-columns: 320px minmax(0, 1fr); } }
.nw-labels-form { min-width: 0; }
.nw-labels-form legend { font-size: inherit; padding: 0; }
.nw-labels-result { min-width: 0; }
/* White paper look keeps the preview readable in dark mode */
.nw-labels-preview { display: block; max-width: 100%; height: auto; background: var(--nw-paper); border: 1px solid var(--nw-border); border-radius: 8px; }
.nw-labels-list-title { margin: 24px 0 8px; font-size: 1rem; font-weight: 600; }
.nw-labels-list { margin: 0; padding-left: 20px; overflow-wrap: anywhere; }

/* Demo installation (#256): note band under the top bar and the page /demo with one card per user */
.nw-demo-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 12px;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--nw-accent-border);
  background: var(--nw-accent-subtle);
  color: var(--nw-accent-text);
  font-size: 14px;
  text-align: center;
}
.nw-demo-band span { overflow-wrap: anywhere; }
.nw-demo-band a { display: inline-flex; align-items: center; min-height: var(--nw-touch); color: inherit; font-weight: 600; }
.nw-demo-rules { margin: 0; padding-left: 20px; }
.nw-demo-rules li { margin-bottom: 4px; }
.nw-demo-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 768px) { .nw-demo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.nw-demo-card { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.nw-demo-role { margin: 0; color: var(--nw-accent-text); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.nw-demo-name { margin: 0; font-size: 1.15rem; font-weight: 600; overflow-wrap: anywhere; }
.nw-demo-text { flex: 1; margin: 0 0 12px; }

/* Inventory categories */
.nw-category { flex-wrap: wrap; align-items: flex-end; gap: 12px; }
/* The form takes the whole row so a long note beside it cannot narrow it; the side wraps below. */
.nw-cat-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; flex: 1 1 100%; min-width: 0; }
/* Cards of makers and models on the category list stand apart like the other cards (#509) */
.nw-cat-form + .nw-cat-form { margin-top: 16px; }
.nw-cat-name { flex: 2 1 180px; min-width: 0; }
.nw-cat-prefix { flex: 1 1 100px; min-width: 0; max-width: 160px; }
.nw-cat-error { flex: 1 1 100%; }
.nw-cat-side { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; margin-left: auto; }
.nw-cat-add { padding: 12px; margin-top: 12px; }

/* Category fields for sizes (#211) */
.nw-cat-sizes { flex: 2 1 220px; min-width: 0; }
.nw-cat-hint { flex: 1 1 100%; margin-top: -4px; }
/* Section "Prüfung" of a category (#488): kinds and intervals as chips, then the default interval */
.nw-cat-checks { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; min-width: 0; padding-top: 8px; border-top: 1px solid var(--nw-border); }
.nw-cat-checks-title { flex: 1 1 100%; margin: 0; font-weight: 600; }
.nw-cat-checks-title small { font-weight: 400; }

/* Lists of values of a category as chips (#485): each value with ×, below a field to add more. Small badges in the
   accent colour (#511); the × stays a full touch target through its padding box, negative margins keep the chip small */
.nw-tags { display: flex; flex-direction: column; gap: 6px; flex-basis: 100%; }
.nw-tag-list { display: flex; flex-wrap: wrap; gap: 16px 6px; margin: 0; padding: 0; list-style: none; }
/* Jinja leaves whitespace in an empty list, so :empty alone never matches (gap under empty lists, #500) */
.nw-tag-list:empty, .nw-tag-list:not(:has(li)) { display: none; }
.nw-tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  padding: 1px 4px 1px 9px;
  border: 1px solid var(--nw-accent-border);
  border-radius: 999px;
  background: var(--nw-accent-subtle);
  color: var(--nw-accent-text);
  font-size: .8125rem;
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.nw-tag-remove {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 18px;
  height: 18px;
  /* Invisible padding widens the hit area (full --nw-touch wide, 36px high) without making the chip bigger; the row
     gap of the list is larger than the overhang, so the hit areas of wrapped rows never overlap */
  margin: -9px calc((18px - var(--nw-touch)) / 2);
  padding: 9px calc((var(--nw-touch) - 18px) / 2);
  box-sizing: content-box;
  border: 0;
  border-radius: 50%;
  background: transparent;
  background-clip: content-box;
  color: inherit;
  font-size: .625rem;
}
.nw-tag-remove:hover, .nw-tag-remove:focus-visible { background-color: var(--nw-accent-border); }
.nw-tag-add { display: flex; gap: 8px; }
.nw-tag-add .form-control { flex: 1 1 auto; min-width: 0; }
.nw-tag-add .btn { flex: none; }
.nw-cat-free { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 0 24px; margin: 0; }
/* Switch row of a category (#500): the whole row is a 44 px tap target, the label is clickable too.
   Off state: muted border and knob on a raised surface, so it stands out in light and dark; on: accent.
   The knob is a gradient, not Bootstrap's SVG, so that it can use the tokens. */
.nw-cat-free { gap: 0 32px; }
.nw-cat-free .form-check { display: flex; align-items: center; gap: 12px; min-height: var(--nw-touch); margin: 0; padding: 0; }
.nw-cat-free .form-check-input {
  --nw-knob: var(--nw-text-muted);
  float: none; flex: none; margin: 0;
  width: 2.75rem; height: 1.625rem;
  border: 2px solid var(--nw-text-muted);
  background-color: var(--nw-bg-3);
  background-image: radial-gradient(circle closest-side, var(--nw-knob) 0 calc(100% - 1px), transparent 100%);
  background-size: 1.125rem 1.125rem;
  background-position: left .15rem center;
  background-repeat: no-repeat;
}
.nw-cat-free .form-check-input:checked {
  --nw-knob: var(--nw-bg);
  background-color: var(--nw-accent);
  border-color: var(--nw-accent);
  background-position: right .15rem center;
}
.nw-cat-free .form-check-label { flex: 1; padding: 10px 0; cursor: pointer; }

/* Text field "Andere…" below the select of a listed field of the item form (#485) */
.nw-other-value { margin-top: 8px; }
.nw-other-value[hidden] { display: none; }

/* Inventory detail */
.nw-inv-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.nw-inv-note { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
/* Disabled retire button of an issued item (#482) with its reason beside it, on the line of the other actions */
.nw-retire-blocked { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Text to read behind a line at the left; on its own (a damage report, #425) it keeps its line breaks */
.nw-terms-text { margin: 0; padding: 10px 12px; border-left: 3px solid var(--nw-border); white-space: pre-wrap; overflow-wrap: anywhere; }
/* Loan terms (#419) from the macro terms_text (_terms.html, #437): headings and paragraphs like the slip,
   the breaks inside a paragraph are <br>, so white space is normal again */
.nw-terms-blocks { white-space: normal; }
.nw-terms-blocks > p { margin: 0; }
/* Spacing like the slip: a block right below another line follows closely, a blank line in the text
   (.nw-terms-gap) leaves a gap, a heading gets a little more room above */
.nw-terms-blocks > p + p { margin-top: 0.15em; }
.nw-terms-blocks > p + .nw-terms-heading { margin-top: 0.45em; }
.nw-terms-blocks > .nw-terms-gap { margin-top: 0.75em; }
.nw-terms-blocks > .nw-terms-heading.nw-terms-gap { margin-top: 1.05em; }
.nw-terms-heading { font-weight: 600; color: var(--nw-text); }
/* The terms a member confirmed (#421), folded below the time of the confirmation; the summary keeps a touch-sized row */
.nw-terms-confirmed > summary { cursor: pointer; padding: 10px 0; color: var(--nw-text); }
.nw-terms-confirmed[open] > summary { margin-bottom: 4px; }

/* Inventory photos and documents (#203) */
.nw-att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.nw-att-tile { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
/* An open management panel takes the whole row, a narrow tile would squeeze the form */
.nw-att-tile:has(details[open]) { grid-column: 1 / -1; }
.nw-att-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--nw-border);
  border-radius: 10px;
  background: var(--nw-bg-2);
  color: var(--nw-text-muted);
  font-size: 2rem;
}
.nw-att-thumb:hover { border-color: var(--nw-accent); }
.nw-att-tile:has(details[open]) .nw-att-thumb { max-width: 200px; width: 100%; }
.nw-att-thumb img { width: 100%; height: 100%; object-fit: cover; }
.nw-att-caption { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-width: 0; }
.nw-att-name { overflow-wrap: anywhere; }
.nw-att-doc-thumb {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border: 1px solid var(--nw-border);
  border-radius: 8px;
  background: var(--nw-bg-2);
  color: var(--nw-text-muted);
  font-size: 1.4rem;
}
.nw-att-doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.nw-att-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 8px; }
.nw-att-actions form { margin: 0; }
.nw-att-upload { height: 100%; }

/* Cover thumbnail in the inventory list (#203): a fixed box, so rows without a photo keep the column */
.nw-thumb {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--nw-bg-2);
  color: var(--nw-text-muted);
  vertical-align: middle;
}
.nw-thumb img { width: 100%; height: 100%; object-fit: cover; }
.nw-table td.nw-thumb-col, .nw-table th.nw-thumb-col { width: 56px; padding-right: 0; }

/* Inventory maintenance records on the detail page (#212) */
.nw-maint-item { padding: 10px 14px; }
.nw-maint-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.nw-maint-head .nw-maint-edit { margin-left: auto; min-height: var(--nw-touch); display: inline-flex; align-items: center; gap: 4px; }
.nw-maint-item p { margin: 4px 0 0; overflow-wrap: anywhere; }
.nw-maint-meta { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--nw-text-muted); font-size: 14px; }
.nw-badge-muted { background: transparent; border: 1px solid var(--nw-border); color: var(--nw-text-muted); }

/* Stocktaking checklist (#241): summary badges, scan field, filters, entry rows */
.nw-count-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.nw-count-scan { display: flex; flex-wrap: wrap; gap: 8px; }
.nw-count-scan .form-control { flex: 1 1 14rem; min-height: var(--nw-touch); }
.nw-count-scan .btn { min-height: var(--nw-touch); }
.nw-count-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.nw-count-filters .btn { min-height: var(--nw-touch); display: inline-flex; align-items: center; }
.nw-count-entry { padding: 10px 14px; }
.nw-count-head { display: flex; align-items: flex-start; gap: 8px; }
.nw-count-head .nw-grow strong { overflow-wrap: anywhere; }
.nw-count-remark { margin: 4px 0 0; overflow-wrap: anywhere; white-space: pre-line; }
.nw-count-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.nw-count-actions .btn, .nw-count-actions .form-control { min-height: var(--nw-touch); }
.nw-count-qty { width: 7rem; flex: none; }
.nw-count-more { margin-top: 8px; }
.nw-count-more summary { min-height: var(--nw-touch); display: flex; align-items: center; cursor: pointer; color: var(--nw-accent-text); }
.nw-count-more .btn { min-height: var(--nw-touch); }
.nw-count-pick { margin: 0 0 12px; padding: 0; list-style: none; }
.nw-count-pick li { min-height: var(--nw-touch); display: flex; align-items: center; gap: 8px; }
.nw-count-pick .form-check { padding-left: 0; margin: 0; }
.nw-count-pick .form-check-input { margin: 0; flex: none; width: 1.25rem; height: 1.25rem; float: none; }

/* Page "Ausgabe per Scan" (#219): camera panel, scanned rows, data of the loan */
.nw-scan-camera { margin-bottom: 16px; }
.nw-scan-camera video { display: none; width: 100%; max-height: 260px; object-fit: cover; border-radius: 10px; background: var(--nw-bg-2); margin-bottom: 8px; }
.nw-scan-camera.nw-scan-camera-on video { display: block; }
.nw-scan-camera .btn { min-height: var(--nw-touch); }
.nw-scan-status { margin: 8px 0 0; color: var(--nw-text-muted); overflow-wrap: anywhere; }
/* A scanned text without spaces (a long QR code) must not widen the page */
#scan-form .alert, .nw-scan-error { overflow-wrap: anywhere; }
.nw-scan-modes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.nw-scan-modes .btn { min-height: var(--nw-touch); display: inline-flex; align-items: center; gap: 6px; }
.nw-scan-row { padding: 10px 14px; }
.nw-scan-row-error { box-shadow: inset 3px 0 0 var(--bs-danger-text-emphasis); background: var(--bs-danger-bg-subtle); }
.nw-scan-head { display: flex; align-items: flex-start; gap: 8px; }
.nw-scan-head .nw-grow a { font-weight: 600; overflow-wrap: anywhere; }
.nw-scan-head .btn { min-width: var(--nw-touch); min-height: var(--nw-touch); }
.nw-scan-fields { display: grid; gap: 8px; margin-top: 8px; }
.nw-scan-fields .form-select, .nw-scan-fields .form-control { min-height: var(--nw-touch); }
@media (min-width: 768px) {
  .nw-scan-fields { grid-template-columns: 14rem 1fr; }
}
.nw-scan-error { margin: 6px 0 0; color: var(--bs-danger-text-emphasis); }

/* Charts (#373): one class colors the SVG path and the legend swatch alike */
.nw-chart-s1 { fill: var(--nw-chart-1); background-color: var(--nw-chart-1); }
.nw-chart-s2 { fill: var(--nw-chart-2); background-color: var(--nw-chart-2); }
.nw-chart-s3 { fill: var(--nw-chart-3); background-color: var(--nw-chart-3); }
.nw-chart-alert { fill: var(--nw-chart-alert); background-color: var(--nw-chart-alert); }
.nw-chart-grid { stroke: var(--nw-border); stroke-width: 1; }
/* User units of the SVG (viewBox 400 wide): about 11px on a phone, 13px in a desktop column */
.nw-chart-tick { fill: var(--nw-text-muted); font-size: 12px; }
/* The hit targets lie over the columns, so the hover tint stays faint */
.nw-chart-hit { fill: transparent; }
.nw-chart-hit:hover { fill: var(--nw-text); fill-opacity: 0.08; }
.nw-chart-svg { display: block; width: 100%; height: auto; }
/* Columns of at least 380px keep the axis text readable; cards keep their own height */
.nw-charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); align-items: start; gap: 12px; margin: 0 0 24px; }
.nw-chart { margin: 0; padding: 12px 16px; min-width: 0; border: 1px solid var(--nw-border); border-radius: var(--nw-radius); background: var(--nw-bg); color: var(--nw-text); }
.nw-chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; font-weight: 600; }
.nw-chart-total { color: var(--nw-text-muted); font-size: 0.9rem; font-weight: 400; font-variant-numeric: tabular-nums; }
.nw-chart-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; padding: 0; margin: 0 0 8px; font-size: 0.9rem; }
.nw-chart-legend li { display: inline-flex; align-items: center; gap: 6px; }
.nw-chart-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.nw-chart-empty, .nw-chart-note { margin: 8px 0 0; color: var(--nw-text-muted); font-size: 0.85rem; }
.nw-chart-table { margin-top: 8px; }
.nw-chart-table summary { min-height: var(--nw-touch); display: flex; align-items: center; cursor: pointer; color: var(--nw-text-muted); font-size: 0.9rem; }
.nw-chart-table .table { margin-bottom: 0; font-size: 0.85rem; }
.nw-chart-title { overflow-wrap: anywhere; }

/* forScore comparison: headings of cards look like those of sections, works get inner spacing */
.nw-card-title { margin-bottom: 12px; font-size: 1.15rem; font-weight: 600; }
.nw-work-body { padding: 0 14px 14px; }
.nw-work-body > :last-child { margin-bottom: 0; }
/* Differing fields: one stacked block per field, a row of field, values and choice from 1100 px; below,
   the content next to the sidebar is too narrow for four columns and the values would break inside words */
.nw-changes { margin: 12px 0 0; padding: 0; list-style: none; border: 1px solid var(--nw-border); border-radius: 10px; overflow: hidden; }
.nw-changes > li { display: grid; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--nw-border); }
.nw-changes > li:last-child { border-bottom: 0; }
.nw-change-field { font-weight: 600; overflow-wrap: anywhere; }
.nw-change-values { display: grid; gap: 2px 16px; margin: 0; }
.nw-change-values > div { display: flex; gap: 8px; min-width: 0; }
.nw-change-values dt { flex: none; width: 5rem; color: var(--nw-text-muted); font-size: 14px; font-weight: 400; }
.nw-change-values dd { flex: 1; min-width: 0; margin: 0; overflow-wrap: anywhere; }
.nw-change-take .form-check { display: flex; align-items: center; gap: 10px; min-height: var(--nw-touch); margin: 0; padding: 0; }
.nw-change-take .form-check-input { flex: none; margin: 0; width: 1.25rem; height: 1.25rem; }
.nw-change-take .form-check-input:checked { background-color: var(--nw-accent); border-color: var(--nw-accent); }
/* A disabled box keeps readable text, Bootstrap would fade the label below the contrast limit */
.nw-change-take .form-check-input:disabled ~ .form-check-label { opacity: 1; color: var(--nw-text-muted); }
@media (min-width: 1100px) {
  .nw-changes > li { grid-template-columns: 9rem minmax(0, 1fr) 13rem; align-items: center; gap: 16px; }
  .nw-change-values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Role picker of one member: groups of checkbox rows, one column on phones, two from tablet width */
.nw-role-mail { color: var(--nw-text-muted); overflow-wrap: anywhere; }
.nw-role-group { border: 0; margin: 20px 0 0; padding: 0; min-width: 0; }
.nw-role-group legend { float: none; width: auto; margin: 0 0 4px; padding: 0; font-size: 1.05rem; font-weight: 700; }
.nw-role-hint { margin: 0 0 8px; color: var(--nw-text-muted); font-size: 14px; }
.nw-role-choices { display: grid; grid-template-columns: 1fr; gap: 8px; }
.nw-role-choice { display: flex; align-items: flex-start; gap: 12px; min-height: var(--nw-touch); margin: 0; padding: 10px 12px; border: 1px solid var(--nw-border); border-radius: 10px; cursor: pointer; }
.nw-role-choice:hover { background: var(--nw-accent-subtle); }
.nw-role-choice:focus-within { outline: 2px solid var(--nw-accent); outline-offset: 2px; }
.nw-role-choice .form-check-input { flex: none; margin: 2px 0 0; width: 1.25rem; height: 1.25rem; float: none; }
.nw-role-choice .form-check-input:checked { background-color: var(--nw-accent); border-color: var(--nw-accent); }
.nw-role-choice .nw-check-text { display: flex; flex-direction: column; gap: 2px; }
.nw-role-name { overflow-wrap: anywhere; }
.nw-role-summary { color: var(--nw-text-muted); font-size: 14px; overflow-wrap: anywhere; }
@media (min-width: 768px) {
  .nw-role-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Connect an AI assistant (templates/_mcp_steps.html): assistant pills, copyable values, step blocks */
.nw-assistants { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.nw-assistant { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--nw-text); }
.nw-copy-list { display: grid; gap: 12px; margin-bottom: 8px; }
.nw-copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* Long addresses and commands wrap instead of widening the page on phones */
.nw-copy-value { flex: 1 1 220px; min-width: 0; padding: 6px 8px; border: 1px solid var(--nw-border); border-radius: 6px; background: var(--nw-bg-3); color: var(--nw-text); overflow-wrap: anywhere; word-break: break-all; }
.nw-copy { min-height: var(--nw-touch); white-space: nowrap; }
.nw-copy-label { display: inline-block; min-width: 4.5em; text-align: left; }

/* Save button before any change (#510, #521): outline, but with a border that stays visible on dark cards */
.btn-outline-secondary[data-save-button] { --bs-btn-border-color: var(--nw-text-muted); --bs-btn-color: var(--nw-text); }

/* Item form (#514): sections locked until name and category are set look inactive; the wrapper of the purchase
   section adds no box of its own */
.nw-lock-wrap { border: 0; padding: 0; margin: 0; min-width: 0; }
.nw-form fieldset[data-locked-section]:disabled { opacity: .5; }

/* Onboarding of new members (#534): welcome card above the pages of the group and on the profile,
   after "Später" a quiet line; the buttons wrap below the text on phones */
.nw-onboarding { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 24px; border-color: var(--nw-accent-border); background: var(--nw-accent-subtle); }
.nw-onboarding-text { display: flex; align-items: flex-start; gap: 12px; flex: 1 1 320px; min-width: 0; }
.nw-onboarding-icon { font-size: 28px; line-height: 1; color: var(--nw-accent-text); }
.nw-onboarding-title { margin: 0 0 4px; font-size: 1.1rem; font-weight: 600; }
.nw-onboarding-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* The bar drawn by hand: the native one keeps a light track in dark mode */
.nw-onboarding-progress { display: block; width: 100%; max-width: 240px; height: 8px; border: 0; border-radius: 4px; background: var(--nw-border); appearance: none; overflow: hidden; }
.nw-onboarding-progress::-webkit-progress-bar { background: var(--nw-border); border-radius: 4px; }
.nw-onboarding-progress::-webkit-progress-value { background: var(--nw-accent); border-radius: 4px; }
.nw-onboarding-progress::-moz-progress-bar { background: var(--nw-accent); border-radius: 4px; }
.nw-onboarding-steps { margin: 12px 0 0; padding: 0; list-style: none; }
.nw-onboarding-steps li { display: flex; align-items: center; gap: 8px; min-height: var(--nw-touch); }
.nw-onboarding-steps .is-done { color: var(--nw-text-muted); }
.nw-onboarding-steps .is-done .bi { color: var(--nw-accent-text); }
.nw-onboarding-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; margin: 0 0 16px; color: var(--nw-text-muted); font-size: 14px; }
.nw-onboarding-hint span { overflow-wrap: anywhere; }
.nw-onboarding-hint .bi { margin-right: 6px; }
.nw-onboarding-hint .btn-link { padding-left: 0; }
