body {
    font-family: 'Arial', sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: #fafcff;
    color: #4a5568;
    line-height: 1.6;
}

/* Header Section Styling */
header {
    padding: 2em 0;
    margin-bottom: 2em;
}

header p {
    text-align: center;
    color: #4a5568;
    font-size: 1.05em;
    margin: 1em 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

header ul {
    list-style: none;
    padding: 0;
    text-align: center;
    margin: 1.5em 0 0 0;
}

header ul li {
    display: inline-block;
    margin: 0.5em 1em;
    padding: 0.5em 0;
    color: #4a5568;
    font-size: 0.95em;
}

header ul li::before {
    content: "✓";
    color: #38a169;
    font-weight: bold;
    margin-right: 0.5em;
}

h1 {
    color: #7c3aed;
    text-align: center;
    font-size: 2em;
    margin-bottom: 0.5em;
}

h2 {
    color: #6366f1;
    font-size: 1.5em;
    margin-top: 2em;
}

/* Special styling for the main subtitle header */
header h2 {
    color: #a5b4fc;
    font-size: 1.1em;
    font-weight: 400;
    text-align: center;
    margin: 0.5em 0 1.5em 0;
    letter-spacing: 0.3px;
}

h3 {
    color: #6366f1;
    font-size: 1.2em;
    margin-top: 1em;
}

p {
    margin: 0.5em 0;
}

label {
    display: block;
    margin: 1em 0 0.25em; /* Increased margin-top for more vertical spacing */
    font-weight: bold;
    color: #6366f1;
}

/* Input styling - separated for better control */
input[type="date"],
select {
    padding: 0.75em;
    border: 2px solid #e0e7ff;
    border-radius: 12px;
    width: 100%;
    max-width: 300px;
    font-size: 1em;
    background-color: #f8faff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Height/Weight input styling to match site design */
.height-weight-input {
    padding: 0.75em;
    border: 2px solid #e0e7ff;
    border-radius: 12px;
    width: 80px;
    font-size: 1em;
    background-color: #f8faff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    text-align: center;
}

/* Updated BMI display styling to match site design */
.bmi-display {
    display: inline-block;
    margin-left: 1em;
    padding: 0.75em 1em;
    background-color: #f8faff;
    border: 2px solid #e0e7ff;
    border-radius: 12px;
    color: #6366f1;
    font-weight: 600;
    font-size: 0.9em;
    white-space: nowrap;
    transition: all 0.2s ease;
    width: auto;
    max-width: 120px;
    text-align: center;
    vertical-align: middle;
}

/* Container modifications for better layout */
#imperialInputs .form-group:last-child,
#metricInputs .form-group:last-child {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5em;
}

/* Weight input containers - flex layout for inline BMI display */
#imperialInputs > div:last-child,
#metricInputs > div:last-child {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5em;
}

/* Ensure weight input has appropriate flex properties */
#imperialInputs > div:last-child > input,
#metricInputs > div:last-child > input {
    flex: 0 0 auto;
}

/* Ensure the unit span doesn't break the layout */
#imperialInputs > div:last-child > span,
#metricInputs > div:last-child > span {
    flex: 0 0 auto;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .bmi-display {
        margin-left: 0;
        margin-top: 0.75em;
        width: 100%;
        max-width: 200px;
        padding: 0.75em;
        font-size: 1em;
    }
    
    #imperialInputs > div:last-child,
    #metricInputs > div:last-child {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75em;
    }
    
    /* Stack BMI display below weight input on mobile */
    #imperialInputs > div:last-child,
    #metricInputs > div:last-child {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Enhanced dropdown styling */
select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
}

select:hover,
.height-weight-input:hover {
    border-color: #c7d2fe;
    background-color: #f1f5f9;
}

input[type="date"]:focus,
select:focus,
.height-weight-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
    background-color: #f8faff;
}

/* Style select options */
select option {
    padding: 0.5em;
    background-color: #fff;
    color: #333;
}

select option:hover {
    background-color: #f7fafc;
}

/* Radio button styling - browser default */
input[type="radio"] {
    margin-right: 0.5em;
}

.radio-group {
    margin-bottom: 1.5em; /* Increased for more vertical spacing */
}

.radio-group label {
    display: inline;
    margin-right: 1.5em;
    font-weight: normal;
}

