/* The ineligible flag: the panel on an application (banner for everyone, controls for an Admin with
   the permission) and the tag on the applicant's dashboard. All styling lives here per the
   stylesheet-only rule - no inline styles. Colors follow the V2 application screens; the rose is
   the one new hue, kept to text on a pale ground so it passes contrast (about 8:1). */

:root {
    --inel-ink: #7A1B1B;
    --inel-ink-soft: #8F3A3A;
    --inel-bg: #FDEEEE;
    --inel-line: #E8B7B7;
    --inel-strong: #A52A2A;
    --inel-text: #2B3A4B;
    --inel-muted: #5E6E84;
    --inel-blue: #005F85;
    --inel-blue-line: #C0D6EA;
    --inel-surface: #FFFFFF;
}

/* The hidden attribute must win over the display rules below (a flex box would otherwise show). */
.inel [hidden] {
    display: none !important;
}

/* ---------- panel on the application ---------- */

.inel {
    margin: 14px 0;
    color: var(--inel-text);
}

.inel-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--inel-line);
    border-left: 4px solid var(--inel-strong);
    border-radius: 6px;
    background: var(--inel-bg);
}

.inel-icon {
    flex: 0 0 auto;
    margin-top: 3px;
    font-size: 18px;
    color: var(--inel-strong);
}

.inel-banner-body {
    flex: 1 1 260px;
    min-width: 0;
}

.inel-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--inel-ink);
}

.inel-when {
    margin-left: 8px;
    font-weight: 500;
    font-size: 12px;
    color: var(--inel-ink-soft);
}

.inel-reason {
    margin-top: 6px;
    font-size: 14px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.inel-reason-label {
    display: inline-block;
    margin-right: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--inel-ink-soft);
}

.inel-note {
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--inel-muted);
}

.inel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-self: center;
}

.inel-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border: 1px solid var(--inel-blue-line);
    border-radius: 6px;
    background: #F2F8FC;
}

.inel-bar-text {
    margin-right: auto;
    font-size: 12.5px;
    font-weight: 600;
    color: #004A68;
}

.inel-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 7px 16px;
    border-radius: 5px;
    border: 1px solid var(--inel-blue-line);
    background: var(--inel-surface);
    color: var(--inel-blue);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}

    .inel-btn:hover:not(:disabled) {
        background: #EAF3FA;
    }

    .inel-btn:focus-visible,
    .inel-textarea:focus-visible,
    .inel-check input:focus-visible {
        outline: 2px solid var(--inel-blue);
        outline-offset: 2px;
    }

    .inel-btn:disabled {
        cursor: not-allowed;
        opacity: .55;
    }

.inel-btn-danger {
    border-color: var(--inel-strong);
    background: var(--inel-strong);
    color: #fff;
}

    .inel-btn-danger:hover:not(:disabled) {
        background: var(--inel-ink);
    }

.inel-btn-quiet {
    border-color: transparent;
    background: transparent;
}

/* ---------- dialog ---------- */

.inel-dialog {
    width: min(560px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid var(--inel-blue-line);
    border-radius: 8px;
    color: var(--inel-text);
    background: var(--inel-surface);
    box-shadow: 0 12px 40px rgba(16, 36, 56, .28);
}

    .inel-dialog::backdrop {
        background: rgba(16, 36, 56, .45);
    }

.inel-form {
    padding: 20px 22px 18px;
}

.inel-dialog-title {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
    color: #004A68;
}

.inel-dialog-lead {
    margin: 0 0 14px;
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--inel-muted);
}

.inel-label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 600;
}

.inel-req {
    color: var(--inel-strong);
}

.inel-textarea {
    display: block;
    width: 100%;
    resize: vertical;
    min-height: 96px;
    padding: 8px 10px;
    border: 1px solid #AFC2D6;
    border-radius: 5px;
    font: inherit;
    font-size: 14px;
    color: var(--inel-text);
}

.inel-count {
    margin-top: 3px;
    text-align: right;
    font-size: 11.5px;
    color: var(--inel-muted);
}

.inel-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 12px 0 0;
    padding: 10px 12px;
    border: 1px solid var(--inel-blue-line);
    border-radius: 6px;
    background: #F8FBFD;
    cursor: pointer;
    font-size: 13.5px;
}

    .inel-check input {
        flex: 0 0 auto;
        margin-top: 3px;
    }

