/* Briefs module — restrained petrol-teal reporting workspace. */
#tab-briefs {
    --briefs-accent: #087f78;
    --briefs-accent-deep: #075f5b;
    --briefs-accent-soft: #e8f4f2;
    --briefs-ink: var(--text-primary, #18363a);
    --briefs-muted: var(--text-secondary, #607477);
}

#tab-briefs .header-card-briefs {
    background: linear-gradient(118deg, #0b817a 0%, #096b68 62%, #075b60 100%);
    box-shadow: 0 10px 24px rgba(7, 95, 91, 0.15);
}

#tab-briefs .briefs-header-icon {
    width: 27px;
    height: 27px;
    margin-right: 7px;
    vertical-align: -6px;
    filter: drop-shadow(0 2px 3px rgba(0, 34, 37, 0.16));
}

#tab-briefs .briefs-workspace {
    container-type: inline-size;
    padding: clamp(16px, 2.5vw, 28px);
    border: 1px solid var(--border-color, #dce7e6);
    border-radius: var(--radius-lg, 12px);
    background:
        linear-gradient(145deg, rgba(232, 244, 242, 0.58), transparent 42%),
        var(--card-bg, #fff);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(18, 54, 54, .08));
}

#tab-briefs .briefs-country-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color, #dce7e6);
}

#tab-briefs .briefs-eyebrow {
    display: block;
    margin-bottom: 3px;
    color: var(--briefs-accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

#tab-briefs .briefs-country-label {
    margin: 0;
    color: var(--briefs-ink);
    font-size: 15px;
    font-weight: 700;
}

#tab-briefs .briefs-country-status {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 11px;
    border: 1px solid rgba(8, 127, 120, .22);
    border-radius: 999px;
    background: var(--briefs-accent-soft);
    color: var(--briefs-accent-deep);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
}

#tab-briefs .briefs-selection-guidance {
    margin: 0 0 10px;
    color: var(--briefs-ink);
    font-size: 13px;
    line-height: 1.55;
}

#tab-briefs .country-report-selection-hint {
    margin: 0 0 18px;
    padding: 10px 12px;
    border: 1px solid rgba(8, 127, 120, .2);
    border-left: 3px solid var(--briefs-accent);
    border-radius: 6px;
    background: color-mix(in srgb, var(--briefs-accent-soft) 68%, var(--card-bg, #fff));
    color: var(--briefs-muted);
    font-size: 12px;
    line-height: 1.55;
}

#tab-briefs .briefs-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

#tab-briefs .briefs-action {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;
    min-width: 0;
    min-height: 104px;
    padding: 17px 18px;
    border: 1px solid var(--border-color, #dce7e6);
    border-radius: 10px;
    background: var(--card-bg, #fff);
    color: var(--briefs-ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(24, 54, 58, .035);
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

#tab-briefs .briefs-action-featured {
    grid-column: 1 / -1;
    min-height: 112px;
    padding: 20px 22px;
    border-color: rgba(8, 127, 120, .32);
    background: linear-gradient(105deg, var(--briefs-accent-soft), var(--card-bg, #fff) 66%);
}

#tab-briefs .briefs-action-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 10px;
    background: var(--briefs-accent-soft);
    color: var(--briefs-accent-deep);
}

#tab-briefs .briefs-action-icon svg {
    width: 27px;
    height: 27px;
}

#tab-briefs .briefs-action-copy {
    display: grid;
    gap: 5px;
    min-width: 0;
}

#tab-briefs .briefs-action-title {
    color: var(--briefs-ink);
    font-size: 14px;
    font-weight: 750;
    line-height: 1.35;
}

#tab-briefs .briefs-action-description {
    max-width: 56ch;
    color: var(--briefs-muted);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
}

#tab-briefs .briefs-action-cue {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--briefs-accent-deep);
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
}

#tab-briefs .briefs-action-cue span {
    font-size: 18px;
    line-height: 1;
    transition: transform 180ms ease;
}

#tab-briefs .briefs-action:not(:disabled):hover {
    transform: translateY(-2px);
    border-color: rgba(8, 127, 120, .52);
    box-shadow: 0 8px 18px rgba(8, 82, 79, .1);
}

