* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: #ffffff;
    color: #202020;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden; 
    overflow-y: auto;   
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    padding: 15px 30px;
    border-bottom: 1px solid #f0f0f0;
}

.top-bar button {
    padding: 8px 12px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 5px;
    font-size: 14px;
}

#add-task-btn {
    color: #db4c3f;
    font-weight: 500;
}

#add-task-btn:hover {
    background: #ffefe5;
}

.left-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.category-manager {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #f9f9f9;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #eee;
}

.top-input {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 13px;
    outline: none;
    background: #fff;
}

.top-input:focus {
    border-color: #bbb;
}

.top-btn {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-weight: bold;
    color: #555;
}

.top-btn:hover {
    background: #f0f0f0;
}

#delete-cat-btn:hover { color: #db4c3f; }
#add-cat-btn:hover { color: #2a9d8f; }

.divider-vertical {
    width: 1px;
    height: 15px;
    background: #ddd;
    margin: 0 5px;
}

.view-toggles button.active {
    background: #f0f0f0;
    font-weight: 500;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.calendar-zone {
    flex: 2; 
    padding: 30px;
    border-right: 1px solid #f0f0f0;
    background: #ffffff;
}

.right-panel {
    width: 380px; 
    flex-shrink: 0; 
    padding: 20px 25px;
    background: #ffffff;
    overflow-y: auto;
    border-left: 1px solid #f0f0f0; 
}

.task-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

.checkbox {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #ccc;
    margin-right: 15px;
    cursor: pointer;
    flex-shrink: 0;
}

.priority-7 { border-color: #db4c3f; } 
.priority-6 { border-color: #e36940; } 
.priority-5 { border-color: #eb8909; } 
.priority-4 { border-color: #f4a261; } 
.priority-3 { border-color: #e9c46a; } 
.priority-2 { border-color: #2a9d8f; } 
.priority-1 { border-color: #246fe0; } 

.task-info {
    flex: 1;
}

.task-title {
    font-size: 14px;
    margin-bottom: 4px;
    color: #202020;
}

.task-meta {
    font-size: 12px;
    color: #808080;
    display: flex;
    gap: 15px;
}

.task-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease; 
}

.task-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
    border-color: #e0e0e0;
}

.task-item.is-running {
    box-shadow: inset 4px 0 0 #db4c3f, 0 4px 12px rgba(0,0,0,0.05);
    transform: translateY(-1px);
}

.task-comment {
    width: 100%;
    min-height: 80px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    margin-top: 15px;
    font-size: 13px;
    resize: vertical;
    outline: none;
    background: #fafafa;
}

.task-comment:focus {
    border-color: #bbb;
    background: #fff;
}

.task-actions {
    display: none; 
}

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background: #f0f0f0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-bar-fill {
    height: 100%;
    background: #db4c3f; 
    transition: width 1s linear; 
}

.achievement-basement {
    height: 200px;
    border-top: 2px solid #f0f0f0;
    background: #fafafa;
    position: relative;
    overflow: hidden;
    padding: 0; 
}

.placeholder-text {
    color: #b3b3b3;
    font-style: italic;
    font-size: 14px;
}

.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    width: 400px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.modal-title { margin-bottom: 15px; font-size: 18px; }

.input-field {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.input-row {
    display: flex;
    gap: 10px;
}

.input-field.half { width: 50%; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-secondary, .btn-primary {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.btn-secondary { background: #f0f0f0; color: #333; }
.btn-primary { background: #db4c3f; color: #fff; }
.btn-primary:hover { background: #c53e33; }

.active-task-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border-top: 4px solid #db4c3f; 
}

.active-task-title {
    font-weight: 500;
    margin-bottom: 10px;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    margin-bottom: 8px;
    color: #555;
}

.checklist-item input[type="checkbox"] {
    cursor: pointer;
}

.active-panel {
    width: 380px;
    flex-shrink: 0;
    background: #fafafa; 
    border-left: 1px solid #e0e0e0;
    padding: 20px 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.active-panel.hidden {
    display: none;
}

.active-panel-header {
    font-size: 12px;
    text-transform: uppercase;
    color: #b3b3b3;
    margin-bottom: 20px;
    letter-spacing: 0.5px;
}

.task-item.is-running {
    background: #f9f9f9;
    border-radius: 8px;
    box-shadow: inset 3px 0 0 #db4c3f; 
}

.left-controls { display: flex; gap: 15px; }
.action-btn { background: none; border: none; font-size: 14px; cursor: pointer; font-weight: 500; }
.action-btn:hover { text-decoration: underline; }
.text-red { color: #db4c3f; }
.text-gray { color: #555; }

.btn-icon { width: 38px; height: 38px; border: 1px solid #ddd; border-radius: 5px; background: #fff; cursor: pointer; font-size: 18px; font-weight: bold; }
.btn-icon:hover { background: #f0f0f0; }
.red-plus { color: #db4c3f; }
.black-minus { color: #202020; width: 28px; height: 28px; border: none; background: none; font-size: 20px; }
.black-minus:hover { color: #db4c3f; }

.category-list { max-height: 200px; overflow-y: auto; border: 1px solid #f0f0f0; border-radius: 5px; padding: 5px; }
.category-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-bottom: 1px solid #f9f9f9; font-size: 14px; }
.category-row:last-child { border-bottom: none; }

.create-checklist-zone { margin: 15px 0; padding-top: 15px; border-top: 1px solid #f0f0f0; }
.btn-text { background: none; border: none; color: #888; font-size: 12px; cursor: pointer; margin-top: 5px; }
.btn-text:hover { color: #333; }
.mini-input {
    border: none;
    border-bottom: 1px solid #ddd;
    outline: none;
    padding: 4px;
    width: 100%;
    font-size: 13px;
    text-overflow: ellipsis; 
    white-space: nowrap; 
    overflow: hidden; 
}

.calendar-zone {
    display: flex;
    flex-direction: column;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#current-month-display {
    font-size: 20px;
    font-weight: 600;
    color: #202020;
}

.month-nav {
    display: flex;
    gap: 10px;
    align-items: center;
}

.icon-btn {
    background: #f0f0f0;
    border: none;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
}

.icon-btn:hover { background: #e0e0e0; }

.weekdays-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: right;
    padding-bottom: 10px;
    font-size: 12px;
    font-weight: 500;
    color: #888;
    border-bottom: 1px solid #f0f0f0;
}

.weekdays-grid .weekend { color: #db4c3f; }

.days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: 1fr; 
    flex: 1; 
    gap: 1px;
    background: #f0f0f0; 
    border: 1px solid #f0f0f0;
}

.day-cell {
    background: #fff;
    padding: 8px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-height: 100px;
    cursor: pointer; 
    transition: background-color 0.2s, box-shadow 0.2s;
}

.day-cell:hover {
    background: #f9f9f9;
    box-shadow: inset 0 0 0 1px #e0e0e0;
}

.day-cell.other-month { background: #fafafa; color: #ccc; }
.day-cell.today .day-number {
    background: #db4c3f;
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.day-number {
    font-size: 14px;
    font-weight: 500;
    align-self: flex-end;
    margin-bottom: 5px;
    color: #333;
}

.cal-task {
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 4px;
    margin-bottom: 3px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
    font-weight: 500;
    transition: transform 0.1s;
}

.cal-task:hover { transform: scale(1.02); }

.cal-task.shadow-task {
    background-color: transparent !important;
    color: #b3b3b3 !important;
    border: 1px dashed #d0d0d0;
    box-shadow: none;
    cursor: default;
    font-style: italic;
}
.cal-task.shadow-task:hover {
    transform: none; 
}

.day-plan-soft-tasks { margin-bottom: 20px; padding-bottom: 10px; border-bottom: 2px dashed #f0f0f0; }
.timeline-container { position: relative; padding-left: 50px; margin-top: 10px; padding-bottom: 20px; }
.time-slot { height: 50px; border-bottom: 1px solid #f0f0f0; cursor: pointer; transition: background 0.2s; position: relative; }
.time-slot:hover { background: #f9f9f9; }
.time-label { position: absolute; left: -45px; top: -8px; color: #888; font-size: 11px; font-weight: 500; }
.timeline-task { position: absolute; left: 55px; right: 10px; background: #fff; border: 1px solid #ddd; border-radius: 4px; padding: 4px 8px; font-size: 12px; font-weight: bold; color: #333; z-index: 10; box-shadow: 0 2px 4px rgba(0,0,0,0.05); cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.timeline-task:hover { transform: translateY(-1px); box-shadow: 0 4px 8px rgba(0,0,0,0.08); }

.active-task-title-input { font-size: 1.17em; font-weight: bold; border: none; background: transparent; width: 100%; outline: none; color: #333; margin: 0; padding: 0; font-family: inherit; }
.active-task-title-input:focus { border-bottom: 1px dashed #ccc; }

.cal-task.completed-task {
    background-color: transparent !important;
    color: #a0a0a0 !important;
    border: 1px solid #e0e0e0;
    text-decoration: line-through;
    opacity: 0.8;
}

.cal-task.completed-task:hover {
    opacity: 1;
    border-color: #bbb;
    color: #888 !important;
}

/* --- МОБИЛЬНАЯ АДАПТАЦИЯ --- */
@media (max-width: 900px) {
    .app-container { height: auto; min-height: 100vh; }
    .main-content { flex-direction: column; overflow: visible; display: flex; }
    
    #day-plan-panel { order: -1; width: 100%; border-left: none; border-bottom: 2px solid #2a9d8f; margin-bottom: 15px; }
    
    .calendar-zone { order: 1; border-right: none; border-bottom: 2px solid #f0f0f0; padding-bottom: 20px; min-height: 400px; }
    .right-panel { order: 2; width: 100%; border-left: none; overflow: visible; }
    .top-bar { flex-direction: column; gap: 15px; align-items: flex-start; }
    .achievement-basement { height: 120px; }

    /* Окно активной задачи поверх всего (ТОЛЬКО НА МОБИЛЬНОМ) */
    #active-task-panel:not(.hidden) {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.7);
        z-index: 9999;
        display: flex;
        justify-content: center;
        align-items: flex-start;
        padding: 20px;
        margin: 0 !important;
        overflow-y: auto;
    }

    #active-task-content {
        width: 100%;
        max-width: 450px;
        margin-top: 5vh;
        background: #fff;
        border-radius: 8px;
    }

    #active-task-content .active-task-card {
        box-shadow: 0 15px 35px rgba(0,0,0,0.3);
        margin-bottom: 0; 
    }

    #active-task-panel:not(.hidden) .active-panel-header {
        display: none;
    }
}

.cat-dropdown-item { padding: 8px 10px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-size: 13px; border-bottom: 1px solid #f9f9f9; }
.cat-dropdown-item:hover { background: #f0f0f0; }
.cat-delete-btn { color: #bbb; border: none; background: none; cursor: pointer; font-size: 14px; padding: 0 5px; }
.cat-delete-btn:hover { color: #db4c3f; }