/* ── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1a202c;
  --muted: #718096;
  --primary: #2b6cb0;
  --primary-hover: #2c5282;
  --danger: #e53e3e;
  --danger-hover: #c53030;
  --success: #38a169;
  --warning: #d69e2e;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
}

body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }

/* ── Navbar ───────────────────────────────────────────────────── */
.navbar { background: linear-gradient(90deg, #16294a 0%, #1e3a5f 100%); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; height: 56px; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 12px rgba(15,30,60,.18); }
.nav-brand { font-weight: 700; font-size: 1.02rem; letter-spacing: .01em; display: flex; align-items: center; gap: .5rem; }
.nav-brand::before { content: "📋"; font-size: 1.1rem; }
.nav-links { display: flex; gap: .15rem; align-items: center; }
.nav-links a { color: #cbdcf0; text-decoration: none; padding: .45rem .8rem; border-radius: 8px; font-size: .85rem; font-weight: 500; transition: background .15s, color .15s; }
.nav-links a:hover { background: rgba(255,255,255,.13); color: #fff; }
.nav-links .btn-export { background: var(--primary); color: #fff; }
.nav-links .btn-export:hover { background: var(--primary-hover); }
.nav-links .btn-logout { color: #fca5a5; }
.nav-links .btn-logout:hover { background: rgba(252,129,129,.18); }
.badge { background: #ef4444; color: #fff; border-radius: 999px; padding: 1px 7px; font-size: .7rem; font-weight: 700; margin-left: 4px; }

/* ── Layout ───────────────────────────────────────────────────── */
.container { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }
.page-header { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; color: #0f213d; }
.mt-2 { margin-top: 1.5rem; }

/* ── Cards ────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1.35rem; box-shadow: 0 2px 8px rgba(15,30,60,.06); margin-bottom: 1rem; }
.card h2 { font-size: 1rem; font-weight: 700; margin-bottom: .75rem; color: #0f213d; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }

/* ── Forms ────────────────────────────────────────────────────── */
label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; font-weight: 500; color: var(--text); margin-bottom: .75rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  padding: .45rem .65rem; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .9rem; background: #fff; color: var(--text); width: 100%;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
textarea { resize: vertical; }
.checkbox-label { flex-direction: row; align-items: center; gap: .5rem; }
.checkbox-label input { width: auto; }
.inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; }
.form-row { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.form-row label { margin-bottom: 0; }
.form-actions { margin-top: 1.5rem; }
.input-inline { width: 140px; padding: .3rem .5rem; font-size: .85rem; }
.input-num { width: 70px; }
.select-inline { width: 120px; padding: .3rem .5rem; font-size: .85rem; }
.waitlist-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; align-items: end; }
.waitlist-form button { grid-column: span 1; align-self: end; }

/* ── Buttons ──────────────────────────────────────────────────── */
button, .btn { display: inline-flex; align-items: center; gap: .3rem; padding: .45rem .9rem; border-radius: var(--radius); border: none; cursor: pointer; font-size: .875rem; font-weight: 500; transition: background .15s; }
button[type=submit], .btn-primary { background: var(--primary); color: #fff; }
button[type=submit]:hover, .btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #edf2f7; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-danger-outline { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger-outline:hover { background: #fff5f5; }
.btn-save { background: var(--success); color: #fff; }
.btn-save:hover { background: #2f855a; }
.btn-sm { padding: .25rem .5rem; font-size: .78rem; background: #edf2f7; color: var(--text); border: 1px solid var(--border); }
.btn-sm:hover { background: #e2e8f0; }
.btn-sm.btn-danger { background: #fff5f5; color: var(--danger); border-color: #fed7d7; }
.btn-sm.btn-danger:hover { background: #fed7d7; }
.btn-sm.btn-save { background: #f0fff4; color: var(--success); border-color: #c6f6d5; }
.btn-sm.btn-save:hover { background: #c6f6d5; }

/* ── Attendance Table (scrollbar, sticky Kopf + Datumsspalte) ────── */
.table-scroll {
  overflow: auto;
  max-height: calc(100vh - 200px);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(15, 30, 60, .08), 0 0 0 1px var(--border);
  background: var(--surface);
}
.table-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.table-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; border: 2px solid var(--surface); }
.table-scroll::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.attendance-table { border-collapse: separate; border-spacing: 0; width: 100%; background: var(--surface); font-size: .82rem; }

/* Kopfzeile fixiert beim vertikalen Scrollen */
.attendance-table thead th {
  position: sticky; top: 0; z-index: 3;
  background: linear-gradient(180deg, #1e3a5f 0%, #1a3050 100%);
  color: #fff; padding: .65rem .6rem; text-align: center; white-space: nowrap;
  font-weight: 600; font-size: .76rem; letter-spacing: .02em;
  border-bottom: 2px solid #2c5282;
}
.attendance-table thead th.probation { background: linear-gradient(180deg, #2a4a7f 0%, #243f6e 100%); font-style: italic; }

/* Datumsspalte fixiert beim horizontalen Scrollen */
.attendance-table th.col-date, .attendance-table td.col-date {
  position: sticky; left: 0; z-index: 2;
  text-align: left; min-width: 116px; white-space: nowrap;
}
.attendance-table thead th.col-date { z-index: 4; }
.attendance-table td.col-date {
  background: var(--surface); font-weight: 600; padding-left: .85rem;
  color: #334155; box-shadow: 1px 0 0 var(--border);
}
.attendance-table tbody tr:hover td.col-date { background: #f1f5f9; }

.attendance-table td { padding: .3rem .4rem; border-bottom: 1px solid #edf1f6; text-align: center; vertical-align: middle; }
.attendance-table tbody tr:last-child td { border-bottom: none; }
.attendance-table tbody tr:hover td { background: #f8fafc; }

.row-cancelled td { opacity: .5; }
.tag-ausfall { font-size: .68rem; background: #64748b; color: #fff; border-radius: 999px; padding: 1px 8px; margin-left: .35rem; font-weight: 600; vertical-align: middle; }
.col-actions { width: 80px; white-space: nowrap; }

/* Status-Farben (modern, weicher) */
.status-anwesend    { background: #d1fae5 !important; }
.status-probezeit   { background: #dbeafe !important; }
.status-abgemeldet  { background: #fef3c7 !important; }
.status-unabgemeldet-abwesend{ background: #fee2e2 !important; }
.status-pause       { background: #e2e8f0 !important; }
.status-ausfall     { background: #475569 !important; color: #fff; }

.status-select {
  padding: .35rem .4rem; font-size: .78rem; border: 1px solid transparent;
  border-radius: 7px; width: 100%; cursor: pointer; background: transparent;
  font-weight: 500; color: #1e293b; transition: box-shadow .15s, border-color .15s;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2364748b' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .4rem center; padding-right: 1.2rem;
}
.status-select:hover { border-color: #cbd5e1; }
.status-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(43,108,176,.2); }
.status-anwesend .status-select     { background-color: #d1fae5; }
.status-probezeit .status-select    { background-color: #dbeafe; }
.status-abgemeldet .status-select   { background-color: #fef3c7; }
.status-unabgemeldet-abwesend .status-select { background-color: #fee2e2; }
.status-pause .status-select        { background-color: #e2e8f0; }
.status-text { font-size: .78rem; color: var(--muted); }

/* ── Data Table ───────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); box-shadow: var(--shadow); border-radius: var(--radius); overflow: hidden; font-size: .85rem; }
.data-table th { background: #2d3748; color: #fff; padding: .6rem .75rem; text-align: left; font-weight: 600; font-size: .78rem; }
.data-table td { padding: .45rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f7fafc; }
.muted-table { opacity: .7; }
.note-cell { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions { white-space: nowrap; display: flex; gap: .3rem; align-items: center; }

/* ── Pending Messages ─────────────────────────────────────────── */
.pending-card { margin-bottom: 1rem; }
.card-warning { border-left: 4px solid var(--warning); }
.card-danger  { border-left: 4px solid var(--danger); }
.card-success { border-left: 4px solid var(--success); }
.pending-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: .75rem; flex-wrap: wrap; }
.pending-actions { display: flex; gap: .5rem; flex-shrink: 0; }
.pending-subject { margin-bottom: .5rem; font-size: .85rem; }
.pending-body { font-family: inherit; font-size: .83rem; white-space: pre-wrap; background: #f7fafc; border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem; max-height: 260px; overflow-y: auto; line-height: 1.6; }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; margin-left: .4rem; }
.tag-hint     { background: #e0f2fe; color: #075985; }
.tag-warning  { background: #fef3c7; color: #92400e; }
.tag-removal  { background: #fee2e2; color: #991b1b; }
.tag-probation_passed { background: #d1fae5; color: #065f46; }

/* ── Stats Row (Lesen) ────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .8rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 1rem 1.1rem; text-align: left; position: relative; overflow: hidden;
  box-shadow: 0 2px 8px rgba(15,30,60,.06); transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15,30,60,.1); }
.stat-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.stat-name { font-size: .82rem; font-weight: 600; margin-bottom: .4rem; color: #475569; }
.stat-pct { font-size: 1.9rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.stat-sub { font-size: .74rem; color: var(--muted); margin-top: .3rem; }
.stat-green  .stat-pct { color: #16a34a; }
.stat-yellow .stat-pct { color: #ca8a04; }
.stat-red    .stat-pct { color: #dc2626; }
.stat-green::before  { background: #16a34a; }
.stat-yellow::before { background: #ca8a04; }
.stat-red::before    { background: #dc2626; }
.read-table td { font-size: .82rem; font-weight: 500; }
.ehemalig-col { opacity: .65; font-style: italic; }
.btn-toggle-ehemalig { margin-left: auto; text-decoration: none; display: inline-flex; align-items: center; padding: .4rem .9rem; border-radius: var(--radius); font-size: .82rem; font-weight: 500; border: 1px solid #cbd5e1; background: #f8fafc; color: #475569; transition: background .15s, border-color .15s, color .15s; }
.btn-toggle-ehemalig:hover { background: #edf2f7; border-color: #94a3b8; color: #1e293b; }
.btn-toggle-ehemalig.active { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; }

/* ── Settings ─────────────────────────────────────────────────── */
.settings-section-heading { font-size: 1rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .07em; margin: 2rem 0 .75rem; padding-bottom: .4rem; border-bottom: 2px solid var(--border); }
.card h3 { font-size: .95rem; font-weight: 700; margin-bottom: .75rem; color: #0f213d; }
.card-footer { display: flex; gap: .5rem; margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--border); }
.two-col-form { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.input-suffix { display: flex; align-items: center; gap: .5rem; }
.input-suffix input { width: 80px; flex-shrink: 0; }
.input-suffix span { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.label-plain { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; font-weight: 500; margin-bottom: .75rem; }
.token-row { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.token-code { background: #edf2f7; border-radius: var(--radius); padding: .35rem .6rem; font-family: monospace; font-size: .78rem; word-break: break-all; flex: 1; min-width: 0; }
.smtp-actions { display: flex; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }

/* ── Login ────────────────────────────────────────────────────── */
body.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #1a365d; }
.login-box { background: var(--surface); border-radius: 10px; padding: 2.5rem 2rem; width: 100%; max-width: 360px; box-shadow: 0 8px 32px rgba(0,0,0,.25); }
.login-box h1 { font-size: 1.2rem; font-weight: 700; color: var(--primary); margin-bottom: .25rem; }
.login-box h2 { font-size: .95rem; color: var(--muted); margin-bottom: 1.5rem; }
.login-box label { margin-bottom: 1rem; }
.login-box button { width: 100%; margin-top: .5rem; justify-content: center; padding: .6rem; font-size: .95rem; }
.login-alt { margin-top: 1rem; text-align: center; font-size: .82rem; }
.login-alt a { color: var(--primary); text-decoration: none; }

/* ── Fehlerseite (404) ────────────────────────────────────────── */
body.error-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #1a365d; padding: 1.5rem; }
.error-box { background: var(--surface); border-radius: 14px; padding: 2.75rem 2.25rem; width: 100%; max-width: 440px; text-align: center; box-shadow: 0 8px 32px rgba(0,0,0,.25); }
.error-emoji { font-size: 3rem; line-height: 1; margin-bottom: .75rem; }
.error-box h1 { font-size: 1.35rem; font-weight: 800; color: #0f213d; margin-bottom: .75rem; }
.error-box p { color: var(--muted); font-size: .9rem; line-height: 1.6; margin-bottom: 1.5rem; }
.error-home { text-decoration: none; display: inline-flex; padding: .55rem 1.2rem; justify-content: center; }

/* ── Alerts ───────────────────────────────────────────────────── */
.alert { padding: .6rem .9rem; border-radius: var(--radius); font-size: .85rem; margin-bottom: 1rem; }
.alert-error   { background: #fff5f5; border: 1px solid #fed7d7; color: #c53030; }
.alert-success { background: #f0fff4; border: 1px solid #c6f6d5; color: #276749; }
.smtp-actions { display: flex; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }
.placeholder-legend { display: flex; flex-direction: column; gap: .3rem; background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: .75rem; }
.placeholder-item { font-size: .82rem; color: var(--muted); }
.placeholder-item code { background: #e2e8f0; border-radius: 4px; padding: 1px 5px; font-size: .8rem; color: #1e293b; margin-right: .35rem; }

/* ── Misc ─────────────────────────────────────────────────────── */
.section-heading { font-size: 1rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border); padding-bottom: .4rem; }
.muted { color: var(--muted); }
.empty-hint { color: var(--muted); font-style: italic; padding: 1rem 0; }
.empty-state { text-align: center; padding: 3rem; color: var(--muted); }
