* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif; background: #f0f2f5; padding: 16px; line-height: 1.5; }
.container { max-width: 1400px; margin: 0 auto; background: white; border-radius: 20px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); overflow: hidden; }
.header { background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%); color: white; padding: 24px 20px; }
.header h1 { font-size: 1.6rem; margin-bottom: 8px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.badge { background: #27ae60; padding: 4px 12px; border-radius: 50px; font-size: 0.75rem; font-weight: normal; }
.header p { font-size: 0.85rem; opacity: 0.9; }
.content { padding: 20px; }

/* --- TÁBLÁZAT SCROLL --- */
.table-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    margin: 20px 0;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    position: relative;
    padding-bottom: 4px;
}

/* Két scrollbar: felül és alul */
.table-wrapper .scroll-top {
    overflow-x: auto;
    overflow-y: hidden;
    height: 16px;
    margin-bottom: 4px;
}
.table-wrapper .scroll-top::-webkit-scrollbar {
    height: 12px;
}
.table-wrapper .scroll-top::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 6px;
}
.table-wrapper .scroll-top::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
}
.table-wrapper .scroll-top::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.table-wrapper .scroll-bottom {
    overflow-x: auto;
    overflow-y: hidden;
    height: 16px;
    margin-top: 4px;
}
.table-wrapper .scroll-bottom::-webkit-scrollbar {
    height: 12px;
}
.table-wrapper .scroll-bottom::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 6px;
}
.table-wrapper .scroll-bottom::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
}
.table-wrapper .scroll-bottom::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- OSZLOP SZÉLESSÉGEK --- */
table { 
    width: 100%; 
    border-collapse: collapse; 
    font-size: 12px; 
    min-width: 1200px; 
}
th { 
    background: #f1f5f9; 
    padding: 4px 3px; 
    text-align: center; 
    font-weight: 600; 
    color: #1e293b; 
    border-bottom: 1px solid #e2e8f0; 
    font-size: 10px; 
    white-space: normal;
    word-break: break-word;
    line-height: 1.25;
    vertical-align: top;
}
td { 
    padding: 4px 2px; 
    border-bottom: 1px solid #f1f5f9; 
    vertical-align: middle; 
    text-align: center; 
}

/* Oszlop szélességek */
th:nth-child(1), td:nth-child(1) { min-width: 30px; max-width: 30px; width: 30px; }
th:nth-child(2), td:nth-child(2) { min-width: 30px; max-width: 30px; width: 30px; }
th:nth-child(3), td:nth-child(3) { min-width: 75px; max-width: 75px; width: 75px; }
th:nth-child(4), td:nth-child(4) { min-width: 75px; max-width: 75px; width: 75px; }
th:nth-child(5), td:nth-child(5) { min-width: 45px; max-width: 45px; width: 45px; } /* Napok */
th:nth-child(6), td:nth-child(6) { min-width: 90px; max-width: 90px; width: 90px; } /* Havi jöv. */
th:nth-child(7), td:nth-child(7) { min-width: 90px; max-width: 90px; width: 90px; } /* Jutalom */
th:nth-child(8), td:nth-child(8) { min-width: 90px; max-width: 90px; width: 90px; } /* Részesedés */
th:nth-child(9), td:nth-child(9) { min-width: 90px; max-width: 90px; width: 90px; } /* Adóm. jöv. */
th:nth-child(10), td:nth-child(10) { min-width: 90px; max-width: 90px; width: 90px; } /* Adóm. jut. */
th:nth-child(11), td:nth-child(11) { min-width: 90px; max-width: 90px; width: 90px; } /* Járulékalap */
th:nth-child(12), td:nth-child(12) { min-width: 90px; max-width: 90px; width: 90px; } /* Bef. jár. */
/* 10 órás napok - UGYANAKKORA, MINT A NAPOK (45px) - OSZTÁLY ALAPJÁN */
.col-ten-hour {
    min-width: 45px !important;
    max-width: 45px !important;
    width: 45px !important;
}
.col-ten-hour input {
    width: 45px !important;
    min-width: 45px !important;
    max-width: 45px !important;
}
th:nth-child(14), td:nth-child(14) { min-width: 90px; max-width: 90px; width: 90px; } /* Időszaki összeg */
th:nth-child(15), td:nth-child(15) { min-width: 130px; max-width: 130px; width: 130px; } /* Foglalkoztató */
th:nth-child(16), td:nth-child(16) { min-width: 150px; max-width: 150px; width: 150px; } /* Jogviszony */

