* {
    box-sizing: border-box;
}

:root {
    --bg: #07122b;
    --bg-2: #091733;
    --panel: rgba(10, 22, 52, 0.92);
    --panel-2: rgba(18, 32, 68, 0.98);
    --line: rgba(255,255,255,0.10);
    --line-soft: rgba(255,255,255,0.07);
    --text: #f3f6fb;
    --muted: #9ea9bf;
    --accent1: #2c6fa3;
    --accent2: #1f4f78;
    --success: #15803d;
    --danger: #b91c1c;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: Inter, Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(44,111,163,0.22), transparent 35%),
        linear-gradient(180deg, #050d20, #07122b 35%, #071734 100%);
    color: var(--text);
}

body {
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

.app-layout {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 270px;
    height: 100vh;
    background: linear-gradient(180deg, var(--accent1), var(--accent2));
    border-right: 1px solid rgba(255,255,255,0.10);
    padding: 18px 16px;
    z-index: 60;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.03), 0 18px 45px rgba(0,0,0,0.28);
}

.sidebar-header {
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    margin-bottom: 16px;
}

.sidebar-brand {
    font-size: 1.18rem;
    font-weight: 800;
    line-height: 1.2;
    color: #fff;
}

.sidebar-subbrand {
    margin-top: 4px;
    color: rgba(255,255,255,0.75);
    font-size: 0.92rem;
}

.sidebar-user {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px;
    margin-bottom: 16px;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 18px;
    backdrop-filter: blur(6px);
}

.sidebar-user strong {
    font-size: 1rem;
    color: #fff;
}

.sidebar-user span,
.sidebar-user small {
    color: rgba(255,255,255,0.78);
}

.sidebar-nav {
    display: grid;
    gap: 10px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 12px 14px;
    border-radius: 16px;
    text-decoration: none;
    color: #fff;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
    font-weight: 700;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.sidebar-link:hover {
    transform: translateX(2px);
    background: rgba(255,255,255,0.11);
    border-color: rgba(255,255,255,0.20);
}

.logout-link {
    margin-top: 8px;
}

.menu-svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.main-area {
    margin-left: 270px;
    min-height: 100vh;
    min-width: 0;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px;
}

.login-header {
    padding: 20px;
    border-bottom: 1px solid var(--line);
    background: rgba(7, 18, 43, 0.9);
}

.brand {
    font-size: 1.18rem;
    font-weight: 800;
}

.subbrand {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.96rem;
}

.mobile-topbar,
.mobile-sidebar-overlay {
    display: none;
}

.card {
    background: rgba(7, 18, 43, 0.90);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 18px;
    margin-bottom: 18px;
    box-shadow: 0 14px 40px rgba(0,0,0,0.20);
    min-width: 0;
}

.narrow-card {
    max-width: 460px;
    margin: 40px auto;
}

h1,
h2 {
    margin-top: 0;
    line-height: 1.15;
}

.muted {
    color: var(--muted);
}

.flash {
    padding: 14px 16px;
    border-radius: 18px;
    margin-bottom: 16px;
    font-weight: 700;
}

.flash.success {
    background: rgba(21, 128, 61, 0.18);
    border: 1px solid rgba(34, 197, 94, 0.30);
}

.flash.error {
    background: rgba(185, 28, 28, 0.18);
    border: 1px solid rgba(239, 68, 68, 0.30);
}

.toolbar,
.section-header,
.action-row,
.button-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.button-row.compact {
    justify-content: flex-start;
}

.filters {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.form-grid.single-col {
    grid-template-columns: 1fr;
}

.full-row {
    grid-column: 1 / -1;
}

label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-weight: 700;
    min-width: 0;
}

.checkbox-line {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding-top: 34px;
}

.checkbox-line input {
    width: auto;
}

input,
select,
textarea,
button,
.btn {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(14, 25, 55, 0.96);
    color: var(--text);
    padding: 12px 14px;
    font-size: 1rem;
    outline: none;
    min-width: 0;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(96, 165, 250, 0.5);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 10px 14px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.05);
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    font-weight: 700;
    text-align: center;
}

.btn:hover {
    background: rgba(255,255,255,0.10);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent1), var(--accent2));
    border-color: transparent;
}

