/* ============================================================
   ClassicDossier — App-Shell-Layout
   Ergänzt components.css (Optik von .cd-sidebar/.cd-navitem/.cd-masthead)
   um das eigentliche Layout: Sidebar (Desktop) ↔ Masthead + Bottom-Nav (mobil).
   Mobil-Breakpoint 900px (Tablets/Hochkant bekommen die Touch-Navigation).
   ============================================================ */

.cd-app { display: flex; min-height: 100vh; }
.cd-main { flex: 1; min-width: 0; }

/* Navigations-/Marken-Links ohne Unterstreichung */
.cd-sidebar a, .cd-navitem, .cd-sidebar__brand { text-decoration: none; }

/* Große Beträge nie umbrechen (sonst verrutschen Karten/Hero) */
.cd-summary__value, .cd-valuepair__value, .cd-bilanz__value, .cd-figure--display { white-space: nowrap; }

/* Summen-Labels auf feste 2 Zeilen → alle drei Beträge stehen auf einer Linie,
   auch wenn ein Label umbricht ("Geschätzter Sammlungswert"). */
.cd-summary__cell .cd-eyebrow { display: block; min-height: 2.6em; }

/* Fahrzeug-Karten: Inhalt als Spalte, Footer bündig unten → gleiche Optik
   trotz unterschiedlich langer Texte (Notiz, Beträge) */
.cd-vehicle-card__body { display: flex; flex-direction: column; height: 100%; }
.cd-vehicle-card__footer { margin-top: auto; padding-top: 13px; }
.cd-vehicle-card .cd-distribution { margin-top: 20px; }

/* ---- Sidebar (Desktop) ---- */
.cd-sidebar {
  width: 264px; flex: none;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.cd-sidebar__brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 22px; text-decoration: none; color: var(--cd-masthead-ink);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.cd-sidebar__nav { padding: 14px 12px 6px; display: flex; flex-direction: column; gap: 2px; }
.cd-sidebar__section {
  font-size: var(--cd-fs-eyebrow); letter-spacing: var(--cd-tracking-eyebrow);
  text-transform: uppercase; color: rgba(255,255,255,0.5); padding: 16px 14px 8px;
}
.cd-sidebar__list { padding: 0 12px; flex: 1; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 2px; }
.cd-sidebar__foot { padding: 6px 12px 8px; }
.cd-sidebar__user { display: flex; align-items: center; gap: 11px; padding: 14px; border-top: 1px solid rgba(255,255,255,0.08); }
.cd-sidebar__user-name { font-weight: var(--cd-fw-bold); font-size: 0.86rem; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cd-navitem svg { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cd-navitem span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-navitem__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* Marken-Monogramm + Wortmarke */
.cd-brand-mono {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1.4px solid rgba(255,255,255,0.4);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--cd-font-display); font-weight: 600; font-size: 0.95rem;
  color: var(--cd-accent-on-dark); flex: none;
}
.cd-brand-word { font-family: var(--cd-font-display); font-size: 1.25rem; line-height: 1; }
.cd-brand-word em { font-style: italic; }

.cd-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--cd-accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: var(--cd-fw-bold); font-size: 0.8rem;
}
.cd-iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--cd-radius-button);
  border: 1px solid rgba(255,255,255,0.18); background: transparent;
  color: rgba(255,255,255,0.7); cursor: pointer;
}
.cd-iconbtn:hover { color: #fff; border-color: rgba(255,255,255,0.4); }
.cd-iconbtn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Mobile-Shell (Masthead + Bottom-Nav) ---- */
.cd-masthead-m, .cd-bottomnav { display: none; }

/* ---- Fahrzeug-Leiste (Breadcrumb + Tabs) ---- */
.cd-fzbar { border-bottom: 1px solid var(--cd-line); padding: 18px var(--cd-page-pad-desktop) 0; }
.cd-breadcrumb { display: flex; align-items: center; gap: 10px; font-size: var(--cd-fs-meta); color: var(--cd-ink-soft); }
.cd-breadcrumb a { color: var(--cd-accent); text-decoration: none; }
.cd-tabs { margin-top: 16px; flex-wrap: wrap; }
.cd-tab { text-decoration: none; }   /* funktioniert auch als <a> */

/* ---- Formulare (Edit, Einstellungen, Neu, Fahrzeug …) ---- */
.cd-field { margin-bottom: 16px; }
.cd-label { display: block; font-size: var(--cd-fs-eyebrow); letter-spacing: var(--cd-tracking-eyebrow); text-transform: uppercase; font-weight: var(--cd-fw-bold); color: var(--cd-ink-faint); margin-bottom: 6px; }
.cd-input, .cd-select, .cd-textarea {
  width: 100%; min-height: var(--cd-touch-min); padding: 11px 13px;
  border: 1px solid var(--cd-line); border-radius: var(--cd-radius-button);
  background: var(--cd-surface); color: var(--cd-ink);
  font-family: var(--cd-font-body); font-size: 1rem; line-height: 1.4;
}
.cd-textarea { min-height: 96px; resize: vertical; }
.cd-input:focus, .cd-select:focus, .cd-textarea:focus { outline: none; border-color: var(--cd-accent); }
.cd-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 640px) { .cd-form-grid { grid-template-columns: 1fr; } }

