:root {
    --app-bg: #f4f6f8;
    --border-soft: #d7dee2;
    --text-soft: #57717a;
    --hero-start: #12343b;
    --hero-end: #2a5c65;
    --impact-0: #edf2f3;
    --impact-1: #d5e7ea;
    --impact-2: #9dc7cf;
    --impact-3: #2a7f92;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: radial-gradient(circle at top left, #e8efef 0%, var(--app-bg) 42%, #eef2f5 100%);
    font-family: "Aptos", "Segoe UI", sans-serif;
    color: #18323a;
}

a {
    color: inherit;
}

h1:focus {
    outline: none;
}

.page-shell {
    padding: 1rem 1.5rem 1.5rem;
}

.full-height {
    height: 100%;
}

.hero-panel {
    color: #f7fbfc;
    border-radius: 24px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
        linear-gradient(135deg, var(--hero-start), var(--hero-end));
}

.summary-card,
.section-card,
.criterion-card,
.weight-card,
.ranking-card,
.provider-card {
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(215, 222, 226, 0.8);
}

.summary-card {
    background: rgba(255, 255, 255, 0.16);
    color: #f7fbfc;
    border-color: rgba(255, 255, 255, 0.18);
}

.summary-note {
    display: block;
}

.criterion-card {
    background: linear-gradient(180deg, #ffffff, #f8fbfb);
}

.weight-bar {
    height: 10px;
}

.optimal-preset-panel {
    border: 1px solid rgba(42, 127, 146, 0.22);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(244, 250, 251, 0.9));
    padding: 0.85rem;
}

.preset-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.35rem;
}

.preset-button {
    min-height: 36px;
    border-radius: 8px;
    padding: 0.25rem 0.55rem;
    text-align: center;
    justify-content: center;
}

.preset-button .mud-button-label {
    width: 100%;
    display: flex;
    justify-content: center;
    line-height: 1.15;
    white-space: normal;
}

.simple-model-shell {
    min-height: calc(100vh - 3.5rem);
}

.simple-model-grid {
    display: grid;
    grid-template-columns: minmax(20rem, 0.9fr) minmax(24rem, 1.35fr);
    gap: 1rem;
    align-items: start;
}

.simple-input-panel,
.simple-result-panel {
    border-radius: 14px;
}

.simple-input-panel {
    position: sticky;
    top: 1rem;
}

.simple-presets {
    border: 1px solid rgba(42, 127, 146, 0.18);
    border-radius: 10px;
    background: rgba(244, 250, 251, 0.9);
    padding: 0.75rem;
}

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

.simple-slider-row {
    border: 1px solid rgba(215, 222, 226, 0.72);
    border-radius: 10px;
    background: rgba(248, 251, 251, 0.78);
    padding: 0.65rem 0.75rem 0.3rem;
}

.simple-slider-label,
.simple-result-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.simple-slider-label span,
.simple-result-meta span {
    min-width: 0;
}

.simple-slider-label strong,
.simple-result-meta strong {
    font-weight: 800;
}

.simple-recommendation {
    border-radius: 12px;
    color: #f7fbfc;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
        linear-gradient(135deg, var(--hero-start), var(--hero-end));
    padding: 1rem;
}

.simple-ranking {
    display: grid;
    gap: 0.65rem;
}

.simple-result-row {
    border: 1px solid rgba(215, 222, 226, 0.76);
    border-radius: 10px;
    background: rgba(248, 251, 251, 0.86);
    padding: 0.75rem;
}

.simple-result-row.rank-1 {
    border-color: rgba(42, 127, 146, 0.36);
    background: rgba(237, 247, 244, 0.95);
}

.simple-result-meta {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    margin-bottom: 0.55rem;
}

.simple-result-bar {
    height: 9px;
}

.scale-list {
    margin: 0.75rem 0 0;
    padding-left: 1.25rem;
}

.scale-list li + li {
    margin-top: 0.25rem;
}

.compact-section {
    overflow: hidden;
}

.metric-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: flex-end;
}

.metric-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid rgba(42, 127, 146, 0.2);
    border-radius: 999px;
    background: rgba(244, 250, 251, 0.86);
    color: var(--text-soft);
    font-size: 0.78rem;
    line-height: 1;
    padding: 0.4rem 0.55rem;
}

.metric-pill strong {
    color: #18323a;
    font-weight: 800;
}

.compact-weight-card {
    min-height: 4.2rem;
}

.decision-quality-panel,
.robustness-panel {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.decision-quality-panel > div,
.robustness-card {
    border: 1px solid rgba(215, 222, 226, 0.8);
    border-radius: 12px;
    background: rgba(248, 251, 251, 0.9);
    padding: 0.75rem;
}

.robustness-panel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
}

.decision-comparison-card {
    grid-column: 1 / -1;
    display: grid;
    gap: 0.35rem;
}