.btn-danger {
    background: rgba(185, 28, 28, 0.20);
    border-color: rgba(239, 68, 68, 0.28);
}

.btn-small {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 0.88rem;
}

.stats-grid,
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

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

.stat-box {
    background: rgba(10, 22, 52, 0.76);
    border: 1px solid var(--line-soft);
    border-radius: 18px;
    padding: 16px;
}

.stat-label {
    color: var(--muted);
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
}

.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.82rem;
    font-weight: 700;
    border: 1px solid rgba(255,255,255,0.10);
}

.pill.admin {
    background: rgba(59, 130, 246, 0.18);
    color: #bfdbfe;
}

.pill.user {
    background: rgba(148, 163, 184, 0.16);
    color: #e2e8f0;
}

.pill.active {
    background: rgba(21, 128, 61, 0.18);
    color: #bbf7d0;
}

.pill.inactive {
    background: rgba(185, 28, 28, 0.18);
    color: #fecaca;
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: top;
}

th {
    color: #dbe4f2;
    font-size: 0.92rem;
}

tfoot th,
tfoot td {
    border-top: 2px solid rgba(255,255,255,0.14);
    border-bottom: none;
}

.empty {
    color: var(--muted);
    text-align: center;
}

.report-body {
    background: #fff;
    color: #111;
}

.report-body table,
.report-body th,
.report-body td {
    color: #111;
    border-color: #d1d5db;
}

.report-body .btn {
    color: #111;
}

.report-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.quick-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-decoration: none;
    padding: 14px;
    border-radius: 16px;
    background: rgba(20,39,78,0.9);
    border: 1px solid rgba(255,255,255,0.08);
    color: #fff;
}

.quick-card:hover {
    background: rgba(30,55,100,0.95);
}

.quick-title {
    font-weight: 800;
    font-size: 1rem;
}

.quick-text {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.75);
}

.quick-card-primary {
    background: linear-gradient(135deg, #22c55e, #15803d);
    border: none;
}

.quick-card-primary .quick-text {
    color: rgba(255,255,255,0.9);
}

.quick-svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.section,
.quick-section {
    margin-top: 20px;
}
.quick-section {
    margin-top: 25px;
}
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

.status-dot-green {
    background: #22c55e;
}

.status-dot-red {
    background: #ef4444;
}

.action-buttons {
    white-space: nowrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
}

.nav-icon svg,
.nav-icon .icon {
    width: 22px;
    height: 22px;
    display: block;
}

.inline-form {
    display: inline;
}

/* Sidebar Logo */
.sidebar-logo {
    width: 100%;
    max-width: 160px;
    height: auto;
    display: block;
    background: rgba(255,255,255,0.96);
    border-radius: 12px;
    padding: 6px 8px;
}

/* Mobile Topbar Logo */
.topbar-logo {
    width: 32px;
    height: auto;
    border-radius: 8px;
    background: rgba(255,255,255,0.95);
    padding: 2px;
}

/* ===== Templates / Vorlagen ===== */

.templates-table {
    width: 100%;
    table-layout: fixed;
}

.templates-table th,
.templates-table td {
    vertical-align: top;
    word-break: break-word;
}

.templates-table th:nth-child(1),
.templates-table td:nth-child(1) {
    width: 34%;
}

.templates-table th:nth-child(2),
.templates-table td:nth-child(2) {
    width: 24%;
}

.templates-table th:nth-child(3),
.templates-table td:nth-child(3) {
    width: 16%;
    white-space: nowrap;
}

.templates-table th:nth-child(4),
.templates-table td:nth-child(4) {
    width: 26%;
}

.action-buttons-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    white-space: normal;
}

.action-buttons-stack .btn,
.action-buttons-stack .inline-form {
    flex: 1 1 120px;
}

.action-buttons-stack .inline-form .btn {
    width: 100%;
}

/* ===== Monat / Jahr kompakt ===== */

.page-compact .card {
    padding: 14px;
    border-radius: 20px;
    margin-bottom: 14px;
}

