/* Schriften liegen auf dem eigenen Server. Es wird nichts von Google oder anderen Dritten geladen. */

@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/instrument-sans-latin-ext-400-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/instrument-sans-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/instrument-sans-latin-ext-500-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/instrument-sans-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-mono-latin-ext-500-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
  --paper: #f6f5f2;
  --surface: #ffffff;
  --ink: #1f2024;
  /* Nebentext unter 18px. --muted erreicht auf paper nur 4,1:1 und bleibt großer Schrift vorbehalten. */
  --muted: #7a776f;
  --muted-text: #6b685f;
  --line: #d9d5cd;
  --line-strong: #b9b3a8;
  --brass: #8c6f3f;
  --danger: #8a3a2e;
  --ok: #3c6146;
  --placeholder: #b5b0a6;
  --ink-hover: #33353b;
  --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%231f2024' stroke-width='1.2'/%3E%3C/svg%3E");
  color-scheme: light;
  --radius: 2px;
  --sans: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.75rem;
  --step-3: clamp(2rem, 1.4rem + 3vw, 2.5rem);
  /* Seitenrand. Auf Geräten mit Notch nie kleiner als der sichere Bereich. */
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --pad-l: max(var(--gutter), env(safe-area-inset-left, 0px));
  --pad-r: max(var(--gutter), env(safe-area-inset-right, 0px));
}

/*
 * Dunkle Darstellung. Gleiche Rollen, gleiche Regeln: ein Akzent in Messing, keine Farbflächen.
 * theme.js setzt data-theme am <html>. Ohne Skript folgt die Seite der Einstellung des Geräts.
 */
:root[data-theme='dark'] {
  --paper: #141518;
  --surface: #1d1e22;
  --ink: #ecebe6;
  --muted: #8f8b82;
  --muted-text: #a6a298;
  --line: #33343a;
  --line-strong: #4a4b52;
  --brass: #b8965f;
  --danger: #e5917f;
  --ok: #8fc09b;
  --placeholder: #6a6862;
  --ink-hover: #d4d2cc;
  --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23ecebe6' stroke-width='1.2'/%3E%3C/svg%3E");
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --paper: #141518;
    --surface: #1d1e22;
    --ink: #ecebe6;
    --muted: #8f8b82;
    --muted-text: #a6a298;
    --line: #33343a;
    --line-strong: #4a4b52;
    --brass: #b8965f;
    --danger: #e5917f;
    --ok: #8fc09b;
    --placeholder: #6a6862;
    --ink-hover: #d4d2cc;
    --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23ecebe6' stroke-width='1.2'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
}

a {
  color: inherit;
}

button {
  font: inherit;
  cursor: pointer;
}

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

.sheet {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.sheet-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: calc(1.25rem + env(safe-area-inset-top, 0px)) var(--pad-r) 1.25rem var(--pad-l);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 10;
}

.wordmark {
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
}

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

.ghost-link {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: 0.8rem;
  color: var(--muted-text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.3rem 0.7rem;
  background: var(--surface);
  transition: border-color 0.15s ease, color 0.15s ease;
}

.ghost-link:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.sheet-body {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: clamp(2rem, 8vh, 5rem) var(--pad-r) 3rem var(--pad-l);
}

.sheet-foot {
  padding: 1rem var(--pad-r) calc(1.5rem + env(safe-area-inset-bottom, 0px)) var(--pad-l);
  border-top: 1px solid var(--line);
  color: var(--muted-text);
  font-size: 0.78rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Öffentliche Seite */

.panel {
  width: 100%;
  max-width: 34rem;
}

.panel[hidden] {
  display: none;
}

h1 {
  font-size: var(--step-3);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0 0 0.6rem;
  overflow-wrap: anywhere;
}

.lede {
  margin: 0 0 2.5rem;
  color: var(--muted-text);
  max-width: 44ch;
}

.field {
  display: block;
  margin-bottom: 1.5rem;
}

.field-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted-text);
  margin-bottom: 0.5rem;
}

#code-input,
.code-input {
  width: 100%;
  font-family: var(--mono);
  font-size: clamp(1.5rem, 6vw, 2.1rem);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 2px solid var(--brass);
  border-radius: var(--radius);
  padding: 1rem 0.75rem;
}

