:root {
    --three-dpa-portal-navy: #102f4f;
    --three-dpa-portal-blue: #1769aa;
    --three-dpa-portal-blue-dark: #0f568f;
    --three-dpa-portal-gold: #d1a33a;
    --three-dpa-portal-ink: #183247;
    --three-dpa-portal-muted: #60788c;
    --three-dpa-portal-border: #dbe5ed;
    --three-dpa-portal-soft: #f4f8fb;
    --three-dpa-portal-success: #217a50;
    --three-dpa-portal-danger: #a73b45;
}

.three-dpa-portal {
    color: var(--three-dpa-portal-ink);
    font-size: 16px;
    line-height: 1.55;
}

.three-dpa-portal *,
.crm-portal-admin * {
    box-sizing: border-box;
}

.three-dpa-portal-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin: 0 0 20px;
    padding: 28px 30px;
    color: #fff;
    background: linear-gradient(135deg, var(--three-dpa-portal-navy), #174d79);
    border-bottom: 5px solid var(--three-dpa-portal-gold);
    border-radius: 18px;
}

.three-dpa-portal-hero h2 {
    margin: 3px 0 6px;
    color: #fff;
    font-size: clamp(25px, 3vw, 36px);
    line-height: 1.15;
}

.three-dpa-portal-hero p {
    margin: 0;
    color: #dbeaf5;
}

.three-dpa-portal-eyebrow {
    display: block;
    color: var(--three-dpa-portal-gold);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.three-dpa-portal-scope {
    min-width: 240px;
    padding: 13px;
    background: rgba(255,255,255,.11);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 12px;
}

.three-dpa-portal-scope label {
    display: block;
    margin-bottom: 5px;
    color: #dbeaf5;
    font-size: 12px;
    font-weight: 700;
}

.three-dpa-portal-scope select {
    width: calc(100% - 70px);
    min-height: 40px;
    padding: 0 10px;
    background: #fff;
    border: 0;
    border-radius: 8px;
    color: var(--three-dpa-portal-ink);
}

.three-dpa-portal-scope button {
    min-height: 40px;
    margin-left: 5px;
    padding: 0 10px;
    color: #fff;
    background: var(--three-dpa-portal-blue);
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}

.three-dpa-portal-notice {
    margin: 0 0 18px;
    padding: 14px 17px;
    background: #fff8e7;
    border: 1px solid #ead69b;
    border-left: 5px solid var(--three-dpa-portal-gold);
    border-radius: 10px;
}

.three-dpa-portal-notice.success {
    background: #ecf8f1;
    border-color: #a9d8bd;
    border-left-color: var(--three-dpa-portal-success);
}

.three-dpa-portal-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin: 0 0 20px;
}

