/* Kontakt-Freischaltungen der Basic-Lizenz -- Figma "ATZ 2026 - Zukunft",
   Screens cred_m_* / cred_d_*.

   Markup:    web/templates/web/contact_quota.html
              web/templates/web/partials/_quota_chip.html
              web/templates/web/partials/_quota_bar.html
              web/templates/web/partials/_quota_contact.html

   Der Klassenpraefix `cred-` bleibt aus dem Vorlauf erhalten, obwohl es kein
   Guthaben mehr gibt: er ist frei von Kollisionen und im ganzen Block
   einheitlich. Die Fachlogik dahinter steht in
   atz_v1/services/contact_unlock.py.

   Mobile first: die Basis-Styles beschreiben das 402px-Layout, die
   Media-Queries (>=768px / >=992px) bauen daraus das Desktop-Layout.
   Klassenpraefix `cred-`, damit sich nichts mit den bestehenden Praefixen
   ueberschneidet (`atz-`, `lic-`, `ord-`, `own-`, `dir-`, `rev-`, `fp-`,
   `chat-`, `cpr-`, `tuk-`, `mapv-`).

   Der Chip, das mobile Band und der Kontaktblock werden ausserhalb dieser
   Seite mitgerendert -- die Datei haengt deshalb in base.html. */

:root {
  --cred-shaded: #F5F5F5;
  --cred-border: #E7E7E7;
  --cred-red-tint: #FCEAED;
  --cred-green: #2E9E4F;
  --cred-green-tint: #EAF5EC;
  --cred-amber: #B26A00;
  --cred-amber-tint: #FDF3E3;
  --cred-radius: 12px;
}

/* ---------------------------------------------- Kontingent-Chip / -Band */

.cred-chip {
  align-items: center;
  background: var(--cred-red-tint);
  border-radius: 999px;
  color: var(--atz-red);
  font-size: 14px;
  font-weight: 700;
  gap: 6px;
  padding: 6px 14px;
  text-decoration: none;
}

.cred-chip:hover {
  background: #F8DDE2;
  color: var(--atz-red);
}

.cred-chip__icon svg,
.cred-bar__icon svg {
  display: block;
  height: 16px;
  width: 16px;
}

.cred-bar {
  background: var(--cred-red-tint);
  border-bottom: 1px solid #F3D5DB;
}

.cred-bar__inner {
  align-items: center;
  display: flex;
  justify-content: space-between;
  padding-bottom: 10px;
  padding-top: 10px;
}

.cred-bar__balance {
  align-items: center;
  color: var(--atz-red);
  display: inline-flex;
  font-size: 15px;
  font-weight: 700;
  gap: 8px;
}

.cred-bar__link {
  color: var(--atz-red);
  font-size: 15px;
  font-weight: 600;
  text-decoration: underline;
}

/* Offener Betrag statt Kontingent: derselbe Chip, warnende Farbe. */
.cred-chip--warn {
  background: var(--cred-amber-tint);
  color: var(--cred-amber);
}

.cred-chip--warn:hover {
  background: #F9E8CC;
  color: var(--cred-amber);
}

.cred-bar--warn {
  background: var(--cred-amber-tint);
  border-bottom-color: #F1DDBC;
}

.cred-bar--warn .cred-bar__balance,
.cred-bar--warn .cred-bar__link {
  color: var(--cred-amber);
}

/* ---------------------------------------------------------- Grundgeruest */

.cred-page {
  color: var(--atz-dark);
  font-size: 15px;
}

.cred-wrap {
  margin: 0 auto;
  max-width: 1200px;
  padding: 0 16px;
  width: 100%;
}

.cred-section__title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
}

.cred-section__lead {
  color: var(--atz-gray);
  margin: 0 0 20px;
}

/* ------------------------------------------------------------- Schaltung */

