:root {
  --bg: #f5f3ee;
  --card: #fffdfa;
  --text: #202020;
  --muted: #6c6a64;
  --line: #e5dfd2;
  --primary: #2f5f46;
  --primary-dark: #234835;
  --danger: #b42318;
  --warning: #9a6700;
  --ok: #246b45;
  --shadow: 0 10px 30px rgba(0,0,0,.07);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255,253,250,.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: .8rem 1rem;
  display: flex;
  gap: .75rem;
  align-items: center;
  justify-content: space-between;
  overflow-x: auto;
}

.brand {
  font-weight: 800;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}

nav { display: flex; gap: .35rem; }
nav a, .button, button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .65rem .9rem;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  cursor: pointer;
  font-size: .95rem;
}

.container {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 1rem;
  padding-bottom: 4rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.narrow { max-width: 440px; margin: 2rem auto; }
.hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

h1, h2, h3 { line-height: 1.12; margin: 0 0 .45rem; }
h1 { font-size: clamp(2rem, 8vw, 3.8rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }
p { margin: .35rem 0; }
.eyebrow, .muted, .date { color: var(--muted); }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 750; }

.actions, .item-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.primary, .button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.primary:hover { background: var(--primary-dark); }
.danger-button {
  color: var(--danger);
  border-color: #f0c6c1;
}

.section-head {
  margin: 1.4rem 0 .75rem;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}
.section-head a { color: var(--primary); font-weight: 700; }

.cards, .timeline {
  display: grid;
  gap: .85rem;
}
.cards { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.row-between { display: flex; align-items: start; justify-content: space-between; gap: .75rem; }
.km { font-weight: 800; white-space: nowrap; }
.meta { color: var(--muted); display: flex; gap: .5rem; flex-wrap: wrap; font-size: .93rem; }
.meta.vertical { flex-direction: column; gap: .15rem; }

.pill {
  display: inline-flex;
  border-radius: 999px;
  padding: .25rem .55rem;
  font-size: .78rem;
  font-weight: 800;
  white-space: nowrap;
}
.pill.danger { background: #fee4e2; color: var(--danger); }
.pill.warning { background: #fef0c7; color: var(--warning); }
.pill.ok { background: #dcfae6; color: var(--ok); }
.status-danger { border-left: .45rem solid var(--danger); }
.status-warning { border-left: .45rem solid var(--warning); }
.status-ok { border-left: .45rem solid var(--ok); }
.inactive { opacity: .58; }

.form { display: grid; gap: .9rem; }
label { display: grid; gap: .32rem; font-weight: 700; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: .9rem;
  padding: .9rem;
  background: white;
  font: inherit;
  min-height: 44px;
}
textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.checkline { display: flex; grid-template-columns: auto 1fr; flex-direction: row; align-items: center; }
.checkline input { width: auto; }
.done-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: .5rem; margin: .85rem 0; }
.messages { display: grid; gap: .5rem; margin-bottom: 1rem; }
.message { padding: .8rem 1rem; border-radius: .9rem; background: white; border: 1px solid var(--line); }
.message.error { border-color: #f0c6c1; color: var(--danger); }
.message.success { border-color: #bbebcd; color: var(--ok); }

@media (max-width: 650px) {
  .topbar { align-items: start; flex-direction: column; }
  nav { width: 100%; overflow-x: auto; padding-bottom: .15rem; }
  .hero, .section-head { align-items: stretch; flex-direction: column; }
  .actions, .actions .button { width: 100%; }
  .actions .button, .primary, button { min-height: 48px; text-align: center; }
  .grid2, .done-form { grid-template-columns: 1fr; }
  .row-between { flex-direction: column; }
  .container { padding: .75rem; }
}

.odometer-box {
  width: min(100%, 560px);
}

.odometer-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: .5rem;
  margin-top: .85rem;
}

.odometer-form input {
  font-size: 1.05rem;
}

.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;
}

@media (max-width: 650px) {
  .odometer-form {
    grid-template-columns: 1fr;
  }
}

/* XT600 Logo */
.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
}

.brand-logo {
  height: 2.35rem;
  width: auto;
  display: block;
  border-radius: .35rem;
}

@media (max-width: 650px) {
  .brand-logo {
    height: 2.1rem;
  }
}


/* Erweiterungen: Logo, Dokumente, Tanklog, Service-Fotos */
.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
}
.brand-logo {
  height: 38px;
  width: auto;
  display: block;
  border-radius: .35rem;
}
pre {
  white-space: pre-wrap;
  background: #f7f3ea;
  border: 1px solid var(--line);
  border-radius: .8rem;
  padding: .8rem;
  overflow-x: auto;
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.document-card .item-actions { margin-top: .85rem; }
.stats-card {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}
.photo-section { margin-top: 1rem; }
.photo-grid, .photo-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .6rem;
  margin: .8rem 0;
}
.photo-strip {
  grid-template-columns: repeat(3, 84px);
}
.photo-grid img, .photo-strip img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: .85rem;
  border: 1px solid var(--line);
  display: block;
}
.photo-edit-card {
  display: grid;
  gap: .45rem;
}
.photo-edit-card button { width: 100%; }
@media (max-width: 650px) {
  .brand-logo { height: 32px; }
  .stats-card { grid-template-columns: 1fr; }
  .photo-strip { grid-template-columns: repeat(3, 1fr); }
}

/* Dropdown-Menü mit eigenen kleinen SVG-Icons */
.main-menu {
  position: relative;
  margin-left: auto;
}

.menu-dropdown {
  position: relative;
}

.menu-dropdown summary {
  list-style: none;
}

.menu-dropdown summary::-webkit-details-marker {
  display: none;
}

.menu-button {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 44px;
  padding: .55rem .85rem;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: rgba(255, 255, 255, .72);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 6px 16px rgba(0,0,0,.08);
}

.menu-button-icon,
.menu-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.menu-button svg,
.menu-icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + .55rem);
  z-index: 1000;
  min-width: 235px;
  padding: .45rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--card);
  box-shadow: 0 18px 45px rgba(0,0,0,.18);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 46px;
  padding: .65rem .75rem;
  border-radius: .75rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  white-space: nowrap;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: rgba(0,0,0,.06);
  outline: none;
}

