/* Version 8 — My Life Planner */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: #34323d;
    background: #f8f7fb;
    font-family: Arial, sans-serif;
}

button, input, select, textarea {
    font: inherit;
}

button {
    border: 0;
    border-radius: 9px;
    padding: 10px 13px;
    background: #8a79c9;
    color: white;
    cursor: pointer;
}

button:hover {
    filter: brightness(.96);
}

button:disabled {
    opacity: .4;
    cursor: default;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
    outline: 3px solid #b5a6f5;
    outline-offset: 2px;
}

input:not([type="checkbox"]),
textarea,
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #d7d3df;
    border-radius: 9px;
    color: #34323d;
    background: white;
}

textarea {
    resize: vertical;
}

[hidden] {
    display: none !important;
}

/* Header */

.app-header {
    padding: 24px;
    text-align: center;
    background: #e9e1f5;
}

.app-header h1 {
    margin: 0;
}

.app-header p {
    margin-bottom: 0;
    color: #6e6580;
}

/* Layout and sidebar */

.app-layout {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    padding: 24px;
}

.sidebar {
    flex: 0 0 240px;
    min-height: calc(100vh - 175px);
    display: flex;
    flex-direction: column;
    padding: 18px;
    border-radius: 15px;
    background: white;
    box-shadow: 0 2px 8px #00000010;
}

.sidebar-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.sidebar-heading h2 {
    margin: 0;
}

#sections-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.section-row {
    display: flex;
    gap: 5px;
    border-radius: 9px;
}

.section-row.drop-target {
    outline: 3px dashed #8a79c9;
    outline-offset: 2px;
}

.section-button {
    flex: 1;
    min-width: 0;
    text-align: left;
    color: #51476c;
    background: #f0edf6;
    overflow-wrap: anywhere;
}

.section-button.active {
    color: white;
    background: #8a79c9;
}

.section-delete {
    color: #9e4545;
    background: #f6dede;
}

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
}

.secondary-button {
    color: #51476c;
    background: #f0edf6;
}

.trash-link {
    margin-top: auto;
    width: 100%;
    text-align: left;
    color: #746981;
    background: #f2eff5;
    font-size: 13px;
}

.trash-link.active {
    color: white;
    background: #8a79c9;
}

#trash-count {
    float: right;
}

/* Three-dot note and sidebar menus */

.menu {
    position: relative;
    flex-shrink: 0;
}

.menu summary {
    list-style: none;
    display: grid;
    place-items: center;
    width: 33px;
    height: 30px;
    border-radius: 9px;
    cursor: pointer;
    color: #675777;
    background: #eee8f4;
    font-size: 21px;
    line-height: 1;
}

.menu summary::-webkit-details-marker {
    display: none;
}

.menu-items {
    position: absolute;
    right: 0;
    top: calc(100% + 7px);
    z-index: 30;
    width: 175px;
    padding: 6px;
    border: 1px solid #eadbb9;
    border-radius: 13px;
    background: #fff9e9;
    box-shadow: 0 10px 26px #6a54352b;
}

.menu-items button {
    display: block;
    width: 100%;
    padding: 10px;
    text-align: left;
    color: #5b4b63;
    background: transparent;
    border-radius: 8px;
    font-size: 13px;
}

.menu-items button:hover {
    background: #f4e6cc;
}

.menu-items .danger-action {
    color: #a45165;
}

.note-menu[open] {
    z-index: 40;
}

/* Main planner */

.planner {
    flex: 1;
    min-width: 0;
}

.planner-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 15px;
}

.planner-header h2 {
    margin: 0;
}

/* Progress bars */

.progress-panel {
    padding: 15px 18px;
    margin-bottom: 20px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 2px 7px #0000000d;
}

.progress-heading {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}

.progress-track {
    height: 9px;
    overflow: hidden;
    border-radius: 30px;
    background: #e4d7b1;
}

.progress-panel .progress-track {
    background: #eae6f0;
}

.progress-fill {
    height: 100%;
    background: #93b490;
    transition: width .2s;
}

.progress-label {
    font-size: 12px;
    color: #756d5d;
}

/* Sticky notes */

.notes-container {
    display: grid;
    grid-template-columns: repeat(
        auto-fill,
        minmax(280px, 1fr)
    );
    gap: 18px;
    align-items: start;
}

.empty-message {
    color: #777480;
}

.sticky-note {
    position: relative;
    min-width: 0;
    padding: 16px;
    border: 1px solid #efdfa9;
    border-radius: 15px;
    background: #fff0c7;
    overflow-wrap: anywhere;
}

.sticky-note:has(.menu[open]) {
    z-index: 15;
}

.sticky-note.dragging {
    opacity: .3;
    transform: scale(.97);
}

.sticky-note.drop-before {
    outline: 3px dashed #9c88d1;
    outline-offset: 4px;
}

.sticky-note.drop-after {
    outline: 3px solid #98b89a;
    outline-offset: 4px;
}

.note-top {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 32px;
    margin-bottom: 12px;
}

.note-top h3 {
    margin: 0;
    flex: 1;
    min-width: 0;
    font-size: 19px;
}

.note-menu summary {
    background: #e6d3a0;
    color: #574832;
}

.note-menu .menu-items {
    background: #fff6df;
    border-color: #e6d3a0;
}

.drag-handle {
    border: 0;
    padding: 3px;
    background: transparent;
    color: #8f7c58;
    cursor: grab;
    font-size: 21px;
    line-height: 1;
}

