/*
 * Compact headings and open-corner table repairs for principal client pages.
 * The legacy theme remains byte-for-byte unaffected: every rule requires
 * html.design-v3 and JS also returns before touching a legacy document.
 */

/* Service-list actions keep their neutral buttons, with green icon glyphs. */
html.design-v3 .v3-products-dashboard .v3-product-actions > a.tooltips > .fa {
    color: var(--v3-green-dark, #5fa52e);
}

/* Keep the invoice table's intrinsic width inside its scrolling wrapper. */
html.design-v3 .v3-billing-invoice-header > .v3-billing-invoice-body {
    min-width: 0;
}

/* Native disclosure keeps removed services available without crowding the list. */
html.design-v3 .v3-products-dashboard .v3-products-archive {
    min-width: 0;
    border: 1px solid var(--v3-border, #dce4ed);
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(8, 17, 31, 0.045);
}

html.design-v3 .v3-products-dashboard .v3-products-archive__summary {
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 72px;
    padding: 18px 20px;
    border-radius: 13px;
    cursor: pointer;
    list-style: none;
}

html.design-v3 .v3-products-dashboard .v3-products-archive__summary::-webkit-details-marker {
    display: none;
}

html.design-v3 .v3-products-dashboard .v3-products-archive__summary::after {
    content: "";
    flex: 0 0 9px;
    width: 9px;
    height: 9px;
    margin-right: 3px;
    border-right: 2px solid #617186;
    border-bottom: 2px solid #617186;
    transform: rotate(-45deg);
}

html.design-v3 .v3-products-dashboard .v3-products-archive[open] > summary::after {
    transform: rotate(45deg);
}

html.design-v3 .v3-products-dashboard .v3-products-archive__summary:hover {
    background: #f5f8fb;
}

html.design-v3 .v3-products-dashboard .v3-products-archive__summary:focus-visible {
    outline: 3px solid var(--v3-blue, #2f80ed);
    outline-offset: 3px;
}

html.design-v3 .v3-products-dashboard .v3-products-archive__summary > .v3-products-section__heading {
    flex: 1;
    min-width: 0;
    margin: 0;
}

html.design-v3 .v3-products-dashboard .v3-products-archive__summary h3 {
    font-size: 17px;
}

html.design-v3 .v3-products-dashboard .v3-products-archive > .v3-products-table-wrap {
    width: auto;
    margin: 16px;
    box-shadow: none;
}

html.design-v3 .v3-page-hero,
html.design-v3 .v3-page-hero *,
html.design-v3 .v3-page-hero *::before,
html.design-v3 .v3-page-hero *::after {
    box-sizing: border-box;
}

html.design-v3 .v3-page-hero {
    position: relative !important;
    isolation: isolate;
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: 148px !important;
    margin: 0 0 24px !important;
    padding: 28px 32px !important;
    overflow: visible !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 16px !important;
    background:
        radial-gradient(circle at 86% 22%, rgba(47, 128, 237, 0.2), transparent 34%),
        linear-gradient(135deg, var(--v3-navy-950, #08111f), var(--v3-navy-800, #16263c)) !important;
    box-shadow: 0 16px 38px rgba(8, 17, 31, 0.14) !important;
    color: var(--v3-white, #ffffff) !important;
    font-family: Inter, "Open Sans", "Segoe UI", Arial, sans-serif;
    text-align: left !important;
}

html.design-v3 .v3-page-hero::before {
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    background: radial-gradient(circle at 10% 115%, rgba(118, 192, 67, 0.16), transparent 36%);
    content: "";
    pointer-events: none;
}

html.design-v3 .v3-page-hero::after {
    position: absolute;
    left: 0;
    top: 28px;
    bottom: 28px;
    z-index: 2;
    width: 4px;
    border-radius: 0 999px 999px 0;
    background: var(--v3-green, #76c043);
    content: "";
    pointer-events: none;
}

/*
 * The original dashboard hero owns a full-cover ::after at a higher
 * specificity. Reset all four offsets here so it becomes the shared green
 * accent instead of a narrow strip painted with the old dark overlay.
 */
html.design-v3 .v3-products-dashboard .v3-client-hero.v3-page-hero::after {
    inset: 28px auto 28px 0;
    z-index: 2;
    width: 4px;
    height: auto;
    border-radius: 0 999px 999px 0;
    background: var(--v3-green, #76c043);
}

html.design-v3 .v3-page-hero > * {
    position: relative;
    z-index: 1;
}

html.design-v3 .v3-page-hero .v3-page-hero__title {
    width: auto !important;
    max-width: 720px !important;
    margin: 0 0 9px !important;
    padding: 0 !important;
    color: var(--v3-white, #ffffff) !important;
    font-family: Inter, "Open Sans", "Segoe UI", Arial, sans-serif !important;
    font-size: clamp(28px, 3.2vw, 36px) !important;
    font-weight: 750 !important;
    letter-spacing: -0.035em !important;
    line-height: 1.12 !important;
    text-align: left !important;
    text-transform: none !important;
}

html.design-v3 .v3-page-hero .v3-page-hero__title::before,
html.design-v3 .v3-page-hero .v3-page-hero__title::after {
    display: none !important;
    content: none !important;
}

html.design-v3 .v3-page-hero .v3-page-hero__copy {
    width: auto !important;
    max-width: 720px !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #cbd5e1 !important;
    font-family: Inter, "Open Sans", "Segoe UI", Arial, sans-serif !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    text-align: left !important;
}

html.design-v3 .v3-page-hero .v3-page-hero__copy + .v3-page-hero__copy {
    margin-top: 7px !important;
}

html.design-v3 .v3-page-hero a {
    color: #a5dc80 !important;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    white-space: nowrap;
}

html.design-v3 .v3-page-hero a:focus,
html.design-v3 .v3-page-hero a:focus-visible {
    border-radius: 4px;
    outline: 3px solid var(--v3-blue, #2f80ed);
    outline-offset: 3px;
}

/* Existing visual heroes keep their semantic copy but use the compact shell. */
html.design-v3 .v3-products-dashboard .v3-client-hero.v3-page-hero,
html.design-v3 .v3-affiliate-page .v3-affiliate-hero.v3-page-hero {
    min-height: 148px !important;
    padding: 28px 32px !important;
}

html.design-v3 .v3-products-dashboard .v3-client-hero.v3-page-hero > figure,
html.design-v3 .v3-affiliate-page .v3-affiliate-hero.v3-page-hero > figure {
    display: none !important;
}

/* Dashboard help follows the hero as a distinct, compact guidance panel. */
html.design-v3 .v3-products-dashboard .v3-page-hero--with-guidance {
    margin-bottom: 12px !important;
}

html.design-v3 .v3-products-dashboard .v3-products-dashboard__guidance {
    margin: 0 0 24px;
    padding: 12px 15px;
    border: 1px solid var(--v3-border, #dce4ed);
    border-left: 3px solid var(--v3-green, #76c043);
    border-radius: 10px;
    background: var(--v3-white, #ffffff);
    color: var(--v3-muted, #617186);
    font-size: 13px;
    line-height: 1.55;
}

html.design-v3 .v3-products-dashboard .v3-products-dashboard__guidance a {
    color: var(--v3-blue, #2f80ed);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    white-space: nowrap;
}

html.design-v3 .v3-products-dashboard .v3-products-dashboard__guidance a:focus,
html.design-v3 .v3-products-dashboard .v3-products-dashboard__guidance a:focus-visible {
    border-radius: 4px;
    outline: 3px solid var(--v3-blue, #2f80ed);
    outline-offset: 3px;
}

/* Support reuses its current intro and its single existing ticket action. */
html.design-v3 .v3-support-index .v3-page-hero--support {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: center;
    min-height: 148px !important;
    padding: 24px 28px !important;
}

html.design-v3 .v3-support-index .v3-page-hero--support::before,
html.design-v3 .v3-support-index .v3-page-hero--support::after {
    display: block !important;
    content: "" !important;
}

html.design-v3 .v3-support-index .v3-page-hero--support > .v3-support-index__intro-copy,
html.design-v3 .v3-support-index .v3-page-hero--support > .v3-support-index__intro-action {
    position: relative;
    z-index: 3;
}

html.design-v3 .v3-support-index .v3-page-hero--support .v3-support-index__intro-action {
    margin-top: 0 !important;
}

html.design-v3 .v3-support-index .v3-page-hero--support .v3-support-index__cta a {
    border-color: var(--v3-green, #76c043);
    background: var(--v3-green, #76c043);
    color: var(--v3-white, #ffffff) !important;
    text-decoration: none;
}

html.design-v3 .v3-support-index .v3-page-hero--support .v3-support-index__cta a:hover {
    border-color: #8ed05f;
    background: #8ed05f;
    color: var(--v3-white, #ffffff) !important;
}

html.design-v3 .v3-support-index .v3-support-index__hero-stack {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

html.design-v3 .v3-support-index .v3-support-index__hero-stack > .v3-page-hero--support {
    order: 1;
    margin-bottom: 12px !important;
}

html.design-v3 .v3-support-index .v3-support-index__guidance {
    order: 2;
    margin: 0 0 24px !important;
    padding: 12px 15px !important;
    border: 1px solid var(--v3-support-line, var(--v3-border, #dce4ed));
    border-left: 3px solid var(--v3-green, #76c043);
    border-radius: 10px;
    background: var(--v3-support-panel, var(--v3-white, #ffffff));
    color: var(--v3-support-muted, var(--v3-muted, #617186)) !important;
    font-size: 13px !important;
    line-height: 1.55 !important;
}

html.design-v3 .v3-support-index .v3-support-index__guidance a {
    color: var(--v3-blue, #2f80ed);
    font-weight: 700;
}

/* The billing sidebar used a title-height offset before the unified hero. */
html.design-v3 .v3-billing-index .v3-billing-aside {
    margin-top: 0 !important;
}

/*
 * Paint table corners on the actual cells. Wrappers stay open/scrollable so
 * focus rings, Bootstrap tooltips and action menus are never clipped merely
 * to obtain rounded corners.
 */
html.design-v3 .v3-products-dashboard .v3-products-table thead:first-child tr:first-child > th:first-child,
html.design-v3 .v3-billing-index .v3-billing-table thead:first-child tr:first-child > th:first-child,
html.design-v3 .v3-affiliate-page .v3-affiliate-table thead:first-child tr:first-child > th:first-child,
html.design-v3 .v3-support-index .v3-support-tickets thead:first-child tr:first-child > th:first-child {
    border-top-left-radius: 13px;
}

html.design-v3 .v3-products-dashboard .v3-products-table thead:first-child tr:first-child > th:last-child,
html.design-v3 .v3-billing-index .v3-billing-table thead:first-child tr:first-child > th:last-child,
html.design-v3 .v3-affiliate-page .v3-affiliate-table thead:first-child tr:first-child > th:last-child,
html.design-v3 .v3-support-index .v3-support-tickets thead:first-child tr:first-child > th:last-child {
    border-top-right-radius: 13px;
}

html.design-v3 .v3-products-dashboard .v3-products-table tbody:last-child tr:last-child > td:first-child,
html.design-v3 .v3-billing-index .v3-billing-table tbody:last-child tr:last-child > td:first-child,
html.design-v3 .v3-affiliate-page .v3-affiliate-table tbody:last-child tr:last-child > td:first-child,
html.design-v3 .v3-support-index .v3-support-tickets tbody:last-child tr:last-child > td:first-child {
    border-bottom-left-radius: 13px;
}

html.design-v3 .v3-products-dashboard .v3-products-table tbody:last-child tr:last-child > td:last-child,
html.design-v3 .v3-billing-index .v3-billing-table tbody:last-child tr:last-child > td:last-child,
html.design-v3 .v3-affiliate-page .v3-affiliate-table tbody:last-child tr:last-child > td:last-child,
html.design-v3 .v3-support-index .v3-support-tickets tbody:last-child tr:last-child > td:last-child {
    border-bottom-right-radius: 13px;
}

html.design-v3 .v3-billing-index .v3-billing-empty:last-child {
    border-radius: 0 0 17px 17px;
}

html.design-v3 .v3-billing-index .v3-billing-empty:empty,
html.design-v3 .v3-billing-index .v3-billing-empty:not(:has(p)) {
    display: none;
}

@media (max-width: 760px) {
    html.design-v3 .v3-page-hero,
    html.design-v3 .v3-products-dashboard .v3-client-hero.v3-page-hero,
    html.design-v3 .v3-affiliate-page .v3-affiliate-hero.v3-page-hero,
    html.design-v3 .v3-support-index .v3-page-hero--support {
        min-height: 132px !important;
        padding: 24px 22px !important;
        border-radius: 14px !important;
    }

    html.design-v3 .v3-page-hero::after {
        top: 24px;
        bottom: 24px;
    }

    html.design-v3 .v3-products-dashboard .v3-client-hero.v3-page-hero::after {
        inset: 24px auto 24px 0;
    }

    html.design-v3 .v3-page-hero .v3-page-hero__title {
        font-size: 27px !important;
    }

    html.design-v3 .v3-support-index .v3-page-hero--support {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    html.design-v3 .v3-support-index .v3-page-hero--support .v3-support-index__cta,
    html.design-v3 .v3-support-index .v3-page-hero--support .v3-support-index__cta a {
        width: 100%;
    }
}

@media (max-width: 420px) {
    html.design-v3 .v3-page-hero,
    html.design-v3 .v3-products-dashboard .v3-client-hero.v3-page-hero,
    html.design-v3 .v3-affiliate-page .v3-affiliate-hero.v3-page-hero,
    html.design-v3 .v3-support-index .v3-page-hero--support {
        padding-right: 18px !important;
        padding-left: 20px !important;
    }

    html.design-v3 .v3-page-hero .v3-page-hero__title {
        font-size: 25px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    html.design-v3 .v3-page-hero a {
        transition: none;
    }
}
