#view-todo {
    --todo-border: #dce3ed;
    --todo-panel: var(--surface);
    --todo-subtle: #f7f9fc;
    --todo-danger: #b91c1c;
    --todo-danger-soft: #fef2f2;
    --todo-warning-soft: #fffbeb;
    --todo-columns: 2rem minmax(0, 1fr) minmax(8rem, .28fr) minmax(8rem, .3fr) 7.5rem;
    display: grid;
    align-content: start;
    gap: 12px;
    min-width: 0;
    color: var(--text);
}

.dark #view-todo {
    --todo-border: #2b384d;
    --todo-panel: #111b2d;
    --todo-subtle: #172338;
    --todo-danger: #fca5a5;
    --todo-danger-soft: #39212b;
    --todo-warning-soft: #382d20;
}

#view-todo [hidden] {
    display: none !important;
}

#view-todo :is(.todo-toolbar, .todo-tabs, .todo-toolbar-actions, .todo-compose-tools, .todo-photo-tools, .todo-row-actions, .todo-dialog-actions) {
    display: flex;
    align-items: center;
}

#view-todo .todo-toolbar {
    justify-content: space-between;
    gap: 8px 16px;
    border-bottom: 1px solid var(--todo-border);
}

#view-todo .todo-tabs {
    align-self: stretch;
    gap: 4px;
}

#view-todo .todo-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 10px;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

#view-todo .todo-tab:hover,
#view-todo .todo-tab[aria-pressed="true"] {
    color: var(--action-text);
}

#view-todo .todo-tab[aria-pressed="true"] {
    border-bottom-color: var(--action);
}

#view-todo .todo-tab-count {
    color: var(--text-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

#view-todo .todo-toolbar-actions {
    gap: 12px;
    margin-left: auto;
    padding: 3px 0 7px;
}

#view-todo .todo-attention {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--danger-text);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

#view-todo :is(.todo-button, .todo-icon-button, .todo-complete) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

#view-todo .todo-button {
    min-height: 34px;
    padding: 0 11px;
    border-color: var(--todo-border);
    background: var(--todo-panel);
    font-size: 13px;
}

#view-todo .todo-button-quiet {
    border-color: transparent;
    background: transparent;
    font-size: 12px;
}

#view-todo :is(.todo-button, .todo-icon-button):hover {
    background: var(--todo-subtle);
    color: var(--text);
}

#view-todo .todo-button-primary {
    border-color: transparent;
    background: var(--action);
    color: white;
}

#view-todo .todo-button-primary:hover {
    background: var(--action-hover);
    color: white;
}

#view-todo button:disabled {
    opacity: .48;
    cursor: not-allowed;
}

#view-todo :is(.todo-composer, .todo-list) {
    min-width: 0;
    border: 1px solid var(--todo-border);
    border-radius: 9px;
    background: var(--todo-panel);
}

#view-todo .todo-composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "fields submit" "tools tools";
    gap: 6px 8px;
    padding: 12px;
}

#view-todo .todo-compose-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 8.5rem 9rem;
    grid-area: fields;
    gap: 8px;
}

#view-todo .todo-add {
    grid-area: submit;
    padding-inline: 14px;
}

#view-todo .todo-control {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--todo-border);
    border-radius: 6px;
    background: var(--todo-panel);
    color: var(--text);
    font-size: 13px;
    line-height: 1.4;
}

#view-todo .todo-control:hover {
    border-color: var(--text-muted);
}

#view-todo .todo-control::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

#view-todo #todo-input-title {
    font-size: 14px;
}

#view-todo :is(.todo-compose-priority, .todo-search) {
    position: relative;
    min-width: 0;
}

#view-todo :is(.todo-compose-priority, .todo-search) > i {
    position: absolute;
    top: 50%;
    left: 11px;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
    pointer-events: none;
}

#view-todo :is(.todo-compose-priority, .todo-search) .todo-control {
    padding-left: 32px;
}

#view-todo .todo-compose-tools {
    grid-area: tools;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px 10px;
}

#view-todo .todo-photo-picker {
    min-width: 0;
}

#view-todo .todo-photo-tools {
    flex-wrap: wrap;
    gap: 3px;
}

#view-todo #btn-todo-toggle-details[aria-expanded="true"] i {
    transform: rotate(180deg);
}

#view-todo .todo-photo-selection {
    color: var(--text-muted);
    font-size: 12px;
    overflow-wrap: anywhere;
}

