body {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.42857143;
    color: #333;
    background-color: #fff;
}
h2 {
    font-size: 30px;
}
h1, h2, h3 {
    margin-top: 20px;
    margin-bottom: 10px;
}
h4 {
    font-size: 18px;
}
h4, h5, h6 {
    margin-top: 10px;
    margin-bottom: 10px;
}
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 15px;
    position: relative;
    width: 100%;
    /* Removed fixed height: 20px so multi-line messages aren't clipped */
    min-height: 20px;
    box-sizing: border-box;
}
.alert-warning {
    color: #8a6d3b;
    background-color: #fcf8e3;
    border-color: #faebcc;
}
br {
    width: 100%;
    position: relative;
}
.btn-primary {
    color: #fff;
    background-color: #337ab7;
    border-color: #2e6da4;
    /* Better mobile touch target */
    padding: 10px 16px;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    /*width: 100%;*/
    box-sizing: border-box;
}
.checkbox {
    font-size: 11px;
}

/* Columns default to full width on mobile, side-by-side on larger screens */
.col-sm-4,
.col-sm-6 {
    width: 100%;
    float: none;
    position: relative;
    box-sizing: border-box;
    padding: 0 8px;
}
@media (min-width: 768px) {
    .col-sm-4 {
        width: 33.33333333%;
        float: left;
    }
    .col-sm-6 {
        width: 50%;
        float: left;
    }
}

.container, .container-fluid {
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
    width: 100%;          /* Full width on mobile */
    box-sizing: border-box;
}
@media (min-width: 768px) {
    .container {
        width: 85%;       /* Restore desktop width */
    }
}

.control-label {
    color: #333;
}
.dl-horizontal dd {
    margin-left: 180px;
}
.dl-horizontal dt {
    float: left;
    width: 160px;
    overflow: hidden;
    clear: left;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Stack definition lists on mobile */
@media (max-width: 768px) {
    .dl-horizontal dt,
    .dl-horizontal dd {
        float: none;
        width: auto;
        text-align: left;
        margin-left: 0;
        white-space: normal;
    }
}

dt {
    font-weight: 700;
}
.error {
    color: #8a6d3b;
    font-weight: bold;
}
.form-control {
    display: block;
    width: 100%;
    /* Removed fixed height: 13px — let padding control the size */
    height: auto;
    padding: 10px 12px;   /* Larger padding for easier touch */
    font-size: 16px;      /* Prevents iOS auto-zoom on focus */
    line-height: 1.42857143;
    color: #555;
    background-color: #fff;
    background-image: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
    box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
    -webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
    -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
    transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
}
.half-panel {
    width: 100%;          /* Full width on mobile */
    box-sizing: border-box;
}
@media (min-width: 768px) {
    .half-panel {
        width: 50%;
    }
}
.help-block {
    display: block;
    margin-top: 5px;
    margin-bottom: 10px;
    color: #737373;
}
.hidden {
    opacity: 0.0;
}
hr {
    color: grey;
}
img {
    max-width: 100%;
    height: auto;
}
label {
    display: inline-block;
    max-width: 100%;
    margin-bottom: 5px;
    font-weight: 700;
}
.left-panel {
    left: 0;
    float: left;
}
.right-panel {
    right: 0;
    float: right;
    break-after: always;
}
/* Stack left/right panels on mobile */
@media (max-width: 768px) {
    .left-panel,
    .right-panel {
        float: none;
        width: 100%;
        left: auto;
        right: auto;
    }
}
.panel {
    margin-bottom: 20px;
    background-color: #fff;
    border: 1px solid transparent;
    border-radius: 4px;
    -webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
    box-shadow: 0 1px 1px rgba(0,0,0,.05);
}
.panel-body {
    padding: 15px;
}
.panel-default {
    border-color: #ddd;
}
.panel-default>.panel-heading {
    color: #333;
    background-color: #f5f5f5;
    border-color: #ddd;
}
.panel-heading {
    padding: 10px 15px;
    border-bottom: 1px solid transparent;
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
}
.recaptcha-note {
    margin-top: 1rem;
    font-size: 0.72rem;
    color: #999;
    line-height: 1.5;
}
.small, small {
    font-size: 85%;
}
#spinner-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.75);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 16px;
}
#spinner-overlay.active {
    display: flex;
}
.spinner {
    width: 52px;
    height: 52px;
    border: 6px solid #ddd;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.spinner-label {
    font-size: 15px;
    color: #555;
}
.text-muted {
    color: #777;
}
.text-right {
    text-align: right;
}
.valid {
    left: 10px;
    color: green;
}
.valid:before {
    position: relative;
    left: -5px;
    content: "✔";
}
.invalid {
    left: 10px;
    color: red;
}
.invalid:before {
    position: relative;
    left: -5px;
    content: "✖";
}

/* General mobile cleanup */
@media (max-width: 768px) {
    .container {
        display: flex;
        flex-direction: column;
        padding-left: 12px;
        padding-right: 12px;
    }
    .text-right {
        text-align: left;   /* Right-aligned text looks odd on narrow screens */
    }
    h2 {
        font-size: 22px;    /* Scale down large headings */
    }
}

/* Overlay */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 9999;
}
.modal-overlay.active {
    display: flex;
}

/* Modal box */
.modal-box {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    max-width: 260px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.modal-box p {
    margin: 0 0 1rem;
}

.close-btn {
    padding: 0.4rem 1rem;
    cursor: pointer;
}