.cred-btn {
  align-items: center;
  background: #fff;
  border: 1px solid var(--cred-border);
  border-radius: 8px;
  color: var(--atz-dark);
  cursor: pointer;
  display: inline-flex;
  font-size: 15px;
  font-weight: 600;
  gap: 8px;
  justify-content: center;
  padding: 11px 20px;
  text-align: center;
  text-decoration: none;
}

.cred-btn--primary {
  background: var(--atz-red);
  border-color: var(--atz-red);
  color: #fff;
}

.cred-btn--primary:hover {
  background: #A5081F;
  border-color: #A5081F;
  color: #fff;
}

.cred-btn--ghost:hover {
  border-color: var(--atz-gray);
  color: var(--atz-dark);
}

.cred-btn--block {
  width: 100%;
}

.cred-btn__icon svg {
  display: block;
  height: 17px;
  width: 17px;
}

/* ------------------------------------------------------------ Kopfbereich */

.cred-hero {
  background: #fff;
  padding: 24px 0 28px;
}

.cred-hero__eyebrow {
  color: var(--atz-red);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.cred-hero__title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 12px;
}

.cred-hero__lead {
  color: var(--atz-gray);
  margin: 0 0 20px;
}

.cred-hero__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cred-balance {
  background: #fff;
  border: 1px solid var(--cred-border);
  border-radius: var(--cred-radius);
  margin-top: 20px;
  padding: 20px;
}

.cred-balance__label {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 6px;
}

.cred-balance__value {
  align-items: baseline;
  display: flex;
  gap: 8px;
  margin: 0 0 6px;
}

.cred-balance__number {
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
}

.cred-balance__unit {
  color: var(--atz-gray);
  font-size: 16px;
}

.cred-balance__note {
  color: var(--atz-gray);
  font-size: 14px;
  margin: 0 0 14px;
}

.cred-balance__meta {
  border-top: 1px solid var(--cred-border);
  font-size: 14px;
  margin: 0 0 14px;
  padding-top: 14px;
}

.cred-balance__meta-label {
  color: var(--atz-gray);
  display: block;
}

.cred-balance__pending {
  background: var(--cred-amber-tint);
  border-radius: 8px;
  color: var(--cred-amber);
  font-size: 13px;
  margin: 0 0 14px;
  padding: 10px 12px;
}

/* Kontingent-Fortschritt ("14 von 20 verbraucht"). Der Balken traegt keine
   eigene Zahl -- die steht als Text darunter, damit er auch fuer Screenreader
   und ohne CSS lesbar bleibt. Die Breite kommt per widthratio aus dem
   Template. */
.cred-quota {
  margin: 0 0 14px;
}

.cred-quota__track {
  background: var(--cred-border);
  border-radius: 999px;
  display: block;
  height: 8px;
  overflow: hidden;
}

.cred-quota__fill {
  background: var(--atz-red);
  display: block;
  height: 100%;
}

.cred-quota__text {
  color: var(--atz-gray);
  display: block;
  font-size: 13px;
  margin-top: 6px;
}

/* ------------------------------------------------------- So funktioniert's */

.cred-how {
  background: var(--cred-shaded);
  padding: 28px 0;
}

