html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: none;
}

body {
    margin: 0;
    background: #f5f5f5;
    color: #222;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.todo-page {
    max-width: 640px;
    margin: 0 auto;
    padding: 14px;
}

.todo-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

    .todo-header h1 {
        margin: 0;
        font-size: 1.7rem;
        font-weight: 700;
    }

    .todo-header p {
        margin: 3px 0 0;
        color: #777;
        font-size: 0.92rem;
    }

.logout-btn {
    border: 0;
    background: transparent;
    color: #888;
    font-size: 0.9rem;
    padding: 8px;
    cursor: pointer;
    transition: color 0.15s ease;
}

    .logout-btn:hover {
        color: #222;
    }

.todo-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.todo-card {
    background: white;
    border-radius: 18px;
    padding: 14px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-left: 4px solid #ddd;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

    .todo-card:hover {
        transform: translateY(-1px);
        box-shadow: 0 8px 22px rgba(0,0,0,0.08);
    }

    .todo-card.priority-1 {
        border-left-color: #dc3545;
    }

    .todo-card.priority-2 {
        border-left-color: #fd7e14;
    }

    .todo-card.priority-3 {
        border-left-color: #adb5bd;
    }

.state-16 {
    border-left-color: #fd7e14;
}

.state-21 {
    border-left-color: #198754;
}

.todo-main {
    min-width: 0;
    flex: 1;
}

    .todo-main h2 {
        margin: 0;
        font-size: 1.08rem;
        line-height: 1.3;
        font-weight: 650;
    }

.video-prefix {
    color: #777;
    font-weight: 600;
}

.todo-title-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    justify-content: space-between;
}

.todo-status-pill {
    display: inline-block;
    margin-top: 5px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #f1f1f1;
    color: #666;
    font-size: 0.72rem;
    line-height: 1.2;
}

.todo-description-box {
    margin-top: 10px;
    padding: 11px 12px;
    background: #f7f8fc;
    border-radius: 12px;
    color: #444;
    font-size: 0.93rem;
    line-height: 1.5;
    white-space: pre-line;
    border-left: 3px solid #d7ddf7;
}

.todo-actions {
    display: flex;
    flex-direction: column;
    gap: 7px;
    align-items: flex-end;
    justify-content: center;
    opacity: 0.35;
    transition: opacity 0.2s ease;
}

.todo-card:hover .todo-actions,
.todo-card:focus-within .todo-actions {
    opacity: 1;
}

