/* GülleLogger – Dashboard-Look, gebaut für Sonnenlicht, Handschuhe und
   schnelle Blicke auf den Traktor-Sitz. Dunkler Hintergrund (Displays sind
   in der Sonne besser lesbar als hell auf hell), Sicherheitsfarben für
   die Aktionen, große Zahlen statt kleiner Icons. */

:root {
  --bg: #0f1f16;
  --surface: #17291d;
  --surface-raised: #1f3327;
  --border: #2b4433;
  --text: #eef3ea;
  --muted: #9db3a1;

  --beladung: #43a047;
  --beladung-dark: #2e7031;
  --pause: #f2b705;
  --pause-dark: #b98a00;
  --diesel: #2e86c1;
  --diesel-dark: #1f5f8f;
  --beenden: #d9463c;
  --beenden-dark: #a5332b;
  --accent: #ff8a00;

  --radius: 16px;
  --font-display: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

body {
  padding-bottom: env(safe-area-inset-bottom);
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 32px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Kopfzeile / Status-Leiste ---------- */
.statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 4px 10px;
}

.statusbar .brand {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.statusbar .brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--beladung);
  box-shadow: 0 0 8px var(--beladung);
}

.statusbar button.icon-btn {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
}

/* ---------- Dashboard-Karte (Betrieb / Behälter / Beladungen) ---------- */
.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  row-gap: 16px;
  margin-bottom: 18px;
}

.dash-field .label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.dash-field .value {
  font-size: 18px;
  font-weight: 700;
}

.dash-field.counter {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}

.counter-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 4px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.times-row {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--muted);
}

.times-row span {
  background: var(--surface-raised);
  border-radius: 8px;
  padding: 4px 8px;
}

/* ---------- Große Aktions-Buttons ---------- */
.actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.big-btn {
  border: none;
  border-radius: var(--radius);
  padding: 26px 20px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #0b1710;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 92px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.05s ease;
}

.big-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.big-btn .emoji { font-size: 28px; }

.btn-beladung { background: var(--beladung); border-bottom: 4px solid var(--beladung-dark); }
.btn-pause    { background: var(--pause);    border-bottom: 4px solid var(--pause-dark); color: #201800; }
.btn-diesel   { background: var(--diesel);   border-bottom: 4px solid var(--diesel-dark); color: #eef3ea; }
.btn-beenden  { background: var(--beenden);  border-bottom: 4px solid var(--beenden-dark); color: #eef3ea; }

.big-btn:disabled {
  opacity: 0.4;
}

.btn-pause.active {
  outline: 3px solid #fff3c4;
}

/* ---------- Auswahl-Screens (Betrieb / Behälter wählen, Login) ---------- */
.center-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 24px 0;
}

.center-screen h1 {
  font-size: 26px;
  margin: 0 0 4px;
  text-align: center;
}

.center-screen p.sub {
  color: var(--muted);
  text-align: center;
  margin: 0 0 12px;
}

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

.field label {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

select, input {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 16px 14px;
  font-size: 17px;
  font-family: inherit;
}

select:focus, input:focus, button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}

.primary-btn {
  background: var(--accent);
  color: #201200;
  border: none;
  border-radius: 12px;
  padding: 18px;
  font-size: 18px;
  font-weight: 800;
  margin-top: 6px;
}

.primary-btn:disabled { opacity: 0.5; }

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  text-decoration: underline;
  padding: 8px;
}

.error-msg {
  background: rgba(217, 70, 60, 0.15);
  border: 1px solid var(--beenden);
  color: #ffd8d4;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
}

/* ---------- Tagesübersicht ---------- */
.tour-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

.tour-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

.tour-item .top-row {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
}

.tour-item .meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge.laufend { background: var(--beladung-dark); }
.badge.pausiert { background: var(--pause-dark); color: #201800; }
.badge.beendet { background: var(--surface-raised); color: var(--muted); }

nav.tabbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

nav.tabbar button {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 10px;
  padding: 10px;
  font-weight: 700;
}

nav.tabbar button.active {
  background: var(--surface-raised);
  color: var(--text);
  border-color: var(--accent);
}

/* ---------- Admin-Tabellen (Desktop-Verwaltung) ---------- */
.admin-wrap { max-width: 900px; margin: 0 auto; padding: 24px; }

table.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}

table.admin-table th, table.admin-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

table.admin-table th {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.inline-form { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.inline-form input, .inline-form select { flex: 1; min-width: 160px; }
.inline-form button { white-space: nowrap; }

.pill-btn {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
}

.section-title {
  font-size: 20px;
  font-weight: 800;
  margin: 28px 0 10px;
}

.hidden { display: none !important; }

.app-footer {
  text-align: center;
  padding: 14px 0 6px;
}

.app-footer a {
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
}

/* ---------- Modal (z. B. Diesel-Liter-Eingabe) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 480px;
}

.modal-box h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

.modal-box input {
  width: 100%;
  font-size: 24px;
  text-align: center;
  margin-top: 12px;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  gap: 12px;
}

.modal-actions .primary-btn {
  flex: 1;
  margin-top: 0;
}