button {
    background-color: #8b5cf6;
    color: white;
    padding: 0.75em 1.5em;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1em;
    margin-top: 1em;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

button:hover {
    background-color: #7c3aed;
}

#results {
    background-color: #f0f4ff;
    padding: 1.5em;
    border-radius: 16px;
    margin-top: 2em;
    border: 1px solid #e0e7ff;
}

/* Standardize all text in results section (excluding metric cards and milestone badges) */
#results > p,
#results > h3 + p,
#results .table-container,
#results #gaToday,
#results #nextMilestone,
#results #countdown,
#results #adjustments,
#results #pretermDetails {
    color: #4a5568;
    font-size: 1em;
    line-height: 1.6;
    font-weight: normal;
}

.disclaimer {
    font-size: 1em;
    color: #4a5568;
    margin-top: 1em;
    line-height: 1.6;
    font-weight: normal;
}

.explanation, .methods, .methods-general {
    background-color: #fcfcff;
    padding: 1.5em;
    border-radius: 16px;
    margin-top: 2em;
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.08);
    border: 1px solid #e0e7ff;
}

.explanation ul, .methods ul, .methods-general ul {
    padding-left: 1.5em;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1em;
}

th, td {
    padding: 0.75em;
    text-align: left;
    border-bottom: 1px solid #e0e7ff;
}

th {
    background-color: #f0f4ff;
    color: #6366f1;
    font-weight: 600;
}

#error {
    color: red;
    display: none;
    margin-top: 1em;
}

.math-equation {
    font-style: italic;
    margin: 1em 0;
    text-align: center;
    white-space: normal;
}

/* MathJax v3 responsive containers */
mjx-container {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

mjx-container[jax="CHTML"] {
    display: block;
}

.math-equation, .methods .math-equation, .methods-general .math-equation {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* General overflow guard */
img, table, canvas, pre, code, mjx-container {
    max-width: 100%;
}

.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.disabled label {
    color: #718096;
}

/* --- New Clean Corporate Toggle Styles --- */
.methods-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 240px; /* Adjust width as needed */
    height: 34px; /* Adjust height as needed */
    background-color: #f5f5f5; /* Light gray background */
    border: 1px solid #e0e0e0; /* Thin light gray border */
    border-radius: 8px; /* Gentle rounding */
    padding: 2px;
    box-sizing: border-box;
    user-select: none;
    cursor: pointer;
    overflow: hidden; /* Ensures the thumb doesn't overflow rounded corners */
}

/* Hide the default radio buttons */
.methods-toggle input[type="radio"] {
    display: none;
}

/* Style the labels for the toggle options */
.methods-toggle label {
    flex: 1;
    text-align: center;
    font-family: sans-serif; /* Standard sans-serif font */
    font-weight: 500; /* Medium weight */
    color: #333; /* Dark gray text */
    cursor: pointer;
    z-index: 2; /* Ensure labels are above the thumb */
    transition: color 0.2s ease;
    margin: 0; /* Override default label margin */
    padding: 6px 0; /* Adjust padding for vertical centering */
    font-size: 0.9em; /* Adjust font size if needed */
}

/* Style the thumb */
.methods-toggle .thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: calc(50% - 2px); /* Half the width minus border/padding */
    height: calc(100% - 4px); /* Full height minus top/bottom padding/border */
    background-color: white; /* Clean white thumb */
    border-radius: 6px; /* Slightly less than container for visual inset */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Subtle drop shadow */
    transition: transform 0.2s ease; /* Smooth movement */
    z-index: 1; /* Behind the labels */
}

/* Move the thumb when Advanced is selected */
.methods-toggle input[value="advanced"]:checked ~ .thumb {
    transform: translateX(100%);
}

/* Optional: Slightly darken background on hover */
.methods-toggle:hover {
    background-color: #eeeeee; /* Slightly darker gray on hover */
}

/* Ensure content panels are styled consistently */
.methods-container {
    margin-top: 0.5em;
}


/* --- End Clean Corporate Toggle Styles --- */

/* Table of Contents Navigation Styling */
.toc {
    text-align: center;
    margin: 1.5em 0 2em 0;
    padding: 1em 0;
}