.inel-check-hint {
    display: block;
    margin-top: 2px;
    font-size: 12.5px;
    color: var(--inel-muted);
}

.inel-warn {
    margin-top: 12px;
    padding: 9px 12px;
    border: 1px solid #F0D488;
    border-radius: 6px;
    background: #FFF8E1;
    color: #6B5100;
    font-size: 13px;
}

.inel-history {
    margin-top: 6px;
    max-height: 320px;
    overflow-y: auto;
    font-size: 13.5px;
}

.inel-h-item {
    padding: 10px 0;
    border-top: 1px solid #E3EAF2;
}

    .inel-h-item:first-child {
        border-top: 0;
    }

.inel-h-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
}

.inel-h-tag {
    font-weight: 700;
}

.inel-h-set {
    color: var(--inel-ink);
}

.inel-h-clear {
    color: #1F5F3B;
}

.inel-h-who {
    font-size: 12px;
    color: var(--inel-muted);
}

.inel-h-reason {
    margin-top: 3px;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.inel-h-meta {
    margin-top: 3px;
    font-size: 12px;
    color: var(--inel-muted);
}

.inel-msg {
    min-height: 18px;
    margin: 10px 0 0;
    font-size: 13px;
    color: var(--inel-muted);
}

.inel-msg-error {
    color: var(--inel-ink);
    font-weight: 600;
}

.inel-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

/* ---------- applicant dashboard ---------- */

/* A deemed-ineligible application shows this badge in place of its status, built from the same
   parts as every other status (icon circle, text, info popover). The popover carries the reason
   when the Admin chose to show it. The thin rose stripe marks the row. */
table.listdashboard .status-icon.status-ineligible {
    background: #FDECEC !important;
    color: var(--inel-strong) !important;
}

table.listdashboard .status-badge-ineligible .status-text {
    color: var(--inel-ink) !important;
    font-weight: 600 !important;
}

/* "View details" link beside the badge. */
.inel-link {
    margin-left: 2px;
    font-size: 13px;
    font-weight: 600;
    color: var(--inel-blue);
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}

    .inel-link:hover {
        color: #004A68;
    }

    .inel-link:focus-visible {
        outline: 2px solid var(--inel-blue);
        outline-offset: 2px;
        border-radius: 2px;
    }

/* The pop-up the link opens. */
.inel-dash-dialog {
    width: min(480px, calc(100vw - 32px));
}

.inel-dash-when {
    margin: 0 0 12px;
    font-size: 12.5px;
    color: var(--inel-muted);
}

.inel-dash-block {
    padding: 10px 14px;
    border-left: 4px solid var(--inel-strong);
    border-radius: 4px;
    background: var(--inel-bg);
}

.inel-dash-label {
    margin-bottom: 3px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--inel-ink-soft);
}

.inel-dash-reason {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--inel-text);
    overflow-wrap: anywhere;
    white-space: pre-line;
}

    .inel-dash-reason.inel-dash-none {
        color: var(--inel-muted);
        font-style: italic;
    }

.inel-dash-next {
    margin: 14px 0 0;
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--inel-muted);
}

.inel-dash-dialog [hidden] {
    display: none !important;
}

/* The choice offered after the agreement: a blank application or a copy of the ineligible one. */
.ineligible-choice-lead {
    margin: 0 0 14px;
    font-size: 14.5px;
    line-height: 1.5;
}

.ineligible-choice-list {
    display: grid;
    gap: 10px;
}

.ineligible-choice {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--inel-blue-line);
    border-radius: 8px;
    background: var(--inel-surface);
    text-align: left;
    cursor: pointer;
    color: var(--inel-text);
}

    .ineligible-choice:hover {
        border-color: var(--inel-blue);
        background: #F2F8FC;
    }

    .ineligible-choice:focus-visible {
        outline: 2px solid var(--inel-blue);
        outline-offset: 2px;
    }

.ineligible-choice-title {
    font-size: 14.5px;
    font-weight: 700;
    color: #004A68;
}

    .ineligible-choice-title i {
        margin-right: 6px;
    }

.ineligible-choice-hint {
    font-size: 13px;
    color: var(--inel-muted);
}

tr.row-ineligible > td:first-child {
    box-shadow: inset 3px 0 0 var(--inel-strong);
}

@media (max-width: 560px) {
    .inel-banner {
        flex-direction: column;
    }

    .inel-actions {
        align-self: stretch;
    }
}