.cred-steps {
  display: grid;
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.cred-step {
  background: #fff;
  border: 1px solid var(--cred-border);
  border-radius: var(--cred-radius);
  padding: 18px;
}

.cred-step__head {
  align-items: center;
  display: flex;
  gap: 10px;
  margin: 0 0 10px;
}

.cred-step__icon {
  color: var(--atz-red);
}

.cred-step__icon svg {
  display: block;
  height: 20px;
  width: 20px;
}

.cred-step__count {
  color: var(--atz-red);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cred-step__title {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 6px;
}

.cred-step__text {
  color: var(--atz-gray);
  font-size: 14px;
  margin: 0;
}

/* ------------------------------------------------------- Offene Betraege */

.cred-offers {
  background: #fff;
  padding: 28px 0;
}

.cred-offers .cred-table {
  margin-bottom: 14px;
}

.cred-offers__foot,
.cred-contact__foot {
  color: var(--atz-gray);
  font-size: 13px;
  margin: 0;
}

.cred-offers__foot-icon,
.cred-contact__foot-icon {
  margin-right: 4px;
}

/* --------------------------------------------------------------- Verlauf */

.cred-history {
  background: var(--cred-shaded);
  padding: 28px 0;
}

.cred-table {
  background: #fff;
  border: 1px solid var(--cred-border);
  border-radius: var(--cred-radius);
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

/* Auf dem Telefon wird aus jeder Zeile eine Karte; die Spaltennamen stehen
   dann vor dem Wert (data-cred-col). */
.cred-table__head {
  display: none;
}

.cred-table__row {
  border-bottom: 1px solid var(--cred-border);
  display: block;
  padding: 12px 16px;
}

.cred-table__row:last-child {
  border-bottom: 0;
}

.cred-table__row td {
  display: flex;
  font-size: 14px;
  justify-content: space-between;
  padding: 2px 0;
}

.cred-table__row td::before {
  color: var(--atz-gray);
  content: attr(data-cred-col);
  margin-right: 12px;
}

.cred-delta--plus {
  color: var(--cred-green);
  font-weight: 700;
}

.cred-delta--minus {
  font-weight: 700;
}

.cred-history__empty {
  background: #fff;
  border: 1px solid var(--cred-border);
  border-radius: var(--cred-radius);
  color: var(--atz-gray);
  margin: 0;
  padding: 18px;
}

/* ---------------------------------------------------------------- Upsell */

.cred-upsell {
  background: #fff;
  padding: 0 0 32px;
}

.cred-upsell__inner {
  background: var(--cred-red-tint);
  border-radius: var(--cred-radius);
  padding: 20px;
}

.cred-upsell__title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 6px;
}

.cred-upsell__lead {
  color: var(--atz-gray);
  font-size: 14px;
  margin: 0 0 14px;
}

/* --------------------------------------------- Kontaktblock am Auftrag */

.cred-contact {
  background: #fff;
  border: 1px solid var(--cred-border);
  border-radius: var(--cred-radius);
  margin-bottom: 8px;
  padding: 18px;
}

.cred-contact__head {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.cred-contact__icon {
  align-items: center;
  background: var(--cred-red-tint);
  border-radius: 999px;
  color: var(--atz-red);
  display: inline-flex;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.cred-contact__icon--ok {
  background: var(--cred-green-tint);
  color: var(--cred-green);
}

.cred-contact__icon svg {
  height: 20px;
  width: 20px;
}

.cred-contact__title {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 4px;
}

.cred-contact__lead {
  color: var(--atz-gray);
  font-size: 14px;
  margin: 0;
}

.cred-contact__after {
  color: var(--atz-gray);
  font-size: 13px;
  margin: 6px 0 0;
  text-align: center;
}

/* Kontingent aufgebraucht: derselbe Platz, warnender Ton. */
.cred-contact__after--warn {
  color: var(--cred-amber);
  font-weight: 600;
}

.cred-contact__cta .cred-btn {
  width: 100%;
}

.cred-fields {
  background: var(--cred-shaded);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px 16px;
}

.cred-fields--open {
  background: var(--cred-green-tint);
}

.cred-field {
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.cred-field__label {
  color: var(--atz-gray);
  font-size: 14px;
  font-weight: 400;
}

.cred-field__value {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  text-align: right;
  word-break: break-word;
}

.cred-field__value--masked {
  color: #BFBFBF;
  font-weight: 400;
  letter-spacing: 0.08em;
}

/* --------------------------------------------------------------- Dialoge */

/* Auf dem Telefon sitzt der Dialog als Blatt am unteren Rand (cred_m_sheet_*),
   ab Tablet ist es ein mittiger Dialog (cred_d_dialog_*). */
.cred-modal .cred-modal__dialog {
  align-items: flex-end;
  margin: 0;
  max-width: none;
  min-height: 100%;
}

.cred-modal__content {
  border: 0;
  border-radius: 16px 16px 0 0;
  padding: 8px 20px 20px;
}

.cred-modal__grabber {
  background: var(--cred-border);
  border-radius: 999px;
  display: block;
  height: 4px;
  margin: 0 auto 14px;
  width: 44px;
}

.cred-modal__badge {
  align-items: center;
  background: var(--cred-red-tint);
  border-radius: 999px;
  color: var(--atz-red);
  display: inline-flex;
  height: 44px;
  justify-content: center;
  margin-bottom: 12px;
  width: 44px;
}

.cred-modal__badge--warn {
  background: var(--cred-amber-tint);
  color: var(--cred-amber);
}

.cred-modal__badge svg {
  height: 22px;
  width: 22px;
}

.cred-modal__title {
  font-size: 21px;
  font-weight: 700;
  margin: 0 0 8px;
}

.cred-modal__lead {
  color: var(--atz-gray);
  font-size: 14px;
  margin: 0 0 16px;
}

.cred-modal__alt {
  color: var(--atz-gray);
  font-size: 13px;
  margin: 12px 0 0;
}

.cred-modal__alt {
  text-align: center;
}

.cred-modal__actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

/* Rueckfrage-Tabelle im Freischalt-Dialog */

.cred-recap {
  background: var(--cred-shaded);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 14px 16px;
}

.cred-recap__row {
  display: flex;
  justify-content: space-between;
}

.cred-recap__row dt {
  color: var(--atz-gray);
  font-size: 14px;
  font-weight: 400;
}

.cred-recap__row dd {
  font-size: 14px;
  margin: 0;
}

.cred-recap__row--total dt,
.cred-recap__row--total dd {
  color: var(--atz-dark);
  font-weight: 700;
}

/* ------------------------------------------------------------ ab Tablet */

@media (min-width: 768px) {
  .cred-hero__actions {
    flex-direction: row;
  }

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

  .cred-contact__head {
    align-items: start;
    grid-template-columns: auto 1fr auto;
  }

  .cred-contact__cta .cred-btn {
    width: auto;
  }

  .cred-contact__after {
    text-align: right;
  }

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

  .cred-field {
    display: grid;
    gap: 2px;
  }

  .cred-field__value {
    text-align: left;
  }

  .cred-modal .cred-modal__dialog {
    align-items: center;
    margin: 1.75rem auto;
    max-width: 560px;
    min-height: calc(100% - 3.5rem);
  }

  .cred-modal__content {
    border-radius: 16px;
    padding: 24px;
  }

  .cred-modal__grabber {
    display: none;
  }

  .cred-modal__actions {
    grid-template-columns: 1fr 1fr;
  }

  .cred-upsell__inner {
    align-items: center;
    display: flex;
    gap: 20px;
    justify-content: space-between;
  }

  .cred-upsell__lead {
    margin-bottom: 0;
  }

  /* Ab hier ist der Verlauf wieder eine Tabelle. */
  .cred-table__head {
    display: table-header-group;
  }

  .cred-table__head th {
    color: var(--atz-gray);
    font-size: 13px;
    font-weight: 600;
    padding: 12px 16px;
    text-align: left;
  }

  .cred-table__row {
    display: table-row;
    padding: 0;
  }

  .cred-table__row td {
    display: table-cell;
    padding: 12px 16px;
  }

  .cred-table__row td::before {
    content: none;
  }

  .cred-table__num {
    text-align: right;
  }
}

/* ----------------------------------------------------------- ab Desktop */

@media (min-width: 992px) {
  .cred-hero {
    padding: 40px 0;
  }

  .cred-hero__inner {
    align-items: start;
    display: grid;
    gap: 40px;
    grid-template-columns: minmax(0, 1fr) 320px;
  }

  .cred-hero__title {
    font-size: 34px;
  }

  .cred-balance {
    margin-top: 0;
  }

  .cred-how,
  .cred-offers,
  .cred-history {
    padding: 40px 0;
  }

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