.robustness-row {
    display: grid;
    grid-template-columns: minmax(8rem, 1fr) auto;
    gap: 0.35rem 0.65rem;
    align-items: center;
    font-size: 0.86rem;
}

.robustness-help {
    display: block;
    color: var(--text-soft);
}

.robustness-row strong {
    font-size: 0.84rem;
}

.robustness-bar {
    grid-column: 1 / -1;
    height: 0.45rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(215, 222, 226, 0.85);
}

.robustness-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2a7f92, #34a853);
}

.registration-info-list {
    margin: 0.7rem 0 0;
    padding-left: 1.2rem;
}

.registration-info-list li + li {
    margin-top: 0.25rem;
}

.login-form {
    display: grid;
    gap: 0.75rem;
}

.login-label {
    font-size: 0.9rem;
    font-weight: 600;
}

.login-input {
    width: 100%;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    font: inherit;
    background: rgba(255, 255, 255, 0.96);
    color: inherit;
    box-sizing: border-box;
}

.token-create-row {
    align-items: stretch;
    gap: 1rem;
}

.token-role-field {
    min-width: 18rem;
    max-width: 28rem;
    flex: 1 1 20rem;
    display: flex;
}

.token-email-field {
    min-width: 18rem;
    flex: 2 1 24rem;
    display: flex;
}

.token-create-button {
    min-height: 56px;
    align-self: stretch;
    white-space: nowrap;
}

.token-role-field .mud-input-control,
.token-email-field .mud-input-control {
    margin: 0;
    width: 100%;
}

.token-result-row {
    margin-top: 0.25rem;
}

.token-output-field {
    min-width: 20rem;
    flex: 1 1 24rem;
}

.token-output-field .mud-input-control {
    margin: 0;
}

.qr-generator-row {
    align-items: stretch;
    gap: 1rem;
}

.qr-count-field {
    min-width: 12rem;
    max-width: 18rem;
    flex: 1 1 12rem;
    display: flex;
}

.qr-count-field .mud-input-control {
    width: 100%;
    margin: 0;
}

.qr-create-button {
    min-height: 56px;
    align-self: stretch;
    white-space: nowrap;
}

.mail-wizard-panel {
    border: 1px solid rgba(215, 222, 226, 0.8);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.52);
}

.mail-tabs .mud-tabs-panels {
    padding-top: 1rem;
}

.mail-preview {
    border: 1px solid rgba(215, 222, 226, 0.9);
    border-radius: 14px;
    background: rgba(248, 251, 251, 0.92);
    max-height: 32rem;
    overflow: auto;
}

.mail-preview pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font: inherit;
    line-height: 1.5;
}

.app-footer {
    padding: 1rem 1.5rem 1.25rem;
    color: var(--text-soft);
    border-top: 1px solid rgba(215, 222, 226, 0.65);
}

.footer-link {
    min-width: auto;
    padding: 0.25rem 0.5rem;
    text-transform: none;
    font-weight: 600;
}

.cookie-consent {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
    z-index: 1200;
    display: flex;
    justify-content: flex-end;
    pointer-events: none;
}

.cookie-consent-panel {
    width: min(42rem, 100%);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(215, 222, 226, 0.95);
    box-shadow: 0 20px 55px rgba(18, 52, 59, 0.22);
    pointer-events: auto;
}

.cookie-details {
    border-radius: 14px;
    background: rgba(248, 251, 251, 0.92);
    border: 1px solid rgba(215, 222, 226, 0.9);
}

.legal-page {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.legal-card {
    line-height: 1.6;
}

.legal-address {
    font-style: normal;
    line-height: 1.65;
}

.legal-definition-list {
    display: grid;
    grid-template-columns: minmax(10rem, 16rem) 1fr;
    gap: 0.5rem 1rem;
    margin: 0;
}

.legal-definition-list dt {
    font-weight: 700;
    color: var(--text-soft);
}

.legal-definition-list dd {
    margin: 0;
}

.legal-placeholder {
    display: inline;
    color: #8a4f00;
    background: rgba(246, 178, 60, 0.18);
    border-radius: 6px;
    padding: 0.05rem 0.3rem;
}

.legal-list {
    margin-top: 0.5rem;
}

.theme-dark .login-input {
    background: rgba(22, 35, 39, 0.92);
    border-color: #2d4349;
    color: #e6f0f2;
}

.matrix-table-wrap {
    overflow-x: auto;
}

.matrix-table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
}

.matrix-table-compact {
    min-width: 760px;
    font-size: 0.82rem;
}

.matrix-table th,
.matrix-table td {
    padding: 0.8rem;
    border-bottom: 1px solid var(--border-soft);
    text-align: center;
    vertical-align: middle;
}

.matrix-table-compact th,
.matrix-table-compact td {
    padding: 0.38rem 0.42rem;
}

