:root {
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --ink: #17222b;
  --ink-soft: #5b6b76;
  --brand: #0f2027;
  --accent: #ff9800;
  --accent-ink: #7a4400;
  --border: #dfe3e7;
  --arb: #2e7d32;
  --rues: #ef6c00;
  --fah: #1565c0;
  --pau: #6a1b9a;
  --danger: #c62828;
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(135deg, #0f2027, #203a43);
  color: #fff;
  padding: calc(14px + var(--safe-top)) 18px 14px;
}
.topbar-title { font-size: 20px; font-weight: 700; letter-spacing: 0.2px; }
.topbar-sub { font-size: 13px; opacity: 0.8; margin-top: 2px; }

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 14px calc(90px + var(--safe-bottom));
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(15, 32, 39, 0.08);
  margin-bottom: 14px;
}

.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.big-select, input[type="date"], input[type="text"], input[type="number"], input[type="time"], select {
  width: 100%;
  padding: 14px 12px;
  font-size: 17px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
}
select.big-select { background-image: linear-gradient(45deg, transparent 50%, #66727b 50%), linear-gradient(135deg, #66727b 50%, transparent 50%); background-position: calc(100% - 20px) 22px, calc(100% - 14px) 22px; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; }

.job-info { margin-top: 4px; border-top: 1px dashed var(--border); padding-top: 12px; }
.job-info-row { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 14.5px; }
.job-info-row .k { color: var(--ink-soft); }
.job-info-row .v { font-weight: 600; text-align: right; }
.status-pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
}
.status-offen { background: #eceff1; color: #455a64; }
.status-in_bearbeitung { background: #fff3e0; color: #ef6c00; }
.status-abgeschlossen { background: #e8f5e9; color: #2e7d32; }

.tabs {
  position: sticky;
  top: calc(64px + var(--safe-top));
  z-index: 15;
  display: flex;
  gap: 6px;
  background: var(--bg);
  padding: 6px 0 10px;
}
.tab {
  flex: 1;
  padding: 12px 4px;
  border: none;
  border-radius: 10px;
  background: #fff;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 14.5px;
  border: 1.5px solid var(--border);
}
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.panel-head h2 { font-size: 18px; margin: 0; }

.btn-add {
  border: none;
  background: var(--accent);
  color: #2b1a00;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14.5px;
}
.btn-add:active { opacity: 0.8; }

.entry-list { display: flex; flex-direction: column; gap: 12px; }

.entry-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 1px 3px rgba(15, 32, 39, 0.08);
  border-left: 5px solid var(--border);
  position: relative;
}
.entry-card.type-ARB { border-left-color: var(--arb); }
.entry-card.type-RUES { border-left-color: var(--rues); }
.entry-card.type-FAH { border-left-color: var(--fah); }
.entry-card.type-PAU { border-left-color: var(--pau); }

.entry-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.entry-grid .full { grid-column: 1 / -1; }

.entry-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.entry-badge {
  font-size: 12px; font-weight: 800; letter-spacing: 0.03em;
  padding: 4px 9px; border-radius: 7px; color: #fff;
}
.type-ARB .entry-badge { background: var(--arb); }
.type-RUES .entry-badge { background: var(--rues); }
.type-FAH .entry-badge { background: var(--fah); }
.type-PAU .entry-badge { background: var(--pau); }

.duration-display { font-weight: 700; font-size: 15px; color: var(--ink); }

.btn-remove {
  border: none; background: transparent; color: var(--danger); font-size: 22px; line-height: 1; padding: 4px 8px;
}

.hint { color: var(--ink-soft); font-size: 13px; margin-top: 4px; }

.summary-box { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.summary-section {
  background: var(--card-bg); border-radius: var(--radius); padding: 14px;
  box-shadow: 0 1px 3px rgba(15, 32, 39, 0.08);
}
.summary-section h3 { margin: 0 0 8px; font-size: 15px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.summary-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 15px; border-bottom: 1px solid #f0f1f3; }
.summary-row:last-child { border-bottom: none; }
.summary-total { font-weight: 800; font-size: 17px; margin-top: 6px; }

.submit-row { display: flex; gap: 10px; flex-direction: column; }
.btn-primary, .btn-secondary {
  padding: 16px; border-radius: 12px; font-size: 17px; font-weight: 800; border: none; width: 100%;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-secondary { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); }
.btn-primary:active, .btn-secondary:active { opacity: 0.85; }

.status-line { text-align: center; color: var(--ink-soft); font-size: 13.5px; margin-top: 10px; min-height: 18px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translate(-50%, 20px);
  background: #17222b;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 50;
  max-width: 90%;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--arb); }

@media (min-width: 760px) {
  .app { padding-top: 20px; }
  .entry-grid { grid-template-columns: 1fr 1fr 1fr; }
}
