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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f8f9fa;
    color: #1f2937;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    background: white;
    min-height: 100vh;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1rem;
    color: #6b7280;
}

/* Controls Section */
.controls-section {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 0.75rem;
    margin-bottom: 2rem;
}

.input-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: end;
}

.input-container {
    display: flex;
    flex-direction: column;
}

.input-container label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.input-container input {
    padding: 0.75rem;
    border: 2px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

.input-container input[readonly] {
    background: #f3f4f6;
    color: #6b7280;
}

/* Half-units toggle */
.half-units-wrapper {
    display: flex;
    align-items: end;
    gap: 0.75rem;
    justify-self: center;
    padding-bottom: 1rem;
}

.half-units-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

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

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
}

input:checked + .slider {
    background-color: #3b82f6;
}

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

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Results Section */
.results-section {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.method-container {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.comparison-table-container {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.comparison-table-container .table-container {
    flex: 1;
}

.method-container h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1rem;
    text-align: center;
}

.method-result {
    text-align: center;
    margin-bottom: 1.5rem;
}

.dose-display {
    font-size: 2rem;
    font-weight: 700;
    color: #3b82f6;
    margin-bottom: 0.5rem;
}

.method-description {
    font-size: 0.875rem;
    color: #6b7280;
}

/* Table Styles */
.table-container {
    max-height: 750px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

th {
    background: #f8f9fa;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
}

td {
    padding: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}

tr:hover {
    background: #f8f9fa;
}

tr.highlight {
    background: #dbeafe;
    font-weight: 600;
}

tr.highlight-discrepancy {
    background: #fef3c7;
}

tr.highlight-current-discrepancy {
    background: #bbf7d0;
    font-weight: 600;
}

.same {
    color: #059669;
    font-weight: 600;
}

.different {
    color: #dc2626;
    font-weight: 600;
}

/* Calculation Breakdown */
.calculation-breakdown {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 0.5rem;
    text-align: left;
    font-family: 'Monaco', 'Menlo', monospace;
}

.calculation-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.25rem;
    margin-top: 0.75rem;
}

.calculation-label:first-child {
    margin-top: 0;
}

.calculation-step {
    font-size: 1rem;
    color: #374151;
    margin-bottom: 0.5rem;
}

.formula {
    color: #374151;
}

.equals {
    font-weight: 700;
    color: #6b7280;
}

.result {
    font-weight: 700;
    color: #3b82f6;
}

/* Comparison Section */
.comparison-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 0.75rem;
    text-align: center;
    margin-bottom: 2rem;
}

.comparison-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1rem;
}

.comparison-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.difference-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.125rem;
}

.difference-label {
    color: #6b7280;
    font-weight: 500;
}

.difference-value {
    font-weight: 700;
    color: #dc2626;
}

.difference-value.same {
    color: #059669;
}

.difference-explanation {
    font-size: 0.875rem;
    color: #6b7280;
    max-width: 400px;
}

/* Back Link */
.back-link {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.back-link a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

.back-link a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .results-section {
        grid-template-columns: 1fr;
    }
    
    .comparison-table-container {
        grid-column: 1 / -1;
    }
    
    .input-row {
        grid-template-columns: 1fr;
    }
    
    .calculation-step {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .difference-display {
        flex-direction: column;
        gap: 0.5rem;
    }
}