* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #fafbfc;
    --text: #2d3748;
    --muted: #8a94a6;
    --line: #e9edf2;

    --blue: #487DA8;
    --teal: #49A8BF;
    --mint: #99CCBF;
    --pink: #CC67AA;
    --cream: #E8E7C8;
    --lime: #CC67AA;
    --green: #BACF79;

    --shadow-soft: 0 8px 24px rgba(31, 41, 55, 0.05);
    --shadow-card: 0 10px 28px rgba(31, 41, 55, 0.07);

    --radius-xl: 22px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 12px;

    --layout-gap: 16px;
    --panel-gap: 10px;
    --chart-height: 320px;
}

html {
    height: 100%;
}

body {
    min-height: 100vh;
    align-content: start;
    background:
        radial-gradient(circle at top right, rgba(73, 168, 191, 0.08), transparent 26%),
        radial-gradient(circle at top left, rgba(153, 204, 191, 0.12), transparent 24%),
        linear-gradient(180deg, #f8fafb 0%, var(--bg) 100%);
    color: var(--text);
    text-align: left;
    font-family: Calibri, "Trebuchet MS", sans-serif;
    line-height: 1.4;
    padding: 22px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Header ---------- */

.header-shell {
    display: grid;
    gap: 12px;
}

.navbar {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 0 4px;
    min-width: 0;
}

.brand-controls {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 0 0 auto;
}

.logo-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    text-decoration: none;
}

.logo-link:focus-visible {
    outline: 3px solid rgba(73, 168, 191, 0.2);
    outline-offset: 3px;
}

.language-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.84);
    box-shadow: 0 4px 12px rgba(31, 41, 55, 0.04);
}

.language-switch a {
    min-width: 44px;
    padding: 5px 11px;
    border-radius: 999px;
    color: #607086;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-align: center;
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.language-switch a:hover,
.language-switch a:focus-visible {
    background: rgba(72, 125, 168, 0.08);
    color: var(--blue);
    outline: none;
}

.language-switch a[aria-current="page"] {
    background: #eef4f8;
    color: var(--blue);
    box-shadow: inset 0 0 0 1px rgba(72, 125, 168, 0.14);
}

.fullscreen-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.84);
    box-shadow: 0 4px 12px rgba(31, 41, 55, 0.04);
    padding: 3px;
    color: #607086;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.fullscreen-toggle-inner {
    min-width: calc(44px * 2 + 2px);
    min-height: 27px;
    padding: 5px 11px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-align: center;
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.fullscreen-toggle svg {
    width: 14px;
    height: 14px;
}

.fullscreen-toggle:hover .fullscreen-toggle-inner,
.fullscreen-toggle:focus-visible .fullscreen-toggle-inner {
    background: rgba(72, 125, 168, 0.08);
    color: var(--blue);
}

.fullscreen-toggle:focus-visible {
    outline: none;
}

.fullscreen-toggle.is-active .fullscreen-toggle-inner {
    background: #eef4f8;
    color: var(--blue);
    box-shadow: inset 0 0 0 1px rgba(72, 125, 168, 0.14);
}

.page-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 10px;
    padding: 4px 4px 0;
    width: fit-content;
    max-width: 100%;
    justify-self: start;
}

.page-nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid rgba(72, 125, 168, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    color: #5f6f84;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(31, 41, 55, 0.04);
    white-space: nowrap;
}

.page-nav-link.is-active,
.page-nav-link[aria-current="page"] {
    background: #eef4f8;
    color: var(--blue);
    border-color: rgba(72, 125, 168, 0.24);
}

.page-nav-link.is-disabled {
    color: var(--muted);
    background: rgba(255, 255, 255, 0.68);
    border-style: dashed;
}

.page-nav.is-hidden {
    display: none;
}

@media (hover: hover) {
    .page-nav a.page-nav-link:hover,
    .page-nav a.page-nav-link:focus-visible {
        color: var(--blue);
        border-color: rgba(72, 125, 168, 0.24);
        background: rgba(238, 244, 248, 0.92);
        outline: none;
    }
}

.logo {
    width: 98px;
    height: auto;
    object-fit: contain;
    flex: 0 0 auto;
}