#code-input::placeholder,
.code-input::placeholder {
  color: var(--placeholder);
  letter-spacing: 0.18em;
}

#code-input:focus,
.code-input:focus {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  min-height: 2.5rem;
  padding: 0.45rem 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.3;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  background: var(--ink-hover);
  border-color: var(--ink-hover);
}

.btn:disabled {
  opacity: 0.5;
  cursor: progress;
}

.btn-wide {
  width: 100%;
}

.btn-quiet {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.btn-quiet:hover {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn-small {
  min-height: 0;
  padding: 0.4rem 0.8rem;
  font-size: 0.82rem;
  white-space: nowrap;
}

.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--line);
}

.btn-danger:hover {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--danger);
}

.message {
  margin: 0 0 1.25rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--danger);
  font-size: 0.9rem;
}

.message[hidden] {
  display: none;
}

.message.is-ok {
  color: var(--ok);
}

.file-list {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  border-top: 1px solid var(--line);
}

.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.file-row > div {
  min-width: 0;
}

.file-row .btn {
  flex-shrink: 0;
}

.file-name {
  overflow-wrap: anywhere;
}

.file-meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted-text);
}

/* Galerie: Dateiliste als Kacheln, sobald Bilder mit Vorschau dabei sind */

.panel.is-gallery {
  max-width: 64rem;
}

.file-list.is-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 1rem;
  border-top: 0;
}

.file-tile {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.tile-figure {
  position: relative;
  display: block;
  flex: none;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  cursor: zoom-in;
}

/* Absolut gesetzt, damit die Kachel ihr Seitenverhältnis behält, egal wie das Bild geschnitten ist. */
.tile-figure img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0.5rem;
  /* Grundrisse nie beschneiden */
  object-fit: contain;
}

.tile-figure:focus-visible {
  outline-offset: -2px;
}

.tile-figure.is-plain {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  color: var(--muted-text);
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  cursor: default;
}

.tile-body {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem 0.8rem;
}

.tile-body > div {
  min-width: 0;
}

.tile-body .file-name {
  font-size: 0.9rem;
  line-height: 1.35;
}

.tile-body .btn {
  flex-shrink: 0;
}

/* Große Ansicht */

.viewer {
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: var(--paper);
}

.viewer[open] {
  display: flex;
  flex-direction: column;
}

.viewer::backdrop {
  background: var(--paper);
}

html:has(.viewer[open]) {
  overflow: hidden;
}

.viewer-head,
.viewer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-left: var(--pad-l);
  padding-right: var(--pad-r);
}

.viewer-head {
  padding-top: calc(0.8rem + env(safe-area-inset-top, 0px));
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--line);
}

