#taskTimeGlobalWidget {
    position: fixed;
    right: 0;
    bottom: 90px;
    z-index: 1060;
    display: block;
    --task-time-panel-width: 360px;
    --task-time-running-title-font-size: 0.87rem;
    pointer-events: none;
}

#taskTimeGlobalWidget * {
    pointer-events: auto;
}

#taskTimeGlobalWidget .task-time-widget-toggle {
    position: relative;
    z-index: 2;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-height: 42px;
    min-width: 42px;
}

#taskTimeGlobalWidget .task-time-widget-launcher {
    position: relative;
    z-index: 2;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
    min-height: 42px;
    min-width: 42px;
    width: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#taskTimeGlobalWidget.expanded .task-time-widget-launcher {
    display: none;
}

#taskTimeGlobalWidget:not(.expanded) .task-time-widget-toggle {
    display: none;
}

#taskTimeGlobalWidget.expanded .task-time-widget-toggle {
    display: inline-flex;
    position: absolute;
    right: var(--task-time-panel-width);
    bottom: 0;
}

#taskTimeGlobalWidget .task-time-widget-panel {
    position: absolute;
    right: 0;
    bottom: 0;
    z-index: 1;
    width: 360px;
    max-width: calc(100vw - 24px);
    border: 1px solid rgba(13, 110, 253, 0.2);
    border-right: 0;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 0;
    /* box-shadow: 0 12px 24px rgba(0, 0, 0, 0.14); */
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    transform: translateX(100%);
    transition: transform 0.24s ease;
    background: #fff;
    overflow: hidden;
}

#taskTimeGlobalWidget.expanded .task-time-widget-panel {
    transform: translateX(0);
}

#taskTimeGlobalWidget .task-time-widget-header {
    padding: 10px 12px;
    border-bottom: 1px solid #e9ecef;
    background: #fff;
}

#taskTimeGlobalWidget .task-time-widget-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

#taskTimeGlobalWidget .task-time-widget-title {
    font-weight: 600;
    font-size: 0.92rem;
    color: #1e3a5f;
}

#taskTimeGlobalWidget .task-time-widget-count {
    font-size: 0.72rem;
    font-weight: 600;
    color: #495057;
}

#taskTimeGlobalWidget .task-time-widget-body {
    padding: 12px;
    max-height: 360px;
    overflow-y: auto;
}

#taskTimeGlobalWidget .task-time-widget-body::-webkit-scrollbar {
    width: 6px;
}

#taskTimeGlobalWidget .task-time-widget-body::-webkit-scrollbar-thumb {
    background: #d5deed;
    border-radius: 3px;
}

/* Card da tarefa em execução (fixado no topo) */
#taskTimeGlobalWidget .task-time-widget-running {
    padding: 12px 12px 0;
    border-bottom: 1px solid #e9ecef;
    background: linear-gradient(135deg, #eef4ff 0%, #f7faff 100%);
}

#taskTimeGlobalWidget .task-time-widget-running[hidden] {
    display: none;
}

#taskTimeGlobalWidget .task-time-widget-running-card {
    border: 1px solid rgba(79, 128, 255, 0.35);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(30, 58, 95, 0.08);
}

#taskTimeGlobalWidget .task-time-widget-running-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #285ec7;
    margin-bottom: 6px;
}

#taskTimeGlobalWidget .task-time-widget-running-label .pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #28a745;
    animation: taskWidgetPulse 1.6s ease-in-out infinite;
}

#taskTimeGlobalWidget .task-time-widget-running-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e3a5f;
    line-height: 1.25;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#taskTimeGlobalWidget .task-time-widget-running-sub {
    font-size: 0.78rem;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#taskTimeGlobalWidget .task-time-widget-running-counter {
    font-size: 1.3rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #1e3a5f;
    line-height: 1;
    margin-top: 8px;
}

/* Cards de tarefa */
#taskTimeGlobalWidget .task-time-widget-task {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 8px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#taskTimeGlobalWidget .task-time-widget-task:hover {
    border-color: rgba(79, 128, 255, 0.45);
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.08);
}

#taskTimeGlobalWidget .task-time-widget-task-main {
    flex: 1 1 auto;
    min-width: 0;
}

#taskTimeGlobalWidget .task-time-widget-task-title {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
}