.compact-hero h1 {
    margin-bottom: 6px;
    font-size: 2.2rem;
}

.compact-toolbar,
.compact-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.compact-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.compact-filters-year {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.filter-span-2 {
    grid-column: span 2;
}

.filter-action {
    display: flex;
    align-items: flex-end;
}

.filter-action .btn {
    width: 100%;
}

.compact-stats {
    margin-top: 12px;
    gap: 10px;
}

.compact-stats-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.always-card-list {
    display: grid;
    gap: 10px;
}

.mobile-entry-card,
.mobile-total-card {
    background: linear-gradient(180deg, rgba(20,39,78,0.92), rgba(11,24,49,0.96));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    padding: 13px;
}

.total-highlight-card {
    box-shadow: inset 0 0 0 1px rgba(243,107,33,0.18);
}

.mobile-entry-top,
.mobile-total-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.mobile-entry-date,
.mobile-total-title {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.2;
}

.mobile-entry-hours,
.mobile-total-value {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.2;
    color: #d9ecff;
    white-space: nowrap;
}

.mobile-entry-grid,
.mobile-total-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
}

.mobile-span-2 {
    grid-column: 1 / -1;
}

.mobile-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.mobile-meta-label {
    font-size: 0.74rem;
    line-height: 1.1;
    color: var(--muted);
}

.mobile-meta-value {
    font-size: 0.92rem;
    line-height: 1.28;
    color: #fff;
    word-break: break-word;
}

.mobile-entry-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.mobile-entry-actions .btn {
    flex: 1 1 auto;
}

/* ===== Admin Totale pro Benutzer ===== */

.user-total-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 8px;
}

.user-total-card {
    background: linear-gradient(180deg, rgba(17, 33, 69, 0.96), rgba(10, 24, 52, 0.98));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 18px;
    box-shadow: 0 10px 28px rgba(0,0,0,0.14);
}

.user-total-head {
    margin-bottom: 14px;
}

.user-total-name {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
}

.user-total-mail {
    margin-top: 4px;
    font-size: 0.92rem;
    color: var(--muted);
    word-break: break-word;
}

.user-total-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.user-total-stat {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 12px;
}

.user-total-label {
    display: block;
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 6px;
}

.user-total-stat strong {
    display: block;
    font-size: 1.15rem;
    color: #fff;
    line-height: 1.2;
}