.viewer-foot {
  justify-content: center;
  padding-top: 0.8rem;
  padding-bottom: calc(0.8rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
}

.viewer-title {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.viewer-title .file-name {
  font-size: 0.95rem;
}

.viewer-stage {
  flex: 1;
  min-height: 0;
  padding: clamp(0.5rem, 2vw, 1.5rem);
}

.viewer-stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.2s ease;
}

/* Solange nur das kleine Bild da ist, leicht zurücknehmen. */
.viewer-stage.is-loading img {
  opacity: 0.55;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.5rem;
  margin: 0 0 2rem;
  padding: 0;
  font-size: 0.85rem;
  color: var(--muted-text);
}

.summary div {
  display: flex;
  gap: 0.4rem;
}

.summary dd {
  margin: 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Kopfzeile der Dateiansicht: links die Eckdaten, rechts die Aktionen in klein */
.files-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem 2rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.files-bar .summary {
  margin: 0;
}

.actions-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Bei wenigen Dateien wären die Knöpfe unten nur eine Wiederholung in Sichtweite. */
.panel.is-short .actions {
  display: none;
}

/* In der Listenansicht zieht die Liste selbst die Linie. */
.files-bar:has(+ .file-list:not(.is-gallery)) {
  padding-bottom: 0;
  border-bottom: 0;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}

/* Auswahl für den ZIP-Download im Panel */
.zip-bar {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.cell-pick {
  width: 2rem;
  padding-right: 0;
}

.pick {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--ink);
  vertical-align: middle;
  cursor: pointer;
}

@container detail (max-width: 52rem) {
  .table-stack .cell-pick {
    order: 0;
    flex: 0 0 2rem;
    width: 2rem;
  }

  .table-stack tr:has(.cell-pick) .cell-main {
    flex-basis: calc(100% - 2rem);
  }
}

/* Wechsel hell/dunkel: alles gleichzeitig, eine ruhige Überblendung der ganzen Seite. */
.theme-switching,
.theme-switching *,
.theme-switching *::before,
.theme-switching *::after {
  transition: none !important;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.5s;
  animation-timing-function: ease;
}

/* Adminbereich */

.admin-body {
  display: grid;
  grid-template-columns: clamp(14rem, 28vw, 22rem) minmax(0, 1fr);
  gap: 0;
  flex: 1;
  align-items: stretch;
}

.admin-aside {
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 1.25rem clamp(1rem, 2vw, 1.5rem) calc(1.25rem + env(safe-area-inset-bottom, 0px))
    max(clamp(1rem, 2vw, 1.5rem), env(safe-area-inset-left, 0px));
  overflow-y: auto;
}

.admin-detail {
  min-width: 0;
}

/* Die Tabellen richten sich nach der Breite dieser Spalte, nicht nach der
   des Bildschirms. Siehe @container weiter unten. */
.admin-main {
  container-type: inline-size;
  container-name: detail;
  padding: 1.25rem max(clamp(1rem, 3vw, 2rem), env(safe-area-inset-right, 0px))
    calc(3rem + env(safe-area-inset-bottom, 0px)) clamp(1rem, 3vw, 2rem);
}

.back-link {
  display: none;
}

.search-input {
  display: block;
  width: 100%;
  margin-bottom: 0.9rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink);
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  -webkit-appearance: none;
  appearance: none;
}

.search-input:focus {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.section-title {
  font-size: 0.8rem;
  color: var(--muted-text);
  margin: 0 0 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.code-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.code-card {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: border-color 0.15s ease;
}

.code-card:hover {
  border-color: var(--line-strong);
}

.code-card.is-active {
  border-color: var(--brass);
}

.code-card .code-value {
  font-family: var(--mono);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
}

.code-card .code-label {
  font-size: 0.82rem;
  color: var(--muted-text);
  overflow-wrap: anywhere;
}

.status {
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--muted-text);
}

.status.is-ok {
  color: var(--ok);
}

.status.is-blocked {
  color: var(--danger);
}

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

.card h2 {
  font-size: var(--step-1);
  font-weight: 500;
  margin: 0 0 1rem;
}

.card h3 {
  font-size: 0.95rem;
  font-weight: 500;
  margin: 1.5rem 0 0.6rem;
}

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

/* Breites Hauptfeld, schmales Zusatzfeld, z. B. Name und Gültigkeit */
.form-grid.is-wide-narrow {
  grid-template-columns: minmax(0, 3fr) minmax(8rem, 1fr);
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted-text);
}

.form-grid input,
.form-grid textarea {
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
}

.form-grid input::placeholder,
.form-grid textarea::placeholder,
.inline-form input::placeholder,
.login-card input::placeholder,
.search-input::placeholder {
  color: var(--placeholder);
}

.form-grid input:hover,
.form-grid textarea:hover,
.inline-form input:hover {
  border-color: var(--line-strong);
}

.form-grid input:focus,
.form-grid textarea:focus,
.form-grid select:focus {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.form-grid .span-all {
  grid-column: 1 / -1;
}

.hint {
  font-size: 0.78rem;
  color: var(--muted-text);
  margin: 0.4rem 0 0;
}

.card h2 + .hint {
  margin: 0 0 1rem;
}

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

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

.table th {
  text-align: left;
  font-weight: 500;
  color: var(--muted-text);
  font-size: 0.78rem;
  border-bottom: 1px solid var(--line);
  padding: 0.4rem 0.5rem 0.4rem 0;
}

.table td {
  border-bottom: 1px solid var(--line);
  padding: 0.5rem 0.5rem 0.5rem 0;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.table td.num,
.table th.num {
  font-family: var(--mono);
  font-size: 0.78rem;
  white-space: nowrap;
}

/* Lange IPv6-Adressen dürfen umbrechen, statt die Namensspalte zu zerdrücken. */
.table td.cell-ip {
  white-space: normal;
  max-width: 11rem;
}

.table .cell-main {
  min-width: 9rem;
}

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

.dropzone {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  color: var(--muted-text);
  font-size: 0.88rem;
  background: var(--paper);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.touch-only {
  display: none;
}

.dropzone .btn {
  gap: 0;
}

.dropzone.is-over {
  border-color: var(--ink);
  background: var(--surface);
  color: var(--ink);
}

.progress {
  height: 2px;
  background: var(--line);
  margin-top: 0.75rem;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ink);
  transition: width 0.2s ease;
}

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

.inbox-card {
  margin-bottom: 1.5rem;
}

/* Markierte Zeilen (neu, verlinkt) tragen ein Etikett "neu", keine Farbfläche. */
.table tr.is-marked td:first-child {
  font-weight: 500;
}

.row-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  align-items: center;
}

.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-card {
  width: min(22rem, 100%);
}

.login-card .login-hint {
  margin: 0 0 1rem;
}

.login-card .login-back {
  display: block;
  margin: 0.9rem auto 0;
}

.login-card input {
  width: 100%;
  font: inherit;
  padding: 0.65rem 0.7rem;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 0.9rem;
}

/* ---------- Schmale Detailspalte: Tabellen werden zu gestapelten Zeilen ---------- */

@container detail (max-width: 52rem) {
  .table-stack,
  .table-stack tbody {
    display: block;
  }

  .table-stack thead {
    display: none;
  }

  .table-stack tbody {
    border-top: 1px solid var(--line);
  }

  .table-stack tr {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.15rem 0.9rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--line);
  }

  .table-stack td {
    display: block;
    padding: 0;
    border: 0;
  }

  .table-stack td:empty {
    display: none;
  }

  .table-stack .cell-main {
    order: 1;
    flex: 1 1 100%;
    min-width: 0;
  }

  .table-stack .cell-sub {
    order: 2;
    flex: 1 1 100%;
    font-size: 0.82rem;
    color: var(--muted-text);
  }

  .table-stack td.num {
    order: 3;
    color: var(--muted-text);
    white-space: normal;
    max-width: none;
  }

  .table-stack .cell-actions {
    order: 4;
    flex: 1 1 100%;
    margin-top: 0.45rem;
  }

  .table-stack .row-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

}

/* ---------- Touch-Geräte: größere Tippflächen, kein Zoom beim Fokussieren ---------- */

@media (pointer: coarse) {
  .btn {
    min-height: 2.75rem;
  }

  .btn-small,
  .ghost-link {
    min-height: 2.5rem;
  }

  .ghost-link {
    display: inline-flex;
    align-items: center;
  }

  .sheet-head {
    align-items: center;
    padding-top: calc(0.7rem + env(safe-area-inset-top, 0px));
    padding-bottom: 0.7rem;
  }

  /* iOS zoomt in Felder mit weniger als 16px Schrift hinein. */
  .form-grid input,
  .form-grid textarea,
  .inline-form input,
  .search-input,
  .login-card input {
    font-size: 1rem;
    min-height: 2.75rem;
  }

  .text-link {
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
  }

  .select-small {
    font-size: 1rem;
    min-height: 2.5rem;
  }

  .tab {
    min-height: 2.75rem;
  }

  .form-grid input[type='date'] {
    -webkit-appearance: none;
    appearance: none;
  }

  .form-grid input::-webkit-date-and-time-value {
    text-align: left;
  }

  .code-card {
    padding: 0.85rem 0.9rem;
  }
}

@media (hover: none) and (pointer: coarse) {
  .drop-hint {
    display: none;
  }

  .touch-only {
    display: inline;
  }
}

/* ---------- Handy: Admin zeigt entweder Übersicht oder Detail ---------- */
/* Der Wert muss zu narrowLayout in admin.js passen. */

@media (max-width: 699.98px) {
  .admin-body {
    display: block;
  }

  .admin-aside {
    border-right: 0;
    overflow: visible;
    padding-left: var(--pad-l);
    padding-right: var(--pad-r);
  }

  .admin-main {
    padding-left: var(--pad-l);
    padding-right: var(--pad-r);
    padding-top: 1rem;
  }

  .admin-body[data-pane='list'] .admin-detail,
  .admin-body[data-pane='detail'] .admin-aside {
    display: none;
  }

  .back-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 2.75rem;
    padding: 0 var(--pad-r) 0 var(--pad-l);
    border: 0;
    border-bottom: 1px solid var(--line);
    background: none;
    color: var(--muted-text);
    font-size: 0.85rem;
    text-align: left;
  }

  .card {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .toolbar .btn {
    flex: 1 1 auto;
  }

  .dropzone {
    padding: 1.1rem;
  }
}

/* ---------- Handy: Kundenseite ---------- */

@media (max-width: 640px) {
  .sheet-body {
    padding-top: clamp(1.5rem, 5vh, 3rem);
    padding-bottom: 2rem;
  }

  .lede {
    margin-bottom: 2rem;
  }

  .files-bar {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
  }

  .actions-top {
    display: none;
  }

  /* Am Handy sind die Knöpfe nur unten, also dort immer zeigen. */
  .panel.is-short .actions {
    display: flex;
  }

  /* Die Aktionen bleiben am unteren Rand stehen, damit der ZIP-Download auch
     bei langen Dateilisten ohne Scrollen erreichbar ist. */
  .actions {
    position: sticky;
    bottom: 0;
    margin: 0 calc(-1 * var(--pad-r)) 0 calc(-1 * var(--pad-l));
    padding: 0.75rem var(--pad-r) calc(0.75rem + env(safe-area-inset-bottom, 0px)) var(--pad-l);
    background: var(--paper);
    border-top: 1px solid var(--line);
    gap: 0.5rem;
  }

  .actions .btn {
    flex: 1 1 auto;
    padding-left: 0.9rem;
    padding-right: 0.9rem;
    white-space: nowrap;
  }

  .file-list {
    margin-bottom: 0;
  }

  .file-row:last-child {
    border-bottom: 0;
  }

  .file-list.is-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
    margin-bottom: 1rem;
  }

  .tile-body {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    padding: 0.6rem;
  }

  .tile-body .file-name {
    font-size: 0.82rem;
  }

  /* Knöpfe einer Reihe auf gleicher Höhe, auch bei unterschiedlich langen Namen */
  .tile-body .btn {
    margin-top: auto;
  }

  .viewer-foot .btn {
    flex: 1 1 0;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .sheet-foot {
    flex-direction: column;
    gap: 0.25rem;
  }
}

/* Sehr schmale Handys: beide Knöpfe passen nicht in eine Zeile, die Leiste
   würde zu viel Platz nehmen. Dann steht sie normal unter der Liste. */
@media (max-width: 359.98px) {
  .actions {
    position: static;
  }

  .actions-top {
    display: flex;
  }
}

/* Handy im Querformat: wenig Höhe, deshalb nichts festkleben. */
@media (max-height: 480px) {
  .sheet-head,
  .actions {
    position: static;
  }

  .actions-top {
    display: flex;
  }
}

[hidden] {
  display: none !important;
}

/* ---------- Kundenbereich (/kunde) ---------- */

.text-input {
  width: 100%;
  font: inherit;
  font-size: 1.1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
}

.text-input::placeholder {
  color: var(--placeholder);
}

.text-input:focus {
  border-color: var(--line-strong);
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.text-input.is-code {
  font-family: var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.quiet-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  margin: 1.25rem 0 0;
  font-size: 0.85rem;
}

.text-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted-text);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

.text-link:hover {
  color: var(--ink);
}

.text-link:disabled {
  opacity: 0.5;
  cursor: progress;
}

.quiet-links + .hint {
  margin-top: 0.9rem;
}

.panel-area {
  max-width: 40rem;
}

.panel-area .lede {
  margin-bottom: 1.75rem;
  max-width: none;
  overflow-wrap: anywhere;
}

.tabs {
  display: flex;
  gap: 1.75rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.tab {
  margin-bottom: -1px;
  padding: 0.6rem 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted-text);
  font-size: 0.95rem;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab:hover {
  color: var(--ink);
}

.tab[aria-selected='true'],
.tab.is-current {
  color: var(--ink);
  border-bottom-color: var(--brass);
}

.tab-count {
  margin-left: 0.2rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted-text);
}

.tab-count:empty {
  display: none;
}

/* Die Galerie darf breit werden, das Senden bleibt eine schmale Spalte. */
.send-view {
  max-width: 42rem;
}

.dropzone-large {
  padding: 2.25rem 1.5rem;
}

.dropzone-large .drop-title {
  margin: 0;
  color: var(--ink);
}

.dropzone-large .hint {
  margin-top: 0.75rem;
}

.dropzone.is-busy {
  opacity: 0.55;
  pointer-events: none;
}

.upload-queue {
  margin: 1.25rem 0 0;
}

.upload-row > div:first-child {
  flex: 1;
}

.upload-row .progress {
  margin-top: 0.5rem;
}

.upload-status {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted-text);
  white-space: nowrap;
}

