:root {
    --bg-color: #0f0f0f;
    --surface-color: #1a1a1a;
    --surface-raised: #222222;
    --border-color: #333333;
    --accent-color: #f59e0b;
    --accent-dim: #b45309;
    --text-color: #e5e5e5;
    --text-muted: #888888;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', Courier, monospace;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    line-height: 1.5;
}

h1, h2, h3 {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-top: 0;
    color: var(--text-color);
}

h1 {
    color: var(--accent-color);
    font-size: 1.4em;
}

/* Layout */
.dashboard {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 1024px) {
    .dashboard {
        grid-template-columns: 1fr;
    }
}

/* Panels */
.panel {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Buttons */
button {
    font-family: inherit;
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: var(--surface-raised);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

button:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

button:active {
    transform: scale(0.97);
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    align-items: center;
}

#btn-calculate {
    margin-left: auto;
    background-color: var(--accent-color);
    color: #000000;
    border-color: var(--accent-color);
    padding: 8px 18px;
    font-size: 0.85em;
}

#btn-calculate:hover {
    background-color: #fbbf24;
    color: #000000;
    border-color: #fbbf24;
}

#btn-pdf {
    background-color: transparent;
    border-color: var(--accent-dim);
    color: var(--accent-color);
}

#btn-pdf:hover {
    background-color: var(--accent-dim);
    color: #000;
}

/* Forms */
fieldset {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 14px;
    padding: 12px;
    background-color: var(--surface-raised);
}

legend {
    font-weight: bold;
    font-size: 0.8em;
    letter-spacing: 0.08em;
    color: var(--accent-color);
    padding: 0 6px;
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8em;
    color: var(--text-muted);
    padding: 2px 0;
}

label:hover {
    color: var(--text-color);
}

input[type="number"] {
    width: 55px;
    font-family: inherit;
    font-size: 0.9em;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--text-color);
    padding: 2px 5px;
    margin-left: 5px;
    text-align: right;
    transition: border-color 0.15s;
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
    gap: 4px;
}

.tab-btn {
    background-color: transparent;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    padding: 8px 16px;
    color: var(--text-muted);
}

.tab-btn:hover {
    color: var(--text-color);
    border-color: transparent;
}

.tab-btn.active {
    background-color: var(--surface-color);
    border-color: var(--border-color);
    border-bottom: 1px solid var(--surface-color);
    color: var(--accent-color);
    margin-bottom: -1px;
}

/* Graphs */
.tab-content {
    display: none;
}

.tab-content.active {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.graph-container {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--surface-raised);
    min-height: 400px;
    overflow: hidden;
    width: 100%;
}

#graphs-section {
    width: 100%;
    min-width: 0;
}

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;
}

/* --- PIE CHART LAYOUT --- */
.pie-row {
    display: flex;
    flex-direction: row; /* Forces side-by-side */
    flex-wrap: nowrap;   /* Keeps them on one line */
    gap: 15px;
    width: 100%;
    overflow-x: auto;    /* Adds a scrollbar if the screen gets too tiny */
}

.third-width {
    flex: 1;             /* Each pie takes up 1/3 of the space */
    min-width: 300px;    /* Minimum usable width for a pie chart */
    height: 400px;
    padding: 5px;
}

/* --- GENERAL UTILITIES --- */
.graph-container {
    box-sizing: border-box;
    transition: transform 0.2s ease;
}

/* Hover effect for that Brutalist pop */
.graph-container:hover {
    border-color: #fbbf24;
}

/* Responsive Tweak for Mobile */
@media (max-width: 900px) {
    .pie-row {
        flex-wrap: wrap; /* Stacks them on tablets/phones */
    }
    .third-width {
        flex: 1 1 100%; /* Takes full width on mobile */
    }
}

/* --- SCATTER CHART LAYOUT --- */
.scatter-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 15px;
    width: 100%;
    overflow-x: auto;
}

.half-width {
    flex: 1;
    min-width: 400px;
    height: 400px;
    padding: 5px;
}

@media (max-width: 900px) {
    .scatter-row {
        flex-wrap: wrap;
    }
    .half-width {
        flex: 1 1 100%;
    }
}