body.admin {
  background: var(--bg);
}

.app {
  display: grid;
  grid-template-columns: 236px 1fr;
  min-height: 100vh;
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
  }
  .nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }
  .nav__item {
    white-space: nowrap;
  }
}

.sidebar {
  background: var(--brand-ink);
  color: #dbe7f1;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.sidebar__brand img {
  height: 30px;
  filter: brightness(0) invert(1);
}

.sidebar__brand strong {
  font-size: 0.98rem;
  color: #fff;
  line-height: 1.2;
}

.sidebar__brand span {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: #9fb9cf;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
}

.nav__item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  border-radius: 9px;
  font-size: 0.92rem;
  font-weight: 500;
  color: #c6d9e8;
  text-align: left;
  transition: background 0.14s ease, color 0.14s ease;
}

.nav__item:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.nav__item--active {
  background: #fff;
  color: var(--brand-ink);
  font-weight: 650;
}

.sidebar__user {
  font-size: 0.78rem;
  color: #9fb9cf;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 1rem;
}

.sidebar__user strong {
  display: block;
  color: #fff;
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
}

.sidebar__user button {
  color: #c6d9e8;
  text-decoration: underline;
  font-size: 0.78rem;
  margin-top: 0.4rem;
}

.content {
  padding: 1.75rem 2rem 3rem;
  overflow-x: hidden;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.page-head h1 {
  font-size: 1.5rem;
}

.page-head p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.page[hidden] {
  display: none;
}

/* Kennzahlen */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
}

.stat__value {
  font-size: 1.9rem;
  font-weight: 650;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.stat__label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.stat--accent .stat__value {
  color: var(--ok);
}

/* Panels und Tabellen */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.section__head {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--surface-2);
}

.section__head h2 {
  font-size: 1rem;
}

.section__body {
  padding: 1.25rem;
}

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

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

th {
  text-align: left;
  padding: 0.65rem 1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: var(--surface-2);
}

td.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.empty {
  padding: 2.5rem 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Statusanzeigen */
.badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.badge--ok {
  background: var(--ok-soft);
  color: #0f5132;
}

.badge--info {
  background: var(--brand-soft);
  color: var(--brand-ink);
}

.badge--warn {
  background: var(--warn-soft);
  color: #74490a;
}

.badge--danger {
  background: var(--danger-soft);
  color: #8f1e17;
}

.badge--muted {
  background: #eef1f5;
  color: var(--muted);
}

/* Filterleiste */
.filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filters .field {
  margin-bottom: 0;
  min-width: 150px;
}

.filters .field > span {
  font-size: 0.78rem;
}

.filters .input,
.filters .select {
  padding: 0.45rem 0.65rem;
  font-size: 0.88rem;
}

.actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* Dialog */
dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-lg);
  width: min(480px, calc(100vw - 2rem));
  color: var(--ink);
  background: var(--surface);
}

dialog::backdrop {
  background: rgba(15, 27, 45, 0.45);
}

.dialog__head {
  padding: 1.15rem 1.35rem 0.75rem;
}

.dialog__head h3 {
  font-size: 1.1rem;
}

.dialog__head p {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.dialog__body {
  padding: 0.75rem 1.35rem 1rem;
  max-height: 60vh;
  overflow-y: auto;
}

.dialog__foot {
  padding: 1rem 1.35rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  background: var(--surface-2);
}

.toast {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  background: var(--ink);
  color: #fff;
  padding: 0.8rem 1.15rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  max-width: 380px;
  z-index: 50;
  animation: toast-in 0.2s ease;
}

.toast--error {
  background: var(--danger);
}

.toast--ok {
  background: var(--ok);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.pin-reveal {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 1.6rem;
  letter-spacing: 0.3em;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  margin: 0.75rem 0;
}
