.wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.App {
    text-align: center;
    font-family: monospace;
    border: 1px solid #000;
    max-width: 1200px;
    width: 98%;
    position: relative;
    display: none;
    padding-bottom: 2rem;
}

.App.show {
    display: block;
}

.loading {
    display: block;
}

.loading {
    border: 16px solid #f3f3f3; /* Light grey */
    border-top: 16px solid #000; /* Blue */
    border-radius: 50%;
    width: 60px;
    height: 60px;
    margin: calc(50vh - 30px) auto 0;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.headline {
    font-size: 3rem;
    padding: 0 1rem;
    margin-top: 3.5rem;
    margin-bottom: 0.5rem;
}

button {
    background: none;
    border: 1px solid #000000;
    font-family: monospace;
    padding: 1rem;
    font-size: 1rem;
    margin: 0.5rem;
    cursor: pointer;
}

/* Normalize iOS default form control styling (blue text, rounded corners).
   Checkboxes and radios keep their native rendering — appearance: none erases
   them entirely, and edit-event.html draws its bulk-assign column with them. */
button, input:not([type="checkbox"]):not([type="radio"]), select {
    -webkit-appearance: none; /* iOS Safari */
    appearance: none;
    border-radius: 0; /* rectangular look */
    color: inherit; /* avoid iOS default button blue */
}

@media (hover: hover) {
    button:hover {
        background: #000;
        color: #fff;
    }
}

a {
    color: inherit;
}

u {
    color: inherit;
}

input, select {
    background: none;
    border: 1px solid #000000;
    font-family: monospace;
    padding: 1rem;
    font-size: 1rem;
    margin: 0.5rem;
    flex: 1;
    /* border-box, or the 1rem padding lands outside max-width and the field overhangs its
       container. The margins are not covered by that, hence subtracting them here. */
    box-sizing: border-box;
    max-width: calc(100% - 1rem);
}

/* Cross-platform custom dropdown arrow for select */
select {
    /* Hide native indicators broadly */
    -moz-appearance: none; /* Firefox */
    -webkit-appearance: none; /* Safari/Chrome */
    appearance: none;

    /* Add a consistent arrow using current text color */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right -1rem center;
    /* Ensure the arrow sits within the padded content area, not over text */
    background-origin: content-box;
    background-size: 12px 8px;
    padding-right: 2rem; /* space for arrow */
}

/* Keep arrow for underline variant and ensure spacing */
select.underline {
    padding-right: 1.5rem;
}

input.underline, select.underline {
    border: 0;
    border-bottom: 1px solid #000;
    padding: 5px;
    font-size: 1em;
    flex: 1;
}

/* After the generic underline shorthand above, reserve space for the arrow on selects
   so it doesn't overlap the text on iOS/Android/desktop */
select.underline {
    /* Keep the compact underline padding but add extra space on the right for the arrow */
    padding-right: 1.5rem;
}

@media only screen and (max-width: 768px) {
    input.underline, select.underline {
        display: block;
        flex: 1;
        margin-left: auto;
        margin-right: auto;
        text-align: center;
        margin-bottom: 0.7rem;
    }
}

input[disabled] {
    border: none;
    padding: 0;
    margin: 0;
    display: inline;
}

.error {
    color: red;
}

.inputRow {
    display: flex;
    width: 100%;
    align-items: stretch;
}

.inputRow button {
    margin-left: auto;
}

.formGroup label {
    display: block;
}

.friend {
    text-decoration: none;
}

.friend span {
    text-decoration: underline;
}

.friend sup {
    text-decoration: none;
}

@media (hover: hover) {
    .friend:hover {
        color: red;
        text-decoration: line-through;
    }
}

.friend::before, .member::before {
    content: ", ";
    display: inline-block;
    white-space: pre;
    color: #000000;
}

.friend:last-of-type::before, .member:last-of-type::before {
    content: " and ";
    color: #000000;
}

.friend:first-of-type::before, .member:first-of-type::before {
    content: "";
}

#controls {
    display: flex;
    justify-content: space-between;
}

#controls h1 {
    margin-left: 1rem;
}

/* The link wraps a button; without this the decoration propagates onto the label. */
#controls a {
    text-decoration: none;
}

#wrap h2 {
    font-size: 2rem;
}

#wrap h2 select {
    font-weight: bold;
}

#wrap .join-link h2 {
    font-size: 1.5rem;
}

.payments > div {
    display: flex;
    border-top: 1px solid #000;
    padding: 1rem;
    align-items: flex-end;
    justify-content: space-between;
    flex-direction: row;
}

