/* Estilos globais do portal com foco em layout responsivo, leitura clara e manutencao simples. */

:root {
    --bg: #f3f7f8;
    --panel: rgba(255, 255, 255, 0.88);
    --panel-strong: #ffffff;
    --border: rgba(15, 23, 42, 0.08);
    --text: #0f172a;
    --muted: #516072;
    --teal: #0f766e;
    --teal-soft: #ccfbf1;
    --blue: #1d4ed8;
    --blue-soft: #dbeafe;
    --danger: #b91c1c;
    --danger-soft: #fee2e2;
    --shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --sidebar-width: 320px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: 'Manrope', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 30%),
        radial-gradient(circle at right center, rgba(29, 78, 216, 0.08), transparent 26%),
        linear-gradient(180deg, #f8fbfc 0%, var(--bg) 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select {
    font: inherit;
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
    background:
        linear-gradient(90deg, rgba(10, 19, 30, 0.92) 0, rgba(10, 19, 30, 0.92) var(--sidebar-width), transparent var(--sidebar-width), transparent 100%);
}

.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    min-height: 100vh;
    padding: 32px 24px;
    background: rgba(10, 19, 30, 0.92);
    color: #e5eef6;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(18px);
    overflow-y: auto;
    z-index: 20;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.brand-badge {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--teal), var(--blue));
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.08em;
    box-shadow: 0 16px 30px rgba(15, 118, 110, 0.25);
}

.sidebar h1,
.sidebar h2,
.sidebar h3,
.sidebar p {
    margin: 0;
}

.sidebar__eyebrow,
.eyebrow {
    font-size: 0.76rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #9fb3c8;
}

.sidebar__description {
    color: #c3d3e2;
    line-height: 1.6;
    margin-bottom: 28px;
}

.sidebar__meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}

.sidebar__meta-card {
    padding: 16px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar__meta-card strong {
    display: block;
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.sidebar__meta-card span,
.nav-link small {
    color: #a8bacd;
}

.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar__nav-title {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: #86a0ba;
    margin-bottom: 8px;
}

.nav-link {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.nav-link:hover,
.nav-link.is-active {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}

.nav-link__icon {
    min-width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 0.78rem;
    font-weight: 800;
    color: #fff;
    background: rgba(15, 118, 110, 0.9);
}

.main-content {
    padding: 28px;
    min-width: 0;
    overflow-x: hidden;
}

.topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.menu-toggle {
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 14px;
    background: var(--panel-strong);
    box-shadow: var(--shadow);
    cursor: pointer;
}

.menu-toggle span,
.menu-toggle span::before,
.menu-toggle span::after {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 999px;
    margin: 0 auto;
    position: relative;
}

.menu-toggle span::before,
.menu-toggle span::after {
    content: '';
    position: absolute;
    left: 0;
}

.menu-toggle span::before {
    top: -6px;
}

.menu-toggle span::after {
    top: 6px;
}

.content-panel {
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
    min-width: 0;
    position: relative;
    overflow-x: hidden;
}

body.has-calculator.sidebar-collapsed .app-shell {
    grid-template-columns: 1fr;
    background: transparent;
}

body.has-calculator.sidebar-collapsed .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(calc(-100% - 24px));
    opacity: 0;
    pointer-events: none;
}

.focus-toggle {
    position: fixed;
    top: 22px;
    left: 18px;
    z-index: 12;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
    color: var(--text);
    cursor: pointer;
}

body.has-calculator:not(.sidebar-collapsed) .focus-toggle {
    left: calc(var(--sidebar-width) + 18px);
}

.focus-toggle__icon {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    position: relative;
    display: inline-block;
}

.focus-toggle__icon::before,
.focus-toggle__icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.focus-toggle__icon::before {
    top: -6px;
}

.focus-toggle__icon::after {
    top: 6px;
}

.hero-home,
.panel,
.result-card,
.welcome-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.hero-home {
    padding: 36px;
    display: grid;
    grid-template-columns: 1.3fr 0.9fr;
    gap: 24px;
    margin-bottom: 24px;
}

.hero-home h2,
.page-head h2,
.section-title h3,
.panel__header h3,
.result-card h4,
.welcome-card h3 {
    margin: 0;
}

.hero-home__title {
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.05;
    margin: 12px 0 16px;
}

.hero-home__text,
.page-head__text,
.section-title__text,
.panel__header p,
.result-card p,
.welcome-card p,
.metric span,
.field small,
.alert,
.site-footer p,
.info-list li {
    color: var(--muted);
    line-height: 1.6;
}

.hero-home__cta {
    margin: 20px 0 0;
}

.hero-stats,
.cards-grid,
.calculator-grid,
.results-cards {
    display: grid;
    gap: 20px;
}

.hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 24px;
}

.stat-card {
    padding: 18px;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.68));
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.stat-card strong {
    display: block;
    font-size: 1.5rem;
    margin-top: 8px;
}