#tab-briefs .briefs-action:not(:disabled):hover .briefs-action-cue span {
    transform: translateX(3px);
}

#tab-briefs .briefs-action:focus-visible {
    outline: 3px solid rgba(8, 127, 120, .48);
    outline-offset: 3px;
}

#tab-briefs .briefs-action:disabled {
    cursor: not-allowed;
    opacity: .66;
    box-shadow: none;
}

.main-tabs-nav .main-tab-btn.active[data-tab="briefs"] {
    background: linear-gradient(135deg, #0b817a 0%, #075f5b 100%);
}

.main-tabs-nav .main-tab-btn[data-tab="briefs"]:focus-visible {
    outline: 2px solid #087f78;
    outline-offset: 2px;
}

.main-tabs-nav .main-tab-btn[data-tab="briefs"]:not(.active):hover {
    background: #e8f4f2;
    color: #075f5b;
}

.mobile-nav-btn.active[data-tab="briefs"] {
    color: #087f78;
}

.mobile-nav-btn.active[data-tab="briefs"]::after {
    background: #087f78;
}

[data-theme="dark"] #tab-briefs {
    --briefs-accent: #55c7ba;
    --briefs-accent-deep: #b2eee4;
    --briefs-accent-soft: #193b3c;
    --briefs-ink: var(--text-primary, #f1f5f9);
    --briefs-muted: var(--text-secondary, #bdcfce);
}

[data-theme="dark"] #tab-briefs .header-card-briefs {
    background: linear-gradient(118deg, #126b67 0%, #104f52 100%);
}

[data-theme="dark"] #tab-briefs .briefs-action-featured {
    background: linear-gradient(105deg, #193b3c, var(--card-bg, #1e293b) 70%);
}

[data-theme="dark"] .mobile-nav-btn.active[data-tab="briefs"] {
    color: #72d5c9;
}

[data-theme="dark"] .mobile-nav-btn.active[data-tab="briefs"]::after {
    background: #72d5c9;
}

[data-theme="dark"] .main-tabs-nav .main-tab-btn[data-tab="briefs"]:not(.active):hover {
    background: #193b3c;
    color: #b2eee4;
}

/* Keep descriptions readable when the country sidebar reduces module width. */
@container (max-width: 800px) {
    #tab-briefs .briefs-action:not(.briefs-action-featured) {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    #tab-briefs .briefs-action:not(.briefs-action-featured) .briefs-action-cue {
        grid-column: 2;
        justify-self: start;
    }
}

@media (max-width: 760px) {
    #tab-briefs .briefs-action-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    #tab-briefs .briefs-action-featured {
        grid-column: auto;
    }

    #tab-briefs .briefs-action {
        grid-template-columns: 40px minmax(0, 1fr) auto;
        gap: 11px;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    #tab-briefs .briefs-country-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 9px;
    }

    #tab-briefs .briefs-action {
        grid-template-columns: 38px minmax(0, 1fr);
    }

    #tab-briefs .briefs-action-icon {
        width: 38px;
        height: 38px;
    }

    #tab-briefs .briefs-action-cue {
        grid-column: 2;
        justify-self: start;
        margin-top: 2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #tab-briefs .briefs-action,
    #tab-briefs .briefs-action-cue span {
        transition: none;
    }
}

/* Inline report expansion: the selected card and its result share the module grid. */
#tab-briefs .briefs-action-open {
    grid-column: 1 / -1;
    width: 100%;
    border-color: rgba(8, 127, 120, .62);
    background: linear-gradient(105deg, var(--briefs-accent-soft), var(--card-bg, #fff) 72%);
    box-shadow: 0 5px 14px rgba(8, 82, 79, .08);
}

#tab-briefs .briefs-action-open:not(:disabled):hover {
    transform: translateY(-1px);
    border-color: var(--briefs-accent);
}

#tab-briefs .briefs-action-open:disabled {
    border-color: var(--border-color, #dce7e6);
    background: var(--card-bg, #fff);
}

#tab-briefs .briefs-action-open:focus-visible {
    outline-color: var(--briefs-accent);
}

