* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f4f4;
    color: #222;
    padding-bottom: 90px;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: 90px;
}

h1 {
    margin-top: 0;
}

h2 {
    margin-top: 0;
}

a {
    color: inherit;
}

.back {
    display: inline-block;
    margin-bottom: 16px;
    text-decoration: none;
    font-weight: bold;
}

.card {
    background: white;
    padding: 16px;
    border-radius: 14px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 5px;
}

.top-bar h1 {
    margin-bottom: 5px;
}

.top-bar p {
    margin-top: 0;
    color: #666;
}

.logout-button {
    flex-shrink: 0;
    padding: 10px 12px;
    background: #eee;
    border-radius: 10px;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
}

.logout-button:hover {
    background: #ddd;
}

.welcome {
    margin-bottom: 18px;
    font-size: 14px;
    color: #666;
}



input,
textarea,
select {
    width: 100%;
    padding: 12px;
    margin-top: 5px;
    margin-bottom: 12px;
    border: 1px solid #ccc;
    border-radius: 10px;
    font-size: 16px;
}

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

button,
.button {
    display: inline-block;
    padding: 12px 16px;
    border: 0;
    border-radius: 10px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    background: #ddd;
    color: #222;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.full-width {
    width: 100%;
}

.message {
    background: #d8f0d8;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.error {
    background: #f4cccc;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.nav-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.nav-card {
    display: block;
    background: white;
    padding: 20px;
    border-radius: 14px;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.nav-card strong {
    display: block;
    font-size: 20px;
    margin-bottom: 5px;
}

.nav-card span {
    color: #666;
    font-size: 14px;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;

    width: 100%;
    max-width: 700px;

    display: grid;

    background: white;
    border-top: 1px solid #ddd;

    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.10);
}

.bottom-nav-5 {
    grid-template-columns: repeat(5, 1fr);
}

.bottom-nav-4 {
    grid-template-columns: repeat(4, 1fr);
}

.bottom-nav-3 {
    grid-template-columns: repeat(3, 1fr);
}

.bottom-nav-2 {
    grid-template-columns: repeat(2, 1fr);
}

.bottom-nav a {
    padding: 10px 2px;
    text-align: center;
    text-decoration: none;

    font-size: 11px;
    line-height: 1.5;
}

.bottom-nav a:hover {
    background: #f1f1f1;
}

.bottom-nav a.active {
    background: #e2e2e2;
    font-weight: bold;
}


