:root {
  --bg: #0f172a;
  --card: #1e293b;
  --accent: #38bdf8;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --error: #f87171;
  --pump-on: #4ade80;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 2rem 1rem 4rem;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

header,
main {
  max-width: 60rem;
  margin: 0 auto;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

header h1 {
  margin: 0;
  color: var(--accent);
}

.session {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.link-button {
  background: none;
  border: 1px solid #334155;
  color: var(--text);
  padding: 0.4rem 0.8rem;
  border-radius: 0.4rem;
  font-size: 0.85rem;
  min-height: 2.5rem;
  cursor: pointer;
  touch-action: manipulation;
}

.card-login {
  max-width: 22rem;
}

.subtitle {
  margin: 0.25rem 0 2rem;
  color: var(--muted);
}

.card {
  background: var(--card);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card h2 {
  margin-top: 0;
  font-size: 1.15rem;
}

form {
  display: grid;
  gap: 0.35rem;
}

label {
  font-size: 0.85rem;
  color: var(--muted);
}

input {
  padding: 0.65rem 0.7rem;
  border: 1px solid #334155;
  border-radius: 0.4rem;
  background: #0f172a;
  color: var(--text);
  font-size: 16px;
  min-height: 2.75rem;
}

input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button {
  margin-top: 0.75rem;
  justify-self: start;
  padding: 0.55rem 1.1rem;
  min-height: 2.75rem;
  border: 0;
  border-radius: 0.4rem;
  background: var(--accent);
  color: #0f172a;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  touch-action: manipulation;
}

button:hover {
  filter: brightness(1.1);
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid #334155;
}

th {
  color: var(--muted);
  font-weight: 600;
}

code {
  color: var(--accent);
}

.badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: #334155;
  font-size: 0.8rem;
  color: var(--muted);
}

.pump-toggle {
  margin: 0;
  min-width: 6.5rem;
  min-height: 2.5rem;
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
}

.pump-toggle.off {
  background: #334155;
  color: var(--muted);
}

.pump-toggle.on {
  background: var(--pump-on);
  color: #0f172a;
}

.status {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #334155;
  color: var(--muted);
}

.status-requested {
  background: #78350f;
  color: #fcd34d;
}

.status-acknowledged {
  background: #164e63;
  color: #67e8f9;
}

.status-running {
  background: #14532d;
  color: var(--pump-on);
}

.status-done {
  background: #1e3a5f;
  color: #93c5fd;
}

.status-failed,
.status-expired {
  background: #7f1d1d;
  color: #fca5a5;
}

.hint {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.75rem;
  color: var(--muted);
}

/* Mobil: Tabellenzeilen werden zu einzelnen Karten */
@media (max-width: 40rem) {
  body {
    padding: 1.25rem 0.75rem 3rem;
  }

  header h1 {
    font-size: 1.4rem;
  }

  .subtitle {
    margin-bottom: 1.25rem;
  }

  .card {
    padding: 1rem;
  }

  form button {
    justify-self: stretch;
    width: 100%;
  }

  .table-wrap {
    overflow-x: visible;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  tr {
    border: 1px solid #334155;
    border-radius: 0.6rem;
    padding: 0.75rem 0.9rem;
    margin-bottom: 0.75rem;
  }

  td {
    border-bottom: 0;
    padding: 0.3rem 0;
  }

  td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .cell-action {
    padding-top: 0.75rem;
  }

  .cell-action::before {
    content: none;
  }

  .pump-toggle {
    width: 100%;
    min-height: 2.75rem;
    font-size: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

.error {
  color: var(--error);
  margin: 0 0 1rem;
}

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