.upload-row.is-done .upload-status {
  color: var(--ok);
}

.upload-row.is-failed .upload-status {
  color: var(--danger);
}

.upload-error {
  margin-top: 0.2rem;
  font-size: 0.82rem;
  color: var(--danger);
}

.list-title {
  margin: 2.25rem 0 0.6rem;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted-text);
}

/* ---------- Admin: Kunden ---------- */

.customer-list {
  margin-bottom: 1.5rem;
}

.customer-list .empty {
  margin: 0;
  font-size: 0.82rem;
}

.badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0 0.35rem;
  border: 1px solid var(--brass);
  border-radius: var(--radius);
  color: var(--brass);
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.5;
  vertical-align: 0.1em;
  white-space: nowrap;
}

.invite-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.invite-box .code-display {
  font-family: var(--mono);
  font-size: clamp(1.2rem, 4vw, 1.6rem);
  letter-spacing: 0.12em;
  user-select: all;
}

.invite-box .hint {
  margin: 0;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.inline-form input {
  flex: 1 1 12rem;
  min-width: 0;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
}

.inline-form input:focus {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.code-card .customer-name {
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .tabs {
    gap: 1.25rem;
  }

  .dropzone-large {
    padding: 1.5rem 1rem;
  }
}

/* ---------- Kundenseite: Auswahl vor dem Senden ---------- */

.upload-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
  flex-shrink: 0;
}

.upload-side .text-link {
  font-size: 0.8rem;
}

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

.upload-actions + .hint {
  margin-top: 0.75rem;
}

/* ---------- Admin: Startseite und Bereiche ---------- */

.area-nav {
  display: flex;
  gap: 1.75rem;
  padding: 0 var(--pad-r) 0 var(--pad-l);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  overflow-x: auto;
}

.area-nav .tab {
  margin-bottom: 0;
  padding: 0.7rem 0;
}

.admin-home {
  flex: 1;
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 6vh, 4rem) var(--pad-r) 3rem var(--pad-l);
}

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

