/* ============================================================
   CNC-DURCH-BLICK GmbH – gemeinsame Design-Schicht
   Gilt für Kundenbereich und Bürobereich.

   Aufbau:
   1. Zusatzwerte
   2. Grundflächen und Typografie
   3. Klarer Fokus (aktiver / zurückgenommener Bereich)
   4. Fortschrittsleiste (Kundenseite)
   5. Übersicht der Anfrage (Kundenseite)
   6. Bereiche, Positionen, Fotos
   7. Bürobereich: Registerkarten, Karten, Tabellen, Summen
   ============================================================ */

/* ---------------------------- 1. Zusatzwerte ---------------------------- */
:root {
  --r-xl: 18px;
  --r-lg: 14px;
  --r-md: 11px;
  --r-sm: 8px;
  --muted: #6d7885;
  --surface-2: #fbfcfe;
  --ring: 0 0 0 3px rgba(50, 102, 175, .16);
  --shadow-soft: 0 1px 2px rgba(16, 31, 45, .05), 0 6px 18px rgba(16, 31, 45, .05);
  --shadow-aktiv: 0 2px 6px rgba(16, 31, 45, .06), 0 18px 38px rgba(16, 31, 45, .11);
  --zurueck: .55;
}

/* ---------------------------- 2. Grundflächen ---------------------------- */
[hidden] {
  display: none !important;
}

body {
  background:
    radial-gradient(1200px 420px at 50% -120px, #e9f0fa 0%, rgba(233, 240, 250, 0) 70%),
    linear-gradient(180deg, #eef3fa 0%, var(--bg) 320px, var(--bg) 100%);
}

.card {
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  background: var(--surface);
}

.card-head h2,
.card-head h3 {
  letter-spacing: -.01em;
}

.card-head {
  align-items: center;
}

h1 {
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.05rem);
  letter-spacing: -.02em;
  line-height: 1.15;
}

.feld > span,
.feld-gruppe__titel {
  letter-spacing: .01em;
}

/* Eingabefelder: ruhiger Rahmen, klarer Fokus */
.feld input,
.feld select,
.feld textarea {
  border-radius: var(--r-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.feld input:focus,
.feld select:focus,
.feld textarea:focus,
button:focus-visible,
a:focus-visible,
.btn:focus-visible {
  outline: none;
  border-color: var(--navy);
  box-shadow: var(--ring);
}

.btn {
  border-radius: var(--r-sm);
  transition: transform .12s ease, box-shadow .15s ease, background-color .15s ease;
}

.btn--primary {
  box-shadow: 0 1px 2px rgba(16, 31, 45, .08), 0 8px 20px rgba(50, 102, 175, .18);
}

.btn--primary:hover {
  transform: translateY(-1px);
}

/* ---------------------------- 3. Klarer Fokus ---------------------------- */
.karte-fokus {
  transition: opacity .22s ease, box-shadow .22s ease, border-color .22s ease, background-color .22s ease;
}

.karte-fokus.is-aktiv {
  border-color: var(--navy);
  box-shadow: var(--shadow-aktiv);
  background: var(--surface);
  opacity: 1;
}

.karte-fokus.is-inaktiv {
  opacity: var(--zurueck);
  box-shadow: none;
  background: var(--surface-2);
}

.karte-fokus.is-inaktiv:hover,
.karte-fokus.is-inaktiv:focus-within {
  opacity: .82;
}

.karte-fokus.is-inaktiv .card-head h2 {
  color: var(--steel);
}

/* Erledigte Karte: kompakte Zusammenfassung statt Felder */
.karte-kurz {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: #f2f6fb;
  border: 1px solid #e3ebf5;
}

.karte-kurz__text {
  color: var(--steel);
  font-size: .95rem;
}

.karte-kurz__text strong {
  color: var(--ink);
}

.karte-kurz__haken {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 700;
  font-size: .8rem;
  margin-right: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .karte-fokus,
  .btn {
    transition: none;
  }
}

/* ---------------------------- 4. Fortschrittsleiste ---------------------------- */
.fortschritt {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.fortschritt__leiste {
  height: 4px;
  border-radius: 999px;
  background: #e8eef7;
  overflow: hidden;
  margin: 2px 6px 4px;
}

.fortschritt__balken {
  height: 100%;
  width: 33%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--navy) 0%, var(--accent-light) 100%);
  transition: width .25s ease;
}

.fortschritt__schritt {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
}

.fortschritt__schritt:hover {
  background: #f4f8fd;
}

.fortschritt__nr {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #eef2f7;
  color: var(--steel);
  font-weight: 700;
  font-size: .82rem;
}

.fortschritt__text {
  display: block;
  min-width: 0;
}

.fortschritt__text strong {
  display: block;
  font-size: .96rem;
}

.fortschritt__text span {
  display: block;
  font-size: .8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fortschritt__schritt.is-aktiv {
  background: #fff;
  border-color: var(--navy);
  box-shadow: 0 4px 14px rgba(16, 31, 45, .10);
}

.fortschritt__schritt.is-aktiv .fortschritt__nr {
  background: var(--navy);
  color: #fff;
}

.fortschritt__schritt.is-fertig .fortschritt__nr {
  background: var(--ok-soft);
  color: var(--ok);
}

.fortschritt__schritt.is-inaktiv {
  opacity: var(--zurueck);
}

.fortschritt__hinweis {
  margin: 2px 6px 0;
  font-size: .82rem;
  color: var(--muted);
}

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

  .fortschritt__leiste,
  .fortschritt__hinweis {
    grid-column: 1 / -1;
  }
}

/* ---------------------------- 5. Übersicht der Anfrage ---------------------------- */
.kunde-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.kunde-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr);
}

