/* ==========================================================================
   LINKLISTE — Stylesheet
   Bento-Look: schwarzer Grund, abgerundete Farbflächen, Pill-Knöpfe.
   Hauptfarben sind Orange und Schwarz, dazu Creme, Lavendel und Gelb.
   Mobil zuerst, Desktop danach. Alle Farben stehen hier oben unter :root.
   ========================================================================== */

:root {
  /* --- Farben ---------------------------------------------------------- */
  --ink:        #0b0b0b;   /* Hintergrund: Schwarz */
  --ink-soft:   #161616;   /* dunkle Kacheln, Panels */
  --ink-soft-2: #1f1f1f;   /* Eingabefelder, Zeilen */
  --ink-line:   #2c2c2c;   /* feine Trennlinien auf Schwarz */

  --orange:     #ff4a1e;   /* Hauptfarbe */
  --cream:      #ebe9de;   /* helle Fläche + Schrift auf Schwarz */
  --lavender:   #b7abdd;   /* Akzentfläche */
  --yellow:     #f2e63c;   /* Akzentfläche */
  --olive:      #8d8a14;   /* Akzentfläche, dunkler */

  --dim:        #8d8b84;   /* gedimmte Schrift auf Schwarz */
  --faint:      #5e5c57;
  --on-color:   #0b0b0b;   /* Schrift auf hellen Flächen */
  --on-color-2: rgba(11, 11, 11, 0.62);
  --red:        #e0342a;   /* Löschen / Fehler */

  /* --- Maße ------------------------------------------------------------ */
  --gap:  10px;
  --r-xl: 26px;   /* große Kacheln */
  --r-lg: 20px;   /* Panels innen, Bilder */
  --r-md: 14px;   /* Eingabefelder */
  --r-pill: 999px;

  --sans: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ==========================================================================
   Grundlagen
   ========================================================================== */

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

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 {
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.02;
  margin: 0 0 10px;
}

p { margin: 0 0 12px; }

:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}

.skiplink {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 999;
  background: var(--orange);
  color: var(--on-color);
  padding: 10px 18px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 600;
}
.skiplink:focus { left: 8px; }

.wrap {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 12px 32px;
}
.wrap--narrow { max-width: 520px; }

/* Nur für Screenreader */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Pill-Knöpfe — die Grundform der ganzen Seite
   ========================================================================== */

.pill,
.btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 18px;
  border: 1.5px solid var(--ink-line);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--cream);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease, transform 0.1s ease;
}
.pill:hover, .btn:hover {
  background: var(--cream);
  border-color: var(--cream);
  color: var(--on-color);
  text-decoration: none;
}
.pill:active, .btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.pill--fill,
.btn--orange {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--on-color);
  font-weight: 600;
}
.pill--fill:hover,
.btn--orange:hover { background: var(--cream); border-color: var(--cream); }

.btn--ghost { border-color: var(--ink-line); color: var(--dim); }
.btn--ghost:hover { background: transparent; border-color: var(--cream); color: var(--cream); }

.btn--red { border-color: rgba(224, 52, 42, 0.5); color: var(--red); }
.btn--red:hover { background: var(--red); border-color: var(--red); color: var(--cream); }

.btn--sm, .pill--sm { min-height: 36px; padding: 6px 14px; font-size: 13px; }
.btn--block { width: 100%; }

.btn .ico, .pill .ico { flex: none; }

/* Knöpfe auf hellen Flächen drehen die Farben um */
.on-color .btn,
.card .btn {
  background: var(--on-color);
  border-color: var(--on-color);
  color: var(--cream);
}
.on-color .btn:hover,
.card .btn:hover { background: #fff; border-color: #fff; color: var(--on-color); }

/* ==========================================================================
   Kopfleiste
   ========================================================================== */

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0 6px;
}
.topbar__brand {
  flex: none;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--cream);
  padding: 4px 2px;
}
.topbar__brand:hover { color: var(--orange); text-decoration: none; }

/* Die Knöpfe bleiben in einer Zeile und lassen sich notfalls schieben */
.topbar__nav {
  display: flex;
  gap: 6px;
  margin-left: auto;
  flex-wrap: nowrap;
  justify-content: flex-end;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}
