/* Compact Impla Task/Offer UI — scoped under .impla-* */

.impla-source-task-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    padding: 10px 14px;
    margin: 0 0 14px;
    background: #f5f8fc;
    border: 1px solid #dbe4f0;
    border-inline-start: 3px solid #3b82f6;
    border-radius: 8px;
    color: #1f2937;
}

.impla-source-task-banner__main {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    flex: 1 1 220px;
}

.impla-source-task-banner__icon {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #e8f0fe;
    color: #2563eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.impla-source-task-banner__text {
    min-width: 0;
}

.impla-source-task-banner__title {
    font-weight: 600;
    font-size: 13px;
    line-height: 1.35;
    margin: 0;
}

.impla-source-task-banner__title a {
    color: #1d4ed8;
    text-decoration: none;
}

.impla-source-task-banner__title a:hover {
    text-decoration: underline;
}

.impla-source-task-banner__meta {
    margin: 2px 0 0;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.35;
}

.impla-source-task-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.impla-source-task-banner__actions .btn {
    margin: 0;
}

/* Offer Status stage badges (Task index) */
#task_table td .qs-badge-none { background: #9ca3af; }
#task_table td .qs-badge-pending { background: #d97706; }
#task_table td .qs-badge-awaiting-doctor { background: #2563eb; }
#task_table td .qs-badge-awaiting-contract { background: #0f766e; }
#task_table td .qs-badge-approved { background: #16a34a; }
#task_table td .qs-badge-rejected { background: #dc2626; }
#task_table td .qs-badge-ambiguous { background: #d97706; white-space: normal; max-width: 160px; }

/* Task Offer card */
.impla-offer-card {
    margin: 12px 0;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}

.impla-offer-card__head {
    padding: 10px 14px;
    border-bottom: 1px solid #eef2f7;
    font-weight: 600;
    font-size: 14px;
    color: #111827;
}

.impla-offer-card__body {
    padding: 14px;
}

.impla-offer-card__empty {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 12px;
}

.impla-offer-card__refs {
    font-size: 13px;
    margin: 0 0 12px;
    color: #374151;
}

.impla-offer-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.impla-offer-card__actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
}

.impla-offer-card .btn-create-offer {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.impla-offer-card .btn-view-offer {
    background: #fff;
    border: 1px solid #2563eb;
    color: #2563eb;
}

.impla-offer-card .btn-open-contract {
    background: #fff;
    border: 1px solid #16a34a;
    color: #16a34a;
}

.impla-offer-card .qs-link {
    font-weight: 600;
    color: #2563eb;
}

/* Pipeline stepper */
.impla-pipeline-stepper {
    display: flex;
    align-items: flex-start;
    gap: 0;
    margin: 0 0 16px;
    padding: 4px 0 8px;
    overflow-x: auto;
    list-style: none;
}

.impla-pipeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1 1 0;
    min-width: 88px;
    position: relative;
    text-align: center;
}

.impla-pipeline-step__node {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    background: #fff;
    color: #9ca3af;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    z-index: 1;
}

.impla-pipeline-step__label {
    margin-top: 8px;
    font-size: 11px;
    line-height: 1.3;
    color: #6b7280;
    max-width: 96px;
}

.impla-pipeline-step__connector {
    position: absolute;
    top: 13px;
    inset-inline-start: calc(50% + 16px);
    width: calc(100% - 32px);
    height: 2px;
    background: #e5e7eb;
}

.impla-pipeline-step.is-complete .impla-pipeline-step__node {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
}

.impla-pipeline-step.is-complete .impla-pipeline-step__connector {
    background: #16a34a;
}

.impla-pipeline-step.is-complete .impla-pipeline-step__label {
    color: #374151;
}

.impla-pipeline-step.is-current .impla-pipeline-step__label {
    color: #111827;
    font-weight: 700;
}

.impla-pipeline-step.is-current-task .impla-pipeline-step__node {
    background: #6b7280;
    border-color: #6b7280;
    color: #fff;
}

.impla-pipeline-step.is-current-pending_offer .impla-pipeline-step__node {
    background: #d97706;
    border-color: #d97706;
    color: #fff;
}

