/* ============================================================================
   aPunkt AI Fotostudio — Design-System (Single Source of Truth fürs Styling)
   CI: Navy #1B1D36 · Teal #00B0B9 · Plus Jakarta Sans. Kein Modul definiert
   eigene Primärfarben — nur diese Tokens nutzen. Mandanten-Akzent via --accent.
   ============================================================================ */

:root {
  /* Marken-CI */
  --navy:    #1B1D36;
  --navy-2:  #14152B;
  --navy-3:  #23264a;
  --teal:    #00B0B9;
  --teal-d:  #019aa2;
  --teal-l:  #33C4CB;
  --teal-pale:#E8F8F9;
  /* Mandanten-Akzent (wird pro Tenant überschrieben; Default = Teal) */
  --accent:  var(--teal);
  --accent-d:var(--teal-d);

  /* Neutralskala */
  --bg:      #F4F5F7;
  --surface: #ffffff;
  --surface-2:#FAFBFC;
  --line:    #E4E7EC;
  --line-2:  #EEF1F4;
  --ink:     #1A1D24;
  --muted:   #5A6A7A;
  --faint:   #9AAABB;

  /* Status */
  --ok:      #16A34A;  --ok-pale:#E9F7EF;
  --warn:    #D97706;  --warn-pale:#FEF3E2;
  --info:    #2563EB;  --info-pale:#E8F0FE;
  --danger:  #DC2626;  --danger-pale:#FCEBEB;

  /* Form */
  --r-s: 8px; --r: 12px; --r-l: 16px; --r-xl: 22px;
  --sh-s: 0 1px 3px rgba(16,24,40,.08);
  --sh:   0 8px 28px -14px rgba(16,24,40,.28);
  --sh-l: 0 18px 50px -20px rgba(16,24,40,.38);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --navbar-h: 78px;
  --logo-h: 54px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
/* Wurzel-Schutz gegen horizontalen Überlauf (Handy): nichts darf breiter als der
   Viewport rendern → kein seitliches „Wegscrollen" der Navbar/Inhalte. */
html, body { max-width: 100vw; overflow-x: hidden; }
body {
  font-family: var(--font); background: var(--bg); color: var(--ink);
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d4d9e0; border-radius: 8px; border: 2px solid var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ---------- App-Shell: Top-Navigation + volle Arbeitsfläche ----------
   Editor-Pattern: schlanke navy Leiste oben, darunter der ganze Bildschirm
   fürs Bearbeiten — die Navigation stört die Bildarbeit nicht (kein Sidebar,
   der Breite frisst). */
.app { display: flex; flex-direction: column; height: 100vh; min-height: 0; }

/* ---------- Top-Navbar (navy, horizontal) ---------- */
.navbar {
  flex: none; height: var(--navbar-h); background: var(--navy); color: #fff;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; padding: 0 26px;
}
.nb-brand { display: flex; align-items: center; flex: none; justify-self: start; }
.nb-brand img { height: var(--logo-h); width: auto; }
/* Vertikaler Strich: gleicher Abstand links (zur aPunkt-AI-Wortmarke) wie rechts
   (zum Produktnamen) — symmetrisch über margin, daher als eigenes Element. */
/* Logo-SVG hat rechts ~19px Eigen-Weißraum → linker Margin 0, damit Logo→Strich
   genauso groß wirkt wie Strich→Text (beide ~19px, symmetrisch). */
.nb-bdiv { width: 1.5px; height: 30px; background: rgba(255,255,255,.22); margin: 0 16px 0 0; flex: none; }
/* „Autostudio" = Produktname neben der aPunkt-AI-Wortmarke (nicht „aPunkt AI" doppeln). */
.nb-product { font-size: 17px; font-weight: 800; color: #fff; letter-spacing: -.01em; line-height: 1; }
.nb-nav { display: flex; align-items: center; gap: 6px; justify-self: center; }
/* Text-only Nav: kein Icon → Text exakt mittig. line-height:1 + gleiches
   Padding oben/unten = vertikal zentriert; justify-content:center = horizontal. */
.nb-a {
  display: flex; align-items: center; justify-content: center; height: 38px; padding: 0 18px; border-radius: 9px;
  color: rgba(255,255,255,.72); font-weight: 600; font-size: 14px; line-height: 1; letter-spacing: -.005em;
  transition: .12s; white-space: nowrap;
}
.nb-a:hover { background: rgba(255,255,255,.09); color: #fff; }
.nb-a.on { background: var(--accent); color: #fff; }
.nb-right { justify-self: end; display: flex; align-items: center; gap: 14px; }
/* Hamburger + Drawer-Backdrop: auf Desktop unsichtbar, nur Mobile (Media Query unten). */
.nb-burger { display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 42px; height: 42px; border-radius: 10px; padding: 0 10px; flex: none; }
.nb-burger span { display: block; height: 2px; border-radius: 2px; background: #fff; transition: .2s; }
.app.nav-open .nb-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.app.nav-open .nb-burger span:nth-child(2) { opacity: 0; }
.app.nav-open .nb-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.nb-scrim { display: none; }
.nb-standort select {
  background: var(--navy-3); color: #fff; border: 1px solid rgba(255,255,255,.14);
  border-radius: 9px; padding: 8px 11px; font-weight: 600; font-size: 12.5px;
}

/* ---------- Schlanke Titelzeile (persistente Title/Sub fürs Routing) ---------- */
.pagehead {
  flex: none; background: var(--surface); border-bottom: 1px solid var(--line);
  /* padding-left 45px = visueller Glyph-Beginn des Logos (das SVG hat links
     Eigen-Whitespace) → „Masken-Studio" steht exakt unter dem aPunkt-AI-Logo. */
  padding: 11px 26px 11px 45px; display: flex; align-items: baseline; gap: 13px;
}
.pagehead h1 { font-size: 16px; font-weight: 800; color: var(--navy); }
.pagehead .ph-sub { color: var(--muted); font-size: 12.5px; }

.tb-userwrap { position: relative; }
/* Konto-Button sitzt auf der NAVY Navbar → helle Schrift; Hover ist eine helle
   Aufhellung (NICHT var(--bg), sonst dunkle Schrift auf dunkel → nur im Hover lesbar). */
.tb-user { display: flex; align-items: center; gap: 9px; padding: 5px 9px 5px 6px; border-radius: 11px; transition: .12s; }
.tb-user:hover { background: rgba(255,255,255,.09); }
.tb-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.tb-avatar.lg { width: 44px; height: 44px; font-size: 17px; }
.tb-uname { text-align: left; line-height: 1.15; min-width: 0; }
.tb-uname b { display: block; font-size: 13px; font-weight: 700; color: #fff; white-space: nowrap; }
.tb-uname small { font-size: 11.5px; color: rgba(255,255,255,.62); }
.tb-caret { width: 15px; height: 15px; color: rgba(255,255,255,.55); transform: rotate(-90deg); flex: none; }
.tb-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 270px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--sh-l); padding: 16px; z-index: 70; }
.tb-menu-h { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.tb-menu-h b { font-size: 15px; color: var(--navy); }
.tb-menu-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tb-logout { width: 100%; justify-content: flex-start; }
@media (max-width: 920px) { .tb-uname { display: none; } }

.content { flex: 1; overflow: auto; padding: 22px 26px; min-height: 0; }
.content-wrap { max-width: 1600px; margin: 0 auto; }

/* Vollbild-View (Masken-Studio): randlos, füllt Breite + Höhe; Editor oben
   (flex:1), Footer als schlanke Leiste unten. Kein Seiten-Scroll. */
.content.content-full { padding: 0; overflow: auto; display: flex; flex-direction: column; }
.content.content-full .content-wrap { max-width: none; margin: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---------- Footer = schlanke Klappleiste (überall) ---------- */
.foot { flex: none; border-top: 1px solid var(--line); background: var(--surface); }
/* Auf normalen (scrollenden) Views blendet der Footer mit dem Seitenhintergrund —
   die weiße Leiste passt nur in den randlosen Editor (Masken-Studio / Pro Studio). */
.content:not(.content-full) .foot { background: transparent; margin-top: 10px; }
.foot-tog { display: flex; align-items: center; gap: 7px; width: 100%; padding: 8px 26px;
  font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .01em; }
.foot-tog:hover { color: var(--navy); }
.foot-chev { width: 13px; height: 13px; color: var(--faint); transition: transform .2s; }
.foot.open .foot-chev { transform: rotate(180deg); }
.foot-body { display: none; align-items: center; gap: 16px; padding: 0 26px 12px; color: var(--muted); font-size: 12.5px; }
.foot.open .foot-body { display: flex; }
.foot-pa { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-weight: 600; }
.foot-pa img { width: 26px; height: 26px; flex: none; }
.foot-pa-tx { white-space: nowrap; }
.foot-pa b { color: var(--navy); }
.foot-links { display: flex; gap: 18px; }
.foot-links a:hover { color: var(--accent-d); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 700; font-size: 13.5px; border-radius: 10px; padding: 10px 16px; transition: .13s;
  border: 1px solid transparent; white-space: nowrap; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-d); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-2); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--navy); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-d); }
.btn-soft { background: var(--teal-pale); color: var(--teal-d); }
.btn-soft:hover { background: #d6f2f4; }
.btn-sm { padding: 7px 11px; font-size: 12.5px; border-radius: 9px; }
.btn-lg { padding: 13px 22px; font-size: 15px; border-radius: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.card-pad { padding: 18px 20px; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-h h2, .card-h h3 { font-size: 15px; font-weight: 800; color: var(--navy); }
.card-h .spacer { margin-left: auto; }

/* Stat-Kachel (Chef-Cockpit) */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px 18px; }
.stat .v { font-size: 26px; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.stat .d { font-size: 11.5px; font-weight: 700; margin-top: 6px; }
.stat .d.up { color: var(--ok); } .stat .d.down { color: var(--danger); }

/* ---------- Felder ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; color: var(--ink); transition: .12s;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--teal-pale); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* ---------- Chips / Tags / Status ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 800;
  padding: 3px 9px; border-radius: 7px; letter-spacing: .01em; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.offen { background: var(--warn-pale); color: var(--warn); }
.tag.bearbeitet { background: var(--info-pale); color: var(--info); }
.tag.veroeffentlicht, .tag.fertig { background: var(--ok-pale); color: var(--ok); }
.tag.reserviert { background: var(--teal-pale); color: var(--teal-d); }

/* ---------- Tabelle ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint); padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:hover td { background: var(--surface-2); }
.table .thumb { width: 56px; height: 42px; border-radius: 7px; object-fit: cover; background: var(--bg); border: 1px solid var(--line); }

/* ---------- Segmented control ---------- */
.seg { display: inline-grid; grid-auto-flow: column; gap: 5px; background: #eef0f4;
  border: 1px solid var(--line); border-radius: 11px; padding: 4px; }
.seg button { font-size: 12.5px; font-weight: 700; color: var(--muted); border-radius: 8px; padding: 7px 13px; transition: .12s; }
.seg button:hover { color: var(--navy); }
.seg button.on { background: #fff; color: var(--accent-d); box-shadow: var(--sh-s); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; font-weight: 600; padding: 12px 20px; border-radius: 11px;
  box-shadow: var(--sh-l); opacity: 0; pointer-events: none; transition: .22s; z-index: 90; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(20,21,43,.5); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 80; padding: 24px; }
.modal { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-l);
  width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; }
.modal-h { display: flex; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-h h3 { font-size: 16px; font-weight: 800; color: var(--navy); }
.modal-h .x { margin-left: auto; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.modal-h .x:hover { background: var(--bg); color: var(--ink); }
.modal-b { padding: 22px; }
.modal-f { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); }

/* ---------- „Bildkreislauf" — Schritt-Ring (Studio) ---------- */
.flow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.flow-step { display: flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-weight: 700; font-size: 12.5px; color: var(--muted); }
.flow-step .n { width: 20px; height: 20px; border-radius: 50%; background: var(--bg); color: var(--muted);
  display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.flow-step.on { border-color: var(--accent); color: var(--accent-d); background: var(--teal-pale); }
.flow-step.on .n { background: var(--accent); color: #fff; }
.flow-step.done .n { background: var(--ok); color: #fff; }
.flow-arrow { color: var(--faint); }

/* ---------- Helpers ---------- */
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.h-title { font-size: 20px; font-weight: 800; color: var(--navy); }
.sub { color: var(--muted); font-size: 13px; }
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}
.grid-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* ---------- Responsive ---------- */
/* Laptop-Breite (~1280): die volle Nav (v. a. agentur mit „Agenturverwaltung")
   wird eng → Padding/Gap zurücknehmen, damit nichts kollidiert. Label bleibt. */
@media (max-width: 1340px) {
  .navbar { gap: 12px; padding: 0 18px; }
  .nb-a { padding: 0 11px; font-size: 13.5px; }
  .nb-nav { gap: 3px; }
  .nb-bdiv { margin: 0 12px 0 0; }
  .nb-standort select { padding: 7px 8px; font-size: 12px; }
}
@media (max-width: 1040px) {
  .navbar { gap: 12px; padding: 0 16px; }
  .nb-a { padding: 9px 12px; font-size: 13.5px; }
  .nb-bdiv { margin: 0 12px; }
}
@media (max-width: 820px) {
  /* Kein horizontaler Überlauf: keine Zelle/Karte darf die App breiter als den
     Viewport ziehen (sonst „wandert" die Navbar mit → Avatar abgeschnitten). */
  .app { overflow-x: hidden; }

  /* ---- Navbar wird zur kompakten Leiste: Logo links, rechts Avatar + Hamburger ---- */
  .navbar { display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 14px; overflow: visible; }
  .nb-brand img { height: 36px; }
  .nb-bdiv, .nb-product { display: none; }
  .nb-right { margin-left: auto; gap: 8px; }
  .nb-standort { display: none; }            /* Standort-Filter wandert in den Drawer-Bereich (Fahrzeuge hat eigene Filter) */
  .nb-burger { display: flex; }

  /* ---- Nav = Vollflächen-Drawer unter der Leiste (slide-in) ---- */
  .nb-nav { position: fixed; top: 60px; left: 0; right: 0; bottom: 0; z-index: 90;
    flex-direction: column; align-items: stretch; gap: 6px; padding: 14px;
    background: var(--navy); justify-self: auto;
    transform: translateX(-100%); transition: transform .22s ease; overflow-y: auto; }
  .app.nav-open .nb-nav { transform: translateX(0); }
  .nb-a { width: 100%; height: 54px; justify-content: flex-start; padding: 0 16px; font-size: 16px; border-radius: 12px; }
  .nb-scrim { display: block; position: fixed; inset: 60px 0 0 0; z-index: 85;
    background: rgba(8,9,18,.5); opacity: 0; pointer-events: none; transition: opacity .22s; }
  .app.nav-open .nb-scrim { opacity: 1; pointer-events: auto; }

  /* ---- Pagehead: kompakt; bei Vollbild-Views (Capture/Editoren) ganz weg → max. Platz ---- */
  .pagehead { padding: 9px 16px; }
  .pagehead .ph-sub { display: none; }
  .app.full-view .pagehead { display: none; }

  /* ---- Inhalt: schmaleres Padding, Touch-Targets ---- */
  .content { padding: 14px; }
  .tb-avatar { width: 38px; height: 38px; }

  /* ---- Tabellen (Fahrzeuge) → gestapelte Karten statt 7-Spalten-Raster ---- */
  .table { font-size: 14px; }
  .table thead { display: none; }
  .table tbody, .table tr, .table td { display: block; }
  .table tr { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px;
    padding: 12px 14px; background: var(--surface); }
  .table tr:hover td { background: transparent; }
  .table td { border: none; padding: 4px 0; }
  /* Feste Desktop-Spaltenbreiten (40% / 1%) im Karten-Layout neutralisieren +
     die nowrap-Datums-/Preiszelle umbrechen lassen, sonst Breiten-Überlauf. */
  .table td.cloud-col-veh { width: auto; padding-bottom: 8px; }
  .table td.cloud-acts-col { width: auto; }
  /* Inline-Style white-space:nowrap der Datums-/Preiszelle nur per !important schlagbar. */
  .table td:nth-child(4) div { white-space: normal !important; }
  /* Interne Nr · Standort · Datum · Fotozahl: in der Karte als Zeile mit Label statt eigene Spalten */
  .table td:nth-child(2)::before { content: 'Nr. '; }
  .table td:nth-child(3)::before { content: 'Standort: '; }
  .table td:nth-child(2), .table td:nth-child(3), .table td:nth-child(4), .table td:nth-child(5) {
    display: inline-block; font-size: 12.5px; color: var(--muted); margin-right: 14px; }
  .table .cloud-acts-col { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; margin-top: 6px; border-top: 1px solid var(--line-2); }
  .table .cloud-acts-col > * { min-width: 44px; min-height: 44px; }

  /* ---- Karten-Grids: einspaltig (cloud-statgrid bringt eigene 760px-Regel mit) ---- */
  .grid-2 { grid-template-columns: 1fr; }
  .grid-cards { grid-template-columns: 1fr; }
  .cloud-toolbar { flex-wrap: wrap; }
}