@media (min-width: 901px) {
    .navbar {
        display: flex;
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
    }

    h1 {
        text-align: left;
    }

    .brand-controls {
        justify-content: flex-start;
        flex-direction: row-reverse;
        flex-shrink: 0;
        margin-right: 36px;
    }

    .logo {
        transform: none;
    }
}

h1 {
    color: var(--text);
    font-size: clamp(0.88rem, 1.35vw, 1.35rem);
    line-height: 1.12;
    font-weight: 700;
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    max-width: 920px;
    text-align: left;
}

@media (max-width: 900px) {
    .navbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        justify-items: stretch;
        align-items: start;
    }

    .brand-controls {
        gap: 10px;
        width: auto;
        justify-content: flex-start;
        justify-self: start;
           flex-direction: row;
    }

    h1 {
        width: 100%;
    }
}

@media (min-width: 421px) and (max-width: 900px) {
    h1 {
        text-align: left;
    }

    .brand-controls {
        width: auto;
    }
}

/* ---------- Main layout ---------- */

.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
    gap: var(--layout-gap);
    align-items: stretch;
    min-height: 0;
}

/* ---------- Left column ---------- */

.cards {
    display: flex;
    flex-direction: column;
    gap: var(--panel-gap);
    min-width: 0;
    height: 100%;
}

.cards .filters-section,
.current-section,
.ai_agent {
    background: var(--surface);
    border: 1px solid #e8eef2;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
    padding: 14px;
}

.current-section,
.ai_agent {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.current-section {
    flex: 0 0 auto;
}

/* ---------- Filters ---------- */

.filters-panel {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.filters {
    min-width: 0;
}

label[for="filter1"],
label[for="filter2"] {
    display: block;
    font-size: 0.98rem;
    color: var(--text);
    margin-bottom: 6px;
    font-weight: 800;
}

#filter1,
#filter2,
.chart-type-select,
#question {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text);
    outline: none;
}

#filter1,
#filter2 {
    height: 40px;
    padding: 0 12px;
    font-size: 0.92rem;
}

#filter1:focus,
#filter2:focus,
.chart-type-select:focus,
#question:focus {
    border-color: rgba(73, 168, 191, 0.45);
    box-shadow: 0 0 0 4px rgba(73, 168, 191, 0.10);
    background: var(--surface);
}

/* ---------- Cards ---------- */

.cards-title,
.ai_agent h2 {
    color: var(--text);
    font-size: 0.98rem;
    line-height: 1.1;
    font-weight: 800;
    margin-bottom: 2px;
}

.cards-items {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

@media (min-width: 1181px) {
    .cards-items {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-rows: 1fr;
        flex: 1 1 auto;
    }

    .cards-items > div {
        min-height: 0;
        justify-content: flex-start;
    }

    .card-value,
    .card-value-grouped {
        margin-top: auto;
    }
}

.cards-items > div {
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 5px solid var(--card-accent, var(--mint));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    min-height: 78px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    text-align: center;
}

.cards-items > div.card-placeholder {
    visibility: hidden;
    pointer-events: none;
}

.cards-items > div.card-link-mobile {
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, border-left-color 0.18s ease;
}

.cards-items > div.card-link-mobile:active {
    transform: translateY(-2px) scale(0.99);
    box-shadow: 0 14px 26px rgba(31, 41, 55, 0.12);
    border-top-color: rgba(73, 168, 191, 0.28);
    border-right-color: rgba(73, 168, 191, 0.28);
    border-bottom-color: rgba(73, 168, 191, 0.28);
    border-left-color: var(--card-accent, var(--mint));
}

.cards-items > div.card-link-mobile:focus-visible {
    outline: none;
    border-top-color: rgba(73, 168, 191, 0.45);
    border-right-color: rgba(73, 168, 191, 0.45);
    border-bottom-color: rgba(73, 168, 191, 0.45);
    border-left-color: var(--card-accent, var(--mint));
    box-shadow: 0 0 0 4px rgba(73, 168, 191, 0.10), var(--shadow-card);
}

@media (min-width: 901px) {
    .cards-items > div.card-link-mobile:hover {
        transform: translateY(-4px);
        box-shadow: 0 16px 30px rgba(31, 41, 55, 0.12);
        border-top-color: rgba(73, 168, 191, 0.22);
        border-right-color: rgba(73, 168, 191, 0.22);
        border-bottom-color: rgba(73, 168, 191, 0.22);
        border-left-color: var(--card-accent, var(--mint));
    }
}

.cards-items > div:nth-of-type(1) { --card-accent: var(--blue); }
.cards-items > div:nth-of-type(2) { --card-accent: var(--teal); }
.cards-items > div:nth-of-type(3) { --card-accent: var(--mint); }
.cards-items > div:nth-of-type(4) { --card-accent: var(--pink); }

.cards[data-grouped="true"] .cards-items > div {
    --card-accent: var(--line);
}

.card-title {
    color: var(--text);
    font-weight: 700;
    line-height: 1.2;
    font-size: 0.76rem;
}

.card-value {
    color: var(--blue);
    font-size: 1.28rem;
    font-weight: 800;
    line-height: 1;
}

.card-value-grouped {
    color: var(--text);
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.2;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}

.card-group-row {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.card-group-label {
    font-weight: 800;
}

.card-group-value {
    font-weight: 700;
}

.card-group-separator {
    color: var(--muted);
    opacity: 0.55;
}

/* ---------- Charts ---------- */

.charts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    min-width: 0;
    min-height: 0;
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfd 100%);
    border: 1px solid #e8eef2;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
    padding: 14px;
    align-content: start;
    position: relative;
}