.home-tile {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.4rem 1.4rem 1.5rem;
  text-align: left;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.15s ease;
}

.home-tile:hover {
  border-color: var(--brass);
}

.home-label {
  font-size: var(--step-1);
  font-weight: 500;
}

.home-number {
  margin-top: 0.75rem;
  font-family: var(--mono);
  font-size: var(--step-3);
  line-height: 1.1;
}

.home-tile .status.is-new {
  color: var(--brass);
}

.home-text {
  margin-top: 0.75rem;
  font-size: 0.82rem;
  color: var(--muted-text);
}

/* Auf der Startseite gibt es weder Liste noch Detail. */
.admin-body[data-area='home'] {
  display: none;
}

/* Eingang und Team haben keine Liste: das Detail nutzt die ganze Breite. */
.admin-body[data-area='inbox'],
.admin-body[data-area='team'] {
  grid-template-columns: minmax(0, 1fr);
}

.admin-body[data-area='inbox'] .admin-aside,
.admin-body[data-area='team'] .admin-aside {
  display: none;
}

@media (max-width: 699.98px) {
  .admin-body[data-area='inbox'] .admin-detail,
  .admin-body[data-area='team'] .admin-detail {
    display: block;
  }

  .area-nav {
    gap: 1.25rem;
  }

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

  .upload-actions .btn {
    flex: 1 1 auto;
  }
}