.matrix-table th:first-child,
.matrix-table td:first-child {
    position: sticky;
    left: 0;
    text-align: left;
    background: #fbfcfd;
}

.matrix-row-label,
.alternative-label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.matrix-row-label small,
.alternative-label small {
    color: var(--text-soft);
}

.impact-box {
    width: 2.25rem;
    height: 2.25rem;
    margin: 0 auto;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-weight: 700;
}

.matrix-table-compact .impact-box {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 9px;
    font-size: 0.78rem;
}

.impact-0 {
    background: var(--impact-0);
    color: #4b656b;
}

.impact-1 {
    background: var(--impact-1);
    color: #29515b;
}

.impact-2 {
    background: var(--impact-2);
    color: #143f49;
}

.impact-3 {
    background: var(--impact-3);
    color: #f7fbfc;
}

.impact-skipped {
    border: 1px dashed rgba(87, 113, 122, 0.55);
    background: rgba(237, 242, 243, 0.65);
    color: var(--text-soft);
}

.assessment-cell {
    display: flex;
    align-items: center;
    justify-content: center;
}

.assessment-score {
    min-width: 3.1rem;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.assessment-score-1 {
    background: #f9d7d7;
    color: #8e1f1f;
}

.assessment-score-2 {
    background: #f8e4c8;
    color: #8b4d12;
}

.assessment-score-3 {
    background: #ece8c6;
    color: #6d610f;
}

.assessment-score-4 {
    background: #d7efd7;
    color: #1f6a35;
}

.assessment-score-5 {
    background: #81c995;
    color: #103d1e;
}

.rank-1 {
    border-color: rgba(52, 168, 83, 0.4);
    box-shadow: inset 0 0 0 1px rgba(52, 168, 83, 0.18);
}

.rank-2 {
    border-color: rgba(42, 127, 146, 0.28);
}

.provider-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 249, 250, 0.9));
}

.rank-3 {
    border-color: rgba(120, 136, 145, 0.26);
}

.ranking-list-item {
    width: 100%;
}

.ranking-col-meta {
    min-width: 10rem;
}

.ranking-col-side {
    min-width: 14rem;
}

.result-chart-panel {
    display: grid;
    gap: 1.25rem;
}

.result-chart {
    min-height: 26rem;
    padding: 1rem 0.75rem 0.25rem;
    display: grid;
    grid-template-columns: repeat(6, minmax(8.5rem, 1fr));
    gap: 1rem;
    align-items: end;
    overflow-x: auto;
}

.result-chart-item {
    min-width: 8.5rem;
    display: grid;
    grid-template-rows: auto 18rem auto;
    gap: 0.75rem;
    align-items: end;
}

.result-chart-value {
    justify-self: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-weight: 800;
    color: #12343b;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(215, 222, 226, 0.9);
}

.result-chart-canvas {
    height: 18rem;
    display: flex;
    align-items: end;
    justify-content: center;
    border-bottom: 1px solid var(--border-soft);
    background:
        linear-gradient(to top, rgba(42, 127, 146, 0.12) 1px, transparent 1px);
    background-size: 100% 25%;
}

.result-chart-stack {
    width: min(4.75rem, 68%);
    min-height: 0.6rem;
    display: flex;
    flex-direction: column-reverse;
    overflow: hidden;
    border-radius: 16px 16px 7px 7px;
    box-shadow: 0 18px 35px rgba(18, 52, 59, 0.16);
}

.result-chart-segment {
    min-height: 3px;
    border-top: 1px solid rgba(255, 255, 255, 0.24);
}

.result-chart-label {
    display: grid;
    gap: 0.35rem;
    justify-items: center;
    text-align: center;
}

.result-chart-label strong {
    line-height: 1.2;
}

.result-chart-label small {
    color: var(--text-soft);
}

.result-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 0.9rem;
    align-items: center;
}

.result-chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-soft);
    font-size: 0.88rem;
}

