:root {
  --primary: #1f3b8f;
  --primary-light: #3158d3;
  --primary-dark: #142559;
  --bg: rgb(121, 159, 255);
  --card: #ffffff;
  --text-color: #111827;
  --muted: #6b7280;
  --danger: #dc2626;
  --ring: rgba(49, 88, 211, 0.32);
}

/* Grundlayout */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  padding: 2rem 0 2rem;   /* oben etwas Abstand */
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-color);
  background:
    rgb(241, 245, 255);
    
  /* WICHTIG: keine Flexbox mehr */
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

.actions-row-header {
    margin-top: 100px;
    z-index: 100;
}

.login-page {
  max-width: 200px;
}

.buttons-login {
    float: right;
    
}


.page-wrapper {
  width: 100%;
  max-width: 960px;
  padding: 1.5rem;
  justify-content: center;
}

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 1.75rem 1.75rem 1.5rem;
  box-shadow: 0 22px 45px rgba(15, 23, 42, 0.16);
  border: 1px solid rgba(15, 23, 42, 0.08);
  animation: cardFadeIn 520ms cubic-bezier(.22,1,.36,1);
}

@keyframes cardFadeIn {
  0% { opacity: 0; transform: translateY(18px) scale(.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

header h1 {
  margin: 0 0 .25rem;
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem);
  color: var(--primary);
  text-align: center;
  letter-spacing: 0.03em;
}

header p {
  margin: 0 0 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.98rem;
}

.subtitle {
  text-align: center;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Formulare & Inputs */
.form-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
}

.field {
  margin-bottom: 1rem;
  display: grid;
  gap: .35rem;
}

.label {
  font-weight: 600;
  font-size: 0.95rem;
  color: #111827;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 400;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  padding: 0.7rem 0.85rem;
  font-size: 0.95rem;
  outline: none;
  background-color: #ffffff;
  transition: border-color .15s ease, box-shadow .15s ease, transform .08s ease;
}

textarea {
  min-height: 220px;
  resize: vertical;
}

input {
    width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  padding: 0.7rem 0.85rem;
  font-size: 0.95rem;
  outline: none;
  background-color: #ffffff;
  transition: border-color .15s ease, box-shadow .15s ease, transform .08s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px var(--ring);
  transform: translateY(-1px);
}

/* Buttons */
button {
  --btn-bg: var(--primary);
  --btn-bg-hover: var(--primary-light);
  --btn-fg: #ffffff;

  border-radius: 999px;
  border: none;
  padding: 0.7rem 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  background-color: var(--btn-bg);
  color: var(--btn-fg);
  box-shadow: 0 10px 25px rgba(31,59,143,0.35);
  transition: transform 0.08s ease, box-shadow 0.1s ease, background-color 0.12s ease;
}

button svg {
  width: 18px;
  height: 18px;
}

button:hover {
  background-color: var(--btn-bg-hover);
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(31,59,143,0.4);
}

button:active {
  transform: translateY(1px) scale(.99);
  box-shadow: 0 6px 12px rgba(15,23,42,0.35);
}

.btn-ghost {
  --btn-bg: #e5edff;
  --btn-bg-hover: #d5e1ff;
  --btn-fg: var(--primary-dark);
  box-shadow: none;
}

.btn-danger {
  --btn-bg: #fee2e2;
  --btn-bg-hover: #fecaca;
  --btn-fg: #b91c1c;
  box-shadow: none;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

/* Status-Messages */
.status-message {
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  animation: fadeInStatus 0.4s ease-out;
}

.status-success {
  background-color: #ecfdf3;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.status-error {
  background-color: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

@keyframes fadeInStatus {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Tabellen */
.table-wrapper {
  margin-top: 1.25rem;
  border-radius: 12px;
  background: #f9fafb;
  border: 1px solid rgba(15,23,42,0.06);
  padding: 0.75rem;
  max-height: 260px;
  overflow: auto;
  animation: cardFadeIn 520ms cubic-bezier(.22,1,.36,1);
}

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

th, td {
  padding: 0.45rem 0.6rem;
  text-align: left;
  white-space: nowrap;
}

th {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid rgba(15,23,42,0.08);
  position: sticky;
  top: 0;
  background: #f9fafb;
  z-index: 1;
}

tbody tr:nth-child(even) {
  background-color: #f3f4f6;
}

tbody tr:hover {
  background-color: #e5edff;
}

/* Kleine Helfer */
.subtitle {
  text-align: center;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.meta-label {
  font-weight: 600;
  color: #374151;
  font-size: 0.8rem;
}

.footer-note {
  margin-top: 1.2rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
}

.footer-note strong {
  color: var(--primary-dark);
}

.countdown {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary-dark);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  background-color: #e0e7ff;
  color: #1f2937;
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background-color: #22c55e;
}

@media (max-width: 768px) {
  body {
    align-items: flex-start;
  }
  .card {
    padding: 1.3rem 1.2rem 1.25rem;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .actions-row {
    justify-content: center;
  }
}
/* Overlays & Popups for Generator PDF actions */
.overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(10, 15, 28, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 380ms cubic-bezier(.22,1,.36,1);
  backdrop-filter: blur(2px);
}
.overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.overlay.closing {
  opacity: 0;
  pointer-events: none;
}

.modal {
  background: var(--card);
  padding: 1.25rem 1.25rem 1rem;
  border-radius: 16px;
  box-shadow: 0 18px 42px rgba(17, 24, 39, .25);
  max-width: 92vw;
  width: 440px;
  text-align: center;
  border: 1px solid rgba(17,24,39,.08);
  opacity: 0;
  transform: translateY(-28px);
}
.modal--wide {
  width: clamp(720px, 92vw, 1200px);
}
.overlay.active .modal {
  animation: modalSlideIn 480ms cubic-bezier(.22,1,.36,1) forwards;
}
.overlay.closing .modal {
  animation: modalSlideOut 420ms cubic-bezier(.22,1,.36,1) forwards;
}

.modal h2 {
  margin-top: 0;
  margin-bottom: .4rem;
  color: var(--primary);
}

.modal .actions {
  margin-top: .75rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.9rem;
}


/* Loader */
.loader-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(255, 255, 255, 0.8);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}
.loader-overlay.active {
  display: flex;
}
.loader {
  border: 6px solid #f3f3f3;
  border-top: 6px solid var(--primary);
  border-radius: 50%;
  width: 64px;
  height: 64px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes modalSlideIn {
  0% { opacity: 0; transform: translateY(-28px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes modalSlideOut {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-28px); }
}
/* Popup-spezifischer Loader im Modal */
.modal {
  position: relative;
}

.modal-loading-overlay {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(to bottom right, rgba(15,23,42,0.08), rgba(15,23,42,0.18));
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.modal-loading-overlay.active {
  display: flex;
}

.modal-spinner {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 4px solid rgba(255,255,255,0.6);
  border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
}

.top-right-nav {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: -40px;
}

.generate-btn {
    width: 100%;
}

.login-admin {
    margin-top: 24px;
}

.urkunde-img {
    width: 70%;
    display: block;
    margin: 0 auto;
    margin-top: 20px;
}

.verify-box {
     display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 8px;
    background-color: #ecfdf3;
    color: #166534;
    font-size: 16px;
    font-weight: 500;
}
.verify-center-container {
   height: 60px;              /* nimmt die volle Höhe des Fensters ein */
    display: flex;
    justify-content: center;
    align-items: center;
}

@media(max-width: 600px) {
    .urkunde-img {
        width: 100%;
    }
    .card {
        margin: 0;
    }
}

/* Mobile: Card ohne Rand, ohne Shadow, voller Breite */
@media (max-width: 640px) {

  .page-wrapper {
    padding-left: 0;
    padding-right: 0;
    padding-top: 0;
  }

  .card {
    border-radius: 0;
    box-shadow: none;
    border: none;
    background-color: #ffffff;
    max-width: none;
    width: 100%;
    padding: 1.2rem 1.2rem;
    margin-top: 0;
    padding-top: 0;
  }

  /* Optional: Body-Hintergrund neutralisieren */
  body {
    background-color: #ffffff !important;
  }
  .verify-center-container {
      height: 100px;
  }
  .login-admin {
      margin-top: 70px;
  }
}

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

.system-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.system-table th,
.system-table td {
  padding: 0.4rem 0.6rem;
  text-align: left;
}

.system-table th {
  width: 45%;
  font-weight: 600;
  color: var(--primary-dark);
  background-color: rgba(15,23,42,0.03);
}

.system-table tr:nth-child(even) td {
  background-color: rgba(148,163,184,0.06);
}

.system-card {
    margin-top: 30px;
    margin-bottom: 30px;
}

.powredby {
    color: #142559;
    margin-top: -15px;
    text-align: center;
    font-size: 12px;
}