* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: #f5f5f5;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 24px;
    padding: 1rem;
    margin: 1rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

header {
    background-color: #c7b99b;
    padding: 1rem;
    margin-top: 0.2rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-align: center;
    border-bottom: 1px solid #8d7f60;
    color: #8d7f60;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

p {
    font-size: 1.2rem;
    font-weight: 400;
    margin-bottom: 1rem;
    text-align: center;
    color: gray;
    padding: 0;
    margin: 0;
}

#todo-form {
    display: flex;
    gap: 0.5rem;
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
    border-radius: 24px;

}

#todo-input {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
    font-size: 16px;
    width: 100%;
    line-height: 1.5;
}

#todo-input:focus {
    outline: none;
    border-color: #c7b99b;
    box-shadow: 0 0 0 2px rgba(199, 185, 155, 0.25);
}
#todo-input:hover {
    border-color: #b3a589;
    box-shadow: 0 0 0 2px rgba(199, 185, 155, 0.25);
    outline: none;
    line-height: 1.5;
    transition: all 0.3s ease;
}

#todo-tools {
    max-width: 600px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    background-color: #fff;
    border: 1px solid #c7b99b;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

#todo-tools-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.25rem 0.75rem;
    margin-top: 0.5rem;
}

#todo-tools-row label[for="todo-search-in"] {
    grid-column: 1;
    grid-row: 1;
}

#todo-tools-row #todo-search-in {
    grid-column: 1;
    grid-row: 2;
}

#todo-tools-row label[for="todo-sort"] {
    grid-column: 2;
    grid-row: 1;
}

#todo-tools-row #todo-sort {
    grid-column: 2;
    grid-row: 2;
}

#todo-tools-row label[for="todo-tag-filter"] {
    grid-column: 3;
    grid-row: 1;
}

#todo-tools-row #todo-tag-filter {
    grid-column: 3;
    grid-row: 2;
}

#todo-tools-row label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #8d7f60;
}

#todo-search {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
    font-size: 16px;
    line-height: 1.5;
}

#todo-search:focus {
    outline: none;
    border-color: #c7b99b;
    box-shadow: 0 0 0 2px rgba(199, 185, 155, 0.25);
}

.todo-search-wrap {
    position: relative;
}

#todo-search {
    padding-right: 2.5rem;
}

#todo-search::-webkit-search-decoration,
#todo-search::-webkit-search-results-button {
    display: none;
}

.todo-search-icon {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    width: 14px;
    height: 14px;
    transform: translateY(-50%);
    pointer-events: none;
    color: #8d7f60;
}

.todo-search-icon::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 9px;
    height: 9px;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.todo-search-icon::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    width: 2px;
    height: 6px;
    background-color: currentColor;
    border-radius: 1px;
    transform: rotate(-50deg);
}

#todo-search:not(:placeholder-shown) + .todo-search-icon {
    display: none;
}

#todo-search::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

.todo-search-clear {
    display: none;
    position: absolute;
    top: 50%;
    right: 0.55rem;
    transform: translateY(-50%);
    width: 1.4rem;
    height: 1.4rem;
    padding: 0;
    border: none;
    background: none;
    color: #8d7f60;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.todo-search-clear::before {
    content: "\00d7";
}

#todo-search:not(:placeholder-shown) ~ .todo-search-clear {
    display: block;
}

[data-theme="dark"] .todo-search-clear {
    color: #d7c79e;
}

#todo-sort,
#todo-search-in,
#todo-tag-filter {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
    font-size: 16px;
    line-height: 1.5;
    background-color: #fff;
}

#todo-sort:focus,
#todo-search-in:focus,
#todo-tag-filter:focus {
    outline: none;
    border-color: #c7b99b;
    box-shadow: 0 0 0 2px rgba(199, 185, 155, 0.25);
}

#todo-add {
    background-color: #c7b99b;
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-weight: 700;
    line-height: 1.5;
    gap: 0.5rem;
}

