/* Soft table frame for en-us ESG10-46 (same shape as ESG51-63: 12px rounded frame,
   light inner lines). Header colors stay per chapter - only shape and lines change.
   Loaded by MasterEn AFTER cphHead so it sits on top of page CSS and inline styles.
   ponytail: !important is deliberate - these tables carry inline/page borders
   (1-2px colored grids); this one file is the single place that overrides them.
   Opt-out: class "table" (Bootstrap), class "esg-soft-skip" (own design, e.g. ESG14 topics), or nested tables. */

:root {
    --esg-soft-table-line: #dfe5ee;
    --esg-soft-table-frame: #cfd8e5;
    --esg-soft-table-head-line: rgba(255, 255, 255, 0.45);
}

/* The square 1px border on the direct wrapper would sit around the rounded frame */
:is(.esg13-page, .esg14-page, .esg21-page, .esg22-page, .esg23-page, .esg24-page,
    .esg25-page, .esg26-page, .esg27-page, .esg28-page, .esg29-page, .esg29-2-page,
    .esg29-3-page, .esg31-page, .esg34-page, .esg35-page, .esg41-page, .esg42-page,
    .esg43-page, .esg44-page, .esg45-page) :is(.table-wrap, .esg-table-wrap):has(> table:not(.table)) {
    border: 0 !important;
}

:is(.esg13-page, .esg14-page, .esg21-page, .esg22-page, .esg23-page, .esg24-page,
    .esg25-page, .esg26-page, .esg27-page, .esg28-page, .esg29-page, .esg29-2-page,
    .esg29-3-page, .esg31-page, .esg34-page, .esg35-page, .esg41-page, .esg42-page,
    .esg43-page, .esg44-page, .esg45-page) table:not(.table):not(table table):not(.esg-soft-skip),
table.esg10-sdg-table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    border: 1px solid var(--esg-soft-table-frame) !important;
    border-radius: 12px !important;
    overflow: hidden;
}

/* Lines: top + right on every cell, so rowspan cells never draw a doubled edge */
:is(.esg13-page, .esg14-page, .esg21-page, .esg22-page, .esg23-page, .esg24-page,
    .esg25-page, .esg26-page, .esg27-page, .esg28-page, .esg29-page, .esg29-2-page,
    .esg29-3-page, .esg31-page, .esg34-page, .esg35-page, .esg41-page, .esg42-page,
    .esg43-page, .esg44-page, .esg45-page) table:not(.table):not(table table):not(.esg-soft-skip) > * > tr > *,
table.esg10-sdg-table > * > tr > * {
    border: 0 !important;
    border-top: 1px solid var(--esg-soft-table-line) !important;
    border-right: 1px solid var(--esg-soft-table-line) !important;
}

:is(.esg13-page, .esg14-page, .esg21-page, .esg22-page, .esg23-page, .esg24-page,
    .esg25-page, .esg26-page, .esg27-page, .esg28-page, .esg29-page, .esg29-2-page,
    .esg29-3-page, .esg31-page, .esg34-page, .esg35-page, .esg41-page, .esg42-page,
    .esg43-page, .esg44-page, .esg45-page) table:not(.table):not(table table):not(.esg-soft-skip) > * > tr > *:last-child,
table.esg10-sdg-table > * > tr > *:last-child {
    border-right: 0 !important;
}

:is(.esg13-page, .esg14-page, .esg21-page, .esg22-page, .esg23-page, .esg24-page,
    .esg25-page, .esg26-page, .esg27-page, .esg28-page, .esg29-page, .esg29-2-page,
    .esg29-3-page, .esg31-page, .esg34-page, .esg35-page, .esg41-page, .esg42-page,
    .esg43-page, .esg44-page, .esg45-page) table:not(.table):not(table table):not(.esg-soft-skip) > thead > tr:first-child > *,
:is(.esg13-page, .esg14-page, .esg21-page, .esg22-page, .esg23-page, .esg24-page,
    .esg25-page, .esg26-page, .esg27-page, .esg28-page, .esg29-page, .esg29-2-page,
    .esg29-3-page, .esg31-page, .esg34-page, .esg35-page, .esg41-page, .esg42-page,
    .esg43-page, .esg44-page, .esg45-page) table:not(.table):not(table table):not(.esg-soft-skip):not(:has(> thead)) > tbody:first-of-type > tr:first-child > *,
table.esg10-sdg-table > tbody:first-of-type > tr:first-child > * {
    border-top: 0 !important;
}