.kunde-haupt {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.kunde-summe {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.kunde-summe__kopf h2 {
  margin: 0 0 10px;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--steel);
}

.kunde-summe__zahlen {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.kunde-summe__zahlen > div {
  background: #f4f8fd;
  border-radius: var(--r-md);
  padding: 8px 10px;
}

.kunde-summe__zahlen span {
  display: block;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.kunde-summe__zahlen strong {
  display: block;
  font-size: 1.05rem;
  margin-top: 2px;
}

.kunde-summe__liste {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.kunde-summe__liste li {
  border-left: 3px solid var(--accent-light);
  background: #fafcfe;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 8px 10px;
  font-size: .88rem;
  color: var(--steel);
}

.kunde-summe__hinweis {
  margin: 0;
  font-size: .8rem;
  color: var(--muted);
}

.kunde-summe .btn {
  width: 100%;
}

@media (min-width: 1000px) {
  .kunde-grid {
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: start;
  }

  .kunde-summe {
    position: sticky;
    top: 16px;
  }
}

/* Am Handy: kompakte Leiste unten, nichts wird abgeschnitten */
@media (max-width: 999px) {
  .kunde-summe {
    position: sticky;
    bottom: 0;
    z-index: 40;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    box-shadow: 0 -8px 26px rgba(16, 31, 45, .14);
    padding: 12px 14px;
    gap: 10px;
  }

  .kunde-summe__kopf h2,
  .kunde-summe__liste,
  .kunde-summe__hinweis {
    display: none;
  }

  /* Am Handy bleibt die Leiste bewusst flach: Zahlen, ein Knopf. */
  .kunde-summe .btn--ghost {
    display: none;
  }

  .kunde-summe__zahlen > div {
    padding: 5px 8px;
  }

  .kunde-summe__zahlen span {
    font-size: .66rem;
  }

  .kunde-summe__zahlen strong {
    font-size: .95rem;
  }

  .kunde-summe .btn--gross {
    padding-top: 11px;
    padding-bottom: 11px;
  }
}

/* ---------------------------- 6. Bereiche, Positionen, Fotos ---------------------------- */
.bereich-wahl,
.weiter-wahl {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}

.bereich-knopf {
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}

.bereich-knopf:hover {
  border-color: var(--accent-light);
  box-shadow: 0 6px 18px rgba(16, 31, 45, .07);
  transform: translateY(-1px);
}

.bereich-knopf.is-gewaehlt {
  border-color: var(--navy);
  box-shadow: 0 4px 14px rgba(16, 31, 45, .10);
}

.position {
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.position__kopf {
  background: #f6f9fd;
}

.position--offen .position__kopf {
  background: #eef4fc;
}

.position__kurz {
  color: var(--muted);
}

.feld-gruppe__titel {
  text-transform: uppercase;
  letter-spacing: .07em;
  font-size: .74rem;
  color: var(--muted);
  font-weight: 600;
}

/* Fotos: zwei Kacheln (aufnehmen / Dateien wählen) */
.foto-kacheln {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

.foto-kachel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 18px 12px;
  border: 1px dashed #bccbdd;
  border-radius: var(--r-md);
  background: var(--surface-2);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s ease, background-color .15s ease, transform .12s ease;
}

.foto-kachel:hover,
.foto-kachel:focus-within {
  border-color: var(--navy);
  background: var(--blue-soft);
  transform: translateY(-1px);
}

.foto-kachel input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.foto-kachel svg {
  width: 26px;
  height: 26px;
  color: var(--navy);
}

.foto-kachel strong {
  font-size: .95rem;
}

.foto-kachel small {
  color: var(--muted);
  font-size: .78rem;
}

.foto-zaehler {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: .82rem;
  color: var(--muted);
}

@media (max-width: 560px) {
  .foto-kacheln {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------- 7. Bürobereich ---------------------------- */
.tabs {
  gap: 6px;
  padding: 8px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.tab {
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  font-weight: 600;
  color: var(--steel);
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.tab:hover {
  background: #f2f7fd;
  color: var(--navy-dark);
}

.tab.is-active {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 6px 16px rgba(50, 102, 175, .22);
}

/* Der gerade gewählte Kalkulator ist der aktive Bereich */
.panel:not([hidden]) > .card--input {
  border-color: var(--navy);
  box-shadow: var(--shadow-aktiv);
}

/* Einstellungen bleiben zurückgenommen, bis sie gebraucht werden */
.card--settings {
  background: var(--surface-2);
}

.card--settings > .card-head h2 {
  color: var(--steel);
}

.card--settings:focus-within {
  background: var(--surface);
}

/* Vorgangssumme: klare, ruhige Zusammenfassung */
.card--sum {
  border-color: #d3e0f1;
  background: linear-gradient(180deg, #f7fafd 0%, #fff 60%);
}

.card--sum .card-head h2 {
  color: var(--navy-dark);
}

.card--sum .sum-total,
.card--sum .summe-gross {
  font-size: 1.35rem;
  letter-spacing: -.01em;
}

/* Tabellen: ruhiger, lesbarer */
.pos-table thead th,
.price-table thead th {
  background: #f4f8fd;
  color: var(--steel);
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.pos-table tbody tr:hover,
.price-table tbody tr:hover {
  background: #f8fbff;
}

.status-meta {
  color: var(--muted);
}

/* Anfragenliste: Foto, Angaben und Status stehen sauber in einer Zeile */
.anfrage-zeile {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px 14px;
  align-items: center;
}

.anfrage-zeile__bild {
  grid-column: 1;
  grid-row: 1;
  width: 62px;
  height: 62px;
  margin-right: 0;
  border-radius: 10px;
  border-color: var(--line);
}

.anfrage-zeile__haupt {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.anfrage-zeile__rechts {
  grid-column: 3;
  grid-row: 1;
}

@media (max-width: 720px) {
  .anfrage-zeile {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .anfrage-zeile__rechts {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
  }
}

.info-btn {
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.info-btn:hover {
  border-color: var(--navy);
  color: var(--navy);
}

@media (max-width: 720px) {
  .kunde-shell,
  .shell {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* ------------------------------ Gesamtübersicht (fünfter Bereich) ------------------------------ */

.bereich-punkt {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}
.bereich-punkt--pc { background: #3266af; }
.bereich-punkt--folie { background: #8fb3de; }
.bereich-punkt--aufbereitung-pc { background: #28518b; }
.bereich-punkt--aufbereitung-vs { background: #6b7280; }

.cell-zusatz { display: block; color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }

.pos-table tr.zeile-summe td {
  background: #f4f8fd;
  font-weight: 600;
  color: var(--navy-dark);
}
.pos-table tr.zeile-gesamt td {
  background: #e9f0fa;
  font-weight: 700;
}
.pos-table tr.pos-hervorheben td {
  background: #fff6d8;
  transition: background .35s ease;
}

/* ------------------------------ Fenster (Dialog) ------------------------------ */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(16, 31, 45, .45);
  z-index: 80;
}
.modal__box {
  width: 100%;
  max-width: 540px;
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(16, 31, 45, .28);
}
.modal__box h2 { margin: 0 0 10px; font-size: 19px; color: var(--navy-dark); }
.modal__box p { margin: 0 0 12px; }
.modal__liste { list-style: none; margin: 0 0 14px; padding: 0; }
.modal__liste li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  margin-bottom: 6px;
  background: #f5f8fc;
  border-radius: 9px;
  font-size: 14.5px;
}
.modal__knoepfe { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

/* Hinweis am unteren Rand, mit möglicher Aktion (Rückgängig) */
.dialog-hinweis {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(16, 31, 45, .25);
  z-index: 90;
}
.toast__aktion {
  border: 0;
  border-radius: 999px;
  padding: 7px 14px;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.toast__aktion:hover { background: rgba(255, 255, 255, .3); }

/* Fünf Reiter: am schmalen Bildschirm bleibt die Leiste scrollbar,
   damit kein Reiter abgeschnitten wird. */
@media (max-width: 900px) {
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

/* Gesamtübersicht: Fläche und Preis stehen einzeilig */
#gTable td:nth-child(5),
#gTable td:nth-child(6) {
  white-space: nowrap;
}

/* Nicht verfügbare Knöpfe sind erkennbar */
.btn[disabled] {
  opacity: .55;
  cursor: not-allowed;
  box-shadow: none;
}