.charts h2 {
    grid-column: 1 / -1;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0;
    padding-right: 182px;
}

.export-csv-button {
    position: absolute;
    top: 10px;
    right: 150px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    z-index: 2;
    transition: transform 0.16s ease, filter 0.16s ease;
}

.export-csv-button img {
    width: 30px;
    height: 30px;
    display: block;
    object-fit: contain;
}

.export-csv-button:hover {
    transform: translateY(-1px) scale(1.03);
}

.export-csv-button:focus-visible {
    outline: 3px solid rgba(73, 168, 191, 0.2);
    outline-offset: 3px;
}

.export-pdf-button {
    position: absolute;
    top: 10px;
    right: 74px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    z-index: 2;
    transition: transform 0.16s ease, filter 0.16s ease, opacity 0.16s ease;
}

.export-pdf-button img {
    width: 26px;
    height: 26px;
    display: block;
    object-fit: contain;
}

.export-pdf-button:hover {
    transform: translateY(-1px) scale(1.03);
    filter: brightness(1.04);
}

.export-pdf-button:focus-visible {
    outline: 3px solid rgba(139, 51, 51, 0.18);
    outline-offset: 3px;
}

.export-pdf-button.is-loading,
.export-pdf-button:disabled {
    cursor: progress;
    opacity: 0.65;
    transform: none;
    filter: none;
}

.export-ppt-button {
    position: absolute;
    top: 10px;
    right: 112px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #d24726;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    z-index: 2;
    transition: transform 0.16s ease, filter 0.16s ease, opacity 0.16s ease;
}

.export-ppt-button img {
    width: 30px;
    height: 30px;
    display: block;
    object-fit: contain;
}

.export-ppt-button:hover {
    transform: translateY(-1px) scale(1.03);
    filter: brightness(1.04);
}

.export-ppt-button:focus-visible {
    outline: 3px solid rgba(210, 71, 38, 0.18);
    outline-offset: 3px;
}

.export-ppt-button.is-loading,
.export-ppt-button:disabled {
    cursor: progress;
    opacity: 0.65;
    transform: none;
    filter: none;
}

.show-all-charts-button {
    position: absolute;
    top: 10px;
    right: 164px;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #7b8794;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: transform 0.16s ease, filter 0.16s ease;
}

@media (min-width: 901px) {
    .charts h2 {
        padding-right: 158px;
    }

    .export-csv-button,
    .export-pdf-button,
    .export-ppt-button,
    .show-all-charts-button {
        top: 8px;
    }

    .export-csv-button {
        right: 102px;
    }

    .export-ppt-button {
        right: 64px;
    }

    .export-pdf-button {
        right: 26px;
    }

    .show-all-charts-button {
        right: 140px;
    }
}