#todo-add:focus {
    outline: none;
    border-color: #c7b99b;
    box-shadow: 0 0 0 2px rgba(199, 185, 155, 0.25);
    line-height: 1.5;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

#todo-add:hover {
    background-color: #b3a589;
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-weight: 700;
    line-height: 1.5;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

#todo-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
    margin-top: 1.5rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    
}

#todo-list li {
    position: relative;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-top: 2px solid #8d7f60;
}

#todo-list li:not([hidden]) {
    display: flex;
}

#todo-list li span {
    flex: 1;
    word-break: break-all;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    max-width: 500px;
}

#todo-list li input[type="checkbox"]:checked + .todo-text > span:first-child {
    text-decoration: line-through;
    color: #8d7f60;
    opacity: 0.5;
}

#todo-list li.todo-completing {
    max-height: 6rem;
    overflow: hidden;
    pointer-events: none;
    animation: todo-collapse 0.3s ease forwards;
}

@keyframes todo-collapse {
    to {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin: 0;
        border-top-width: 0;
        box-shadow: none;
    }
}

#todo-list li input[type="checkbox"]:checked {
    background-color: #8d7f60;
    border-color: #8d7f60;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8"><path fill="%23fff" d="M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z"/></svg>');
    background-size: 70%;
    background-repeat: no-repeat;
    background-position: center;
}

#todo-list li input[type="checkbox"]:hover {
    border-color: #7a6d52;
}

#todo-list li input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(199, 185, 155, 0.45);
}

#todo-list li button {
    border: none;
    background-color: darkgray;
    color: #fff;
    border-radius: 0.25rem;
    cursor: pointer;
    width: 1.3rem;
    height: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#todo-list li button:hover {
    background-color: grey;
    color: #fff;
    border-radius: 0.25rem;
    cursor: pointer;
    width: 1.3rem;
    height: 1.1rem;
    flex-shrink: 0;
}

#todo-list li input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    border: 2px solid #8d7f60;
    border-radius: 50%;
    background-color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
}

#completed-todo-container-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2rem;
    margin-bottom: 1.5rem;
    gap: 0.75rem;
    border-bottom: 1px solid #8d7f60;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 0.75rem 1rem;
    background-color: #fff;
    border: 1px solid #c7b99b;
    border-radius: 12px;

}

#completed-todo-container-checkbox label {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background-color: #c7b99b;
    color: #fff;
    font-weight: 700;
    border-radius: 0.25rem;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

#completed-todo-container-checkbox label:hover {
    background-color: #b3a589;
    color: #fff;
}

#completed-todo-container-checkbox input[type="checkbox"] {
    width: 1.0rem;
    height: 1.0rem;
    flex-shrink: 0;
    cursor: pointer;
}

#completed-todo-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    pointer-events: none;
}

#completed-todo-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
    margin-top: 1.5rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    
}

#completed-todo-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-top: 2px solid #8d7f60;
    border-radius: 8px;
}

#completed-todo-list li:not([hidden]) {
    display: flex;
}

#completed-todo-list-container {display: none;}
#completed-todo-container-checkbox:has(#completed-todo-checkbox:checked) ~ #completed-todo-list-container { 
    display: block;
}

#completed-todo-list li span {
    flex: 1;
    word-break: break-all;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    max-width: 500px;
    text-decoration: line-through;
    color: #8d7f60;
    opacity: 0.5;
}

#todo-list .todo-due-hint,
#completed-todo-list .todo-due-hint,
#todo-list .todo-tag,
#completed-todo-list .todo-tag {
    flex: 0 0 auto;
    max-width: none;
    padding: 0.15rem 0.45rem;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: none;
    word-break: normal;
    cursor: default;
    white-space: nowrap;
    text-decoration: none;
    opacity: 1;
    color: #fff;
    background-color: #8d7f60;
}

#todo-list .todo-due-hint.overdue,
#completed-todo-list .todo-due-hint.overdue {
    background-color: #8f4b4b;
}

