:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --border: #e2e8f0;
}

/* ========================================================================= */
/* INJECT THESE DARK MODE CSS COLOR VARIABLE THEMES OVERRIDES HERE: */
/* ========================================================================= */
body.dark-theme {
    --bg: #0f172a;          /* Dark Slate Midnight background color */
    --card-bg: #1e293b;     /* Deep card workspace backgrounds */
    --text: #f1f5f9;         /* High contrast soft white text titles */
    --border: #334155;       /* Subdued charcoal border lines boundaries */
}

/* Dark layout refinement overrides for table headers, form inputs, and buttons */
body.dark-theme th { background-color: #334155; color: #f1f5f9; }
body.dark-theme input, body.dark-theme select { background-color: #1e293b; color: #f1f5f9; border-color: #334155; }
body.dark-theme #standardCitationWrapper { background-color: #334155; border-color: #475569; }
body.dark-theme #standardCitationWrapper p { color: #cbd5e1 !important; }
body.dark-theme #engineeringConclusionBox { background-color: #334155; border-color: #475569; }
body.dark-theme #engineeringConclusionBox p { color: #cbd5e1 !important; }
body.dark-theme h1, body.dark-theme h2, body.dark-theme h3 { color: #ffffff !important; }
body.dark-theme tr:hover { background-color: #334155; }
body.dark-theme #fieldDiagnosticInputs { background-color: #1e293b; border-color: #334155; }
body.dark-theme #fieldDiagnosticInputs h4 { color: #22c55e !important; }
/* ========================================================================= */

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 2px dashed var(--border);
    padding-bottom: 15px;
}

h1 { 
    margin: 0 0 5px 0; 
    color: #0f172a; 
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
}

@media (min-width: 768px) {
    .grid { grid-template-columns: 360px 1fr; }
}

.card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
    border: 1px solid var(--border);
}

.form-group { 
    margin-bottom: 18px; 
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
}

input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 15px;
    box-sizing: border-box;
}

input:focus {
    outline: 2px solid var(--primary);
    outline-offset: -1px;
}

button {
    width: 100%;
    padding: 12px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover { 
    background-color: var(--primary-hover); 
}

.results-box {
    margin-top: 20px;
    padding: 15px;
    background-color: #f0fdf4;
    border-left: 4px solid #22c55e;
    border-radius: 4px;
}

.results-box h3 { 
    margin: 0 0 8px 0; 
    color: #166534; 
}

.results-box p { 
    margin: 6px 0; 
    font-size: 14.5px; 
}

.table-container { 
    margin-top: 25px; 
    overflow-x: auto; 
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13.5px;
}

th, td { 
    padding: 10px 12px; 
    border-bottom: 1px solid var(--border); 
}

th { 
    background-color: #f1f5f9; 
    font-weight: 600; 
}

tr:hover { 
    background-color: #f8fafc; 
}

.highlight {
    background-color: #dcfce7 !important;
    font-weight: bold;
    color: #166534;
}

/* Highlights empty required inputs with a soft amber border outline */
input:invalid {
    border-color: #f59e0b;
    background-color: #fffbeb;
}
/* Restructures tables and charts seamlessly for narrow mobile viewports */
@media (max-width: 600px) {
    body {
        padding: 10px; /* Gives more room on tight screens */
    }
    th, td {
        padding: 8px 6px; /* Shrinks cell spacing slightly */
        font-size: 11px;  /* Shrinks text size so it fits perfectly on phone screens */
    }
    h1 {
        font-size: 22px; /* Scales header down safely */
    }
}

/* ========================================================================= */
/* INJECT OR REPLACE THESE HIGH-CONTRAST MOBILE RESPONSIVE DARK OVERRIDES */
/* ========================================================================= */
body.dark-theme .results-box { 
    background-color: #064e3b !important; /* Deep forest green container */
    border-left: 5px solid #22c55e !important; 
}
body.dark-theme .results-box h3 { color: #4ade80 !important; } /* Bright light-green titles */
body.dark-theme .results-box p, body.dark-theme .results-box span { color: #f1f5f9 !important; } /* Crisp white text variables */

body.dark-theme #dataTable tr[style*="background-color"] { 
    background-color: #78350f !important; /* Rich amber-brown instead of bright yellow */
    color: #fef3c7 !important; /* Crisp cream white row text strings */
}

body.dark-theme #engineeringConclusionBox { 
    background-color: #1e293b !important; /* Deep solid charcoal background panel card */
    border-color: #475569 !important; 
}
body.dark-theme #engineeringConclusionBox h3 { color: #ffffff !important; }
body.dark-theme #engineeringConclusionBox p, body.dark-theme #engineeringConclusionBox strong { 
    color: #cbd5e1 !important; /* High contrast soft gray reading text */
}

body.dark-theme #standardCitationWrapper { 
    background-color: #1e293b !important; /* Deep solid charcoal parameter citation box */
    border-color: #475569 !important; 
}
body.dark-theme #standardCitationWrapper p { color: #cbd5e1 !important; }