.show-all-charts-button.is-visible {
    display: inline-flex;
}

.show-all-charts-button svg {
    width: 30px;
    height: 30px;
    display: block;
}

.show-all-charts-button:hover {
    transform: translateY(-1px) scale(1.03);
    color: #5f6b77;
    filter: brightness(1.03);
}

.show-all-charts-button:focus-visible {
    outline: 3px solid rgba(73, 168, 191, 0.2);
    outline-offset: 3px;
}

.charts > div {
    min-width: 0;
    height: var(--chart-height);
    background: linear-gradient(180deg, #fcfdfe 0%, #f7f9fb 100%);
    border: 1px solid #edf2f5;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
    padding: 12px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.charts > div.chart-hover-highlight {
    border-color: rgba(73, 168, 191, 0.65);
    box-shadow: 0 0 0 3px rgba(73, 168, 191, 0.14), var(--shadow-soft);
}

.charts > div::after {
    content: "Chart area";
    position: absolute;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    color: #b0b8c4;
    font-size: 0.95rem;
    font-weight: 600;
}

.charts > div.has-chart::after {
    display: none;
}

/* Layout for a single visible chart */
.charts[data-item-count="1"] > div:first-of-type {
    grid-column: 1 / -1;
}

.charts[data-item-count="1"] h2 {
    font-size: 1.16rem;
}

.charts[data-item-count="1"] .chart-header {
    gap: 14px;
    margin-bottom: 12px;
    padding-bottom: 10px;
}

.charts[data-item-count="1"] .chart-title {
    font-size: 1.14rem;
    line-height: 1.35;
}

.charts[data-item-count="1"] .chart-type-control {
    width: 136px;
    gap: 6px;
}

.charts[data-item-count="1"] .chart-type-label {
    font-size: 0.88rem;
}

.charts[data-item-count="1"] .chart-type-select {
    height: 36px;
    font-size: 0.98rem;
}

.charts[data-item-count="1"] .chart-legend {
    gap: 10px 16px;
    padding-top: 12px;
    margin-top: 12px;
}

.charts[data-item-count="1"] .chart-legend-item {
    font-size: 0.98rem;
}

.charts[data-item-count="1"] .chart-legend-swatch {
    width: 12px;
    height: 12px;
}

.charts[data-item-count="1"] .board-table-wrap {
    border-radius: var(--radius-lg);
}

.charts[data-item-count="1"] .board-table {
    font-size: 1.04rem;
}

.charts[data-item-count="1"] .board-table th,
.charts[data-item-count="1"] .board-table td {
    padding: 14px 16px;
}

.charts[data-item-count="1"] .board-table-heading {
    font-size: 1rem;
    font-weight: 800;
}

.charts[data-item-count="3"] > div:last-of-type {
    grid-column: 1 / -1;
}

/* ---------- Chart internals ---------- */

.chart-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: start;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #edf2f5;
}

.chart-title {
    color: var(--text);
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.25;
    text-align: left;
}

.chart-type-control {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    width: 112px;
    flex-shrink: 0;
}

.chart-type-label {
    font-size: 0.72rem;
    color: var(--muted);
    font-weight: 700;
    width: 100%;
    text-align: left;
    transform: none;
}

.chart-type-select {
    height: 30px;
    padding: 0 8px;
    font-size: 0.8rem;
    background: var(--surface);
}

.chart-canvas-wrap {
    flex: 1;
    min-height: 0;
    position: relative;
}

.charts canvas {
    width: 100% !important;
    height: 100% !important;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 14px;
    padding-top: 10px;
    margin-top: 10px;
    border-top: 1px solid #edf2f5;
}

.chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #667487;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
}

.chart-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(45, 55, 72, 0.08);
}

.chart-legend-text {
    white-space: nowrap;
}

.board-table-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border: 1px solid #edf2f5;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfd 100%);
}

.board-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    color: var(--text);
}

.board-table thead th {
    position: sticky;
    top: 0;
    background: #f7fafc;
    z-index: 1;
}

.board-table th,
.board-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #edf2f5;
    text-align: center;
    white-space: nowrap;
}

.board-table tbody th {
    background: #fcfdfe;
    font-weight: 800;
}