.hero-home__aside {
    padding: 24px;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(15, 118, 110, 0.08), rgba(29, 78, 216, 0.08));
    border: 1px solid rgba(15, 118, 110, 0.12);
}

.hero-home__aside ul,
.info-list {
    margin: 16px 0 0;
    padding-left: 18px;
}

.cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.welcome-card {
    padding: 24px;
}

.welcome-card__icon {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--blue-soft);
    color: var(--blue);
    font-weight: 800;
    margin-bottom: 18px;
}

.button {
    border: 0;
    border-radius: 16px;
    padding: 14px 18px;
    background: rgba(15, 23, 42, 0.06);
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button--primary {
    background: linear-gradient(135deg, var(--teal), var(--blue));
    color: #fff;
    box-shadow: 0 18px 34px rgba(15, 118, 110, 0.22);
}

.page-head,
.section-title {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.content-panel--calculator {
    padding-top: 76px;
}

.page-head__note {
    min-width: min(240px, 100%);
    padding: 16px 18px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border);
    color: var(--muted);
}

.page-head__note strong {
    display: block;
    color: var(--text);
    margin-bottom: 6px;
}

.calculator-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
    margin-bottom: 26px;
}

.calculator-grid--single {
    grid-template-columns: 1fr;
}

.panel {
    padding: 26px;
}

.panel--accent {
    background: linear-gradient(180deg, rgba(15, 118, 110, 0.12), rgba(255, 255, 255, 0.86));
}

.panel--soft {
    background: linear-gradient(180deg, rgba(29, 78, 216, 0.08), rgba(255, 255, 255, 0.86));
}

.panel__header {
    margin-bottom: 18px;
}

.form-grid {
    display: grid;
    gap: 16px;
}

.form-grid--inline {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
}

.form-grid--double {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 156px;
    align-items: start;
}

.field {
    display: grid;
    gap: 8px;
    align-content: start;
}

.field span {
    font-weight: 700;
}

.field input,
.field select {
    width: 100%;
    min-height: 52px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
    outline: none;
}

.field input:focus,
.field select:focus {
    border-color: rgba(29, 78, 216, 0.4);
    box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.1);
}

.alert {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
}

.alert--error {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: rgba(185, 28, 28, 0.14);
}

.is-hidden {
    display: none !important;
}

.field small {
    display: block;
    min-height: 22px;
}

.results-section {
    margin-top: 8px;
    min-width: 0;
    overflow-x: hidden;
}

.results-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 24px;
}

.result-card {
    padding: 24px;
}

.result-card.is-top {
    border-color: rgba(15, 118, 110, 0.28);
    background: linear-gradient(180deg, rgba(15, 118, 110, 0.11), rgba(255, 255, 255, 0.9));
}

.result-card__top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.result-card__rank {
    font-size: 0.84rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--teal);
    margin-bottom: 6px;
}

.badge-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.badge,
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.badge {
    background: var(--teal-soft);
    color: var(--teal);
}

.status-pill.is-active {
    background: rgba(15, 118, 110, 0.12);
    color: var(--teal);
}

.status-pill.is-inactive {
    background: rgba(148, 163, 184, 0.16);
    color: #475569;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.metric {
    padding: 16px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.metric--full {
    grid-column: 1 / -1;
}

.metric strong {
    display: block;
    margin-top: 6px;
    font-size: 1.08rem;
}

.table-wrap {
    display: block;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    -webkit-overflow-scrolling: touch;
}

.tabs-nav {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.tab-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.76);
    color: var(--muted);
    font-weight: 700;
    box-shadow: var(--shadow);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.tab-link:hover,
.tab-link.is-active {
    background: linear-gradient(135deg, var(--teal), var(--blue));
    color: #fff;
    transform: translateY(-1px);
}

.data-table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
    table-layout: auto;
}

