/* RE-IN Corporate Design: Inter, radius 0 (Identitaetsmerkmal),
   Cyan #48C1E9 nur als Flaeche/Linie, Text-Cyan abgedunkelt #0c7797 */
:root {
    --primary: #48C1E9;
    --primary-text: #0c7797;
    --tint: #e6f7fc;
    --secondary: #86bc24;
    --dark: #0E1010;
    --light-gray: #eeeeee;
    --global-border: #f0f0f0;
    --medium-gray: #cacaca;
    --dark-gray: #8a8a8a;
    --alert: #F83B3B;
    --alert-bg: #ffc6c6;
    --alert-text: #9a0000;
    --success-bg: #c9e8c1;
    --success-text: #2a5020;
    --warn-bg: #f7dfbe;
    --warn-text: #7a5410;
    --holiday-bg: #fdf3dd;
    --weekend-bg: #f5f5f5;
}
* { box-sizing: border-box; border-radius: 0 !important; }
body {
    margin: 0;
    font-family: Inter, Helvetica, Roboto, Arial, sans-serif;
    font-size: 15px; line-height: 22px;
    color: var(--dark); background: #ffffff;
}
a { color: var(--primary-text); text-decoration: none; }
a:hover { color: #0a5f78; text-decoration: underline; }

/* --- Kopf & Navigation ------------------------------------- */
header.app { border-bottom: 3px solid var(--primary); }
header.app .inner {
    max-width: 1320px; margin: 0 auto; padding: 0 28px;
    display: flex; align-items: center; gap: 30px; min-height: 64px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .signet { height: 26px; width: 26px; display: block; }
.brand i { width: 1px; height: 22px; background: var(--medium-gray); }
.brand b { font-size: 16px; font-weight: 700; color: var(--primary-text); }
nav.main { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
nav.main a {
    color: var(--dark); font-weight: 600; font-size: 15px;
    padding: 21px 14px 18px; border-bottom: 3px solid transparent; margin-bottom: -3px;
}
nav.main a:hover { color: var(--primary-text); text-decoration: none; }
nav.main a.active { border-bottom-color: var(--primary); color: var(--primary-text); }
.userbox { display: flex; align-items: center; gap: 10px; color: var(--dark-gray); font-size: 14px; white-space: nowrap; }
.avatar {
    width: 32px; height: 32px; flex: none; background: var(--tint); color: var(--primary-text);
    font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center;
}
.burger {
    display: none; width: 44px; height: 44px; margin-left: auto; margin-right: -10px;
    align-items: center; justify-content: center; cursor: pointer; color: var(--dark);
}

main { max-width: 1320px; margin: 0 auto; padding: 30px 28px 56px; }
h1 { font-weight: 700; font-size: 28px; line-height: 36px; margin: 0; letter-spacing: -.01em; }
h2 { font-weight: 700; font-size: 17px; line-height: 24px; margin: 32px 0 14px; }
h2:first-child { margin-top: 0; }
.sub { color: var(--dark-gray); font-size: 14px; margin-top: 4px; }
.muted { color: var(--dark-gray); }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* --- Bausteine ---------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--primary); border: 1px solid var(--primary); color: var(--dark);
    font-weight: 700; padding: 0 18px; height: 40px; font-size: 14px;
    text-decoration: none; cursor: pointer; font-family: inherit;
}
.btn:hover { background: #31b5e2; border-color: #31b5e2; color: var(--dark); text-decoration: none; }
.btn.ghost { background: #ffffff; color: var(--primary-text); }
.btn.ghost:hover { background: var(--tint); color: var(--primary-text); }
.btn.icon { width: 40px; padding: 0; }
.btn.block { width: 100%; }
.btn.sm { height: 36px; padding: 0 14px; }
.btn[disabled], .btn.is-disabled {
    background: var(--light-gray); border-color: var(--light-gray);
    color: var(--dark-gray); cursor: default; pointer-events: none;
}
.btn-plain {
    border: none; background: none; color: var(--primary-text);
    font-weight: 600; cursor: pointer; font-size: 14px; font-family: inherit;
    padding: 0; text-decoration: underline;
}
.btn-plain:hover { color: #0a5f78; }
.btn-plain.danger, .btn-plain.danger:hover { color: var(--alert-text); }

/* Meldungen stehen immer unter einer Ueberschrift oder den Reitern,
   daher Abstand nach oben wie nach unten. */
.error {
    background: var(--alert-bg); color: var(--alert-text);
    border-left: 4px solid var(--alert); padding: 12px 16px; margin: 20px 0;
}
.flash {
    background: var(--success-bg); color: var(--success-text);
    border-left: 4px solid var(--secondary); padding: 12px 16px; margin: 20px 0;
}
/* Hinweis ohne Fehlercharakter (z. B. Abwesenheit ueber geplanten Tagen) */
.notice {
    background: var(--warn-bg); color: var(--warn-text);
    border-left: 4px solid var(--warn-text); padding: 12px 16px; margin: 20px 0;
}
/* Mehrere Aktionen (Link + Formular-Button) nebeneinander in einer Zelle */
.actions { display: flex; align-items: center; gap: 12px; }

.cards { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
.card { border: 1px solid var(--global-border); border-top: 3px solid var(--primary); padding: 16px 18px; }
.card.alert { border-top-color: var(--alert); }
.card.alert .v { color: var(--alert-text); }
.card .k, .fieldlabel {
    font-size: 11px; font-weight: 700; letter-spacing: .07em;
    text-transform: uppercase; color: var(--dark-gray);
}
.card .v { font-size: 27px; font-weight: 700; line-height: 34px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.card .n { font-size: 13px; color: var(--dark-gray); margin-top: 2px; }

.panel { border: 1px solid var(--global-border); padding: 20px; }
.panel.accent { border-left: 3px solid var(--primary); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 24px; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; margin-top: 24px; }
.stack { display: flex; flex-direction: column; gap: 24px; }
.stack > * { margin-top: 0; }

.chip {
    display: inline-flex; align-items: center; gap: 5px; font-size: 12px;
    font-weight: 600; padding: 2px 8px; line-height: 18px; white-space: nowrap;
}
.chip.ok { background: var(--success-bg); color: var(--success-text); }
.chip.rot { background: var(--alert-bg); color: var(--alert-text); }
.chip.warn { background: var(--warn-bg); color: var(--warn-text); }
.chip.cyan { background: var(--tint); color: var(--primary-text); }
.chip.grau { background: var(--light-gray); color: var(--dark); }
.chip.offen { border: 1px solid var(--medium-gray); color: var(--dark-gray); }

.row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--global-border);
}
.row:last-child { border-bottom: none; }

/* --- Tabellen ------------------------------------------------ */
.table-scroll { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; }
table.data th {
    font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--dark-gray); background: #fafafa;
    border-bottom: 1px solid var(--global-border);
    padding: 9px 12px; text-align: left; white-space: nowrap;
}
table.data td {
    border-bottom: 1px solid var(--global-border);
    padding: 10px 12px; text-align: left; vertical-align: middle;
}
table.data tbody tr:hover td { background: #fafafa; }
/* Baum-Zelle (Abteilungen): Einrueckung je Ebene. Die Tiefe liefert die
   View als --depth, weil der Baum frei tief ist - eine Klasse je Ebene
   wuerde irgendwann nicht mehr reichen. */
table.data td.tree { padding-left: calc(12px + var(--depth, 0) * 18px); }
table.data .num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.total td, table.data tr.total th {
    font-weight: 700; background: #fafafa; border-top: 2px solid var(--dark);
    color: var(--dark); text-transform: none; font-size: 15px; letter-spacing: 0;
}
/* Zeile im Bearbeiten-Zustand (?bearbeiten=<id>) */
table.data tr.editing td, table.data tr.editing:hover td { background: #fafafa; }
table.data tr.editing + tr.editing td { padding-top: 0; }
/* Eingabefelder in Bearbeiten-Zeilen fuellen ihre Zelle, sofern nicht
   ausdruecklich schmaler gesetzt (Pers.-Nr., Datum). */
table.data td input[type=text], table.data td input[type=email], table.data td select { width: 100%; }

/* --- Formulare ----------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 5px; margin: 0 0 14px; }
.field > span {
    font-size: 11px; font-weight: 700; letter-spacing: .05em;
    text-transform: uppercase; color: var(--dark-gray);
}
.field-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.field-row .field { margin-bottom: 0; }
.field.grow { flex: 1; }
input[type=text], input[type=email], input[type=date], input[type=number], select {
    font-family: inherit; font-size: 14px; padding: 8px 10px; height: 40px;
    border: 1px solid var(--medium-gray); background: #fff; color: var(--dark);
    max-width: 100%;
}
input[type=checkbox] { width: 16px; height: 16px; vertical-align: -2px; accent-color: var(--primary-text); }
input:focus, select:focus, .btn:focus-visible, a:focus-visible {
    outline: 2px solid var(--primary); outline-offset: -1px;
}
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
form { margin: 0; }

/* --- Kalenderraster (Planung) -------------------------------- */
.cal {
    display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
    border-left: 1px solid var(--global-border); border-top: 1px solid var(--global-border);
}
.cal .wd {
    border-right: 1px solid var(--global-border); border-bottom: 1px solid var(--global-border);
    background: #fafafa; padding: 7px 10px;
    font-size: 11px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--dark-gray);
}
.cal .cell {
    border-right: 1px solid var(--global-border); border-bottom: 1px solid var(--global-border);
    min-height: 104px; padding: 8px 10px;
}
.cal .cell .daybox { display: block; }
.cal .cell .d { font-size: 13px; font-weight: 700; }
.cal .cell .wdm { display: none; font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--dark-gray); }
.cal .cellbody { display: block; min-width: 0; }
.cal .cell .hn { display: block; font-size: 11px; font-weight: 600; color: var(--warn-text); }
.cal .cell.we { background: var(--weekend-bg); }
.cal .cell.hol { background: var(--holiday-bg); }
.cal .cell.out .d { color: var(--medium-gray); }
.cal .pchip { display: block; margin-top: 6px; background: var(--tint); color: var(--primary-text); font-size: 12px; font-weight: 600; padding: 3px 8px; }
/* eingeteilt trotz Abwesenheit: Block-Chip mit Alarmkante */
.cal .pchip.konflikt { border-left: 3px solid var(--alert); }
/* Abwesenheit (Urlaub/Krankheit) am Tag */
.cal .achip { display: block; margin-top: 6px; background: var(--light-gray); color: var(--dark-gray); font-size: 12px; font-weight: 600; padding: 3px 8px; }
.cal .amount { display: block; margin-top: 4px; font-size: 12px; color: var(--dark-gray); font-variant-numeric: tabular-nums; }
.cal .unb { display: block; margin-top: 6px; border-left: 3px solid var(--alert); background: #fff; padding: 3px 8px; color: var(--alert-text); font-size: 12px; font-weight: 700; }
.legend { margin-top: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--dark-gray); margin: 0 22px 6px 0; }
.legend i { width: 14px; height: 14px; border: 1px solid var(--global-border); display: inline-block; }

/* --- Freigabekette (Abrechnung) ------------------------------ */
.steps { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 10px; }
.step .sq { width: 30px; height: 30px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.step.done .sq { background: var(--primary); color: var(--dark); }
.step.now .sq { border: 2px solid var(--primary); color: var(--primary-text); }
.step.next .sq { border: 1px solid var(--medium-gray); color: var(--dark-gray); }
.step .lbl { font-size: 13px; font-weight: 600; }
.step.next .lbl { color: var(--dark-gray); font-weight: 500; }
.conn { flex: 1; height: 2px; background: var(--global-border); min-width: 30px; }
.conn.done { background: var(--primary); }

/* --- Reiter (Verwaltung) ------------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--global-border); margin: 24px 0 0; flex-wrap: wrap; }
.tabs a {
    padding: 10px 16px 9px; font-size: 14px; font-weight: 600; color: var(--dark-gray);
    border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--primary-text); text-decoration: none; }
.tabs a.active { color: var(--primary-text); border-bottom-color: var(--primary); }
h2 + .tabs { margin-top: 8px; }

/* --- Seitennavigation ---------------------------------------- */
nav.pagination { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
nav.pagination .page {
    display: inline-block; padding: 7px 13px; font-size: 14px; font-weight: 600;
    border: 1px solid var(--global-border); text-decoration: none; color: var(--primary-text);
}
nav.pagination a.page:hover { background: var(--primary); color: var(--dark); border-color: var(--primary); text-decoration: none; }
nav.pagination .current { background: var(--primary); color: var(--dark); border-color: var(--primary); }
nav.pagination .disabled { color: var(--medium-gray); }

.ico { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; flex: none; }
.ico.sm { width: 13px; height: 13px; }
.ico.lg { width: 20px; height: 20px; }

/* --- Kleinteile ------------------------------------------------ */
.semi { font-weight: 600; }
.nowrap { white-space: nowrap; }
.period { font-size: 17px; min-width: 70px; text-align: center; }
.period.wide { min-width: 150px; }

/* --- Anmeldung -------------------------------------------------- */
.login { min-height: 68vh; display: flex; align-items: center; justify-content: center; }
.login-card {
    width: 440px; max-width: 100%; border: 1px solid var(--global-border);
    border-top: 3px solid var(--primary); padding: 48px 44px 40px; text-align: center;
}
.login-card svg.rein_logo { height: 44px; width: auto; }
.login-card h1 { font-size: 26px; line-height: 32px; margin: 22px 0 0; }
.login-card .error { text-align: left; }
.login-foot {
    margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--global-border);
    font-size: 13px; line-height: 19px; color: var(--dark-gray);
}
.btn-google {
    margin-top: 34px; width: 100%; height: 48px; display: flex; align-items: center;
    justify-content: center; gap: 12px; background: #ffffff; border: 1px solid var(--medium-gray);
    font-family: inherit; font-size: 15px; font-weight: 600; color: var(--dark);
    cursor: pointer; text-decoration: none;
}
.btn-google:hover { background: #fafafa; color: var(--dark); text-decoration: none; }

/* --- Mobil ---------------------------------------------------- */
@media (max-width: 900px) {
    header.app .inner { flex-wrap: wrap; gap: 0 14px; min-height: 56px; padding: 0 16px; }
    .burger { display: flex; }
    nav.main, header.app .userbox { display: none; width: 100%; }
    #navtoggle:checked + header.app nav.main {
        display: flex; flex-direction: column; gap: 0;
        border-top: 1px solid var(--global-border); padding: 4px 0;
    }
    #navtoggle:checked + header.app nav.main a {
        padding: 0 4px; margin: 0; min-height: 46px; display: flex; align-items: center;
        border-bottom: none; border-left: 3px solid transparent;
    }
    #navtoggle:checked + header.app nav.main a.active { border-left-color: var(--primary); }
    #navtoggle:checked + header.app .userbox {
        display: flex; border-top: 1px solid var(--global-border); padding: 12px 0;
    }
    main { padding: 20px 16px 40px; }
    h1 { font-size: 22px; line-height: 28px; }
    .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .card .v { font-size: 20px; line-height: 26px; }
    .grid-2, .grid-side { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .pagehead { align-items: flex-start; }

    /* Kalenderraster wird zur Tagesliste */
    .cal { display: block; border: none; }
    .cal .wd { display: none; }
    .cal .cell.out { display: none; }
    .cal .cell {
        display: flex; align-items: center; gap: 12px; min-height: 56px;
        border: none; border-bottom: 1px solid var(--global-border); padding: 8px 0;
    }
    .cal .cell.we, .cal .cell.hol { background: none; }
    .cal .cell .daybox {
        width: 46px; height: 46px; flex: none; display: flex; flex-direction: column;
        align-items: center; justify-content: center; border: 1px solid var(--global-border);
    }
    .cal .cell.we .daybox { background: var(--weekend-bg); }
    .cal .cell.hol .daybox { background: var(--holiday-bg); }
    .cal .cell.unbesetzt .daybox { border-left: 3px solid var(--alert); }
    .cal .cell .wdm { display: block; }
    .cal .cellbody { display: flex; flex-direction: column; gap: 3px; }
    .cal .pchip, .cal .achip, .cal .unb, .cal .amount { margin-top: 0; }
    .cal .pchip, .cal .achip, .cal .unb { align-self: flex-start; }
    .cal .unb { border-left: none; padding-left: 0; }
}
@media (max-width: 560px) {
    .cards { grid-template-columns: minmax(0, 1fr); }
    .btn { width: 100%; }
    .toolbar .btn.icon { width: 44px; }
    .field-row { flex-direction: column; align-items: stretch; }
}

/* Mehrere Chips in einer Tabellenzelle brauchen Luft zueinander. */
table.data td .chip { margin: 0 4px 4px 0; }
