:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1b1b1f;
  --muted: #6b6b73;
  --accent: #0a7c5e;
  --border: #e2e4ea;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

#app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

#app.login-view .topbar {
  display: none;
}

.nav-tabs {
  display: flex;
  gap: 8px;
}

.tab-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 0 36px 36px;
  max-width: 420px;
  margin: 60px auto 0;
  text-align: center;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

.login-logo img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  margin: 24px 0 8px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
  text-align: left;
}

.login-form button {
  margin-top: 6px;
  width: 100%;
}

.form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  align-items: end;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input, button {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
}

select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
  background: #fff;
}

button {
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
}

button.secondary {
  background: #1f2937;
}

button.danger {
  background: #b42318;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: #0a7c5e;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
}

.hint {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.upload-result {
  margin-top: 16px;
}

.qr-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: 12px;
  background: #f9fafc;
  border: 1px solid var(--border);
}

.qr-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.qr-tools select,
.qr-tools button {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
}

.qr-tools .icon-btn {
  width: 30px;
  height: 30px;
}

.qr-result img {
  width: 240px;
  height: 240px;
  object-fit: contain;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 18px rgba(0,0,0,0.08);
}

/* legacy inline download button removed */

.download-link {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
}

.qr-preview {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.report-row .qr-preview {
  margin-top: 0;
}

.qr-preview img {
  width: 220px;
  height: 220px;
  object-fit: contain;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 18px rgba(0,0,0,0.08);
}

.table {
  display: grid;
  gap: 12px;
}

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

.reports-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reports-tools input {
  min-width: 200px;
}

.pagination {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.pagination button {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.report-row {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto;
  align-items: center;
  background: #f9fafc;
  border-radius: 12px;
  padding: 8px 12px;
  border: 1px solid var(--border);
}

.report-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.report-main .hint {
  margin-top: 0;
}

.report-main header {
  font-weight: 600;
  margin-right: 4px;
}

.status-pill {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #e5e7eb;
  color: #111827;
}

.status-pill.status-active { background: #d1fae5; color: #065f46; }
.status-pill.status-revoked { background: #fee2e2; color: #991b1b; }
.status-pill.status-superseded { background: #fde68a; color: #92400e; }
.status-pill.status-draft { background: #e0e7ff; color: #3730a3; }

.report-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.report-details {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
  display: grid;
  gap: 4px;
}

.report-row header {
  font-weight: 600;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #1f2937;
  text-decoration: none;
  cursor: pointer;
  padding: 0;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.icon-btn.danger {
  border-color: #f2b8b5;
  color: #b42318;
}

.hidden { display: none; }


@media (max-width: 900px) {
  .report-row {
    grid-template-columns: 1fr;
  }
}
