 :root {
    --perm-navy: #1e2d3d;
    --perm-navy-2: #2e4257;
    --perm-gold: #b58b3a;
    --perm-navy-soft: rgba(30, 45, 61, 0.1);
    --perm-gold-soft: rgba(181, 139, 58, 0.14);
    --bs-primary: #1e2d3d;
    --bs-primary-rgb: 30, 45, 61;
}

body {
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top left, rgba(30, 45, 61, 0.1), transparent 30%),
        radial-gradient(circle at bottom right, rgba(181, 139, 58, 0.1), transparent 35%),
        #eff3f8;
    color: #222;
    min-height: 100vh;
    padding-bottom: 180px;
}

header {
    background: linear-gradient(180deg, #223448 0%, #1e2d3d 100%);
    color: #fff;
    padding: 0.4rem 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.14);
}

header .app-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

header .app-logo {
    width: auto;
    height: clamp(64px, 7.6vw, 84px);
    max-width: min(78vw, 260px);
    object-fit: contain;
    border-radius: 0;
    filter: none;
    display: none;
}

header .app-logo[src]:not([src=""]) {
    display: block;
}

header .app-logo.has-image {
    display: block;
}

main#app {
    padding-top: 0.6rem;
    padding-bottom: 7.5rem !important;
}

@media (max-width: 991px) {
    main#app {
        padding-bottom: 8.5rem !important;
    }
}

@media (min-width: 992px) {
    main#app {
        max-width: 1440px;
        padding-top: 1rem;
        padding-bottom: 3.5rem !important;
    }

    header .container {
        max-width: 1440px;
    }

    .dashboard-page,
    .projects-page,
    .expenses-page {
        display: grid;
        gap: 1.25rem;
    }

    .dashboard-grid {
        display: grid;
        grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
        gap: 1.25rem;
        align-items: start;
    }

    .dashboard-column {
        display: grid;
        gap: 1.25rem;
    }

    .dashboard-page #listaAreas {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

    .dashboard-card,
    .project-card,
    .expense-card {
        height: 100%;
    }

    .projects-header,
    .expenses-header,
    .tab-page-header,
    .projects-filters {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
    }

    .projects-filters {
        align-items: end;
    }

    .projects-helper {
        max-width: 420px;
        text-align: right;
    }

    .projects-grid,
    .expenses-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
        gap: 1rem;
    }

    .projects-grid .card,
    .expenses-grid .card {
        margin-bottom: 0 !important;
    }

    .project-card .card-body {
        display: flex;
        justify-content: space-between;
        gap: 1rem;
    }

    .expense-card-body {
        align-items: center;
    }

    .area-card {
        margin-bottom: 0 !important;
    }

    .area-card .card-body {
        padding: 1.1rem 1.15rem;
    }

    .area-mini-summary-list {
        display: grid;
        gap: 0.55rem;
    }

    .area-mini-summary {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.75rem;
        padding: 0.55rem 0.7rem;
        border-radius: 0.9rem;
        background: rgba(181, 139, 58, 0.08);
        border: 1px solid rgba(181, 139, 58, 0.22);
    }

    .area-mini-summary-name {
        min-width: 0;
    }

    .dashboard-total-card .area-mini-summary-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-total-card .area-mini-summary {
        min-height: 56px;
    }

    .card-body {
        padding: 1.65rem;
    }

    #bottomBar {
        width: min(920px, calc(100% - 48px));
    }
}

.card {
    border: none;
    border-radius: 1.35rem;
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.07);
    overflow: hidden;
}

.card-body {
    padding: 1.45rem;
}

.tab-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1rem !important;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(30, 45, 61, 0.1);
}

.tab-page-title {
    margin: 0;
    color: var(--perm-navy);
    font-weight: 800;
    letter-spacing: 0.01em;
    font-size: clamp(1.5rem, 1.2rem + 1.1vw, 2rem);
}

.tab-page-subtitle {
    margin: 0;
    color: #5d6b83;
    font-weight: 500;
}

