*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: #1a1a1a;
    background: #f5f5f5;
}

main {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

h1 {
    margin-bottom: 2rem;
}

section {
    margin-bottom: 1.5rem;
}

/* Header & nav */
.site-header {
    background: #fff;
    border-bottom: 3px solid #00A651;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.site-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #00A651;
    text-decoration: none;
    letter-spacing: -0.01em;
}

.site-title:hover {
    color: #008a44;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.site-nav a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
}

.site-nav a:hover {
    color: #00A651;
}

.nav-username {
    font-weight: 500;
    font-size: 0.95rem;
    color: #333;
}

.nav-badge {
    font-size: 0.7rem;
    vertical-align: super;
}

.nav-logout-form {
    margin: 0;
}

.nav-logout-form button {
    padding: 0.35rem 0.9rem;
    font-size: 0.9rem;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-weight: 500;
}

.nav-logout-form button:hover {
    border-color: #00A651;
    color: #00A651;
    background: #fff;
}

/* Generic buttons */
button {
    padding: 0.4rem 1rem;
    font-size: 0.95rem;
    cursor: pointer;
    border: 1px solid #555;
    border-radius: 4px;
    background: #fff;
}

button:hover {
    background: #eee;
}

/* Auth pages */
.auth-page {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    background: #fff;
    border: 1px solid #ddd;
    border-top: 3px solid #00A651;
    border-radius: 4px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.auth-card h1 {
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    color: #1a1a1a;
}

/* Form elements */
.field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 1.2rem;
}

.field label {
    font-size: 0.9rem;
    font-weight: 600;
}

.field input {
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
}

.field input:focus {
    outline: 2px solid #00A651;
    outline-offset: 1px;
    border-color: transparent;
}

.field-hint {
    font-size: 0.8rem;
    color: #666;
}

.optional {
    font-weight: 400;
    color: #888;
    font-size: 0.85rem;
}

.btn-primary {
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    background: #00A651;
    color: #fff;
}

.btn-primary:hover {
    background: #008a44;
}

.form-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    border-radius: 4px;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.form-hint {
    color: #555;
    font-size: 0.95rem;
    margin-bottom: 1.2rem;
}

.form-success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
    border-radius: 4px;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.field-password {
    position: relative;
}

.field-password input {
    padding-right: 5rem;
}

.btn-show-password {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #00A651;
    background: none;
    border: none;
    cursor: pointer;
}

.btn-show-password:hover {
    background: none;
    text-decoration: underline;
}

.auth-footer {
    margin-top: 1.25rem;
    font-size: 0.88rem;
    color: #666;
    text-align: center;
}

.auth-footer a {
    color: #00A651;
    text-decoration: none;
    font-weight: 500;
}

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

/* ── Badge grid ─────────────────────────────────────────────────────────── */

.section-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid #00A651;
}

.badge-group-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.badge-group-title a {
    color: #1a1a1a;
    text-decoration: none;
}

.badge-group-title a:hover {
    color: #00A651;
}

.badge-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.badge-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.badge-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-color: #00A651;
}

.badge-card-image {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 3px;
    margin-bottom: 0.75rem;
    display: block;
}

.badge-card-level {
    font-size: 0.82rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.75rem;
    margin-top: -0.5rem;
    text-align: center;
}

.badge-card .badge-category {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #00A651;
    margin-bottom: 0.4rem;
}

.badge-card h2 {
    font-size: 1rem;
    margin-bottom: 0.9rem;
}

.progress-bar-wrap {
    background: #e5e7eb;
    border-radius: 999px;
    height: 7px;
    overflow: hidden;
    margin-bottom: 0.3rem;
}

.progress-bar-fill {
    background: #00A651;
    height: 100%;
    border-radius: 999px;
}

.progress-label {
    font-size: 0.78rem;
    color: #666;
    text-align: center;
}

/* ── Badge detail ────────────────────────────────────────────────────────── */

