@import url("https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@300;400;600;700&family=Source+Serif+4:wght@400;600&display=swap");

:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #1f2933;
  --muted: #6b7280;
  --accent: #1f6f5c;
  --accent-dark: #155245;
  --border: #e5e7eb;
  --shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Source Sans 3", "Helvetica Neue", sans-serif;
  background: radial-gradient(1200px 600px at 100% -10%, #e8f2ee 0%, var(--bg) 55%);
  color: var(--ink);
}

header {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  position: sticky;
  top: 0;
  z-index: 10;
}

header .header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

header .brand {
  font-size: 22px;
  font-weight: 700;
  font-family: "Source Serif 4", serif;
}

.header-logo img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

header nav a {
  margin-right: 14px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}

.burger {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  padding: 0;
  cursor: pointer;
}

.burger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  z-index: 40;
}

.drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: min(320px, 82vw);
  background: #ffffff;
  border-right: 1px solid var(--border);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  transform: translateX(-100%);
  transition: transform 0.22s ease;
  z-index: 50;
  padding: 16px;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.drawer-title {
  font-weight: 700;
  font-family: "Source Serif 4", serif;
  font-size: 18px;
}

.drawer-close {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.drawer-nav {
  display: grid;
  gap: 8px;
}

.drawer-nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f9fafb;
}

.drawer-nav a:hover {
  background: #eef2f6;
}

.no-scroll {
  overflow: hidden;
}

main {
  max-width: 1080px;
  margin: 24px auto;
  padding: 0 16px 40px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.btn {
  display: inline-block;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.btn.secondary {
  background: #6b6b6b;
}

.btn.light {
  background: #ffffff;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.flash {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.flash.error {
  background: #ffe3e3;
  border: 1px solid #f1b5b5;
}

.flash.success {
  background: #e5f6e9;
  border: 1px solid #bfe2c8;
}

form .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
}

textarea {
  min-height: 90px;
}

.muted {
  color: var(--muted);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.photo-grid img {
  width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  margin-top: 6px;
}

.list-headers,
.list-row {
  display: grid;
  grid-template-columns: 60px 1.2fr 1.2fr 1fr 120px 1fr;
  gap: 12px;
  align-items: center;
}

.list-headers {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 6px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.list {
  display: grid;
  gap: 8px;
}

.list-row {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

@media (max-width: 720px) {
  header {
    padding: 12px 16px;
  }

  .burger {
    display: inline-flex;
  }

  header .header-inner {
    flex-wrap: wrap;
  }

  header nav {
    display: none;
  }

  main {
    margin: 16px auto;
  }

  .card {
    padding: 12px;
  }

  form .row {
    grid-template-columns: 1fr;
  }

  table:not(.simple-table) thead {
    display: none;
  }

  table:not(.simple-table),
  table:not(.simple-table) tbody,
  table:not(.simple-table) tr,
  table:not(.simple-table) td {
    display: block;
    width: 100%;
  }

  table:not(.simple-table) tr {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px;
    margin-bottom: 8px;
    background: #ffffff;
  }

  table:not(.simple-table) td {
    border: none;
    padding: 4px 2px;
  }

  .grid {
    gap: 10px;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
  }

  .list-headers {
    display: none;
  }

  .list-row {
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
  }

  .list-row > div:nth-child(1)::before { content: "ID: "; color: var(--muted); }
  .list-row > div:nth-child(2)::before { content: "Kunde: "; color: var(--muted); }
  .list-row > div:nth-child(3)::before { content: "Gerät: "; color: var(--muted); }
  .list-row > div:nth-child(4)::before { content: "Status: "; color: var(--muted); }
  .list-row > div:nth-child(5)::before { content: "Datum: "; color: var(--muted); }
  .list-row > div:nth-child(6)::before { content: "Zuständig: "; color: var(--muted); }
}

.simple-table {
  display: table;
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

@media (max-width: 720px) {
  .simple-table thead {
    display: table-header-group !important;
  }

  .simple-table,
  .simple-table tbody {
    display: table !important;
    width: 100%;
  }

  .simple-table tr {
    display: table-row !important;
  }

  .simple-table th,
  .simple-table td {
    display: table-cell !important;
    width: 33.33%;
    border-bottom: 1px solid var(--border);
    padding: 8px 6px;
  }

  .simple-table-wrapper {
    overflow-x: auto;
  }

  .simple-table {
    min-width: 0;
  }
}