/* Colored header rows: faint white dividers instead of grey */
:is(.esg13-page, .esg14-page, .esg21-page, .esg22-page, .esg23-page, .esg24-page,
    .esg25-page, .esg26-page, .esg27-page, .esg28-page, .esg29-page, .esg29-2-page,
    .esg29-3-page, .esg31-page, .esg34-page, .esg35-page, .esg41-page, .esg42-page,
    .esg43-page, .esg44-page, .esg45-page) table:not(.table):not(table table):not(.esg-soft-skip) > thead > tr > th,
table.esg10-sdg-table > tbody:first-of-type > tr:first-child > th {
    border-color: var(--esg-soft-table-head-line) !important;
}

/* Phones: fixed column widths + long words pushed these tables (and the page) past
   the screen. Let columns size to content and let the table's parent scroll sideways
   when a table still needs more room, so the rounded frame stays intact. */
@media (max-width: 768px) {
    :is(.esg13-page, .esg14-page, .esg21-page, .esg22-page, .esg23-page, .esg24-page,
        .esg25-page, .esg26-page, .esg27-page, .esg28-page, .esg29-page, .esg29-2-page,
        .esg29-3-page, .esg31-page, .esg34-page, .esg35-page, .esg41-page, .esg42-page,
        .esg43-page, .esg44-page, .esg45-page) table:not(.table):not(table table):not(.esg-soft-skip):not(.esg-management-table--column-flow),
    table.esg10-sdg-table {
        table-layout: auto !important;
    }

    :is(.esg13-page, .esg14-page, .esg21-page, .esg22-page, .esg23-page, .esg24-page,
        .esg25-page, .esg26-page, .esg27-page, .esg28-page, .esg29-page, .esg29-2-page,
        .esg29-3-page, .esg31-page, .esg34-page, .esg35-page, .esg41-page, .esg42-page,
        .esg43-page, .esg44-page, .esg45-page) :has(> table:not(.table):not(table table)),
    :has(> table.esg10-sdg-table) {
        overflow-x: auto;
    }
}

/* ESG29_1 supplier score panels frame a rounded table - round the panel to match */
.esg29-page .esg29-score-panel {
    border-radius: 12px;
}

/* ESG32/33/35 PDF download lists (Bootstrap "table thead-dark"): same rounded frame,
   chapter-3 orange header, and each PDF link as a download card (ESG51 style).
   CSS only - markup and link text untouched. */
:is(.esg32-page, .esg33-page, .esg35-page) table.table {
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--esg-soft-table-frame);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0;
    background: var(--esg-color-white);
}

:is(.esg32-page, .esg33-page, .esg35-page) table.table > * > tr > * {
    border: 0;
    border-top: 1px solid var(--esg-soft-table-line);
    border-right: 1px solid var(--esg-soft-table-line);
    padding: 14px 12px;
    vertical-align: middle;
}

:is(.esg32-page, .esg33-page, .esg35-page) table.table > * > tr > *:last-child {
    border-right: 0;
}

:is(.esg32-page, .esg33-page, .esg35-page) table.table > thead > tr > th {
    border-top: 0;
    border-right-color: var(--esg-soft-table-head-line);
    background: var(--esg-palette-orange);
    color: var(--esg-color-white);
    font-size: 17px;
    font-weight: 700;
}

:is(.esg32-page, .esg33-page, .esg35-page) table.table > tbody > tr > td:first-child {
    background: var(--esg-process-orange-soft);
    color: var(--esg-color-heading-strong);
}

:is(.esg32-page, .esg33-page, .esg35-page) table.table td > a {
    display: block;
    border: 1px solid var(--esg-soft-table-frame);
    border-radius: 12px;
    background: var(--esg-color-white);
    color: var(--esg-color-text-strong);
    text-decoration: none;
    transition: background-color .2s, box-shadow .2s, border-color .2s;
}

:is(.esg32-page, .esg33-page, .esg35-page) table.table td > a:hover,
:is(.esg32-page, .esg33-page, .esg35-page) table.table td > a:focus-visible {
    border-color: var(--esg-palette-orange);
    background: var(--esg-process-orange-soft);
    box-shadow: 0 4px 12px rgba(249, 155, 46, .18);
    text-decoration: none;
}

:is(.esg32-page, .esg33-page, .esg35-page) table.table td > a:focus-visible {
    outline: 2px solid var(--esg-palette-orange);
    outline-offset: 2px;
}

:is(.esg32-page, .esg33-page, .esg35-page) table.table td > a > div {
    padding: 12px 14px !important;
}

