/* Lohnportal - Vatter Design (angelehnt an profi.vatter.de) */

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

body {
    font-family: 'Open Sans', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: #2B2B2B;
    background-color: #f4f6f9;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: #003781;
    text-decoration: none;
}

a:hover {
    color: #D7192F;
}

/* === Header === */
.header {
    background: #003781;
    color: #fff;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo img {
    height: 36px;
}

.header-logo h1 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 1px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-nav a {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    padding: 8px 14px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}

.header-nav a:hover,
.header-nav a.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.header-user {
    color: rgba(255,255,255,0.7);
    font-size: 13px;
}

.header-user strong {
    color: #fff;
}

/* === Login === */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #003781 0%, #001f4d 100%);
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card .logo-area {
    text-align: center;
    margin-bottom: 32px;
}

.login-card .logo-area img {
    height: 48px;
    margin-bottom: 12px;
}

.login-card .logo-area h2 {
    color: #003781;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
}

.login-card .logo-area p {
    color: #7A7A7A;
    font-size: 14px;
    margin-top: 4px;
}

/* === Forms === */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #003781;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    border: 2px solid #E5E5E5;
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    font-family: inherit;
}

.form-control:focus {
    border-color: #003781;
    box-shadow: 0 0 0 3px rgba(0,55,129,0.1);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: inherit;
}

.btn-primary {
    background: #D7192F;
    color: #fff;
}

.btn-primary:hover {
    background: #b8142a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(215,25,47,0.3);
}

.btn-secondary {
    background: #003781;
    color: #fff;
}

.btn-secondary:hover {
    background: #002a63;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,55,129,0.3);
}

.btn-outline {
    background: transparent;
    color: #003781;
    border: 2px solid #003781;
}

.btn-outline:hover {
    background: #003781;
    color: #fff;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-success {
    background: #28a745;
    color: #fff;
}

.btn-success:hover {
    background: #218838;
}

.btn-block {
    width: 100%;
}

/* === Content === */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
    width: 100%;
}

.page-title {
    font-size: 28px;
    color: #003781;
    font-weight: 700;
    margin-bottom: 24px;
    padding-left: 16px;
    border-left: 5px solid #D7192F;
}

/* === Cards === */
.card {
    background: #fff;
    border-radius: 10px;
    border: 2px solid #E5E5E5;
    padding: 24px;
    margin-bottom: 20px;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    border-color: #D7192F;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: #003781;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #E5E5E5;
}

/* === Payslip List === */
.year-group {
    margin-bottom: 32px;
}

.year-label {
    font-size: 20px;
    font-weight: 700;
    color: #003781;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.year-label::before {
    content: '';
    width: 4px;
    height: 24px;
    background: #D7192F;
    border-radius: 2px;
}

.payslip-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #fff;
    border: 2px solid #E5E5E5;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.payslip-item:hover {
    border-color: #D7192F;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.payslip-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.payslip-icon {
    width: 40px;
    height: 40px;
    background: #F2F4F8;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #D7192F;
    font-size: 18px;
}

.payslip-period {
    font-weight: 600;
    color: #2B2B2B;
    font-size: 16px;
}

.payslip-company {
    color: #003781;
    font-weight: 700;
    font-size: 13px;
}

.payslip-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.send-form {
    display: flex;
    align-items: center;
    gap: 6px;
}

.email-input {
    width: 220px;
    padding: 8px 10px;
    font-size: 13px;
    border: 2px solid #E5E5E5;
    border-radius: 6px;
}

.email-input:focus {
    border-color: #003781;
    outline: none;
}

.payslip-date {
    font-size: 12px;
    color: #7A7A7A;
}

.btn-download {
    background: #003781;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-download:hover {
    background: #D7192F;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(215,25,47,0.3);
}

/* === Flash Messages === */
.flash-messages {
    margin-bottom: 20px;
}