.topbar__nav::-webkit-scrollbar { display: none; }
.topbar__nav .pill {
  flex: none;
  min-height: 38px;
  padding: 7px 15px;
  font-size: 14px;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero { padding: 10px 0 4px; }

.hero__day {
  font-size: 15px;
  color: var(--dim);
  margin: 0 0 2px;
}
.hero__day span { color: var(--faint); }

.hero__title {
  font-size: clamp(46px, 14vw, 104px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.92;
  margin: 0;
  word-break: break-word;
}

.hero__sub {
  font-size: 17px;
  line-height: 1.35;
  color: var(--dim);
  margin: 10px 0 0;
  max-width: 44ch;
}

/* --- Kennzahlen-Kacheln --------------------------------------------------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
  margin: 18px 0 0;
}
.tile {
  border-radius: var(--r-xl);
  padding: 16px 18px 18px;
  background: var(--ink-soft);
  color: var(--cream);
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.tile dt { font-size: 13px; opacity: 0.6; }
.tile dd {
  margin: 6px 0 0;
  font-size: clamp(22px, 7vw, 30px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
}

/* Farbverteilung der Kacheln */
.tile:nth-child(1) { background: var(--orange);   color: var(--on-color); }
.tile:nth-child(1) dt { opacity: 0.7; }
.tile:nth-child(2) { background: var(--cream);    color: var(--on-color); }
.tile:nth-child(2) dt { opacity: 0.55; }
.tile:nth-child(3) { background: var(--lavender); color: var(--on-color); }
.tile:nth-child(3) dt { opacity: 0.6; }
.tile:nth-child(4) { background: var(--ink-soft); color: var(--cream); }

/* ==========================================================================
   Suche, Kategorien, Sortierung
   ========================================================================== */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  align-items: center;
  margin: 18px 0 0;
}
.toolbar .spacer { flex: 1 1 auto; }

.search {
  display: flex;
  align-items: center;
  flex: 1 1 100%;
  gap: 4px;
  padding: 5px 5px 5px 16px;
  border-radius: var(--r-pill);
  background: var(--ink-soft);
  border: 1.5px solid transparent;
}
.search:focus-within { border-color: var(--orange); }

.search__icon { display: flex; align-items: center; color: var(--faint); flex: none; }

.search input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 42px;
  padding: 8px 6px;
  border: 0;
  background: transparent;
  color: var(--cream);
  font-family: var(--sans);
  font-size: 16px;
}
.search input::placeholder { color: var(--faint); }
.search input:focus { outline: none; }
.search input::-webkit-search-cancel-button { filter: invert(1) opacity(0.4); }

.search__go {
  flex: none;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--orange);
  color: var(--on-color);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  padding: 0 20px;
  min-height: 42px;
  cursor: pointer;
  transition: background 0.14s ease;
}
.search__go:hover { background: var(--cream); }

.search__clear {
  display: flex;
  align-items: center;
  padding: 0 8px;
  color: var(--faint);
  flex: none;
}
.search__clear:hover { color: var(--orange); text-decoration: none; }

/* Kategorien: waagerecht scrollbar am Handy */
.cats {
  display: flex;
  gap: 6px;
  margin: 12px -12px 0;
  padding: 2px 12px 10px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  scroll-snap-align: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  background: var(--ink-soft);
  color: var(--cream);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.14s ease, color 0.14s ease;
}
.chip:hover { background: var(--ink-soft-2); color: var(--cream); text-decoration: none; }
.chip b { font-size: 13px; font-weight: 500; color: var(--faint); }

.chip__dot {
  width: 9px; height: 9px;
  flex: none;
  border-radius: var(--r-pill);
  background: var(--orange);
}

.chip.is-active { background: var(--orange); color: var(--on-color); font-weight: 600; }
.chip.is-active b { color: rgba(11, 11, 11, 0.55); }
.chip.is-active .chip__dot { background: var(--on-color); }

/* Sortierung */
.sortbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--faint);
}
.sortbar > span:first-child { display: none; }
.sortbar__links { display: flex; gap: 6px; flex-wrap: wrap; }
.sortbar a {
  padding: 7px 14px;
  border-radius: var(--r-pill);
  color: var(--dim);
  font-size: 14px;
  border: 1.5px solid var(--ink-line);
}
.sortbar a:hover { color: var(--cream); border-color: var(--cream); text-decoration: none; }
.sortbar a.is-active {
  color: var(--on-color);
  background: var(--cream);
  border-color: var(--cream);
  font-weight: 600;
}
.sortbar__count { margin-left: auto; }

/* ==========================================================================
   Bento-Raster mit den Link-Karten
   ========================================================================== */

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 8px;
  border-radius: var(--r-xl);
  background: var(--cream);
  color: var(--on-color);
  transition: transform 0.16s ease;
}
.card:hover { transform: translateY(-3px); }

/* Der Sofort-Filter blendet Karten mit [hidden] aus — das muss "display: flex"
   oben überstimmen, sonst bleiben sie stehen. */