@media (min-width: 600px) {
    .nav-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.member {
    padding: 14px 0;
    border-bottom: 1px solid #ddd;
}

.member:last-child {
    border-bottom: none;
}

.member-name {
    font-size: 18px;
    font-weight: bold;
}

.member-details {
    margin-top: 5px;
    color: #666;
    font-size: 14px;
}

.member-actions {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.member-actions form {
    margin: 0;
}

.deactivate-button {
    background: #f2b5b5;
}

.reactivate-button {
    background: #b8e6b8;
}

.inactive {
    opacity: 0.7;
}

.group {
    padding: 14px 0;
    border-bottom: 1px solid #ddd;
}

.group:last-child {
    border-bottom: none;
}

.group-name {
    font-size: 18px;
    font-weight: bold;
}

.description {
    margin-top: 4px;
    color: #666;
}

.member-list {
    margin-top: 12px;
}

.group-member {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid #eee;
}

.remove-button {
    background: #f2b5b5;
    white-space: nowrap;
}

.event {
    padding: 14px 0;
    border-bottom: 1px solid #ddd;
}

.event:last-child {
    border-bottom: none;
}

.event-title {
    font-size: 18px;
    font-weight: bold;
}

.event-meta {
    margin-top: 5px;
    color: #666;
    line-height: 1.5;
}

.event-actions {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.event-actions form {
    margin: 0;
}

.delete-button {
    background: #f2b5b5;
}



/* =========================================================
   Anwesenheit
   ========================================================= */

.event-info {
    line-height: 1.6;
}


/* Statistik */

.stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.stat {
    padding: 10px;
    border-radius: 10px;
    background: #eee;
    text-align: center;
}

.stat-number {
    font-size: 22px;
    font-weight: bold;
}

.stat-label {
    margin-top: 3px;
    font-size: 13px;
}


/* Alle anwesend */

.all-present {
    width: 100%;
    padding: 14px;
    margin-top: 15px;
    border: 0;
    border-radius: 10px;
    background: #a9e5a9;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}


/* Anwesenheit zurücksetzen */

.reset-attendance {
    width: 100%;
    padding: 14px;
    margin-top: 10px;
    border: 0;
    border-radius: 10px;
    background: #ddd;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}


/* Teilnehmer */

.status-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.status-button {
    padding: 12px 6px;
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    background: #ddd;
}

.status-button[data-status="present"] {
    background: #d9f2d9;
}

.status-button[data-status="unexcused"] {
    background: #f3c6c6;
}

.status-button[data-status="excused"] {
    background: #f4e6a8;
}

.status-button[data-status="late"] {
    background: #d5ddf3;
}

.status-button.active {
    border-color: #222;
    font-weight: bold;
}

.status-button[data-status="absent"] {
    background: #f3c6c6;
}

/* Speicherstatus */

.save-status {
    min-height: 22px;
    margin-top: 10px;
    font-size: 14px;
    font-weight: bold;
}

.save-ok {
    color: #267326;
}

.save-error {
    color: #a00000;
}


/* Größere Displays */

@media (min-width: 600px) {

    .stats {
        grid-template-columns: repeat(5, 1fr);
    }

    .status-buttons {
        grid-template-columns: repeat(4, 1fr);
    }
}


.repeat-box {
    margin: 8px 0 18px 0;
    padding: 14px;
    background: #f7f7f7;
    border-radius: 10px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: bold;
}

.checkbox-row input {
    width: auto;
    margin: 0;
    transform: scale(1.3);
}

#repeat-until-container {
    margin-top: 14px;
}


.history-entry {
    padding: 14px 0;
    border-bottom: 1px solid #ddd;
}

.history-entry:last-child {
    border-bottom: none;
}

.history-member {
    font-size: 18px;
    font-weight: bold;
}

.history-event {
    margin-top: 4px;
    color: #666;
    font-size: 14px;
}

.history-change {
    margin-top: 8px;
    font-size: 16px;
}

.history-meta {
    margin-top: 6px;
    color: #777;
    font-size: 13px;
}


.user-entry {
    padding: 14px 0;
    border-bottom: 1px solid #ddd;
}

.user-entry:last-child {
    border-bottom: none;
}

.user-name {
    font-size: 18px;
    font-weight: bold;
}

.user-details {
    margin-top: 5px;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

.user-actions {
    margin-top: 10px;
}

.user-actions form {
    margin: 0;
}

.user-you {
    display: inline-block;
    margin-left: 6px;
    padding: 3px 7px;
    border-radius: 7px;
    background: #eee;
    font-size: 11px;
    font-weight: normal;
}


.user-edit {
    margin-top: 12px;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.user-edit summary {
    cursor: pointer;
    font-weight: bold;
    padding: 8px 0;
}

.user-edit form {
    margin-top: 10px;
}

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

.calendar-header strong {
    font-size: 20px;
}

.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-weekday {
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    padding: 6px 2px;
    color: #666;
}

.calendar-day {
    min-height: 90px;
    background: white;
    border-radius: 8px;
    padding: 5px;
    border: 1px solid #e5e5e5;
    min-width: 0;
}

.calendar-empty {
    background: transparent;
    border: 0;
}

.calendar-date {
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 5px;
}

.calendar-event {
    display: block;
    margin-top: 4px;
    padding: 5px;
    border-radius: 6px;
    background: #eee;
    text-decoration: none;
    font-size: 10px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.calendar-event strong,
.calendar-event span {
    display: block;
}

@media (max-width: 500px) {

    .calendar {
        gap: 2px;
    }

    .calendar-day {
        min-height: 72px;
        padding: 3px;
    }

    .calendar-event {
        padding: 3px;
        font-size: 9px;
    }

}


.calendar-day.today {
    border: 2px solid #222;
}

.calendar-day.today .calendar-date {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 7px;
    border-radius: 50%;
    background: #222;
    color: white;
}

.calendar-day.has-events {
    border-width: 2px;
    background: #fafafa;
}

.calendar-day.has-events .calendar-event {
    font-weight: bold;
    border-left: 4px solid #555;
    padding: 7px 5px;
}

.calendar-day.today.has-events {
    border-width: 3px;
}


.calendar-date {
    display: flex;
    align-items: center;
    gap: 5px;
}

.calendar-event-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #222;
    flex-shrink: 0;
}


.status-buttons-hidden {
    display: none;
}

.selected-status {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.status-badge {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 600;
}

.status-present {
    background: #d1e7dd;
    color: #0f5132;
}

.status-absent {
    background: #f8d7da;
    color: #842029;
}

.status-unknown {
    background: #e9ecef;
    color: #495057;
}


.status-excused {
    background: #fff3cd;
    color: #856404;
}

.status-late {
    background: #d9edf7;
    color: #0c5460;
}



.change-status-button {
    padding: 7px 10px;
    font-size: 14px;
}


.status-buttons.status-buttons-hidden {
    display: none;
}

.member-name {
    margin-bottom: 12px;
}


.section-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    text-align: left;
}

.collapsible-content {
    display: none;
    margin-top: 20px;
}

.collapsible-content.open {
    display: block;
}



/* =========================================================
   Anwesenheitsübersicht
   ========================================================= */

.statistics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.statistics-header form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.statistics-header select {
    width: auto;
}


.statistics-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.statistics-legend span {
    padding: 7px 10px;
    border-radius: 8px;
    font-weight: bold;
}


.statistics-group {
    margin-bottom: 40px;
}


.statistics-month {
    padding: 0;
    overflow: hidden;
}


.statistics-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
}


.statistics-content {
    display: none;
    padding: 0 20px 20px;
}

.statistics-content.open {
    display: block;
}


.statistics-table-wrapper {
    width: 100%;
    overflow-x: auto;
}


.statistics-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.statistics-table th,
.statistics-table td {
    border: 1px solid #ddd;
    padding: 9px 10px;
    text-align: center;
}

.statistics-table th {
    background: #f3f3f3;
}


.statistics-table .statistics-name-column {
    text-align: left;
    position: sticky;
    left: 0;
    background: white;
    z-index: 1;
    min-width: 170px;
}


.statistics-table th.statistics-name-column {
    background: #f3f3f3;
    z-index: 2;
}


.stat-present {
    background: #cfe9df;
    color: #075c3b;
}

.stat-late {
    background: #d9edf7;
    color: #0c5460;
}

.stat-excused {
    background: #fff3cd;
    color: #856404;
}

.stat-unexcused {
    background: #f8d7da;
    color: #8b1e24;
}

.stat-unknown {
    background: #eeeeee;
    color: #666;
}


.statistics-total {
    font-weight: bold;
}

.statistics-percentage {
    font-weight: bold;
}


.statistics-year-total {
    margin-top: 15px;
}

.statistics-year-total h3 {
    margin-top: 0;
}


@media (max-width: 700px) {

    .statistics-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .statistics-table th,
    .statistics-table td {
        padding: 8px;
        font-size: 0.9rem;
    }

    .statistics-table .statistics-name-column {
        min-width: 145px;
    }

}


/* =========================================================
   Statistik – saubere Tabellenansicht
   ========================================================= */

.statistics-month,
.statistics-year-total {
    overflow: hidden;
}

.statistics-content {
    display: none;
    padding: 0 20px 20px;
}

.statistics-content.open {
    display: block;
}

.statistics-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.statistics-table {
    width: 100%;
    min-width: 700px;
    border-collapse: collapse;
    table-layout: auto;
    background: #fff;
}

.statistics-table th,
.statistics-table td {
    border: 1px solid #d7d7d7;
    padding: 10px 12px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

.statistics-table thead th {
    background: #f1f1f1;
    font-weight: bold;
}

.statistics-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.statistics-table tbody tr:hover {
    background: #f5f5f5;
}


/* Name links */

.statistics-table .statistics-name-column,
.statistics-table td:first-child {
    text-align: left;
    min-width: 190px;
    font-weight: 600;
}

.statistics-table .statistics-name-column {
    position: sticky;
    left: 0;
    z-index: 3;
    background: #f1f1f1;
}

.statistics-table tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
}

.statistics-table tbody tr:nth-child(even) td:first-child {
    background: #fafafa;
}


/* Statuszellen */

.statistics-table td.stat-present,
.statistics-table td.stat-late,
.statistics-table td.stat-excused,
.statistics-table td.stat-unexcused,
.statistics-table td.stat-unknown {
    min-width: 58px;
    font-weight: bold;
}

.statistics-table td.stat-present {
    background: #cfe9df;
    color: #075c3b;
}

.statistics-table td.stat-late {
    background: #d9edf7;
    color: #0c5460;
}

.statistics-table td.stat-excused {
    background: #fff3cd;
    color: #856404;
}

.statistics-table td.stat-unexcused {
    background: #f8d7da;
    color: #8b1e24;
}

.statistics-table td.stat-unknown {
    background: #eeeeee;
    color: #666;
}


/* Monatssumme */

.statistics-total {
    min-width: 85px;
    font-weight: bold;
    background: #f6f6f6;
}

.statistics-percentage {
    min-width: 70px;
    font-weight: bold;
    background: #f6f6f6;
}


/* Jahresgesamt */

.statistics-total-table {
    min-width: 550px;
}

.statistics-total-table th:first-child,
.statistics-total-table td:first-child {
    min-width: 190px;
}

.statistics-total-table td:nth-child(2),
.statistics-total-table td:nth-child(3),
.statistics-total-table td:nth-child(4) {
    text-align: center;
}


/* Monatskopf */

.statistics-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
}


/* Handy */

@media (max-width: 700px) {

    .statistics-table {
        min-width: 650px;
    }

    .statistics-table th,
    .statistics-table td {
        padding: 9px 10px;
        font-size: 0.9rem;
    }

    .statistics-table .statistics-name-column,
    .statistics-table tbody td:first-child {
        min-width: 155px;
    }

    .statistics-total-table {
        min-width: 500px;
    }
}


.statistics-table td.stat-not-applicable {
    background: #f8f8f8;
    color: #aaa;
    font-weight: normal;
}


.statistics-section-card {
    margin-bottom: 18px;
}

.statistics-group-card {
    margin-bottom: 14px;
}

.statistics-section-card > .statistics-toggle {
    font-size: 1.3rem;
}

.statistics-group-card > .statistics-toggle {
    font-size: 1.1rem;
}



/* =========================
   Sticker-Übersicht
   ========================= */

.sticker-overview summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    padding: 8px 0;
}

.sticker-overview-content {
    margin-top: 16px;
}


/* Abstand zwischen den Gruppen */

.sticker-group {
    margin-bottom: 14px;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    overflow: hidden;
}

.sticker-group:last-child {
    margin-bottom: 0;
}

.sticker-group > summary {
    cursor: pointer;
    font-weight: 600;
    padding: 14px;
}

.sticker-group-content {
    padding: 8px 14px 14px;
}


/* Abstand zwischen den einzelnen Mitgliedern */

.sticker-member-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;

    padding: 12px 0;
    margin-bottom: 6px;

    border-bottom: 1px solid #eee;
}

.sticker-member-row:last-child {
    margin-bottom: 0;
    border-bottom: none;
}


/* =========================
   Sticker-Gruppen
   ========================= */

.sticker-group {
    margin-top: 10px;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    overflow: hidden;
}

.sticker-group > summary {
    cursor: pointer;
    font-weight: 600;
    padding: 12px 14px;
}

.sticker-group-content {
    padding: 0 14px 8px 14px;
}

/* =========================
   Protokoll-Bereiche
   ========================= */

.protocol-section > summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    padding: 8px 0;
}

.protocol-section-content {
    margin-top: 16px;
}



.member-group {
    margin-bottom: 32px;
}

.member-group-title {
    font-size: 18px;
    font-weight: 700;
    margin-top: 24px;
    margin-bottom: 12px;
}

.member-group-total {
    font-size: 16px;
    font-weight: 700;
    margin-top: 12px;
    margin-bottom: 28px;
    padding-top: 8px;
    border-top: 1px solid #ddd;
}