.three-dpa-portal-kpi {
    position: relative;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 12px;
    min-height: 92px;
    padding: 16px;
    color: var(--three-dpa-portal-ink);
    background: #fff;
    border: 1px solid var(--three-dpa-portal-border);
    border-radius: 14px;
    text-decoration: none !important;
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.three-dpa-portal-kpi:hover,
.three-dpa-portal-kpi:focus-visible {
    color: var(--three-dpa-portal-ink);
    border-color: #8eb9db;
    box-shadow: 0 10px 22px rgba(16,47,79,.09);
    transform: translateY(-2px);
}

.three-dpa-portal-kpi small,
.three-dpa-portal-kpi strong {
    display: block;
}

.three-dpa-portal-kpi small {
    color: var(--three-dpa-portal-muted);
    font-size: 12px;
    font-weight: 700;
}

.three-dpa-portal-kpi strong {
    margin-top: 2px;
    font-size: 26px;
    line-height: 1;
}

.three-dpa-portal-kpi-icon,
.doc-icon {
    width: 42px;
    height: 42px;
    background: #eaf4fb;
    border-radius: 12px;
}

.three-dpa-portal-kpi-icon::before,
.doc-icon::before {
    display: grid;
    height: 100%;
    place-items: center;
    color: var(--three-dpa-portal-blue);
    font-size: 21px;
    font-weight: 800;
}

.three-dpa-portal-kpi-icon.document::before { content: "Q"; }
.three-dpa-portal-kpi-icon.payment::before { content: "£"; }
.three-dpa-portal-kpi-icon.calendar::before { content: "▦"; }
.three-dpa-portal-kpi-icon.folder::before,
.doc-icon::before { content: "▰"; }

.three-dpa-portal-arrow {
    color: var(--three-dpa-portal-blue);
    font-size: 19px;
}

.three-dpa-portal-nav {
    display: flex;
    gap: 6px;
    margin: 0 0 18px;
    padding: 6px;
    overflow-x: auto;
    background: var(--three-dpa-portal-soft);
    border: 1px solid var(--three-dpa-portal-border);
    border-radius: 12px;
    scrollbar-width: thin;
}

.three-dpa-portal-nav a {
    flex: 0 0 auto;
    padding: 9px 13px;
    color: #466278;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none !important;
}

.three-dpa-portal-nav a:hover,
.three-dpa-portal-nav a:focus-visible,
.three-dpa-portal-nav a.active {
    color: #fff;
    background: var(--three-dpa-portal-blue);
}

.three-dpa-portal-content {
    display: block;
}

.three-dpa-portal-grid {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}

.three-dpa-portal-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three-dpa-portal-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.three-dpa-portal-card {
    min-width: 0;
    padding: 22px;
    background: #fff;
    border: 1px solid var(--three-dpa-portal-border);
    border-radius: 15px;
}

.three-dpa-portal-card + .three-dpa-portal-card {
    margin-top: 18px;
}

.three-dpa-portal-grid .three-dpa-portal-card + .three-dpa-portal-card {
    margin-top: 0;
}

.three-dpa-portal-card.feature {
    border-top: 4px solid var(--three-dpa-portal-blue);
}

.three-dpa-portal-card h3,
.three-dpa-portal-card h4 {
    margin: 2px 0 8px;
    color: var(--three-dpa-portal-navy);
}

.three-dpa-portal-card h3 { font-size: 21px; }
.three-dpa-portal-card h4 { font-size: 16px; }

.three-dpa-portal-card p {
    color: var(--three-dpa-portal-muted);
}

.three-dpa-portal-card .card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.three-dpa-portal-card .card-head > a {
    color: var(--three-dpa-portal-blue);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.three-dpa-portal-action-row,
.three-dpa-portal-session,
.three-dpa-portal-renewals article {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 0;
    border-top: 1px solid var(--three-dpa-portal-border);
}

.three-dpa-portal-action-row:first-of-type,
.three-dpa-portal-session:first-of-type,
.three-dpa-portal-renewals article:first-child {
    border-top: 0;
}

.three-dpa-portal-action-row strong,
.three-dpa-portal-action-row span,
.three-dpa-portal-session strong,
.three-dpa-portal-session span,
.three-dpa-portal-renewals strong,
.three-dpa-portal-renewals span {
    display: block;
}

.three-dpa-portal-action-row span,
.three-dpa-portal-session span,
.three-dpa-portal-renewals span,
.three-dpa-portal-renewals small {
    color: var(--three-dpa-portal-muted);
    font-size: 13px;
}

.three-dpa-portal .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 15px;
    color: #fff !important;
    background: var(--three-dpa-portal-blue);
    border: 1px solid var(--three-dpa-portal-blue);
    border-radius: 9px;
    font-weight: 800;
    line-height: 1.2;
    text-decoration: none !important;
    cursor: pointer;
}

.three-dpa-portal .button:hover,
.three-dpa-portal .button:focus-visible {
    background: var(--three-dpa-portal-blue-dark);
    border-color: var(--three-dpa-portal-blue-dark);
}

.three-dpa-portal .button.alt {
    color: var(--three-dpa-portal-blue) !important;
    background: #fff;
}

.three-dpa-portal-good {
    padding: 18px;
    background: #eef8f2;
    border: 1px solid #b8dec7;
    border-radius: 12px;
}

.three-dpa-portal-good strong {
    color: var(--three-dpa-portal-success);
}

.three-dpa-portal-good p { margin: 4px 0 0; }

.three-dpa-portal-date {
    padding: 20px;
    background: var(--three-dpa-portal-soft);
    border-radius: 12px;
}

.three-dpa-portal-date strong,
.three-dpa-portal-date span,
.three-dpa-portal-date small {
    display: block;
}

.three-dpa-portal-date strong {
    color: var(--three-dpa-portal-blue);
    font-size: 21px;
}

.three-dpa-portal-date small { margin-top: 4px; color: var(--three-dpa-portal-muted); }

.three-dpa-portal-list-row {
    padding: 12px 0;
    border-top: 1px solid var(--three-dpa-portal-border);
}

.three-dpa-portal-list-row:first-child { border-top: 0; }
.three-dpa-portal-list-row strong,
.three-dpa-portal-list-row span,
.three-dpa-portal-list-row small { display: block; }
.three-dpa-portal-list-row span,
.three-dpa-portal-list-row small { color: var(--three-dpa-portal-muted); font-size: 13px; }

.three-dpa-portal-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.three-dpa-portal-table {
    width: 100%;
    border-collapse: collapse;
}

.three-dpa-portal-table th,
.three-dpa-portal-table td {
    padding: 13px 11px;
    border-bottom: 1px solid var(--three-dpa-portal-border);
    text-align: left;
    vertical-align: middle;
}

.three-dpa-portal-table th {
    color: var(--three-dpa-portal-muted);
    font-size: 12px;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.three-dpa-portal-table td strong,
.three-dpa-portal-table td small {
    display: block;
}

.three-dpa-portal-table td small {
    color: var(--three-dpa-portal-muted);
}

.three-dpa-portal-table .actions {
    white-space: nowrap;
}

.three-dpa-portal-status {
    display: inline-flex !important;
    align-items: center;
    width: fit-content;
    padding: 5px 9px;
    color: #34566e !important;
    background: #edf3f7;
    border-radius: 999px;
    font-size: 12px !important;
    font-weight: 800;
    line-height: 1.2;
}

.three-dpa-portal-status.status-paid,
.three-dpa-portal-status.status-accepted,
.three-dpa-portal-status.status-completed,
.three-dpa-portal-status.status-won,
.three-dpa-portal-status.status-ready_to_deliver {
    color: #176440 !important;
    background: #e9f7ef;
}

.three-dpa-portal-status.status-unpaid,
.three-dpa-portal-status.status-sent,
.three-dpa-portal-status.status-viewed,
.three-dpa-portal-status.status-information_required,
.three-dpa-portal-status.status-payment_confirmed {
    color: #875d06 !important;
    background: #fff5da;
}

.three-dpa-portal-status.status-rejected,
.three-dpa-portal-status.status-cancelled,
.three-dpa-portal-status.status-expired {
    color: #8c303a !important;
    background: #fae9eb;
}

.three-dpa-portal-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.three-dpa-portal-detail-grid > div {
    padding: 13px;
    background: var(--three-dpa-portal-soft);
    border-radius: 10px;
}

.three-dpa-portal-detail-grid small,
.three-dpa-portal-detail-grid strong {
    display: block;
}

.three-dpa-portal-detail-grid small {
    margin-bottom: 3px;
    color: var(--three-dpa-portal-muted);
}

.three-dpa-portal-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 10px 0 20px;
}

.three-dpa-portal-sessions {
    padding-top: 12px;
    border-top: 1px solid var(--three-dpa-portal-border);
}

.three-dpa-portal-session {
    justify-content: flex-start;
}

.three-dpa-portal-session > .three-dpa-portal-status { margin-left: auto; }

.session-number {
    display: grid;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    color: #fff;
    background: var(--three-dpa-portal-blue);
    border-radius: 50%;
    place-items: center;
    font-weight: 800;
}

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

.three-dpa-portal-document {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 15px;
    color: var(--three-dpa-portal-ink);
    border: 1px solid var(--three-dpa-portal-border);
    border-radius: 12px;
    text-decoration: none !important;
}

.three-dpa-portal-document:hover,
.three-dpa-portal-document:focus-visible {
    color: var(--three-dpa-portal-ink);
    border-color: #8eb9db;
    background: #fbfdff;
}

.three-dpa-portal-document strong,
.three-dpa-portal-document small { display: block; }
.three-dpa-portal-document small { color: var(--three-dpa-portal-muted); }
.three-dpa-portal-document > span:last-child { color: var(--three-dpa-portal-blue); font-size: 12px; font-weight: 800; }

.three-dpa-portal-renewals article {
    padding: 16px;
    border: 1px solid var(--three-dpa-portal-border);
    border-radius: 12px;
}

.three-dpa-portal-renewals article + article { margin-top: 10px; }
.three-dpa-portal-renewals .renewal-meta { display: flex; align-items: flex-end; gap: 8px; flex-direction: column; }

.three-dpa-portal-form label {
    display: block;
    margin: 0 0 15px;
    color: var(--three-dpa-portal-ink);
    font-weight: 800;
}

.three-dpa-portal-form input,
.three-dpa-portal-form select,
.three-dpa-portal-form textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 11px 12px;
    color: var(--three-dpa-portal-ink);
    background: #fff;
    border: 1px solid #bccbd7;
    border-radius: 9px;
    font: inherit;
    font-weight: 400;
}