.card[hidden] { display: none; }

/* Farbverteilung: Creme bleibt führend, dazu Lavendel und Gelb */
.card:nth-child(4n+2) { background: var(--lavender); }
.card:nth-child(4n+4) { background: var(--yellow); }

.card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-lg);
  background: rgba(11, 11, 11, 0.07);
  overflow: hidden;
}
.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.card:hover .card__media img { transform: scale(1.04); }

/* Platzhalter ohne Bild: große Initialen */
.card__noimg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(40px, 13vw, 66px);
  font-weight: 700;
  letter-spacing: -0.05em;
  color: rgba(11, 11, 11, 0.22);
}

.card__badges {
  position: absolute;
  top: 8px; left: 8px;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  max-width: calc(100% - 16px);
}
.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  background: var(--on-color);
  color: var(--cream);
}
.badge--cat { background: rgba(255, 255, 255, 0.92); color: var(--on-color); }
.badge--new { background: var(--orange); color: var(--on-color); }

.card__price {
  position: absolute;
  right: 8px; bottom: 8px;
  padding: 6px 13px;
  border-radius: var(--r-pill);
  background: var(--on-color);
  color: var(--cream);
  font-size: 15px;
  font-weight: 600;
}

.card__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 14px 10px 8px;
  gap: 8px;
}

.card__host {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--on-color-2);
  min-width: 0;
  margin: 0;
}
.card__host img {
  width: 18px; height: 18px;
  flex: none;
  object-fit: contain;
  border-radius: 5px;
}
.card__host span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card__title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.03em;
  margin: 0;
  overflow-wrap: anywhere;
}

.card__note {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--on-color-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 6px;
}
.card__clicks { font-size: 13px; color: var(--on-color-2); margin-left: auto; }

/* Die ganze Karte ist klickbar, der Knopf bleibt trotzdem sichtbar */
.card__link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: var(--r-xl);
}

/* Hervorgehobene Karte: immer Orange */
.card--featured,
.card--featured:nth-child(4n+2),
.card--featured:nth-child(4n+4) { background: var(--orange); }
.card--featured .card__media { background: rgba(11, 11, 11, 0.12); }

/* ==========================================================================
   Leerer Zustand
   ========================================================================== */

.empty {
  border-radius: var(--r-xl);
  background: var(--ink-soft);
  padding: 44px 22px;
  text-align: center;
  margin: 16px 0 0;
}
.empty h2 { font-size: 26px; }
.empty p { color: var(--dim); }

/* ==========================================================================
   Meldungen
   ========================================================================== */

.note {
  margin: 14px 0 0;
  padding: 14px 18px;
  border-radius: var(--r-lg);
  background: var(--cream);
  color: var(--on-color);
  font-size: 15px;
  line-height: 1.45;
}
.note--ok   { background: var(--cream);    color: var(--on-color); }
.note--info { background: var(--lavender); color: var(--on-color); }
.note--err  { background: var(--red);      color: #fff; }

/* ==========================================================================
   Panels & Formulare (Admin)
   ========================================================================== */

.panel {
  position: relative;
  border-radius: var(--r-xl);
  background: var(--ink-soft);
  padding: 22px 16px;
  margin: 12px 0 0;
}
.panel > h2 { font-size: 24px; margin: 0 0 4px; }
.panel__hint { font-size: 14px; color: var(--dim); margin: 0 0 20px; }
.panel__hint a { color: var(--orange); }

.panel__num {
  position: absolute;
  top: 16px; right: 16px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: var(--ink-soft-2);
  color: var(--faint);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.field { display: block; margin: 0 0 16px; }
.field > span {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--cream);
  margin: 0 0 7px;
}
.field small {
  display: block;
  margin: 7px 2px 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--faint);
}

input[type="text"],
input[type="url"],
input[type="password"],
input[type="search"],
input[type="number"],
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  background: var(--ink-soft-2);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 16px;   /* 16px verhindert das Zoomen auf dem iPhone */
  line-height: 1.4;
}
textarea { min-height: 104px; resize: vertical; border-radius: var(--r-lg); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--orange);
}
input::placeholder, textarea::placeholder { color: var(--faint); }

select {
  -webkit-appearance: none;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--orange) 50%),
    linear-gradient(135deg, var(--orange) 50%, transparent 50%);
  background-position: calc(100% - 20px) 22px, calc(100% - 14px) 22px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 42px;
}

