:root {
    --background: #F5F5F5;
    --panel: #E0E0E0;
    --text: #222222;
    --primary: #4A90E2;
    --secondary: #FF9500;
    --input-bg: #f9f9f9;
    --border: #333;
}

.colorblind {
    --primary: #0066CC;
    --secondary: #CC6600;
}

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

body {
    font-family: system-ui, -apple-system, sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.5;
    padding: 0;
    margin: 0;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    display: flex;
    flex: 1;
    flex-direction: row;
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
}

#input-panel {
    background-color: var(--panel);
    padding: 20px;
    width: 350px;
    overflow-y: auto;
    border-right: 1px solid var(--border);
}

@media (max-width: 768px) {
    #input-panel {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}

#results-panel {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-title {
    font-size: 1.25rem;
    font-weight: bold;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: rgba(74, 144, 226, 0.1);
    border: 2px solid var(--primary);
    border-radius: 6px;
    font-weight: bold;
}

.toggle-label {
    font-size: 0.875rem;
    color: var(--primary);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--primary);
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.input-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

input, select, textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: 4px;
    background-color: var(--input-bg);
    font-size: 1rem;
    color: var(--text);
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.button {
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: 500;
}

.button.primary {
    background-color: var(--primary);
    color: white;
}

.button.secondary {
    background-color: var(--secondary);
    color: white;
}

.button:hover {
    opacity: 0.9;
}

.button:focus {
    outline: 2px solid var(--border);
    outline-offset: 2px;
}

.calculate-button {
    width: 100%;
    margin-top: 20px;
}

.section {
    margin-bottom: 30px;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section-title {
    font-size: 1.125rem;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--panel);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.result-card {
    padding: 15px;
    background-color: var(--panel);
    border-radius: 6px;
}

.result-title {
    font-weight: bold;
    margin-bottom: 10px;
}

.result-value {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary);
}

.step-log {
    margin-top: 20px;
}

.step-item {
    padding: 10px;
    border-left: 3px solid var(--primary);
    margin-bottom: 10px;
    background-color: var(--panel);
}

.step-formula {
    font-family: monospace;
    margin: 5px 0;
}

.step-numeric {
    font-weight: bold;
    margin: 5px 0;
}

.chart-container {
    margin: 20px 0;
    height: 300px;
    position: relative;
}

.export-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.trademark {
    position: fixed;
    bottom: 10px;
    right: 10px;
    font-size: 0.75rem;
    color: var(--text);
    z-index: 100;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: bold;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
}

.progress-bar {
    width: 100%;
    height: 20px;
    background-color: var(--panel);
    border-radius: 10px;
    margin: 10px 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary);
    width: 0%;
    transition: width 0.3s;
}

.csv-mapping-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.csv-mapping-table th,
.csv-mapping-table td {
    border: 1px solid var(--border);
    padding: 8px;
    text-align: left;
}

.csv-mapping-table th {
    background-color: var(--panel);
}

.diagnostic-warning {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}

.diagnostic-error {
    background-color: #f8d7da;
    border: 1px solid #dc3545;
    color: #721c24;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}

.sensitivity-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.sensitivity-table th,
.sensitivity-table td {
    border: 1px solid var(--border);
    padding: 8px;
    text-align: left;
}

.sensitivity-table th {
    background-color: var(--panel);
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.status-message {
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
    border-left: 4px solid;
}

.status-info {
    background-color: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

.status-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.status-warning {
    background-color: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.status-error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}