:root {
    /* HSL Colors - Dark Theme */
    --hue: 150;
    /* Green base */
    --bg-app: #121214;
    --bg-card: #202024;
    --text-primary: #ECECEC;
    --text-secondary: #A8A8B3;

    --primary: hsl(var(--hue), 70%, 50%);
    --primary-hover: hsl(var(--hue), 70%, 40%);

    --danger: #E25858;
    --warning: #F5A623;
    --success: #04D361;

    --font-main: 'Outfit', sans-serif;
    --radius: 12px;
    --transition: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 480px;
    /* Mobile first constrain */
    background-color: var(--bg-app);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.app-header {
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Main Content & Screens */
#main-content {
    flex: 1;
    position: relative;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    /* Ajuste para garantir que o conteúdo ocupe altura se necessário */
    height: 100%;
}

.screen {
    flex: 1;
    display: flex;
    /* Default for active screens is usually needed */
    flex-direction: column;
    animation: fadeUp 0.4s ease forwards;
    height: 100%;
    /* Garante que a tela ocupe o espaço para flex column funcionar bem */
}

.screen.hidden {
    display: none;
}

.screen.active {
    display: flex;
}

/* Helper layout classes */
.content-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 2rem;
}

/* Typography */
h1 {
    font-size: 2.5rem;
    line-height: 1.1;
    font-weight: 700;
}

h2 {
    font-size: 1.75rem;
    font-weight: 600;
}

p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.5;
}

/* Inputs */
.input-group {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: var(--radius);
    padding: 1rem;
    width: 100%;
    transition: var(--transition);
}

.input-group:focus-within {
    border-color: var(--primary);
}

.currency {
    color: var(--text-secondary);
    font-size: 1.25rem;
    margin-right: 0.5rem;
}

input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-family: var(--font-main);
    width: 100%;
    outline: none;
    font-weight: 600;
}

/* Buttons */
button {
    cursor: pointer;
    border: none;
    font-family: var(--font-main);
    transition: var(--transition);
    border-radius: var(--radius);
    font-weight: 600;
}

.btn-primary {
    background: var(--primary);
    color: #000;
    padding: 1rem 2rem;
    width: 100%;
    font-size: 1.125rem;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn-secondary.small {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    background: #2A2A2E;
}

.btn-large {
    background: linear-gradient(135deg, var(--primary), #04C351);
    color: #001005;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: 800;
    box-shadow: 0 10px 30px -10px rgba(4, 211, 97, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}

.btn-large:active {
    transform: scale(0.95);
}

.pulse {
    animation: pulse-animation 2s infinite;
}

.btn-danger {
    background: var(--danger);
    color: white;
    padding: 1rem;
    width: 100%;
}

.btn-success {
    background: var(--success);
    color: #000;
    padding: 1rem;
    width: 100%;
}

.btn-text {
    background: none;
    color: var(--text-secondary);
    text-decoration: underline;
    font-size: 0.9rem;
    padding: 0.5rem;
}

/* Status Cards */
.status-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    text-align: center;
    margin-bottom: 2rem;
    border: 1px solid #303036;
}

.status-card .label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.status-card .value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.mini-stats {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: auto;
    padding: 1rem 0;
    border-top: 1px solid #303036;
}

.mini-stats div {
    display: flex;
    flex-direction: column;
}

.mini-stats span:first-child {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.mini-stats span:last-child {
    font-weight: 600;
}

/* Alert Screen Specifics */
.alert-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1.5rem;
}

.icon-warning {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.actions-vertical {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    margin-top: 2rem;
}

.impact-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--danger);
}

.button-row {
    display: flex;
    gap: 1rem;
    width: 100%;
}

.button-row button {
    flex: 1;
}

/* Animations */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse-animation {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(4, 211, 97, 0.4);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 15px rgba(4, 211, 97, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(4, 211, 97, 0);
    }
}

/* Confirmation Screen Styles */
#conf-title {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

#conf-message {
    font-size: 1.25rem;
    color: var(--text-primary);
    max-width: 80%;
}

/* 
   v1.2: Expenses List Styles 
   (Adicionado para correção)
*/
.fixed-expenses-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 80vh;
    /* Limite para garantir que caiba na tela */
}

.fixed-header {
    flex-shrink: 0;
    margin-bottom: 1rem;
    text-align: center;
}

.total-display {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius);
    margin-top: 0.5rem;
    border: 1px solid #303036;
}

.total-display small {
    display: block;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.total-display span {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--danger);
}

.expenses-list {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    /* Estilização scrollbar fina se possível */
    scrollbar-width: thin;
    scrollbar-color: var(--bg-card) transparent;
}

/* Group Headers */
.group-header {
    font-size: 0.9rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 1.5rem 0 0.5rem 0;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #303036;
    font-weight: 700;
}

.group-header:first-child {
    margin-top: 0;
}

.expense-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    padding: 0.75rem;
    border-radius: var(--radius);
    animation: fadeUp 0.3s ease forwards;
    flex-shrink: 0;
    margin-bottom: 0.5rem;
}

/* Enhanced Input Styles */
.expense-item input[type="text"] {
    flex: 2;
    font-size: 1rem;
    padding: 0.5rem;
    background: #2A2A2E;
    border: 1px solid #3A3A40;
    border-radius: 6px;
    color: var(--text-primary);
    transition: var(--transition);
}

.expense-item input[type="text"]:focus {
    border-color: var(--primary);
    background: #323238;
}

.expense-item input[type="number"] {
    flex: 1;
    text-align: right;
    font-size: 1rem;
    min-width: 90px;
    padding: 0.5rem;
    background: #2A2A2E;
    border: 1px solid #3A3A40;
    border-radius: 6px;
    color: var(--text-primary);
    font-weight: 600;
    transition: var(--transition);
}

.expense-item input[type="number"]:focus {
    border-color: var(--primary);
    background: #323238;
}

/* Remove Spinners */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}

.btn-remove {
    background: #2A2A2E;
    border: 1px solid #3A3A40;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 1.25rem;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-remove:hover {
    color: var(--danger);
    border-color: var(--danger);
    background: rgba(226, 88, 88, 0.1);
}

.fixed-footer {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #303036;
}

/* Home Header Settings */
.home-header {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.7;
    transition: var(--transition);
}

.btn-icon:hover {
    opacity: 1;
    transform: rotate(45deg);
}