/* ==========================================================================
   RawmanPictures — Component & Layout styles
   Depends on tokens.css
   ========================================================================== */

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

/* Ensure [hidden] always wins, even when element has display:flex via class */
[hidden] { display: none !important; }

html, body { height: 100%; overflow: hidden; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; }

input, textarea, select {
  font-family: inherit;
  font-size: 16px; /* prevents iOS zoom on focus */
}

::selection { background: var(--accent-soft); }

/* Hide scrollbars but keep scroll */
.scroll-y { overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ---------- App shell ---------- */
/*
 * App-shell layout: body/html are viewport-locked (no body scroll).
 * Only .app__main scrolls — this keeps the nav reliably pinned at the bottom
 * on all mobile browsers without relying on position:fixed.
 */
.app {
  max-width: var(--maxw);
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app__header {
  flex-shrink: 0;
  z-index: 20;
  padding: calc(var(--safe-top) + var(--sp-4)) var(--sp-5) var(--sp-3);
  background: linear-gradient(180deg, var(--color-bg) 80%, transparent);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: var(--fs-md);
  letter-spacing: 0.22em;
  user-select: none;
}
.logo b { font-weight: var(--fw-bold); }
.logo span { font-weight: var(--fw-light); color: var(--text-secondary); }

.header-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-tertiary);
  transition: background var(--dur), box-shadow var(--dur);
}
.header-dot.is-live {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.app__main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: var(--sp-3) var(--sp-5) var(--sp-6);
}

/* ---------- Views ---------- */
.view { display: none; animation: fade var(--dur) var(--ease); }
.view.is-active { display: block; }

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.section-title {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-secondary);
  font-weight: var(--fw-medium);
  margin: var(--sp-5) 0 var(--sp-3);
}
.section-title:first-child { margin-top: var(--sp-2); }

/* ---------- Dashboard ---------- */
.dash {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-5);
  padding-top: var(--sp-6);
}

.dash__greeting { text-align: center; }
.dash__greeting h1 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  margin: 0 0 var(--sp-1);
}
.dash__greeting p {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
}

/* Big circular CTA */
.cta {
  position: relative;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--text-on-accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  box-shadow: var(--shadow-accent);
  transition: transform var(--dur-fast) var(--ease), background var(--dur);
  user-select: none;
}
.cta:active { transform: scale(0.96); }
.cta svg { width: 46px; height: 46px; stroke-width: 1.8; }
.cta__label {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.01em;
}
.cta__sub {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  opacity: 0.7;
}

/* Stop state */
.cta.is-stop {
  background: var(--color-surface-2);
  color: var(--text-primary);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
}
.cta.is-stop .cta__sub { color: var(--accent); opacity: 1; }

/* Pulsing ring when a trip is running */
.cta.is-stop::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid var(--accent-ring);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0%   { transform: scale(1);    opacity: 0.8; }
  70%  { transform: scale(1.08); opacity: 0;   }
  100% { transform: scale(1.08); opacity: 0;   }
}

/* Live trip meta card */
.live-card {
  width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
}
.live-card .meta__label {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  margin-bottom: 2px;
}
.live-card .meta__value {
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
}
.live-card .full { grid-column: 1 / -1; }

/* ---------- Stats (Berichte header) ---------- */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
}
.stat-card.accent {
  background: var(--accent-soft);
  border-color: transparent;
}
.stat-card .label {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.stat-card.accent .label { color: var(--accent); }
.stat-card .value {
  margin-top: var(--sp-2);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
}

.year-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: var(--sp-4) 0 var(--sp-3);
}
.year-switch h2 {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  margin: 0;
}
.year-switch .chips { display: flex; gap: var(--sp-2); }
.chip {
  background: var(--color-surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--r-pill);
  padding: 6px 14px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}
.chip.is-active {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: transparent;
}

/* ---------- Trip list ---------- */
.trip-list { display: flex; flex-direction: column; gap: var(--sp-3); }

/* Swipe wrapper — clips overflow and provides the visual card box */
.trip-wrap {
  position: relative;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--r-lg);
  overflow: hidden;
  isolation: isolate;
}

