:root {
    --bg-color: #f4f7f6;
    --window-bg: #2c3e50;
    --primary-color: #f52222aa; /* Loan focus color (e.g., orange/red) */
    --secondary-color: #007bff; /* Principal color */
    --tertiary-color: #ffffff;  /* Interest color */
    --line-color: #28a745;      /* Balance line color */
    --text-color: #000000;
    --border-color: #ddd;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0px;
}

/* Main Grid Layout */
.main-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    grid-template-rows: auto auto;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Responsive Stacking */
@media (max-width: 900px) {
    .main-container {
        grid-template-columns: 1fr;
    }
    .config-window {
        grid-row: auto; 
    }
}

/* Window styling */
.window {
    background: var(--window-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 0px solid var(--border-color);
}

h2 {
    margin-top: 0;
    border-bottom: 0px solid var(--bg-color);
    padding-bottom: 10px;
    font-size: 1.2rem;
    color: var(--tertiary-color);
}

/* Window 1: Configuration */
.config-window {
    grid-row: span 2; 
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box; 
    background-color: #ffffff;
}

/* Term Length specific layout */
.term-group .term-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}
.term-group .term-inputs input {
    width: 60px;
    text-align: center;
}
.term-group .term-inputs label {
    margin: 0;
    font-weight: normal;
}

#calculateBtn {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

#calculateBtn:hover {
    background-color: #841414;
}

/* Window 2: Key Results */
.key-results {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

/* Mobile stacking for results */
@media (max-width: 600px) {
    .key-results {
        flex-direction: column; 
        gap: 10px;
    }
}

.result-box {
    flex: 1;
    background: var(--bg-color);
    padding: 15px;
    border-radius: 6px;
    text-align: center;
}

.result-box h3 {
    margin: 0 0 5px 0;
    font-size: 0.9rem;
    color: #666;
}

.result-box span {
    font-size: 1.2rem;
    font-weight: bold;
}

.result-box.primary span {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.graph-container {
    min-height: 300px;
    position: relative;
}

/* Window 3: Table */
.table-window {
    overflow: hidden; 
    display: flex;
    flex-direction: column;
}

.table-container {
    overflow-y: auto;
    max-height: 400px;
}

table {
    color: #ffffff;
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    text-align: right;
    padding: 8px 12px;
    border-bottom: 1px solid var(--tertiary-color);
}

th:first-child, td:first-child {
    text-align: left;
}

th {
    background-color: #de4747;
    position: sticky;
    top: 0;
}
.bg-dark-indigo {
    background-color: #2c3e50; /* Deep Slate Blue/Dark Indigo */
}