:root {
  --r: #ed1b24;
  --k: #1d1d1b;
  --g: #198754;
  --bg: #f4f5f7;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font: 15px Arial;
  background: var(--bg);
  color: var(--k);
}
button,
input,
select {
  font: inherit;
}
.hide {
  display: none !important;
}
.login {
  position: fixed;
  inset: 0;
  background: #180002;
  display: grid;
  place-items: center;
  z-index: 20;
}
.login form {
  background: #fff;
  border-top: 8px solid var(--r);
  border-radius: 14px;
  padding: 25px;
  width: min(430px, 92%);
}
.logo {
  width: 240px;
  max-width: 100%;
  height: auto;
}
.login input {
  width: 100%;
  padding: 11px;
  margin: 5px 0 12px;
}
.btn {
  padding: 9px 13px;
  border: 1px solid #bbb;
  border-radius: 7px;
  background: #fff;
  font-weight: bold;
  cursor: pointer;
}
.primary {
  background: var(--r);
  color: white;
  border-color: var(--r);
}
/* Header und Tabs bleiben beim Scrollen oben stehen. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 4px 12px rgb(0 0 0 / 15%);
}
header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  background: #fff;
  border-bottom: 6px solid var(--r);
  padding: 8px 16px;
}
header .logo {
  width: 230px;
}
.app-title {
  font-size: 28px;
  letter-spacing: 0.03em;
}
.right {
  margin-left: auto;
}
.nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--k);
  padding: 9px;
}
.nav button {
  color: #fff;
  background: #373737;
  border: 0;
  padding: 10px 14px;
  border-radius: 7px;
  font-weight: bold;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}
.nav .on {
  background: var(--r);
}
.burger,
.nav-head,
.nav-footer,
.nav-backdrop {
  display: none;
}

/* Kleine Auflösung: Tabs werden zum Burger-Menü, das von links hereinfährt. */
@media (max-width: 850px) {
  .burger {
    display: grid;
    align-content: center;
    gap: 5px;
    flex: none;
    width: 44px;
    height: 44px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
  }
  .burger span {
    display: block;
    height: 3px;
    border-radius: 2px;
    background: var(--k);
    transition:
      transform 0.25s,
      opacity 0.2s;
  }
  /* Abmelden befindet sich im Burger-Menü; bei geöffnetem Menü verschwindet der Header. */
  #logout {
    display: none;
  }
  header {
    transition:
      opacity 0.2s,
      visibility 0.2s;
  }
  .nav-open header {
    opacity: 0;
    visibility: hidden;
  }
  .nav {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(280px, 82vw);
    flex-direction: column;
    gap: 6px;
    padding: 16px 12px;
    overflow-y: auto;
    z-index: 2;
    transform: translateX(-100%);
    visibility: hidden;
    transition:
      transform 0.25s ease,
      visibility 0.25s;
    box-shadow: 6px 0 24px rgb(0 0 0 / 35%);
  }
  .nav-open .nav {
    transform: none;
    visibility: visible;
  }
  .nav-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #aaa;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 4px 6px 10px;
    border-bottom: 1px solid #333;
    margin-bottom: 6px;
  }
  .nav button {
    text-align: left;
    padding: 13px 16px;
    background: transparent;
  }
  .nav button:hover {
    background: #333;
  }
  .nav .nav-close {
    width: 40px;
    height: 40px;
    min-height: 0;
    padding: 0;
    text-align: center;
    color: #ddd;
    font-size: 18px;
    border-radius: 50%;
  }
  .nav-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #333;
  }
  .nav-footer span {
    color: #aaa;
    font-size: 13px;
    padding: 0 6px;
    overflow-wrap: anywhere;
  }
  .nav .nav-logout {
    text-align: center;
    background: #fff;
    color: var(--k);
  }
  .nav .nav-logout:hover {
    background: #e9e9e9;
  }
  .nav .on,
  .nav .on:hover {
    background: var(--r);
  }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1;
    background: rgb(0 0 0 / 45%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
  }
  .nav-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  body.nav-open {
    overflow: hidden;
  }
}
main {
  max-width: 1400px;
  margin: auto;
  padding: 18px;
}
.page {
  display: none;
  min-width: 0;
}
.page.on {
  display: block;
}
h1 {
  margin: 0 0 4px;
  text-transform: uppercase;
}
.sub {
  color: #667085;
  margin: 0 0 16px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.progress {
  height: 12px;
  background: #e7e7e7;
  border-radius: 99px;
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #ed1b24, #ff646b);
}
.statusline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.statpill {
  padding: 7px 10px;
  border-radius: 99px;
  background: #f0f1f3;
  font-weight: bold;
}
.statpill.ok {
  background: #dff5e9;
  color: #09683a;
}
.statpill.warn {
  background: #fff1c9;
  color: #805300;
}
.card,
.panel,
.day,
.job {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 11px;
  padding: 16px;
  margin-bottom: 12px;
}
.card {
  border-top: 5px solid var(--r);
  box-shadow: 0 8px 25px #17233414;
}
.card:nth-child(2) {
  border-top-color: #198754;
}
.card:nth-child(3) {
  border-top-color: #e0a000;
}
.card:nth-child(4) {
  border-top-color: #30343b;
}
.card b {
  font-size: 29px;
  display: block;
}
.dash {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 13px;
  margin-top: 13px;
}
.missing {
  padding: 9px;
  border-left: 5px solid var(--r);
  background: #fff0f0;
  margin: 6px 0;
}
.dayhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #222;
  color: white;
  padding: 10px;
  border-radius: 8px;
}
.slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin-top: 9px;
}
.slot {
  padding: 11px;
  border: 2px solid #ddd;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
}
.slot:has(input:checked) {
  border-color: var(--g);
  background: #e9f8f0;
}
.job {
  display: grid;
  grid-template-columns: 190px 1fr 280px;
  gap: 12px;
  border-left: 7px solid var(--r);
}
.chip {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 99px;
  background: #dff5e9;
  color: #09683a;
  margin: 2px;
  font-size: 12px;
}
.job-select {
  min-width: 0;
}
.job select {
  width: 100%;
  padding: 8px;
  margin: 3px;
  border: 1px solid #aaa;
  border-radius: 6px;
}
.form {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  align-items: stretch;
  gap: 8px;
}
.form input,
.form select {
  padding: 9px;
}
.users > div {
  display: grid;
  align-items: center;
  grid-template-columns: 1.5fr 1fr 1.5fr auto;
  gap: 8px;
  padding: 9px;
  border-bottom: 1px solid #ddd;
}
.modal {
  position: fixed;
  inset: 0;
  background: rgb(15 15 20 / 55%);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 30;
  animation: modal-fade 0.18s ease-out;
}
.modal-box {
  --accent: var(--g);
  width: min(420px, 100%);
  background: #fff;
  text-align: center;
  padding: 32px 28px 24px;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgb(0 0 0 / 30%);
  animation: modal-pop 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.modal[data-variant="error"] .modal-box {
  --accent: var(--r);
}
.modal[data-variant="warning"] .modal-box {
  --accent: #f0a500;
}
.modal[data-variant="info"] .modal-box {
  --accent: #0d6efd;
}
.modal-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 34px;
  font-weight: bold;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, #fff);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 6%, #fff);
}
.modal-box h2 {
  margin: 0 0 8px;
  font-size: 20px;
}
.modal-box p {
  margin: 0 0 22px;
  color: #555;
  line-height: 1.45;
  white-space: pre-line;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.modal-actions .btn {
  flex: 1;
  max-width: 180px;
  padding: 11px 16px;
  border-radius: 10px;
}
.modal-actions .primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.modal-actions .btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent);
  outline-offset: 2px;
}
@keyframes modal-fade {
  from {
    opacity: 0;
  }
}
@keyframes modal-pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
}
@media (max-width: 600px) {
  .modal {
    place-items: end center;
  }
  .modal-box {
    border-radius: 18px 18px 12px 12px;
  }
  .modal-actions .btn {
    max-width: none;
  }
}
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 40;
  pointer-events: none;
}
.toast {
  --accent: var(--g);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 30px rgb(0 0 0 / 25%);
  cursor: pointer;
  pointer-events: auto;
  animation: toast-in 0.25s ease-out;
}
.toast-error {
  --accent: var(--r);
}
.toast-out {
  animation: toast-out 0.25s ease-in forwards;
}
.toast-icon {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgb(255 255 255 / 22%);
  font-weight: bold;
}
.toast b,
.toast span:not(.toast-icon) {
  display: block;
}
.toast span:not(.toast-icon) {
  font-size: 13px;
  opacity: 0.9;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}