/* ---------- Kundenseite: einloggen und registrieren nebeneinander ---------- */

.login-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

/* ---------- Kundenseite: Projekt und Kategorien beim Senden ---------- */

.label {
  display: block;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-text);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.step + .step {
  margin-top: 2.5rem;
}

.step-title {
  margin: 0 0 1rem;
  font-size: var(--step-1);
  line-height: 1.4;
  font-weight: 500;
}

.step-title .label {
  margin-bottom: 0.25rem;
}

.step .field:last-child {
  margin-bottom: 0;
}

textarea.text-input {
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
}

/* Auswahlfelder ohne Systemoptik. Der Pfeil ist ein kleines Inline-SVG in ink. */
.select {
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
  color: var(--ink);
  background-color: var(--surface);
  background-image: var(--arrow);
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.25rem;
  cursor: pointer;
}

.select-small {
  max-width: 13rem;
  font-size: 0.82rem;
  padding: 0.3rem 1.9rem 0.3rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-position: right 0.6rem center;
}

.select-small:hover {
  border-color: var(--line-strong);
}

.select:disabled {
  color: var(--muted-text);
  cursor: default;
}

.project-new {
  margin-top: 1.5rem;
}

.sort-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1.5rem;
  margin-top: 1.25rem;
}

.sort-summary {
  flex: 1 1 16rem;
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted-text);
}

