/* GWS — Portfolio Builder
 * AzimutSuite CI: slate palette, system sans, clean cards.
 * Reuses tokens from gws.css (--gws-accent, --gws-bg, --gws-text, ...).
 * Class names match gws_portfolio.js — do not rename.
 */

:root {
    --pb-accent:       #2C3E50;
    --pb-accent-soft:  rgba(44, 62, 80, 0.08);
    --pb-accent-line:  rgba(44, 62, 80, 0.14);
    --pb-surface:      #ffffff;
    --pb-surface-alt:  #f8fafc;
    --pb-border:       #e2e8f0;
    --pb-border-strong:#cbd5e1;
    --pb-text:         #0f172a;
    --pb-text-soft:    #334155;
    --pb-text-mute:    #64748b;
    --pb-text-faint:   #94a3b8;
    --pb-pos:          #10B981;
    --pb-pos-soft:     rgba(16, 185, 129, 0.12);
    --pb-neg:          #EF4444;
    --pb-neg-soft:     rgba(239, 68, 68, 0.12);
    --pb-warn:         #F59E0B;
    --pb-shadow-sm:    0 1px 2px rgba(15, 23, 42, 0.04);
    --pb-shadow-md:    0 2px 8px rgba(15, 23, 42, 0.06);
    --pb-shadow-lg:    0 8px 28px rgba(15, 23, 42, 0.08);
    --pb-radius:       10px;
    --pb-radius-sm:    6px;
    --pb-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
               'Helvetica Neue', Arial, sans-serif;
    --pb-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

/* ── Layout ──────────────────────────────────────────── */
.gws-pb-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 20px;
    align-items: start;
    margin-top: 8px;
    font-family: var(--pb-sans);
    color: var(--pb-text);
}

/* ═══════════ SIDEBAR ═══════════ */
.gws-pb-sidebar {
    background: var(--pb-surface);
    border: 1px solid var(--pb-border);
    border-radius: var(--pb-radius);
    padding: 14px;
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    box-shadow: var(--pb-shadow-sm);
}
.gws-pb-sidebar-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--pb-border);
}
.gws-pb-sidebar-head h6 {
    margin: 0;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--pb-text-mute);
}
.gws-btn-sm { padding: 5px 9px; font-size: 12px; }
.gws-pb-saved { display: flex; flex-direction: column; gap: 6px; }
.gws-pb-saved-row {
    background: var(--pb-surface-alt);
    border: 1px solid transparent;
    border-left: 3px solid transparent;
    border-radius: var(--pb-radius-sm);
    padding: 10px 12px;
    cursor: pointer;
    transition: all .15s ease;
    display: flex; align-items: center; gap: 8px;
    position: relative;
}
.gws-pb-saved-row-main {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 3px;
}
.gws-pb-saved-del {
    background: none; border: none;
    color: var(--pb-text-faint);
    padding: 4px 6px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    transition: opacity .15s, color .15s, background .15s;
    flex-shrink: 0;
}
.gws-pb-saved-row:hover .gws-pb-saved-del { opacity: 1; }
/* Touch devices have no hover, so the delete affordance must stay visible
   — otherwise saved portfolios can't be deleted on iPad/iPhone. */
@media (hover: none) {
    .gws-pb-saved-del { opacity: 1; }
}
.gws-pb-saved-del:hover {
    color: var(--pb-neg);
    background: var(--pb-neg-soft);
}
.gws-pb-saved-row:hover {
    background: var(--pb-surface);
    border-color: var(--pb-border);
}
.gws-pb-saved-row.active {
    background: var(--pb-surface);
    border-color: var(--pb-border);
    border-left-color: var(--pb-accent);
    box-shadow: var(--pb-shadow-sm);
}
.gws-pb-saved-row strong {
    font-size: 13px;
    font-weight: 600;
    color: var(--pb-text);
}
.gws-pb-saved-row span {
    font-size: 11px;
    color: var(--pb-text-mute);
    font-variant-numeric: tabular-nums;
}
.gws-pb-empty-saved {
    text-align: center;
    color: var(--pb-text-faint);
    font-size: 12px;
    padding: 20px 4px;
}