:is(.esg32-page, .esg33-page, .esg35-page) table.table td > a h6 {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
}

:is(.esg32-page, .esg33-page, .esg35-page) table.table td > a img {
    vertical-align: middle;
}

@media (prefers-reduced-motion: reduce) {
    :is(.esg32-page, .esg33-page, .esg35-page) table.table td > a {
        transition: none;
    }
}

/* Phones: drop the year header row and stack - each row becomes a titled card group */
@media (max-width: 768px) {
    :is(.esg32-page, .esg33-page, .esg35-page) table.table,
    :is(.esg32-page, .esg33-page, .esg35-page) table.table > tbody,
    :is(.esg32-page, .esg33-page, .esg35-page) table.table > tbody > tr,
    :is(.esg32-page, .esg33-page, .esg35-page) table.table > tbody > tr > td {
        display: block;
        width: auto !important;
    }

    :is(.esg32-page, .esg33-page, .esg35-page) table.table > thead {
        display: none;
    }

    :is(.esg32-page, .esg33-page, .esg35-page) table.table > tbody > tr > td {
        border-right: 0;
        padding: 10px 14px;
    }

    :is(.esg32-page, .esg33-page, .esg35-page) table.table > tbody > tr > td:not(:first-child):not(:has(a)) {
        display: none;
    }
}

/* ESG10 stage cards and ESG12 highlight panels (inline-styled boxes): same 12px corners */
.esg10-stage,
.esg12-panel {
    border-radius: 12px;
}

/* Management approach as four independent column cards (docx, chapter 2):
   coloured header, tinted centred sub-headings, sections stack per column.
   Markup: .esg-mgmt > section.esg-mgmt-col.is-c1..c4 > .esg-mgmt-head,
   then .esg-mgmt-sub + .esg-mgmt-body pairs. Used by ESG21, ESG22. */
.esg-mgmt {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
}

.esg-mgmt-col {
    --col: #2fa7a5;
    --col-soft: #e3f3f2;
    --col-text: #2fa7a5;
    border: 2px solid var(--col);
    border-radius: 16px;
    overflow: hidden;
    background: var(--esg-color-white);
}

