:root {
    --brand-color: #76b62f;
    --brand-color-dark: #5f9426;
    --text-color: #222222;
    --bg-color: #f4f6f2;
    --error-color: #c0392b;
    --white: #ffffff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* ---------- Login-Seite ---------- */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    background: var(--white);
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 380px;
    border-top: 5px solid var(--brand-color);
}

.login-box h1 {
    margin-top: 0;
    font-size: 1.4rem;
    color: var(--text-color);
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo {
    display: block;
    height: 56px;
    width: auto;
    margin: 0 auto 1.5rem;
}

.login-box label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.login-box input[type="text"],
.login-box input[type="password"] {
    width: 100%;
    padding: 0.6rem 0.8rem;
    margin-bottom: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.login-box input:focus {
    outline: none;
    border-color: var(--brand-color);
    box-shadow: 0 0 0 2px rgba(118, 182, 47, 0.25);
}

.login-box button {
    width: 100%;
    padding: 0.7rem;
    background-color: var(--brand-color);
    color: var(--white);
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.login-box button:hover {
    background-color: var(--brand-color-dark);
}

.error-message {
    background-color: #fdecea;
    color: var(--error-color);
    padding: 0.7rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ---------- Allgemeines Layout (nach Login) ---------- */

.topbar {
    background-color: var(--brand-color);
    color: var(--white);
    padding: 0.7rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 200;
}

.topbar-logo-link {
    display: flex;
    align-items: center;
}

.topbar-logo {
    height: 32px;
    width: auto;
    display: block;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-icon-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 20px;
    color: var(--white);
    padding: 0.3rem 0.8rem;
    font-size: 0.82rem;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.topbar-icon-btn:hover { background: rgba(255,255,255,0.15); }

@media (max-width: 480px) {
    .topbar { padding: 0.6rem 0.8rem; }
    .topbar-actions { gap: 0.5rem; }
    .topbar-icon-btn { padding: 0.3rem 0.55rem; font-size: 0.76rem; }
    .topbar-logo { height: 26px; }
}

.topbar a {
    color: var(--white);
    text-decoration: none;
    font-weight: 600;
}

.content {
    padding: 1rem 2rem 2rem;
    max-width: 900px;
    margin: 0 auto;
}

/* Für dichte Tabellen-Module (z.B. Finanzen), die den schmalen
   Standard-Lesefluss sprengen würden — bewusst als eigene Klasse statt
   .content selbst zu ändern, damit einfache Seiten (Urlaub, Verwaltung
   etc.) ihre angenehme Lesebreite behalten. */
.content.content-wide {
    max-width: 98%;
}
@media (min-width: 1600px) {
    .content.content-wide { max-width: 1700px; }
}

/* Volle Fensterbreite ohne Obergrenze — für Arbeitsplätze, an denen den
   ganzen Tag EIN Modul offen ist (Telefonjournal am Front Office).
   Zusätzlich zu content-wide zu setzen. */
.content.content-voll { max-width: 100%; padding-left: 1.2rem; padding-right: 1.2rem; }
@media (min-width: 1600px) {
    .content.content-wide.content-voll { max-width: 100%; }
}

.badge-role {
    display: inline-block;
    background-color: var(--brand-color-dark);
    color: var(--white);
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
}

/* ---------- Urlaubsmodul ---------- */

.saldo-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.saldo-card {
    background: var(--white);
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.saldo-card .value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--brand-color-dark);
}

.saldo-card.verfuegbar .value {
    color: var(--brand-color);
}

.saldo-card .label {
    font-size: 0.78rem;
    color: #666;
    margin-top: 0.25rem;
}

.team-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
}
.status-beantragt { background: #fff4de; color: #a3690a; }
.status-genehmigt { background: #e6f4ea; color: #1e7d34; }
.status-abgelehnt { background: #fdecea; color: #c0392b; }
.status-storniert { background: #eee; color: #777; }

.antrag-card {
    background: var(--white);
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.antrag-card .antrag-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.antrag-card .antrag-dates {
    font-weight: 600;
}

.antrag-card .antrag-meta {
    font-size: 0.85rem;
    color: #666;
}

/* ---- Urlaub: Kopfzeile mit Personenauswahl + Gesamtübersicht-Button ---- */
.urlaub-kopf {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin: 1rem 0 1.2rem;
}
.urlaub-kopf-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.urlaub-kopf-controls select {
    padding: 0.5rem 0.7rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.9rem;
}

/* ---- Urlaub: einladende Karte für "Neuen Antrag stellen" ---- */
.urlaub-antrag-card {
    background: linear-gradient(135deg, #f6fbf2, var(--white));
    border: 1px solid #d9ecc9;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.2rem 0 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.urlaub-antrag-intro {
    color: #666;
    margin-top: -0.3rem;
    margin-bottom: 1.1rem;
}
.urlaub-submit-btn {
    background-color: var(--brand-color);
    color: #fff;
    border: none;
    padding: 0.75rem 1.4rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
}
.urlaub-submit-btn:hover { filter: brightness(0.95); }

input[type="date"] {
    font-family: inherit;
    font-size: 0.95rem;
    padding: 0.5rem 0.7rem;
    border: 1.5px solid var(--brand-color);
    border-radius: 6px;
    color: #333;
    background: var(--white);
}
input[type="date"]:focus {
    outline: none;
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px rgba(118, 182, 47, 0.2);
}

/* ---- Urlaub: Gesamtübersicht-Tabelle ---- */
.urlaub-uebersicht-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--white);
}
.urlaub-uebersicht-table th, .urlaub-uebersicht-table td {
    padding: 0.55rem 0.8rem;
    border-bottom: 1px solid #eee;
    text-align: left;
}
.urlaub-uebersicht-table thead th {
    background: #eef3ea;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #667;
    /* Klebt unterhalb der (global sticky) Topbar — gemessene Höhe: 54,375px.
       !important nötig: DataTables' eigenes CSS setzt auf sortierbaren
       th-Zellen "position: relative" mit höherer Spezifität
       (table.dataTable thead > tr > th.sorting), was sonst unser sticky
       zu einem permanent verschobenen "relative" degradieren würde. */
    position: sticky !important;
    top: 55px;
    z-index: 90;
}
.urlaub-uebersicht-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.urlaub-uebersicht-table tbody tr:hover { background: #faf6ed; }
.urlaub-uebersicht-table a { color: var(--brand-color); text-decoration: none; font-weight: 600; }
.urlaub-uebersicht-table a:hover { text-decoration: underline; }
.urlaub-uebersicht-table tfoot th { background: #eef3ea; font-weight: 700; border-top: 2px solid var(--brand-color); padding: 0.55rem 0.7rem; }
#urlaub-uebersicht-table_filter { margin-bottom: 0.8rem; text-align: right; }
#urlaub-uebersicht-table_filter input { border: 1px solid #ccc; border-radius: 6px; padding: 0.4rem 0.6rem; margin-left: 0.5rem; }

@media (max-width: 700px) {
    .urlaub-kopf { flex-direction: column; align-items: flex-start; }
}

.btn-approve {
    background-color: var(--brand-color);
    color: var(--white);
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    font-weight: 600;
    cursor: pointer;
}
.btn-reject {
    background-color: var(--error-color);
    color: var(--white);
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    font-weight: 600;
    cursor: pointer;
}

.days-preview {
    background: #f4f6f2;
    border-radius: 6px;
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.days-preview.warning {
    background: #fff4de;
    color: #a3690a;
}

/* Mobile: großzügigere Touch-Ziele, engere Ränder */
@media (max-width: 600px) {
    .content { padding: 1rem; }
    .saldo-cards { grid-template-columns: repeat(2, 1fr); }
    .antrag-card .antrag-header { flex-direction: column; align-items: flex-start; }
    .btn-approve, .btn-reject { width: 100%; padding: 0.7rem; }
}

/* ===================================================================
   Generische, modul-übergreifende Bausteine: Popup-Formular (Modal),
   Primär-/Sekundärbutton, Formularfeld. Erstmals für Befund-Anfrage
   angelegt, gedacht zur Wiederverwendung in JEDEM künftigen Modul,
   das ein Popup-Formular braucht — Duplizieren vermeiden.
   =================================================================== */
.modal {
    position: fixed; inset: 0; background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 70; padding: 1rem;
}
/* Ohne diese Zeile gewinnt "display: flex" oben gegen das native
   [hidden]-Verhalten des Browsers (bekannte CSS-Falle: Autoren-CSS hat
   bei gleicher Spezifität immer Vorrang vor dem UA-Stylesheet) — das
   Popup würde also beim Laden der Seite sofort sichtbar sein. */
.modal[hidden] {
    display: none;
}
.modal-card {
    background: var(--white); border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 18px rgba(0,0,0,.06);
    width: 440px; max-width: 100%; max-height: 90vh; overflow-y: auto;
    padding: 1.4rem;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; }
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal-close { background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: #667; padding: 0 0.3rem; }
.modal-hint { color: #667; margin: 0 0 0.9rem; font-size: 0.9rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.2rem; }

.field { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; font-size: 0.88rem; margin-top: 0.7rem; }
.field input, .field textarea, .field select {
    padding: 0.6rem 0.7rem; border: 1px solid #e5e5e5; border-radius: 8px;
    font-family: inherit; font-size: 0.95rem; font-weight: normal;
}
.field input:focus, .field textarea:focus, .field select:focus {
    outline: none; border-color: var(--brand-color); box-shadow: 0 0 0 2px rgba(118,182,47,0.2);
}

.btn-primary {
    background: var(--brand-color); color: #fff; border: 0;
    padding: 0.6rem 1.1rem; border-radius: 8px; font-weight: 600; cursor: pointer;
}
.btn-primary:hover { background: var(--brand-color-dark); }
.btn-ghost {
    background: #fff; border: 1px solid #e5e5e5; color: var(--text-color);
    padding: 0.6rem 1rem; border-radius: 8px; font-weight: 600; cursor: pointer;
}
.btn-ghost:hover { background: var(--bg-color); }

@media (max-width: 600px) {
    .modal-card { padding: 1.1rem; }
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions button { width: 100%; }
}
