* { box-sizing: border-box; }
:root {
    --bg: #eef2f7;
    --card: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --line: #dbe3ee;
    --primary: #0f766e;
    --primary-dark: #0a534e;
    --danger: #dc2626;
    --warning: #d97706;
    --ok: #15803d;
    --neutral: #64748b;
    --sidebar: #0f172a;
    --sidebar-text: #e5eefc;
}
html, body { margin: 0; padding: 0; font-family: Inter, Arial, sans-serif; color: var(--text); background: var(--bg); -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
code { background: #f3f4f6; padding: 0.1rem 0.35rem; border-radius: 6px; }
.layout { display: flex; min-height: 100vh; align-items: stretch; background: linear-gradient(to right, var(--sidebar) 0, var(--sidebar) 280px, var(--bg) 280px, var(--bg) 100%); }
.sidebar { width: 280px; background: var(--sidebar); color: var(--sidebar-text); padding: 1.5rem; position: sticky; top: 0; height: 100vh; max-height: 100vh; align-self: flex-start; overflow-y: auto; scrollbar-gutter: stable; }
.brand { margin-bottom: 0.5rem; }
.brand-logo-panel { background: rgba(255, 255, 255, 0.97); border-radius: 18px; padding: 0.7rem 0.85rem; margin-bottom: 1rem; display: flex; justify-content: center; align-items: center; box-shadow: 0 10px 24px rgba(2, 6, 23, 0.22); }
.brand-logo { display: block; width: 100%; max-width: 190px; height: auto; }
.brand-title { font-size: 1.2rem; font-weight: 700; }
.brand-subtitle { color: #94a3b8; margin-top: 0.25rem; }
.nav { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 1.5rem; }
.nav a, .nav-section { padding: 0.8rem 0.95rem; border-radius: 10px; }
.nav a:hover { background: rgba(255, 255, 255, 0.08); }
.nav-section { color: #94a3b8; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 0.75rem; }
.main { flex: 1; padding: 1.5rem; min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }
.content-shell { flex: 1; min-width: 0; }
.app-footer { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.92rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.main-login { max-width: none; width: 100%; margin: 0; display: flex; flex-direction: column; align-items: stretch; justify-content: stretch; min-height: 100vh; padding: 0; }
.main-login .content-shell { display: flex; flex: 1 0 auto; width: 100%; min-height: 100vh; }
.main-login .app-footer { display: none; }
.page-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }
h1, h2, h3 { margin: 0 0 0.75rem 0; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
.card { background: var(--card); border-radius: 18px; padding: 1.2rem; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06); margin-bottom: 1.25rem; }
.card-soft { background: #f8fafc; border-radius: 16px; padding: 1rem; border: 1px solid var(--line); }
.card-head { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 0.93rem; }
.flash { padding: 0.9rem 1rem; border-radius: 12px; margin-bottom: 1rem; }
.flash-success { background: #ecfdf5; color: #14532d; border: 1px solid #bbf7d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.grid { display: grid; gap: 1rem; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.full-width { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
label { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 600; font-size: 0.95rem; }
input, select, textarea, button { font: inherit; }
input[type="text"], input[type="password"], input[type="date"], input[type="datetime-local"], input[type="number"], input[type="color"], select, textarea {
    width: 100%;
    padding: 0.72rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}
textarea { resize: vertical; min-height: 110px; }
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.72rem 1rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-weight: 700;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #e5edf7; color: #0f172a; }
.btn-secondary:hover { background: #d7e3f4; }
.btn-danger { background: #fee2e2; color: #991b1b; }
.btn-danger:hover { background: #fecaca; }
.form-actions, .actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.align-end { align-items: end; }
.checkbox-row { display: flex; gap: 0.6rem; align-items: center; font-weight: 500; }
.checkbox-row input { width: auto; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.6rem; margin-top: 0.75rem; }
.inline-form { display: grid; grid-template-columns: 1.6fr 0.9fr 1fr; gap: 0.6rem; align-items: center; margin-bottom: 0.6rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
.card, .card-soft, .page-top, .card-head, .form-actions, .actions, .checkbox-grid, .inline-form, .table-wrap { min-width: 0; }
th, td { text-align: left; padding: 0.85rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.9rem; color: var(--muted); }
.badge { display: inline-flex; align-items: center; padding: 0.35rem 0.6rem; border-radius: 999px; font-size: 0.85rem; font-weight: 700; white-space: nowrap; }
.badge-ok { background: #dcfce7; color: #166534; }
.badge-warning { background: #ffedd5; color: #9a3412; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-neutral { background: #e2e8f0; color: #334155; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; margin-right: 0.35rem; vertical-align: middle; }
.calendar-nav { display: flex; align-items: center; gap: 0.75rem; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.calendar-weekday, .calendar-cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; }
.calendar-weekday:nth-child(7), .calendar-cell:nth-child(7n) { border-right: none; }
.calendar-weekday { padding: 0.75rem; font-weight: 700; background: #f8fafc; }
.calendar-cell { min-height: 120px; padding: 0.6rem; }
.calendar-date { font-weight: 700; margin-bottom: 0.45rem; }
.calendar-entry { font-size: 0.82rem; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 0.3rem 0.45rem; margin-bottom: 0.35rem; }
.is-other-month { background: #f8fafc; color: var(--muted); }
.login-card { width: 100%; max-width: 560px; background: var(--card); border-radius: 24px; padding: 2rem; box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12); }
.public-logo-panel { display: flex; justify-content: center; align-items: center; margin-bottom: 1.25rem; padding: 0.9rem 1rem; border-radius: 18px; background: #f8fafc; border: 1px solid var(--line); }
.public-logo { display: block; width: min(100%, 260px); height: auto; }
.info-box { margin-top: 1rem; padding: 1rem; border-radius: 14px; background: #f8fafc; border: 1px solid var(--line); }
.danger-zone { margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--line); }
.stat-card { text-align: center; }
.stat-value { font-size: 2rem; font-weight: 800; }
@media (max-width: 1200px) {
    .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
    .layout { background: linear-gradient(to right, var(--sidebar) 0, var(--sidebar) 248px, var(--bg) 248px, var(--bg) 100%); }
    .sidebar { width: 248px; padding: 1.1rem; }
    .main { padding: 1.15rem; }
    .cols-2 { grid-template-columns: 1fr; }
    .inline-form { grid-template-columns: 1fr; }
    .page-top, .card-head, .app-footer { align-items: flex-start; }
    th, td { padding: 0.72rem 0.55rem; }
}

@media (max-width: 1024px) {
    .calendar-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .calendar-weekday:nth-child(n) { display: none; }
    .calendar-cell { min-height: 110px; }
}

@media (max-width: 960px) {
    .layout { display: block; background: var(--bg); }
    .sidebar { position: static; height: auto; max-height: none; width: 100%; overflow: visible; }
    .cols-2, .cols-3, .cols-4, .inline-form { grid-template-columns: 1fr; }
    .main { padding: 1rem; min-height: auto; }
    .page-top, .card-head, .app-footer, .actions, .form-actions { flex-direction: column; align-items: stretch; }
    .actions > *, .form-actions > * { width: 100%; }
    .calendar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .calendar-weekday { display: none; }
}

@media (max-width: 640px) {
    .login-card { padding: 1.25rem; border-radius: 18px; }
    .card { padding: 1rem; border-radius: 16px; }
    .calendar-grid { grid-template-columns: 1fr; }
    th, td { font-size: 0.92rem; }
    .pinboard-grid { grid-template-columns: 1fr; }
    .pinboard-actions { flex-direction: column; }
    .pinboard-actions > *, .pinboard-actions form, .pinboard-actions .btn, .pinboard-actions button { width: 100%; }
}


.btn-small { padding: 0.45rem 0.7rem; border-radius: 10px; font-size: 0.85rem; }
.response-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-top: 0.5rem; }
.response-actions form { margin: 0; }
.simple-list { margin: 0.5rem 0 0 1.2rem; padding: 0; }
.simple-list li { margin-bottom: 0.35rem; }


.inline-details summary { cursor: pointer; color: var(--primary); font-weight: 700; }
.inline-details[open] summary { margin-bottom: 0.45rem; }
.inline-details > div { white-space: pre-wrap; }

.history-details { min-width: 220px; }
.history-list { margin: 0.5rem 0 0 1rem; padding: 0; display: grid; gap: 0.6rem; }
.history-list li { margin: 0; }
.filter-bar { margin-bottom: 1rem; }
.duty-calendar-grid .calendar-cell { min-height: 150px; }
.duty-entry { border-left: 4px solid var(--primary); }
.duty-pending { background: #fff7ed; }
.duty-rejected { background: #fef2f2; }
.duty-approved { background: #f0fdf4; }
.duty-entry.is-own { box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.18); }


 .login-hero {
    position: relative;
    flex: 1 0 auto;
    width: 100%;
    min-height: 100vh;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 3vw, 2.25rem);
    overflow: hidden;
}
.login-image-panel {
    position: absolute;
    inset: 0;
    border-radius: 0;
    overflow: hidden;
    background:
        linear-gradient(rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.62)),
        url('login-bg.jpg?v=4863') center center / cover no-repeat;
    box-shadow: 0 24px 55px rgba(15, 23, 42, 0.16);
}
.login-image-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(238, 242, 247, 0.12), rgba(226, 232, 240, 0.3));
    backdrop-filter: saturate(0.82);
}
.login-card-glass {
    position: relative;
    z-index: 1;
    width: min(100%, 560px);
    margin-inline: auto;
    background: rgba(255, 255, 255, 0.46);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 28px 55px rgba(15, 23, 42, 0.18);
    -webkit-backdrop-filter: blur(16px) saturate(1.08);
    backdrop-filter: blur(16px) saturate(1.08);
}
.public-logo-panel-glass,
.info-box-glass {
    background: rgba(248, 250, 252, 0.52);
    border-color: rgba(255, 255, 255, 0.5);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.login-card-glass input[type="text"],
.login-card-glass input[type="password"] {
    background: rgba(255, 255, 255, 0.76);
    border-color: rgba(148, 163, 184, 0.36);
}
.login-card-glass input[type="text"]:focus,
.login-card-glass input[type="password"]:focus {
    outline: 2px solid rgba(15, 118, 110, 0.18);
    outline-offset: 1px;
}

@media (max-width: 960px) {
    .login-hero {
        min-height: 100vh;
        height: 100vh;
        padding: 1rem;
    }
    .login-image-panel {
        border-radius: 0;
    }
}

@media (max-width: 640px) {
    .login-hero {
        padding: 0;
    }
    .login-image-panel {
        display: none;
    }
    .login-card-glass {
        background: var(--card);
        border: 1px solid var(--line);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12);
    }
}


.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.table-search {
    min-width: 260px;
    max-width: 420px;
}

.filter-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: end;
}

.multi-select {
    min-height: 7.5rem;
}

.multi-select option {
    padding: 0.35rem 0.45rem;
}


@media (max-width: 800px) {
    .filter-panel {
        grid-template-columns: 1fr;
    }

    .multi-select {
        min-height: 6rem;
    }
}


.table-integrated-form { display: none; }
.table-filter-row th {
    background: #f8fbff;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
    vertical-align: top;
}
.table-filter-row select {
    width: 100%;
    min-width: 0;
}
.table-filter-row .muted {
    display: inline-block;
    padding: 0.45rem 0;
}

.breadcrumb-list { display: flex; gap: 0.45rem; flex-wrap: wrap; align-items: center; }

.pinboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.pinboard-tile {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 1rem;
    min-height: 260px;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}
.pinboard-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 30px rgba(15, 23, 42, 0.1);
}
.pinboard-tile-main {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
    min-height: 0;
    align-items: flex-start;
}
.pinboard-icon {
    width: 96px;
    height: 96px;
    position: relative;
    flex: 0 0 auto;
    display: block;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}
.pinboard-icon::before,
.pinboard-icon::after {
    content: none !important;
    display: none !important;
}
.pinboard-icon-folder {
    margin-top: 0.15rem;
    background-image: url('pinboard-folder-icon.png');
}
.pinboard-icon-file {
    background-image: url('pinboard-file-icon.png');
}
.pinboard-title {
    font-weight: 800;
    font-size: 1rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
.pinboard-description {
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3.9em;
}
.pinboard-meta {
    display: grid;
    gap: 0.35rem;
    font-size: 0.87rem;
    color: var(--muted);
    padding-top: 0.2rem;
    border-top: 1px solid var(--line);
}
.pinboard-meta strong { color: var(--text); }
.pinboard-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.pinboard-actions form { margin: 0; }
.pinboard-empty {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    text-align: center;
    border: 1px dashed var(--line);
    border-radius: 18px;
    background: #f8fafc;
    padding: 1.5rem;
}
.pinboard-empty .pinboard-icon-folder {
    transform: scale(1.1);
}

/* Mobile UI Erweiterungen */
.sidebar-overlay,
.mobile-topbar,
.sidebar-mobile-head,
.sidebar-close {
    display: none;
}

.mobile-topbar {
    align-items: center;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 70;
    margin: -1.5rem -1.5rem 1rem;
    padding: calc(0.75rem + env(safe-area-inset-top, 0px)) 1rem 0.75rem;
    background: rgba(238, 242, 247, 0.94);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(219, 227, 238, 0.95);
}

.mobile-menu-toggle,
.sidebar-close {
    min-height: 44px;
    padding: 0.72rem 0.95rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    font-weight: 700;
}

.mobile-topbar-text {
    min-width: 0;
    flex: 1;
}

.mobile-topbar-app {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mobile-topbar-page {
    font-size: 1rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-mobile-head {
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.sidebar-mobile-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.table-wrap {
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 960px) {
    body.sidebar-open {
        overflow: hidden;
    }

    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 79;
        border: 0;
        padding: 0;
        background: rgba(15, 23, 42, 0.46);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.22s ease;
    }

    body.sidebar-open .sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(88vw, 320px);
        max-width: 320px;
        height: 100dvh;
        max-height: 100dvh;
        overflow-y: auto;
        z-index: 80;
        transform: translateX(calc(-100% - 16px));
        transition: transform 0.24s ease;
        padding: 1rem;
        box-shadow: 0 28px 48px rgba(2, 6, 23, 0.34);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-mobile-head,
    .sidebar-close,
    .mobile-topbar {
        display: flex;
    }

    .main-auth {
        padding: 0 0.8rem 0.8rem;
    }

    .page-top {
        margin-bottom: 1rem;
        padding-inline: 0.15rem;
    }

    .page-top h1 {
        font-size: 1.45rem;
        margin-bottom: 0.35rem;
    }

    .card,
    .card-soft {
        border-radius: 16px;
    }

    input[type="text"], input[type="password"], input[type="date"], input[type="datetime-local"], input[type="number"], input[type="color"], input[type="search"], select, textarea {
        min-height: 48px;
        font-size: 16px;
    }

    textarea {
        min-height: 120px;
    }

    button,
    .btn {
        min-height: 48px;
    }

    .btn-small {
        min-height: 40px;
    }

    .table-toolbar {
        align-items: stretch;
    }

    .table-search {
        min-width: 0;
        max-width: none;
    }

    table[data-mobile-cards="1"],
    table[data-mobile-cards="1"] tbody,
    table[data-mobile-cards="1"] tr,
    table[data-mobile-cards="1"] td {
        display: block;
        width: 100%;
    }

    table[data-mobile-cards="1"] {
        border-collapse: separate;
        border-spacing: 0;
    }

    table[data-mobile-cards="1"] thead {
        display: none;
    }

    table[data-mobile-cards="1"] tbody {
        display: grid;
        gap: 0.9rem;
    }

    table[data-mobile-cards="1"] tr {
        background: var(--card);
        border: 1px solid var(--line);
        border-radius: 16px;
        padding: 0.3rem 0.9rem;
        box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
    }

    table[data-mobile-cards="1"] td {
        min-width: 0;
        padding: 0.72rem 0;
        border-bottom: 1px solid var(--line);
    }

    table[data-mobile-cards="1"] td:last-child {
        border-bottom: none;
    }

    table[data-mobile-cards="1"] td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.28rem;
        color: var(--muted);
        font-size: 0.8rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

    table[data-mobile-cards="1"] td[data-label=""]::before {
        display: none;
    }

    table[data-mobile-cards="1"] .actions,
    table[data-mobile-cards="1"] .form-actions,
    table[data-mobile-cards="1"] .response-actions,
    table[data-mobile-cards="1"] form {
        width: 100%;
    }

    table[data-mobile-cards="0"] {
        min-width: 760px;
    }
}

@media (max-width: 640px) {
    .mobile-topbar {
        margin: -1rem -1rem 0.9rem;
        padding-inline: 0.85rem;
    }

    .mobile-menu-toggle,
    .sidebar-close {
        padding-inline: 0.82rem;
    }


    .app-footer {
        padding-bottom: calc(0.3rem + env(safe-area-inset-bottom, 0px));
    }
}
