:root {
    color-scheme: light dark;
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    background: #111827;
    color: #f9fafb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #111827;
}

button,
input,
select {
    font: inherit;
}

button {
    border: 0;
    border-radius: 0.6rem;
    padding: 0.65rem 0.9rem;
    background: #38bdf8;
    color: #082f49;
    font-weight: 700;
    cursor: pointer;
}

button:hover {
    background: #7dd3fc;
}

input,
select {
    width: 100%;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    padding: 0.6rem;
    background: #0f172a;
    color: #f9fafb;
}

label {
    display: grid;
    gap: 0.35rem;
    color: #cbd5e1;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 2rem;
    background: #0f172a;
    border-bottom: 1px solid #1f2937;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1 1 50%;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  flex: 1 1 50%;
  justify-content: flex-end;
}

.register-header-btn {
  white-space: nowrap;
}

.page-header h1 {
    margin: 0;
}

.page-header p {
    margin: 0.5rem 0 0;
    color: #94a3b8;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.api-key-field {
    min-width: min(28rem, 100%);
}

.layout {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.card {
    padding: 1rem;
    border: 1px solid #1f2937;
    border-radius: 1rem;
    background: #172033;
    box-shadow: 0 10px 20px rgb(0 0 0 / 0.18);
}

.card h2 {
    margin-top: 0;
}

.btn-primary {
    background: #10b981 !important;
    color: #f0fdf4 !important;
    font-size: 1.1rem;
    padding: 0.8rem 1.5rem;
}

.btn-primary:hover {
    background: #34d399 !important;
}

textarea {
    width: 100%;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    padding: 0.6rem;
    background: #0f172a;
    color: #f9fafb;
    font: inherit;
    resize: vertical;
}

.full-width {
    grid-column: 1 / -1;
}

/* ===== Statistiken ===== */
.stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: end;
}

.stat-block {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 10rem;
    max-width: 200px;
}

.stat-block strong {
    color: #93c5fd;
}

.stat-block.highlight {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    min-width: 12rem;
    max-width: 200px;
}

.stat-block.highlight strong {
    color: #38bdf8;
    font-size: 0.9rem;
}

.stat-big {
    font-size: 2rem;
    font-weight: 800;
    color: #f9fafb;
    line-height: 1;
}

details.nfc-history {
    margin-top: 0.75rem;
}

details.nfc-history summary {
    cursor: pointer;
    color: #94a3b8;
    font-size: 0.85rem;
    user-select: none;
}

details.nfc-history summary:hover {
    color: #38bdf8;
}

.nfc-history table {
    min-width: unset;
    width: 100%;
    margin-top: 0.5rem;
}

.nfc-history th,
.nfc-history td {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
}

/* ===== Modal Overlay ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

/* ===== Page Footer ===== */
.page-footer {
  text-align: center;
  padding: 1rem 2rem;
  color: #64748b;
  font-size: 0.875rem;
  border-top: 1px solid #1f2937;
  background: #0f172a;
}

.page-footer p {
  margin: 0;
}

.page-footer a {
  color: #38bdf8;
  text-decoration: none;
  font-weight: 600;
}

.page-footer a:hover {
  text-decoration: underline;
}

.heart {
  color: #ef4444;
}

/* ===== Modal Overlay ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.search-bar input,
.search-bar select {
    width: auto;
}

.grid-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.grid-form button {
    grid-column: 1 / -1;
}

.inline-form {
    display: flex;
    align-items: end;
    gap: 0.8rem;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox input {
    width: auto;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 50rem;
}

th,
td {
    border-bottom: 1px solid #1f2937;
    padding: 0.65rem;
    text-align: left;
    vertical-align: top;
}

th {
    color: #93c5fd;
    background: #0f172a;
}

.muted {
    color: #94a3b8;
}

.message {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    max-width: 30rem;
    border-radius: 0.8rem;
    padding: 1rem;
    background: transparent;
}

.message.success {
    background: #14532d;
}

.message.error {
    background: #7f1d1d;
}

.message.info {
    background: #1e3a8a;
}

.safety-ok {
  color: #4ade80;
}

.safety-expired {
  color: #f87171;
}

@media (max-width: 1000px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem 1rem;
    }

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

    .header-right {
        display: flex;
        flex-wrap: wrap;
        align-items: end;
        gap: 0.5rem;
    }

    .register-header-btn {
        align-self: flex-start;
    }

    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }

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

    /* Mobile-friendly tables */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 40rem;
        font-size: 0.85rem;
    }

    table.present-table {
        min-width: 30rem;
    }

    th, td {
        padding: 0.4rem 0.5rem;
        white-space: nowrap;
    }
}