input[type="file"] {
  width: 100%;
  padding: 14px;
  border: 1.5px dashed var(--ink-line);
  border-radius: var(--r-lg);
  background: transparent;
  color: var(--dim);
  font-family: var(--sans);
  font-size: 14px;
}
input[type="file"]::file-selector-button {
  border: 0;
  border-radius: var(--r-pill);
  background: var(--cream);
  color: var(--on-color);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  padding: 9px 16px;
  margin-right: 14px;
  cursor: pointer;
}

.check {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: var(--r-lg);
  background: var(--ink-soft-2);
  font-size: 15px;
  cursor: pointer;
}
.check input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 24px; height: 24px;
  flex: none;
  margin: 0;
  border: 1.5px solid var(--ink-line);
  border-radius: 8px;
  background: var(--ink);
  cursor: pointer;
}
.check input[type="checkbox"]:checked {
  background: var(--orange);
  border-color: var(--orange);
  background-image: linear-gradient(var(--ink) 0 0), linear-gradient(var(--ink) 0 0);
  background-size: 11px 2.5px, 2.5px 11px;
  background-position: center, center;
  background-repeat: no-repeat;
}

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 14px; }

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 18px 0 0;
}

.fetch-status {
  font-size: 14px;
  line-height: 1.45;
  color: var(--dim);
  min-height: 20px;
  margin: 10px 2px 16px;
}
.fetch-status.ok  { color: var(--lavender); }
.fetch-status.err { color: #ff8a7a; }
.fetch-status.busy::after { content: ""; animation: dots 1.2s steps(4) infinite; }
@keyframes dots {
  0%  { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}

.preview-img {
  width: 100%;
  max-width: 260px;
  border-radius: var(--r-lg);
  background: var(--ink-soft-2);
  margin: 4px 0 0;
}

/* ==========================================================================
   Admin-Liste
   ========================================================================== */

.admin-list { list-style: none; margin: 14px 0 0; padding: 0; }

.admin-row {
  display: grid;
  grid-template-columns: 26px 54px 1fr;
  grid-template-areas:
    "handle thumb main"
    "act    act   act";
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--r-lg);
  background: var(--ink-soft-2);
  margin: 0 0 8px;
  touch-action: pan-y;
}
.admin-row.dragging { background: var(--ink-line); }

.admin-row__handle {
  grid-area: handle;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  color: var(--faint);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -2px;
  border-radius: var(--r-pill);
  background: var(--ink);
  user-select: none;
  touch-action: none;
}
.admin-row__handle:active { cursor: grabbing; color: var(--orange); }

.admin-row__thumb {
  grid-area: thumb;
  width: 54px; height: 54px;
  border-radius: var(--r-md);
  background: var(--ink);
  overflow: hidden;
}
.admin-row__thumb img { width: 100%; height: 100%; object-fit: cover; }
.admin-row__thumb.is-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 11px;
}
.admin-row__thumb.is-icon img { object-fit: contain; }
.admin-row__initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%; height: 100%;
  font-size: 16px;
  font-weight: 700;
  color: var(--faint);
}

.admin-row__main { grid-area: main; min-width: 0; }
.admin-row__main strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-row__main span {
  display: block;
  font-size: 13px;
  color: var(--faint);
  margin: 3px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-row__main .hot { color: var(--orange); }

.admin-row__actions { grid-area: act; display: flex; gap: 8px; flex-wrap: wrap; }
.admin-row__actions form { margin: 0; }

/* Kategorie-Zeilen */
.cat-row {
  display: grid;
  grid-template-columns: 26px 1fr;
  grid-template-areas:
    "handle main"
    "act    act";
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--r-lg);
  background: var(--ink-soft-2);
  margin: 0 0 8px;
}
.cat-row .admin-row__handle { grid-area: handle; }
.cat-row__main { grid-area: main; display: flex; align-items: center; gap: 9px; min-width: 0; flex-wrap: wrap; }
.cat-row__main strong { font-size: 16px; font-weight: 600; }
.cat-row__main em { font-size: 13px; font-style: normal; color: var(--faint); }

.cat-row__form { grid-area: act; display: flex; gap: 8px; align-items: flex-end; }
.cat-row__edit {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  /* Platz für den Löschen-Knopf daneben frei lassen */
  flex: 1 1 calc(100% - 52px);
  margin: 0;
}
.cat-row__edit input[name="name"]  { flex: 1 1 100%; }
.cat-row__edit input[name="color"] { flex: 0 1 110px; }
/* min-width: 0 — sonst bleiben Eingabefelder so breit wie ihre Standardgröße
   und der Speichern-Knopf rutscht in die nächste Zeile. */
.cat-row__form input[type="text"] {
  min-height: 40px;
  padding: 9px 14px;
  font-size: 15px;
  width: auto;
  min-width: 0;
  background: var(--ink);
}

