body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 0;
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    color: #333;
    background-color: #f9fafb;
}

main {
    max-width: 600px;
    margin: 5vh auto;
    background: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    width: 100%;
    box-sizing: border-box;
}

/* Headings */
h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

h2 {
    margin-top: 2rem;
    text-align: center;
    color: #2c3e50;
}

/* Shared row style for all inputs */
.form-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 0.5rem 0;
}

/* Labels aligned */
.form-row label {
    font-weight: 500;
    width: 140px;       /* fixed width for alignment */
    text-align: right;
}

/* Inputs aligned */
.form-row input {
    flex: 0 0 200px;    /* fixed input width */
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    text-align: right;  /* better for numbers/money */
}

/* Buttons */
.button-group {
    margin: 1.5rem 0;
    text-align: center;
}

button {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    background: #3498db;
    color: white;
    transition: background 0.2s ease;
    margin: 0 0.3rem;
}

button:hover {
    background: #2980b9;
}

/* Payments Section */
#payments {
    margin: 1rem 0;
}

/* Results Box */
#results {
    background: #f4f6f8;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem auto 0 auto;
    font-size: 1rem;
    max-width: 400px;
    text-align: center;
    color: #2c3e50;
}

/* Mobile */
@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
    }

    .form-row label {
        width: 100%;      /* full width */
        text-align: left; /* better on small screens */
        margin-bottom: 0.3rem;
    }

    .form-row input {
        flex: 1;
        width: 100%;      /* expand to full width */
        text-align: left;
    }

    #results {
        max-width: 100%;  /* allow shrinking */
        font-size: 0.95rem;
    }

    button {
        width: 100%;      /* stack buttons */
        margin: 0.3rem 0;
    }

    .button-group {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
}