.table-input input {
    width: 100%;
    min-width: 54px;
    width: 54px;
    padding: 5px 6px;
    font-size: 0.86rem;
    line-height: 1.15;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #fff;
    flex: 0 0 54px;
    appearance: textfield;
    -moz-appearance: textfield;
}

.summary-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.summary-chip {
    padding: 16px 18px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.summary-chip span {
    display: block;
    color: var(--muted);
    font-size: 0.92rem;
}

.summary-chip strong {
    display: block;
    margin-top: 6px;
    font-size: 1.18rem;
}

.is-positive {
    color: var(--teal);
    font-weight: 800;
}

.is-negative {
    color: var(--danger);
    font-weight: 800;
}

.ranking-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ranking-star {
    color: #eab308;
}

.table-input input:focus {
    outline: none;
    border-color: rgba(29, 78, 216, 0.4);
    box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.1);
}

.data-table th,
.data-table td {
    padding: 8px 9px;
    text-align: left;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    vertical-align: middle;
}

.data-table th {
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #516072;
    background: rgba(248, 250, 252, 0.8);
}

.data-table tbody tr:hover {
    background: rgba(15, 118, 110, 0.04);
}

.form-actions {
    display: flex;
    align-items: flex-start;
    padding-top: 30px;
    height: 100%;
}

.form-actions .button {
    min-height: 52px;
    width: 100%;
}

.section-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.icon-button,
.field-save {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: rgba(255, 255, 255, 0.82);
    color: var(--text);
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.icon-button svg,
.field-save svg {
    width: 16px;
    height: 16px;
}

.icon-button:hover,
.field-save:hover,
.field-save.is-visible {
    transform: translateY(-1px);
    background: rgba(15, 118, 110, 0.08);
    color: var(--teal);
}

.field-save {
    opacity: 0;
    pointer-events: none;
}

.field-save.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.table-input-group,
.table-input-inline {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    width: fit-content;
    max-width: 100%;
    flex-wrap: nowrap;
}

.table-input-group {
    min-width: 0;
}

.table-input-group .table-input {
    flex: 0 0 auto;
    min-width: 0;
}

.table-input-inline .table-input {
    flex: 0 0 auto;
    min-width: 0;
}

.table-input {
    display: grid;
    gap: 4px;
    width: fit-content;
    min-width: 0;
}

.table-input span {
    font-size: 0.66rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.table-input-group input,
.table-input-inline input {
    width: 54px;
    max-width: 54px;
}

.table-input input::-webkit-outer-spin-button,
.table-input input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 1100px) {
    .hero-home,
    .cards-grid,
    .calculator-grid,
    .results-cards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 920px) {
    body.has-calculator.sidebar-collapsed .app-shell {
        background: transparent;
    }

    body.has-calculator.sidebar-collapsed .sidebar {
        transform: translateX(-100%);
        opacity: 1;
        pointer-events: auto;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(88vw, 340px);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 0 30px 60px rgba(15, 23, 42, 0.25);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(2, 6, 23, 0.45);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease, visibility 0.2s ease;
        z-index: 10;
    }

    body.sidebar-open .sidebar-backdrop {
        opacity: 1;
        visibility: visible;
    }

    .topbar {
        display: flex;
    }

    .main-content {
        padding: 18px;
    }

    .focus-toggle {
        display: none;
    }
}

@media (max-width: 640px) {
    .hero-home,
    .panel,
    .result-card,
    .welcome-card {
        border-radius: 22px;
    }

    .hero-home,
    .panel,
    .result-card {
        padding: 20px;
    }

    .hero-stats,
    .metric-grid,
    .sidebar__meta {
        grid-template-columns: 1fr;
    }

    .page-head,
    .section-title,
    .result-card__top {
        flex-direction: column;
    }

    .data-table {
        min-width: 560px;
    }

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

    .form-actions {
        align-items: stretch;
    }

    .table-input input {
        min-width: 54px;
        width: 54px;
        padding: 5px 6px;
    }

    .summary-strip {
        grid-template-columns: 1fr;
    }
}