#view-todo .todo-photo-selection:not(:empty) {
    margin-top: 4px;
}

#view-todo :is(.todo-optional-fields, .todo-editor-fields) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

#view-todo .todo-optional-fields {
    grid-column: 1 / -1;
    padding-top: 10px;
    margin-top: 2px;
    border-top: 1px solid var(--todo-border);
}

#view-todo .todo-field {
    display: grid;
    align-content: start;
    gap: 4px;
    min-width: 0;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

#view-todo textarea.todo-control {
    resize: vertical;
    font-weight: 400;
}

#view-todo .todo-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
}

#view-todo .todo-search {
    flex: 1 1 14rem;
}

#view-todo .todo-filters select {
    width: auto;
    max-width: 13rem;
}

#view-todo .todo-delete:hover {
    background: var(--todo-danger-soft);
    color: var(--danger-text);
}

#view-todo :is(.todo-column-headings, .todo-row) {
    display: grid;
    grid-template-columns: var(--todo-columns);
    align-items: center;
    column-gap: 12px;
    padding-inline: 14px;
}

#view-todo .todo-column-headings {
    padding-block: 7px;
    border-block: 1px solid var(--todo-border);
    background: var(--todo-subtle);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

#view-todo .todo-column-headings > :first-child {
    grid-column: 2;
}

#view-todo .todo-row {
    min-height: 62px;
    padding-block: 9px;
}

#view-todo .todo-row + .todo-row {
    border-top: 1px solid var(--todo-border);
}

#view-todo .todo-row:hover {
    background: var(--todo-subtle);
}

#view-todo .todo-row-content {
    min-width: 0;
}

#view-todo .todo-task-title {
    margin: 0;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

#view-todo .todo-row[data-done] .todo-task-title > [data-no-i18n] {
    color: var(--text-muted);
    text-decoration: line-through;
}

#view-todo .todo-priority {
    margin-inline-start: 4px;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--todo-warning-soft);
    color: var(--warning-text);
    font-size: 12px;
    white-space: nowrap;
}

#view-todo .todo-priority[data-priority="Urgente"] {
    background: var(--todo-danger-soft);
    color: var(--danger-text);
}

#view-todo .todo-related {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 2px 10px;
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 12px;
    overflow-wrap: anywhere;
}

#view-todo .todo-related button {
    min-height: 24px;
    color: var(--action-text);
    font-weight: 600;
}

#view-todo .todo-related button:hover {
    text-decoration: underline;
}

#view-todo .todo-related button i {
    margin-inline-start: 2px;
    font-size: 10px;
}

#view-todo .todo-note {
    margin: 2px 0 0;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#view-todo .todo-row-details {
    display: contents;
}

#view-todo :is(.todo-due, .todo-assignee) {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 2px 6px;
    min-width: 0;
    color: var(--text-secondary);
    font-size: 13px;
    overflow-wrap: anywhere;
}

#view-todo .todo-due time {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

#view-todo .todo-due span {
    font-size: 12px;
}

#view-todo .todo-overdue {
    color: var(--danger-text);
}

#view-todo .todo-due-today {
    color: var(--warning-text);
}

#view-todo :is(.todo-missing, .todo-assignee i) {
    color: var(--text-muted);
}

#view-todo .todo-assignee i {
    display: none;
    font-size: 11px;
}

#view-todo .todo-complete {
    align-self: center;
    min-height: 32px;
    padding: 0;
}

#view-todo .todo-complete > span {
    display: grid;
    width: 17px;
    height: 17px;
    place-items: center;
    border: 1px solid var(--text-muted);
    border-radius: 4px;
    background: var(--todo-panel);
    font-size: 10px;
}

#view-todo .todo-complete:hover > span {
    border-color: var(--action-text);
}

#view-todo .todo-row[data-done] .todo-complete > span {
    border-color: var(--action);
    background: var(--action);
    color: white;
}

#view-todo .todo-row-actions {
    justify-content: flex-end;
    gap: 2px;
}

#view-todo .todo-icon-button {
    gap: 4px;
    min-width: 33px;
    min-height: 33px;
    padding-inline: 6px;
    font-size: 13px;
}

#view-todo [data-todo-photo-count] {
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

#view-todo .todo-empty {
    margin: 0;
    padding: 26px 12px;
    border-top: 1px solid var(--todo-border);
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

