/* CrossSell — Grundgestaltung. Farben/Schrift/Radius kommen aus app/design.py (data-design). */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
}

h1, h2, h3, h4 { font-family: var(--heading); line-height: 1.25; margin: 0 0 .6rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .muted { color: var(--muted); }
code { font-size: .875em; background: var(--surface2); padding: .1em .35em; border-radius: 4px; }

/* --- Kopfleiste --------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.topbar-inner {
  max-width: 1600px; margin: 0 auto; padding: .55rem 1rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--heading); font-size: 1.05rem; font-weight: 700; color: var(--text);
}
.brand:hover { text-decoration: none; color: var(--accent); }
.brand-mark {
  width: 28px; height: 28px; border-radius: calc(var(--radius) * .6);
  background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center; font-size: .8rem; font-weight: 700;
}
.nav { display: flex; gap: .15rem; flex-wrap: wrap; margin-left: auto; }
.nav a {
  padding: .35rem .6rem; border-radius: calc(var(--radius) * .6);
  color: var(--muted); font-size: .9rem;
}
.nav a:hover { background: var(--surface2); color: var(--text); text-decoration: none; }
.nav a.aktiv { background: var(--surface2); color: var(--text); font-weight: 600; }

.topbar-tools { display: flex; align-items: center; gap: .4rem; }
.topbar-tools form { display: flex; }
.icon-knopf {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: calc(var(--radius) * .6); padding: .3rem .5rem; cursor: pointer;
  font-size: .85rem; font-family: inherit;
}
.icon-knopf:hover { color: var(--text); border-color: var(--accent); }
select.icon-knopf { padding-right: 1.2rem; }

/* --- Seitenrahmen ------------------------------------------------------- */
.wrap { max-width: 1600px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.kopfzeile { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.kopfzeile h1 { margin: 0; }
.kopfzeile .muted { font-size: .9rem; }

.grid { display: grid; gap: 1rem; }
.grid.kpi { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem;
}
.card > h2, .card > h3 { margin-top: 0; }
.kpi-wert { font-size: 1.9rem; font-weight: 700; font-family: var(--heading); line-height: 1.1; }
.kpi-label { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }

/* --- Tabellen ----------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tbody tr:hover { background: var(--surface2); }
th a { color: inherit; }
.rechts { text-align: right; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }

/* --- Formulare ---------------------------------------------------------- */
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .2rem; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], input[type=search], select, textarea {
  width: 100%; padding: .5rem .6rem; font: inherit; font-size: 1rem;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: calc(var(--radius) * .5);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
textarea { min-height: 7rem; resize: vertical; }
.feld { margin-bottom: .9rem; }
.reihe { display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; }
.reihe > * { flex: 1 1 180px; }
.haken { display: flex; align-items: center; gap: .5rem; }
.haken input { width: 1.1rem; height: 1.1rem; }
.hinweis { font-size: .8rem; color: var(--muted); margin-top: .25rem; }

.btn {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 40px;
  padding: .45rem .9rem; font: inherit; font-size: .95rem; cursor: pointer;
  border-radius: calc(var(--radius) * .6); border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.06); }

/* --- Meldungen ---------------------------------------------------------- */
.flash {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 50;
  max-width: min(420px, calc(100vw - 2rem));
  padding: .75rem 1rem; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); box-shadow: 0 8px 28px rgba(0,0,0,.18); font-size: .92rem;
}
.flash.ok { border-left: 4px solid var(--accent); }
.flash.warn { border-left: 4px solid #d97706; }

/* --- Anmeldung ---------------------------------------------------------- */
.login-rahmen { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-karte { width: min(420px, 100%); }

/* --- Fuß ---------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: .82rem;
}
.footer-inner {
  max-width: 1600px; margin: 0 auto; padding: .8rem 1rem;
  display: flex; gap: 1rem; flex-wrap: wrap; align-items: center;
}
.footer-inner nav { margin-left: auto; display: flex; gap: .9rem; }
.env-chip {
  border: 1px solid var(--border); border-radius: 999px; padding: .1rem .55rem;
  font-size: .75rem; letter-spacing: .04em; text-transform: uppercase;
}

/* --- Schmale Geräte ----------------------------------------------------- */
@media (max-width: 900px) {
  .topbar-inner { gap: .5rem; }
  .nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .nav a { white-space: nowrap; }
}

@media (max-width: 720px) {
  body { font-size: 15px; }
  .wrap { padding: .9rem .6rem 2.5rem; }
  h1 { font-size: 1.35rem; }
  table thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tr { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .6rem; padding: .3rem .1rem; }
  td { border: none; padding: .3rem .7rem; }
  td::before {
    content: attr(data-label); display: block; font-size: .72rem;
    text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  }
  td.leer::before { content: none; }
  input, select, textarea { font-size: 16px; } /* verhindert Zoom auf iOS */
  .btn { min-height: 44px; }
  .flash { right: .5rem; left: .5rem; bottom: .5rem; max-width: none; }
}

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

/* --- Marke -------------------------------------------------------------- */
.cs-mark { flex: 0 0 auto; display: block; }
.cs-wordmark { font-family: var(--heading); font-weight: 600; letter-spacing: -.01em; }
.cs-wordmark-sell { font-weight: 800; color: var(--accent); }
.brand .cs-wordmark { font-size: 1.05rem; }
.login-marke { display: flex; justify-content: center; }
.login-marke .brand { font-size: 1.4rem; }
.login-marke .cs-wordmark { font-size: 1.4rem; }

/* --- Startseite --------------------------------------------------------- */
.hero {
  max-width: 1200px; margin: 2rem auto; padding: 1rem;
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 2rem; align-items: start;
}
.hero-brand { margin-bottom: 1rem; }
.hero h1 { font-size: clamp(1.9rem, 4vw, 3rem); margin-bottom: .8rem; }
.hero-lead { font-size: 1.08rem; color: var(--muted); max-width: 46ch; }
.hero-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.4rem; }
.merkmale { margin: 0; padding-left: 1.1rem; }
.merkmale li { margin-bottom: .55rem; }

/* --- Bilder ------------------------------------------------------------- */
.mini { width: 56px; height: 56px; object-fit: cover; border-radius: calc(var(--radius) * .5);
        background: var(--surface2); display: block; }
.mini-leer { display: grid; place-items: center; color: var(--muted); }

.bild-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.bild-raster.gross { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.bild { margin: 0; background: var(--surface2); border: 1px solid var(--border);
        border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.bild img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--surface2); }
.bild figcaption { padding: .5rem .6rem; font-size: .82rem; display: grid; gap: .35rem; }
.bild-aktionen { display: flex; gap: .25rem; }
.bild-aktionen form { display: flex; }

.avatar-vorschau { display: flex; }
.avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover;
          border: 2px solid var(--border); background: var(--surface2); }
.avatar-leer { display: grid; place-items: center; font-size: 2rem; font-weight: 700;
               color: var(--muted); font-family: var(--heading); }

/* --- Status-Kennzeichnungen --------------------------------------------- */
.chip { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .76rem;
        border: 1px solid var(--border); background: var(--surface2); color: var(--text);
        white-space: nowrap; }
.chip-draft { border-color: var(--border); color: var(--muted); }
.chip-online { border-color: #16a34a; color: #15803d; }
.chip-reserved { border-color: #d97706; color: #b45309; }
.chip-sold { border-color: #2563eb; color: #1d4ed8; }
.chip-paused { border-color: #6b7280; color: #4b5563; }
.chip-error { border-color: #dc2626; color: #b91c1c; }

/* --- Editor ------------------------------------------------------------- */
.editor-flaeche { min-height: 320px; background: var(--surface); color: var(--text);
                  border-radius: calc(var(--radius) * .5); }
.ql-toolbar.ql-snow, .ql-container.ql-snow { border-color: var(--border); font-family: var(--body); }
.ql-editor { min-height: 320px; font-size: 1rem; line-height: 1.6; }
.ql-editor h2 { font-size: 1.2rem; }
.ql-editor h3 { font-size: 1.05rem; }

/* --- Textseiten --------------------------------------------------------- */
.textseite { line-height: 1.65; }
.textseite h2 { margin-top: 1.4rem; }
.textseite h3 { margin-top: 1.1rem; }
.textseite table { margin: .8rem 0; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 1.2rem; }
}

.hero-brand { display: flex; align-items: center; gap: .7rem; }
.hero-brand .cs-wordmark { font-size: clamp(1.6rem, 3vw, 2.1rem); }

/* --- Menü „Verwaltung" -------------------------------------------------- */
.nav-mehr { position: relative; }
.nav-mehr > summary {
  list-style: none; cursor: pointer; padding: .35rem .6rem; font-size: .9rem;
  color: var(--muted); border-radius: calc(var(--radius) * .6); user-select: none;
}
.nav-mehr > summary::-webkit-details-marker { display: none; }
.nav-mehr > summary::after { content: " ▾"; font-size: .75em; }
.nav-mehr[open] > summary, .nav-mehr > summary:hover { background: var(--surface2); color: var(--text); }
.nav-mehr-liste {
  position: absolute; right: 0; top: calc(100% + .35rem); z-index: 30; min-width: 240px;
  display: grid; gap: .1rem; padding: .4rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
}
.nav-mehr-liste a { padding: .45rem .6rem; border-radius: calc(var(--radius) * .5); }
@media (max-width: 900px) {
  .nav-mehr-liste { position: static; box-shadow: none; border: none; padding: 0; }
}

/* --- Rechte-Raster ------------------------------------------------------ */
.rechte-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .35rem .8rem; }
.recht-zeile { display: flex; align-items: center; gap: .5rem; padding: .3rem .4rem;
               border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.recht-zeile .haken { margin: 0; }