.flash {
    padding: 14px 20px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.flash-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flash-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.flash-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* === Tables === */
.table-wrapper {
    overflow-x: auto;
}

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

table th {
    background: #003781;
    color: #fff;
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table td {
    padding: 12px 16px;
    border-bottom: 1px solid #E5E5E5;
    font-size: 14px;
}

table tr:hover td {
    background: #F2F4F8;
}

table th:first-child {
    border-radius: 8px 0 0 0;
}

table th:last-child {
    border-radius: 0 8px 0 0;
}

/* === Upload Preview === */
.preview-table td {
    vertical-align: middle;
}

.match-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.match-status.matched {
    background: #d4edda;
    color: #155724;
}

.match-status.uncertain {
    background: #fff3cd;
    color: #856404;
}

.match-status.unmatched {
    background: #f8d7da;
    color: #721c24;
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #7A7A7A;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 20px;
    color: #003781;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}

/* === Footer === */
.footer {
    background: #1a1a1a;
    color: rgba(255,255,255,0.5);
    text-align: center;
    padding: 16px 24px;
    font-size: 12px;
}

/* === Responsive === */
@media (max-width: 768px) {
    .header {
        padding: 0 16px;
        height: 56px;
    }

    .header-logo h1 {
        font-size: 16px;
    }

    .header-nav a {
        padding: 6px 10px;
        font-size: 12px;
    }

    .main-content {
        padding: 16px;
    }

    .page-title {
        font-size: 22px;
    }

    .login-card {
        margin: 16px;
        padding: 32px 24px;
    }

    .payslip-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .btn-download {
        width: 100%;
        justify-content: center;
    }

    table th, table td {
        padding: 8px 10px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .header-nav {
        gap: 4px;
    }

    .header-nav a {
        font-size: 11px;
        padding: 6px 8px;
    }
}

/* === Utilities === */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-muted { color: #7A7A7A; }
.text-danger { color: #D7192F; }
.d-flex { display: flex; }
.gap-2 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }

/* === Admin Sections === */
.admin-section {
    margin-bottom: 32px;
}

.admin-section .card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.inline-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.inline-form .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 150px;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-active {
    background: #d4edda;
    color: #155724;
}

.badge-inactive {
    background: #f8d7da;
    color: #721c24;
}

.badge-admin {
    background: #003781;
    color: #fff;
}

.action-buttons {
    display: flex;
    flex-direction: row;
    gap: 4px;
    align-items: center;
    flex-wrap: nowrap;
}

.action-buttons form {
    display: inline-flex;
    margin: 0;
    padding: 0;
}

.action-buttons .btn {
    height: 30px;
    padding: 4px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    font-size: 12px;
}

/* === Zeiten-spezifische Klassen === */
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 24px; color: #003781; margin-bottom: 4px; }
.muted { color: #6e7681; font-size: 13px; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.card h3 {
    font-size: 16px;
    color: #003781;
    margin-bottom: 12px;
    border-bottom: 1px solid #e4e6eb;
    padding-bottom: 8px;
}

.card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 16px 0 0;
}

.stempel-card .status.on { color: #2e7d32; font-weight: 600; }
.stempel-card .status.off { color: #6e7681; font-weight: 600; }

.t-buchungen { width: 100%; border-collapse: collapse; font-size: 14px; }
.t-buchungen th { text-align: left; padding: 6px 4px; color: #6e7681; font-weight: 600; border-bottom: 1px solid #e4e6eb; }
.t-buchungen td { padding: 6px 4px; border-bottom: 1px solid #f0f1f4; }

.flash-success { background: #d4edda; color: #155724; border-left: 4px solid #28a745; padding: 10px; border-radius: 4px; margin: 8px 0; }

#stempel-feedback { margin-top: 12px; }

/* Mobile-Optimierung */
@media (max-width: 600px) {
    .header { padding: 0 12px; height: 56px; }
    .header-logo h1 { font-size: 17px; }
    .header-nav { gap: 6px; }
    .header-nav a { padding: 6px 8px; font-size: 12px; }
    .header-user { display: none; }
    .main-content { padding: 14px; }
    .card-actions .btn { flex: 1; min-width: 0; }
    .stempel-card .btn { font-size: 18px; padding: 16px; }
}
.status-ok { color: #2e7d32; font-weight: 600; }
.status-bad { color: #c62828; font-weight: 600; }
.status-pending { color: #ed6c02; font-weight: 600; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.row-wochenende td { background: #fafbfc; color: #6e7681; }
.row-feiertag td { background: #fff3e0; }
.row-arbeitstag td:nth-child(1) { font-weight: 600; }
.badge-feiertag { background: #ff9800; color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.badge-bruecke { background: #1976d2; color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.badge-ruhe { background: #6e7681; color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.buchungs-zeile { font-family: 'Courier New', monospace; font-size: 13px; }
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin: 0 0 24px;
}
.kpi {
    background: #fff;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border-left: 4px solid #003781;
}
.kpi-label { font-size: 12px; color: #6e7681; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-size: 28px; font-weight: 700; color: #003781; margin: 6px 0; line-height: 1; }
.kpi-value-small { font-size: 18px; font-weight: 700; color: #003781; margin: 6px 0; line-height: 1.1; }
.kpi-sub { font-size: 12px; color: #6e7681; }
.kpi-pos { border-left-color: #2e7d32; }
.kpi-pos .kpi-value { color: #2e7d32; }
.kpi-neg { border-left-color: #c62828; }
.kpi-neg .kpi-value { color: #c62828; }
.kpi-alert { border-left-color: #ed6c02; }
.kpi-alert .kpi-value { color: #ed6c02; }

.entscheider-card {
    background: linear-gradient(135deg, #003781 0%, #1c4f9c 100%);
    color: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}
.entscheider-card h3 { color: #fff; border-bottom-color: rgba(255,255,255,0.2); }
.entscheider-card .kpi { border-left-color: rgba(255,255,255,0.5); }
.entscheider-card .kpi-label { color: rgba(255,255,255,0.7); }
.entscheider-card .kpi-value { color: #fff; }
.entscheider-card .kpi-sub { color: rgba(255,255,255,0.7); }
.entscheider-card .kpi-sub a { color: #fff; text-decoration: underline; }

/* === Historie schick === */
.historie-wochen { display: flex; flex-direction: column; gap: 16px; }
.woche-card { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); overflow: hidden; }
.woche-header { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 16px; background: #003781; color: #fff; }
.woche-header .kw { font-size: 13px; font-weight: 600; letter-spacing: 0.5px; }
.woche-header .woche-summe { font-size: 12px; opacity: 0.85; font-family: 'Courier New', monospace; }
.woche-tage { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: #e4e6eb; }
.tag-card { background: #fff; padding: 10px; display: flex; flex-direction: column; min-height: 110px; font-size: 13px; }
.tag-wochenende { background: #fafbfc; }
.tag-feiertag { background: #fff3e0; }
.tag-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.tag-wd { font-weight: 700; color: #003781; }
.tag-dat { color: #6e7681; font-size: 12px; }
.tag-buchungen { flex: 1; }
.buchung-pair { display: flex; justify-content: space-between; font-family: 'Courier New', monospace; font-size: 12px; padding: 2px 0; border-bottom: 1px dotted #e4e6eb; }
.buchung-pair .dauer { color: #6e7681; }
.tag-foot { display: flex; justify-content: space-between; margin-top: 6px; padding-top: 6px; border-top: 1px solid #e4e6eb; font-size: 12px; font-weight: 600; }
.tag-ist { color: #2B2B2B; font-family: 'Courier New', monospace; }
.tag-diff { font-family: 'Courier New', monospace; }
.diff-pos { color: #2e7d32; }
.diff-neg { color: #c62828; }
.warn { color: #ed6c02; font-size: 11px; margin-top: 2px; }
.small { font-size: 11px; }

@media (max-width: 900px) {
    .woche-tage { grid-template-columns: repeat(2, 1fr); }
}

/* === Kalender === */
.kal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e4e6eb;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.kal-wd-head {
    background: #003781;
    color: #fff;
    padding: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
}
.kal-cell {
    background: #fff;
    padding: 8px;
    min-height: 96px;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.kal-empty { background: #f4f6f9; }
.kal-day-num { font-weight: 600; color: #2B2B2B; font-size: 14px; }
.kal-today { background: #e3f2fd; }
.kal-today .kal-day-num { background: #003781; color: #fff; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.kal-wochenende { background: #fafbfc; }
.kal-wochenende .kal-day-num { color: #6e7681; }
.kal-feiertag { background: #fff3e0; }
.kal-event {
    font-size: 11px;
    padding: 2px 4px;
    border-radius: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kal-event.kal-feiertag { background: #ff9800; color: #fff; }
.kal-event.kal-bruecke { background: #1976d2; color: #fff; }
.kal-event.kal-ruhe { background: #6e7681; color: #fff; }
.kal-event.kal-firma { background: #e8f4fd; color: #003781; border-left: 3px solid #003781; }
.kal-event.kal-urlaub { background: #e8f5e9; color: #2e7d32; border-left: 3px solid #2e7d32; }

.termin-liste { list-style: none; padding: 0; }
.termin-liste li { padding: 8px 0; border-bottom: 1px solid #e4e6eb; }

@media (max-width: 700px) {
    .kal-cell { min-height: 70px; padding: 4px; font-size: 11px; }
    .kal-event { font-size: 10px; }
}

/* === Mobile Polishing === */
.t-buchungen-wrap, .main-content table { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 800px) {
    .main-content { padding: 12px; }
    .page-header h2 { font-size: 20px; }
    .kpi-value { font-size: 22px; }
    .card { padding: 14px; }
    .card h3 { font-size: 14px; }
    .t-buchungen { font-size: 12px; }
    .t-buchungen th, .t-buchungen td { padding: 4px 3px; }
    .form-group { margin-bottom: 14px; }
    /* Touch-friendly Buttons (min 44px) */
    .btn { min-height: 44px; padding: 10px 16px; }
    .btn-sm { min-height: 36px; padding: 6px 12px; }
    /* Header-Menü kompakt */
    .header { padding: 0 8px; height: auto; flex-wrap: wrap; }
    .header-nav { flex-wrap: wrap; gap: 4px; padding: 4px 0; }
    .header-nav a { padding: 6px 10px; font-size: 12px; }
}

@media (max-width: 500px) {
    .header-logo h1 { font-size: 16px; }
    .header-user { display: none; }
    .kpi-row { grid-template-columns: 1fr 1fr; gap: 8px; }
    .kpi-value { font-size: 20px; }
    .stempel-card .btn { font-size: 16px; padding: 14px; min-height: 56px; }
    /* Kalender: 2-Spalten reduzieren auf weiterhin 2, aber kleiner */
    .kal-cell { min-height: 56px; padding: 3px; }
    .kal-day-num { font-size: 12px; }
    .kal-event { font-size: 9px; padding: 1px 3px; }
    .kal-wd-head { font-size: 11px; padding: 4px; }
}

/* Touch-Verhalten — kein Hover-Lock */
@media (hover: none) {
    .btn:hover { opacity: 1; }
    .header-nav a:hover { background: none; }
}
