:root {
    --bg-color: #f8fafc;
    --bg-gradient: linear-gradient(140deg, #eff6ff 0%, #eef4ff 52%, #f8fafc 100%);
    --card-bg: rgba(255, 255, 255, 0.82);
    --card-strong: rgba(255, 255, 255, 0.94);
    --border-color: rgba(148, 163, 184, 0.24);
    --text-main: #102033;
    --text-muted: #5a6b80;
    --accent: #3b82f6;
    --accent-soft: rgba(59, 130, 246, 0.1);
    --accent-strong: #2563eb;
    --gold: #d97706;
    --shadow-sm: 0 18px 40px -28px rgba(15, 23, 42, 0.28);
    --shadow-md: 0 28px 64px -36px rgba(15, 23, 42, 0.34);
    --glass-blur: blur(18px);
    --radius-lg: 24px;
    --radius-md: 16px;
}

body.dark-mode {
    --bg-color: #0b1522;
    --bg-gradient: radial-gradient(circle at top, rgba(59, 130, 246, 0.22), transparent 30%), linear-gradient(145deg, #08111b 0%, #102033 52%, #120d18 100%);
    --card-bg: rgba(10, 21, 34, 0.78);
    --card-strong: rgba(13, 25, 40, 0.92);
    --border-color: rgba(148, 163, 184, 0.18);
    --text-main: #eef2ff;
    --text-muted: #9aa8bb;
    --accent: #60a5fa;
    --accent-soft: rgba(96, 165, 250, 0.12);
    --accent-strong: #93c5fd;
    --gold: #fbbf24;
    --shadow-sm: 0 22px 48px -30px rgba(2, 6, 23, 0.72);
    --shadow-md: 0 32px 80px -40px rgba(2, 6, 23, 0.82);
}

* {
    box-sizing: border-box;
}

body {
    background: var(--bg-gradient);
    color: var(--text-main);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 1.5rem 1rem 0;
    display: flex;
    flex-direction: column;
}

.nav-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    padding: 0.45rem;
    margin-bottom: 1.4rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-sm);
    align-self: center;
}

.nav-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.75rem 1.15rem;
    border-radius: 999px;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.nav-btn:hover {
    color: var(--accent);
    background: var(--accent-soft);
}

.nav-btn.active {
    color: white;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
}

.theme-btn {
    width: 2.9rem;
    height: 2.9rem;
    padding: 0;
    font-size: 1.1rem;
}

.theme-btn.active {
    background: var(--card-strong);
    color: var(--accent);
}

.header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.brand-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.75rem;
    margin-bottom: 1.15rem;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    padding: 0.35rem 0.5rem;
    transition: transform 0.2s ease, background 0.2s ease;
}

.brand-link:hover {
    transform: translateY(-1px);
    background: var(--accent-soft);
}

.brand-logo {
    height: 48px;
    max-height: 48px;
    max-width: 170px;
    width: auto;
    object-fit: contain;
}

.brand-logo-aina {
    max-width: 110px;
}

.brand-logo-generalitat {
    max-width: 180px;
}

.hero-badge,
.section-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-soft);
    margin-bottom: 0.9rem;
}

.header h1 {
    font-size: clamp(2.4rem, 5vw, 4rem);
    line-height: 0.95;
    letter-spacing: -0.05em;
    margin: 0 0 0.7rem;
}

.header p {
    max-width: 720px;
    margin: 0 auto;
    color: var(--text-muted);
    font-size: 1.08rem;
    line-height: 1.7;
}

.views {
    display: flex;
    flex: 1;
    min-height: 0;
}

.view-section {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 1.25rem;
    min-height: 0;
}

.view-section.active {
    display: flex;
}