#todo-list .todo-due-hint.tomorrow,
#completed-todo-list .todo-due-hint.tomorrow {
    background-color: #b2a486;
}

#todo-list .todo-text,
#completed-todo-list .todo-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

#todo-list .todo-last-done,
#completed-todo-list .todo-last-done {
    flex: 0 0 auto;
    max-width: none;
    padding:0;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: none;
    word-break: normal;
    cursor: default;
    white-space: nowrap;
    text-decoration: none;
    opacity: 1;
    color: #9a5a4a;
    background: none;
}

#todo-list .todo-tag.work,
#completed-todo-list .todo-tag.work {
    background-color: #8d7f60;
}

#todo-list .todo-tag.home,
#completed-todo-list .todo-tag.home {
    background-color: #b2a486;
}

#todo-list .todo-tag.personal,
#completed-todo-list .todo-tag.personal {
    background-color: #7a6d52;
}

#completed-todo-list li button {
    border: none;
    background-color: darkgray;
    color: #fff;
    border-radius: 0.25rem;
    cursor: pointer;
    width: 1.3rem;
    height: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#completed-todo-list li button:hover {
    background-color: color-mix(in srgb, red 50%, transparent);
    color: #fff;
    border-radius: 0.25rem;
    cursor: pointer;
    width: 1.3rem;
    height: 1.1rem;
    flex-shrink: 0;
}

#completed-todo-list li input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    border: 2px solid #8d7f60;;
    border-radius: 50%;
    background-color: #fff;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
}

#completed-todo-list li input[type="checkbox"]:checked {
    background-color: #8d7f60;
    border-color: #8d7f60;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8"><path fill="%23fff" d="M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z"/></svg>');
    background-size: 70%;
    background-repeat: no-repeat;
    background-position: center;
}

#completed-todo-list li input[type="checkbox"]:hover {
    border-color: #7a6d52;
}

#completed-todo-list li input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(199, 185, 155, 0.45);
}

.empty-message {
    max-width: 500px;
    margin: 1.5rem auto 0;
    padding: 1rem;
    text-align: center;
    color: gray;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

#todo-toasts {
    position: fixed;
    top: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 80;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: max-content;
    max-width: calc(100% - 2rem);
    margin: 0;
    padding: 0;
    background: none;
    pointer-events: none;
}

.todo-toast {
    margin: 0;
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    color: #9a5a4a;
    background-color: #f6eee6;
    border: 1px solid #c7b99b;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
    animation: todo-toast-in 0.35s ease;
}

.todo-toast-out {
    animation: todo-toast-out 0.4s ease forwards;
}

@keyframes todo-toast-in {
    from {
        opacity: 0;
        transform: translateY(-18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes todo-toast-out {
    to {
        opacity: 0;
        transform: translateY(-28px);
    }
}

#todo-list li span,
#completed-todo-list li span {
    cursor: text;
}

#todo-list li span:focus,
#completed-todo-list li span:focus {
    outline: none;
    border: 1px solid #c7b99b;
    box-shadow: 0 0 0 2px rgba(199, 185, 155, 0.25);
}

#bin-container-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2rem;
    margin-bottom: 1.5rem;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background-color: #fff;
    border: 1px solid #c7b99b;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

#bin-container-checkbox label {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background-color: #c7b99b;
    color: #fff;
    font-weight: 700;
    border-radius: 0.25rem;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

#bin-container-checkbox label:hover {
    background-color: #b3a589;
    color: #fff;
}

#bin-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    pointer-events: none;
}

#bin-list-container {
    display: none;
}

#bin-container-checkbox:has(#bin-checkbox:checked) ~ #bin-list-container {
    display: block;
}

#bin-actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

#completed-actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

#bin-restore-all,
#bin-empty-all,
#completed-bin-all {
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-weight: 700;
    color: #fff;
    background-color: #c7b99b;
    transition: background-color 0.2s ease;
}

#bin-empty-all:hover {
    background-color: #8f4b4b;
}

#bin-restore-all:hover {
    background-color: #b3a589;
}

