:root {
  --color-bg: #f4f5f7;
  --color-surface: #ffffff;
  --color-primary: #111827;
  --color-accent: #b45309;
  --color-accent-light: #f59e0b;
  --color-text: #1f2937;
  --color-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-danger-bg: #fee2e2;
  --color-danger-text: #991b1b;
  --color-warn-bg: #ffedd5;
  --color-warn-text: #9a3412;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

/* Garantiert, dass [hidden] immer greift, unabhängig von anderen display-Regeln
   (z.B. .field { display:flex }, .status-card-details { display:flex } etc.). */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
}

h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 20px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.05s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: #1f2937;
}

.btn-secondary {
  background: #fff;
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: #f3f4f6;
}

.nav-current {
  background: #e5e7eb;
  border-color: #d1d5db;
}

.nav-current:hover {
  background: #e5e7eb;
}

.btn-ghost {
  background: transparent;
  color: var(--color-muted);
}

.btn-ghost:hover {
  color: var(--color-text);
}

.btn-success {
  background: #16a34a;
  color: #fff;
}

.btn-success:hover {
  background: #15803d;
}

.btn-danger {
  background: var(--color-danger-text);
  color: #fff;
}

.btn-danger:hover {
  background: #7f1d1d;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-large {
  width: 100%;
  padding: 14px 18px;
  font-size: 15px;
  margin-top: 8px;
}

/* Login */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, #1f2937, #0b0f19 70%);
  padding: 24px;
}

