:root {
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --surface-variant: #2d2d2d;
    --primary-color: #bb86fc;
    --secondary-color: #03dac6;
    --error-color: #cf6679;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 480px;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 24px;
    padding-top: 10px;
}

header h1 {
    margin: 0;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 2rem;
    letter-spacing: -0.5px;
}

header h2 {
    margin: 4px 0 16px;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
}

.date-container {
    background-color: var(--surface-color);
    padding: 10px 20px;
    border-radius: 8px;
    display: inline-block;
    border: 1px solid #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.date-display {
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: capitalize;
    margin: 0;
}

/* Banners Responsive (900x350) */
.banner-wrapper {
    width: 100%;
    max-width: 900px;
    margin: 20px auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    border: 1px solid #333;
    display: block;
    text-decoration: none;
    background-color: #1e1e1e;
    
    /* Responsive Magic */
    aspect-ratio: 900 / 350;
    height: auto; /* Allow height to scale proportionally */
}

.banner-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Legal Modals */
.legal-footer {
    text-align: center;
    margin-top: 40px;
    padding-bottom: 20px;
}

.legal-btn {
    background: transparent;
    border: 1px solid #444;
    color: #888;
    padding: 8px 16px;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 20px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 10000; /* High z-index */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    overflow-y: auto;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #1e1e1e;
    padding: 24px;
    border: 1px solid #333;
    width: 90%;
    max-width: 600px;
    border-radius: 16px;
    color: #e0e0e0;
    position: relative;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    max-height: 90vh;
    overflow-y: auto;
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 20px;
    width: 30px;
    height: 30px;
    background: #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 20px;
    border: none;
}

.modal-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.modal-menu button {
    background: #2d2d2d;
    border: none;
    padding: 8px 12px;
    color: #aaa;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    flex: 1;
}

.modal-menu button.active {
    background: var(--secondary-color);
    color: #121212;
    font-weight: bold;
}

.legal-section {
    display: none;
}

.legal-section.active {
    display: block;
}

.legal-section h3 {
    color: var(--secondary-color);
    margin-bottom: 15px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.legal-section p, .legal-section ul {
    margin-bottom: 15px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #ccc;
    text-align: left;
}

/* Lock Screen */
.lock-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #121212;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lock-content {
    text-align: center;
    padding: 24px;
    width: 100%;
    max-width: 320px;
}

.lock-content h1 {
    color: var(--primary-color);
    margin-bottom: 8px;
}

.lock-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

#pin-input {
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 4px;
    margin-bottom: 24px;
}

#unlock-btn {
    background-color: var(--secondary-color);
    color: #000;
}

.summary-card {
    background-color: var(--surface-color);
    padding: 28px 20px;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    border: 1px solid #333;
}

.summary-card h2 {
    margin: 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-secondary);
}

.big-number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-top: 8px;
    text-shadow: 0 0 15px rgba(3, 218, 198, 0.15);
}

/* New Styles for Dynamic Lists */
.section-group {
    margin-bottom: 24px;
    background-color: var(--surface-color);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid #2a2a2a;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.section-group h3 {
    margin: 0 0 16px 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap; /* Corrección para pantallas muy pequeñas */
}

/* Fix Input Overflow */
.concept-input {
    flex: 2 1 140px; /* Grow, Shrink, Basis */
    min-width: 0; /* Permite que se encoja correctamente en Flex */
}

.amount-input {
    flex: 1 1 80px;
    min-width: 0;
}

input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #444;
    background-color: var(--surface-variant);
    color: var(--text-primary);
    font-size: 1rem;
    box-sizing: border-box; /* Vital para evitar overflow */
    transition: all 0.2s ease;
}

input::placeholder {
    color: #666;
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #333;
    box-shadow: 0 0 0 2px rgba(187, 134, 252, 0.1);
}

.add-btn {
    flex: 0 0 46px;
    height: 46px; /* Altura fija igual que inputs aprox */
    padding: 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    line-height: 1;
    background-color: var(--surface-variant);
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
    transition: all 0.2s;
    box-shadow: none;
}

.add-btn:active {
    background-color: var(--secondary-color);
    color: #000;
}

.add-btn.expense-btn {
    color: var(--error-color);
    border-color: var(--error-color);
}

.add-btn.expense-btn:active {
    background-color: var(--error-color);
    color: #fff;
}

.item-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.item-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #333;
}

.item-list li:last-child {
    border-bottom: none;
}

.item-concept {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.item-value {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
}

.delete-btn {
    background: none;
    border: none;
    color: #555;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: none;
    width: auto;
    margin-left: 10px;
}

.delete-btn:hover {
    color: var(--error-color);
}

.subtotal {
    text-align: right;
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.actions {
    margin-top: 10px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Remove Arrows/Spinners */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield; /* Standard property for compatibility */
}

button {
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    background-color: var(--primary-color);
    color: #000000;
    transition: transform 0.1s;
    box-shadow: 0 4px 12px rgba(187, 134, 252, 0.3);
}


button.secondary {
    background-color: transparent;
    border: 2px solid #444;
    color: var(--text-secondary);
    box-shadow: none;
}

button.secondary:hover {
    border-color: #666;
    color: var(--text-primary);
}