.board-table tbody tr:last-child th,
.board-table tbody tr:last-child td {
    border-bottom: 0;
}

.board-table-heading {
    display: inline-block;
    font-weight: 800;
}

/* ---------- AI ---------- */

.ai_agent {
    min-height: 250px;
    flex: 1 1 auto;
    min-height: 0;
}

.ai-input-wrap {
    position: relative;
    width: 100%;
}

.answer-wrap {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

#question {
    min-height: 48px;
    padding: 10px 12px 10px 56px;
    font-size: 0.85rem;
    background: #f4f4f5;
    border-color: #e5e7eb;
    border-radius: 12px;
    text-align: left;
    direction: ltr;
}

#question::placeholder {
    text-align: left;
}

#askButton {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: #202123;
    color: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
}

#askButton svg {
    width: 15px;
    height: 15px;
    fill: currentColor;
}

#askButton:hover {
    background: #111214;
}

#askButton:focus-visible {
    outline: 3px solid rgba(32, 33, 35, 0.14);
    outline-offset: 2px;
}

#answer {
    margin-top: 2px;
    border: 1px dashed rgba(45, 55, 72, 0.16);
    border-radius: 12px;
    background: #fbfcfd;
    color: var(--muted);
    font-size: 0.9rem;
    padding: 12px 12px 48px;
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.reset-answer-button {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #d5dae1;
    border-radius: 999px;
    background: #f2f4f7;
    color: #8a94a6;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease, opacity 0.16s ease;
}

.reset-answer-button.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.reset-answer-button svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.reset-answer-button.is-visible:hover {
    background: var(--surface);
    color: var(--teal);
    border-color: rgba(73, 168, 191, 0.45);
    box-shadow: 0 0 0 4px rgba(73, 168, 191, 0.10);
    transform: translateY(-1px);
}

.reset-answer-button:focus-visible {
    outline: none;
    border-color: rgba(73, 168, 191, 0.45);
    box-shadow: 0 0 0 4px rgba(73, 168, 191, 0.10);
    background: var(--surface);
    color: var(--teal);
}

.reset-answer-button.is-spinning svg {
    animation: reset-button-spin 0.55s ease;
}