.esg-mgmt-col.is-c2 { --col: #f2a443; --col-soft: #fdf0df; --col-text: #e08a1e; }
.esg-mgmt-col.is-c3 { --col: #7cbf74; --col-soft: #e9f4e6; --col-text: #5fa857; }
.esg-mgmt-col.is-c4 { --col: #ec7a5c; --col-soft: #fde9e3; --col-text: #d9623f; }

.esg-mgmt-head {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 62px;
    padding: 10px 12px;
    background: var(--col);
    color: var(--esg-color-white);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
}

.esg-mgmt-sub {
    padding: 6px 12px;
    background: var(--col-soft);
    color: var(--col-text);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
}

.esg-mgmt-body {
    padding: 12px 16px 16px;
    color: #333;
    font-size: 15px;
    line-height: 1.7;
    text-align: left;
    text-indent: 0;
}

.esg-mgmt-body p {
    margin: 0 0 6px;
    text-indent: 0;
}

.esg-mgmt-body p:last-child {
    margin-bottom: 0;
}

/* a sub-heading inside a section body (e.g. ESG24 "Explanation and Optimization of Unmet Targets") */
.esg-mgmt-body :is([class^="title-"], [class^="esg-title-"]) {
    margin: 12px 0 6px;
    color: var(--col-text);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
}

/* the old table wrapper keeps a square border once it holds cards instead of a table */
:is(.table-wrap, .esg-table-wrap):has(> .esg-mgmt) {
    border: 0 !important;
}

.esg-mgmt-body ul {
    margin: 0;
    padding-left: 1.2em;
    list-style: disc outside;
}

.esg-mgmt-body li {
    display: list-item;
    list-style: disc outside;
    margin-bottom: 4px;
    padding-left: 0;
    text-indent: 0;
}

@media (max-width: 1199px) {
    .esg-mgmt {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .esg-mgmt {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* GHG summary cards (icon | text + pill badges, one rounded frame, docx Chap.4).
   Shared by ESG24 and ESG45 - moved from esg45.css and renamed esg45-* -> esg-ghg-* / esg-pill / esg-saving-*. */

/* Scope 1/2 summary: rounded green frame, line icon left, text + badges right (per Chap.4 docx) */
:is(.esg24-page, .esg45-page) .esg-ghg-summary {
    border: 1px solid var(--esg-border-green-soft);
    border-radius: 16px;
    overflow: hidden;
    background: var(--esg-color-white);
}

:is(.esg24-page, .esg45-page) .esg-ghg-summary-card {
    display: grid;
    grid-template-columns: 64px 1fr;
    align-items: center;
    gap: 28px;
    padding: 28px 36px;
    border-bottom: 1px solid var(--esg-border-green-soft);
}

:is(.esg24-page, .esg45-page) .esg-ghg-summary-card:last-child {
    border-bottom: none;
}

:is(.esg24-page, .esg45-page) .esg-ghg-icon {
    width: 64px;
    height: 64px;
    fill: none;
    stroke: var(--esg-color-lime);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

:is(.esg24-page, .esg45-page) .esg-ghg-summary-body h5 {
    margin: 0;
    font-size: 19px;
    font-weight: 400;
    letter-spacing: normal;
    line-height: 1.5;
    color: var(--esg-color-heading);
}

:is(.esg24-page, .esg45-page) .esg-ghg-icon text {
    fill: var(--esg-color-lime);
    stroke: none;
    font-size: 17px;
    font-weight: 700;
}

:is(.esg24-page, .esg45-page) .esg-ghg-summary-body p {
    margin: 6px 0 12px;
    font-size: 15px;
    line-height: 1.5;
    text-indent: 0;
    color: var(--esg-color-muted);
}

:is(.esg24-page, .esg45-page) .esg-ghg-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Docx-style pill badges: GRI purple, SASB orange, Assurance Report green */
:is(.esg24-page, .esg45-page) .esg-pill {
    display: inline-flex;
    align-items: stretch;
    overflow: hidden;
    border: 1px solid currentColor;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    background: var(--esg-color-white);
}

:is(.esg24-page, .esg45-page) .esg-pill--gri {
    padding: 0;
    color: var(--esg-color-purple);
}

:is(.esg24-page, .esg45-page) .esg-pill--gri > span {
    padding: 4px 10px;
}

:is(.esg24-page, .esg45-page) .esg-pill--gri > span:first-child {
    background: var(--esg-color-purple);
    color: var(--esg-color-white);
}

:is(.esg24-page, .esg45-page) .esg-pill--sasb {
    color: var(--esg-palette-orange-accent);
}

:is(.esg24-page, .esg45-page) .esg-pill--assurance {
    color: var(--esg-color-green-text);
}

/* Scope 3 table + card: full column width, same as the Scope 1/2 card
   (shared .esg-scope3-grid caps both at 64%; ESG24 / zh-tw still use that) */
:is(.esg24-page, .esg45-page) .esg-scope3-grid > .table-wrap,
:is(.esg24-page, .esg45-page) .esg-scope3-grid > .esg-ghg-scope3 {
    width: 100%;
    max-width: 100%;
}

:is(.esg24-page, .esg45-page) .esg-ghg-scope3 {
    padding: 0;
}

/* Energy conservation card: icon | title + list | Savings */
:is(.esg24-page, .esg45-page) .esg-saving-summary .esg-ghg-summary-card {
    grid-template-columns: 64px 1fr minmax(220px, 30%);
}

:is(.esg24-page, .esg45-page) .esg-saving-summary h5 {
    margin: 0 0 6px;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: normal;
    color: var(--esg-color-heading);
}

:is(.esg24-page, .esg45-page) .esg-saving-summary ol {
    margin: 0;
    padding-left: 1.4em;
    list-style: decimal;
}

:is(.esg24-page, .esg45-page) .esg-saving-summary li {
    display: list-item;
    list-style: decimal outside;
}

:is(.esg24-page, .esg45-page) .esg-saving-summary li,
:is(.esg24-page, .esg45-page) .esg-saving-metric div {
    font-size: 16px;
    line-height: 1.6;
    color: var(--esg-color-text);
}

@media (max-width: 768px) {
    :is(.esg24-page, .esg45-page) .esg-ghg-summary {
        max-width: 100%;
    }
}

@media (max-width: 900px) {
    :is(.esg24-page, .esg45-page) .esg-ghg-summary-card {
        grid-template-columns: 40px 1fr;
        align-items: start;
        gap: 14px;
        padding: 20px 16px;
    }

    :is(.esg24-page, .esg45-page) .esg-ghg-icon {
        width: 40px;
        height: 40px;
    }

    :is(.esg24-page, .esg45-page) .esg-ghg-summary-body h5 {
        font-size: 17px;
    }

    :is(.esg24-page, .esg45-page) .esg-ghg-summary-body p {
        font-size: 14px;
    }

    :is(.esg24-page, .esg45-page) .esg-saving-summary .esg-ghg-summary-card {
        grid-template-columns: 40px 1fr;
    }

    :is(.esg24-page, .esg45-page) .esg-saving-metric {
        grid-column: 2;
    }

    :is(.esg24-page, .esg45-page) .esg-saving-summary h5 {
        font-size: 17px;
    }

    :is(.esg24-page, .esg45-page) .esg-saving-summary li,
    :is(.esg24-page, .esg45-page) .esg-saving-metric div {
        font-size: 14px;
    }
}

/* Water source / risk block (ESG29_2, ESG41):
   risk level as a highlighted strip with a drop icon and an amber pill (not red -
   the level is low-medium), the three water sources as icon tiles, notes small/grey. */
.esg-wr {
    --wr: #2f8fc4;
    --wr-soft: #eaf4fb;
    padding: 22px 24px 18px;
    border: 1px solid #cfe3f1;
    border-radius: 16px;
    background: var(--esg-color-white);
    box-shadow: 0 2px 10px rgba(23, 58, 138, 0.06);
}

.esg-wr-level {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    border-radius: 12px;
    background: var(--wr-soft);
}

.esg-wr-drop {
    flex: none;
    width: 48px;
    height: 48px;
    fill: var(--wr);
    stroke: var(--esg-color-white);
    stroke-width: 2.4;
    stroke-linecap: round;
}

.esg-wr-label {
    color: var(--esg-color-muted);
    font-size: 14px;
    font-weight: 700;
}

.esg-wr-value {
    color: var(--esg-color-heading-strong);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
}

.esg-wr-pill {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 12px;
    border-radius: 999px;
    background: #f6a623;
    color: var(--esg-color-white);
    font-size: 15px;
    vertical-align: middle;
}

.esg-wr-sources {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 14px 0 12px;
}

.esg-wr-source {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 14px 16px;
    border: 1px solid #d6e8f5;
    border-radius: 12px;
    background: #f7fbfe;
}

.esg-wr-icon {
    width: 40px;
    height: 40px;
    fill: none;
    stroke: var(--wr);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.esg-wr-source h5 {
    margin: 0 0 4px;
    color: var(--wr);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: normal;
}

.esg-wr-source p {
    margin: 0;
    color: #333;
    font-size: 15px;
    line-height: 1.6;
    text-indent: 0;
}

.esg-wr-source .esg-wr-sub {
    margin-top: 6px;
    color: var(--esg-color-muted);
    font-size: 13px;
}

.esg-wr .esg-wr-notes {
    margin: 0;
    padding-left: 1.4em;
    color: var(--esg-color-muted);
    font-size: 13px;
    line-height: 1.7;
}

.esg-wr .esg-wr-notes li {
    display: list-item;
    list-style: decimal outside;
}

/* Water summary table: arrow on the variance, formula row as a tinted note row */
:is(.esg29-2-page, .esg41-page) .esg-water-change.is-up::before,
:is(.esg29-2-page, .esg41-page) .esg-water-change.is-down::before {
    display: inline-block;
    margin-right: 4px;
    font-size: 0.85em;
}

:is(.esg29-2-page, .esg41-page) .esg-water-change.is-up::before { content: "\25B2"; }
:is(.esg29-2-page, .esg41-page) .esg-water-change.is-down::before { content: "\25BC"; }

:is(.esg29-2-page, .esg41-page) .esg-water-summary-table tbody tr:last-child > td[colspan] {
    background: var(--esg-process-blue-soft, #eaf1f9) !important;
    color: var(--esg-color-muted);
    font-size: 14px;
    line-height: 1.6;
}

@media (max-width: 900px) {
    .esg-wr-sources {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 600px) {
    .esg-wr {
        padding: 16px 14px;
    }

    .esg-wr-value {
        font-size: 20px;
    }
}

/* Note under the water summary table: label + numbered list, tight spacing */
.esg-wr-note {
    margin-top: 10px;
    color: var(--esg-color-muted);
    font-size: 14px;
    line-height: 1.7;
    text-align: left;
}

.esg-wr-note p {
    margin: 0;
    text-indent: 0;
}

.esg-wr-note-label {
    font-weight: 700;
}

.esg-wr-note ol {
    margin: 2px 0 0;
    padding-left: 1.4em;
}

.esg-wr-note li {
    display: list-item;
    margin: 0;
    padding-left: 0;
    list-style: decimal outside;
    text-indent: 0;
}

/* ESG41 keeps the summary table right after the risk card */
.esg-wr + section {
    margin-top: 24px;
}