.toc a {
    color: #7c3aed;
    text-decoration: none;
    font-weight: 600;
    padding: 0.5em 1.2em;
    margin: 0 0.5em;
    border-radius: 12px;
    transition: all 0.3s ease;
    display: inline-block;
    background-color: #f0f4ff;
    border: 1px solid #e0e7ff;
}

.toc a:hover {
    background-color: #e0e7ff;
    color: #6366f1;
    border-color: #c7d2fe;
    text-decoration: none;
}

.toc a:focus {
    outline: 2px solid #8b5cf6;
    outline-offset: 2px;
}

.key-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin: 1.5em 0;
}

@media (max-width: 768px) {
    .key-metrics {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .key-metrics {
        grid-template-columns: 1fr;
    }
}

.metric-card {
    background: #fefeff;
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.08);
    text-align: center;
    border: 1px solid #e0e7ff;
}

.metric-value {
    font-size: 1.4rem;
    font-weight: bold;
    color: #7c3aed;
    margin: 0.4rem 0;
    line-height: 1.2;
}

.metric-label {
    color: #6366f1;
    font-size: 0.9rem;
    font-weight: 600;
}

.metric-sublabel {
    color: #a5b4fc;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.most-probable-window {
    background-color: #e6f7ee;
    border: 1px solid #c6e2d6;
    border-radius: 4px;
    padding: 0.5rem;
    margin: 0.5rem 0;
    color: #4a5568;
    font-size: 1em;
    line-height: 1.6;
    font-weight: normal;
}

/* Chart container wrapper */
.chart-wrap {
    width: 100%;
    margin: 12px auto;
}

/* Chart canvas styling */
canvas#pdfChart {
    display: block;
    width: 100%;
    max-width: 100%;
}