.sort-bar + .upload-queue {
  margin-top: 0.75rem;
}

.upload-side .select-small {
  margin-bottom: 0.2rem;
}

.upload-row.is-done .select-small,
.upload-row .select-small:disabled {
  border-color: transparent;
  background-image: none;
  padding-right: 0.55rem;
}

.group-title {
  margin: 2rem 0 0.75rem;
  font-size: 0.9375rem;
  line-height: 1.4;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.group-title:first-child {
  margin-top: 0;
}

.group-object {
  margin-left: 0.5rem;
  font-weight: 400;
  color: var(--muted-text);
}

.file-tag {
  margin-bottom: 0.15rem;
}

#file-groups .file-list:last-child,
#sent-groups .file-list:last-child {
  margin-bottom: 0;
}

.send-view .list-title {
  font-size: var(--step-1);
  font-weight: 500;
  color: var(--ink);
  margin: 3rem 0 1rem;
}

@media (max-width: 640px) {
  .upload-row {
    flex-wrap: wrap;
  }

  .upload-row .upload-side {
    flex: 1 1 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
  }

  .upload-side .select-small {
    margin-bottom: 0;
    max-width: none;
    flex: 1 1 auto;
  }
}

/* ---------- Admin: Projekte beim Kunden ---------- */

.project-list {
  list-style: none;
  margin: 0 0 0.5rem;
  padding: 0;
  border-top: 1px solid var(--line);
}

.project-item {
  border-bottom: 1px solid var(--line);
}

.project-item summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.6rem;
  padding: 0.7rem 0;
  cursor: pointer;
  list-style: none;
}

.project-item summary::-webkit-details-marker {
  display: none;
}

.project-item summary::after {
  content: 'bearbeiten';
  order: 2;
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--muted-text);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

.project-item[open] summary::after {
  content: 'schließen';
}