/* Gold edit zone — revealed by right swipe (left side) */
.trip-edit-zone {
  position: absolute;
  inset-block: 0;
  left: 0;
  width: 80px;
  background: var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--text-on-accent);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
}
.trip-edit-zone svg { stroke: var(--text-on-accent); }
.trip-edit-zone__label {
  font-size: 10px;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Red delete zone — revealed by left swipe (right side) */
.trip-del-zone {
  position: absolute;
  inset-block: 0;
  right: 0;
  width: 80px;
  background: var(--danger);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #fff;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
}
.trip-del-zone svg { stroke: #fff; }

/* Zones only visible when actively swiping in that direction or already open */
.trip-wrap.is-swiping-right .trip-edit-zone,
.trip-wrap[data-open-edit] .trip-edit-zone,
.trip-wrap.is-swiping-left .trip-del-zone,
.trip-wrap[data-open] .trip-del-zone {
  opacity: 1;
  transition: opacity 0.08s;
}
.trip-del-zone svg { stroke: #fff; }
.trip-del-zone__label {
  font-size: 10px;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.trip {
  background: var(--color-surface);
  border-radius: 0;
  border: none;
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  /* Swipe mechanics */
  position: relative;
  z-index: 1;
  touch-action: pan-y;
  transition: transform var(--dur) var(--ease);
  cursor: default;
}
.trip.is-dragging { transition: none; }

.trip__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--sp-3);
}
.trip__date { font-size: var(--fs-xs); color: var(--text-secondary); }
.trip__amount {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  color: var(--accent);
  white-space: nowrap;
}

.trip__route {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.route-node { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.route-node .place {
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.route-node .km { font-size: var(--fs-xs); color: var(--text-secondary); }
.route-arrow { color: var(--text-tertiary); flex-shrink: 0; }
.route-arrow svg { width: 18px; height: 18px; }

.trip__desc {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  border-top: 1px solid var(--color-border-soft);
  padding-top: var(--sp-3);
}
.trip__foot {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: var(--sp-7) var(--sp-5);
  color: var(--text-secondary);
}
.empty svg { width: 40px; height: 40px; color: var(--text-tertiary); margin-bottom: var(--sp-3); }
.empty p { margin: 0; font-size: var(--fs-sm); }

/* ---------- Data management ---------- */
.data-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-3);
}
.data-card .ico {
  width: 42px; height: 42px;
  flex-shrink: 0;
  border-radius: var(--r-md);
  background: var(--color-surface-2);
  display: grid; place-items: center;
  color: var(--accent);
}
.data-card .ico svg { width: 20px; height: 20px; }
.data-card .txt { flex: 1; min-width: 0; }
.data-card .txt h3 { margin: 0 0 2px; font-size: var(--fs-base); font-weight: var(--fw-medium); color: var(--text-primary); }
.data-card .txt p { margin: 0; font-size: var(--fs-xs); color: var(--text-secondary); }
.data-card .chev { color: var(--text-tertiary); }

.danger-zone .data-card .ico { color: var(--danger); }
.danger-zone .data-card .txt h3 { color: var(--danger); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  border-radius: var(--r-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--text-primary);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  padding: 14px 18px;
  width: 100%;
  transition: transform var(--dur-fast), background var(--dur);
}
.btn:active { transform: scale(0.98); }
.btn--primary {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: transparent;
  font-weight: var(--fw-semibold);
}
.btn--primary:active { background: var(--accent-press); }
.btn--ghost { background: transparent; }
.btn--danger { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }

/* ---------- Bottom nav ---------- */
.nav {
  flex-shrink: 0;
  width: 100%;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(15,15,15,0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--color-border-soft);
  display: flex;
  z-index: 30;
}
.nav__item {
  flex: 1;
  background: none; border: none;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10px;
  letter-spacing: 0.04em;
  font-weight: var(--fw-medium);
  transition: color var(--dur);
}
.nav__item svg { width: 22px; height: 22px; stroke-width: 1.7; }
.nav__item.is-active { color: var(--accent); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.is-open { display: flex; animation: fade var(--dur-fast); }

.modal {
  width: 100%;
  max-width: var(--maxw);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-bottom: none;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: var(--sp-5) var(--sp-5) calc(var(--sp-5) + var(--safe-bottom));
  animation: slideUp var(--dur) var(--ease);
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: none; }
}
.modal__handle {
  width: 36px; height: 4px;
  border-radius: var(--r-pill);
  background: var(--color-border);
  margin: 0 auto var(--sp-4);
}
.modal__title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  margin: 0 0 var(--sp-1);
}
.modal__subtitle {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin: 0 0 var(--sp-5);
}

/* ---------- Form fields ---------- */
.field { margin-bottom: var(--sp-4); }
.field__label {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: var(--fw-medium);
  margin-bottom: var(--sp-2);
}
.input, .textarea {
  width: 100%;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  padding: 14px var(--sp-4);
  transition: border-color var(--dur), box-shadow var(--dur);
}
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}
.textarea { resize: none; min-height: 76px; }
.input-hint {
  display: block;
  font-size: var(--fs-xs);
  margin-top: var(--sp-2);
  color: var(--text-tertiary);
}
.input-hint.is-error { color: var(--danger); }
.input-row { display: flex; gap: var(--sp-3); }
.input-row .field { flex: 1; }

.field__loading {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-xs); color: var(--accent);
  margin-top: var(--sp-2);
}
.spinner {
  width: 12px; height: 12px;
  border: 2px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.modal__actions { display: flex; gap: var(--sp-3); margin-top: var(--sp-5); }
.modal__actions .btn { flex: 1; }

/* ---------- Toast ---------- */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + var(--sp-4));
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: calc(100% - var(--sp-6));
  max-width: 460px;
  pointer-events: none;
}
.toast {
  background: var(--color-surface-3);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  padding: 12px var(--sp-4);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  animation: toastIn var(--dur) var(--ease);
}
.toast.is-success { border-left: 3px solid var(--success); }
.toast.is-error   { border-left: 3px solid var(--danger); }
.toast.is-info    { border-left: 3px solid var(--accent); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- PIN screen ---------- */
.pin-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--color-bg);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--safe-top) var(--sp-5) var(--safe-bottom);
}
.pin-screen.is-visible { display: flex; }
.pin-screen.is-unlocking {
  animation: pinFadeOut 0.42s var(--ease) forwards;
}
@keyframes pinFadeOut {
  to { opacity: 0; transform: scale(1.04); }
}