@keyframes reset-button-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(-180deg);
    }
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .cards {
        height: auto;
    }

    .ai_agent {
        flex: 0 0 auto;
    }

    .answer-wrap,
    #answer {
        flex: 0 0 auto;
    }

    #answer {
        overflow: visible;
    }

    .cards-items {
        grid-template-columns: repeat(var(--cards-columns, 4), minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .show-all-charts-button {
        display: none !important;
    }

    body {
        padding: 16px 12px;
        gap: 12px;
    }

    .navbar {
        gap: 12px;
        padding: 0;
    }

    .dashboard-layout {
        gap: 12px;
    }

    .cards-items {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cards .filters-section,
    .current-section,
    .ai_agent,
    .charts {
        padding: 12px;
        height: auto;
        align-content: start;
    }

    .charts {
        grid-template-columns: 1fr;
    }

    .charts > div {
        height: 270px;
        padding: 10px;
    }

    .ai_agent {
        min-height: 220px;
    }

    .logo {
        width: 88px;
    }

    .charts[data-item-count="3"] > div:last-of-type {
        grid-column: auto;
    }

}

@media (max-width: 700px) {
    .fullscreen-toggle {
        display: none;
    }

    body {
        padding: 12px 10px;
    }

    .chart-header {
        grid-template-columns: 1fr;
    }

    .navbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .charts {
        grid-template-columns: repeat(4, 30px) minmax(0, 1fr);
        column-gap: 8px;
        row-gap: 10px;
    }

    .dashboard-layout,
    .filters-panel,
    .cards,
    .cards-items,
    .charts {
        gap: 10px;
    }

    .chart-type-control {
        width: 100%;
        align-items: stretch;
    }

    .charts h2 {
        grid-column: 1 / -1;
        padding-right: 0;
        font-size: 0.95rem;
    }

    .export-csv-button,
    .export-pdf-button,
    .export-ppt-button,
    .show-all-charts-button {
        position: static;
        top: auto;
        left: auto;
        justify-self: center;
        margin-top: 0;
    }

    .charts > div {
        grid-column: 1 / -1;
    }

    .chart-title {
        font-size: 0.82rem;
        line-height: 1.35;
    }

    .chart-type-label {
        font-size: 0.7rem;
    }

    .chart-type-select {
        height: 34px;
        font-size: 0.86rem;
    }

    .export-csv-button {
        top: 8px;
        right: 74px;
        width: 30px;
        height: 30px;
    }

    .export-csv-button img {
        width: 24px;
        height: 24px;
    }

    .export-ppt-button {
        top: 8px;
        right: 42px;
        width: 30px;
        height: 30px;
    }

    .export-pdf-button {
        top: 8px;
        right: 10px;
        width: 30px;
        height: 30px;
    }

    .export-pdf-button img {
        width: 21px;
        height: 21px;
    }

    .export-ppt-button img {
        width: 24px;
        height: 24px;
    }

    h1 {
        width: 100%;
        font-size: 1.25rem;
        line-height: 1.2;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .logo {
        width: 80px;
    }

    .cards-items {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .cards-items > div {
        min-height: 70px;
        padding: 8px 10px;
        gap: 4px;
    }

    .card-title {
        font-size: 0.72rem;
    }

    .card-value {
        font-size: 1.12rem;
    }

    .card-value-grouped {
        font-size: 0.68rem;
        gap: 3px;
    }

    .charts > div {
        height: 380px;
    }

    .charts > div.has-board {
        height: auto;
        min-height: 0;
    }

    .charts > div.has-board .board-table-wrap {
        flex: 0 0 auto;
        min-height: 0;
        max-height: none;
        overflow: visible;
    }

    .charts > div.has-board .board-table {
        font-size: 0.76rem;
    }

    .charts > div.has-board .board-table th,
    .charts > div.has-board .board-table td {
        padding: 9px 10px;
        white-space: normal;
    }

    .chart-legend {
        justify-content: center;
        flex-wrap: nowrap;
        gap: 8px 12px;
    }

    .chart-legend-item {
        align-items: center;
        max-width: none;
        flex: 0 0 auto;
    }

    .chart-legend-text {
        white-space: nowrap;
        text-align: center;
    }

    .ai_agent {
        min-height: 0;
    }

    #answer {
        padding: 10px 10px 52px;
    }
}

@media (max-width: 480px) {
    .navbar {
        gap: 6px;
    }

    h1 {
        font-size: 1.08rem;
    }

    .logo {
        width: 88px;
    }

    .cards .filters-section,
    .current-section,
    .ai_agent,
    .charts {
        padding: 10px;
        border-radius: 18px;
    }

    #filter1,
    #filter2,
    #question {
        font-size: 16px;
    }

    .chart-header {
        gap: 8px;
        margin-bottom: 8px;
        padding-bottom: 6px;
    }

    .chart-title {
        font-size: 0.78rem;
    }

    .chart-type-select {
        font-size: 0.82rem;
    }

    .charts > div {
        height: 380px;
        padding: 8px;
    }

    .charts h2 {
        padding-right: 68px;
    }

    .cards-items {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .cards-items > div {
        min-height: 66px;
        padding: 8px;
    }

    .card-title {
        font-size: 0.68rem;
        line-height: 1.15;
    }

    .card-value {
        font-size: 1.02rem;
    }

    .card-value-grouped {
        font-size: 0.64rem;
        line-height: 1.1;
    }

    .charts > div.has-board {
        height: auto;
    }

    .charts > div.has-board .board-table-wrap {
        flex: 0 0 auto;
        min-height: 0;
        max-height: none;
        overflow: visible;
    }

    .charts > div.has-board .board-table {
        font-size: 0.72rem;
    }

    .charts > div.has-board .board-table th,
    .charts > div.has-board .board-table td {
        padding: 8px;
    }

    .chart-legend {
        justify-content: center;
        flex-wrap: nowrap;
        gap: 6px 10px;
        padding-top: 8px;
        margin-top: 8px;
    }

    .chart-legend-item {
        width: auto;
        flex: 0 0 auto;
        font-size: 0.74rem;
        align-items: center;
    }

    .chart-legend-text {
        white-space: nowrap;
        text-align: center;
    }

}