.tab-page-action-btn {
    border-radius: 999px;
    padding: 0.58rem 0.9rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.tab-page-action-btn i {
    font-size: 1rem;
}

.dashboard-hero {
    margin-bottom: 1rem !important;
}

.dashboard-hero-title-row {
    display: inline-flex;
    align-items: baseline;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    gap: 0.5rem !important;
}

.dashboard-project-title {
    font-size: clamp(2.35rem, 1.55rem + 2.6vw, 3.45rem);
    font-weight: 900;
    line-height: 1.07;
    color: var(--perm-navy);
    letter-spacing: 0;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

.dashboard-project-switcher-btn {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-color: rgba(30, 45, 61, 0.18);
    background: rgba(30, 45, 61, 0.04);
    color: var(--perm-navy);
}

.dashboard-project-switcher-btn:hover,
.dashboard-project-switcher-btn:focus {
    background: rgba(181, 139, 58, 0.2);
    border-color: rgba(181, 139, 58, 0.55);
    color: var(--perm-navy);
}

.dashboard-status-badge {
    border-radius: 999px;
    font-size: 0.56rem !important;
    font-weight: 700;
    padding: 0.2rem 0.42rem !important;
    line-height: 1.1;
    border: 1px solid rgba(30, 45, 61, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
    text-transform: none !important;
    letter-spacing: 0;
}

@media (max-width: 575px) {
    .dashboard-hero-title-row {
        gap: 0.45rem !important;
    }

    .dashboard-project-title {
        font-size: 2.1rem;
    }

    .dashboard-status-badge {
        font-size: 0.52rem !important;
        padding: 0.16rem 0.36rem !important;
    }
}

.btn-primary {
    background-color: var(--perm-navy-2);
    border-color: var(--perm-navy-2);
    color: #fff;
    border-radius: 1.05rem;
    box-shadow: 0 4px 10px rgba(11, 31, 58, 0.14);
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.projects-page #btnNovoProjeto {
    border-radius: 999px;
    padding: 0.62rem 1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 10px rgba(30, 45, 61, 0.14);
}

.projects-page #btnNovoProjeto i {
    margin-right: 0.3rem;
}

.btn-primary:hover {
    transform: translateY(-1px);
    background-color: var(--perm-navy);
    border-color: var(--perm-navy);
    box-shadow: 0 6px 12px rgba(11, 31, 58, 0.16);
}

.btn-primary:focus-visible {
    box-shadow: 0 0 0 0.2rem rgba(30, 45, 61, 0.18), 0 4px 10px rgba(11, 31, 58, 0.14);
}

.btn-primary:active {
    box-shadow: 0 2px 8px rgba(11, 31, 58, 0.12) !important;
}

.btn-outline-primary {
    color: var(--perm-navy);
    border-color: rgba(30, 45, 61, 0.25);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: var(--perm-gold);
    border-color: var(--perm-gold);
    color: #1e2d3d;
}

.form-control,
.form-select {
    border-radius: 0.85rem;
    border: 1px solid rgba(30, 45, 61, 0.16);
    box-shadow: inset 0 1px 2px rgba(30, 45, 61, 0.05);
}

.form-label {
    font-weight: 600;
    color: #3c4a6b;
}

#fab {
    position: fixed;
    right: 22px;
    bottom: 100px;
    width: 64px;
    height: 64px;
    font-size: 28px;
    border-radius: 50%;
    box-shadow: 0 10px 20px rgba(30, 45, 61, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1035;
}

@media (max-width: 991px) {
    #fab {
        bottom: calc(116px + env(safe-area-inset-bottom, 0px));
    }
}

#bottomBar {
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    width: min(760px, calc(100% - 32px));
    min-height: 74px;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
    border-radius: 24px;
    border: 1px solid rgba(30, 45, 61, 0.14);
    gap: 0.75rem;
    padding: 0.5rem 10px;
    z-index: 1030;
}

/* Mantem modais do Bootstrap acima da barra inferior fixa */
.modal-backdrop {
    z-index: 1050;
}

.modal {
    z-index: 1060;
}

/* Evita que o menu dos 3 pontos dos projetos fique cortado pelo card */
.project-card,
.project-card .card-body,
.expense-card,
.expense-card .card-body {
    overflow: visible;
}

.project-card .dropdown-menu,
.expense-card .dropdown-menu {
    z-index: 1070;
}

#bottomBar button {
    border: none;
    background: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    min-width: 0;
    color: #6c757d;
    font-size: 13px;
    gap: 0.2rem;
    padding: 0.55rem 0.35rem;
    border-radius: 14px;
    transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

