.portal-page {
    margin: 0 auto;
    max-width: 1440px;
    padding: 26px 28px 80px;
}

.portal-heading {
    align-items: flex-end;
    display: flex;
    gap: 24px;
    justify-content: space-between;
    margin-bottom: 24px;
}

.portal-heading > div:first-child > span,
.portal-panel header > div > span,
.technician-list > header > div > span {
    color: var(--il-coral-strong);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.portal-heading h1 {
    color: var(--il-ink);
    font-size: clamp(32px, 4vw, 48px);
    letter-spacing: -.045em;
    margin: 4px 0 4px;
}

.portal-heading p {
    color: var(--il-muted);
    margin: 0;
}

.primary-action,
.contract-billing a,
.work-action a {
    align-items: center;
    background: var(--il-coral);
    border: 1px solid var(--il-coral);
    border-radius: 12px;
    color: #fff;
    display: inline-flex;
    font-size: 13px;
    font-weight: 750;
    gap: 8px;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    text-decoration: none;
}

.portal-metrics {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
}

.portal-metrics article {
    background: rgba(255, 253, 248, .92);
    border: 1px solid var(--il-line);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    min-height: 112px;
    padding: 16px;
}

.portal-metrics article.accent {
    background: rgba(235, 231, 251, .64);
    border-color: rgba(111, 77, 221, .24);
}

.portal-metrics article.danger {
    background: rgba(255, 111, 97, .09);
    border-color: rgba(232, 91, 77, .3);
}

.portal-metrics span {
    color: var(--il-muted);
    font-size: 12px;
    font-weight: 700;
}

.portal-metrics strong {
    color: var(--il-ink);
    font-size: 25px;
    letter-spacing: -.035em;
    margin: 7px 0 2px;
}

.portal-metrics small {
    color: var(--il-muted);
    font-size: 11px;
}

.contract-card {
    background: var(--il-ink);
    border-radius: 18px;
    color: #fff;
    display: grid;
    gap: 22px;
    grid-template-columns: minmax(0, 1fr) 290px;
    margin-bottom: 18px;
    overflow: hidden;
    padding: 24px;
}

.contract-main .status {
    color: #bce6d4;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.contract-main h2 {
    color: #fff;
    font-size: 24px;
    margin: 7px 0 3px;
}

.contract-main > p {
    color: rgba(255, 255, 255, .68);
    margin: 0;
}

.contract-main dl {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 22px 0 0;
}

.contract-main dl div {
    border-top: 1px solid rgba(255, 255, 255, .15);
    padding-top: 11px;
}

.contract-main dt {
    color: rgba(255, 255, 255, .58);
    font-size: 11px;
    font-weight: 600;
}

.contract-main dd {
    font-size: 14px;
    font-weight: 750;
    margin: 3px 0 0;
}

.contract-billing {
    background: #fffdf8;
    border-radius: 14px;
    color: var(--il-ink);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 18px;
}

.contract-billing > span,
.contract-billing > small {
    color: var(--il-muted);
    font-size: 12px;
}

.contract-billing > strong {
    font-size: 25px;
    margin: 5px 0 2px;
}

.contract-billing a {
    margin-top: 16px;
}

.contract-billing .portal-download-link {
    align-items: center;
    background: transparent;
    border: 1px solid rgba(5, 61, 62, .22);
    border-radius: 10px;
    color: var(--il-ink);
    display: inline-flex;
    font-size: 12px;
    font-weight: 750;
    gap: 7px;
    justify-content: center;
    margin-top: 14px;
    min-height: 38px;
    padding: 0 12px;
}

.contract-billing .portal-download-link + a {
    margin-top: 8px;
}

.portal-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-panel,
.technician-list {
    background: rgba(255, 253, 248, .9);
    border: 1px solid var(--il-line);
    border-radius: 16px;
    overflow: hidden;
}

.portal-panel > header,
.technician-list > header {
    align-items: center;
    border-bottom: 1px solid var(--il-line);
    display: flex;
    justify-content: space-between;
    padding: 16px 18px;
}

.portal-panel h2,
.technician-list h2 {
    color: var(--il-ink);
    font-size: 18px;
    margin: 2px 0 0;
}

.portal-panel header a {
    color: var(--il-coral-strong);
    font-size: 12px;
    font-weight: 750;
}

.portal-row {
    align-items: center;
    border-bottom: 1px solid var(--il-line);
    color: var(--il-ink);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    min-height: 66px;
    padding: 12px 18px;
    text-decoration: none;
}

.portal-row:last-child {
    border-bottom: 0;
}

.portal-row:hover {
    background: rgba(235, 231, 251, .35);
}

.portal-row div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.portal-row strong {
    font-size: 13px;
}

.portal-row div span,
.portal-row .tag {
    color: var(--il-muted);
    font-size: 11px;
}

.portal-row .tag {
    background: var(--il-lavender);
    border-radius: 999px;
    color: var(--il-violet);
    flex: 0 0 auto;
    font-weight: 750;
    padding: 5px 8px;
}

.documents-panel {
    margin-top: 16px;
}

.document-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 14px;
}

