/* Managed Flows: a dossier screen drawn in the application's own look (hero of the homepage).
   Values follow the product's CSS: status-stepper.css, workflow-panel.css, forms.css and
   site.css (Bootstrap 5 with its system font stack). Kept close to the real screen on purpose:
   phase bar on top, the form card, and the workflow card as a separate block. */

.mf-app {
    --app-red: #d63b47;
    --app-text: #212529;
    --app-heading: #1f2937;
    --app-muted: #6c757d;
    --app-line: #e5e7eb;
    --app-field: #f1f3f5;
    --app-field-line: #dee2e6;
    position: relative;
    padding: 14px 14px 18px;
    border-radius: var(--mf-radius-xl);
    background: #eef0f3;
    box-shadow: var(--mf-shadow-lift);
    color: var(--app-text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;
    font-size: 13px;
    line-height: 1.45;
}

/* ---- Phase bar (status-stepper.css) ---- */

.mf-app-stepper {
    margin: 0 0 12px;
    padding: 8px 10px 6px;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.mf-app-stepper p { margin: 0 0 6px; font-weight: 600; }

/* The product scrolls a long phase bar sideways; here it fades out at the right edge instead of
   cutting a phase name in half. */
.mf-app-stepper ol {
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
    mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent);
    mask-repeat: no-repeat;
}

.mf-app-stepper li {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    height: 26px;
    margin-left: -10px;
    padding: 0 16px 0 20px;
    background: #f0f1f4;
    color: #6b7280;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
}

.mf-app-stepper li:first-child {
    margin-left: 0;
    padding-left: 12px;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%);
}

.mf-app-stepper li.is-done { background: #e5e7eb; color: #4a5568; }
.mf-app-stepper li.is-active { background: var(--app-red); color: #fff; }

/* ---- Form card (site.css .card, forms.css .sd-tabs and fields) ---- */

.mf-app-form {
    border: 1px solid var(--app-line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.mf-app-form-head {
    margin: 0;
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--app-line);
    color: var(--app-heading);
    font-size: 0.85rem;
    font-weight: 600;
}

.mf-app-tabs {
    display: flex;
    flex-wrap: wrap;
    margin: 0 0.9rem;
    padding: 0;
    border-bottom: 2px solid var(--app-line);
    list-style: none;
}

.mf-app-tabs li {
    margin-bottom: -2px;
    padding: 0.45rem 0.7rem;
    border-bottom: 2px solid transparent;
    color: var(--app-muted);
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
}

.mf-app-tabs li.is-active { border-bottom-color: var(--app-red); color: var(--app-red); font-weight: 600; }

.mf-app-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem 0.9rem;
    margin: 0;
    padding: 0.8rem 0.9rem 2.4rem;
}

.mf-app-fields dt { margin-bottom: 0.2rem; font-size: 0.74rem; font-weight: 600; }
.mf-app-fields dt b { color: var(--app-red); font-weight: 600; }

.mf-app-fields dd {
    min-height: 1.8rem;
    margin: 0;
    padding: 0.3rem 0.45rem;
    border: 1px solid var(--app-field-line);
    border-radius: 4px;
    background: var(--app-field);
    font-size: 0.74rem;
}

/* Fields on a whole row, as in the grant configuration; half width is a per-field setting. */
.mf-app-fields-full { grid-template-columns: 1fr; }

/* ---- Workflow card (workflow-panel.css) ---- */

.mf-app-wf {
    position: relative;
    width: 76%;
    margin: -28px 0 0 auto;
    padding: 0.75rem 0.85rem 0.85rem;
    border: 1px solid var(--app-line);
    border-left: 3px solid var(--app-red);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 18px 40px -18px rgba(22, 24, 63, 0.35);
    font-size: 0.78rem;
}

.mf-app-wf-title {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 0.5rem;
    font-weight: 600;
}

.mf-app-badge {
    flex: none;
    align-self: start;
    padding: 0.2rem 0.45rem;
    border-radius: 0.375rem;
    background: var(--app-red);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 600;
}

.mf-app-current {
    margin-bottom: 0.4rem;
    padding: 0.4rem 0.55rem;
    border: 1px solid #f0d0d3;
    border-left: 3px solid var(--app-red);
    border-radius: 0.375rem;
    background: #fff8f8;
}

.mf-app-current p {
    margin: 0 0 0.25rem;
    color: var(--app-red);
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.mf-app-current span {
    display: inline-block;
    padding: 0.2em 0.55em;
    border-radius: 0.375rem;
    background: var(--app-red);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 500;
}

.mf-app-meta { margin: 0 0 0.5rem; color: var(--app-muted); font-size: 0.7rem; }
.mf-app-meta b { color: #495057; }

.mf-app-check {
    margin-bottom: 0.55rem;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: #f8f9fa;
}

.mf-app-check-head { display: flex; justify-content: space-between; margin: 0 0 0.35rem; font-weight: 600; }
.mf-app-check-head span { color: var(--app-muted); font-weight: 400; }

.mf-app-progress {
    height: 6px;
    margin-bottom: 0.45rem;
    border-radius: 3px;
    background: #e9ecef;
    overflow: hidden;
}

.mf-app-progress i {
    display: block;
    width: 67%;
    height: 100%;
    background: #ffc107;
}

.mf-app-check ul { margin: 0; padding: 0; list-style: none; }

.mf-app-check li {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 1px 0;
    font-size: 0.72rem;
}

.mf-app-check li::before {
    content: "";
    flex: none;
    width: 12px;
    height: 12px;
    border: 1px solid #adb5bd;
    border-radius: 3px;
    background: #fff;
}

.mf-app-check li.is-done::before,
.mf-app-check li.mf-app-late::before {
    border-color: #0d6efd;
    background: #0d6efd no-repeat center / 8px 8px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1.5 5.2 4 7.5 8.5 2.5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.mf-app-check li.mf-app-late::before { border-color: #adb5bd; background-color: #fff; }
.mf-app-check li b { color: var(--app-red); font-weight: 400; }

.mf-app-actions-title { margin: 0 0 0.3rem; font-size: 0.7rem; font-weight: 600; }

.mf-app-action {
    display: block;
    margin-top: 0.3rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid #0d6efd;
    border-radius: 0.25rem;
    color: #0d6efd;
    font-size: 0.72rem;
    opacity: 0.6;
}

.mf-app-action::before {
    content: "";
    display: inline-block;
    width: 0.85em;
    height: 0.85em;
    margin-right: 0.4em;
    vertical-align: -0.1em;
    background-color: currentColor;
    /* Bootstrap Icons arrow-right-circle, as in the application */
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1 8a7 7 0 1 0 14 0A7 7 0 0 0 1 8m15 0A8 8 0 1 1 0 8a8 8 0 0 1 16 0M4.5 7.5a.5.5 0 0 0 0 1h5.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1 8a7 7 0 1 0 14 0A7 7 0 0 0 1 8m15 0A8 8 0 1 1 0 8a8 8 0 0 1 16 0M4.5 7.5a.5.5 0 0 0 0 1h5.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5z'/%3E%3C/svg%3E") center / contain no-repeat;
}

@media (max-width: 520px) {
    .mf-app-fields { grid-template-columns: 1fr; padding-bottom: 0.9rem; }
    .mf-app-fields div:nth-child(n + 3) { display: none; }
    .mf-app-wf { width: 100%; margin-top: 12px; }
}

.mf-app-count { display: inline-grid; }
.mf-app-count > span { grid-area: 1 / 1; }
.mf-app-count > span:last-child { opacity: 0; }