.login-card {
  background: var(--color-surface);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-logo {
  max-width: 220px;
  margin: 0 auto 20px;
  display: block;
}

.login-card h1 {
  font-size: 17px;
  color: var(--color-muted);
  font-weight: 600;
  margin-bottom: 28px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.login-form label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
  margin-top: 10px;
}

.login-form input {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  font-size: 15px;
}

.login-form input:focus {
  outline: 2px solid var(--color-accent-light);
  outline-offset: 1px;
}

.login-form .btn {
  margin-top: 22px;
}

.error-text {
  color: var(--color-danger-text);
  font-size: 13px;
  margin: 6px 0 0;
  min-height: 1em;
}

/* App shell */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.app-logo {
  height: 34px;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

/* Parkticket kommt ohne Ueberschrift aus - dort darf der erste Block
   direkt unter der Navigation sitzen. */
.page-content.page-content-tight {
  padding-top: 6px;
}

/* Der Rechner-Block soll moeglichst weit oben stehen: oben weniger
   Innenabstand als an den restlichen Seiten der Karte. */
.page-content-tight .karte-form {
  padding-top: 16px;
}

.page-content-tight .section-title {
  margin-bottom: 12px;
}

/* Unten ebenfalls weniger Leerraum: der Block soll nicht in einer grossen
   weissen Flaeche unterhalb der manuellen Quittung enden. */
.page-content-tight .karte-form {
  padding-bottom: 14px;
}

.page-content-tight .receipt-choice-row-manuell {
  margin-bottom: 6px;
}

/* Form */
.karte-form {
  position: relative;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

/* Die beiden Schalter sitzen oben rechts ueber den Feldern. Bewusst im
   normalen Textfluss: nebeneinander schwebend wuerden sie das erste Feld
   ueberdecken, sobald es zwei sind. */
.schalter-oben {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 4px;
}

.hmh-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #f9fafb;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  cursor: pointer;
}

.hmh-toggle input {
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* Beschriftung links, Kasten rechts daneben. Die Beschriftungsspalte hat eine
   feste Breite, damit alle Kaesten trotz unterschiedlich langer Woerter genau
   untereinander stehen - die laengste Zeile ist "Emergency number" mit
   nachgemessenen 103 px. */
.form-grid {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  margin-top: 12px;
}

.form-grid .field {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.form-grid .field > label {
  flex: 0 0 115px;
  width: 115px;
}

/* Auf dieser Seite steht die englische Fassung unter der deutschen, nicht
   daneben - sonst wuerde die Beschriftungsspalte doppelt so breit. */
.form-grid .field-en {
  display: block;
  margin-left: 0;
}

.feld-eingaben {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Die Kaesten sind nur so breit wie ihr Inhalt: ueber die ganze
   Formularbreite gezogen wirkte ein Kennzeichen verloren. */
#kennzeichen,
#notfallnummer {
  width: 170px;
}

/* [type=date|time] entsteht auf Smartphones/Tablets, wo flatpickr auf die
   nativen Picker umschaltet. */
.feld-eingaben input.eingabe-datum,
.feld-eingaben input[type='date'] {
  width: 120px;
}

.feld-eingaben input.eingabe-zeit,
.feld-eingaben input[type='time'] {
  width: 78px;
}

/* Das "h" steht anstelle einer eigenen Beschriftung fuer die Uhrzeit. */
.feld-einheit {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.field-en {
  font-size: 11px;
  font-weight: 400;
  font-style: italic;
  color: #9ca3af;
  margin-left: 6px;
}

/* [type=date|time] entsteht auf Smartphones/Tablets, weil flatpickr dort auf die
   nativen Picker umschaltet und die Klassen des Originalfeldes uebernimmt. */
.field input[type='text'],
.field input[type='tel'],
.field input[type='date'],
.field input[type='time'],
.field input[type='datetime-local'] {
  padding: 11px 13px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  font-size: 15px;
  background: #fff;
  cursor: pointer;
}

.field input:focus {
  outline: 2px solid var(--color-accent-light);
  outline-offset: 1px;
}

.form-grid .field input {
  border-color: var(--color-text);
}

.field-invalid input[type='text'],
.field-invalid input[type='tel'],
.field-invalid input[type='date'],
.field-invalid input[type='time'],
.field-invalid input[type='datetime-local'] {
  border-color: var(--color-danger-text);
  background: var(--color-danger-bg);
}

.price-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--color-border);
}

.price-summary-single {
  grid-template-columns: 1fr;
  max-width: 240px;
  margin-left: auto;
  margin-right: auto;
}

.tageskarte-kennzeichen-wrap {
  margin-bottom: 22px;
}

.field.kurzpark-entry-centered input.tageskarte-kennzeichen-input {
  width: 260px;
  padding: 16px;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
}

.price-box {
  background: #f9fafb;
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
}

.price-box-total {
  background: #fffbeb;
}

.price-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.price-value {
  display: block;
  font-size: 22px;
  font-weight: 700;
}

.price-box-total .price-value {
  color: var(--color-accent);
}

/* Übersicht: Status-Board */
.status-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 36px;
}

.status-column {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.status-column-header {
  padding: 14px 16px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.status-column-header-right {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.status-column-toggle-icon {
  font-size: 11px;
  opacity: 0.75;
}

.status-column-hidden {
  display: none;
}

.status-column-expanded-view {
  grid-column: 1 / -1;
}

.status-column h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.status-column-date {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.75;
  white-space: nowrap;
}

.status-column-expired .status-column-header {
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
}

.status-column-today .status-column-header {
  background: var(--color-warn-bg);
  color: var(--color-warn-text);
}

.status-column-future .status-column-header {
  background: #dcfce7;
  color: #166534;
}

.status-cards {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 50px;
}

.status-card {
  background: #f9fafb;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  overflow: hidden;
}

.status-card:hover {
  background: #f3f4f6;
}

.status-card-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
}

.status-card-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.status-card-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.status-card-plate {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-card-time {
  color: var(--color-muted);
  font-size: 12px;
  white-space: nowrap;
}

/* Feste Breite, damit die Kennzeichen daneben alle an derselben Stelle
   anfangen - "TAGES" ist sonst breiter als "24H" und schiebt sie versetzt. */
.type-tag {
  flex-shrink: 0;
  width: 44px;
  box-sizing: border-box;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 4px;
  border-radius: 10px;
}

.type-tag-24h {
  background: #e0e7ff;
  color: #3730a3;
}

.type-tag-day {
  background: #dcfce7;
  color: #166534;
}

.status-card-toggle {
  color: var(--color-muted);
  font-size: 11px;
}

.status-card-expanded {
  background: #fff;
  box-shadow: var(--shadow);
}

.status-card-details:not([hidden]) {
  padding: 2px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--color-border);
  margin: 0 12px;
  padding-top: 8px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.detail-label {
  color: var(--color-muted);
  font-weight: 600;
}

.detail-value {
  font-weight: 600;
  text-align: right;
}

.status-empty {
  color: var(--color-muted);
  font-size: 13px;
  text-align: center;
  padding: 16px 0;
  margin: 0;
}

/* Übersicht: Verlauf */
.history-section {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.history-section h2 {
  font-size: 15px;
  margin: 0 0 16px;
}

.history-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  cursor: pointer;
  font-family: inherit;
}

.history-toggle-icon {
  color: var(--color-muted);
  font-size: 13px;
}

#history-content,
#receipt-history-content {
  margin-top: 18px;
}

.history-section-spaced {
  margin-top: 24px;
}

.receipt-days-toggle {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}

#receipt-days-content {
  margin-top: 18px;
}

.anwalt-kanzlei-block > [id$='-content'] {
  margin-top: 18px;
}

/* Suchzeitraum ueber beiden Kanzlei-Tabellen. Die beiden Datumsfelder duerfen
   mitwachsen, der Knopf bleibt auf seiner Grundlinie stehen. */
.anwalt-zeitraum {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin: 18px 0 22px;
}

.anwalt-zeitraum .field {
  flex: 1 1 150px;
  min-width: 130px;
}

.anwalt-zeitraum .btn {
  flex: 0 0 auto;
  padding: 11px 16px;
}

.anwalt-sum-row td {
  font-weight: 700;
  border-top: 2px solid var(--color-border);
}

.history-days-vertical {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
  max-height: 320px;
  overflow-y: auto;
}

.day-pill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
}

.day-pill:hover {
  background: #f3f4f6;
}

.day-pill-active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.day-pill-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-muted);
  background: #f3f4f6;
  padding: 3px 10px;
  border-radius: 12px;
}