.card-surface,
.controls,
.leaderboard {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.controls {
    padding: 1.25rem 1.4rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.search-bar {
    flex: 1 1 320px;
    position: relative;
}

.search-bar::before {
    content: "Search";
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    pointer-events: none;
}

.search-bar input,
.filters select,
.form-field input,
.form-field select {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 16px;
    background: var(--card-strong);
    color: var(--text-main);
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.search-bar input {
    padding: 1rem 1rem 1rem 5.2rem;
    min-height: 58px;
}

.search-bar input:focus,
.filters select:focus,
.form-field input:focus,
.form-field select:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.45);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
    flex: 1 1 460px;
}

.filters-single {
    grid-template-columns: minmax(220px, 320px);
    flex: 0 0 auto;
}

.filter-group,
.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label,
.form-field span {
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.filters select,
.form-field select {
    min-height: 56px;
    padding: 0.95rem 1rem;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position: calc(100% - 22px) calc(50% - 3px), calc(100% - 16px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.leaderboard {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.table-wrapper {
    height: 100%;
    overflow: auto;
}

table {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
    border-collapse: collapse;
}

th,
td {
    padding: 0.9rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(255, 255, 255, 0.85);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.76rem;
    font-weight: 800;
    cursor: pointer;
}

.header-group-row th {
    top: 0;
    z-index: 4;
}

.header-group-row th:first-child {
    width: clamp(4rem, 5vw, 4.8rem);
}

.header-group-row th:nth-child(2) {
    width: clamp(11rem, 18vw, 15rem);
}

.header-group-row th:nth-child(3) {
    width: clamp(12rem, 16vw, 14rem);
}

.header-subgroup-row th {
    top: var(--leaderboard-header-group-offset, 3.55rem);
    z-index: 4;
}

.header-metric-row th {
    top: var(--leaderboard-header-subgroup-offset, 7rem);
    z-index: 4;
}

.dataset-group-header,
.average-group-header,
.subgroup-header {
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.3;
    min-width: 0;
}

.dataset-group-header {
    padding-top: 0.75rem;
    padding-bottom: 0.7rem;
    cursor: default;
}

.average-group-header {
    cursor: default;
    border-right: 2px solid rgba(148, 163, 184, 0.32);
}

.dataset-boundary {
    border-left: 2px solid rgba(148, 163, 184, 0.32);
}

.table-left-boundary {
    border-left: 2px solid rgba(148, 163, 184, 0.32);
}

.rank-column-boundary,
.model-column-boundary,
.average-column-boundary {
    border-right: 2px solid rgba(148, 163, 184, 0.32);
}

.dataset-group-title {
    display: block;
    margin-bottom: 0.55rem;
}

.dataset-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 0;
}

.dataset-link:hover {
    color: inherit;
}

.dataset-toggle-btn {
    border: 1px solid rgba(59, 130, 246, 0.2);
    background: var(--card-strong);
    color: var(--accent-strong);
    font: inherit;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.38rem 0.65rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.dataset-toggle-btn:hover {
    background: var(--accent-soft);
    border-color: rgba(59, 130, 246, 0.35);
}

.dataset-toggle-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.subgroup-header {
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
    font-size: 0.68rem;
}

.metric-header,
.metric-col,
.rank-cell {
    text-align: center;
}

.metric-header {
    white-space: nowrap;
    min-width: 4.25rem;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
}

.subgroup-boundary {
    border-left: 2px solid rgba(148, 163, 184, 0.32);
}

.table-right-boundary {
    border-right: 2px solid rgba(148, 163, 184, 0.32);
}

body.dark-mode th {
    background: rgba(8, 17, 27, 0.9);
}

body.dark-mode .dataset-boundary,
body.dark-mode .table-left-boundary,
body.dark-mode .subgroup-boundary {
    border-left-color: rgba(148, 163, 184, 0.26);
}

body.dark-mode .rank-column-boundary,
body.dark-mode .model-column-boundary,
body.dark-mode .average-column-boundary,
body.dark-mode .table-right-boundary {
    border-right-color: rgba(148, 163, 184, 0.26);
}

td {
    font-size: 0.95rem;
    font-weight: 500;
    vertical-align: top;
}

.metric-col {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.metric-empty {
    color: var(--text-muted);
}

tbody tr:hover td {
    background: rgba(59, 130, 246, 0.045);
}

.model-link {
    display: inline-block;
    max-width: 100%;
    color: var(--accent-strong);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px dashed rgba(59, 130, 246, 0.35);
    overflow-wrap: anywhere;
}

.model-link:hover {
    color: var(--accent);
}

.status-badge {
    display: inline-flex;
    padding: 0.38rem 0.68rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.16);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.status-badge.complete {
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
}

body.dark-mode .status-badge.complete {
    color: #86efac;
}

.metric-col {
    font-variant-numeric: tabular-nums;
}

.metric-best {
    color: #15803d;
    font-weight: 800;
}

body.dark-mode .metric-best {
    color: #86efac;
}

.submission-shell {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.submission-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    padding: 1.4rem;
}

.submission-hero h2,
.about-panel h2 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    letter-spacing: -0.04em;
}

.submission-hero p,
.about-panel p,
.about-block p,
.hero-note span,
.supporting-copy,
.submit-note {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.7;
}

.hero-note {
    min-width: 240px;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 1rem 1.1rem;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(217, 119, 6, 0.1) 100%);
}

.submission-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.85fr);
    gap: 1rem;
}

.submission-form,
.preview-card,
.flow-card,
.about-panel {
    padding: 1.35rem;
}

.about-shell {
    display: grid;
    gap: 1rem;
}

.analysis-shell {
    display: grid;
    gap: 1rem;
}

.analysis-intro,
.analysis-card {
    padding: 1.35rem;
}

.analysis-intro h2 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    letter-spacing: -0.04em;
}

.analysis-intro p,
.analysis-card-heading p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.7;
}

