body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex: 1;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
}

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.period-row {
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 5px;
    background-color: #fafafa;
    position: relative;
}

.period-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.period-number {
    font-weight: bold;
    margin-right: 5px;
    min-width: 20px;
}

.period-name {
    font-weight: bold;
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 200px;
}

.period-actions {
    display: flex;
    gap: 5px;
}

.btn-move, .btn-remove {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px 8px;
    cursor: pointer;
    color: #666;
}

.btn-move:hover, .btn-remove:hover {
    background-color: #eee;
}

.btn-remove {
    color: #d32f2f;
}

.date-inputs {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
}

.input-group {
    flex: 1;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.today-btn {
    margin-left: 10px;
    padding: 8px 12px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.today-btn:hover {
    background-color: #45a049;
}

.checkbox-row {
    margin-top: 8px;
}

.checkbox-row label {
    font-weight: normal;
    font-size: 14px;
}

.period-result {
    padding: 10px;
    background-color: #e8f5e8;
    border-radius: 4px;
    min-height: 20px;
}

.period-result-collapsible .period-result-header {
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    user-select: none;
    padding: 6px 10px;
    margin: -6px -10px 0 -10px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.04);
    transition: background 0.2s;
}

.period-result-collapsible .period-result-header:hover {
    background: rgba(0, 0, 0, 0.08);
}

.period-result-collapsible .toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    min-width: 24px;
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
    background: #2196F3;
    color: white;
    border-radius: 4px;
    transition: background 0.2s;
}

.period-result-collapsible .period-result-header:hover .toggle-icon {
    background: #1976D2;
}

.period-result-collapsible .toggle-label {
    font-size: 12px;
    color: #1976D2;
    font-weight: 500;
    flex-shrink: 0;
}

.period-result-collapsible .period-result-body {
    margin-top: 8px;
    margin-left: 20px;
}

.period-result-collapsible .period-result-body.collapsed {
    display: none !important;
}

.buttons {
    margin: 20px 0;
    text-align: center;
}

.btn {
    padding: 10px 20px;
    margin: 0 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-add {
    background-color: #2196F3;
    color: white;
}

.btn-add:hover {
    background-color: #0b7dda;
}

.btn-calculate {
    background-color: #ff9800;
    color: white;
}

.btn-calculate:hover {
    background-color: #e68a00;
}

.btn-sort {
    background-color: #9c27b0;
    color: white;
}

.btn-sort:hover {
    background-color: #7b1fa2;
}

.btn-pdf {
    background-color: #f44336;
    color: white;
}

.btn-docx {
    background-color: #2B579A;
    color: white;
}

.btn-docx:hover {
    background-color: #1e3d6d;
}

.btn-pdf:hover {
    background-color: #d32f2f;
}

.btn-clear {
    background-color: #d32f2f;
    color: white;
}

.btn-clear:hover {
    background-color: #b71c1c;
}

.btn-overlap {
    background-color: #ff9800;
    color: white;
}

.btn-overlap:hover {
    background-color: #e68a00;
}

.btn-overlap.active {
    background-color: #e65100;
}

.btn-help {
    background-color: #9c27b0;
    color: white;
}

.btn-help:hover {
    background-color: #7b1fa2;
}

.total-result {
    margin-top: 30px;
    padding: 20px;
    background-color: #e3f2fd;
    border-radius: 8px;
    text-align: center;
}

#totalOutput {
    font-size: 24px;
    font-weight: bold;
    color: #1976d2;
}

.error {
    color: #d32f2f;
    font-weight: bold;
}

.success {
    color: #2e7d32;
    font-weight: bold;
}

footer {
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    color: #666;
}

.overlap-highlight {
    background-color: #ffcccc !important;
    border: 2px solid #ff0000 !important;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 700px;
    border-radius: 8px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
}

.help-content h3 {
    color: #333;
    margin-top: 20px;
}

.help-content ul {
    margin-left: 20px;
}

.help-content li {
    margin-bottom: 8px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .date-inputs {
        flex-direction: column;
        gap: 10px;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .btn {
        margin: 5px 0;
        width: 100%;
        justify-content: center;
    }
}

/* Добавлены стили для отображения обновленных дат */
.date-input {
    width: 140px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: monospace; /* Для лучшего отображения дат */
}