.pin-screen__inner {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-5);
}

.pin-logo {
  font-size: var(--fs-md);
  letter-spacing: 0.22em;
  user-select: none;
  margin-bottom: var(--sp-2);
}
.pin-logo b  { font-weight: var(--fw-bold); color: var(--text-primary); }
.pin-logo span { font-weight: var(--fw-light); color: var(--text-secondary); }

.pin-sub {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* 4 dot indicators */
.pin-dots {
  display: flex;
  gap: 20px;
}
.pin-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: transparent;
  transition: background var(--dur-fast), border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.pin-dot.is-filled {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* Shake on wrong PIN */
.pin-dots.is-shake {
  animation: shake 0.55s var(--ease);
}
@keyframes shake {
  0%,100% { transform: none; }
  15%      { transform: translateX(-8px); }
  30%      { transform: translateX( 8px); }
  45%      { transform: translateX(-6px); }
  60%      { transform: translateX( 6px); }
  75%      { transform: translateX(-3px); }
  90%      { transform: translateX( 3px); }
}

.pin-error {
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--danger);
  letter-spacing: 0.02em;
  min-height: 1em;
}

/* Numpad grid */
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  gap: var(--sp-3);
  justify-content: center;
}
.pin-key {
  width: 72px; height: 72px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--text-primary);
  font-size: var(--fs-lg);
  font-weight: var(--fw-medium);
  display: grid; place-items: center;
  transition: background var(--dur-fast), transform var(--dur-fast), border-color var(--dur-fast);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.pin-key:active {
  background: var(--color-surface-3);
  border-color: var(--accent);
  transform: scale(0.93);
}
.pin-key--del {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}
.pin-key--del:active {
  background: var(--color-surface-2);
  border-color: var(--color-border);
  color: var(--text-primary);
}

/* ---------- Confirm modal icon ---------- */
.confirm-modal__icon {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  background: var(--danger-soft);
  display: grid; place-items: center;
  color: var(--danger);
  margin-bottom: var(--sp-3);
}
.confirm-modal__icon svg { width: 22px; height: 22px; }

/* ---------- Bio unlock button (View 1) ---------- */
.bio-cta {
  position: relative;
  width: 160px; height: 160px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  transition: transform var(--dur-fast) var(--ease), background var(--dur),
              border-color var(--dur);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.bio-cta svg { width: 54px; height: 54px; }
.bio-cta__label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-primary);
  letter-spacing: 0.04em;
}
.bio-cta:active { transform: scale(0.94); }
.bio-cta:hover  { border-color: var(--accent); background: var(--color-surface-2); }

/* Pulsing gold ring */
.bio-cta__ring {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1px solid var(--accent-ring);
  animation: pulse 2.6s var(--ease) infinite;
  pointer-events: none;
}

