/* certificate.gredig.swiss — ROD-grün + Trust-Blau */
:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --primary: #47aa8d;          /* ROD-grün */
  --primary-dark: #38886f;
  --trust: #2C5F8D;            /* Trust-Blau Akzent */
  --trust-dark: #1f4566;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--trust); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.cert-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--trust) 100%);
  color: white;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}
.cert-header .brand { display: flex; align-items: center; gap: 0.75rem; }
.cert-header .brand-icon { font-size: 1.75rem; }
.cert-header .brand-text { font-weight: 600; font-size: 1.1rem; }
.cert-header .brand-text small { display: block; opacity: 0.85; font-size: 0.75rem; font-weight: 400; }
.cert-header nav { display: flex; gap: 1.5rem; }
.cert-header nav a {
  color: white;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  transition: background 0.15s;
}
.cert-header nav a:hover {
  background: rgba(255,255,255,0.15);
  text-decoration: none;
}

/* Main container */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Hero */
.hero {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}
.hero h1 {
  margin: 0 0 0.5rem;
  font-size: 2rem;
  color: var(--trust-dark);
}
.hero .lede {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 0 auto 1.5rem;
  max-width: 640px;
}

/* Lookup */
.lookup {
  display: flex;
  gap: 0.5rem;
  max-width: 480px;
  margin: 0 auto;
}
.lookup input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
}
.lookup input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(71,170,141,0.15);
}
.btn {
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--trust); }
.btn-secondary:hover { background: var(--trust-dark); }
.btn-danger { background: var(--danger); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}
.card h2 { margin-top: 0; color: var(--trust-dark); }
.card h3 { color: var(--text); }

/* Levels */
.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.level-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.level-card.level-2 { border-top-color: var(--trust); }
.level-card.level-3 { border-top-color: var(--trust-dark); }
.level-card .level-num {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.level-card h3 { margin: 0.25rem 0 0.75rem; font-size: 1.1rem; }
.level-card p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th, td {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}
th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #fafbfc;
}
tr:hover td { background: #fafbfc; }

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-active   { background: #d1fae5; color: #065f46; }
.badge-revoked  { background: #fee2e2; color: #991b1b; }
.badge-expired  { background: #fef3c7; color: #92400e; }
.badge-suspended{ background: #e0e7ff; color: #3730a3; }
.badge-level-1  { background: #dcfce7; color: #166534; }
.badge-level-2  { background: #cffafe; color: #155e75; }
.badge-level-3  { background: #ddd6fe; color: #5b21b6; }
.badge-pending  { background: #fef3c7; color: #92400e; }

/* Cert detail */
.cert-detail .cert-id {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--trust-dark);
  margin: 0;
}
.cert-detail .cert-system {
  font-size: 1.1rem;
  color: var(--text);
  margin: 0.25rem 0 1rem;
}
.cert-detail .meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.cert-detail .meta-item .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}
.cert-detail .meta-item .value {
  margin-top: 0.25rem;
  font-weight: 500;
}

/* Recognition note (Trust-Blau) */
.recognition {
  background: #f0f5fa;
  border-left: 4px solid var(--trust);
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin: 1rem 0;
  font-size: 0.9rem;
  color: var(--trust-dark);
}

/* Audit Trail */
.trail {
  list-style: none;
  padding: 0;
  margin: 0;
}
.trail li {
  border-left: 2px solid var(--border);
  padding: 0.5rem 0 0.5rem 1rem;
  margin-left: 0.5rem;
  position: relative;
}
.trail li::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 0.85rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}
.trail .type {
  font-weight: 600;
  color: var(--trust-dark);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}
.trail .ts { color: var(--text-muted); font-size: 0.8rem; margin-left: 0.5rem; }
.trail .hash {
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.25rem;
  word-break: break-all;
}

/* Markdown content (Standards) */
.md-content { line-height: 1.7; }
.md-content h1, .md-content h2, .md-content h3 { color: var(--trust-dark); }
.md-content code {
  background: #f3f4f6;
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
  font-size: 0.9em;
}
.md-content pre {
  background: #1f2937;
  color: #f9fafb;
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
footer a { color: var(--text-muted); }

/* Loading / Empty */
.loading, .empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
}

/* Form */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-grid .full { grid-column: 1 / -1; }
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text);
}
input[type="text"], input[type="date"], input[type="number"], select, textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
  background: white;
}
textarea { resize: vertical; min-height: 80px; }

/* Mobile */
@media (max-width: 640px) {
  .cert-header { flex-direction: column; gap: 0.5rem; padding: 0.75rem 1rem; }
  .cert-header nav { gap: 0.75rem; flex-wrap: wrap; justify-content: center; }
  .hero { padding: 2rem 1rem; }
  .hero h1 { font-size: 1.5rem; }
  .lookup { flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
}