/* ═══════════ MAIN COLUMN ═══════════ */
.gws-pb-main {
    display: flex; flex-direction: column; gap: 20px; min-width: 0;
}

/* ── Builder card ─────────────────────────────────────── */
.gws-pb-builder {
    background: var(--pb-surface);
    border: 1px solid var(--pb-border);
    border-radius: var(--pb-radius);
    padding: 20px 22px;
    box-shadow: var(--pb-shadow-sm);
    position: relative;
}
.gws-pb-builder::before {
    /* thin accent strip on top */
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--pb-accent) 0%, #3B7DDD 100%);
    border-radius: var(--pb-radius) var(--pb-radius) 0 0;
}
.gws-pb-builder-head {
    /* All controls in this row (name input, rebalancing select, save /
       trash / compute buttons) snap to one height — without this the
       18px-font name input and the bare-icon trash button each sat at a
       different height than the rest. */
    --pb-head-control-h: 38px;
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--pb-border);
}
.gws-pb-name {
    flex: 1 1 260px;
    height: var(--pb-head-control-h);
    box-sizing: border-box;
    border: 1px solid var(--pb-border);
    border-radius: 8px;
    padding: 0 14px;
    font-family: var(--pb-sans);
    font-size: 15px;
    font-weight: 600;
    color: var(--pb-text);
    background: var(--pb-surface);
    letter-spacing: -.01em;
    transition: border-color .15s, box-shadow .15s;
}
.gws-pb-name:focus {
    outline: none;
    border-color: var(--pb-accent);
    box-shadow: 0 0 0 3px var(--pb-accent-soft);
}
.gws-pb-name::placeholder { color: var(--pb-text-faint); font-weight: 500; }

.gws-pb-head-actions {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.gws-pb-rebal {
    display: flex; align-items: center; gap: 8px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--pb-text-mute);
    font-weight: 700;
}
.gws-pb-rebal select,
.gws-pb-picker select {
    border: 1px solid var(--pb-border);
    border-radius: var(--pb-radius-sm);
    padding: 8px 30px 8px 12px;
    background: var(--pb-surface)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E")
        no-repeat right 10px center;
    appearance: none; -webkit-appearance: none;
    font-family: var(--pb-sans);
    font-size: 13px;
    font-weight: 500;
    color: var(--pb-text);
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
.gws-pb-rebal select {
    height: var(--pb-head-control-h);
    box-sizing: border-box;
    padding-top: 0; padding-bottom: 0;
}
.gws-pb-rebal select:focus,
.gws-pb-picker select:focus {
    outline: none;
    border-color: var(--pb-accent);
    box-shadow: 0 0 0 3px var(--pb-accent-soft);
}

/* Header buttons (Save / Trash / Compute) match the unified control
   height. Trash is icon-only so it gets a square min-width to read as a
   proper icon button rather than a squashed pill. */
.gws-pb-builder-head .gws-btn {
    height: var(--pb-head-control-h);
    box-sizing: border-box;
    padding-top: 0; padding-bottom: 0;
}
.gws-pb-builder-head #gwsPbDelete {
    min-width: var(--pb-head-control-h);
    padding-left: 0; padding-right: 0;
    justify-content: center;
}

/* Pickers row */
.gws-pb-pickers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 18px;
}
.gws-pb-picker label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--pb-text-mute);
    font-weight: 700;
    margin-bottom: 6px;
}
.gws-pb-picker select { width: 100%; }