@media (max-width: 600px) {
  .toasts {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
  .toast {
    min-width: 0;
    max-width: none;
  }
}
@media print {
  .toasts,
  .modal {
    display: none !important;
  }
}
.pdf {
  display: none;
}

.pdfbrand {
  text-align: center;
  border-bottom: 4px solid var(--r);
  margin-bottom: 8px;
  padding-bottom: 6px;
}
.pdfbrand img {
  width: 230px;
  max-height: 78px;
  object-fit: contain;
  margin: auto;
}
.pdfbrand div {
  text-align: center;
}
.pdf-period {
  font-weight: 800;
  margin: 3px 0;
}
.pdf-title {
  font-size: 19px !important;
  letter-spacing: 0.03em;
  margin: 4px 0 2px;
}
.pdf-range {
  font-size: 12px;
  font-weight: bold;
  margin: 2px 0 5px;
}
.pdf-rowtitle {
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  text-align: left;
  margin: 0 0 4px;
  color: #444;
}
.pdf-sub {
  color: #555;
}
.pdftable td:not(.row) {
  font-weight: 600;
}
.pdftable tr:nth-child(3) td {
  background: #fafafa;
}
.pdfblock {
  margin-bottom: 10px;
}
.pdfblock:last-child {
  margin-bottom: 0;
}
.pdftable {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
  font-size: 9px;
}
.pdftable th,
.pdftable td {
  border: 1px solid #111;
  padding: 5px 3px;
  text-align: center;
  height: 34px;
}
.pdftable td {
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  line-height: 1.15;
  vertical-align: middle;
}
.pdftable td:not(.row) {
  height: 38px;
}
.pdf-name {
  display: inline-block;
  white-space: normal;
  line-height: 1.12;
}
.pdftable .row {
  font-weight: 900 !important;
}
.pdfbrand:after {
  content: none !important;
}
.pdftable th {
  background: #222;
  color: #fff;
}
.pdftable .row {
  background: #eee;
  color: #111;
  text-align: left;
  font-weight: bold;
  width: 100px;
}
.foot {
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  margin-top: 6px;
}
@media print {
  @page {
    size: A4 landscape;
    margin: 7mm;
  }
  body > *:not(.pdf) {
    display: none !important;
  }
  .pdf {
    display: block !important;
  }
  .pdftable {
    font-size: 8.5px;
  }
  .pdfbrand img {
    width: 190px;
  }
}
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.report-grid label,
.report-full label {
  display: block;
  font-weight: bold;
}
.report-grid input,
.report-grid select,
.report-full textarea {
  width: 100%;
  padding: 9px;
  border: 1px solid #aaa;
  border-radius: 7px;
  margin-top: 4px;
}
.report-full {
  margin-top: 12px;
}
.checklist {
  display: grid;
  gap: 7px;
}
.checklist-head {
  display: grid;
  grid-template-columns: 52px 1fr;
  font-weight: 900;
  padding: 0 9px 6px;
}
.optional {
  font-weight: normal;
  color: #667085;
}
.open-slot {
  color: #b01820;
}
.options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}
.report-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
}
.checkitem {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 9px;
  background: #fafafa;
}
.checkitem input {
  width: 22px;
  height: 22px;
}
.report-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
}
.report-list {
  display: grid;
  gap: 9px;
}
.report-card {
  border: 1px solid #ddd;
  border-left: 6px solid var(--r);
  border-radius: 9px;
  padding: 12px;
  background: #fff;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.stat-card {
  background: linear-gradient(145deg, #fff, #f1f3f5);
  border: 1px solid #ddd;
  border-top: 5px solid var(--r);
  border-radius: 11px;
  padding: 16px;
}
.stat-card b {
  display: block;
  font-size: 28px;
}
.bars {
  display: grid;
  gap: 10px;
}
.barrow {
  display: grid;
  grid-template-columns: 170px 1fr 45px;
  gap: 10px;
  align-items: center;
}
.barrow span {
  overflow-wrap: anywhere;
}
.bartrack {
  height: 15px;
  background: #e7e7e7;
  border-radius: 99px;
  overflow: hidden;
}
.bartrack i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #ed1b24, #ff6a70);
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .job {
    grid-template-columns: 150px 1fr;
  }
  .job-select {
    grid-column: 1 / -1;
  }
  .form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 850px) {
  .dash,
  .users > div {
    grid-template-columns: 1fr;
  }
  header {
    gap: 10px 14px;
    padding: 8px 12px;
  }
  header .logo {
    width: 170px;
  }
  .app-title {
    font-size: 22px;
  }
  main {
    padding: 12px;
  }
  .checkitem {
    grid-template-columns: 38px 1fr;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 16px;
  }
  h1 {
    font-size: 1.4rem;
  }
  header {
    flex-wrap: nowrap;
    gap: 10px;
    padding: 6px 10px;
    border-bottom-width: 4px;
  }
  header .logo {
    width: 110px;
  }
  .right {
    min-width: 0;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #logout {
    flex: none;
  }
  .app-title {
    display: none;
  }
  .btn,
  .nav button {
    min-height: 44px;
  }
  input,
  select,
  textarea {
    font-size: 16px;
  }
  .job,
  .form,
  .report-card {
    grid-template-columns: 1fr;
  }
  .report-actions {
    flex-direction: column;
  }
  .report-actions .btn {
    width: 100%;
  }
  .barrow {
    grid-template-columns: 100px 1fr 32px;
    gap: 6px;
  }
  .panel,
  .card,
  .day,
  .job {
    padding: 12px;
  }
  .login form {
    padding: 18px;
  }
}