#completed-bin-all:hover {
    background-color: #b3a589;
}

#bin-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 1.5rem auto 0;
    max-width: 500px;
}

#bin-list li {
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-top: 2px solid #8d7f60;
}

#bin-list li:not([hidden]) {
    display: flex;
}

#bin-list li span {
    flex: 1;
    word-break: break-all;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    color: #8d7f60;
    opacity: 0.7;
}

#bin-list .bin-restore {
    border: none;
    background-color: #c7b99b;
    color: #fff;
    border-radius: 0.25rem;
    cursor: pointer;
    font-weight: 700;
    padding: 0.35rem 0.6rem;
    flex-shrink: 0;
}

#bin-list .bin-delete {
    border: none;
    background-color: darkgray;
    color: #fff;
    border-radius: 0.25rem;
    cursor: pointer;
    width: 1.3rem;
    height: 1.1rem;
    flex-shrink: 0;
}

#bin-list .bin-delete:hover {
    background-color: #8f4b4b;
}

#bin-confirm {
    max-width: 500px;
    margin: 1rem auto 0;
    padding: 1rem;
    text-align: center;
    background-color: #fff;
    border: 1px solid #c7b99b;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

#bin-confirm p {
    margin-bottom: 0.75rem;
    color: #8d7f60;
    font-size: 1rem;
}

#bin-confirm button {
    border: none;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-weight: 700;
    color: #fff;
    background-color: darkgray;
}

#bin-confirm-empty {
    background-color: #8f4b4b;
}

header {
    position: relative;
}

#theme-toggle {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 56px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    display: block;
    box-sizing: border-box;
    line-height: 0;
    font-size: 0;
    appearance: none;
    -webkit-appearance: none;
    background-color: #8d7f60;
    transition: background-color 0.2s ease;
    color-scheme: light;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

#theme-toggle:hover {
    background-color: #7a6d52;
}

#theme-toggle:focus-visible {
    outline: 2px solid #d7c79e;
    outline-offset: 2px;
}

.theme-toggle-sun,
.theme-toggle-moon,
.theme-toggle-knob {
    position: absolute;
    pointer-events: none;
}

.theme-toggle-sun {
    left: 7px;
    top: 7px;
    width: 14px;
    height: 14px;
    color: #8d7f60;
    background-color: transparent;
    z-index: 2;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.theme-toggle-sun svg {
    display: block;
    width: 100%;
    height: 100%;
    transform: translateZ(0);
}

.theme-toggle-moon {
    right: 8px;
    top: 8px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    color: #d7c79e;
    background-color: transparent;
    box-shadow: inset 3px -2px 0 0 currentColor;
    z-index: 2;
}

.theme-toggle-knob {
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: #d7c79e;
    transform: translateX(0);
    transition: transform 0.2s ease;
    z-index: 1;
}

[data-theme="dark"] #theme-toggle .theme-toggle-knob {
    transform: translateX(28px);
}

[data-theme="dark"] #theme-toggle .theme-toggle-sun {
    color: #d7c79e;
}

[data-theme="dark"] #theme-toggle .theme-toggle-moon {
    color: #8d7f60;
}

[data-theme="dark"] {
    color-scheme: dark;
}

[data-theme="dark"] body {
    background-color: #202020;
    color: #eeeeee;
    border-color: #4a4a4a;
}

[data-theme="dark"] header {
    background-color: #8d7f60;
}

[data-theme="dark"] h1 {
    color: #d7c79e;
    border-bottom-color: #d7c79e;
}

[data-theme="dark"] p,
[data-theme="dark"] .empty-message {
    color: #b8b8b8;
}

[data-theme="dark"] .empty-message,
[data-theme="dark"] #todo-list li,
[data-theme="dark"] #completed-todo-list li,
[data-theme="dark"] #bin-list li,
[data-theme="dark"] #completed-todo-container-checkbox,
[data-theme="dark"] #bin-container-checkbox,
[data-theme="dark"] #bin-confirm,
[data-theme="dark"] #todo-tools {
    background-color: #2b2b2b;
    border-color: #4a4a4a;
}