.user-total-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.user-total-actions .btn {
    min-width: 88px;
}

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .user-total-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        width: 280px;
    }

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

    .mobile-sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.45);
        opacity: 0;
        visibility: hidden;
        transition: 0.2s ease;
        z-index: 55;
    }

    .mobile-sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    .mobile-topbar {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 14px 16px;
        position: sticky;
        top: 0;
        z-index: 54;
        background: rgba(7, 18, 43, 0.95);
        border-bottom: 1px solid var(--line);
        backdrop-filter: blur(10px);
    }

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

    .mobile-menu-toggle {
        width: 46px;
        height: 46px;
        border-radius: 14px;
        border: 1px solid rgba(255,255,255,0.10);
        background: rgba(255,255,255,0.05);
        padding: 0;
        cursor: pointer;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        flex-shrink: 0;
    }

    .mobile-menu-toggle span {
        display: block;
        width: 19px;
        height: 2px;
        border-radius: 999px;
        background: #fff;
    }

    .main-area {
        margin-left: 0;
    }

    .container {
        padding: 14px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .grid-2,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 14px;
        border-radius: 18px;
    }

    .stat-box {
        padding: 12px;
        border-radius: 16px;
    }

    .stat-label {
        font-size: 0.82rem;
        margin-bottom: 6px;
    }

    .stat-value {
        font-size: 1.2rem;
        line-height: 1.15;
    }

    .checkbox-line {
        padding-top: 0;
    }

    .quick-grid {
        grid-template-columns: 1fr;
    }

    .compact-filters,
    .compact-filters-year {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .filter-span-2,
    .filter-action {
        grid-column: 1 / -1;
    }

    .compact-stats-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .compact-stats-3 .stat-box:last-child {
        grid-column: 1 / -1;
    }

    .compact-buttons {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .compact-buttons .btn {
        min-width: 0;
        width: 100%;
    }

    .page-compact .card {
        padding: 12px;
        border-radius: 18px;
        margin-bottom: 12px;
    }

    .compact-hero h1 {
        font-size: 1.55rem;
        margin-bottom: 4px;
    }

    .page-compact .hero-kicker {
        margin-bottom: 8px;
        padding: 5px 9px;
        font-size: 0.78rem;
    }

    .page-compact .stat-box {
        padding: 12px;
        border-radius: 16px;
    }

    .page-compact .stat-label {
        font-size: 0.86rem;
        margin-bottom: 6px;
    }

    .page-compact .stat-value {
        font-size: 1.35rem;
        margin-bottom: 4px;
    }

    .mobile-entry-card,
    .mobile-total-card {
        padding: 12px;
        border-radius: 16px;
    }

    .mobile-entry-grid,
    .mobile-total-grid {
        gap: 7px 8px;
    }

    .mobile-entry-date,
    .mobile-total-title,
    .mobile-entry-hours,
    .mobile-total-value {
        font-size: 0.96rem;
    }

    .mobile-meta-value {
        font-size: 0.88rem;
    }

    .templates-table {
        min-width: 0;
    }

    .templates-table thead th {
        font-size: 0.84rem;
        padding: 10px 8px;
    }

    .templates-table td {
        padding: 10px 8px;
        font-size: 0.92rem;
    }

    .templates-table th:nth-child(1),
    .templates-table td:nth-child(1) {
        width: 30%;
    }

    .templates-table th:nth-child(2),
    .templates-table td:nth-child(2) {
        width: 22%;
    }

    .templates-table th:nth-child(3),
    .templates-table td:nth-child(3) {
        width: 14%;
    }

    .templates-table th:nth-child(4),
    .templates-table td:nth-child(4) {
        width: 34%;
    }

    .action-buttons-stack {
        flex-direction: column;
        align-items: stretch;
    }

    .action-buttons-stack .btn,
    .action-buttons-stack .inline-form,
    .action-buttons-stack .inline-form .btn {
        width: 100%;
        flex: 1 1 auto;
    }

    .action-buttons {
        white-space: normal;
    }
}

@media (max-width: 640px) {
    .user-total-card {
        padding: 14px;
        border-radius: 16px;
    }

    .user-total-name {
        font-size: 1rem;
    }

    .user-total-mail {
        font-size: 0.84rem;
    }

    .user-total-stats {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .user-total-stat {
        padding: 10px 12px;
        border-radius: 14px;
    }

    .user-total-stat strong {
        font-size: 1rem;
    }

    .user-total-actions {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .user-total-actions .btn {
        min-width: 0;
        width: 100%;
        padding-left: 8px;
        padding-right: 8px;
    }
}

@media print {
    .sidebar,
    .mobile-topbar,
    .mobile-sidebar-overlay,
    .no-print {
        display: none !important;
    }

    .main-area {
        margin-left: 0 !important;
    }

    body,
    .report-body {
        background: #fff;
        color: #111;
    }

    .report-shell,
    .container {
        max-width: none;
        margin: 0;
        padding: 0;
    }
}


/* ===== Templates mobil komplett umbrechen ===== */
@media (max-width: 860px) {
    .table-wrap {
        overflow-x: visible;
    }

    .templates-table,
    .templates-table thead,
    .templates-table tbody,
    .templates-table tr,
    .templates-table th,
    .templates-table td {
        display: block;
        width: 100%;
    }

    .templates-table {
        table-layout: auto;
    }

    .templates-table thead {
        display: none;
    }

    .templates-table tbody tr {
        background: rgba(255,255,255,0.03);
        border: 1px solid rgba(255,255,255,0.08);
        border-radius: 16px;
        padding: 12px;
        margin-bottom: 12px;
    }

    .templates-table tbody td {
        border: none;
        padding: 6px 0;
        white-space: normal !important;
        word-break: break-word;
    }

    .templates-table tbody td:nth-child(1)::before {
        content: "Einsatz";
        display: block;
        font-size: 0.78rem;
        color: var(--muted);
        margin-bottom: 4px;
        font-weight: 700;
    }

    .templates-table tbody td:nth-child(2)::before {
        content: "Ort";
        display: block;
        font-size: 0.78rem;
        color: var(--muted);
        margin-bottom: 4px;
        font-weight: 700;
    }

    .templates-table tbody td:nth-child(3)::before {
        content: "Status";
        display: block;
        font-size: 0.78rem;
        color: var(--muted);
        margin-bottom: 4px;
        font-weight: 700;
    }

    .templates-table tbody td:nth-child(4)::before {
        content: "Aktionen";
        display: block;
        font-size: 0.78rem;
        color: var(--muted);
        margin-bottom: 6px;
        font-weight: 700;
    }

    .templates-table th:nth-child(1),
    .templates-table td:nth-child(1),
    .templates-table th:nth-child(2),
    .templates-table td:nth-child(2),
    .templates-table th:nth-child(3),
    .templates-table td:nth-child(3),
    .templates-table th:nth-child(4),
    .templates-table td:nth-child(4) {
        width: 100% !important;
    }

    .templates-table .action-buttons-stack {
        display: flex;
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }

    .templates-table .action-buttons-stack .btn,
    .templates-table .action-buttons-stack .inline-form,
    .templates-table .action-buttons-stack .inline-form .btn {
        width: 100%;
    }

    .templates-table .action-buttons-stack .inline-form {
        display: block;
    }
}

/* ===== Templates sauber ===== */
.templates-table {
    width: 100%;
    table-layout: fixed;
}

.templates-table th,
.templates-table td {
    vertical-align: top;
    word-break: break-word;
}

.templates-table th:nth-child(1),
.templates-table td:nth-child(1) {
    width: 34%;
}

.templates-table th:nth-child(2),
.templates-table td:nth-child(2) {
    width: 24%;
}

.templates-table th:nth-child(3),
.templates-table td:nth-child(3) {
    width: 16%;
    white-space: nowrap;
}

.templates-table th:nth-child(4),
.templates-table td:nth-child(4) {
    width: 26%;
}

.action-buttons-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    white-space: normal;
}

.action-buttons-stack .btn,
.action-buttons-stack .inline-form {
    flex: 1 1 120px;
}

.action-buttons-stack .inline-form .btn {
    width: 100%;
}

.templates-mobile {
    display: none;
}

.template-mobile-card {
    background: linear-gradient(180deg, rgba(17, 33, 69, 0.96), rgba(10, 24, 52, 0.98));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    padding: 14px;
    margin-bottom: 12px;
}

.template-mobile-head {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.template-mobile-head h3 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.25;
}

.template-mobile-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 700;
}

.template-mobile-status.is-active {
    color: #bbf7d0;
}

.template-mobile-status.is-inactive {
    color: #fecaca;
}

.template-mobile-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.template-mobile-label {
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 700;
}

.template-mobile-value {
    font-size: 0.95rem;
    line-height: 1.3;
    word-break: break-word;
}

.template-mobile-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template-mobile-actions .btn,
.template-mobile-actions form,
.template-mobile-actions form .btn {
    width: 100%;
}

@media (max-width: 860px) {
    .templates-desktop {
        display: none;
    }

    .templates-mobile {
        display: block;
    }
}
/* FIX: Desktop vs Mobile sauber trennen */

.templates-desktop {
    display: block;
}

.templates-mobile {
    display: none;
}

@media (max-width: 860px) {
    .templates-desktop {
        display: none !important;
    }

    .templates-mobile {
        display: block !important;
    }
}
@media (max-width: 860px) {
    .container {
        padding: 18px 14px 14px;
    }

    .container > .card:first-child {
        margin-top: 10px;
    }
}
@media (max-width: 860px) {
    .mobile-topbar {
        padding: 16px;
    }
}
@media (max-width: 860px) {
    .mobile-topbar {
        margin-bottom: 14px !important;
    }

    .main-area {
        padding-top: 0 !important;
    }

    .container {
        padding-top: 0 !important;
    }

    .container > section:first-of-type,
    .container > .card:first-of-type {
        margin-top: 14px !important;
    }
}
@media (max-width: 860px) {
    .page-compact .card {
        padding: 16px !important;
        margin-bottom: 18px !important;
    }

    .page-compact .section-header,
    .page-compact .compact-section-header {
        margin-bottom: 14px !important;
    }

    .page-compact h2 {
        margin: 0 0 14px 0 !important;
        line-height: 1.15 !important;
    }

    .page-compact .button-row,
    .page-compact .compact-buttons {
        margin-bottom: 12px !important;
    }

    .page-compact .button-row .btn,
    .page-compact .compact-buttons .btn {
        min-height: 50px;
    }

    .page-compact .empty,
    .page-compact .mobile-entry-card,
    .page-compact .mobile-total-card,
    .page-compact .stat-box {
        margin-top: 10px !important;
    }
}
/* ===== Dashboard Tabelle mobil sauber ===== */
.dashboard-table-wrap {
    width: 100%;
    max-width: 100%;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
}

.dashboard-table th,
.dashboard-table td {
    vertical-align: top;
    word-break: break-word;
}

@media (max-width: 860px) {
    .dashboard-table-wrap {
        overflow-x: hidden;
    }

    .dashboard-table,
    .dashboard-table thead,
    .dashboard-table tbody,
    .dashboard-table tr,
    .dashboard-table th,
    .dashboard-table td {
        display: block;
        width: 100%;
    }

    .dashboard-table thead {
        display: none;
    }

    .dashboard-table tr {
        background: rgba(255,255,255,0.03);
        border: 1px solid rgba(255,255,255,0.08);
        border-radius: 16px;
        padding: 12px;
        margin-bottom: 12px;
    }

    .dashboard-table td {
        border: none;
        padding: 6px 0;
        white-space: normal;
    }

    .dashboard-table td::before {
        display: block;
        font-size: 0.78rem;
        color: var(--muted);
        font-weight: 700;
        margin-bottom: 4px;
    }

    .dashboard-table td:nth-child(1)::before { content: "Benutzer"; }
    .dashboard-table td:nth-child(2)::before { content: "Datum"; }
    .dashboard-table td:nth-child(3)::before { content: "Einsatz"; }
    .dashboard-table td:nth-child(4)::before { content: "Ort"; }
    .dashboard-table td:nth-child(5)::before { content: "Stunden"; }
    .dashboard-table td:nth-child(6)::before { content: "Betrag"; }
}
/* ===== Users mobil ===== */
.users-desktop {
    display: block;
}

.users-mobile {
    display: none;
}

.users-table {
    width: 100%;
    table-layout: fixed;
}

.users-table th,
.users-table td {
    vertical-align: top;
    word-break: break-word;
}

.users-table th:nth-child(1),
.users-table td:nth-child(1) {
    width: 18%;
}

.users-table th:nth-child(2),
.users-table td:nth-child(2) {
    width: 28%;
}

.users-table th:nth-child(3),
.users-table td:nth-child(3) {
    width: 12%;
}

.users-table th:nth-child(4),
.users-table td:nth-child(4) {
    width: 12%;
}

.users-table th:nth-child(5),
.users-table td:nth-child(5) {
    width: 15%;
}

.users-table th:nth-child(6),
.users-table td:nth-child(6) {
    width: 15%;
}

.user-mobile-card {
    background: linear-gradient(180deg, rgba(17, 33, 69, 0.96), rgba(10, 24, 52, 0.98));
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    padding: 14px;
    margin-bottom: 12px;
}

.user-mobile-head {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.user-mobile-head h3 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.25;
}

.user-mobile-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.user-mobile-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.user-mobile-label {
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 700;
}

.user-mobile-value {
    font-size: 0.95rem;
    line-height: 1.3;
    word-break: break-word;
}

.user-mobile-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-mobile-actions .btn,
.user-mobile-actions form,
.user-mobile-actions form .btn {
    width: 100%;
}

@media (max-width: 860px) {
    .users-desktop {
        display: none !important;
    }

    .users-mobile {
        display: block !important;
    }
}