* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    min-height: 100vh;
    color: #e2e8f0;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 1.8rem;
    color: #f8fafc;
    margin-bottom: 0.5rem;
}

header p {
    color: #94a3b8;
    font-size: 0.95rem;
}

.calculator {
    background: #1e293b;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    border: 1px solid #334155;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 0.4rem;
    font-weight: 500;
}

.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #334155;
    border-radius: 8px;
    background: #0f172a;
    color: #f8fafc;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.extras {
    margin-top: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #cbd5e1;
}

.checkbox-label input {
    accent-color: #3b82f6;
    width: 18px;
    height: 18px;
}

button#calcular {
    width: 100%;
    padding: 0.9rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
    margin-top: 0.5rem;
}

button#calcular:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(59,130,246,0.4);
}

button#calcular:active {
    transform: translateY(0);
}

/* Resultados */
.results-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #334155;
}

.results-section h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: #f8fafc;
}

.result-card {
    background: #0f172a;
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    border: 1px solid #334155;
}

.result-card.principal {
    background: linear-gradient(135deg, #1e3a5f, #1e293b);
    border-color: #3b82f6;
    margin-bottom: 1rem;
}

.result-card.principal .label {
    font-size: 0.9rem;
    color: #93c5fd;
}

.result-card.principal .value {
    font-size: 2rem;
    font-weight: 700;
    color: #f8fafc;
}

.result-card .label {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-card .value {
    font-size: 1.2rem;
    font-weight: 600;
    color: #e2e8f0;
}

.result-card .value.small {
    font-size: 1rem;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

/* Chart */
.chart-container {
    margin: 1.5rem 0;
}

.chart-container h3 {
    font-size: 0.95rem;
    color: #94a3b8;
    margin-bottom: 0.75rem;
}

.chart-bar {
    height: 32px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    background: #334155;
}

.chart-segment {
    height: 100%;
    transition: width 0.5s ease;
}

.chart-segment.capital {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.chart-segment.intereses {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.legend-item {
    font-size: 0.85rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.legend-dot.capital { background: #3b82f6; }
.legend-dot.intereses { background: #f59e0b; }

/* Tabla */
.amortizacion-toggle {
    text-align: center;
    margin: 1rem 0;
}

.amortizacion-toggle button {
    background: transparent;
    border: 1px solid #475569;
    color: #94a3b8;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.amortizacion-toggle button:hover {
    border-color: #3b82f6;
    color: #e2e8f0;
}

.tabla-container {
    overflow-x: auto;
    margin-top: 1rem;
}

.amortizacion {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.amortizacion th {
    background: #0f172a;
    color: #94a3b8;
    padding: 0.6rem;
    text-align: right;
    position: sticky;
    top: 0;
}

.amortizacion td {
    padding: 0.5rem 0.6rem;
    text-align: right;
    border-bottom: 1px solid #1e293b;
    color: #cbd5e1;
}

.amortizacion tr:hover td {
    background: #1e293b;
}

footer {
    text-align: center;
    margin-top: 2rem;
    color: #475569;
    font-size: 0.8rem;
}