.project-item .project-name {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.project-item .group-object {
  margin-left: 0;
  font-size: 0.85rem;
}

.project-item .status {
  order: 3;
  flex-basis: 100%;
}

.project-form {
  padding: 0.25rem 0 1.25rem;
}

.card h3 .group-object {
  margin-left: 0.4rem;
  font-weight: 400;
  font-size: 0.85rem;
}

.card .project-note {
  margin: -0.3rem 0 0.6rem;
}

.cell-category {
  white-space: nowrap;
}

.cell-category .select-small {
  max-width: 13rem;
}

.badge-quiet {
  border-color: var(--line-strong);
  color: var(--muted-text);
}

.upload-target {
  margin-top: 1.5rem;
  max-width: 22rem;
}

.upload-target .select {
  width: 100%;
  font-size: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  padding-left: 0.6rem;
}

/* Listenansicht ohne Projektüberschrift: die Liste zieht die Linie selbst. */
.files-bar:has(+ #file-groups > .file-list:first-child:not(.is-gallery)) {
  padding-bottom: 0;
  border-bottom: 0;
}

/* ---------- Kopfzeile: Aktionen rechts ---------- */

.head-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ---------- Admin: Inhalt nicht über die ganze Breite ziehen ---------- */

.admin-main > * {
  max-width: 60rem;
}

.card h2 {
  line-height: 1.3;
}

.card .toolbar + .hint {
  margin-top: 0.75rem;
}

@media (max-width: 640px) {
  .form-grid.is-wide-narrow {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Dunkle Darstellung: Einzelheiten ---------- */

/* Vorschaubilder sind auf Weiß gerechnet. Ein weißer Grund lässt Grundrisse nicht im Dunkeln schwimmen. */
:root[data-theme='dark'] .tile-figure:not(.is-plain) {
  background: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .tile-figure:not(.is-plain) {
    background: #ffffff;
  }
}

/* ---------- Kundenseite: Projekt als Auswahlliste ---------- */

.choice-list {
  display: grid;
  gap: 0.5rem;
}

.choice {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  width: 100%;
  padding: 0.75rem 1rem;
  text-align: left;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.15s ease;
}

.choice:hover {
  border-color: var(--line-strong);
}

.choice[aria-checked='true'] {
  border-color: var(--ink);
}

.choice[aria-checked='true'] .choice-title {
  font-weight: 500;
}

.choice.is-new {
  border-style: dashed;
  border-color: var(--line-strong);
  background: transparent;
}

.choice.is-new .choice-title {
  color: var(--muted-text);
}

.choice.is-new[aria-checked='true'] {
  border-style: solid;
  border-color: var(--ink);
  background: var(--surface);
}

.choice.is-new[aria-checked='true'] .choice-title {
  color: var(--ink);
}

.choice-title {
  font-size: 0.9375rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.choice-detail {
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--muted-text);
  overflow-wrap: anywhere;
}

.choice-more {
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

.step .field-label + .choice-list {
  margin-top: 0.25rem;
}

/* ---------- Kundenseite: Kategorien als Schaltflächen ---------- */

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

.chip {
  padding: 0.25rem 0.6rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--muted-text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.chip:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.chip[aria-checked='true'] {
  color: var(--ink);
  border-color: var(--ink);
  font-weight: 500;
}

.chip:disabled {
  cursor: default;
}

/* Während des Sendens zählt nur noch die gewählte Kategorie. */
.chips.is-locked .chip:not([aria-checked='true']) {
  display: none;
}

.sort-bar {
  display: block;
}

.sort-all {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 0.75rem;
}

/* ---------- Kundenseite: Zeile pro Datei mit Vorschau ---------- */

.upload-queue .upload-row {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  gap: 0.5rem 1rem;
  align-items: start;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}

.upload-thumb {
  width: 4.5rem;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #ffffff;
}

.upload-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.upload-thumb.is-plain {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  color: var(--muted-text);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

.upload-main {
  min-width: 0;
}

.upload-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  min-width: 0;
}

.upload-head .file-name,
.sent-list .file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-head .file-name {
  flex: 0 1 auto;
}

.upload-head .file-meta,
.upload-head .upload-status {
  flex-shrink: 0;
}

.upload-main .chips {
  margin-top: 0.5rem;
}

.upload-main .progress {
  margin-top: 0.6rem;
}

.upload-remove {
  font-size: 0.8rem;
  line-height: 1.6;
}

.upload-row.is-done .upload-status {
  color: var(--ok);
}

.upload-row.is-failed .upload-status {
  color: var(--danger);
}

.upload-row.is-failed .upload-thumb {
  opacity: 0.5;
}

@media (max-width: 640px) {
  .upload-queue .upload-row {
    grid-template-columns: 3.5rem minmax(0, 1fr);
  }

  .upload-thumb {
    width: 3.5rem;
  }

  .upload-remove {
    grid-column: 2;
    justify-self: start;
  }

  .upload-head {
    flex-wrap: wrap;
    row-gap: 0;
  }

  .upload-head .file-name {
    flex-basis: 100%;
  }
}