.cd-banner { display: flex; gap: 11px; align-items: flex-start; padding: 13px 16px; border-radius: var(--cd-radius-card); font-size: 0.92rem; line-height: 1.5; }
.cd-banner--info { background: var(--cd-surface-2); border: 1px solid var(--cd-line); color: var(--cd-ink-soft); }
.cd-banner--warn { background: #F6EEDC; border: 1px solid #E4D2A6; color: var(--cd-warn); }
.cd-banner a { color: var(--cd-accent); }

/* Schlichte Datentabellen (km, TÜV-Belege, Dokumentzeilen) */
.cd-simpletable { width: 100%; border-collapse: collapse; }
.cd-simpletable th { text-align: left; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cd-ink-soft); font-weight: var(--cd-fw-bold); padding: 8px 10px; border-bottom: 2px solid var(--cd-ink); }
.cd-simpletable td { padding: 11px 10px; border-bottom: 1px solid var(--cd-line); font-size: 0.95rem; vertical-align: top; }
.cd-simpletable .cd-num { text-align: right; font-variant-numeric: tabular-nums; }
.cd-file { font-size: 0.9rem; color: var(--cd-ink-soft); }
.cd-track { height: 7px; background: var(--cd-line-soft); border-radius: var(--cd-radius-pill); overflow: hidden; }

/* Logbuch-Foto-Galerie */
.cd-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 13px; }
.cd-gallery-item { position: relative; aspect-ratio: 4/3; border-radius: 6px; overflow: hidden; border: 1px solid var(--cd-line); }
.cd-gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cd-gallery-del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,0.55); color: #fff; cursor: pointer; font-size: 13px; line-height: 1; }

/* Foto-Erfassung — Kamera-Streifen + Warte-Overlay.
   Klassen-/ID-Namen (rd-*) bleiben, weil foto-erfassung.js sie referenziert. */
.rd-warte { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; background: rgba(29,39,51,0.45); }
.rd-warte[hidden] { display: none; }
.rd-warte-card { background: var(--cd-surface); border: 1px solid var(--cd-line); border-radius: var(--cd-radius-card); padding: 20px 24px; display: flex; gap: 16px; align-items: center; box-shadow: var(--cd-shadow-card-hover); max-width: 360px; }
.rd-spinner { width: 30px; height: 30px; flex: none; border-radius: 50%; border: 3px solid var(--cd-line); border-top-color: var(--cd-accent); }
@media (prefers-reduced-motion: no-preference) { .rd-spinner { animation: cdspin 0.8s linear infinite; } }
@keyframes cdspin { to { transform: rotate(360deg); } }
.rd-seiten { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.rd-seiten[hidden] { display: none; }
.rd-seite { position: relative; width: 64px; height: 86px; border: 1px solid var(--cd-line); border-radius: 6px; overflow: hidden; background: var(--cd-surface-2); }
.rd-seite img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rd-seite .nr { position: absolute; left: 4px; bottom: 3px; font-size: 10px; background: rgba(0,0,0,0.6); color: #fff; padding: 0 5px; border-radius: 3px; }
.rd-seite .weg { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border: 0; border-radius: 50%; background: rgba(0,0,0,0.6); color: #fff; cursor: pointer; font-size: 12px; line-height: 1; }

/* ---- Raster-Helfer ---- */
.cd-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.cd-hero { display: grid; grid-template-columns: 360px 1fr; overflow: hidden; }

/* Belegliste-Tabellenraster (Beleg · Betrag · Status) */
.cd-beleg-grid { grid-template-columns: 2.4fr 1fr 1fr; }
.cd-bilanz-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
.cd-fzlist-grid { grid-template-columns: 2fr 1.1fr 0.7fr 1fr; }
.cd-table__row { text-decoration: none; color: inherit; }
a.cd-table__row:hover { background: var(--cd-paper); }
.cd-tagrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.cd-tagrow span { font-size: 11px; padding: 1px 9px; border-radius: var(--cd-radius-pill); background: var(--cd-surface-2); color: var(--cd-ink-soft); }
.cd-tagrow span.cd-tagrow__on { background: var(--cd-accent); color: #fff; }

@media (max-width: 900px) {
  .cd-sidebar { display: none; }
  .cd-grid-2 { grid-template-columns: 1fr; gap: 18px; }
  .cd-hero { grid-template-columns: 1fr; }
  .cd-fzbar { padding-left: var(--cd-page-pad-mobile); padding-right: var(--cd-page-pad-mobile); }
  .cd-stamm { grid-template-columns: 1fr 1fr; }
  .cd-summary { grid-template-columns: 1fr; }
  /* Belegzeilen mobil gestapelt (große, gut tippbare Zeilen) */
  .cd-beleg-grid { grid-template-columns: 1fr; gap: 6px; }
  .cd-beleg-grid .cd-num { text-align: left; }
  .cd-table__head.cd-beleg-grid { display: none; }
  .cd-summary__cell + .cd-summary__cell { border-left: 0; border-top: 1px solid var(--cd-line); }

  .cd-masthead-m {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px; position: sticky; top: 0; z-index: 20;
  }
  .cd-main { padding-bottom: 78px; }

  .cd-bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--cd-surface); border-top: 1px solid var(--cd-line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .cd-bottomnav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: var(--cd-touch-min); padding: 6px 0;
    text-decoration: none; color: var(--cd-ink-faint); font-size: 0.66rem; font-weight: var(--cd-fw-semi);
    position: relative;
  }
  .cd-bottomnav a.cd-bottomnav--active { color: var(--cd-accent); }
  .cd-bottomnav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .cd-bottomnav__count {
    position: absolute; top: 2px; left: calc(50% + 7px);
    background: var(--cd-accent); color: #fff; font-size: 0.6rem; font-weight: var(--cd-fw-bold);
    border-radius: var(--cd-radius-pill); padding: 0 5px; font-variant-numeric: tabular-nums;
  }
}
