/* The application page in the Workbench (cards, tabs, buttons, tables and the popup forms).
   One accent colour, taken from the Workbench theme; one meaning each for green (good), red (bad) and amber (waiting on someone). */

:root {
    --ws-accent: var(--dxbl-accent-color, #0b6074);
    --ws-accent-soft: #e3eef1;
    --ws-ink: #1f2a33;
    --ws-muted: #55616b;
    --ws-line: #e3e7eb;
    --ws-good: #1f7a45;
    --ws-good-soft: #dff3e4;
    --ws-bad: #b42318;
    --ws-bad-soft: #fde4e4;
    --ws-warn: #7a4b00;
    --ws-warn-soft: #fdf0d3;
}

.asap-ws { display: flex; flex-direction: column; gap: 14px; color: var(--ws-ink); padding: 4px 2px 20px; }
.asap-ws__empty, .asap-none { padding: 14px 4px; color: var(--ws-muted); }

/* ── Header ──────────────────────────────────────────────────────────────── */
.asap-ws__hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 18px;
    padding: 16px 20px;
    border: 1px solid var(--ws-line);
    border-left: 5px solid var(--ws-accent);
    border-radius: 10px;
    background: #fff;
}
.asap-ws__hero--good { border-left-color: var(--ws-good); }
.asap-ws__hero--bad { border-left-color: var(--ws-bad); }
.asap-ws__hero--warn { border-left-color: #d99a1c; }
.asap-ws__hero--muted { border-left-color: #8b97a0; }
.asap-ws__who { flex: 1 1 260px; min-width: 0; }
.asap-ws__state { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px 16px; }

/* The Verification ID, once there is one: the thing an installer asks for, so it sits where the eye lands first. */
.asap-vid { display: flex; align-items: baseline; gap: 8px; padding: 6px 14px; border-radius: 10px; background: var(--ws-good-soft); color: #14532d; }
.asap-vid__label { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.asap-vid__value { font-size: 1.15rem; letter-spacing: 0.04em; }
.asap-vid__through { font-size: 0.85rem; }
.asap-ws__name { margin: 0; font-size: 1.4rem; font-weight: 700; color: #0a3d4c; }
.asap-ws__id { margin-top: 3px; font-size: 0.9rem; color: var(--ws-muted); }
.asap-ws__actions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; padding-top: 12px; border-top: 1px solid var(--ws-line); }

.asap-badge { padding: 5px 14px; border-radius: 999px; font-size: 0.85rem; font-weight: 700; background: var(--ws-accent-soft); color: #0a3d4c; white-space: nowrap; }
.asap-badge--good { background: var(--ws-good-soft); color: #14532d; }
.asap-badge--bad { background: var(--ws-bad-soft); color: #7f1d1d; }
.asap-badge--warn { background: var(--ws-warn-soft); color: var(--ws-warn); }
.asap-badge--muted { background: #eceff2; color: #434d56; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.asap-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.asap-btn:disabled { opacity: 0.55; cursor: default; }
.asap-btn--primary { background: var(--ws-accent); color: #fff; }
.asap-btn--primary:hover:not(:disabled) { filter: brightness(0.92); }
.asap-btn--success { background: var(--ws-good); color: #fff; }
.asap-btn--danger { background: var(--ws-bad); color: #fff; }
.asap-btn--success:hover:not(:disabled), .asap-btn--danger:hover:not(:disabled) { filter: brightness(0.92); }
.asap-btn--ghost { background: #fff; color: var(--ws-accent); border-color: #b9c8cf; }
.asap-btn--ghost:hover:not(:disabled) { background: var(--ws-accent-soft); border-color: var(--ws-accent); }
.asap-btn:focus-visible, .asap-icon-btn:focus-visible, .asap-tab:focus-visible { outline: 3px solid #e6b64a; outline-offset: 2px; }

.asap-icon-btn {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--ws-line);
    border-radius: 8px;
    background: #fff;
    color: var(--ws-accent);
    cursor: pointer;
}
.asap-icon-btn:hover:not(:disabled) { background: var(--ws-accent-soft); }
.asap-icon-btn:disabled { opacity: 0.4; cursor: default; }
.asap-icon-btn--good { color: var(--ws-good); }
.asap-icon-btn--good:hover:not(:disabled) { background: var(--ws-good-soft); }
.asap-icon-btn--bad { color: var(--ws-bad); }
.asap-icon-btn--bad:hover:not(:disabled) { background: var(--ws-bad-soft); }

/* ── Facts and alerts ────────────────────────────────────────────────────── */
/* There are always six facts, so they sit in an even grid that follows the width of the page, never five and one left over:
   six in a row when there is room, then three by two, then two by three, then one column. */
.asap-facts-wrap { container-type: inline-size; }
.asap-ws__facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@container (min-width: 1280px) { .asap-ws__facts { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@container (max-width: 700px) { .asap-ws__facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 440px) { .asap-ws__facts { grid-template-columns: minmax(0, 1fr); } }

/* Each fact is a tile: a coloured circle with its icon, the label, the value, and one small line that helps (how long ago, how many days left). */
.asap-fact {
    --f-main: var(--ws-accent);
    --f-soft: var(--ws-accent-soft);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--ws-line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(10, 52, 65, 0.05);
}
.asap-fact__icon { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--f-soft); color: var(--f-main); }
.asap-fact__text { display: flex; flex-direction: column; min-width: 0; }
.asap-fact__text span { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ws-accent); }
.asap-fact__text strong { font-size: 1.12rem; line-height: 1.25; color: #0a3d4c; }
.asap-fact__text small { margin-top: 1px; font-size: 0.8rem; color: var(--ws-muted); }

.asap-fact--teal { --f-main: #0b6074; --f-soft: #e0eef2; }
.asap-fact--violet { --f-main: #6d4fa3; --f-soft: #eee8f7; }
.asap-fact--green { --f-main: #1f7a45; --f-soft: #dff3e4; }
.asap-fact--blue { --f-main: #2f6db5; --f-soft: #e3eefb; }
.asap-fact--amber { --f-main: #b7791f; --f-soft: #fdf0d3; }
.asap-fact--warn { --f-main: #c2570c; --f-soft: #fde6d3; }
.asap-fact--bad { --f-main: #b42318; --f-soft: #fde4e4; }
.asap-fact--bad .asap-fact__text strong, .asap-fact--bad .asap-fact__text small { color: #b42318; }
.asap-fact--slate { --f-main: #5b6770; --f-soft: #eceff2; }

.asap-alert { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 8px; font-size: 0.92rem; background: var(--ws-accent-soft); color: #0a3d4c; }
.asap-alert--warn { background: var(--ws-warn-soft); color: var(--ws-warn); }
.asap-alert--ok { background: var(--ws-good-soft); color: #14532d; }
.asap-alert__close { display: inline-grid; place-items: center; border: 0; background: transparent; color: inherit; cursor: pointer; padding: 2px; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.asap-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.asap-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 980px) { .asap-layout { grid-template-columns: minmax(0, 1fr); } }

.asap-card { border: 1px solid var(--ws-line); border-radius: 10px; background: #fff; overflow: hidden; box-shadow: 0 1px 2px rgba(10, 52, 65, 0.05); }
.asap-card--flush { overflow: hidden; }
.asap-card--good { border-top: 3px solid var(--ws-good); }
.asap-card--bad { border-top: 3px solid var(--ws-bad); }
.asap-card--info { border-top: 3px solid var(--ws-accent); }

.asap-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 46px; padding: 8px 14px 8px 16px; border-bottom: 1px solid var(--ws-line); background: linear-gradient(#f7fafb, #f0f5f7); }
.asap-card__head h3 { margin: 0; display: flex; align-items: center; gap: 9px; font-size: 0.98rem; font-weight: 700; color: #0a3d4c; }
.asap-card__head h3::before { content: ''; width: 4px; height: 16px; border-radius: 2px; background: var(--ws-accent); }
.asap-card--good .asap-card__head h3::before { background: var(--ws-good); }
.asap-card--bad .asap-card__head h3::before { background: var(--ws-bad); }

.asap-card__body { display: grid; grid-template-columns: minmax(104px, 34%) 1fr; gap: 8px 14px; margin: 0; padding: 14px 16px; }
.asap-card__body dt { color: var(--ws-muted); font-size: 0.88rem; }
.asap-card__body dd { margin: 0; word-break: break-word; }
.asap-card__sub { padding: 8px 16px; border-top: 1px solid var(--ws-line); border-bottom: 1px solid var(--ws-line); background: #fafbfc; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ws-muted); }
.asap-wrap { overflow-wrap: anywhere; }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.asap-tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--ws-line); background: #f6f8fa; }
.asap-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 12px 14px 11px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--ws-muted);
    cursor: pointer;
}
.asap-tab:hover { color: var(--ws-accent); }
.asap-tab--on { color: var(--ws-accent); border-bottom-color: var(--ws-accent); }
.asap-tab__count { padding: 1px 8px; border-radius: 999px; font-size: 0.75rem; background: var(--ws-accent-soft); color: #0a3d4c; }
.asap-tabpanel { padding: 8px 16px 16px; overflow-x: auto; }
.asap-toolbar { display: flex; justify-content: flex-end; padding: 8px 0 4px; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.asap-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.asap-table th { text-align: left; padding: 8px 8px; font-size: 0.8rem; font-weight: 700; color: var(--ws-muted); border-bottom: 2px solid var(--ws-line); white-space: nowrap; }
.asap-table td { padding: 9px 8px; border-bottom: 1px solid var(--ws-line); vertical-align: top; }
.asap-table tfoot td { font-weight: 700; border-bottom: 0; }
.asap-num, .asap-table th.asap-num { text-align: right; white-space: nowrap; }
.asap-actcol { width: 1%; white-space: nowrap; text-align: right; }
.asap-actcol .asap-icon-btn + .asap-icon-btn { margin-left: 4px; }
.asap-row-note { margin-top: 4px; font-size: 0.85rem; color: var(--ws-bad); }

.asap-pill { display: inline-block; margin-left: 6px; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: #eceff2; color: #434d56; }
td > .asap-pill:first-child { margin-left: 0; }
.asap-pill--good { background: var(--ws-good-soft); color: #14532d; }
.asap-pill--bad { background: var(--ws-bad-soft); color: #7f1d1d; }
.asap-pill--warn { background: var(--ws-warn-soft); color: var(--ws-warn); }

/* ── History ─────────────────────────────────────────────────────────────── */
.asap-timeline { list-style: none; margin: 4px 0 0; padding: 0 0 0 18px; border-left: 2px solid var(--ws-line); display: grid; gap: 14px; }
.asap-timeline li { position: relative; }
.asap-timeline li::before { content: ''; position: absolute; left: -25px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--ws-accent); border: 2px solid #fff; }
.asap-timeline__head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; }
.asap-timeline__head span { color: var(--ws-muted); font-size: 0.85rem; }
.asap-timeline__detail { margin-top: 3px; color: var(--ws-muted); font-size: 0.9rem; white-space: pre-line; }

/* ── Popups ──────────────────────────────────────────────────────────────── */
.asap-pop-lead { margin: 0 0 14px; color: var(--ws-muted); }
.asap-pop-step { display: flex; align-items: center; gap: 10px; margin: 22px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--ws-line); font-size: 0.95rem; font-weight: 700; color: #0a3d4c; }
.asap-pop-step:first-child { margin-top: 2px; }
.asap-pop-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ws-accent); color: #fff; font-size: 0.8rem; }
.asap-pop-opt { font-weight: 400; color: var(--ws-muted); font-size: 0.85rem; }
.asap-pop-facts { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 6px 12px; margin: 0 0 12px; padding: 12px 14px; border-radius: 8px; background: #f6f8fa; }
.asap-pop-facts dt { color: var(--ws-muted); font-size: 0.88rem; }
.asap-pop-facts dd { margin: 0; }

.asap-input, .asap-select, .asap-textarea {
    box-sizing: border-box;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #b9c8cf;
    border-radius: 8px;
    font: inherit;
    background: #fff;
    color: var(--ws-ink);
}
.asap-input--date { max-width: 220px; }
.asap-textarea { resize: vertical; min-height: 78px; }
.asap-input:focus, .asap-select:focus, .asap-textarea:focus { outline: 3px solid #e6b64a; outline-offset: 1px; border-color: var(--ws-accent); }

.asap-choice-list { display: grid; gap: 8px; max-height: 280px; overflow-y: auto; }
.asap-choice { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border: 1px solid var(--ws-line); border-radius: 8px; background: #fff; cursor: pointer; }
.asap-choice:hover { border-color: var(--ws-accent); }
.asap-choice--on { border-color: var(--ws-accent); background: var(--ws-accent-soft); }
.asap-choice input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--ws-accent); }
.asap-choice__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.asap-choice__sub { font-size: 0.85rem; color: var(--ws-muted); }

.asap-outcomes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.asap-outcome {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    border: 2px solid var(--ws-line);
    border-radius: 10px;
    background: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.asap-outcome--good { color: var(--ws-good); }
.asap-outcome--bad { color: var(--ws-bad); }
.asap-outcome--good.asap-outcome--on { border-color: var(--ws-good); background: var(--ws-good-soft); }
.asap-outcome--bad.asap-outcome--on { border-color: var(--ws-bad); background: var(--ws-bad-soft); }

.asap-check { display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; cursor: pointer; }
.asap-check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--ws-accent); }

.asap-pop .asap-alert, .dxbl-modal-body .asap-alert { margin-top: 14px; }

/* ── Form fields in the popups ───────────────────────────────────────────── */
.asap-form-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.asap-form-row > .asap-field { flex: 1 1 200px; margin-bottom: 0; }
.asap-form-row > .asap-field--wide { flex: 2 1 280px; }
.asap-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.asap-field > span { font-size: 0.85rem; font-weight: 600; color: var(--ws-muted); }
.asap-checks { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 4px 0 12px; }
.asap-checks .asap-check { margin-top: 0; }
.asap-check--inline { align-self: flex-end; padding-bottom: 8px; }

/* Cancel and Save in a popup's footer sit apart, not touching. */
[class*="footer"] > .asap-btn + .asap-btn { margin-left: 12px; }

/* Address suggestions under a street box */
.asap-autocomplete { position: relative; }
.asap-autocomplete__list {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 1100;
    max-height: 220px; overflow-y: auto;
    background: #fff; border: 1px solid #b9c8cf; border-top: none; border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
}
.asap-autocomplete__item { padding: 9px 12px; font-size: 0.9rem; cursor: pointer; }
.asap-autocomplete__item:hover { background: #eef4f7; }

/* Bank connection on the Income tab */
.asap-subhead { margin: 22px 0 4px; font-size: 1rem; font-weight: 700; }
.asap-hint { margin: 0 0 12px; font-size: 0.85rem; color: var(--ws-muted); }
.asap-bank { border: 1px solid var(--ws-line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; background: #fff; }
.asap-bank__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 8px; }
.asap-bank__meta { font-size: 0.82rem; color: var(--ws-muted); }
.asap-bank__deposits > td { padding-top: 0; }
.asap-bank__deposits summary, .asap-bank__other summary { cursor: pointer; font-size: 0.85rem; color: #0a3d4c; }
.asap-table--inner { margin-top: 6px; }
.asap-bank small { color: var(--ws-muted); }