/* Table responsiveness for tablets and smaller screens */
@media (max-width: 768px) {
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 1em 0;
    }
    
    table {
        min-width: 600px; /* ensures scroll if content needs it */
    }
    
    th, td {
        word-break: break-word;
        overflow-wrap: anywhere;
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    body {
        padding: 15px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    h1 {
        font-size: 1.8em;
        line-height: 1.2;
    }
    
    h2 {
        font-size: 1.3em;
        margin-top: 1.5em;
    }
    
    /* Header improvements */
    header {
        padding: 1.5em 0;
    }
    
    header h2 {
        font-size: 1em;
        margin: 0.5em 0 1em 0;
    }
    
    header ul li {
        display: block;
        margin: 0.5em 0;
        padding: 0.75em;
        text-align: center;
    }
    
    /* Table of contents mobile styling */
    .toc {
        padding: 0.75em 0;
        margin: 1em 0;
    }
    
    .toc a {
        display: block;
        margin: 0.5em 0;
        padding: 0.75em 1em;
        background-color: #f0f4ff;
        border: 1px solid #e0e7ff;
        border-radius: 12px;
        text-decoration: none;
    }
    
    /* Form improvements */
    input[type="date"],
    select {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 1em;
        max-width: 100%;
        width: 100%;
        border-radius: 10px;
    }
    
    /* Enhanced mobile dropdown styling */
    select {
        background-size: 1.2rem;
        padding-right: 3rem;
        min-height: 48px; /* Better touch target */
    }
    
    /* Flex layout for .radio-group > div groups */
    .radio-group > div {
        display: flex;
        flex-wrap: wrap;
        align-items: center; /* vertical alignment */
        gap: 0.5em 1em; /* row/column gaps */
    }
    
    .radio-group > div > input[type="radio"] {
        transform: scale(1.15);
        margin: 0 0.4em 0 0; /* small right gap only */
        vertical-align: middle;
    }
    
    .radio-group > div > label {
        padding: 0; /* remove vertical padding that misaligns text */
        margin: 0 1em 0em 0; /* compact spacing; small bottom for wrapping */
        min-height: 0;
        line-height: 1.3;
        font-weight: normal;
        vertical-align: middle;
    }
    
    /* Compact spacing for all .radio-group labels on mobile */
    .radio-group label {
        display: inline-block;
        padding: 0;
        margin: 0 0.75em 0.5em 0;
        min-height: 0;
        line-height: 1.3;
        font-weight: normal;
        cursor: pointer;
        vertical-align: middle;
    }
    
    .radio-group {
        margin-bottom: 1em; /* less space between groups */
        max-width: 100%;
        overflow-wrap: break-word;
    }
    
    .radio-group legend {
        margin-bottom: 0.5em; /* small space under legend */
        white-space: normal;
        word-wrap: break-word;
        max-width: 100%;
    }
    
    /* Grid layout for fieldsets without inner div (explicit IDs) */
    #prior-post-term-group,
    #prior-preterm-group,
    #timeSinceLastBirth-group {
        display: grid;
        grid-template-columns: auto 1fr; /* radio | label */
        align-items: center;
        column-gap: 0.5em;
        row-gap: 0.4em;
        white-space: normal;
        overflow-wrap: break-word;
    }
    
    #prior-post-term-group input[type="radio"],
    #prior-preterm-group input[type="radio"],
    #timeSinceLastBirth-group input[type="radio"] {
        transform: scale(1.15);
        margin: 0;
        align-self: center;
        justify-self: start;
        vertical-align: middle;
    }
    
    #prior-post-term-group label,
    #prior-preterm-group label,
    #timeSinceLastBirth-group label {
        margin: 0;
        padding: 0;
        min-height: 0;
        line-height: 1.3;
        font-weight: normal;
        white-space: normal;
        word-wrap: break-word;
        max-width: 100%;
        width: auto;
        align-self: center;
    }
    
    #prior-post-term-group legend,
    #prior-preterm-group legend,
    #timeSinceLastBirth-group legend {
        grid-column: 1 / -1; /* span both columns */
        margin-bottom: 0.5em;
        white-space: normal;
        word-wrap: break-word;
        max-width: 100%;
    }
    
    /* Button improvements */
    button {
        width: 100%;
        padding: 1em 1.5em;
        font-size: 18px;
        margin-top: 1.5em;
        min-height: 48px; /* Better touch target */
    }
    
    /* Chart container - responsive sizing for mobile */
    .chart-wrap {
        margin: 16px 0;
    }
    
    /* Results section improvements */
    #results {
        padding: 1.5em;
        margin-top: 1.5em;
    }
    
    /* Key metrics already responsive, but improve spacing */
    .key-metrics {
        gap: 1rem;
        margin: 2em 0;
    }
    
    .metric-card {
        padding: 1rem;
    }
    
    .metric-value {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.6em;
    }
    
    /* Chart sizing on very small screens */
    .chart-wrap {
        margin: 20px 0;
    }
    
    /* Stack table of contents vertically on very small screens */
    .toc a {
        margin: 0.25em 0;
        padding: 0.5em;
        font-size: 0.9em;
    }
    
    /* Improve table readability with horizontal scroll */
    table {
        font-size: 0.85em;
        min-width: 100%;
        table-layout: auto;
    }
    
    th, td {
        padding: 0.6em 0.4em;
        vertical-align: top;
        line-height: 1.3;
    }
    
    /* Allow text wrapping in specific table columns that tend to be wide */
    td:nth-child(2), /* Evidence base column */
    td:nth-child(3), /* Effect column */
    td:last-child {  /* Last column in any table */
        white-space: normal;
        word-wrap: break-word;
        max-width: 200px;
    }
    
    /* Keep first column compact */
    th:first-child,
    td:first-child {
        white-space: nowrap;
        min-width: 120px;
    }
    
    /* Add horizontal scroll for tables */
    .table-container {
        overflow-x: auto;
        margin: 1em 0;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    table {
        min-width: 600px; /* ensures scroll if content needs it */
    }
    
    th, td {
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    
    /* Mobile-specific compression for probability tables */
    #near-term-probabilities,
    #percentiles,
    #weekly-probabilities {
        font-size: 0.8em;
        min-width: 320px; /* Reduce minimum width for mobile */
    }
    
    #near-term-probabilities th,
    #near-term-probabilities td,
    #percentiles th,
    #percentiles td,
    #weekly-probabilities th,
    #weekly-probabilities td {
        padding: 0.4em 0.3em;
        line-height: 1.2;
    }
    
    /* Allow the probability column to be more compact */
    #near-term-probabilities td:nth-child(2),
    #percentiles td:nth-child(2),
    #percentiles td:nth-child(3),
    #weekly-probabilities td:nth-child(2) {
        white-space: nowrap;
        font-weight: 600;
        color: #7c3aed;
    }
    
    /* Make the time frame columns more compact for near-term and weekly tables */
    #near-term-probabilities td:nth-child(1),
    #weekly-probabilities td:nth-child(1) {
        font-size: 0.85em;
        padding-right: 0.2em;
    }
    
    /* Special handling for percentiles table - force wrapping on first 3 columns */
    #percentiles td:nth-child(1) {
        font-size: 0.8em;
        max-width: 50px;
        white-space: normal;
        word-wrap: break-word;
        line-height: 1.1;
    }
    
    #percentiles td:nth-child(2) {
        font-size: 0.8em;
        min-width:60px;
        max-width: 90px;
        white-space: normal;
        word-wrap: break-word;
        line-height: 1.1;
    }
    
    #percentiles td:nth-child(3) {
        font-size: 0.8em;
        min-width:80px;
        max-width: 90px;
        white-space: normal;
        word-wrap: break-word;
        line-height: 1.1;
    }
    
    /* Percentiles meaning column - allow more space */
    #percentiles td:nth-child(4) {
        min-width:60px;
        max-width: 90px;
        font-size: 0.8em;
        color: #6b7280;
        white-space: normal;
        word-wrap: break-word;
        line-height: 1.2;
    }
    
    /* Methods toggle adjustments */
    .methods-toggle {
        width: 100%;
        height: 40px;
    }
    
    .methods-toggle label {
        font-size: 0.85em;
        padding: 8px 0;
    }
}