.day-pill-active .day-pill-count {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.table-wrap {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  /* Waagerecht rollbar statt "hidden": bei "hidden" verschwanden die rechten
     Spalten breiter Tabellen einfach, ohne dass man drankam. */
  overflow-x: auto;
  overflow-y: hidden;
}

.cards-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.cards-table th {
  text-align: left;
  padding: 14px 16px;
  background: #f9fafb;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  border-bottom: 1px solid var(--color-border);
}

.cards-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--color-border);
}

.cards-table tr:last-child td {
  border-bottom: none;
}

/* Neun Spalten: enger gesetzt, damit die Tabelle auch auf dem iPad ohne
   Rollen vollstaendig sichtbar bleibt. */
.cards-table-kompakt th,
.cards-table-kompakt td {
  /* 4 statt 5 px: die Trennlinien brauchen selbst Platz, und die Tabelle
     soll weiterhin ohne Rollen hineinpassen. */
  padding: 10px 2px;
  border-right: 1px solid var(--color-border);
}

.cards-table-kompakt th:last-child,
.cards-table-kompakt td:last-child {
  border-right: none;
}

/* Ueberschrift mittig zwischen ihren Trennlinien. */
.cards-table-kompakt th {
  text-align: center;
}

.cards-table-kompakt th:first-child,
.cards-table-kompakt td:first-child {
  padding-left: 10px;
}

.cards-table-kompakt th:last-child,
.cards-table-kompakt td:last-child {
  padding-right: 10px;
}

/* Ueberschriften duerfen umbrechen ("Notfall-Nummer" auf zwei Zeilen) - sonst
   bestimmt die laengste Ueberschrift die Spaltenbreite, nicht der Inhalt. */
.cards-table-kompakt th {
  white-space: normal;
}

.cards-table-kompakt {
  font-size: 13px;
}

.cards-table-kompakt th {
  font-size: 11px;
  letter-spacing: 0.02em;
}

/* Knoepfe und Werte sollen nicht mitten im Wort umbrechen. */
.cards-table-kompakt td,
.cards-table-kompakt .btn-delete-card,
.cards-table-kompakt .btn-karte-aendern {
  white-space: nowrap;
}

/* Diese beiden tragen zweiwortige Beschriftungen ("Kopie Karte",
   "Quittung Kopie"). Sie duerfen umbrechen - sonst bestimmt das laengste
   Wortpaar die Spaltenbreite und die Tabelle passt nicht mehr aufs iPad. */
.cards-table-kompakt .btn-karte-kopie,
.cards-table-kompakt .btn-karte-quittung {
  white-space: normal;
  line-height: 1.2;
}

