*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --bg: #050816;
    --bg-elevated: #0e172a;
    --bg-elevated-soft: #020617;
    --border-subtle: rgba(148, 163, 184, 0.25);
    --accent: #38bdf8;
    --accent-soft: rgba(56, 189, 248, 0.12);
    --accent-strong: rgba(56, 189, 248, 0.18);
    --text: #e5e7eb;
    --text-soft: #9ca3af;
    --danger: #f97373;
    --success: #4ade80;
    --radius-lg: 14px;
    --radius-full: 999px;
    --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.75);
    --shadow-subtle: 0 1px 0 rgba(148, 163, 184, 0.20);
    --shadow-card: 0 18px 40px rgba(15, 23, 42, 0.85);
    --input-bg: rgba(15, 23, 42, 0.95);
    --input-border: rgba(148, 163, 184, 0.35);
    --chip-bg: rgba(15, 23, 42, 0.9);
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #1e293b 0, #020617 45%, #000 100%);
    color: var(--text);
}

/* Login */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: radial-gradient(circle at top left, rgba(56,189,248,0.17) 0, transparent 55%),
                linear-gradient(to bottom right, rgba(15,23,42,0.96), rgba(15,23,42,0.98));
    border-radius: 26px;
    box-shadow: var(--shadow-card);
    padding: 24px 24px 22px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    backdrop-filter: blur(22px);
}

.login-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.brand {
    display: flex;
    gap: 10px;
    align-items: center;
}

.brand-logo {
    width: auto;
    padding: 10px;
    height: 38px;
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e5e7eb;
    font-weight: 700;
    font-size: 20px;
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.45);
}

.login-title {
    font-weight: 640;
    font-size: 20px;
    letter-spacing: 0.01em;
}

.login-subtitle {
    margin-top: 2px;
    font-size: 13px;
    color: var(--text-soft);
}

/* Layout */

.layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px 10px;
    background: radial-gradient(circle at top left, rgba(56,189,248,0.09) 0, transparent 60%), rgba(15, 23, 42, 0.96);
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
    backdrop-filter: blur(18px);
}

.brand-text-title {
    font-weight: 640;
    font-size: 18px;
}

.brand-text-sub {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-soft);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-shell {
    margin: 16px auto 32px;
    width: 100%;
    /* max-width: 1120px; */
    padding: 0 16px;
}

/* Nav */

.nav {
    display: inline-flex;
    padding: 4px;
    background: rgba(15, 23, 42, 0.9);
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: var(--shadow-subtle);
    margin-bottom: 18px;
    gap: 3px;
}

.nav a {
    position: relative;
    /* font-size: 13px; */
    padding: 6px 14px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--text-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.16s ease-out;
}

.nav a:hover {
    color: var(--text);
}

.nav a.active {
    background: radial-gradient(circle at top, rgba(56,189,248,0.20) 0, rgba(56,189,248,0.05) 42%, rgba(15,23,42,0.95) 100%);
    color: #e5e7eb;
    box-shadow: 0 0 0 1px rgba(56,189,248,0.45);
}

/* Cards */

.card {
    background: radial-gradient(circle at top left, rgba(56,189,248,0.14) 0, transparent 50%),
                linear-gradient(to bottom right, rgba(15,23,42,0.98), rgba(15,23,42,0.99));
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    padding: 16px 18px 14px;
    margin-bottom: 4px;
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.card-title {
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title-pill {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(15,23,42,0.9);
    border: 1px solid rgba(148,163,184,0.45);
    color: var(--text-soft);
}

.card-subtitle {
    font-size: 12px;
    color: var(--text-soft);
}

.grid {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.3fr);
    gap: 14px;
}

@media (max-width: 880px) {
    .grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Tables */

.table-wrapper {
    border-radius: 12px;
    border: 1px solid rgba(15,23,42,0.85);
    background: radial-gradient(circle at top left, rgba(15, 23, 42, 1) 0, rgba(0,0,0,0.98) 50%);
    overflow: auto;
    max-height: 420px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    /* font-size: 13px; */
}

th,
td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(31, 41, 55, 0.9);
}

th {
    position: sticky;
    top: 0;
    background: #020617;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-soft);
    z-index: 1;
}

tbody tr:nth-child(even) {
    background: rgba(15,23,42,0.75);
}

tbody tr:nth-child(odd) {
    background: rgba(15,23,42,0.85);
}

tbody tr:hover {
    background: rgba(30,64,175,0.6);
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

/* Form */

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-soft);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    border-radius: 999px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text);
    font-size: 13px;
    padding: 7px 12px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

textarea {
    border-radius: 14px;
    min-height: 80px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(56,189,248,0.8);
    box-shadow: 0 0 0 1px rgba(56,189,248,0.45);
}

select[multiple] {
    min-height: 80px;
    border-radius: 14px;
    padding: 6px 8px;
}

/* Buttons & chips */