#view-todo .todo-dialog {
    width: min(36rem, calc(100% - 24px));
    max-height: 92vh;
    margin: auto;
    padding: 16px;
    overflow-y: auto;
    border: 1px solid var(--todo-border);
    border-radius: 10px;
    background: var(--todo-panel);
    color: var(--text);
    box-shadow: 0 10px 28px rgb(7 17 38 / .18);
}

#view-todo dialog.todo-dialog::backdrop {
    background: rgb(7 17 38 / .55);
}

#view-todo .todo-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

#view-todo .todo-dialog-header h2 {
    margin: 2px 0 0;
    font-size: 16px;
    font-weight: 650;
}

#view-todo #todo-edit-form,
#view-todo .todo-dialog-photos {
    display: grid;
    gap: 12px;
}

#view-todo dialog .todo-dialog-photos {
    justify-items: start;
    margin-top: 12px;
}

#view-todo .todo-dialog-footer {
    display: grid;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--todo-border);
}

#view-todo .todo-dialog-actions {
    justify-content: flex-end;
    gap: 8px;
}

#view-todo .todo-form-error {
    color: var(--todo-danger);
    font-size: 13px;
}

#view-todo .todo-history {
    color: var(--text-muted);
    font-size: 12px;
    overflow-wrap: anywhere;
}

#view-todo .todo-photo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

#view-todo .todo-photo-grid img {
    width: 100%;
    max-height: 16rem;
    border: 1px solid var(--todo-border);
    border-radius: 6px;
    object-fit: contain;
}

@media (min-width: 1024px) {
    #view-todo .todo-optional-fields {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    #view-todo .todo-toolbar {
        flex-wrap: wrap;
    }

    #view-todo .todo-column-headings {
        display: none;
    }

    #view-todo .todo-row {
        grid-template-columns: 2.25rem minmax(0, 1fr) auto;
        grid-template-areas: "complete content content" ". details actions";
        gap: 3px 9px;
        padding-inline: 10px;
    }

    #view-todo .todo-row:first-child {
        border-top: 1px solid var(--todo-border);
    }

    #view-todo .todo-complete {
        grid-area: complete;
        align-self: start;
    }

    #view-todo .todo-row-content {
        grid-area: content;
        align-self: center;
    }

    #view-todo .todo-row-actions {
        grid-area: actions;
    }

    #view-todo .todo-row-details {
        display: flex;
        flex-wrap: wrap;
        gap: 3px 9px;
        grid-area: details;
    }

    #view-todo :is(.todo-assignee, .todo-due) {
        font-size: 12px;
    }

    #view-todo .todo-assignee i {
        display: inline-block;
    }

    #view-todo .todo-missing {
        display: none;
    }
}

@media (max-width: 767px) {
    #view-todo .todo-composer {
        grid-template-areas: "fields fields" "tools submit";
        align-items: start;
    }

    #view-todo .todo-compose-main {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #view-todo .todo-compose-tools {
        justify-content: flex-start;
        gap: 4px;
    }

    #view-todo .todo-compose-tools .todo-photo-tools > .todo-button {
        min-width: 36px;
        padding-inline: 8px;
    }

    #view-todo .todo-compose-tools .todo-photo-tools > .todo-button > span {
        display: none;
    }

    #view-todo .todo-add {
        min-height: 44px;
        padding-inline: 11px;
    }

    #view-todo #todo-input-title {
        grid-column: 1 / -1;
    }

    #view-todo .todo-control {
        min-height: 44px;
    }

    #view-todo :is(.todo-icon-button, .todo-complete) {
        min-height: 38px;
    }

    #view-todo .todo-icon-button {
        min-width: 38px;
    }

    #view-todo .todo-tab {
        min-height: 40px;
        padding-inline: 7px;
    }

    #view-todo .todo-toolbar-actions {
        padding-bottom: 4px;
    }

    #view-todo .todo-attention-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        overflow: hidden;
        clip-path: inset(50%);
    }

    #view-todo .todo-search {
        flex-basis: 100%;
    }

    #view-todo .todo-filters select {
        flex: 1 1 8rem;
        max-width: 100%;
    }
}

@media (max-width: 440px) {
    #view-todo .todo-print {
        min-width: 36px;
        min-height: 36px;
        padding-inline: 8px;
    }

    #view-todo .todo-print > span {
        display: none;
    }
}

@media (max-width: 369px) {
    #view-todo :is(.todo-optional-fields, .todo-editor-fields) {
        grid-template-columns: 1fr;
    }
}