.action-btn {
    border: 0;
    border-radius: 999px;
    min-width: 36px;
    min-height: 34px;
    padding: 7px 10px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

    .action-btn:hover {
        transform: scale(1.06);
    }

.note-btn {
    background: #f1f3f9;
    color: #5b6475;
}

.done-btn {
    background: #edf8f1;
    color: #198754;
    font-weight: bold;
    font-size: 1rem;
}

.copy-title-btn {
    opacity: 0;
    border: 0;
    background: #f1f1f1;
    color: #777;
    border-radius: 999px;
    font-size: 0.72rem;
    padding: 5px 8px;
    cursor: pointer;
    transition: opacity 0.2s ease, background 0.15s ease;
}

.todo-card:hover .copy-title-btn,
.todo-card:focus-within .copy-title-btn {
    opacity: 1;
}

.copy-title-btn:hover {
    background: #e4e4e4;
}

.empty-state {
    background: white;
    border-radius: 18px;
    padding: 24px;
    text-align: center;
    color: #555;
    box-shadow: 0 4px 14px rgba(0,0,0,0.05);
}

.add-todo-form {
    background: white;
    border-radius: 18px;
    padding: 12px;
    margin-bottom: 14px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.add-title-input,
.add-description-input {
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 11px 12px;
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
    background: white;
}

    .add-title-input:focus,
    .add-description-input:focus,
    .note-textarea:focus {
        outline: none;
        border-color: #c7c7c7;
    }

.add-description-input {
    resize: vertical;
}

.add-todo-btn {
    border: 0;
    border-radius: 999px;
    background: #212529;
    color: white;
    font-weight: 600;
    padding: 11px 14px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

    .add-todo-btn:hover {
        opacity: 0.92;
    }

.priority-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.priority-toggle-btn,
.priority-save-btn,
.priority-delete-btn {
    border: 0;
    border-radius: 999px;
    padding: 9px 12px;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.priority-toggle-btn,
.priority-delete-btn {
    background: #ededed;
    color: #444;
}

    .priority-toggle-btn:hover,
    .priority-delete-btn:hover {
        background: #e3e3e3;
    }

.delete-btn {
    background: #f8ecec;
    color: #b02a37;
    font-weight: bold;
    font-size: 1rem;
}

.priority-save-btn {
    background: #198754;
    color: white;
    font-weight: 600;
}

.autosave-msg {
    font-size: 0.84rem;
    color: #777;
    align-self: center;
}

.drag-handle {
    display: none;
    border: 0;
    background: transparent;
    color: #999;
    font-size: 1.3rem;
    padding: 0 6px 0 0;
    cursor: grab;
    align-self: center;
}

.ordering-mode .drag-handle {
    display: block;
}

.ordering-mode .todo-actions,
.ordering-mode .copy-title-btn {
    display: none;
}

.ordering-mode .todo-card {
    touch-action: manipulation;
}

.dragging {
    opacity: 0.45;
}

.note-edit-card {
    margin-bottom: 14px;
}

.note-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.note-label {
    font-weight: 600;
    color: #444;
}

.note-textarea {
    width: 100%;
    min-height: 260px;
    resize: vertical;
    border: 1px solid #e5e5e5;
    border-radius: 18px;
    padding: 14px;
    font-size: 1rem;
    line-height: 1.45;
    box-shadow: 0 4px 14px rgba(0,0,0,0.05);
    box-sizing: border-box;
    background: white;
}

.save-note-btn {
    border: 0;
    border-radius: 999px;
    background: #198754;
    color: white;
    font-weight: 600;
    padding: 13px 16px;
    font-size: 1rem;
    cursor: pointer;
}

@media (hover: none) {
    .todo-actions {
        opacity: 0.75;
    }

    .copy-title-btn {
        opacity: 0.65;
    }
}

@media (max-width: 420px) {
    .todo-page {
        padding: 10px;
    }

    .todo-card {
        border-radius: 16px;
        padding: 12px;
    }

    .todo-actions {
        min-width: 52px;
    }

    .todo-main h2 {
        font-size: 1rem;
    }

    .todo-status-pill {
        font-size: 0.68rem;
    }
}

.rich-text-content p {
    margin-top: 0;
    margin-bottom: 8px;
}

.rich-text-content ul,
.rich-text-content ol {
    margin-top: 6px;
    margin-bottom: 6px;
    padding-left: 22px;
}

.rich-text-content b,
.rich-text-content strong {
    font-weight: 700;
}

.rich-text-content br {
    line-height: 1.5;
}

.mode-delete-btn {
    display: none;
}

.delete-mode .mode-done-btn {
    display: none;
}

.delete-mode .mode-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.drag-chosen {
    transform: scale(1.025);
    box-shadow: 0 14px 32px rgba(0,0,0,0.16);
    z-index: 10;
}

.drag-moving {
    opacity: 0.96;
}

.drag-placeholder {
    opacity: 0.25;
    transform: scale(0.98);
}

.todo-list .todo-card {
    transition: transform 0.22s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.sortable-fallback {
    opacity: 0.95;
    transform: scale(1.02);
    pointer-events: none;
}

.is-dragging .todo-card {
    transition: transform 0.22s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.18s ease, opacity 0.18s ease;
}

.drag-chosen {
    transform: scale(1.035) !important;
    box-shadow: 0 16px 36px rgba(0,0,0,0.18) !important;
    z-index: 20;
}

.drag-moving {
    opacity: 1 !important;
}

.drag-placeholder {
    opacity: 0.22 !important;
    transform: scale(0.98);
}

body.refreshing::before {
    content: 'A atualizar...';
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    color: white;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.85rem;
    z-index: 9999;
}

.top-menu {
    background: #222;
    padding: 12px 16px;
    margin-bottom: 20px;
}

    .top-menu nav {
        display: flex;
        gap: 16px;
    }

    .top-menu a {
        color: white;
        text-decoration: none;
        font-weight: 600;
    }

        .top-menu a:hover {
            text-decoration: underline;
        }

.video-cards {
    display: grid;
    gap: 14px;
}

.video-card {
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.video-date {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 6px;
}

.video-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.video-state-form {
    display: flex;
    gap: 8px;
}

    .video-state-form select {
        flex: 1;
        padding: 8px;
    }

.btn-alterar {
    background: #f0ad4e;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-weight: 600;
    cursor: pointer;
}

    .btn-alterar:hover {
        background: #ec971f;
    }

@media (max-width: 600px) {
    .video-state-form {
        flex-direction: column;
    }

    .btn-alterar {
        width: 100%;
    }
}