/*
 * Was kostet mein Auto? – Haupt-Stylesheet
 * Alle visuellen Stile der Anwendung.
 */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Ensure the HTML hidden attribute always wins, even when a component class
   (e.g. .form-group { display: flex }) would otherwise override it. */
[hidden] { display: none !important; }

/* Base anchor reset – intentionally low specificity (0,0,1) so component
   classes like .btn-primary can override color without needing !important. */
a {
  color: inherit;
  text-decoration: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f5f5;
  color: #1a1a1a;
  font-size: 15px;
  line-height: 1.5;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
header h1 { font-size: 1.3rem; font-weight: 700; }
/* h1 link looks like plain text; hover reveals it's clickable */
header h1 a:hover { opacity: 0.75; }
header nav a {
  color: #89b4fa;
  text-decoration: none;
  margin-left: 1.5rem;
  font-size: 0.9rem;
}
header nav a:hover { text-decoration: underline; }

/* ── Hamburger button (mobile only) ─────────────────────────────────────── */
.hamburger {
  display: none;            /* hidden on desktop */
  background: none;
  border: none;
  color: #cdd6f4;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

/* Mobile menu wrapper – transparent on desktop, dropdown on mobile */
.mobile-menu { display: contents; }

/* ── Staging Banner ──────────────────────────────────────────────────────── */
.staging-banner {
  position: sticky;
  top: 0;
  z-index: 9999;
  background: #f38ba8;
  color: #1e1e2e;
  text-align: center;
  padding: 0.5rem;
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.05em;
}

/* ── Main ────────────────────────────────────────────────────────────────── */
main { max-width: 1100px; margin: 2rem auto; padding: 0 1rem; }

/* ── Flash ───────────────────────────────────────────────────────────────── */
.flash-notice {
  background: #a6e3a1;
  color: #1e1e2e;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.flash-alert {
  background: #f38ba8;
  color: #1e1e2e;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
}
.card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #eff1f5;
  color: #1e1e2e;
}

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.form-group { display: flex; flex-direction: column; gap: 4px; justify-content: flex-end; }
.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6c6f85;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-group input,
.form-group select {
  padding: 0.55rem 0.75rem;
  border: 1.5px solid #dce0e8;
  border-radius: 8px;
  font-size: 0.95rem;
  color: #1a1a1a;
  background: #fafafa;
  transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #89b4fa;
  background: #fff;
}
.field_with_errors input { border-color: #f38ba8 !important; }
.form-group .hint {
  font-size: 0.75rem;
  color: #9ca0b0;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.6rem 1.4rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity .15s;
}
.btn:hover { opacity: 0.85; }
.btn-primary   { background: #89b4fa; color: #1e1e2e; }
.btn-secondary { background: #eff1f5; color: #4c4f69; }
.btn-danger    { background: #f38ba8; color: #1e1e2e; }
.btn-sm        { padding: 0.35rem 0.9rem; font-size: 0.85rem; }

.btn-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

/* ── Ergebnistabelle ─────────────────────────────────────────────────────── */
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}
.result-tile {
  background: #eff1f5;
  border-radius: 10px;
  padding: 1rem 1.25rem;
}
.result-tile .label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6c6f85;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 4px;
}
.result-tile .value {
  font-size: 1.6rem;
  font-weight: 800;
  color: #1e1e2e;
}
.result-tile.highlight { background: #1e1e2e; }
.result-tile.highlight .label { color: #a6adc8; }
.result-tile.highlight .value { color: #89b4fa; }
.result-tile .sub {
  font-size: 0.78rem;
  color: #9ca0b0;
  margin-top: 2px;
}
/* Depreciation tile – red accent signals the inflation-adjusted loss */
.result-tile.depreciation {
  background: #fef0f2;
  border: 1.5px solid #f38ba8;
}
.result-tile.depreciation .label { color: #b5394f; }
.result-tile.depreciation .value { color: #d20f39; }
.result-tile.depreciation .sub   { color: #c0435a; }

/* Appreciation tile – green accent when the car gained value (profit scenario) */
.result-tile.appreciation {
  background: #f0fef4;
  border: 1.5px solid #40a02b;
}
.result-tile.appreciation .label { color: #2d7a1e; }
.result-tile.appreciation .value { color: #40a02b; }
.result-tile.appreciation .sub   { color: #3d9130; }

/* Profit highlight tiles – green instead of blue */
.result-tile.highlight-profit {
  background: #1a3a1a;
}
.result-tile.highlight-profit .value { color: #a6e3a1; }
.result-tile.highlight-profit .label { color: #94c894; }
.result-tile.highlight-profit .sub   { color: #7aaa7a; }

/* ── Aufschlüsselungstabelle ─────────────────────────────────────────────── */
.breakdown table { width: 100%; border-collapse: collapse; }
.breakdown td,
.breakdown th {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #eff1f5;
  font-size: 0.9rem;
}
.breakdown th { color: #6c6f85; font-size: 0.8rem; text-transform: uppercase; }
.breakdown td:last-child { text-align: right; font-weight: 600; }
.breakdown tr.total td { font-weight: 800; font-size: 1rem; border-top: 2px solid #dce0e8; }
/* Depreciation rows are tinted red so the loss stands out */
.breakdown tr.depreciation-row td { color: #d20f39; }
/* Appreciation rows – green when car gained value */
.breakdown tr.appreciation-row td { color: #40a02b; }
/* Subtotal row (gross cost before resale deduction) */
.breakdown tr.subtotal-row td { color: #6c6f85; border-top: 1.5px solid #dce0e8; }
/* Resale deduction row – green to signal it reduces the total */
.breakdown tr.resale-row td { color: #40a02b; }

/* ── Cars-Tabelle ────────────────────────────────────────────────────────── */
.cars-table { width: 100%; border-collapse: collapse; }
.cars-table th,
.cars-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #eff1f5;
  font-size: 0.9rem;
}
.cars-table th { background: #eff1f5; font-size: 0.8rem; text-transform: uppercase; color: #6c6f85; }
.cars-table td:not(:first-child) { text-align: right; }
.cars-table th:not(:first-child) { text-align: right; }
.cars-table tr:hover td { background: #f9f9fb; }

/* Actions cell: keep all three buttons on one line */
.car-actions-cell {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  border-bottom: 1px solid #eff1f5;
  padding: 0.65rem 0.75rem;
}
/* button_to wraps in a <form> – make it inline so it doesn't break flex */
.inline-form { display: contents; }

/* Privacy policy section on the Impressum page */
.privacy-policy {
  max-width: 900px;
  margin: auto;
  font-family: Arial, sans-serif;
  line-height: 1.6;
}
.privacy-policy-note {
  font-size: 0.9em;
  color: #666;
}

/* Remove default margin on paragraphs inside compact flash alerts */
.flash-alert--compact p { margin: 0; }

/* ── Jahreswerte ─────────────────────────────────────────────────────────── */
.yearly-section {
  margin-top: 1.25rem;
  border: 1.5px dashed #dce0e8;
  border-radius: 10px;
  padding: 1rem 1.25rem;
}
.yearly-section summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: #5c5f77;
  user-select: none;
}
.yearly-section summary::marker { color: #89b4fa; }
.yearly-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
/* Label above each yearly-grid row (field name + currency hint) */
.yearly-field-label {
  font-weight: 600;
  font-size: .85rem;
  margin: .75rem 0 .25rem;
  color: #4c4f69;
}
.yearly-hint {
  font-size: .85rem;
  color: #7c7f93;
  font-style: italic;
  padding: .5rem 0;
}

/* ── Page-title cards (reduced bottom margin) ────────────────────────────── */
.card--title { margin-bottom: 0.5rem; }

/* ── Spacing between the Berechnen button and the result card ────────────── */
.calc-submit-row { margin-bottom: 2rem; }
.card--result { margin-top: 2rem; }

/* ── Breakdown table: right-align the last header cell ──────────────────── */
.breakdown th:last-child { text-align: right; }

/* ── Car show: action-button row ─────────────────────────────────────────── */
.car-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: .5rem; }

/* ── Cars index: empty-state paragraph ──────────────────────────────────── */
.cars-empty-message { color: #6c6f85; margin: 1rem 0; }

/* ── Subtle paragraph text ───────────────────────────────────────────────── */
.text-muted { color: #6c6f85; }

/* ── Error list inside validation flash ──────────────────────────────────── */
.form-error-list { margin-top: .5rem; padding-left: 1.25rem; }

/* ── Compact flash (smaller font, used in tight auth forms) ──────────────── */
.flash-alert--compact { font-size: .85rem; }

/* ── Form: full-width field spanning all grid columns ───────────────────── */
.form-group--full { grid-column: 1 / -1; max-width: 420px; justify-content: flex-start; }

/* ── Hint with extra bottom spacing (outside a .form-group) ─────────────── */
.hint--spaced { margin-bottom: .75rem; }

/* ── Section description (always-visible info text below card heading) ───── */
.section-description {
  font-size: 0.8rem;
  color: #9ca0b0;
  margin: -0.5rem 0 1rem;
  line-height: 1.45;
}

/* ── Info icon (ℹ) in card headings ──────────────────────────────────────── */
.info-icon {
  display: inline-block;
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 600;
  color: #7c8cef;
  background: #e8eaf8;
  border-radius: 50%;
  width: 1.2em;
  height: 1.2em;
  line-height: 1.2em;
  text-align: center;
  cursor: default;
  margin-left: 0.35rem;
  vertical-align: middle;
}

/* ── Checkbox label (inline checkbox + text) ─────────────────────────────── */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #4c4f69;
  cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: #7c8cef;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Error pages ─────────────────────────────────────────────────────────── */
.error-card { text-align: center; padding: 3rem 2rem; }
.error-icon { font-size: 3rem; margin-bottom: 1rem; }
.error-body { margin: 1rem 0 2rem; }

/* ── Header-Right / User ─────────────────────────────────────────────────── */
.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.user-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,.08);
  border-radius: 999px;
  padding: 0.25rem 0.75rem 0.25rem 0.4rem;
}
.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #89b4fa;
  color: #1e1e2e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  flex-shrink: 0;
}
.user-name {
  font-size: 0.82rem;
  color: #cdd6f4;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-logout {
  background: transparent;
  border: 1.5px solid rgba(205,214,244,.2);
  color: #a6adc8;
  padding: 0.28rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s;
  line-height: 1.5;
}
.btn-logout:hover { border-color: #f38ba8; color: #f38ba8; }

/* ── Locale-Umschalter ───────────────────────────────────────────────────── */
.pref-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.pref-btn {
  background: transparent;
  border: 1.5px solid rgba(205,214,244,.2);
  color: #a6adc8;
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.pref-btn:hover       { border-color: #89b4fa; background: rgba(137,180,250,.08); }
.pref-btn.pref-active { border-color: #89b4fa; background: rgba(137,180,250,.15); }

/* ── Save Row ────────────────────────────────────────────────────────────── */
.save-row {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  padding: 1.25rem 2rem;
  margin-bottom: 1.5rem;
}
.save-row-inner {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}
.car-name-input {
  flex: 1;
  min-width: 200px;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid #dce0e8;
  border-radius: 8px;
  font-size: 0.95rem;
  color: #1a1a1a;
  background: #fafafa;
  transition: border-color .15s;
}
.car-name-input:focus {
  outline: none;
  border-color: #89b4fa;
  background: #fff;
}
.btn-save { background: #a6e3a1; color: #1e1e2e; white-space: nowrap; }
.save-row .hint {
  display: block;
  font-size: 0.75rem;
  color: #9ca0b0;
  margin-top: 0.4rem;
}

/* ── Save Card (unauthenticated) ────────────────────────────────────────── */
.save-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
}
.save-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e1e2e;
  margin: 0 0 0.3rem;
}
.save-subtitle {
  font-size: 0.85rem;
  color: #6c6f85;
  margin: 0 0 1.1rem;
}
.save-card .car-name-input {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 1rem;
}
.save-auth-buttons {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}
.save-auth-buttons .btn {
  flex: 1;
  min-width: 130px;
  justify-content: center;
}
/* ── Share card & URL input ─────────────────────────────────────────────── */
.share-card { margin-bottom: 1.5rem; }
.share-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}
.share-url-input {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  color: #5c5f77;
  background: #f4f4f8;
  border: 1.5px solid #dce0e8;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  cursor: text;
}
.share-hint {
  margin-top: 0.6rem;
  font-size: 0.82rem;
}
/* Inline share wrapper on cars/show – sits inside the action button row */
.share-inline-wrapper {
  display: contents; /* takes no space of its own, children join the flex row */
}
.share-result-inline {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}
.share-url-input--sm {
  font-size: 0.78rem;
  padding: 0.35rem 0.6rem;
  max-width: 240px;
}

/* ── Danger zone (account deletion) ───────────────────────────────────── */
.card--danger {
  border: 2px solid #f38ba8;
  margin-top: 2.5rem;
}
.card--danger h2 { color: #d20f39; }
.danger-warning {
  color: #5c5f77;
  margin-bottom: 1rem;
  line-height: 1.5;
}
.btn-danger-outline {
  display: inline-block;
  padding: 0.55rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #d20f39;
  background: transparent;
  border: 1.5px solid #d20f39;
  border-radius: 8px;
  cursor: pointer;
  list-style: none; /* hides default <summary> marker */
}
.btn-danger-outline:hover { background: #fdd; }
.btn-danger-outline::marker,
.btn-danger-outline::-webkit-details-marker { display: none; }
.delete-account-form {
  margin-top: 1.2rem;
  padding-top: 1.2rem;
  border-top: 1px solid #e6e9ef;
}
.checkbox-label--danger { color: #d20f39; }

.btn-google-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  background: #fff;
  border: 1.5px solid #dce0e8;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1a1a1a;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
  white-space: nowrap;
}
.btn-google-save:hover {
  border-color: #89b4fa;
  box-shadow: 0 2px 8px rgba(137,180,250,.2);
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
footer {
  background: #1e1e2e;
  color: #6c6f85;
  padding: 1.5rem 2rem;
  margin-top: 3rem;
  font-size: 0.82rem;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.footer-links { display: flex; gap: 1.25rem; }
.footer-links a {
  color: #6c6f85;
  text-decoration: none;
  transition: color .15s;
}
.footer-links a:hover { color: #cdd6f4; }

/* ── Auth / Login ────────────────────────────────────────────────────────── */
.login-wrap {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1rem;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,.10);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
}
.login-logo { text-align: center; font-size: 2.5rem; margin-bottom: 0.5rem; }
.login-card h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #1e1e2e;
  text-align: center;
  margin-bottom: 0.3rem;
}
.login-subtitle {
  text-align: center;
  color: #6c6f85;
  font-size: 0.88rem;
  margin-bottom: 1.75rem;
}
.auth-form .form-group { margin-bottom: 1rem; }
.auth-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #6c6f85;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 4px;
}
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid #dce0e8;
  border-radius: 8px;
  font-size: 0.95rem;
  color: #1a1a1a;
  background: #fafafa;
  transition: border-color .15s;
}
.auth-form input:focus {
  outline: none;
  border-color: #89b4fa;
  background: #fff;
}
.auth-hint { font-size: .75rem; color: #9ca0b0; margin-top: 2px; display: block; }
.remember-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  color: #4c4f69;
}
.remember-row input[type="checkbox"] { accent-color: #89b4fa; }
.btn-submit {
  width: 100%;
  padding: 0.7rem 1.5rem;
  background: #89b4fa;
  color: #1e1e2e;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-submit:hover { opacity: 0.85; }
.or-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
  color: #9ca0b0;
  font-size: 0.8rem;
}
.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #dce0e8;
}
.google-form { margin: 0; }
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.7rem 1.5rem;
  background: #fff;
  border: 1.5px solid #dce0e8;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #1a1a1a;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
}
.btn-google:hover {
  border-color: #89b4fa;
  box-shadow: 0 2px 12px rgba(137,180,250,.2);
}
.btn-google svg { flex-shrink: 0; }
.auth-links {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: #6c6f85;
  line-height: 1.8;
}
.auth-links a {
  color: #89b4fa;
  text-decoration: none;
  font-weight: 600;
}
.auth-links a:hover { text-decoration: underline; }
.auth-pending-notice {
  background: #cba6f7;
  color: #1e1e2e;
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  text-align: center;
}

/* ── Account-Einstellungen ───────────────────────────────────────────────── */
.account-section {
  border-bottom: 1.5px solid #eff1f5;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
}
.account-section:last-of-type { border-bottom: none; margin-bottom: 0; }
.account-section h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: #4c4f69;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.google-notice {
  background: #eff1f5;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: #6c6f85;
}

/* ── Impressum / Statische Seiten ────────────────────────────────────────── */
.prose { max-width: 680px; }
.prose h2 { font-size: 1.05rem; font-weight: 700; color: #1e1e2e; margin: 1.25rem 0 0.4rem; }
.prose p  { color: #4c4f69; line-height: 1.7; margin-bottom: 0.75rem; }
.prose a  { color: #89b4fa; }

/* ── Sales Optimizer ─────────────────────────────────────────────────────── */

/* "Wann verkaufe ich am besten?" button – teal accent */
.btn-optimizer { background: #a6e3a1; color: #1e1e2e; }

.optimizer-header-meta {
  font-size: 0.9rem;
  margin: 0.25rem 0 0.75rem;
  color: #6c6f85;
}

/* ── Optimal recommendation card ── */
.optimizer-best-card { border: 2px solid #a6e3a1; background: #f2fbf2; }
.optimizer-best-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}
.optimizer-best-header h2 { margin: 0; }
.optimizer-best-signal  { font-size: 1.75rem; }
.optimizer-best-year-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e1e2e;
  margin-bottom: 1rem;
}
.optimizer-best-stats { margin-top: 0; }

/* ── 10-year timeline ── */
.optimizer-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.optimizer-year {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1.5px solid transparent;
}
.optimizer-year--green  { background: #f2fbf2; border-color: #a6e3a1; }
.optimizer-year--yellow { background: #fdf6e3; border-color: #f9c74f; }
.optimizer-year--red    { background: #fef0f2; border-color: #f38ba8; }
.optimizer-year--best   { border-width: 2px; box-shadow: 0 2px 8px rgba(166,227,161,.35); }

.optimizer-year__signal { font-size: 1.4rem; padding-top: 2px; flex-shrink: 0; }

.optimizer-year__body { flex: 1; min-width: 0; }

.optimizer-year__top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.2rem;
}

.optimizer-year__n {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e1e2e;
}
.optimizer-year__calendar {
  font-size: 0.82rem;
  color: #6c6f85;
  font-weight: 400;
}

/* Optimal badge */
.optimizer-year__badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: #1e1e2e;
  color: #a6e3a1;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Traffic light label pill */
.optimizer-traffic-label {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  margin-left: auto;
}
.optimizer-traffic-label--green  { background: #a6e3a1; color: #1e1e2e; }
.optimizer-traffic-label--yellow { background: #f9c74f; color: #1e1e2e; }
.optimizer-traffic-label--red    { background: #f38ba8; color: #1e1e2e; }

.optimizer-year__cost {
  font-size: 1.35rem;
  font-weight: 800;
  color: #1e1e2e;
  margin-bottom: 0.15rem;
}

.optimizer-year__meta {
  font-size: 0.78rem;
  color: #6c6f85;
}

.optimizer-footnote { background: #eff1f5; }
.optimizer-footnote p { font-size: 0.82rem; color: #9ca0b0; margin: 0; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
/*
 * Breakpoints:
 *   ≤ 767px  →  tablet / large phone  (2-column results, compact cards)
 *   ≤ 480px  →  small phone           (1-column results, minimal padding)
 */

/* Scrollable wrapper for wide tables (breakdown) */
.table-scroll-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Tablet / large phone (≤ 767px) ───────────────────────────────────── */
@media (max-width: 767px) {
  /* Header: horizontal row with logo + hamburger */
  header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    gap: 0.6rem;
    flex-wrap: nowrap;
    position: relative;
  }

  /* Show hamburger on mobile */
  .hamburger { display: inline-flex; }

  /* Mobile dropdown menu – hidden by default, shown via .mobile-menu--open */
  .mobile-menu {
    display: none;
    flex-direction: column;
    gap: 0.75rem;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1e1e2e;
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(205,214,244,.1);
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
    z-index: 999;
  }
  .mobile-menu.mobile-menu--open { display: flex; }

  header nav { display: flex; gap: 0.5rem; margin: 0; flex-direction: column; }
  header nav a { margin-left: 0; font-size: 1rem; padding: 0.35rem 0; }
  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  /* Main: tighter top margin */
  main { margin: 1.25rem auto; }

  /* Cards: reduce side padding so content breathes */
  .card { padding: 1.1rem 1rem; }

  /* Result grid: 2 columns, smaller value text to prevent overflow */
  .result-grid { grid-template-columns: 1fr 1fr; gap: 0.65rem; }
  .result-tile { padding: 0.85rem 0.9rem; }
  .result-tile .value { font-size: 1.25rem; }
  .result-tile .label { font-size: 0.7rem; }

  /* Form grid: single column so inputs are full-width */
  .form-grid { grid-template-columns: 1fr; }
  /* Yearly fields: 2 compact columns */
  .yearly-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }

  /* ── Cars table: responsive card layout ──
     Transform each row into a self-contained card so no horizontal
     scrolling is needed. Action buttons appear below the data rows. */
  .cars-table { min-width: 0; border-collapse: separate; border-spacing: 0 0.5rem; }
  .cars-table thead { display: none; }
  .cars-table tbody tr {
    display: block;
    background: #fff;
    border: 1px solid #dce0e8;
    border-radius: 8px;
    padding: 0.5rem 0.85rem 0.1rem;
    margin-bottom: 0.25rem;
  }
  .cars-table tr:hover td { background: transparent; }
  /* All data cells: flex row with label on left, value on right */
  .cars-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
    border-bottom: 1px solid #f2f4f8;
    font-size: 0.88rem;
    text-align: right;
  }
  /* Override desktop right-align — handled per-cell via flex */
  .cars-table td:not(:first-child) { text-align: right; }
  /* Show data-label as the left column in each row */
  .cars-table td[data-label]::before {
    content: attr(data-label);
    font-size: 0.72rem;
    color: #6c6f85;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
    text-align: left;
    flex-shrink: 0;
    margin-right: 0.5rem;
  }
  /* Car name: prominent heading, no label prefix */
  .cars-table td:first-child {
    font-size: 1rem;
    font-weight: 700;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dce0e8;
    margin-bottom: 0.1rem;
  }
  /* Actions cell: buttons full-width below the data rows.
     Use td.car-actions-cell to win specificity against .cars-table td */
  .cars-table td.car-actions-cell {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.55rem 0 0.55rem;
    border-bottom: none;
    margin-top: 0.1rem;
  }
  .cars-table td.car-actions-cell .btn { flex: 1; justify-content: center; min-width: 80px; }

  /* Breakdown table: smaller text, horizontal scroll handled by wrapper */
  .breakdown td,
  .breakdown th { font-size: 0.82rem; padding: 0.45rem 0.55rem; }

  /* Save auth buttons: stack evenly */
  .save-auth-buttons { flex-direction: column; }
  .save-auth-buttons .btn { min-width: 0; width: 100%; }

  /* Button rows: full-width stacking */
  .btn-row { flex-direction: column; align-items: stretch; }
  .btn-row .btn,
  .btn-row a.btn { justify-content: center; }

  /* Print button row: keep horizontal (it's a single button) */
  .print-btn-row { flex-direction: row; align-items: center; }
}

/* ── Small phone (≤ 480px) ────────────────────────────────────────────── */
@media (max-width: 480px) {
  /* Cards: tightest padding */
  .card { padding: 1rem 0.85rem; }

  /* Result grid: single column so values never overflow */
  .result-grid { grid-template-columns: 1fr; }
  .result-tile .value { font-size: 1.4rem; }

  /* Header: hide display name, show only avatar initial */
  .user-name { display: none; }

  /* Compact header padding */
  header { padding: 0.75rem 0.85rem; }
  main   { padding: 0 0.75rem; }

  /* Breakdown table: allow long labels to wrap */
  .breakdown td:first-child { word-break: break-word; hyphens: auto; }

  /* Reserve space at footer bottom so the fixed feedback FAB doesn't cover links */
  footer { padding-bottom: 5rem; }
}

/* ── Print / Save as PDF ─────────────────────────────────────────────────── */

/* Elements hidden from screen that appear only when printing */
.print-only { display: none; }

@media print {
  /* Hide everything that isn't part of the calculation result */
  header,
  footer,
  .staging-banner,
  .no-print    { display: none !important; }

  /* Show the print-only heading */
  .print-only  { display: flex !important; }

  /* Clean up the page */
  body         { background: #fff; color: #1e1e2e; font-size: 11pt; }
  main         { padding: 0; max-width: 100%; }

  /* Remove card shadows and round corners for paper */
  .card {
    box-shadow: none;
    border: 1px solid #ccd0da;
    border-radius: 4px;
    break-inside: avoid;
    margin-bottom: 0.75rem;
  }

  /* Result tiles: 3 per row on paper */
  .result-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }

  .result-tile {
    padding: 0.6rem;
    border: 1px solid #ccd0da;
    border-radius: 4px;
  }

  /* Breakdown table: clean lines */
  .breakdown table { width: 100%; border-collapse: collapse; }
  .breakdown th,
  .breakdown td    { border-bottom: 1px solid #ccd0da; padding: 0.35rem 0.5rem; }
  .breakdown tr.total td { font-weight: 700; border-top: 2px solid #7c8cef; }

  /* Page setup */
  @page {
    margin: 1.5cm 2cm;
    size: A4 portrait;
  }
}

/* Print heading (shown only during print, hidden on screen) */
.print-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid #1e1e2e;
  font-size: 1.1rem;
}
.print-heading strong { font-size: 1.3rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   Feedback widget – floating button + modal overlay
   ═══════════════════════════════════════════════════════════════════════════ */

.feedback-widget { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 1000; }

/* Floating action button */
.feedback-fab {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.65rem 1.2rem;
  background: #1e1e2e; color: #cdd6f4;
  border: none; border-radius: 2rem;
  font-size: 0.9rem; font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  transition: background 0.2s, transform 0.15s;
}
.feedback-fab:hover { background: #313244; transform: translateY(-1px); }

/* Modal card */
.feedback-modal {
  width: 380px; max-width: calc(100vw - 2rem);
  background: #fff; border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  overflow: hidden;
}
.feedback-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.2rem;
  background: #1e1e2e; color: #cdd6f4;
  font-size: 0.95rem;
}
.feedback-close {
  background: none; border: none; color: #cdd6f4;
  font-size: 1.4rem; cursor: pointer; line-height: 1;
  padding: 0 0.2rem;
}
.feedback-close:hover { color: #fff; }

.feedback-modal form,
.feedback-modal .feedback-result { padding: 1rem 1.2rem; }

/* Category chips */
.feedback-chips { display: flex; gap: 0.5rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.feedback-chip {
  padding: 0.35rem 0.75rem;
  border: 1.5px solid #dce0e8; border-radius: 2rem;
  background: #fff; color: #4c4f69;
  font-size: 0.8rem; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.feedback-chip:hover { border-color: #89b4fa; background: #f0f5ff; }
.feedback-chip--active {
  border-color: #89b4fa; background: #dce6fc; color: #1e1e2e; font-weight: 600;
}

/* Form fields */
.feedback-field { margin-bottom: 0.8rem; }
.feedback-field textarea,
.feedback-field input[type="email"] {
  width: 100%; padding: 0.6rem 0.75rem;
  border: 1.5px solid #dce0e8; border-radius: 8px;
  font-size: 0.9rem; font-family: inherit;
  transition: border-color 0.15s;
  resize: vertical;
}
.feedback-field textarea:focus,
.feedback-field input[type="email"]:focus {
  outline: none; border-color: #89b4fa;
}
.feedback-label {
  display: block; margin-bottom: 0.3rem;
  font-size: 0.8rem; color: #6c6f85;
}

/* File upload */
.feedback-file-row { display: flex; align-items: center; gap: 0.6rem; }
.feedback-file-btn {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.35rem 0.75rem;
  border: 1.5px solid #dce0e8; border-radius: 8px;
  background: #f6f8fa; color: #4c4f69;
  font-size: 0.8rem; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.feedback-file-btn:hover { border-color: #89b4fa; background: #f0f5ff; }
.feedback-file-input { display: none; }
.feedback-file-name {
  font-size: 0.8rem; color: #6c6f85;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 180px;
}
.feedback-file-error { color: #d20f39; font-weight: 600; }

/* Actions */
.feedback-actions { display: flex; justify-content: flex-end; padding-top: 0.2rem; }

/* Honeypot – off-screen but not display:none (bots detect that) */
.feedback-honeypot {
  position: absolute; left: -9999px; top: -9999px;
  width: 1px; height: 1px; overflow: hidden;
}

/* Success / error result */
.feedback-result { padding: 1.2rem; text-align: center; font-size: 0.95rem; }
.feedback-result--success { color: #40a02b; }
.feedback-result--error { color: #d20f39; }

/* Responsive: full-width on mobile */
@media (max-width: 480px) {
  .feedback-widget { bottom: 0.75rem; right: 0.75rem; left: 0.75rem; }
  .feedback-modal { width: 100%; max-width: 100%; }
}

/* Hide in print */
@media print { .feedback-widget { display: none !important; } }
