:root {
  --bg: #121212;
  --surface: #1c1a17;
  --surface-variant: #2c2620;
  --primary: #ff7a1a;
  --on-primary: #1a1a1a;
  --text: #ede0d4;
  --text-muted: #a89a8c;
  --error: #ff6b6b;
  --border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

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

.hidden {
  display: none !important;
}

/* --- Auth-Screens --- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface-variant);
  border-radius: 16px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.logo {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

.auth-subtitle {
  margin: 0 0 6px 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.auth-hint {
  margin: 0 0 6px 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.error-text {
  color: var(--error);
  font-size: 0.85rem;
  min-height: 1.1em;
}

input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.95rem;
  outline: none;
}
input:focus {
  border-color: var(--primary);
}

.primary-btn {
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  padding: 13px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  margin-top: 6px;
}
.primary-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 6px;
}
.link-btn.danger {
  color: var(--error);
}

/* --- Hauptlayout --- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.tabs {
  display: flex;
  gap: 4px;
  flex: 1;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
}
.tab-btn.active {
  background: var(--surface-variant);
  color: var(--text);
  font-weight: 600;
}

.settings-link {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.layout {
  display: flex;
  height: calc(100vh - 57px);
}

.sidebar {
  width: 340px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stats-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-tile {
  background: var(--surface-variant);
  border-radius: 12px;
  padding: 12px;
}
.stat-tile .value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}
.stat-tile .label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sidebar-header {
  font-weight: 600;
  font-size: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.trip-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trip-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-variant);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  border: 1px solid transparent;
}
.trip-row:hover {
  border-color: var(--primary);
}

.trip-row-text {
  flex: 1;
  min-width: 0;
}
.trip-row-text .name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trip-row-text .meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.trip-row canvas {
  border-radius: 8px;
  background: var(--surface);
  flex-shrink: 0;
}

.empty-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.map-area {
  flex: 1;
  position: relative;
}

#map, #trip-detail-map {
  width: 100%;
  height: 100%;
  background: var(--surface);
  filter: contrast(1.25) brightness(1.05);
}

.car-selector {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1000;
}
.car-selector select {
  background: var(--surface-variant);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 0.9rem;
  cursor: pointer;
}

/* --- Overlay-Screens (Detail, Settings) --- */
.overlay-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 2000;
  display: flex;
  flex-direction: column;
}

.back-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.95rem;
  text-align: left;
  padding: 16px 20px;
  cursor: pointer;
}

.detail-info {
  padding: 0 20px 16px 20px;
}
.detail-info h2 {
  margin: 0 0 4px 0;
}
.detail-info .date {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 14px;
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

#trip-detail-map {
  flex: 1;
}

.settings-card {
  margin: 40px auto;
}