/* Component rows */
.gws-pb-components { display: flex; flex-direction: column; gap: 8px; }
.gws-pb-empty-components {
    border: 1px dashed var(--pb-border-strong);
    border-radius: var(--pb-radius);
    padding: 26px;
    text-align: center;
    color: var(--pb-text-mute);
    font-size: 13px;
    background: var(--pb-surface-alt);
}
.gws-pb-comp-row {
    display: flex; align-items: center; gap: 12px;
    background: var(--pb-surface-alt);
    border: 1px solid var(--pb-border);
    border-left: 3px solid var(--pb-accent);
    border-radius: var(--pb-radius-sm);
    padding: 10px 14px;
    transition: background .15s, box-shadow .15s;
}
.gws-pb-comp-row:hover {
    background: var(--pb-surface);
    box-shadow: var(--pb-shadow-sm);
}
.gws-pb-comp-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
    box-shadow: 0 0 0 2px var(--pb-surface), 0 0 0 3px rgba(0,0,0,0.06);
}
.gws-pb-comp-namewrap {
    flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px;
}
.gws-pb-comp-name {
    font-size: 13px; color: var(--pb-text); font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gws-pb-comp-incep {
    font-size: 11px; font-weight: 500; color: var(--pb-text-mute);
    font-variant-numeric: tabular-nums; white-space: nowrap;
}
.gws-pb-weight-input {
    width: 72px; text-align: right;
    border: 1px solid var(--pb-border);
    border-radius: var(--pb-radius-sm);
    padding: 6px 10px;
    font-family: var(--pb-mono);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    color: var(--pb-text);
    background: var(--pb-surface);
    transition: border-color .15s, box-shadow .15s;
}
.gws-pb-weight-input:focus {
    outline: none;
    border-color: var(--pb-accent);
    box-shadow: 0 0 0 3px var(--pb-accent-soft);
}
.gws-pb-comp-pct {
    color: var(--pb-text-mute);
    font-size: 12px;
    font-family: var(--pb-mono);
}
.gws-pb-comp-remove {
    background: none; border: none; color: var(--pb-text-faint);
    padding: 4px 6px;
    cursor: pointer; font-size: 14px;
    transition: color .12s;
}
.gws-pb-comp-remove:hover { color: var(--pb-neg); }

/* Weight bar */
.gws-pb-weight-bar { margin-top: 16px; }
.gws-pb-weight-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--pb-text-mute);
    font-weight: 700;
    margin-bottom: 6px;
    display: flex; align-items: center; gap: 8px;
}
.gws-pb-weight-label strong {
    color: var(--pb-text);
    font-family: var(--pb-mono);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
}
.gws-pb-weight-label strong.valid { color: var(--pb-pos); }
.gws-pb-weight-label strong.invalid { color: var(--pb-warn); }
.gws-pb-weight-track {
    height: 5px;
    background: var(--pb-border);
    border-radius: 3px;
    overflow: hidden;
}
.gws-pb-weight-fill {
    height: 100%;
    background: var(--pb-warn);
    width: 0%;
    transition: width .25s cubic-bezier(.2, .8, .2, 1), background-color .15s;
}
.gws-pb-weight-fill.valid { background: var(--pb-pos); }


/* ═══════════ FACTSHEET ═══════════ */
.gws-pb-factsheet {
    background: var(--pb-surface);
    border: 1px solid var(--pb-border);
    border-radius: var(--pb-radius);
    padding: 32px 36px 28px;
    color: var(--pb-text);
    box-shadow: var(--pb-shadow-md);
    position: relative;
    overflow: hidden;
}
.gws-pb-factsheet::before {
    /* accent top strip */
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--pb-accent) 0%, #3B7DDD 60%, #10B981 100%);
}

/* Header */
.gws-pb-fs-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 24px;
    padding-top: 6px;
    padding-bottom: 22px;
    margin-bottom: 26px;
    border-bottom: 1px solid var(--pb-border);
}
.gws-pb-fs-headline { flex: 1; min-width: 0; }
.gws-pb-fs-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 4px;
    flex-shrink: 0;
}
/* Download PDF button — primary action affordance on the factsheet
   header. Sits in the top-right of the head row (the existing flex
   space-between rule pushes it there). Disabled state during the
   ~5-second Playwright generation shows a spinner. */