/* Info Tips Styling */
.info-tip {
    display: inline-block;
    margin-left: 0.5em;
    cursor: help;
    color: #8b5cf6;
    font-size: 0.9em;
    position: relative;
}

.info-tip:hover {
    color: #7c3aed;
}

/* Tooltip styling - works on both hover and touch */
.info-tip[title]:hover::after,
.info-tip[title]:focus::after,
.info-tip[title]:active::after,
.info-tip[title].show-tooltip::after {
    content: attr(title);
    position: absolute;
    left: 50%;
    bottom: 125%;
    transform: translateX(-50%);
    background-color: #6366f1;
    color: white;
    padding: 0.75em 1em;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: normal;
    white-space: normal;
    width: 250px;
    max-width: 300px;
    text-align: left;
    line-height: 1.4;
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.2);
}

.info-tip[title]:hover::before,
.info-tip[title]:focus::before,
.info-tip[title]:active::before,
.info-tip[title].show-tooltip::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 115%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #6366f1;
    z-index: 1001;
}

/* Mobile adjustments for tooltips */
@media (max-width: 768px) {
    .info-tip {
        font-size: 1.1em;
        margin-left: 0.75em;
        padding: 0.25em;
    }
    
    .info-tip[title]:hover::after,
    .info-tip[title]:focus::after,
    .info-tip[title]:active::after,
    .info-tip[title].show-tooltip::after {
        width: 160px;
        max-width: 85vw;
        font-size: 0.8em;
        font-weight: normal;
        padding: 0.6em 0.8em;
        left: auto;
        right: 0;
        transform: none;
        line-height: 1.3;
    }
    
    .info-tip[title]:hover::before,
    .info-tip[title]:focus::before,
    .info-tip[title]:active::before,
    .info-tip[title].show-tooltip::before {
        left: auto;
        right: 20px;
        transform: none;
    }
}

@media (max-width: 480px) {
    .info-tip[title]:hover::after,
    .info-tip[title]:focus::after,
    .info-tip[title]:active::after,
    .info-tip[title].show-tooltip::after {
        position: fixed;
        left: 15px;
        right: 15px;
        bottom: 30px;
        top: auto;
        width: auto;
        max-width: none;
        transform: none;
        font-size: 0.75em;
        font-weight: normal;
        padding: 0.5em 0.7em;
        line-height: 1.2;
    }
    
    .info-tip[title]:hover::before,
    .info-tip[title]:focus::before,
    .info-tip[title]:active::before,
    .info-tip[title].show-tooltip::before {
        display: none;
    }
}

/* Extra spacing between sections */
.extra-spacing-top {
    margin-top: 2em;
}