[data-theme="dark"] #todo-tools-row label {
    color: #d7c79e;
}

[data-theme="dark"] .todo-search-icon {
    color: #d7c79e;
}

[data-theme="dark"] #todo-input,
[data-theme="dark"] #todo-search,
[data-theme="dark"] #todo-sort,
[data-theme="dark"] #todo-search-in,
[data-theme="dark"] #todo-tag-filter,
[data-theme="dark"] #todo-list li span,
[data-theme="dark"] #completed-todo-list li span,
[data-theme="dark"] #bin-list li span {
    background-color: #1f1f1f;
    color: #f2f2f2;
    border-color: #4a4a4a;
}

[data-theme="dark"] #todo-list .todo-last-done,
[data-theme="dark"] #completed-todo-list .todo-last-done {
    background-color: transparent;
    color: #d4a08c;
    box-shadow: none;
}

[data-theme="dark"] .todo-toast {
    color: #d4a08c;
    background-color: #2b2b2b;
    border-color: #4a4a4a;
}
[data-theme="dark"] #todo-list .todo-tag,
[data-theme="dark"] #completed-todo-list .todo-tag {
    color: #fff;
    box-shadow: none;
}

[data-theme="dark"] #todo-list .todo-tag.work,
[data-theme="dark"] #completed-todo-list .todo-tag.work {
    background-color: #8d7f60;
}

[data-theme="dark"] #todo-list .todo-tag.home,
[data-theme="dark"] #completed-todo-list .todo-tag.home {
    background-color: #b2a486;
}

[data-theme="dark"] #todo-list .todo-tag.personal,
[data-theme="dark"] #completed-todo-list .todo-tag.personal {
    background-color: #7a6d52;
}

[data-theme="dark"] #todo-input::placeholder,
[data-theme="dark"] #todo-search::placeholder {
    color: #a9a9a9;
}

[data-theme="dark"] #todo-add,
[data-theme="dark"] #completed-todo-container-checkbox label,
[data-theme="dark"] #bin-container-checkbox label,
[data-theme="dark"] #bin-restore-all,
[data-theme="dark"] #bin-empty-all,
[data-theme="dark"] #completed-bin-all {
    background-color: #8d7f60;
}

[data-theme="dark"] #todo-add:hover,
[data-theme="dark"] #completed-todo-container-checkbox label:hover,
[data-theme="dark"] #bin-container-checkbox label:hover,
[data-theme="dark"] #bin-restore-all:hover,
[data-theme="dark"] #completed-bin-all:hover {
    background-color: #7a6d52;
}

[data-theme="dark"] #bin-empty-all:hover {
    background-color: #8f4b4b;
}

[data-theme="dark"] #theme-toggle {
    background-color: #2b2b2b;
}

[data-theme="dark"] #theme-toggle:hover {
    background-color: #3a3a3a;
}

[data-theme="dark"] #bin-confirm p {
    color: #d7c79e;
}

#task-editor {
    position: fixed;
    inset: 0;
    z-index: 10;
    align-items: center;
    justify-content: center;
}

#task-editor:not([hidden]) {
    display: flex;
}

#task-editor-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.45);
}

#task-editor-panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    margin: 1rem;
    padding: 1.25rem;
    background-color: #fff;
    border: 1px solid #c7b99b;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

#task-editor-panel > * {
    flex-shrink: 0;
}

#task-editor-close {
    align-self: flex-end;
    border: none;
    padding: 0.35rem 0.75rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-weight: 700;
    color: #fff;
    background-color: #8d7f60;
    transition: background-color 0.2s ease;
}

#task-editor-close:hover {
    background-color: #7a6d52;
}

#task-editor-heading {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    color: #8d7f60;
}

#task-editor-panel label {
    display: block;
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
    font-weight: 700;
    color: #8d7f60;
}