.note-description {
    margin: 0 0 11px;
    white-space: pre-wrap;
    font-size: 14px;
    color: #776a50;
}

/* Checklist */

.note-progress-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 6px 0 13px;
}

.check-all-button {
    padding: 5px 9px;
    border: 1px solid #ddc995;
    border-radius: 8px;
    background: #fff5d9;
    color: #69573e;
    font-size: 12px;
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 3px 0;
    border-radius: 7px;
}

.task-row:has(.task-menu[open]) {
    z-index: 25;
}

.task-checkbox {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    accent-color: #8160b4;
    cursor: pointer;
}

.task-text {
    flex: 1;
    min-width: 0;
}

.task-text.completed,
.completed {
    text-decoration: line-through;
    opacity: .6;
}

.task-tag {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    color: #806c55;
}

.task-row.inactive {
    opacity: .65;
}

/* Version 8: small task drag handle */

.task-handle {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: #a5926c;
    padding: 2px;
    font-size: 15px;
    line-height: 1;
    cursor: grab;
    opacity: .5;
}

.task-row:hover .task-handle,
.task-handle:focus-visible {
    opacity: 1;
}

.task-handle:active {
    cursor: grabbing;
}

.task-row.task-dragging {
    opacity: .4;
}

.task-row.task-drop-before {
    box-shadow: 0 -3px #9d86cb;
}

.task-row.task-drop-after {
    box-shadow: 0 3px #9d86cb;
}

/* Version 8: task options menu */

.task-menu {
    position: relative;
    flex: 0 0 auto;
}

.task-more {
    display: grid;
    place-items: center;
    list-style: none;
    cursor: pointer;
    width: 25px;
    height: 26px;
    padding: 0;
    border-radius: 7px;
    color: #806d4d;
    background: transparent;
    font-size: 18px;
    opacity: .45;
}

.task-more::-webkit-details-marker {
    display: none;
}

.task-row:hover .task-more,
.task-menu[open] .task-more,
.task-more:focus-visible {
    opacity: 1;
    background: #e6d6ac;
}

.task-menu-items {
    position: absolute;
    z-index: 40;
    right: 0;
    top: calc(100% + 4px);
    width: 178px;
    padding: 5px;
    background: #fff8e9;
    border: 1px solid #ead8ae;
    border-radius: 11px;
    box-shadow: 0 9px 25px #5b452636;
}

.task-menu-items button {
    width: 100%;
    display: block;
    text-align: left;
    border-radius: 7px;
    padding: 8px 9px;
    color: #5b4b53;
    background: transparent;
    font-size: 12px;
}

.task-menu-items button:hover:not(:disabled) {
    background: #f4e7cb;
}

.task-menu-items .danger-action {
    color: #a64f60;
}

.task-menu-items button:disabled {
    opacity: .35;
    cursor: default;
}

/* Add task link */

.schedule-toggle {
    display: inline-block;
    width: auto;
    margin-top: 14px;
    padding: 7px 3px;
    color: #8064b2;
    background: transparent;
    font-size: 13px;
    text-align: left;
    border-radius: 5px;
}

.schedule-toggle:hover {
    color: #5b3c94;
    text-decoration: underline;
    background: transparent;
}

/* History and Recently Deleted */

.history-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.history-tools select {
    width: auto;
}

.history-day {
    grid-column: 1 / -1;
    margin: 7px 0 0;
    font-size: 17px;
}

.history-item,
.trash-item {
    padding: 15px;
    border: 1px solid #e8e3f1;
    border-radius: 13px;
    background: white;
}

.history-item p,
.trash-item p {
    margin: 6px 0;
    color: #776f83;
    font-size: 13px;
}

.history-item time {
    font-size: 12px;
    color: #888;
}

.trash-item h3 {
    margin: 0 0 7px;
    font-size: 16px;
}

.trash-actions {
    display: flex;
    gap: 7px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.trash-actions button {
    padding: 8px 10px;
    font-size: 13px;
}

.trash-actions .permanent {
    background: #f6dede;
    color: #9e4545;
}

/* Editors and confirmation windows */

.editor-dialog {
    width: min(460px, calc(100% - 30px));
    max-height: calc(100% - 30px);
    padding: 23px;
    border: 0;
    border-radius: 16px;
    box-shadow: 0 15px 65px #0003;
}

.editor-dialog::backdrop {
    background: #28203888;
}

.editor-form {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.editor-form h2 {
    margin: 0 0 8px;
}

.editor-form label {
    font-size: 14px;
    font-weight: bold;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.confirm-dialog {
    background: #fff8ed;
    border: 1px solid #eddfcc;
}

.confirm-dialog h2 {
    margin: 0 0 12px;
    color: #594b46;
}

.confirm-dialog p {
    line-height: 1.5;
    color: #766660;
}

.confirm-help,
.form-hint {
    font-size: 13px;
    color: #806f80;
}

.danger-button {
    background: #b75d70;
}

#weekly-options label,
#custom-clear-options label {
    display: block;
    margin-bottom: 8px;
}

/* Smaller screens */

@media (max-width: 700px) {
    .app-layout {
        flex-direction: column;
        padding: 14px;
    }

    .sidebar,
    .planner {
        width: 100%;
        flex-basis: auto;
    }

    .sidebar {
        min-height: 0;
    }

    .trash-link {
        margin-top: 22px;
    }

    .planner-header {
        flex-wrap: wrap;
    }
}