/* Loading state while WebAuthn dialog is open */
.bio-cta.is-loading {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.bio-cta.is-loading .bio-cta__ring { animation: none; }

.bio-hint {
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
}

.pin-link {
  background: none; border: none;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-family: inherit;
  cursor: pointer;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-md);
  transition: color var(--dur);
}
.pin-link:hover { color: var(--text-primary); }
.pin-link:active { color: var(--accent); }

/* ---------- Enroll view (View 3) ---------- */
.enroll-icon {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  display: grid; place-items: center;
  color: var(--accent);
}
.enroll-icon svg { width: 46px; height: 46px; }

.enroll-title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  margin: 0;
  text-align: center;
}
.enroll-desc {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  text-align: center;
  max-width: 280px;
  line-height: 1.55;
}
.enroll-actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  width: 100%;
  max-width: 300px;
}

/* ================================================================
   FEATURE ADDITIONS
   ================================================================ */

/* ---------- Search bar (Berichte) ---------- */
.search-bar {
  position: relative;
  margin-bottom: var(--sp-3);
}
.search-bar__icon {
  position: absolute;
  left: var(--sp-4);
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-tertiary);
  pointer-events: none;
}
.search-bar__icon svg { width: 16px; height: 16px; }
.search-input {
  width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  padding: 12px var(--sp-4) 12px calc(var(--sp-4) + 24px);
  font-size: var(--fs-sm);
  font-family: inherit;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-input::placeholder { color: var(--text-tertiary); }

/* ---------- Category filter chips (Berichte) ---------- */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

/* ---------- Monthly grouping (Berichte) ---------- */
.trip-list { display: flex; flex-direction: column; gap: var(--sp-4); }
.month-group { display: flex; flex-direction: column; gap: var(--sp-3); }
.month-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--color-border-soft);
}
.month-header__name {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.month-header__stats {
  font-size: var(--fs-xs);
  color: var(--accent);
  font-weight: var(--fw-medium);
}

/* ---------- Category badge on trip card ---------- */
.trip__top-row { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.trip__cat {
  display: inline-block;
  font-size: 9px;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--r-pill);
  padding: 2px 7px;
  align-self: flex-start;
}

/* ---------- Category chip selector (Modals) ---------- */
.cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.cat-chip {
  background: var(--color-surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--r-pill);
  padding: 6px 14px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  font-family: inherit;
  cursor: pointer;
  transition: background var(--dur), color var(--dur), border-color var(--dur);
}
.cat-chip.is-active {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: transparent;
}

/* ---------- Quick routes (Start-Modal) ---------- */
.quick-routes { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.quick-route-chip {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--r-pill);
  padding: 5px 12px;
  font-size: var(--fs-xs);
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--dur), color var(--dur), border-color var(--dur);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.quick-route-chip:active,
.quick-route-chip.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- Trip pair accordion (Hin & Zurück) ---------- */
.trip-pair {
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--color-surface);
}
.trip-pair__header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: none;
  border: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--text-primary);
  -webkit-tap-highlight-color: transparent;
  transition: background var(--dur-fast);
}
.trip-pair__header:active { background: var(--color-surface-2); }
.trip-pair__left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.trip-pair__right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}
.trip-pair__badge {
  font-size: 9px;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--r-pill);
  padding: 2px 7px;
  align-self: flex-start;
}
.trip-pair__route {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trip-pair__sub {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}
.trip-pair__amount {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--accent);
  white-space: nowrap;
}
.trip-pair__chevron {
  color: var(--text-tertiary);
  display: flex;
  flex-shrink: 0;
}
.trip-pair__chevron svg {
  width: 16px;
  height: 16px;
  transform: rotate(90deg);
  transition: transform var(--dur) var(--ease);
}
.trip-pair.is-open .trip-pair__chevron svg { transform: rotate(270deg); }

/* CSS grid accordion — smooth height animation without JS */
.trip-pair__body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s var(--ease);
}
.trip-pair__body-inner {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-top: 1px solid var(--color-border-soft);
}
.trip-pair.is-open .trip-pair__body { grid-template-rows: 1fr; }

/* ---------- KM-Satz in Daten-Tab ---------- */
.rate-field {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}
.rate-field .input {
  width: 80px;
  text-align: right;
  padding: 8px 10px;
  font-size: var(--fs-sm);
}
.rate-unit {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  white-space: nowrap;
}