.payments h2 {
    margin-right: 1rem;
}

.payments h3 {
    font-size: 1.2rem;
}

.paymentGraph {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
}

.paymentGraph > div {
    display: flex;
    flex-direction: row;
}

.firstRow {
    padding-bottom: 0.2rem;
}

.secondRow {
    width: 100%;
}

.paymentHeader {
    display: flex;
    flex-direction: column;
}

.paymentHeader h3 {
    text-align: left;
}

.paymentBody {
    display: flex;
    align-items: flex-end;
}

.paymentButtons {
    margin-left: 0.5rem;
    display: flex;
    flex-direction: column;
}

.paymentBody .paymentButtons button {
    margin: 0;
}

.paymentBody .paymentButtons button:nth-child(2) {
    margin-top: 0.2rem;
}

@media only screen and (max-width: 768px) {
    .payments > div {
        flex-direction: row;
        align-items: flex-end;
    }

    #controls {
        flex-wrap: wrap;
        align-items: stretch;
        padding: 0 0.4rem;
    }

    /* A row of its own, or the participant list squeezes the three buttons beside it.
       border-box because div.boldFont adds 15px of side padding to the 100% basis. */
    #users {
        flex: 1 0 100%;
        box-sizing: border-box;
    }

    #controls a {
        display: flex;
        flex: 1;
    }

    /* Everything but the side padding stays at the app's button size — three across is
       narrow enough that the label has to wrap, which is cheaper than shrinking the text. */
    #controls a button {
        width: 100%;
        margin: 0.4rem;
        padding: 1rem 0.6rem;
        white-space: normal;
        overflow-wrap: break-word;
    }
}

.sender, .receiver {
    border: 1px solid #ccc;
    padding: 0.5rem;
    font-size: 0.9rem;
}

.receiver {
    text-align: left;
}

.arrow {
    font-size: 0.9rem;
    padding: 0.5rem;
    border: 1px solid #fff;
}

#amount {
    width: 8rem;
}

#everyone {
    cursor: pointer;
}

#everyone span {
    text-decoration: underline;
}

#everyone sup {
    text-decoration: none;
}

.member {
    text-decoration: underline;
    cursor: pointer;
}

.member.removed {
    color: red;
    text-decoration: line-through;
}

.nowrap {
    white-space: nowrap;

}

@media only screen and (max-width: 768px) {
    .nowrap {
        display: block;
    }

    /* Selects too, or the currency picker drops below the amount it belongs to. */
    .nowrap input.underline, .nowrap select.underline {
        display: inline;
        margin-bottom: 0;
    }

    /* These sit mid-sentence, so display:block orphans the punctuation after them onto a
       line of its own — a full stop alone on a row reads as a stray bullet. */
    input.currencyInput, #payment-datetime {
        display: inline;
        margin-bottom: 0;
    }

    /* Same problem at the other end: a .underline field takes its own line here, which strands
       the word introducing it on the line above. Flex keeps the two together. */
    .leadsField {
        display: flex;
        align-items: baseline;
        justify-content: center;
        gap: 0.4rem;
        padding: 0 0.5rem;
    }

    /* Both are needed. max-width is measured against the whole row rather than what is left
       of it, and a flex item will not shrink below an input's intrinsic width without
       min-width:0 — either one alone squeezes the word beside it to a few pixels. */
    .leadsField input.underline {
        margin-left: 0;
        margin-right: 0;
        min-width: 0;
        max-width: none;
    }
}

.reassure {
    color: white;
    background: red;
    border-color: red;
}

#myEvents {
    text-align: left;
}

.overview a {
    padding: 1rem;
    border: 1px solid #000000;
    display: block;
    margin: 1rem;
    text-decoration: none;
    font-size: 1rem;
}

.overview {
    display: flex;
    flex-direction: row;
    width: 100%;
    margin-top: 10px;
}

.overview > div {
    flex: 1;
}

@media only screen and (max-width: 768px) {
    .overview {
        flex-direction: column;
    }
}

nav a {
    text-decoration: none;
}

.home {
    position: absolute;
    top: 1rem;
    left: 1rem;
}