.document-grid button {
    align-items: center;
    background: #fff;
    border: 1px solid var(--il-line);
    border-radius: 12px;
    color: var(--il-ink);
    display: grid;
    gap: 10px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    min-height: 66px;
    padding: 11px;
    text-align: left;
}

.document-grid button > span {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.document-grid strong,
.document-grid small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-grid strong {
    font-size: 12px;
}

.document-grid small {
    color: var(--il-muted);
    font-size: 10px;
}

.empty-copy {
    color: var(--il-muted);
    margin: 0;
    padding: 24px 18px;
}

.portal-state,
.portal-empty {
    align-items: center;
    background: var(--il-surface);
    border: 1px solid var(--il-line);
    border-radius: 15px;
    display: flex;
    gap: 12px;
    margin: 34px auto;
    max-width: 780px;
    padding: 22px;
}

.portal-state.error {
    color: var(--il-coral-strong);
}

.portal-state > div,
.portal-empty {
    flex-direction: column;
}

.portal-state > div {
    display: flex;
}

.portal-empty i {
    color: var(--il-violet);
    font-size: 22px;
}

.connection-status {
    align-items: center;
    background: rgba(95, 205, 154, .13);
    border: 1px solid rgba(29, 145, 94, .2);
    border-radius: 999px;
    color: #15734a;
    display: inline-flex;
    font-size: 12px;
    font-weight: 750;
    gap: 7px;
    padding: 8px 12px;
}

.technician-list > header > strong {
    align-items: center;
    background: var(--il-lavender);
    border-radius: 999px;
    color: var(--il-violet);
    display: flex;
    height: 32px;
    justify-content: center;
    width: 32px;
}

.work-card {
    align-items: center;
    border-bottom: 1px solid var(--il-line);
    display: grid;
    gap: 18px;
    grid-template-columns: 130px minmax(0, 1fr) 210px;
    padding: 16px 18px;
}

.work-card:last-child {
    border-bottom: 0;
}

.work-card.overdue {
    border-left: 4px solid var(--il-coral);
}

.work-number,
.work-copy,
.work-action {
    display: flex;
    flex-direction: column;
}

.work-number > span {
    color: var(--il-coral-strong);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.work-number strong {
    color: var(--il-ink);
    font-size: 20px;
    margin: 3px 0;
}

.work-number small,
.work-copy p,
.work-action > span {
    color: var(--il-muted);
    font-size: 11px;
}

.work-copy h3 {
    color: var(--il-ink);
    font-size: 15px;
    margin: 0 0 5px;
}

.work-copy p {
    margin: 2px 0;
}

.work-copy .visit {
    color: var(--il-violet);
    font-weight: 700;
    margin-top: 7px;
}

.work-action {
    align-items: flex-start;
}

.work-action strong {
    color: var(--il-ink);
    font-size: 13px;
    margin: 3px 0 10px;
}

.work-action a {
    min-height: 38px;
    width: 100%;
}

.draft-note {
    align-items: center;
    background: rgba(235, 231, 251, .5);
    border: 1px solid rgba(111, 77, 221, .16);
    border-radius: 14px;
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding: 14px 16px;
}

.draft-note i {
    color: var(--il-violet);
    font-size: 22px;
}

.draft-note div {
    display: flex;
    flex-direction: column;
}

.draft-note strong {
    color: var(--il-ink);
    font-size: 13px;
}

.draft-note span {
    color: var(--il-muted);
    font-size: 11px;
}

@media (max-width: 980px) {
    .portal-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .document-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .work-card {
        grid-template-columns: 100px minmax(0, 1fr);
    }

    .work-action {
        grid-column: 1 / -1;
    }
}

@media (max-width: 680px) {
    .portal-page {
        padding: 20px 14px 92px;
    }

    .portal-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .portal-metrics,
    .portal-grid,
    .document-grid {
        grid-template-columns: 1fr;
    }

    .portal-metrics {
        gap: 8px;
    }

    .portal-metrics article {
        min-height: 92px;
    }

    .contract-card {
        grid-template-columns: 1fr;
        padding: 18px;
    }

    .contract-main dl {
        grid-template-columns: 1fr;
    }

    .work-card {
        align-items: start;
        grid-template-columns: 1fr;
        padding: 15px;
    }

    .work-action {
        grid-column: auto;
        width: 100%;
    }
}