.menu-item-muted {
  color: var(--muted);
  border-top: 1px solid var(--line);
  margin-top: .35rem;
  padding-top: .85rem;
}

.menu-icon {
  width: 28px;
  height: 28px;
  border-radius: .65rem;
  background: rgba(0,0,0,.055);
}

@media (max-width: 640px) {
  .topbar {
    gap: .75rem;
  }

  .brand span {
    font-size: 1rem;
  }

  .brand-logo {
    max-height: 34px;
  }

  .menu-button {
    padding: .5rem .7rem;
  }

  .menu-panel {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 4.75rem);
    left: .75rem;
    right: .75rem;
    min-width: unset;
  }

  .menu-item {
    min-height: 50px;
    font-size: 1.04rem;
  }
}

/* =========================================================
   XT600 dropdown z-index fix
   Sorgt dafür, dass das Dropdown-Menü über den Karten/Inhalten
   liegt und nicht durch Header-/Nav-Container abgeschnitten wird.
   ========================================================= */
.site-header,
.header-bar,
.navbar,
.topbar,
.menu-wrapper,
.dropdown,
.dropdown-menu,
nav {
  overflow: visible !important;
}

.site-header,
.header-bar,
.navbar,
.topbar {
  position: relative;
  z-index: 1000;
}

.menu-wrapper,
.dropdown {
  position: relative;
  z-index: 1100;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 9999;
  min-width: 230px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 0.9rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

main,
.container,
.content,
.card,
.panel {
  position: relative;
  z-index: 1;
}