.analysis-card-featured {
    padding: 1.5rem;
}

.analysis-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.analysis-card-heading .section-kicker {
    margin-bottom: 0.45rem;
}

.analysis-card-heading h3 {
    margin: 0 0 0.35rem;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.chart {
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.chart-pareto {
    min-height: 410px;
}

.chart-bar {
    min-height: 330px;
}

.chart svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.chart-axis,
.chart-grid-line {
    stroke: var(--border-color);
    vector-effect: non-scaling-stroke;
}

.chart-grid-line {
    stroke-dasharray: 3 5;
}

.chart-text {
    fill: var(--text-muted);
    font-family: "Inter", sans-serif;
    font-size: 12px;
}

.chart-text-compact,
.chart-value-label-compact {
    font-size: 9px;
}

.chart-axis-label {
    fill: var(--text-main);
    font-weight: 700;
}

.chart-point {
    fill: rgba(148, 163, 184, 0.72);
    stroke: var(--card-strong);
    stroke-width: 2;
}

.chart-point-frontier {
    fill: var(--accent);
}

.chart-frontier-line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.chart-frontier-label {
    fill: var(--text-main);
    font-size: 11px;
    font-weight: 700;
}

.chart-bar-mark {
    fill: var(--accent);
}

.chart-empty {
    display: grid;
    min-height: inherit;
    place-items: center;
    color: var(--text-muted);
    text-align: center;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.8rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.legend-dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.72);
}

.legend-dot-frontier {
    background: var(--accent);
}

.contributor-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.1rem;
}

.contributor-card {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 1.2rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--card-strong);
    color: inherit;
    text-decoration: none;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.contributor-card:hover {
    transform: translateY(-2px);
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: var(--shadow-sm);
}

.contributor-logo {
    max-height: 44px;
    width: fit-content;
    object-fit: contain;
}

.contributor-link {
    color: var(--accent);
    font-weight: 700;
}

.submission-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-heading h3,
.flow-card h3,
.about-block h3 {
    margin: 0.18rem 0 0;
    font-size: 1.15rem;
}

.form-actions {
    display: flex;
    gap: 0.6rem;
}

.secondary-btn,
.ghost-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.secondary-btn {
    border: none;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: white;
    padding: 0.72rem 1rem;
}

.secondary-btn:disabled {
    background: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
    transform: none;
}

.ghost-btn {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-main);
    padding: 0.7rem 1rem;
}

.secondary-btn:hover,
.ghost-btn:hover,
.nav-btn:hover {
    transform: translateY(-1px);
}

.secondary-btn:disabled:hover {
    transform: none;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.95rem;
}

.form-field-wide {
    grid-column: span 2;
}

.form-field input,
.form-field select {
    min-height: 56px;
    padding: 0.95rem 1rem;
}

.compound-field {
    display: flex;
    align-items: stretch;
    gap: 0;
}

.compound-field input,
.compound-field select {
    min-width: 0;
    width: auto;
}