#taskTimeGlobalWidget .task-time-widget-task-id {
    font-size: 0.72rem;
    font-weight: 700;
    color: #4f80ff;
    flex: 0 0 auto;
}

#taskTimeGlobalWidget .task-time-widget-task-name {
    font-size: 0.87rem;
    font-weight: 600;
    color: #223149;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#taskTimeGlobalWidget .task-time-widget-task-sub {
    font-size: 0.76rem;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
}

#taskTimeGlobalWidget .task-time-widget-task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

#taskTimeGlobalWidget .task-time-widget-footer {
    border-top: 1px solid #e9ecef;
    min-height: 42px;
    height: 42px;
    width: 100%;
    max-width: 100%;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    border-radius: 0 !important;
    overflow: hidden;
}

#taskTimeGlobalWidget .task-time-widget-footer .task-time-widget-footer-icon {
    flex: 0 0 auto;
}

#taskTimeGlobalWidget .task-time-widget-footer .task-time-widget-footer-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.05;
    overflow: hidden;
}

#taskTimeGlobalWidget .task-time-widget-footer .task-time-widget-footer-text {
    font-size: var(--task-time-running-title-font-size);
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    display: block;
}

#taskTimeGlobalWidget .task-time-widget-footer .task-time-widget-footer-counter {
    font-size: 0.76rem;
    font-weight: 700;
    opacity: 0.95;
    margin-top: 2px;
}

#taskTimeGlobalWidget .task-time-widget-footer .task-time-widget-footer-sub {
    font-size: 0.68rem;
    opacity: 0.85;
    margin-top: 1px;
}

#taskTimeGlobalWidget .task-time-widget-footer.btn-success {
    color: #fff;
}

#taskTimeGlobalWidget .task-time-widget-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #6c757d;
    font-size: 0.85rem;
    text-align: center;
    padding: 22px 8px;
}

#taskTimeGlobalWidget .task-time-widget-empty i {
    font-size: 1.5rem;
    color: #adb5bd;
}

#taskTimeGlobalWidget .task-time-widget-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #6c757d;
    font-size: 0.85rem;
    padding: 16px 0;
}

/* Badges */
#taskTimeGlobalWidget .task-time-widget-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    padding: 3px 7px;
    border-radius: 999px;
    white-space: nowrap;
}

/* Os tons de fundo/borda vem prontos do JS (--task-status-bg / --task-status-border).
   Evitamos color-mix() aqui porque o valor computado (color(srgb ...)) quebra a
   captura de tela do suporte via html2canvas. */
#taskTimeGlobalWidget .task-time-widget-badge-status {
    color: var(--task-status-color, #6c757d);
    background: var(--task-status-bg, #f1f3f5);
    border: 1px solid var(--task-status-border, #dee2e6);
}

#taskTimeGlobalWidget .task-time-widget-badge-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--task-status-color, #6c757d);
}

#taskTimeGlobalWidget .task-time-widget-badge--overdue {
    color: #dc3545;
    background: #fff0f0;
    border: 1px solid #f5c2c7;
}

#taskTimeGlobalWidget .task-time-widget-badge--today {
    color: #0d6efd;
    background: #eef4ff;
    border: 1px solid #b6d4fe;
}

#taskTimeGlobalWidget .task-time-widget-badge--none,
#taskTimeGlobalWidget .task-time-widget-badge--effort {
    color: #495057;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

/* Foco visível e acessibilidade */
#taskTimeGlobalWidget .task-time-widget-toggle:focus-visible,
#taskTimeGlobalWidget .task-time-widget-launcher:focus-visible,
#taskTimeGlobalWidget .task-time-widget-task:focus-visible {
    outline: 2px solid #4f80ff;
    outline-offset: 2px;
}

@keyframes taskWidgetPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.45); }
    50% { box-shadow: 0 0 0 5px rgba(40, 167, 69, 0); }
}

@media (prefers-reduced-motion: reduce) {
    #taskTimeGlobalWidget .task-time-widget-panel {
        transition: none;
    }

    #taskTimeGlobalWidget .task-time-widget-running-label .pulse-dot {
        animation: none;
    }
}

@media (max-width: 767px) {
    #taskTimeGlobalWidget {
        bottom: 76px;
    }

    #taskTimeGlobalWidget .task-time-widget-panel {
        width: calc(100vw - 42px);
        max-width: calc(100vw - 42px);
    }
}