#task-editor-title,
#task-editor-notes,
#task-editor-due,
#task-editor-priority,
#task-editor-tag,
#task-editor-repeat {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
    font-size: 16px;
    font-family: inherit;
}

#task-editor-notes {
    min-height: 7.5rem;
    resize: vertical;
}

#task-editor-repeat-days {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.task-editor-repeat-day,
#task-editor-repeat-fortnight {
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 2px solid #8d7f60;
    border-radius: 50%;
    background-color: transparent;
    color: #8d7f60;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    opacity: 0.4;
}

#task-editor-repeat-fortnight {
    width: 2.1rem;
    border-radius: 0.9rem;
    border-radius: 0.4rem;
    border-style: dashed;
}

.task-editor-repeat-day[aria-pressed="true"],
#task-editor-repeat-fortnight[aria-pressed="true"] {
    opacity: 1;
    background-color: #8d7f60;
    color: #fff;
}

[data-theme="dark"] .task-editor-repeat-day,
[data-theme="dark"] #task-editor-repeat-fortnight {
    border-color: #d7c79e;
    color: #d7c79e;
}

[data-theme="dark"] .task-editor-repeat-day[aria-pressed="true"],
[data-theme="dark"] #task-editor-repeat-fortnight[aria-pressed="true"] {
    background-color: #d7c79e;
    color: #2b2b2b;
}

#task-editor-subtasks-block {
    margin-top: 0.75rem;
}

#task-editor-subtasks-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

#task-editor-subtasks-heading,
#task-editor-subtasks-count {
    margin: 0;
    font-weight: 700;
    color: #8d7f60;
}

#task-editor-subtasks-count {
    font-weight: 400;
}

#task-editor-subtasks-progress {
    height: 6px;
    margin-top: 0.4rem;
    background-color: #e8e0d0;
    border-radius: 99px;
    overflow: hidden;
}

#task-editor-subtasks-progress-fill {
    width: 0%;
    height: 100%;
    background-color: #8d7f60;
}

#task-editor-subtasks {
    list-style: none;
    margin: 0.6rem 0 0;
    padding: 0 0 0 0.75rem;
    border-left: 2px solid #8d7f60;
    min-height: 0;
}

#task-editor-subtasks li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

#task-editor-subtasks li input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    border: 2px solid #8d7f60;
    border-radius: 50%;
    background-color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
}

#task-editor-subtasks li input[type="checkbox"]:checked {
    background-color: #8d7f60;
    border-color: #8d7f60;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8"><path fill="%23fff" d="M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z"/></svg>');
    background-size: 70%;
    background-repeat: no-repeat;
    background-position: center;
}

#task-editor-subtasks li span {
    flex: 1;
    word-break: break-word;
}

#task-editor-subtasks li input[type="checkbox"]:checked + span {
    text-decoration: line-through;
    opacity: 0.55;
}

#task-editor-subtasks li button {
    border: none;
    background-color: darkgray;
    color: #fff;
    border-radius: 0.25rem;
    cursor: pointer;
    width: 1.3rem;
    height: 1.1rem;
    flex-shrink: 0;
    font-size: 0.75rem;
}

#task-editor-subtasks li button:hover {
    background-color: #8f4b4b;
    color: #fff;
}

#task-editor-subtask-input {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
    font-size: 16px;
    font-family: inherit;
}

#task-editor-subtask-add {
    margin-top: 0.4rem;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-weight: 700;
    color: #fff;
    background-color: #c7b99b;
}

#task-editor-subtask-add:hover {
    background-color: #b3a589;
}

#task-editor-created-wrap {
    margin-top: 0.75rem;
    text-align: right;
    font-size: 1rem;
}

#task-editor-panel label[for="task-editor-done"] {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#task-editor-done {
    width: 1.1rem;
    height: 1.1rem;
    border: 2px solid #8d7f60;
    border-radius: 50%;
    background-color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
}

#task-editor-done:checked {
    background-color: #8d7f60;
    border-color: #8d7f60;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8"><path fill="%23fff" d="M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z"/></svg>');
    background-size: 70%;
    background-repeat: no-repeat;
    background-position: center;
}