.gws-pb-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-family: var(--pb-sans);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    border-radius: var(--pb-radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 120ms, box-shadow 120ms, opacity 120ms;
    text-decoration: none;
}
.gws-pb-btn[disabled] { opacity: 0.6; cursor: wait; }
.gws-pb-btn-primary {
    background: var(--pb-accent);
    color: #ffffff;
    border-color: var(--pb-accent);
}
.gws-pb-btn-primary:hover:not([disabled]) {
    background: #1f2d3d;
    box-shadow: var(--pb-shadow-sm);
}
.gws-pb-btn .fa-spinner { animation: gws-pb-spin 0.8s linear infinite; }
@keyframes gws-pb-spin { to { transform: rotate(360deg); } }
.gws-pb-fs-eyebrow {
    display: flex; align-items: center; gap: 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--pb-text-mute);
    margin-bottom: 12px;
}
.gws-pb-fs-mark {
    background: var(--pb-accent);
    color: var(--pb-surface);
    padding: 3px 9px 3px;
    border-radius: 3px;
    font-weight: 700;
    letter-spacing: .08em;
}
.gws-pb-fs-mark-sep { color: var(--pb-text-faint); }
.gws-pb-fs-title {
    font-family: var(--pb-sans);
    font-size: 36px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.02em;
    color: var(--pb-text);
    margin: 0 0 10px;
    word-break: break-word;
}
.gws-pb-fs-meta {
    font-size: 12px;
    color: var(--pb-text-mute);
    display: flex; gap: 10px; align-items: center;
    flex-wrap: wrap;
    font-variant-numeric: tabular-nums;
}
.gws-pb-fs-dot {
    color: var(--pb-text-faint);
    font-size: 10px;
}

/* Stats — three logical rows (Performance / Risk / Monthly), each a
   uniform 5-wide grid so tile widths line up vertically across the
   whole panel. Each row is a self-contained block: small uppercase
   eyebrow above its 5 tiles. Rows 2+ get a top border to separate
   the groups visually. */
.gws-pb-fs-stats {
    display: flex;
    flex-direction: column;
    background: var(--pb-surface-alt);
    border: 1px solid var(--pb-border);
    border-radius: var(--pb-radius);
    margin-bottom: 28px;
    overflow: hidden;
}
.gws-pb-stat-row {
    display: block;
}
.gws-pb-stat-row + .gws-pb-stat-row {
    border-top: 1px solid var(--pb-border);
}
.gws-pb-stat-row-eyebrow {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--pb-text-faint);
    padding: 10px 14px 0;
}
.gws-pb-stat-row-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
}
.gws-pb-stat {
    padding: 10px 12px 14px;
    text-align: left;
    border-right: 1px solid var(--pb-border);
    position: relative;
    min-width: 0;  /* allow grid items to shrink so values don't push width */
}
/* Last tile in each row drops the right border. */
.gws-pb-stat-row-grid > .gws-pb-stat:last-child { border-right: none; }
.gws-pb-stat-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--pb-text-mute);
    margin-bottom: 6px;
    display: block;
    /* Lock label height to a single line at the typical 5-wide widths
       (all current labels fit). min-height keeps tiles aligned even
       if a longer label ever wraps. */
    min-height: 1.2em;
    line-height: 1.2;
}
.gws-pb-stat-value {
    font-family: var(--pb-sans);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.15;
    color: var(--pb-text);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.01em;
    /* Keep numeric values on one line — the responsive rules size the
       grid so even the widest value ("-13.48%") has room without
       wrapping or being clipped. */
    white-space: nowrap;
}
.gws-pb-stat.pos .gws-pb-stat-value { color: var(--pb-pos); }
.gws-pb-stat.neg .gws-pb-stat-value { color: var(--pb-neg); }
.gws-pb-stat-bm {
    margin-top: 3px; font-size: 11px; font-weight: 500; color: #94a3b8;
    font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* Cards row */
.gws-pb-fs-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
.gws-pb-fs-card {
    background: var(--pb-surface);
    border: 1px solid var(--pb-border);
    border-radius: var(--pb-radius);
    padding: 20px 22px;
    margin-bottom: 20px;
}
.gws-pb-fs-row .gws-pb-fs-card { margin-bottom: 0; }
.gws-pb-fs-card h6 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--pb-text-soft);
    margin: 0 0 16px;
    display: flex; align-items: center; gap: 10px;
}
.gws-pb-rule {
    display: inline-block;
    width: 22px;
    height: 2px;
    background: var(--pb-accent);
    flex-shrink: 0;
    border-radius: 1px;
}
.gws-pb-h-unit {
    color: var(--pb-text-faint);
    font-size: 9px;
    letter-spacing: .08em;
    font-weight: 600;
}

.gws-pb-chart { position: relative; height: 280px; }
.gws-pb-chart-donut { height: 210px; }
.gws-pb-chart-bar { height: 220px; }
.gws-pb-fs-chart-card .gws-pb-chart { height: 300px; }