.btn {
    padding: 7px 16px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(to right, #0ea5e9, #3b82f6);
    color: #e5e7eb;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.55);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-secondary {
    padding: 6px 13px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.8);
    background: rgba(15, 23, 42, 0.95);
    color: var(--text-soft);
    font-size: 12px;
    cursor: pointer;
}

.btn-ghost {
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: transparent;
    color: var(--text-soft);
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--chip-bg);
    border: 1px solid rgba(148, 163, 184, 0.45);
    font-size: 11px;
    color: var(--text-soft);
}

/* Alerts */

.alert {
    border-radius: 14px;
    padding: 8px 12px;
    margin-bottom: 12px;
    font-size: 12px;
}

.alert-error {
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #fecaca;
}

.alert-success {
    background: rgba(45, 212, 191, 0.09);
    border: 1px solid rgba(45, 212, 191, 0.5);
    color: #a7f3d0;
}

/* Badges & pills */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.95);
    font-size: 11px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.9);
    font-size: 11px;
    color: var(--text-soft);
}

.dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

/* User chip */

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    background: rgba(15, 23, 42, 0.9);
    font-size: 12px;
}

.avatar {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: linear-gradient(to bottom right, #38bdf8, #1d4ed8);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
}

/* Metrics */

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-top: 6px;
}

.metric {
    padding: 9px 11px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(30, 64, 175, 0.9);
}

.metric-label {
    font-size: 11px;
    color: var(--text-soft);
    margin-bottom: 4px;
}

.metric-value {
    font-size: 15px;
    font-weight: 600;
}

/* Modal */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal-backdrop.active {
    display: flex;
}

.modal {
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    overflow: auto;
    border-radius: 20px;
    background: linear-gradient(to bottom right, rgba(15,23,42,0.98), rgba(15,23,42,1));
    border: 1px solid rgba(148, 163, 184, 0.45);
    box-shadow: 0 22px 60px rgba(0,0,0,0.9);
    padding: 14px 16px 12px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.modal-title {
    font-weight: 600;
    font-size: 15px;
}

.modal-body {
    padding-top: 4px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

/* Misc */

.input-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }

/* Scrollbar */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.9);
}

::-webkit-scrollbar-thumb {
    background: rgba(51, 65, 85, 0.9);
    border-radius: 999px;
}

/* Mobile-first tweaks for Tela de Gastos */
@media (max-width: 640px) {
    .gastos-shell .card {
        padding: 14px 14px 12px;
        border-radius: 18px;
    }
    .gastos-shell .input-row {
        grid-template-columns: minmax(0, 1fr);
    }
    .gastos-shell .btn {
        width: 100%;
        justify-content: center;
    }
    .gastos-shell .topbar,
    .gastos-shell .card-shell {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* Stronger mobile-first styles for Tela de Gastos */
@media (max-width: 640px) {
    .gastos-layout {
        font-size: 15px;
    }
    .gastos-layout .topbar {
        padding: 10px 14px;
    }
    .gastos-shell {
        margin-top: 12px;
        padding-left: 10px;
        padding-right: 10px;
        max-width: 520px;
    }
    .gastos-shell .card {
        padding: 14px 14px 16px;
        border-radius: 18px;
    }
    .gastos-shell .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .gastos-shell .input-row {
        grid-template-columns: minmax(0, 1fr);
    }
    .gastos-shell input[type="text"],
    .gastos-shell input[type="password"],
    .gastos-shell input[type="number"],
    .gastos-shell input[type="date"],
    .gastos-shell select,
    .gastos-shell textarea {
        font-size: 15px;
        padding-top: 8px;
        padding-bottom: 8px;
    }
    .gastos-shell .btn {
        width: 100%;
        justify-content: center;
        font-size: 15px;
        padding-top: 9px;
        padding-bottom: 9px;
    }
}


/* Status badges ocupando a largura toda da célula */

.status-cell {
    /* width: 1%; */
}

.badge-status {
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
}

/* Concluído – verde claro (borda/texto) */
.badge-status--concluido {
    border: 1px solid rgba(74, 222, 128, 0.9); /* verde claro */
    color: #bbf7d0;                             /* texto verde bem claro */
    background: rgba(22, 163, 74, 0.12);        /* fundo bem suave pra não matar a leitura */
}

/* Em andamento – amarelo alaranjado */
.badge-status--andamento {
    border: 1px solid rgba(251, 191, 36, 0.9);  /* amarelo alaranjado */
    color: #fed7aa;                              /* texto amarelo/laranja claro */
    background: rgba(245, 158, 11, 0.12);
}

/* Valor a receber – pill progress bar ocupando a célula inteira */

.value-progress-cell {
    /* width: 1%; */
}

.value-progress {
    position: relative;
    width: 100%;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.9);
    font-size: 11px;
}

.value-progress-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    /* start at 0, PHP inline style will override with e.g. 20%, 50%, 75% */
    width: 0;
    background: rgba(22, 101, 52, 0.9); /* dark green, good contrast with white text */
}

.value-progress-text {
    position: relative;
    z-index: 1;
    padding: 4px 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #e5e7eb; /* fonte branca */
}