.breadcrumb {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 1.25rem;
}

.breadcrumb a {
    color: #00A651;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.badge-header {
    margin-bottom: 2rem;
}

.badge-header h1 {
    font-size: 1.7rem;
    margin-bottom: 0.25rem;
}

.badge-introduction {
    color: #444;
    line-height: 1.7;
    white-space: pre-line;
    border-left: 3px solid #00A651;
    padding-left: 1rem;
    margin-top: 1rem;
    font-size: 0.95rem;
}

.badge-afterword {
    color: #555;
    font-size: 0.875rem;
    line-height: 1.7;
    padding: 1rem 1.25rem;
    background: #f9fafb;
    border-radius: 4px;
    margin-top: 2rem;
    white-space: pre-line;
}

/* ── Badge overview grid (3 niveaus × 5 eisen) ───────────────────────────── */

.badge-overview-grid {
    display: grid;
    grid-template-columns: 160px repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 2rem;
    align-items: stretch;
}

.niveau-col-header {
    text-align: center;
    padding: 0.5rem 0.25rem 0.75rem;
}

.niveau-header-image {
    max-width: 100px;
    max-height: 100px;
    object-fit: contain;
    border-radius: 3px;
    margin: 0 auto 0.4rem;
    display: block;
}

.niveau-col-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #1a1a1a;
}

.eis-row-header {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.75rem 0.5rem;
    border-right: 2px solid #e5e7eb;
}

.eis-row-number {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #00A651;
}

.eis-row-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1a1a1a;
}

.eis-row-progress {
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.2rem;
}

/* ── Levels ──────────────────────────────────────────────────────────────── */

.badge-levels {
    margin-bottom: 1.5rem;
}

.level-section {
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.level-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    background: #f9fafb;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    text-align: left;
    color: #1a1a1a;
}

.level-header:hover {
    background: #f0fdf4;
}

.level-stats {
    margin-left: auto;
    font-size: 0.8rem;
    font-weight: 500;
    color: #666;
}

.level-steps {
    padding: 0.5rem;
}

/* ── Step cards ──────────────────────────────────────────────────────────── */