.gws-pb-fs-comp-card { display: flex; flex-direction: column; }
.gws-pb-comp-legend {
    list-style: none; padding: 0; margin: 16px 0 0;
    display: flex; flex-direction: column; gap: 8px;
    border-top: 1px solid var(--pb-border);
    padding-top: 14px;
}
.gws-pb-comp-legend li {
    display: flex; align-items: baseline; gap: 10px;
    font-size: 12px;
    color: var(--pb-text);
}
.gws-pb-comp-legend .dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
    transform: translateY(1px);
}
.gws-pb-comp-legend .name {
    flex: 1;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-weight: 500;
}
.gws-pb-comp-legend .w {
    font-family: var(--pb-mono);
    font-variant-numeric: tabular-nums;
    color: var(--pb-text-soft);
    font-weight: 600;
    font-size: 11px;
}
.gws-pb-comp-legend .gws-pb-legend-divider {
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px dashed var(--pb-border);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--pb-text-mute);
    display: block;
}
.gws-pb-comp-legend .gws-pb-legend-fund {
    font-size: 11px;
    color: var(--pb-text-soft);
}
.gws-pb-comp-legend .gws-pb-legend-fund .name { font-weight: 500; }

/* Monthly returns heatmap */
.gws-pb-monthly-wrap { overflow-x: auto; }
.gws-pb-monthly {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--pb-mono);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    background: var(--pb-surface);
    border: 1px solid var(--pb-border);
    border-radius: var(--pb-radius-sm);
    overflow: hidden;
}
.gws-pb-monthly th, .gws-pb-monthly td {
    padding: 9px 10px;
    text-align: right;
    border-right: 1px solid var(--pb-border);
    border-bottom: 1px solid var(--pb-border);
}
.gws-pb-monthly th:last-child, .gws-pb-monthly td:last-child { border-right: none; }
.gws-pb-monthly tr:last-child td, .gws-pb-monthly tr:last-child th { border-bottom: none; }
.gws-pb-monthly thead th {
    background: var(--pb-surface-alt);
    color: var(--pb-text-mute);
    font-weight: 700;
    text-align: center;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 10px 8px;
    border-bottom: 1px solid var(--pb-border-strong);
}
.gws-pb-monthly thead th:first-child {
    text-align: left;
    padding-left: 14px;
    color: var(--pb-text);
}
.gws-pb-monthly tbody th {
    background: var(--pb-surface-alt);
    color: var(--pb-text);
    font-family: var(--pb-sans);
    font-weight: 700;
    font-size: 12px;
    text-align: left;
    padding-left: 14px;
    border-right: 1px solid var(--pb-border-strong);
}
.gws-pb-monthly td.empty {
    color: var(--pb-text-faint);
    background: var(--pb-surface-alt);
}
.gws-pb-monthly td.pos { color: var(--pb-pos); font-weight: 600; }
.gws-pb-monthly td.neg { color: var(--pb-neg); font-weight: 600; }
.gws-pb-monthly td.ytd {
    background: var(--pb-accent-soft) !important;
    border-left: 1px solid var(--pb-border-strong);
    font-weight: 700;
    color: var(--pb-text) !important;
}
.gws-pb-monthly td.ytd strong { font-weight: 700; }
.gws-pb-monthly td.ytd.pos strong { color: var(--pb-pos); }
.gws-pb-monthly td.ytd.neg strong { color: var(--pb-neg); }

/* Footer */
.gws-pb-fs-footer {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--pb-border);
    font-size: 11px;
    color: var(--pb-text-mute);
    display: flex; align-items: center; gap: 12px;
    justify-content: center;
}
.gws-pb-fs-footer-mark { color: var(--pb-accent); font-size: 9px; }