#tab-briefs .briefs-action-open + .briefs-result[data-briefing-host="1"] {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    margin: 0 0 5px;
    overflow: hidden;
    border: 1px solid var(--border-color, #dce7e6);
    border-radius: 10px;
    background: var(--card-bg, #fff);
    box-shadow: 0 7px 20px rgba(24, 54, 58, .07);
}

#tab-briefs .briefs-result-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 19px;
    border-bottom: 1px solid var(--border-color, #dce7e6);
    background: linear-gradient(110deg, var(--briefs-accent-soft), var(--card-bg, #fff) 72%);
}

#tab-briefs .briefs-result-title {
    min-width: 0;
}

#tab-briefs h5.briefs-result-title {
    margin: 0;
    color: var(--briefs-ink);
    font-size: 14px;
    font-weight: 750;
    line-height: 1.35;
}

#tab-briefs p.briefs-result-country {
    margin: 4px 0 0;
    color: var(--briefs-muted);
    font-size: 12px;
    line-height: 1.4;
}

#tab-briefs .briefs-result-close {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 7px 12px;
    border: 1px solid rgba(8, 127, 120, .3);
    border-radius: 7px;
    background: var(--card-bg, #fff);
    color: var(--briefs-accent-deep);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

#tab-briefs .briefs-result-close:hover {
    transform: translateY(-1px);
    border-color: var(--briefs-accent);
    background: var(--briefs-accent-soft);
}

#tab-briefs .briefs-result-close:focus-visible {
    outline: 3px solid rgba(8, 127, 120, .45);
    outline-offset: 2px;
}

#tab-briefs .briefs-result-frame {
    display: block;
    width: 100%;
    height: 600px;
    min-height: 360px;
    border: 0;
    background: var(--card-bg, #fff);
}

[data-theme="dark"] #tab-briefs .briefs-action-open {
    background: linear-gradient(105deg, #193b3c, var(--card-bg, #1e293b) 72%);
    box-shadow: 0 5px 16px rgba(0, 0, 0, .2);
}

[data-theme="dark"] #tab-briefs .briefs-action-open:disabled {
    background: var(--card-bg, #1e293b);
}

[data-theme="dark"] #tab-briefs .briefs-action-open + .briefs-result[data-briefing-host="1"] {
    box-shadow: 0 8px 24px rgba(0, 0, 0, .24);
}

[data-theme="dark"] #tab-briefs .briefs-result-toolbar {
    background: linear-gradient(110deg, #193b3c, var(--card-bg, #1e293b) 72%);
}

[data-theme="dark"] #tab-briefs .briefs-result-close {
    border-color: rgba(85, 199, 186, .42);
    background: #233b40;
    color: #b2eee4;
}

[data-theme="dark"] #tab-briefs .briefs-result-close:hover {
    background: #294b4e;
    border-color: #55c7ba;
}

@media (max-width: 480px) {
    #tab-briefs .briefs-result-toolbar {
        align-items: flex-start;
        padding: 13px;
    }

    #tab-briefs .briefs-result-close {
        min-height: 34px;
        padding-inline: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #tab-briefs .briefs-result-close {
        transition: none;
    }
}

/* Report tabs: compact selector aligned with the country-view controls. */
/* The shell's overflow-x:hidden otherwise creates non-scrolling ancestors
   that prevent sticky descendants from following the page scroll. Clip keeps
   horizontal containment without introducing those scroll containers. */
