:root {
  --brand-yellow: #F9C62B;
  --brand-yellow-text: #1f2937;
  --brand: #FEBD00;
  --text: #1f2937;
  --muted: #6b7280;
  --card: #ffffff;
  --bg: #f6f7f9;
  --logo-w: 240px;
  --logo-w-mobile: 170px;
  --radius: 16px;
  --shadow: 0 10px 20px rgba(0,0,0,.05);
  --field-h: 46px;
}

* { box-sizing: border-box; }

body {
  font-family: system-ui, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  margin: 0;
  color: var(--text);
  overflow-x: hidden;
}

.wrap { max-width: 900px; margin: 0 auto; padding: 24px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }

/* Header & Logo */
.header { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.logo { display: block; width: var(--logo-w); height: auto; }
h1 { font-size: 1.5rem; line-height: 1.1; margin: 0; }

/* Userbar */
.userbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px;
  background: #f7f7f8; border-bottom: 1px solid #e5e7eb;
  font: 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  overflow-x: hidden;
}
.userbar__left { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1 1 auto; }
.userbar__name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
#tenantDisplay { margin-left: 6px; font-size: 0.85rem; opacity: 0.8; white-space: nowrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 9999px;
  border: 1px solid rgba(0,0,0,.08); background: #fff; cursor: pointer;
  transition: filter .15s, transform .05s; user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn--yellow {
  background: var(--brand-yellow); color: var(--brand-yellow-text);
  border-color: rgba(0,0,0,.06); box-shadow: 0 1px 0 rgba(0,0,0,.04);
}
.btn--yellow:hover { filter: brightness(.98); }
.btn__icon { width: 18px; height: 18px; display: inline-block; }

button.action {
  height: var(--field-h); background: var(--brand); color: #111827;
  border: 0; border-radius: 12px; padding: .65rem 1.1rem;
  font-weight: 600; font-size: 16px; cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.1);
}
button.action:hover { filter: brightness(0.97); }
button.action:active { transform: translateY(1px); }

/* Formular & Layout */
.row { display: flex; gap: 10px; align-items: stretch; }
.field { flex: 1; }
label { display: block; font-size: .9rem; color: var(--muted); margin: 0 0 4px; }
.mt { margin-top: 16px; }
.muted { color: var(--muted); }
.err { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; padding: .75rem; border-radius: 12px; }

/* Text Inputs & Clear Button */
.inputWrap { position: relative; width: 100%; }
input[type="text"] {
  width: 100%; height: var(--field-h);
  border: 1px solid #e5e7eb; border-radius: 12px;
  padding: .65rem 2.6rem .65rem .8rem;
  font-size: 16px; outline: none; background: #fff;
}
input[type="text"]:focus { border-color: #d1d5db; box-shadow: 0 0 0 3px rgba(17,24,39,.06); }

.clearBtn {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 9999px;
  border: 1px solid #e5e7eb; background: #fff; color: #6b7280;
  display: none; align-items: center; justify-content: center;
  padding: 0; line-height: 1; font-size: 18px; cursor: pointer;
  box-shadow: 0 1px 0 rgba(0,0,0,.02);
}
.clearBtn:hover { filter: brightness(.98); }
.clearBtn:active { transform: translateY(-50%) scale(0.98); }
.clearBtn:focus { outline: none; box-shadow: 0 0 0 3px rgba(17,24,39,.06); }

/* Datumssuche (Edge-kompatibel) */
.date-wrap { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.dateOpen {
  height: var(--field-h); min-width: 46px; padding: 0 10px;
  border: 1px solid #e5e7eb; background: #fff; border-radius: 12px;
  cursor: pointer; box-shadow: 0 1px 0 rgba(0,0,0,.02);
}
.dateOpen:hover { filter: brightness(.98); }
.dateOpen:active { transform: translateY(1px); }

.dateNative {
  position: absolute; right: 0; top: 0; width: 48px;
  height: var(--field-h); opacity: 0; z-index: 2; cursor: pointer; padding: 0;
}
.dateNative::-webkit-calendar-picker-indicator {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  margin: 0; padding: 0; cursor: pointer;
}

/* Results & Badges */
.plate { font-size: 2rem; font-weight: 800; letter-spacing: .5px; }
.tag {
  display: inline-flex; align-items: stretch; overflow: hidden;
  border-radius: 9999px; border: 1px solid #e5e7eb; background: #fff; margin-right: 6px;
}
.tag .key { background: #111827; color: #fff; padding: .25rem .6rem; font-size: .85rem; }
.tag .val { padding: .25rem .6rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

dl { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 0 0; }
dt { font-size: .9rem; color: var(--muted); }
dd { margin: 0; font-size: 1.05rem; }

.badge {
  display: inline-flex; align-items: center; padding: .25rem .55rem;
  border-radius: 9999px; font-weight: 700; font-size: .9rem; border: 1px solid transparent;
}
.badge--yellow { background: #FEF3C7; color: #92400E; border-color: #FDE68A; }
.badge--green { background: #DCFCE7; color: #065F46; border-color: #86EFAC; }
.badge--red { background: #FEE2E2; color: #991B1B; border-color: #FCA5A5; }
.badge--gray { background: #F3F4F6; color: #374151; border-color: #E5E7EB; }
.badge--blue { background: #DBEAFE; color: #1E3A8A; border-color: #BFDBFE; }
.badge--brandSolid { background: var(--brand); color: #111827; border-color: rgba(0,0,0,.08); }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .25rem; }
.chip {
  display: inline-flex; align-items: flex-start; gap: .35rem;
  padding: .3rem .6rem; border: 1px solid #e5e7eb; border-radius: 9999px;
  background: #f9fafb; font-size: .95rem; flex-wrap: wrap; max-width: 100%;
  min-width: 0; white-space: normal; overflow-wrap: anywhere; word-break: break-word;
  hyphens: auto; line-height: 1.2;
}
.chip b { font-weight: 600; }

details { margin-top: 14px; border-top: 1px dashed #e5e7eb; padding-top: 12px; }
summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; color: #111827; font-weight: 600; }
summary::-webkit-details-marker { display: none; }
summary:before { content: "▸"; display: inline-block; transition: transform .2s ease; color: #111827; }
details[open] summary:before { transform: rotate(90deg); }
.hit { margin-top: 12px; padding: 12px; border: 1px solid #eef0f2; border-radius: 12px; background: #fafbfc; }

/* Media Queries */
@media (max-width: 720px) {
  .wrap { padding: 12px; }
  .card { padding: 16px; }
  .logo { width: var(--logo-w-mobile); }
  .row { flex-direction: column; }
  button.action { width: 100%; }
  .plate { font-size: 1.6rem; }
  dl { grid-template-columns: 1fr; }
  .clearBtn { width: 32px; height: 32px; right: 8px; font-size: 20px; }
  input[type="text"] { padding-right: 3rem; }
}
@media (max-width: 480px) {
  .userbar { padding: 6px 8px; gap: 8px; }
  .btn { padding: 6px 10px; border-radius: 10px; font-size: 13px; line-height: 1; white-space: nowrap; width: auto; }
  .btn__icon { width: 16px; height: 16px; }
  .btn__text, .userbar__label { display: none; }
  .userbar__left { flex-wrap: wrap; }
  #tenantDisplay { margin-left: 0; flex-basis: 100%; font-size: 0.8rem; white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
}
@media (max-width: 360px) {
  .btn { padding: 6px; }
  .btn__text { display: none; }
}