.compound-field input {
    flex: 1 1 auto;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.compound-field select {
    flex: 0 0 7.5rem;
    border-left: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    padding-left: 0.85rem;
    padding-right: 1.6rem;
}

.submit-strip {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.submit-note {
    flex: 1;
}

.submit-note-detail {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
    line-height: 1.6;
}

.field-help {
    color: var(--text-muted);
    font-size: 0.84rem;
    line-height: 1.5;
}

.submit-user-hero {
    grid-template-columns: minmax(0, 1.3fr) minmax(240px, 0.7fr);
}

.submit-auth-card {
    display: grid;
    gap: 0.6rem;
    padding: 1.35rem;
}

.submit-auth-heading {
    margin-bottom: 0;
}

.submit-auth-warning {
    margin: 0.4rem 0 0;
    color: #dc2626;
    font-size: 0.88rem;
    line-height: 1.5;
}

.submit-user-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
    gap: 1rem;
}

.submit-user-form-card {
    padding: 1.6rem;
}

.submit-user-intro {
    margin-bottom: 1rem;
    padding: 1rem 1.1rem;
    border-radius: 18px;
    background: var(--card-strong);
    border: 1px solid var(--border-color);
}

.submit-user-intro p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.7;
}

.submit-user-sidebar {
    gap: 1rem;
}

.submit-user-info-card {
    padding: 1.35rem;
}

.submit-user-summary {
    margin-bottom: 0.8rem;
}

.submit-user-actions {
    align-items: flex-end;
}

.submit-user-actions > div {
    flex: 1;
}

.issue-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-bottom: 0.9rem;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.14);
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 700;
}

.code-preview {
    margin: 0;
    padding: 1rem;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.92);
    color: #e2e8f0;
    min-height: 220px;
    max-height: 360px;
    overflow: auto;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.88rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

.json-preview {
    min-height: 260px;
}

.flow-list {
    margin: 0;
    padding-left: 1.15rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.flow-list li + li {
    margin-top: 0.5rem;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.2rem;
}

.about-block {
    padding: 1rem 1.05rem;
    border-radius: 20px;
    background: var(--card-strong);
    border: 1px solid var(--border-color);
}

.footer {
    padding: 1.2rem 0 1.4rem;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-logo {
    height: 28px;
    width: auto;
}

@media (max-width: 1080px) {
    .submission-layout,
    .submission-hero,
    .submit-user-layout,
    .submit-user-hero,
    .about-grid,
    .contributor-grid,
    .analysis-grid,
    .filters {
        grid-template-columns: 1fr;
    }

    .hero-note {
        min-width: 0;
    }
}

@media (max-width: 760px) {
    .container {
        padding: 1rem 0.8rem 0;
    }

    .nav-bar {
        width: 100%;
        justify-content: space-between;
        border-radius: 22px;
        flex-wrap: wrap;
    }

    .nav-btn {
        flex: 1 1 calc(50% - 0.45rem);
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    .brand-row {
        gap: 1rem;
        flex-wrap: wrap;
    }

    .brand-logo {
        height: 40px;
        max-height: 40px;
        max-width: 140px;
    }

    .brand-logo-aina {
        max-width: 96px;
    }

    .brand-logo-generalitat {
        max-width: 150px;
    }

    .controls,
    .submission-form,
    .preview-card,
    .flow-card,
    .about-panel,
    .analysis-intro,
    .analysis-card {
        padding: 1rem;
    }

    .analysis-card-heading {
        flex-direction: column;
    }

    .chart-legend {
        justify-content: flex-start;
    }

    .chart-pareto {
        min-height: 300px;
        overflow-x: auto;
    }

    .chart-pareto svg {
        min-width: 680px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-field-wide {
        grid-column: span 1;
    }

    .submit-strip,
    .section-heading,
    .submit-user-actions {
        flex-direction: column;
        align-items: stretch;
    }

    th,
    td {
        padding: 0.8rem 0.7rem;
    }
}


@media (max-width: 1024px) {
    th,
    td {
        padding: 0.7rem 0.35rem;
    }

    th {
        font-size: 0.68rem;
    }

    td {
        font-size: 0.88rem;
    }

    .header-group-row th:nth-child(2) {
        width: clamp(8rem, 18vw, 11rem);
    }

    .subgroup-header {
        font-size: 0.62rem;
    }

    .metric-header {
        min-width: 3.8rem;
    }
}