.logout {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.App hr {
    width: 100%;
    height: 5px;
    background: #000;
    margin: 15px auto 15px;
    border: 0;
}

.overview h2 {
    margin-top: 0;
    font-size: 30px;
}

div.form {
    padding: 0 15px;
    font-size: 2em;
    margin: 0.67em 0;
    font-weight: bold;
}

div.boldFont {
    font-size: 2em;
    font-weight: bold;
    padding: 0 15px;
    margin: 0.67em 0;
}

@media only screen and (max-width: 768px) {
    .form button {
        display: block;
        margin: 15px auto;
    }
}

.loadingError {
    text-align: center;
    font-size: 1.2rem;
    font-family: monospace;
    padding: 0 1rem;
    margin-top: 1.5rem;
}

.editPaymentsTable {
    width: 100%;
    font-size: 1.2rem;
}

.editPaymentsTable tbody tr {
    cursor: pointer;
    transition: 0.1s;
}

.editPaymentsTable tbody tr.active {
    background: #eee;
}

@media (hover: hover) {
    .editPaymentsTable tbody tr:hover {
        background: #ccc;
    }
}

.editPaymentsTable td, .editPaymentsTable th {
    padding: 0.4rem;
}

.editPaymentsTable .left {
    text-align: left;
}

.editPaymentsTable .center {
    text-align: center;
}

.editPaymentsTable .right {
    text-align: right;
}

div.xhrResult {
    max-width: 1000px;
    margin: 0.67rem auto;
    font-size: 2em;
    font-weight: bold;
    text-align: center;
    display: block;
    padding: 0 15px
}

@media only screen and (max-width: 767px) {
    /* The token is something you read out to a friend, not a heading — a line under the
       title, at the size of the other secondary text.
       div.mascot, not .mascot: div.boldFont on the same element would otherwise win. */
    div.mascot {
        font-size: inherit;
        font-weight: normal;
        margin: 0.6em 0 1.2em;
    }
}

.hide {
    display: none;
}

.offlineBanner {
    position: fixed;
    bottom: 0;
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: center;
    background: #000;
    color: #fff;
    left: 0;
    padding: 10px 0;
    font-family: monospace;
    font-size: 1.2rem;
}

.hint {
    font-size: 0.8em;
    opacity: 0.75;
    margin: 0.2em 0 0.6em;
}

/* Reads as a header action ("Logout", "Forget event"), not as fine print. */
.quiet {
    align-self: center;
    font-size: 1rem;
}

/* Only the first item takes the free space, or two auto margins split it and leave the
   link stranded mid-row. */
.inputRow .quiet {
    margin-left: auto;
}

.inputRow .quiet + button {
    margin-left: 1.5rem;
}

/* Once the link hides itself the button has to reclaim the free space, or it snaps left. */
.inputRow .quiet[hidden] + button {
    margin-left: auto;
}

/* flex:1 from .underline would stretch these to fill the sentence. */
/* Sized for the three-letter code it keeps, not for the "EUR - Euro" label you search with —
   that only has to be readable in the dropdown. */
input.currencyInput {
    flex: 0 0 auto;
    width: 5em;
}

/* The field being typed into is the next item in the list, so the "and" belongs before it
   rather than before the last chip. An input cannot carry ::before, hence the wrapper. */
/* :not(:first-of-type) matters — a lone chip is also the last one, and this rule outranks
   the empty separator, so it rendered a leading ", ". */
#alsoAllow .friend:last-of-type:not(:first-of-type)::before {
    content: ", ";
}

/* Kept on one line, or a wrap strands the "and" from the field it introduces. */
.andThen {
    white-space: nowrap;
}

#alsoAllow:not(:empty) + .andThen::before {
    content: " and ";
    white-space: pre;
}


/* The brand and the info link are both global; the page-gated action keeps the right side. */
.brandLinks {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: flex;
    gap: 0.75rem;
}

.brandLinks .home {
    position: static;
}

.info sup {
    text-decoration: none;
}

.update {
    padding: 1rem 15px;
    text-align: left;
}

.update + .update {
    border-top: 1px solid #000;
}

.update h2 {
    font-size: 1.2rem;
    margin: 0;
}

.updateDate {
    font-size: 0.8em;
    opacity: 0.75;
    margin: 0.2em 0 0.8em;
}

dialog.infoDialog {
    border: 1px solid #000;
    background: #fff;
    color: inherit;
    font-family: monospace;
    text-align: center;
    padding: 0 0 1rem;
    width: 92%;
    max-width: 40rem;
}

/* The one place a non-solid colour is used: a scrim has to be see-through to be a scrim. */
dialog.infoDialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

.dialogTitle {
    font-size: 1.5rem;
    margin: 1rem 0;
}

.dialogBody .update h3 {
    font-size: 1rem;
    margin: 0;
}

.dialogBody .update {
    border-top: 1px solid #000;
}

.dialogContact {
    padding: 1rem 15px 0;
    margin: 0;
    border-top: 5px solid #000;
}