/* ═══════════ Print ═══════════ */
@media print {
    body { background: #fff; }
    .no-print, .gws-toast-container, .gws-nav-bar,
    .gws-pb-sidebar, .gws-pb-builder, .back-button-container { display: none !important; }
    .gws-pb-layout { grid-template-columns: 1fr; gap: 0; margin: 0; }
    .gws-pb-main { gap: 0; }

    .gws-pb-factsheet {
        background: #fff !important;
        border: none !important;
        border-radius: 0;
        padding: 0;
        box-shadow: none !important;
    }
    .gws-pb-factsheet::before { display: none; }

    .gws-pb-fs-title { font-size: 28px; }
    .gws-pb-fs-stats { margin-bottom: 16px; }
    /* Print: keep the same 5-wide grouped layout, just tighter. */
    .gws-pb-stat-row-grid { grid-template-columns: repeat(5, 1fr); }
    .gws-pb-stat-row-eyebrow { padding: 7px 10px 0; font-size: 7px; }
    .gws-pb-stat { padding: 6px 9px 9px; }
    .gws-pb-stat-value { font-size: 15px; }
    .gws-pb-stat-label { font-size: 7px; margin-bottom: 4px; }

    .gws-pb-fs-row { grid-template-columns: 2fr 1fr; gap: 14px; margin-bottom: 12px; }
    .gws-pb-fs-card { margin-bottom: 12px; padding: 12px 14px; }
    .gws-pb-fs-card h6 { font-size: 9px; margin-bottom: 8px; }

    .gws-pb-chart { height: 180px !important; }
    .gws-pb-chart-donut { height: 150px !important; }
    .gws-pb-fs-chart-card .gws-pb-chart { height: 200px !important; }
    .gws-pb-chart-bar { height: 160px !important; }

    .gws-pb-monthly { font-size: 9px; }
    .gws-pb-monthly th, .gws-pb-monthly td { padding: 5px 6px; }
    .gws-pb-monthly tbody th { font-size: 10px; }
    .gws-pb-monthly thead th { font-size: 7px; padding: 6px 4px; }

    .gws-pb-fs-footer { margin-top: 12px; padding-top: 8px; font-size: 8px; }

    a[href]:after { content: none !important; }
    @page { margin: 1.4cm 1.6cm; size: A4 portrait; }
}

/* ═══════════ Responsive ═══════════ */
@media (max-width: 1100px) {
    .gws-pb-layout { grid-template-columns: 1fr; }
    .gws-pb-sidebar { position: static; max-height: none; }
    .gws-pb-fs-row { grid-template-columns: 1fr; }
    .gws-pb-factsheet { padding: 26px 22px 22px; }
    .gws-pb-fs-title { font-size: 28px; }
}
@media (min-width: 561px) and (max-width: 860px) {
    /* Each 5-tile row wraps to a 3+2 sub-grid. With exactly 5 children:
       visual row A = tiles 1,2,3 (idx 0,1,2) and visual row B = tiles
       4,5 (idx 3,4). Tiles 1-3 get a bottom border; tile 3 drops its
       right border (end of visual row 1); tile 5 drops its right
       border via the generic :last-child rule above. */
    .gws-pb-stat-row-grid { grid-template-columns: repeat(3, 1fr); }
    .gws-pb-stat-row-grid > .gws-pb-stat:nth-child(-n+3) {
        border-bottom: 1px solid var(--pb-border);
    }
    .gws-pb-stat-row-grid > .gws-pb-stat:nth-child(3n) { border-right: none; }
}
@media (max-width: 560px) {
    /* 5 tiles in a 2-col grid: rows are 1-2, 3-4, 5. Bottom border on
       tiles 1-4 (everything except the last). Right border off on even
       tiles AND on the lone trailing tile (last child). The explicit
       border-right: 1px restore ensures tile #3 (which would have been
       wiped by the 3-col rule at narrower viewports if the cascade
       leaked) gets its right border back. */
    .gws-pb-pickers { grid-template-columns: 1fr; }
    .gws-pb-stat-row-grid { grid-template-columns: repeat(2, 1fr); }
    .gws-pb-stat-row-grid > .gws-pb-stat:nth-child(2n+1) {
        border-right: 1px solid var(--pb-border);
    }
    .gws-pb-stat-row-grid > .gws-pb-stat:nth-child(2n) { border-right: none; }
    .gws-pb-stat-row-grid > .gws-pb-stat:last-child { border-right: none; }
    .gws-pb-stat-row-grid > .gws-pb-stat:not(:last-child) {
        border-bottom: 1px solid var(--pb-border);
    }
    .gws-pb-fs-title { font-size: 24px; }
    .gws-pb-factsheet { padding: 22px 18px 18px; }
}