body:has(#tab-briefs.active.briefs-has-results),
body:has(#tab-briefs.active.briefs-has-results) .container,
body:has(#tab-briefs.active.briefs-has-results) .main-grid,
body:has(#tab-briefs.active.briefs-has-results) .content {
    overflow-x: clip;
    overflow-y: visible;
}

#tab-briefs .briefs-report-tabs {
    display: none;
    position: sticky;
    top: var(--briefs-header-offset, 76px);
    z-index: 20;
    width: 100%;
    max-width: 100%;
    margin: 0 0 14px;
    padding: 5px;
    gap: 4px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    border: 1px solid var(--border-color, #dce7e6);
    border-radius: 9px;
    background: color-mix(in srgb, var(--card-bg, #fff) 94%, var(--briefs-accent-soft));
    box-shadow: 0 3px 10px rgba(24, 54, 58, .06);
    scrollbar-width: thin;
    scrollbar-color: rgba(8, 127, 120, .42) transparent;
}

#tab-briefs.briefs-has-results .briefs-report-tabs {
    display: flex;
}

#tab-briefs .briefs-report-tabs[hidden],
#tab-briefs .briefs-report-panel[hidden],
#tab-briefs .briefs-result[hidden] {
    display: none !important;
}

#tab-briefs .briefs-report-tab {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 7px 13px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--briefs-muted);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

#tab-briefs .briefs-report-tab:hover:not([aria-selected="true"]) {
    border-color: rgba(8, 127, 120, .16);
    background: var(--briefs-accent-soft);
    color: var(--briefs-accent-deep);
}

#tab-briefs .briefs-report-tab[aria-selected="true"] {
    border-color: rgba(8, 127, 120, .22);
    background: var(--briefs-accent);
    color: #fff;
    box-shadow: 0 1px 3px rgba(7, 95, 91, .16);
}

#tab-briefs .briefs-report-tab:focus-visible {
    position: relative;
    z-index: 1;
    outline: 3px solid rgba(8, 127, 120, .4);
    outline-offset: 2px;
}

/* Preserve the original two-column report cards until a report is selected. */
#tab-briefs .briefs-action-grid > .briefs-report-panel {
    display: contents;
}

#tab-briefs .briefs-report-panel-featured {
    grid-column: 1 / -1;
}

#tab-briefs .briefs-report-panel > .briefs-action-open,
#tab-briefs .briefs-report-panel > .briefs-result {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
}

#tab-briefs.briefs-has-results .briefs-action-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
}

#tab-briefs.briefs-has-results .briefs-action-grid > .briefs-report-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 0;
    min-width: 0;
}

#tab-briefs.briefs-has-results .briefs-report-panel-featured {
    grid-column: auto;
}

#tab-briefs.briefs-has-results .briefs-report-panel > .briefs-action {
    grid-column: 1;
    width: 100%;
    min-width: 0;
    border-radius: 10px 10px 0 0;
}

#tab-briefs.briefs-has-results .briefs-report-panel > .briefs-action-open + .briefs-result[data-briefing-host="1"] {
    grid-column: 1;
    margin: 0;
    border-top: 0;
    border-radius: 0 0 10px 10px;
}

#tab-briefs h5.briefs-result-title,
#tab-briefs p.briefs-result-country {
    margin: 0;
    color: var(--briefs-ink);
}

#tab-briefs .briefs-result-country {
    color: var(--briefs-muted);
    font-size: 12px;
    line-height: 1.4;
}

[data-theme="dark"] #tab-briefs .briefs-report-tabs {
    background: color-mix(in srgb, var(--card-bg, #1e293b) 94%, #193b3c);
    box-shadow: 0 3px 12px rgba(0, 0, 0, .2);
}

[data-theme="dark"] #tab-briefs .briefs-report-tab[aria-selected="true"] {
    background: #176e68;
    border-color: rgba(114, 213, 201, .35);
    color: #f2fffc;
}

[data-theme="dark"] #tab-briefs .briefs-report-tab:hover:not([aria-selected="true"]) {
    border-color: rgba(114, 213, 201, .2);
    background: #193b3c;
    color: #b2eee4;
}

[data-theme="dark"] #tab-briefs .briefs-report-tab:focus-visible {
    outline-color: rgba(114, 213, 201, .65);
}

@media (max-width: 760px) {
    #tab-briefs .briefs-report-tabs {
        top: var(--briefs-header-offset, 60px);
        margin-bottom: 11px;
        border-radius: 8px;
    }

    #tab-briefs .briefs-report-tabs::after {
        content: "";
        position: sticky;
        right: 0;
        flex: 0 0 8px;
        width: 8px;
        background: linear-gradient(90deg, transparent, var(--card-bg, #fff));
        pointer-events: none;
    }

    [data-theme="dark"] #tab-briefs .briefs-report-tabs::after {
        background: linear-gradient(90deg, transparent, var(--card-bg, #1e293b));
    }
}

@media (prefers-reduced-motion: reduce) {
    #tab-briefs .briefs-report-tab {
        transition: none;
    }
}