#task-editor-done:hover {
    border-color: #7a6d52;
}

#task-editor-done:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px rgba(199, 185, 155, 0.45);
}

[data-theme="dark"] #task-editor-panel {
    background-color: #2b2b2b;
    border-color: #4a4a4a;
}

[data-theme="dark"] #task-editor-heading,
[data-theme="dark"] #task-editor-panel label,
[data-theme="dark"] #task-editor-created-wrap {
    color: #d7c79e;
}

[data-theme="dark"] #task-editor-subtasks-heading,
[data-theme="dark"] #task-editor-subtasks-count {
    color: #d7c79e;
}

[data-theme="dark"] #task-editor-subtasks {
    border-left-color: #d7c79e;
}

[data-theme="dark"] #task-editor-subtasks-progress {
    background-color: #3a3a3a;
}

[data-theme="dark"] #task-editor-subtask-input {
    background-color: #1f1f1f;
    color: #f2f2f2;
    border-color: #4a4a4a;
}

[data-theme="dark"] #task-editor-title,
[data-theme="dark"] #task-editor-notes,
[data-theme="dark"] #task-editor-due,
[data-theme="dark"] #task-editor-priority,
[data-theme="dark"] #task-editor-tag,
[data-theme="dark"] #task-editor-repeat {
    background-color: #1f1f1f;
    color: #f2f2f2;
    border-color: #4a4a4a;
}

#todo-list .todo-details,
#completed-todo-list .todo-details {
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    padding: 0.15rem 0.4rem;
    line-height: 1;
    background-color: #c7b99b;
}

#todo-list .todo-details:hover,
#completed-todo-list .todo-details:hover {
    width: auto;
    height: auto;
    background-color: #b3a589;
}

#todo-list .todo-drag-handle,
#completed-todo-list .todo-drag-handle {
    width: 0.85rem;
    height: 1.2rem;
    padding: 0;
    border: none;
    background-color: transparent;
    background-image:
        radial-gradient(circle, #8d7f60 1.15px, transparent 1.25px),
        radial-gradient(circle, #8d7f60 1.15px, transparent 1.25px);
    background-size: 0.38rem 0.38rem;
    background-position: 0.05rem 0.08rem, 0.42rem 0.08rem;
    background-repeat: repeat-y;
    box-shadow: none;
    cursor: grab;
    flex-shrink: 0;
}

#todo-list .todo-drag-handle:hover,
#completed-todo-list .todo-drag-handle:hover {
    width: 0.85rem;
    height: 1.2rem;
    background-color: transparent;
}

#todo-list .todo-drag-handle:active,
#completed-todo-list .todo-drag-handle:active {
    cursor: grabbing;
}

[data-theme="dark"] #todo-list .todo-drag-handle,
[data-theme="dark"] #completed-todo-list .todo-drag-handle {
    background-image:
        radial-gradient(circle, #d7c79e 1.15px, transparent 1.25px),
        radial-gradient(circle, #d7c79e 1.15px, transparent 1.25px);
    background-size: 0.38rem 0.38rem;
    background-position: 0.05rem 0.08rem, 0.42rem 0.08rem;
}

#todo-list .todo-dragging,
#completed-todo-list .todo-dragging {
    position: fixed;
    z-index: 40;
    margin: 0;
    pointer-events: none;
    box-shadow: 0 10px 24px rgba(141, 127, 96, 0.4);
    cursor: grabbing;
}

#todo-list .todo-drag-placeholder,
#completed-todo-list .todo-drag-placeholder {
    padding: 0;
    box-shadow: none;
    background-color: #e8e0d0;
    border: 2px dashed #8d7f60;
    box-sizing: border-box;
}

[data-theme="dark"] #todo-list .todo-drag-placeholder,
[data-theme="dark"] #completed-todo-list .todo-drag-placeholder {
    background-color: #3a3a3a;
    border-color: #d7c79e;
}