/* ==========================================================================
   Login-Kasten
   ========================================================================== */

.login-box {
  border-radius: var(--r-xl);
  background: var(--ink-soft);
  padding: 30px 22px;
  margin: 18px 0 0;
}
.login-box h2 { font-size: 30px; }
.login-box .lead { font-size: 15px; color: var(--dim); margin: 0 0 24px; }

/* ==========================================================================
   Statistik-Kacheln (Admin)
   ========================================================================== */

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
  margin: 0 0 12px;
}
.stats > div {
  border-radius: var(--r-xl);
  background: var(--ink-soft);
  padding: 16px 18px;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.stats dt { font-size: 13px; color: var(--dim); }
.stats dd {
  margin: 6px 0 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
}
.stats > div:nth-child(1) { background: var(--orange);   color: var(--on-color); }
.stats > div:nth-child(1) dt { color: rgba(11, 11, 11, 0.65); }
.stats > div:nth-child(2) { background: var(--cream);    color: var(--on-color); }
.stats > div:nth-child(2) dt { color: rgba(11, 11, 11, 0.55); }
.stats > div:nth-child(3) { background: var(--lavender); color: var(--on-color); }
.stats > div:nth-child(3) dt { color: rgba(11, 11, 11, 0.6); }

/* ==========================================================================
   Fuß
   ========================================================================== */

.foot { margin: 14px 0 0; }
.foot__card {
  border-radius: var(--r-xl);
  background: var(--ink-soft);
  padding: 20px 18px;
}
.foot__line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--dim);
  font-size: 14px;
  margin: 0 0 10px;
}
.foot__links { display: flex; gap: 6px; margin-left: auto; }
.foot__fine {
  color: var(--faint);
  font-size: 13px;
  line-height: 1.5;
  max-width: 62ch;
  margin: 0;
}

/* ==========================================================================
   Symbole
   ========================================================================== */

.ico {
  display: inline-block;
  width: 18px; height: 18px;
  vertical-align: -4px;
}
.ico--line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ico--solid { fill: currentColor; stroke: none; }
.ico--lg { width: 22px; height: 22px; }

/* ==========================================================================
   Ab Tablet
   ========================================================================== */

@media (min-width: 640px) {
  :root { --gap: 12px; }

  .wrap { padding: 0 20px 48px; }
  .cats { margin-left: -20px; margin-right: -20px; padding-left: 20px; padding-right: 20px; }

  .search { flex: 1 1 340px; }

  .grid { grid-template-columns: repeat(2, 1fr); }

  .tiles, .stats { grid-template-columns: repeat(4, 1fr); }

  .grid-2 { grid-template-columns: 1fr 1fr; }

  .panel { padding: 28px 24px; }

  .sortbar > span:first-child { display: inline; }

  .admin-row {
    grid-template-columns: 30px 60px 1fr auto;
    grid-template-areas: "handle thumb main act";
  }
  .admin-row__thumb { width: 60px; height: 60px; }
  .admin-row__actions { flex-wrap: nowrap; }

  .cat-row {
    grid-template-columns: 30px minmax(0, 1fr) auto;
    grid-template-areas: "handle main act";
  }
  .cat-row__form { align-items: center; }
  .cat-row__edit { flex: 0 1 auto; flex-wrap: nowrap; }
  .cat-row__edit input[name="name"]  { flex: 0 1 150px; }
  .cat-row__edit input[name="color"] { flex: 0 1 110px; }
}

/* ==========================================================================
   Ab Desktop — hier wird aus dem Raster ein Bento
   ========================================================================== */

@media (min-width: 900px) {
  .wrap { padding: 0 28px 64px; }
  .cats { margin-left: -28px; margin-right: -28px; padding-left: 28px; padding-right: 28px; }

  .grid { grid-template-columns: repeat(3, 1fr); }

  /* Hervorgehobene Links nehmen zwei Spalten ein */
  .card--featured { grid-column: span 2; }
  .card--featured .card__media { aspect-ratio: 21 / 9; }
  .card--featured .card__title { font-size: 32px; }
  .card--featured .card__note { -webkit-line-clamp: 4; }

  .hero { padding: 16px 0 4px; }
  .hero__sub { font-size: 19px; }
}

@media (min-width: 1200px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
}

/* ==========================================================================
   Rücksichtnahme
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  .topbar, .cats, .toolbar, .foot { display: none; }
  body { background: #fff; color: #000; }
  .card { background: #fff; border: 1px solid #000; break-inside: avoid; }
}