.cards-table-kompakt .btn-delete-card,
.cards-table-kompakt .btn-karte-aendern,
.cards-table-kompakt .btn-karte-kopie,
.cards-table-kompakt .btn-karte-quittung {
  margin-top: 0;
  padding: 6px 4px;
  font-size: 11.5px;
}

.table-empty {
  text-align: center;
  color: var(--color-muted);
  padding: 30px !important;
}

/* Vorschau & Bestätigung */
.preview-section {
  margin-top: 24px;
}

.preview-section h2 {
  font-size: 16px;
  margin: 0 0 14px;
}

.preview-cards {
  display: flex;
  justify-content: center;
  margin-bottom: 22px;
}

.preview-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  aspect-ratio: 210 / 148;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 28px;
  overflow: hidden;
}

.preview-watermark {
  position: absolute;
  inset: 0;
  background-image: url('/img/Logo_Knese_CarPark_Schrift Kopie.png');
  background-repeat: repeat;
  background-size: 50px auto;
  opacity: 0.06;
  transform: rotate(-22deg) scale(1.4);
  transform-origin: center;
  z-index: 0;
}

.preview-logo {
  position: relative;
  z-index: 1;
  height: 36px;
  display: block;
  margin-bottom: 14px;
}

.preview-fields {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preview-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 5px;
}

.preview-label {
  flex: 0 0 120px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}

.preview-value {
  font-size: 15px;
  font-weight: 700;
}

.preview-price {
  font-size: 18px;
  color: var(--color-accent);
}

.confirm-step,
.print-step {
  text-align: center;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 28px;
}

.confirm-question {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 16px;
}

.confirm-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.confirm-actions .btn {
  min-width: 160px;
}

.print-hint {
  font-size: 13px;
  color: var(--color-accent);
  font-weight: 600;
  margin: 0 0 14px;
}

.print-step .btn-large {
  max-width: 320px;
  margin: 0 auto;
}

/* Kennzeichen unter der Leistungsbezeichnung in der Quittungsliste - gleiche
   Schrift und Farbe wie die Bezeichnung darueber, nur eine Zeile tiefer. */
.quittung-kennzeichen {
  display: block;
  margin-top: 2px;
}

/* Fenster "Karte ändern": breiter als die Rückfragen, weil hier Felder
   stehen und nicht nur zwei Knöpfe. */
.modal-box.modal-box-breit {
  max-width: 460px;
  text-align: left;
}

.modal-box.modal-box-breit .modal-question {
  text-align: center;
}

.karte-feld,
.karte-zeile {
  margin-bottom: 12px;
}

.karte-zeile {
  display: flex;
  gap: 10px;
}

.karte-zeile > .field {
  flex: 1 1 0;
  min-width: 0;
}

.modal-box-breit .radio-label {
  margin-bottom: 14px;
}

.karte-preis {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 1px solid var(--color-border);
  padding-top: 12px;
  margin-bottom: 6px;
  font-weight: 700;
}

.karte-preis span:last-child {
  font-size: 20px;
}

/* Knopfreihe in der aufgeklappten Karte: nebeneinander, gleich breit, und
   sie duerfen umbrechen, wenn die Spalte schmal wird. */