.three-dpa-portal-card.support {
    background: var(--three-dpa-portal-navy);
    border-color: var(--three-dpa-portal-navy);
}

.three-dpa-portal-card.support h3,
.three-dpa-portal-card.support p,
.three-dpa-portal-card.support a {
    color: #fff;
}

.three-dpa-portal-empty {
    padding: 36px 20px;
    text-align: center;
    background: var(--three-dpa-portal-soft);
    border-radius: 12px;
}

.three-dpa-portal-empty.compact { padding: 18px; }
.three-dpa-portal-empty p { margin: 4px 0 0; }
.three-dpa-portal .muted { color: var(--three-dpa-portal-muted); }

/* WordPress admin portal controls. */
.three-dpa-portal-admin-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0;
}

.three-dpa-portal-admin-stats > div {
    padding: 18px;
    background: #fff;
    border: 1px solid #dce5ec;
    border-radius: 12px;
}

.three-dpa-portal-admin-stats small,
.three-dpa-portal-admin-stats strong { display: block; }
.three-dpa-portal-admin-stats small { color: #61798d; }
.three-dpa-portal-admin-stats strong { margin-top: 4px; color: #143654; font-size: 28px; }

.three-dpa-portal-admin-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin: 18px 0 12px;
}

.three-dpa-portal-admin-actions .filter-links { display: flex; gap: 8px; }
.three-dpa-portal-admin-actions .filter-links a { padding: 6px 10px; background: #fff; border: 1px solid #cbd7e0; border-radius: 7px; text-decoration: none; }
.three-dpa-portal-access-editor { margin-top: 18px; }
.three-dpa-portal-permission-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.three-dpa-portal-permission-grid label { padding: 12px; background: #f5f8fa; border: 1px solid #dce5ec; border-radius: 8px; }

@media (max-width: 1100px) {
    .three-dpa-portal-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .three-dpa-portal-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .three-dpa-portal-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .three-dpa-portal-permission-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .three-dpa-portal-hero { align-items: stretch; flex-direction: column; padding: 23px 20px; }
    .three-dpa-portal-scope { min-width: 0; }
    .three-dpa-portal-grid.two,
    .three-dpa-portal-grid.three,
    .three-dpa-portal-document-grid { grid-template-columns: 1fr; }
    .three-dpa-portal-card .card-head,
    .three-dpa-portal-action-row,
    .three-dpa-portal-renewals article { align-items: flex-start; flex-direction: column; }
    .three-dpa-portal-renewals .renewal-meta { align-items: flex-start; }
    .three-dpa-portal-table th:nth-child(2),
    .three-dpa-portal-table td:nth-child(2) { display: none; }
    .three-dpa-portal-admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .three-dpa-portal-admin-actions { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 480px) {
    .three-dpa-portal-kpis,
    .three-dpa-portal-detail-grid,
    .three-dpa-portal-admin-stats,
    .three-dpa-portal-permission-grid { grid-template-columns: 1fr; }
    .three-dpa-portal-card { padding: 17px; }
    .three-dpa-portal-table .actions .button { display: flex; margin: 4px 0; }
}

/* Customer profile images - scoped to the 3DPA Portal only. */
.three-dpa-portal-identity{display:flex;align-items:center;gap:18px;min-width:0}
.three-dpa-portal-avatar{display:inline-flex;align-items:center;justify-content:center;overflow:hidden;width:76px;height:76px;flex:0 0 76px;border:3px solid rgba(255,255,255,.55);border-radius:24px;background:rgba(255,255,255,.18);color:#fff;font-size:24px;font-weight:800;box-shadow:0 10px 24px rgba(7,27,69,.18)}
.three-dpa-portal-avatar img{display:block;width:100%;height:100%;object-fit:cover}
.three-dpa-portal-avatar--profile{width:132px;height:132px;flex-basis:132px;border-color:#e4e9f2;background:linear-gradient(135deg,#1749b7,#2f7ee6);border-radius:34px}
.three-dpa-portal-profile-preview{display:flex;align-items:center;gap:22px;margin-top:20px}
.three-dpa-portal-profile-preview strong,.three-dpa-portal-profile-preview span{display:block}
.three-dpa-portal-profile-preview strong{font-size:20px}
.three-dpa-portal-profile-preview span{margin-top:4px;color:#667085}
.three-dpa-portal-profile-preview p{max-width:480px;margin:12px 0 0;color:#667085}
.three-dpa-portal-profile-form label>span{display:block;margin-bottom:8px;font-weight:700}
.three-dpa-portal-profile-form input[type=file]{display:block;width:100%;padding:12px;border:1px solid #d7dce5;border-radius:10px;background:#f8fafc}
.three-dpa-portal-profile-form p{color:#667085}
.three-dpa-portal-profile-form .button{margin:8px 8px 0 0}
@media(max-width:680px){.three-dpa-portal-identity{align-items:flex-start}.three-dpa-portal-avatar{width:58px;height:58px;flex-basis:58px;border-radius:18px}.three-dpa-portal-profile-preview{align-items:flex-start;flex-direction:column}.three-dpa-portal-avatar--profile{width:112px;height:112px;flex-basis:112px}}