@media (max-width: 520px) {
    #bottomBar {
        width: calc(100% - 18px);
        padding: 0.35rem 8px;
        gap: 0.35rem;
    }

    #bottomBar button {
        flex: 1 1 0;
        min-width: 48px;
        font-size: 12px;
        padding: 0.35rem 0.3rem;
    }

    #bottomBar button span {
        display: none;
    }

    #bottomBar button i {
        font-size: 1.3rem;
    }
}

#bottomBar button:hover,
#bottomBar button.active {
    color: var(--perm-navy);
}

#bottomBar button.active {
    background: rgba(30, 45, 61, 0.1);
    box-shadow: inset 0 0 0 1px rgba(30, 45, 61, 0.2);
    transform: none;
}

#bottomBar button.active i,
#bottomBar button.active span {
    color: var(--perm-navy);
    font-weight: 700;
}

@media (max-width: 767px) {
    .tab-page-subtitle {
        font-size: 0.92rem;
    }

    .tab-page-action-btn {
        padding: 0.52rem 0.8rem;
    }
}

#bottomBar button i {
    font-size: 1.25rem;
}

.badge {
    border-radius: 999px;
    padding: 0.55rem 0.8rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

blockquote,
pre,
code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.bg-violet {
    background-color: #6f42c1 !important;
}

.bg-mustard {
    background-color: #d39e00 !important;
}

.category-dot {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    flex: 0 0 14px;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.05);
}

.category-dot-sm {
    width: 10px;
    height: 10px;
    flex-basis: 10px;
}

.category-color-input {
    width: 3.4rem;
    height: 3rem;
    padding: 0.2rem;
}

.area-category-chart {
    display: grid;
    gap: 0.8rem;
}

.area-chart-bar {
    display: flex;
    overflow: hidden;
    height: 14px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
}

.area-chart-segment {
    min-width: 4px;
}

.area-category-legend {
    display: grid;
    gap: 0.55rem;
}

.area-category-legend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.92rem;
}

.area-category-empty {
    font-size: 0.92rem;
    font-style: italic;
}

.more-layout-grid .card {
    overflow: visible;
}

.dropdown-menu {
    z-index: 1100;
}

.dropdown-menu .dropdown-item:disabled {
    opacity: 0.45;
}

.task-input-shell {
    background: linear-gradient(180deg, rgba(181, 139, 58, 0.08), rgba(255, 255, 255, 0.6));
    border: 1px solid rgba(181, 139, 58, 0.2);
    border-radius: 1.1rem;
    padding: 0.85rem;
}

.task-board {
    display: grid;
    gap: 1rem;
}

.task-group {
    background: rgba(248, 250, 252, 0.95);
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 1rem;
    padding: 0.9rem;
}

.task-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #5c6c8a;
}

.task-items {
    display: grid;
    gap: 0.65rem;
}

.task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: #fff;
    border: 1px solid rgba(30, 45, 61, 0.12);
    border-radius: 0.9rem;
    padding: 0.75rem 0.85rem;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.05);
}

.task-item-done {
    background: linear-gradient(180deg, rgba(25, 135, 84, 0.06), rgba(255, 255, 255, 0.96));
    border-color: rgba(25, 135, 84, 0.12);
}

.task-check-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
}

.task-text {
    word-break: break-word;
}

.task-item-done .task-text {
    color: #7a8699;
    text-decoration: line-through;
}

.task-empty-state,
.task-empty-inline {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-height: 56px;
    justify-content: center;
    text-align: center;
}

.task-empty-state i {
    font-size: 1.25rem;
    color: var(--perm-gold);
}

.projects-grid,
.expenses-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.9rem;
}

#listaDespesas {
    display: grid;
    gap: 0.75rem;
}

#listaDespesas .expense-card {
    margin: 0 !important;
}

@media (max-width: 991px) {
    .dashboard-page {
        padding-bottom: 6.5rem;
    }

    .dashboard-column:last-child .dashboard-card:first-child .card-body {
        padding-bottom: 2rem;
    }
}

@media (min-width: 1200px) {
    .more-layout-grid .card-body {
        padding: 1.6rem;
    }

    .dashboard-grid {
        grid-template-columns: minmax(0, 1.2fr) minmax(380px, 0.8fr);
    }

    .projects-grid,
    .expenses-grid {
        grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    }

    .dashboard-page #listaAreas {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-total-card .area-mini-summary-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