.step-card {
    border: 1px solid #e5e7eb;
    border-left: 3px solid #e5e7eb;
    border-radius: 4px;
    padding: 0.9rem 1rem;
    margin-bottom: 0.4rem;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.step-state {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.step-card.status-open       { border-left-color: #f59e0b; }
.step-card.status-pending_signoff { border-left-color: #3b82f6; }
.step-card.status-completed  { border-left-color: #00A651; background: #f0fdf4; }

.step-header {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
    margin-bottom: 0.6rem;
}

.step-number {
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    background: #ccc;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.2rem;
}

.status-open            .step-number { background: #f59e0b; }
.status-pending_signoff .step-number { background: #3b82f6; }
.status-completed       .step-number { background: #00A651; }

.step-text {
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre-line;
    flex: 1;
    color: #333;
}

.step-check {
    width: 22px;
    height: 22px;
    border-radius: 3px;
    border: 2px solid #d1d5db;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1;
    color: transparent;
    background: white;
    cursor: default;
    user-select: none;
}
.step-check-in_progress    { background: #3b82f6; border-color: #3b82f6; color: white; }
.step-check-work_done      { background: #86efac; border-color: #86efac; color: white; }
.step-check-pending_signoff { background: #4ade80; border-color: #4ade80; color: white; }
.step-check-signed_off     { background: #16a34a; border-color: #16a34a; color: white; }

.niveau-checks {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 0.5rem;
}

.step-notes {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: #555;
    background: #f9fafb;
    border-radius: 4px;
    padding: 0.45rem 0.7rem;
    margin-bottom: 0.6rem;
    white-space: pre-line;
}

.step-notes span { flex: 1; }

.btn-icon {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #9ca3af;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin-top: 1px;
}
.btn-icon:hover { color: #374151; }

.step-signoff-info {
    font-size: 0.82rem;
    color: #166534;
    margin-top: 0.1rem;
}

.step-mentor-list {
    font-size: 0.82rem;
    color: #1e40af;
    margin-bottom: 0.5rem;
}

.step-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: auto;
    padding-top: 0.75rem;
}

.btn-secondary {
    padding: 0.4rem 0.9rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid #00A651;
    border-radius: 4px;
    background: #fff;
    color: #00A651;
}

.btn-secondary:hover {
    background: #f0fdf4;
}

.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.82rem;
}

.btn-danger-link {
    background: none;
    border: none;
    color: #b91c1c;
    font-size: 0.82rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.btn-danger-link:hover {
    color: #7f1d1d;
}

/* ── Inline forms ────────────────────────────────────────────────────────── */

.inline-form {
    margin-top: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    max-width: 380px;
}

.inline-form input,
.inline-form textarea {
    font-size: 0.875rem;
    padding: 0.4rem 0.6rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
}

.inline-form input:focus,
.inline-form textarea:focus {
    outline: 2px solid #00A651;
    outline-offset: 1px;
    border-color: transparent;
}

.inline-form textarea {
    resize: vertical;
    min-height: 56px;
}

.mentor-suggestions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
}

.mentor-chip {
    font-size: 0.75rem;
    padding: 0.2rem 0.55rem;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 999px;
    cursor: pointer;
    color: #166534;
}

.mentor-chip:hover {
    background: #dcfce7;
    border-color: #00A651;
}

/* ── Notifications ───────────────────────────────────────────────────────── */

.notification-bar {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    padding: 0.7rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: #1e40af;
}

.notification-bar a {
    color: #1e40af;
    font-weight: 600;
}

/* ── Sign-off requests page ──────────────────────────────────────────────── */

.signoff-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1rem;
}

.signoff-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.4rem;
}

.signoff-scout {
    font-weight: 600;
    font-size: 0.95rem;
}

.signoff-badge-info {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.6rem;
}

.signoff-step-text {
    font-size: 0.875rem;
    color: #333;
    white-space: pre-line;
    line-height: 1.55;
    background: #f9fafb;
    padding: 0.5rem 0.7rem;
    border-radius: 4px;
    margin-bottom: 0.7rem;
}

.step-mentor-comment {
    margin-top: 0.5rem;
    background: #f0fdf4;
    border-left: 3px solid #00A651;
    padding: 0.4rem 0.6rem;
    border-radius: 0 4px 4px 0;
    font-size: 0.85rem;
}

.step-mentor-comment-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #166534;
    margin-bottom: 0.2rem;
}

.step-mentor-comment p {
    margin: 0;
    color: #333;
    line-height: 1.5;
}

.step-rejections {
    margin-bottom: 0.5rem;
}

.step-rejection {
    background: #fff7ed;
    border-left: 3px solid #f97316;
    padding: 0.4rem 0.6rem;
    border-radius: 0 4px 4px 0;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

.step-rejection-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #9a3412;
    margin-bottom: 0.2rem;
}

.step-rejection p {
    margin: 0;
    color: #333;
    line-height: 1.5;
}

.signoff-requested-at {
    font-size: 0.78rem;
    color: #aaa;
    margin-bottom: 0.6rem;
}

.signoff-level-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 0.4rem;
}

.signoff-notes-section {
    margin-bottom: 0.7rem;
}

.signoff-notes-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
    margin-bottom: 0.2rem;
}

.signoff-notes {
    font-size: 0.82rem;
    color: #555;
    font-style: italic;
    margin: 0;
    white-space: pre-line;
}

.signoff-confirmed {
    color: #166534;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.25rem 0;
}

.empty-state {
    color: #666;
    font-size: 0.9rem;
    padding: 2rem;
    text-align: center;
    background: #f9fafb;
    border-radius: 4px;
}

[x-cloak] { display: none !important; }