.result-chart-legend-color {
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.theme-dark {
    --app-bg: #0f1a1d;
    --border-soft: #2d4349;
    --text-soft: #9bb2b8;
    --hero-start: #0f2c33;
    --hero-end: #184752;
    color: #e6f0f2;
    background: radial-gradient(circle at top left, #152328 0%, #0f1a1d 48%, #0b1316 100%);
    min-height: 100vh;
}

.theme-light {
    background: radial-gradient(circle at top left, #e8efef 0%, #f4f6f8 42%, #eef2f5 100%);
    min-height: 100vh;
}

.theme-dark .mud-main-content {
    background: radial-gradient(circle at top left, #152328 0%, #0f1a1d 48%, #0b1316 100%);
    color: #e6f0f2;
    min-height: 100vh;
}

.theme-light .mud-main-content {
    background: radial-gradient(circle at top left, #e8efef 0%, #f4f6f8 42%, #eef2f5 100%);
    color: #18323a;
    min-height: 100vh;
}

.theme-dark .section-card,
.theme-dark .criterion-card,
.theme-dark .weight-card,
.theme-dark .ranking-card,
.theme-dark .provider-card,
.theme-dark .mail-wizard-panel {
    background: rgba(22, 35, 39, 0.92);
    border-color: rgba(67, 96, 104, 0.8);
    color: #e6f0f2;
}

.theme-dark .metric-pill,
.theme-dark .decision-quality-panel > div,
.theme-dark .robustness-card {
    background: rgba(15, 26, 29, 0.72);
    border-color: rgba(67, 96, 104, 0.9);
    color: #9bb2b8;
}

.theme-dark .metric-pill strong {
    color: #e6f0f2;
}

.theme-dark .robustness-bar {
    background: rgba(67, 96, 104, 0.85);
}

.theme-dark .mail-preview {
    background: rgba(15, 26, 29, 0.72);
    border-color: rgba(67, 96, 104, 0.9);
    color: #e6f0f2;
}

.theme-dark .app-footer {
    border-top-color: rgba(67, 96, 104, 0.65);
}

.theme-dark .cookie-consent-panel {
    background: rgba(22, 35, 39, 0.98);
    border-color: rgba(67, 96, 104, 0.9);
    color: #e6f0f2;
}

.theme-dark .cookie-details {
    background: rgba(15, 26, 29, 0.72);
    border-color: rgba(67, 96, 104, 0.9);
}

.theme-dark .legal-placeholder {
    color: #ffe0a6;
    background: rgba(246, 178, 60, 0.18);
}

.theme-dark .criterion-card {
    background: linear-gradient(180deg, #17262a, #132126);
}

.theme-dark .optimal-preset-panel {
    border-color: rgba(67, 143, 158, 0.38);
    background: linear-gradient(180deg, rgba(22, 35, 39, 0.92), rgba(18, 31, 35, 0.95));
}

.theme-dark .matrix-table th:first-child,
.theme-dark .matrix-table td:first-child {
    background: #162327;
}

.theme-dark .matrix-table th,
.theme-dark .matrix-table td {
    border-bottom-color: #2d4349;
    color: #e6f0f2;
}

.theme-dark .matrix-row-label small,
.theme-dark .alternative-label small {
    color: #9bb2b8;
}

.theme-dark .impact-0 {
    background: #22353a;
    color: #d7e6ea;
}

.theme-dark .impact-1 {
    background: #2a515b;
    color: #e6f0f2;
}

.theme-dark .impact-2 {
    background: #307387;
    color: #f7fbfc;
}

.theme-dark .impact-3 {
    background: #63b3c4;
    color: #0f1a1d;
}

.theme-dark .impact-skipped {
    border-color: rgba(155, 178, 184, 0.55);
    background: rgba(34, 53, 58, 0.65);
    color: #9bb2b8;
}

.theme-dark .assessment-score-1 {
    background: #6b2525;
    color: #ffe4e4;
}

.theme-dark .assessment-score-2 {
    background: #76501d;
    color: #fff0db;
}

.theme-dark .assessment-score-3 {
    background: #6c6422;
    color: #fff8d6;
}

.theme-dark .assessment-score-4 {
    background: #1f5f35;
    color: #e5ffeb;
}

.theme-dark .assessment-score-5 {
    background: #2f8f4e;
    color: #f2fff6;
}

.theme-dark .result-chart-value {
    color: #e6f0f2;
    background: rgba(15, 26, 29, 0.92);
    border-color: rgba(67, 96, 104, 0.9);
}

.theme-dark .result-chart-canvas {
    background:
        linear-gradient(to top, rgba(99, 179, 196, 0.12) 1px, transparent 1px);
    background-size: 100% 25%;
}

.theme-dark .simple-presets,
.theme-dark .simple-slider-row,
.theme-dark .simple-result-row {
    border-color: rgba(67, 96, 104, 0.78);
    background: rgba(22, 35, 39, 0.92);
}

.theme-dark .simple-result-row.rank-1 {
    border-color: rgba(99, 179, 196, 0.45);
    background: rgba(26, 52, 55, 0.95);
}

@media (max-width: 640px) {
    .simple-model-grid {
        grid-template-columns: 1fr;
    }

    .simple-input-panel {
        position: static;
    }

    .simple-preset-grid {
        grid-template-columns: 1fr;
    }

    .decision-quality-panel,
    .robustness-panel {
        grid-template-columns: 1fr;
    }

    .metric-strip {
        justify-content: flex-start;
    }

    .app-footer {
        padding: 1rem;
    }

    .cookie-consent {
        right: 0.75rem;
        bottom: 0.75rem;
        left: 0.75rem;
    }

    .legal-definition-list {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }
}