.status-card-aktionen {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.status-card-aktionen > * {
  flex: 1 1 auto;
  margin-top: 0;
}

/* Karte löschen */
.btn-delete-card {
  margin-top: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--color-danger-text);
  background: #fff;
  color: var(--color-danger-text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.btn-delete-card:hover {
  background: var(--color-danger-bg);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-box {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  padding: 28px 32px;
  max-width: 360px;
  width: 100%;
  text-align: center;
}

.modal-question {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 20px;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.modal-actions .btn {
  min-width: 110px;
}

/* Parkgebühr */
.page-content .karte-form + .karte-form {
  margin-top: 20px;
}

.section-title {
  font-size: 16px;
  margin: 0 0 18px;
}

.kurzpark-entry-centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.kurzpark-entry-centered label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.kurzpark-entry-row {
  position: relative;
  width: 220px;
}

.kurzpark-entry-input {
  width: 100%;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  background: #fff;
  cursor: pointer;
}

.kurzpark-entry-input:focus {
  outline: 2px solid var(--color-accent-light);
  outline-offset: 1px;
}

.kurzpark-entry-suffix {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 10px;
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
}

.manual-amount-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.manual-amount-row input[type='text'].manual-amount-input {
  width: 90px;
  height: 90px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  background: #fff;
}

.manual-amount-input:focus {
  outline: 2px solid var(--color-accent-light);
  outline-offset: 1px;
}

.manual-amount-input::placeholder {
  color: #b0b6be;
  font-weight: 700;
}

.manual-amount-suffix {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
}

.kurzpark-entry-fields-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.kurzpark-entry-fields-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.kurzpark-live {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}

.kurzpark-live-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.fee-boxes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.fee-box {
  border-radius: 10px;
  padding: 18px 20px;
  text-align: center;
}

button.fee-box {
  border: none;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  transition: filter 0.15s ease;
}

button.fee-box:hover {
  filter: brightness(0.96);
}

button.fee-box:active {
  transform: translateY(1px);
}

.fee-box-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.fee-box-value {
  display: block;
  font-size: 26px;
  font-weight: 700;
}

.fee-box-red {
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
}

.fee-box-blue {
  background: #dbeafe;
  color: #1e40af;
}

.receipt-type-choice {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.receipt-choice-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.manual-zeitraum-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.manual-zeitraum-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.manual-zeitraum-line-label {
  width: 84px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  text-align: right;
}

.manual-zeit-box {
  width: 90px;
  font-size: 15px;
  cursor: text;
}

/* Kennzeichen unter der Bis-Zeile: reicht ueber Datum und Uhrzeit zusammen,
   damit auch lange Kennzeichen ohne Abschneiden hineinpassen. */
.manual-kennzeichen-box {
  width: 228px;
  max-width: 100%;
  font-size: 15px;
  cursor: text;
}

.receipt-choice-row-manuell {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
  margin-bottom: 18px;
  padding: 18px 20px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: transparent;
}

.receipt-choice-row-manuell .receipt-choice-box {
  flex: 0 0 220px;
  width: auto;
}

.manual-box-input {
  height: 89px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  font-weight: 700;
  text-align: center;
  color: var(--color-text);
  padding: 0 10px;
}

.manual-box-input:focus {
  outline: 2px solid var(--color-accent-light);
  outline-offset: 1px;
}

.manual-box-input-slim {
  height: 40px;
}

.manual-amount-box {
  width: 130px;
  font-size: 20px;
  cursor: text;
}

.manual-amount-box::placeholder {
  color: #b0b6be;
  font-weight: 700;
}

.manual-datum-box {
  width: 130px;
  font-size: 15px;
  cursor: default;
}

.receipt-choice-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 89px;
  border: none;
  border-radius: 10px;
  padding: 18px 20px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  line-height: 1.3;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.receipt-choice-box:hover {
  filter: brightness(0.96);
}

.receipt-choice-red {
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
}

.receipt-choice-blue {
  background: #dbeafe;
  color: #1e40af;
}

.receipt-choice-outline {
  background: #f3f4f6;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.anwalt-row {
  display: flex;
  gap: 16px;
  margin-top: 16px;
}

.anwalt-box {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  border: none;
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  line-height: 1.3;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.anwalt-box:hover {
  filter: brightness(0.96);
}

/* Ein- und Ausfahrt im Anwalts-Fenster. Die Beschriftung steht ueber der
   Zeile, weil Datum und Uhrzeit nebeneinander sonst breiter waeren als das
   Fenster. */
.anwalt-modal-zeitraum {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 4px 0 18px;
  text-align: left;
}

.anwalt-modal-line-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 5px;
}

.anwalt-modal-line-inputs {
  display: flex;
  gap: 8px;
}

.anwalt-modal-line-inputs .manual-datum-box {
  flex: 1 1 auto;
  width: auto;
}

.anwalt-modal-line-inputs .manual-zeit-box {
  flex: 0 0 90px;
}

.anwalt-modal-fields {
  text-align: left;
  margin-bottom: 18px;
}

.anwalt-modal-betrag {
  font-size: 17px;
  font-weight: 700;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.radio-label input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.btn-karte-aendern,
.btn-karte-kopie,
.btn-karte-quittung,
.btn-reprint,
.btn-edit {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-karte-aendern:hover,
.btn-karte-kopie:hover,
.btn-karte-quittung:hover,
.btn-reprint:hover,
.btn-edit:hover {
  background: #f3f4f6;
}

/* Nichtzahler */
.nz-table-wrap {
  margin-top: 18px;
}

.nz-kennzeichen-input {
  width: 220px;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  background: #fff;
}

.nz-kennzeichen-input:focus {
  outline: 2px solid var(--color-accent-light);
  outline-offset: 1px;
}

.nz-datum-input {
  width: 130px;
}

.nz-entry-row {
  display: flex;
  align-items: flex-end;
  gap: 20px;
}

.manual-amount-row input[type='text'].nz-preis-input {
  width: 64px;
  height: 41px;
  font-size: 15px;
}

.nz-bemerkung-field {
  margin-top: 16px;
}

.nz-bemerkung-input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  resize: vertical;
}

.nz-bemerkung-input:focus {
  outline: 2px solid var(--color-accent-light);
  outline-offset: 1px;
}

.btn-paid {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #16a34a;
  background: #fff;
  color: #16a34a;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-paid:hover {
  background: #f0fdf4;
}

/* ==========================================================================
   Responsive: Tablet (iPad) und Smartphone
   ========================================================================== */

/* Tablets und alles darunter */
@media screen and (max-width: 1024px) {
  .app-header {
    padding: 12px 18px;
    gap: 12px;
  }

  .app-nav {
    flex-wrap: wrap;
    justify-content: flex-end;
    row-gap: 8px;
  }

  .app-nav .btn {
    padding: 9px 14px;
    font-size: 13px;
  }

  .page-content {
    padding: 24px 18px 48px;
  }

  /* Statusspalten umbrechen, statt Kennzeichen abzuschneiden */
  .status-board {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
  }

  /* Breite Tabellen lieber horizontal scrollen als die Spalten quetschen */
  .table-wrap {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .cards-table {
    min-width: 700px;
  }

  /* Datum, Preis und Kennzeichen sollen nicht mitten im Wert umbrechen */
  .cards-table th,
  .cards-table td {
    white-space: nowrap;
  }
}

/* Sobald die Navigation nicht mehr neben das Logo passt */
@media screen and (max-width: 900px) {
  .app-header {
    flex-direction: column;
    align-items: center;
    padding: 12px 14px;
    gap: 10px;
  }

  .app-logo {
    height: 30px;
  }

  .app-nav {
    width: 100%;
    justify-content: center;
  }
}

/* Smartphones */
/* Unter rund 540 px ist neben der Beschriftung kein Platz mehr fuer den
   Kasten - dort steht die Beschriftung wieder darueber. */
@media screen and (max-width: 560px) {
  .form-grid .field {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .form-grid .field > label {
    flex: 0 0 auto;
    width: auto;
  }
}

@media screen and (max-width: 720px) {
  h1 {
    font-size: 19px;
    margin-bottom: 16px;
  }

  .page-content {
    padding: 20px 14px 48px;
  }

  .app-nav .btn {
    padding: 9px 12px;
  }

  .login-card {
    padding: 30px 22px;
  }

  /* Formular: eine Spalte statt zwei */
  .karte-form {
    padding: 18px 16px;
  }

  .form-grid {
    gap: 14px;
    margin-top: 0;
  }

  .field-full {
    grid-column: auto;
  }

  /* Auf schmalen Schirmen untereinander statt nebeneinander. */
  .schalter-oben {
    flex-wrap: wrap;
  }

  /* Auf dem Handy schaltet flatpickr auf die nativen Felder um: die tragen ein
     Kalendersymbol und die groessere 16px-Schrift und brauchen darum mehr
     Platz als die getippten Felder am Rechner. */
  .feld-eingaben input[type='date'] {
    width: 155px;
  }

  .feld-eingaben input[type='time'] {
    width: 95px;
  }

  /* 16px verhindert, dass iOS beim Antippen eines Feldes hineinzoomt */
  .field input[type='text'],
  .field input[type='tel'],
  .field input[type='date'],
  .field input[type='time'],
  .field input[type='datetime-local'],
  .login-form input,
  .nz-bemerkung-input,
  .manual-datum-box,
  .manual-kennzeichen-box {
    font-size: 16px;
  }

  .price-summary {
    gap: 8px;
    margin-top: 20px;
    padding-top: 18px;
  }

  .price-box {
    padding: 12px 8px;
  }

  .price-label {
    font-size: 11px;
    letter-spacing: 0.02em;
  }

  .price-value {
    font-size: 18px;
  }

  /* Uebersicht: Statusspalten untereinander */
  .status-board {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 24px;
  }

  .history-section {
    padding: 18px 16px;
  }

  .cards-table th,
  .cards-table td {
    padding: 10px 12px;
  }

  .btn-delete-card,
  .btn-reprint,
  .btn-edit,
  .btn-paid {
    padding: 9px 14px;
    font-size: 13px;
  }

  /* Kurzzeitparken */
  .kurzpark-entry-fields-row {
    flex-direction: column;
    gap: 18px;
  }

  .kurzpark-entry-fields-col {
    width: 100%;
  }

  /* "Uhr" stand absolut rechts neben dem Feld und lief aus dem Bild */
  .kurzpark-entry-row {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 260px;
  }

  .kurzpark-entry-input {
    font-size: 20px;
    padding: 14px;
  }

  .kurzpark-entry-suffix {
    position: static;
    transform: none;
    margin-left: 8px;
    font-size: 18px;
  }

  .kurzpark-live {
    gap: 16px;
  }

  .fee-boxes {
    gap: 10px;
  }

  .fee-box {
    padding: 14px 10px;
  }

  .fee-box-value {
    font-size: 22px;
  }

  .receipt-choice-row {
    gap: 10px;
  }

  .receipt-choice-box {
    padding: 14px 10px;
    font-size: 13px;
  }

  .receipt-choice-row-manuell {
    gap: 12px;
    padding: 14px;
  }

  .anwalt-row {
    gap: 10px;
    margin-top: 14px;
  }

  .anwalt-box {
    padding: 12px 8px;
    font-size: 13px;
  }

  .receipt-choice-row-manuell .receipt-choice-box {
    flex: 1 1 100%;
    order: 3;
  }

  .manual-box-input {
    height: 72px;
  }

  .manual-amount-box,
  .manual-datum-box {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
  }

  /* Auf dem Handy ist neben den Feldern kein Platz mehr fuer eine
     Beschriftungsspalte - Von/Bis/Kennzeichen ruecken darum ueber die Zeile. */
  .manual-zeitraum-stack {
    width: 100%;
    gap: 10px;
  }

  .manual-zeitraum-line {
    flex-wrap: wrap;
  }

  .manual-zeitraum-line-label {
    width: 100%;
    text-align: left;
    margin-bottom: -4px;
  }

  .manual-kennzeichen-box {
    width: 100%;
  }

  /* Tageskarte */
  .field.kurzpark-entry-centered input.tageskarte-kennzeichen-input {
    width: 100%;
    max-width: 260px;
    padding: 14px;
    font-size: 22px;
  }

  /* Nichtzahler */
  .nz-entry-row {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .nz-kennzeichen-input,
  .nz-datum-input {
    width: 100%;
  }

  .manual-amount-row input[type='text'].nz-preis-input {
    width: 100px;
    height: 48px;
    font-size: 16px;
  }

  /* Vorschau: feste Kartenproportion wuerde den Inhalt abschneiden */
  .preview-card {
    aspect-ratio: auto;
    max-width: 100%;
    padding: 18px 16px;
  }

  .preview-row {
    gap: 8px;
  }

  .preview-label {
    flex: 0 0 92px;
    font-size: 10px;
  }

  .preview-value {
    font-size: 14px;
  }

  .preview-price {
    font-size: 16px;
  }

  .confirm-step,
  .print-step {
    padding: 18px 16px;
  }

  .confirm-actions {
    flex-wrap: wrap;
    gap: 10px;
  }

  .confirm-actions .btn {
    flex: 1 1 140px;
    min-width: 0;
  }

  /* Dialoge */
  .modal-overlay {
    padding: 16px;
  }

  .modal-box {
    padding: 22px 18px;
  }

  .modal-actions {
    flex-wrap: wrap;
    gap: 10px;
  }

  .modal-actions .btn {
    flex: 1 1 120px;
    min-width: 0;
  }
}