/* Milestone badges styling */
.milestone-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.milestone-badge {
    border: 1px solid #e0e7ff;
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
    background: #fefeff;
    text-align: center;
    flex: 1;
    min-width: 120px;
    max-width: 140px;
    transition: all 0.2s ease;
}

.milestone-badge.reached {
    background: #e6f7ee;
    border-color: #c6e2d6;
    color: #2f855a;
}

.milestone-badge.upcoming {
    background: #f0f4ff;
    border-color: #e0e7ff;
    color: #6366f1;
}

.milestone-badge .metric-label {
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.milestone-badge .metric-value {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0.25rem 0;
}

.milestone-badge .metric-sublabel {
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Footer Styling */
footer {
    background-color: #f8faff;
    border-top: 1px solid #e0e7ff;
    margin-top: 3em;
    padding: 2em 0 1em 0;
    color: #4a5568;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2em;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-section h3 {
    color: #6366f1;
    font-size: 1.1em;
    margin-bottom: 1em;
}

.footer-section p {
    line-height: 1.6;
    margin-bottom: 1em;
}

.contact-form {
    max-width: 100%;
}

.contact-form .form-group {
    margin-bottom: 1em;
}

.contact-form label {
    display: block;
    margin-bottom: 0.5em;
    font-weight: 600;
    color: #6366f1;
    font-size: 0.9em;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 0.75em;
    border: 2px solid #e0e7ff;
    border-radius: 8px;
    font-size: 0.9em;
    background-color: #ffffff;
    transition: border-color 0.2s ease;
    font-family: inherit;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}

.contact-form textarea {
    resize: vertical;
    min-height: 100px;
}

.contact-form button {
    background-color: #6366f1;
    color: white;
    padding: 0.75em 1.5em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: background-color 0.2s ease;
    margin-top: 0.5em;
}

.contact-form button:hover {
    background-color: #5856eb;
}

.footer-bottom {
    text-align: center;
    margin-top: 2em;
    padding-top: 1.5em;
    border-top: 1px solid #e0e7ff;
    color: #718096;
    font-size: 0.9em;
}

/* Mobile footer styles */
@media (max-width: 768px) {
    footer {
        padding: 1.5em 0 1em 0;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5em;
        padding: 0 15px;
    }
    
    .contact-form input,
    .contact-form textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .contact-form button {
        width: 100%;
        padding: 1em;
        font-size: 16px;
    }
}

/* ===== Date input mobile tweaks ===== */
.date-input {
    width: 100%;
    max-width: 300px;     /* desktop/tablet */
    padding: 0.75em 2.5em 0.75em 1em; /* leave space for icon */
    font-size: 1em;
    border: 2px solid #e0e7ff;
    border-radius: 12px;
    
    background-color: #f8faff;

    background-size: 1rem;
    -webkit-appearance: none; /* iOS remove small inner icon */
    appearance: none;
    background-color: #f8faff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer; /* Indicate the entire input is clickable */
  }

  
  @media (max-width: 768px) {
    .date-input {
      width: 100%;
      max-width: 100%;
      padding: 1em;
      font-size: 16px; /* Prevent zoom on iOS */
      border-radius: 10px;
      box-sizing: border-box;
      background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' stroke='%234a5568' fill='none' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
    }
  }
  
  @media (max-width: 480px) {
    .date-input {
      width: 100%;
      max-width: 250px;   /* narrower on phones */
      margin: 0 auto;
      display: block;
      background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' stroke='%234a5568' fill='none' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
    }
  }


/* Pseudo-placeholder for mobile where native placeholder is hidden */
@media (max-width: 768px) {
  /* Make sure the pseudo-element has a positioning context */
  .date-input {
    position: relative;
  }

  /* Show placeholder text when empty */
  .date-input:placeholder-shown::before {
    content: attr(placeholder);
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9aa5b1; /* placeholder gray */
    pointer-events: none;
    font-size: 16px; /* avoid iOS zoom */
    line-height: 1;
    /* Ensure it doesn't overlap the right-side icon/padding */
    right: 2.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Hide pseudo text on focus or when a value is present */
  .date-input:focus::before,
  .date-input:not(:placeholder-shown)::before {
    content: '';
  }
}

/* Highlight active entry mode label */
label span.active{
  color:#7c3aed;
  text-decoration:underline;
}