tr:hover { background: #f8fafc; }
tr.missing-record { background: #fff3cd; }
tr.missing-record:hover { background: #ffe69c; }
tr.sick-leave-record { background: #e8f4f8; }
tr.sick-leave-record:hover { background: #d0e8f0; }
tr.zero-income-record { background: #e6f7ea; }
tr.zero-income-record:hover { background: #c8ecd2; }

.serial-input { width: 35px; padding: 4px; border: 1px solid #cbd5e1; border-radius: 4px; font-size: 12px; text-align: center; background: #f8fafc; color: #64748b; }
.date-input { width: 78px; padding: 4px; border: 1px solid #cbd5e1; border-radius: 4px; font-size: 12px; text-align: center; }
.detail-input { width: 80px; min-width: 80px; max-width: 80px; padding: 4px; border: 1px solid #cbd5e1; border-radius: 4px; font-size: 12px; text-align: right; }
.detail-input-napok { width: 45px !important; min-width: 45px; max-width: 45px; padding: 4px; border: 1px solid #cbd5e1; border-radius: 4px; font-size: 12px; text-align: right; }

.missing-badge { display: inline-block; background: #e67e22; color: white; padding: 2px 8px; border-radius: 12px; font-size: 9px; font-weight: 600; }
.sick-leave-badge { display: inline-block; background: #2a5298; color: white; padding: 2px 8px; border-radius: 12px; font-size: 9px; font-weight: 600; }
.delete-btn { background: #e74c3c; color: white; border: none; padding: 4px 6px; border-radius: 4px; cursor: pointer; font-size: 10px; }
.delete-btn:hover { background: #c0392b; }

.error { color: #c2410c; background: #fff7ed; padding: 14px 18px; border-radius: 12px; margin-bottom: 20px; border-left: 4px solid #e74c3c; }
.warning { color: #9b6b00; background: #fffbeb; padding: 14px 18px; border-radius: 12px; margin-bottom: 20px; border-left: 4px solid #e67e22; }
.success { color: #166534; background: #f0fdf4; padding: 14px 18px; border-radius: 12px; margin-bottom: 20px; border-left: 4px solid #27ae60; }
.info { color: #1e40af; background: #eff6ff; padding: 14px 18px; border-radius: 12px; margin-bottom: 20px; border-left: 4px solid #3b82f6; }

.result { margin-top: 30px; background: #e8f4f8; border-radius: 16px; overflow: hidden; }
.result-summary { background: linear-gradient(135deg, #d4edda 0%, #c8e6d9 100%); padding: 24px; text-align: center; }
.pension { font-size: 2.5rem; font-weight: 700; color: #1e3c72; }
.result-details { padding: 20px; }
details { margin-top: 16px; }
summary { cursor: pointer; color: #2a5298; font-weight: 600; padding: 8px 0; }

.empty-row td { text-align: center; color: #94a3b8; padding: 40px; }

#totalRowContainer { font-size: 13px; background: #f1f5f9; border-radius: 8px; padding: 10px 15px; margin-top: 8px; border-top: 2px solid #1e3c72; display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
#totalRowContainer .total-label { font-weight: 700; color: #1e3c72; }
#totalRowContainer .total-value { font-weight: 600; color: #0b2a4a; }

/* Upload box, modálok, stb. */
.upload-box { border: 2px dashed #cbd5e1; border-radius: 16px; padding: 24px 20px; text-align: center; background: #f8fafc; margin-bottom: 30px; }
.upload-box h3 { font-size: 1.2rem; margin-bottom: 16px; color: #1e293b; }
.file-input-wrapper { margin: 16px 0; }
input[type="file"] { padding: 10px; font-size: 14px; border: 1px solid #cbd5e1; border-radius: 8px; background: white; width: 100%; max-width: 300px; }

.progress-container { margin-top: 20px; display: none; }
.progress-container.show { display: block; }
.progress-bar-wrapper { background: #e2e8f0; border-radius: 50px; height: 8px; overflow: hidden; margin-bottom: 8px; }
.progress-bar-fill { background: linear-gradient(90deg, #2a5298, #27ae60); width: 0%; height: 100%; border-radius: 50px; transition: width 0.3s ease; }
.progress-text { font-size: 13px; color: #64748b; text-align: center; }

button, .btn { background: #2c3e50; color: white; padding: 10px 24px; border: none; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 500; transition: background 0.2s; }
button:hover, .btn:hover { background: #1e2a3a; }
button:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-green { background: #27ae60; }
.btn-green:hover { background: #219a52; }
.btn-blue { background: #2a5298; }
.btn-blue:hover { background: #1e3c72; }
.btn-orange { background: #e67e22; }
.btn-orange:hover { background: #d35400; }
.btn-purple { background: #8e44ad; }
.btn-purple:hover { background: #732d91; }

.contact-btn { position: fixed; bottom: 24px; right: 24px; background: #2a5298; color: white; border: none; border-radius: 60px; padding: 14px 20px; cursor: pointer; font-size: 16px; font-weight: 600; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 1000; transition: all 0.2s; display: flex; align-items: center; gap: 8px; }
.contact-btn:hover { background: #1e3c72; transform: scale(1.02); }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1001; display: none; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal { background: white; border-radius: 24px; max-width: 95% !important; width: 95% !important; max-height: 95% !important; padding: 20px; box-shadow: 0 20px 40px rgba(0,0,0,0.2); overflow-y: auto; }
.modal h3 { margin-bottom: 16px; color: #1e293b; }
.modal input, .modal textarea, .modal input[type="file"] { width: 100%; padding: 10px; margin-bottom: 12px; border: 1px solid #cbd5e1; border-radius: 8px; font-family: inherit; }
.modal textarea { min-height: 100px; resize: vertical; }
.modal button { margin-top: 8px; width: 100%; }
.modal .close-btn { background: #94a3b8; margin-top: 8px; }
.modal .close-btn:hover { background: #64748b; }

.contact-success { background: #d4edda; color: #166534; padding: 12px; border-radius: 8px; margin-bottom: 16px; text-align: center; }
.contact-error { background: #f8d7da; color: #721c24; padding: 12px; border-radius: 8px; margin-bottom: 16px; text-align: center; }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin: 20px 0; padding: 12px 0; border-bottom: 1px solid #e2e8f0; }
.toolbar-left { display: flex; flex-wrap: wrap; gap: 10px; }
.service-years-wrapper { display: flex; align-items: center; gap: 8px; background: #f1f5f9; padding: 8px 16px; border-radius: 40px; flex-wrap: wrap; }
.service-years-wrapper label { font-weight: 600; color: #1e293b; }
.service-years-display { background: #f1f5f9; padding: 8px 16px; border-radius: 40px; font-size: 16px; font-weight: 600; color: #1e293b; }

#columnAdjustContainer { position: relative; overflow: auto; background: #f9f9f9; padding: 10px; touch-action: none; width: 100%; height: 70vh; border: 1px solid #ccc; }
#columnCanvas { position: relative; width: 100%; height: 100%; min-height: 500px; background: white; box-shadow: 0 0 10px rgba(0,0,0,0.1); overflow: hidden; }
.text-item { position: absolute; font-size: 11px; color: #333; pointer-events: none; white-space: nowrap; background: rgba(255,255,255,0.6); padding: 1px 3px; border-radius: 2px; z-index: 10; }
.column-label { position: absolute; top: 0; background: rgba(46, 204, 113, 0.8); color: #000; font-size: 10px; font-weight: bold; padding: 2px 6px; white-space: nowrap; transform: translateX(-50%); pointer-events: none; z-index: 50; border-radius: 3px; border: 1px solid #27ae60; }
.draggable-line { position: absolute; top: 0; width: 2px; height: 100%; background-color: #e74c3c; cursor: col-resize; z-index: 100; touch-action: none; }
.draggable-line::before { content: '||'; position: absolute; top: -15px; left: -10px; color: #e74c3c; font-size: 12px; font-weight: bold; background: white; padding: 0 4px; border-radius: 4px; }
.draggable-line:hover { background-color: #c0392b; width: 4px; }

@media (max-width: 768px) { 
    body { padding: 12px; } 
    .header h1 { font-size: 1.3rem; } 
    .content { padding: 16px; } 
    .toolbar { flex-direction: column; align-items: stretch; } 
    .toolbar-left { justify-content: center; } 
    .service-years-wrapper { justify-content: center; } 
    th { font-size: 8px; padding: 4px 2px; } 
    td { padding: 4px 2px; } 
    .serial-input { width: 30px; font-size: 11px; padding: 3px; } 
    .date-input { width: 65px; font-size: 11px; padding: 3px; } 
    .detail-input { width: 70px; min-width: 70px; max-width: 70px; font-size: 11px; padding: 3px; } 
    .detail-input-napok { width: 40px !important; min-width: 40px; max-width: 40px; font-size: 11px; padding: 3px; } 
    .pension { font-size: 1.8rem; } 
    button, .btn { padding: 8px 16px; font-size: 13px; } 
    .contact-btn { padding: 10px 16px; font-size: 14px; bottom: 16px; right: 16px; } 
    .modal { max-width: 95%; padding: 16px; } 
    #totalRowContainer { font-size: 11px; padding: 8px 10px; gap: 4px 12px; } 
    #columnAdjustContainer { height: 50vh; } 
}
@media (max-width: 480px) { 
    .serial-input { width: 25px; font-size: 10px; padding: 2px; } 
    .date-input { width: 55px; font-size: 10px; padding: 2px; } 
    .detail-input { width: 60px; min-width: 60px; max-width: 60px; font-size: 10px; padding: 2px; } 
    .detail-input-napok { width: 35px !important; min-width: 35px; max-width: 35px; font-size: 10px; padding: 2px; } 
    th { font-size: 7px; padding: 3px 1px; } 
    td { padding: 3px 1px; } 
    .delete-btn { padding: 2px 4px; font-size: 8px; } 
    .pension { font-size: 1.4rem; } 
    #totalRowContainer { font-size: 10px; padding: 6px 8px; gap: 3px 8px; } 
    #columnAdjustContainer { height: 40vh; } 
}
@media print { 
    .upload-box, .toolbar, button, .delete-btn, .progress-container, .contact-btn, .modal-overlay { display: none; } 
    body { padding: 0; background: white; } 
    .container { box-shadow: none; } 
}