.impla-pipeline-step.is-current-doctor_decision .impla-pipeline-step__node {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.impla-pipeline-step.is-current-contract_approval .impla-pipeline-step__node {
    background: #0f766e;
    border-color: #0f766e;
    color: #fff;
}

.impla-pipeline-step.is-current-contract_created .impla-pipeline-step__node {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
}

.impla-pipeline-step.is-rejected .impla-pipeline-step__node {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

.impla-pipeline-step.is-rejected .impla-pipeline-step__label {
    color: #dc2626;
    font-weight: 700;
}

@media (max-width: 767px) {
    .impla-pipeline-stepper {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .impla-pipeline-step {
        flex-direction: row;
        align-items: center;
        min-width: 0;
        padding: 6px 0;
        gap: 10px;
    }

    .impla-pipeline-step__label {
        margin-top: 0;
        max-width: none;
        text-align: start;
        font-size: 13px;
    }

    .impla-pipeline-step__connector {
        display: none;
    }
}

/* Next Action callout */
.impla-next-action {
    margin: 12px 0 16px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid #dbe4f0;
    border-inline-start: 3px solid #2563eb;
    background: #f5f8fc;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    justify-content: space-between;
    align-items: center;
}

.impla-next-action--waiting {
    background: #fffbeb;
    border-color: #fde68a;
    border-inline-start-color: #d97706;
}

.impla-next-action--review {
    background: #fff7ed;
    border-color: #fdba74;
    border-inline-start-color: #ea580c;
}

.impla-next-action__title {
    margin: 0;
    font-weight: 700;
    font-size: 14px;
    color: #111827;
}

.impla-next-action__body {
    margin: 2px 0 0;
    font-size: 13px;
    color: #4b5563;
}

.impla-next-action__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.impla-next-action__actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
}

.impla-closure-requested-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    background: #fef3c7;
    color: #92400e;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
}

/* Desktop Task-column: compact inline badge + text-link (no panel) */
.impla-task-cell-workflow-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    margin-top: 3px;
    max-width: 100%;
    line-height: 1.3;
}

.impla-task-cell-workflow-inline .qs-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    color: #fff;
    white-space: nowrap;
}

.impla-task-cell-workflow-inline .qs-badge-pending { background: #d97706; }
.impla-task-cell-workflow-inline .qs-badge-approved { background: #16a34a; }
.impla-task-cell-workflow-inline .qs-badge-none { background: #9ca3af; }
.impla-task-cell-workflow-inline .qs-badge-awaiting,
.impla-task-cell-workflow-inline .qs-badge-awaiting-doctor { background: #2563eb; }
.impla-task-cell-workflow-inline .qs-badge-awaiting-contract { background: #0f766e; }
.impla-task-cell-workflow-inline .qs-badge-rejected { background: #dc2626; }
.impla-task-cell-workflow-inline .qs-badge-ambiguous {
    background: #d97706;
    white-space: normal;
    max-width: 160px;
}

.impla-task-cell-workflow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin-top: 4px;
    max-width: 220px;
}

/* Desktop: strip any panel chrome; sit inline under the task name */
.impla-task-cell-workflow--desktop {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    margin-top: 0;
    max-width: none;
    padding: 0;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.impla-task-cell-workflow--desktop .impla-closure-requested-badge {
    margin-top: 0;
    flex: 0 0 auto;
}

.impla-task-cell-workflow__link {
    display: inline;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    color: #1d4ed8;
    text-decoration: none;
    cursor: pointer;
    padding: 0;
    background: none;
    border: none;
    white-space: nowrap;
}

.impla-task-cell-workflow__link:hover,
.impla-task-cell-workflow__link:focus {
    text-decoration: underline;
    color: #1e40af;
    outline: none;
}

.impla-task-cell-workflow__link:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
    border-radius: 2px;
}

.impla-task-cell-workflow__link--muted {
    color: #b45309;
    font-weight: 600;
}

.impla-task-cell-workflow__link--muted:hover,
.impla-task-cell-workflow__link--muted:focus {
    color: #92400e;
}

.impla-task-cell-workflow__link--review {
    color: #c2410c;
}

.impla-task-cell-workflow__link--review:hover,
.impla-task-cell-workflow__link--review:focus {
    color: #9a3412;
}

.impla-task-cell-workflow__link--primary {
    color: #1d4ed8;
    font-weight: 700;
}

/* Mobile Daily Task cards: Offer/closure status + next action under Task name */
.impla-mobile-workflow {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin: 0 0 8px;
}

.impla-mobile-offer-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.impla-mobile-workflow .qs-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    color: #fff;
}

.impla-mobile-workflow .qs-badge-pending { background: #d97706; }
.impla-mobile-workflow .qs-badge-approved { background: #16a34a; }
.impla-mobile-workflow .qs-badge-none { background: #9ca3af; }
.impla-mobile-workflow .qs-badge-awaiting,
.impla-mobile-workflow .qs-badge-awaiting-doctor { background: #2563eb; }
.impla-mobile-workflow .qs-badge-awaiting-contract { background: #0f766e; }
.impla-mobile-workflow .qs-badge-rejected { background: #dc2626; }
.impla-mobile-workflow .qs-badge-ambiguous {
    background: #d97706;
    white-space: normal;
    max-width: 220px;
}

.impla-mobile-workflow .qs-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.impla-task-cell-workflow--mobile {
    max-width: none;
    width: 100%;
    margin-top: 0;
    gap: 8px;
}

.impla-task-cell-workflow--mobile .impla-task-cell-workflow__link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 6px 12px;
    border-radius: 8px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    font-size: 13px;
    text-decoration: none;
}

.impla-task-cell-workflow--mobile .impla-task-cell-workflow__link--muted {
    background: #fffbeb;
    border-color: #fde68a;
    color: #b45309;
}

.impla-task-cell-workflow--mobile .impla-task-cell-workflow__link--review {
    background: #fff7ed;
    border-color: #fdba74;
    color: #c2410c;
}

.impla-task-cell-workflow--mobile .impla-task-cell-workflow__link--primary {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}
