/* Only the pieces GoyWebmail's stylesheet does not cover. */

[hidden] { display: none !important; }

.auth_switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    box-sizing: border-box;
    width: min(52ch, calc(100% - 1em));
    margin: 0.85em auto 0;
    padding: 0.28em;
    background: linear-gradient(180deg, #1b1b1b 0%, #101010 100%);
    border: 1px solid #3d3d3d;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0.4em 1.1em rgba(0, 0, 0, 0.22);
}

.auth_switch button,
.random_handle,
.register_submit,
.captcha_open,
.captcha_refresh,
.captcha_confirm,
.issued_copy,
.issued_login {
    appearance: none;
    box-sizing: border-box;
    margin: 0;
    padding: 0.55em 0.95em;
    border: 1px solid #555;
    background: #2a2a2a;
    color: #eee;
    font: inherit;
    line-height: 1.25;
    cursor: pointer;
    border-radius: 0;
}

.auth_switch button:hover,
.random_handle:hover,
.register_submit:hover,
.captcha_open:hover,
.captcha_refresh:hover,
.captcha_confirm:hover,
.issued_copy:hover,
.issued_login:hover {
    background: #3a3a3a;
    border-color: #777;
    color: #fff;
}

.auth_switch button[aria-pressed="true"] {
    background: #3a3a3a;
    border-color: #777;
    color: #fff;
}

.random_handle:disabled,
.register_submit:disabled,
.captcha_confirm:disabled {
    opacity: 0.45;
    cursor: default;
}

.auth_off { display: none !important; }

.login_choice input[name="handle"],
.login_choice input[name="captcha_answer"],
.login_choice select[name="domain"],
.issued_token input {
    box-sizing: border-box;
    width: 100%;
    max-width: 26em;
}

.register_card .reg_label {
    display: block;
    margin: 0.75em 0 0.3em;
    font-weight: 700;
}

.register_card input[name="handle"],
.register_card select {
    box-sizing: border-box;
    width: 100%;
}

.reg_suggest,
.solve_actions {
    display: flex;
    gap: 0.4em;
    margin-top: 0.45em;
}

.reg_suggest select {
    flex: 1 1 0;
    min-width: 0;
}

.random_handle {
    flex: 1.2 1 0;
}

.captcha_open,
.register_submit {
    display: block;
    width: 100%;
    margin-top: 0.85em;
}

.solve_actions .captcha_confirm,
.solve_actions .captcha_refresh {
    flex: 1 1 0;
    width: auto;
    margin-top: 0;
}

.domain_note {
    margin: 0.35em 0 0;
    color: #bdbdbd;
    font-size: 0.85em;
}

.solve_captcha {
    box-sizing: border-box;
    width: min(15rem, 100%);
    margin: 0.9em auto 0;
    padding: 0.65em;
    border: 1px solid #555;
    background: #111;
}

.captcha_confirm {
    border-color: #6a8f4e;
    background: #2f4a28;
    color: #e8f5dc;
}

.captcha_confirm:hover {
    background: #3a5c30;
    border-color: #8ab86a;
    color: #fff;
}

.solve_captcha h4 {
    margin: 0 0 0.35em;
}

.captcha_error,
.captcha_status {
    margin: 0.5em 0 0;
}

.captcha_error { color: #ff8080; }
.captcha_status { font-weight: 800; }

.captcha_thumb,
.captcha_master {
    display: block;
    width: 100%;
    height: auto;
    background: #111;
}

.captcha_stage {
    position: relative;
    margin-top: 0.35em;
}

.captcha_mark {
    position: absolute;
    width: 1.1em;
    height: 1.1em;
    margin: -0.55em 0 0 -0.55em;
    border: 2px solid #111;
    border-radius: 50%;
    background: var(--announce-color-accent, #6ee66e);
    color: #111;
    font-size: 0.75em;
    font-weight: 800;
    line-height: 1.1em;
    text-align: center;
    pointer-events: none;
}

.issued_token {
    display: flex;
    flex-direction: column;
    gap: 0.45em;
}

.issued_token h3,
.issued_jid,
.issued_once,
.issued_status {
    margin: 0;
    text-align: center;
}

.issued_jid {
    font-weight: 800;
}

.issued_once {
    color: #d8d8d8;
    font-size: 0.92em;
}

.issued_plate {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.3em;
    margin: 0.2em 0;
    padding: 0.4em;
    background: #111;
    color: #f3f3f3;
    cursor: text;
    user-select: all;
}

.issued_chunk {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.65em 0.15em;
    background: #2a2a2a;
    border: 1px solid #555;
    font-size: clamp(0.95rem, 4vw, 1.35rem);
    letter-spacing: 0.08em;
}

.issued_copy,
.issued_download,
.issued_login {
    width: 100%;
    min-height: 2.8em;
    font-size: 1.15rem;
}

.issued_copy {
    border-color: #6a8f4e;
    background: #2f4a28;
    color: #e8f5dc;
    font-size: 1.35rem;
    font-weight: 800;
}

.issued_copy:hover {
    background: #3a5c30;
    border-color: #8ab86a;
    color: #fff;
}

.issued_ack {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.6em;
    margin: 0.35em 0;
    font-size: 1.2rem;
    font-weight: 800;
    white-space: nowrap;
}

.issued_ack input {
    width: 1.35em;
    height: 1.35em;
}

.issued_login:disabled {
    opacity: 0.45;
    cursor: default;
}

.auth_error {
    margin: 0.6em 0 0;
    color: #ff8080;
}

.login_choice input[name="jid"] {
    box-sizing: border-box;
    width: 100%;
    max-width: 26em;
}

.nojs_webmail { cursor: default; }
.nojs_webmail_title { text-decoration: none; }

.soon {
    display: inline-block;
    margin-left: 0.45em;
    padding: 0.05em 0.45em;
    border-radius: 1em;
    background: var(--announce-color-accent, #6ee66e);
    color: #111;
    font-size: 0.62em;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: 0.15em;
}

.add-contact,
.join-room {
    display: flex;
    flex-direction: column;
    gap: 0.35em;
    margin: 0.4em 0;
}

.add-contact input,
.join-room input,
.account_card .status-text,
.account_card select {
    box-sizing: border-box;
    width: 100%;
}

.message_panel .typing {
    margin: 0;
    padding: 0.4em 0.8em;
    color: #bbb;
    font-style: italic;
}

/* Logged-in chat. Beats the mailbox panel widths in app.css. */
@media (min-width: 48.01rem) {
    body.chat-app {
        display: grid !important;
        grid-template-columns: 18.5rem minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) auto;
        height: 100vh;
        min-height: 0;
        overflow: hidden;
    }

    body.chat-app > .account_panel {
        grid-column: 1;
        grid-row: 1 / span 2;
        order: 0;
        display: block !important;
        width: auto !important;
        max-width: none !important;
        max-height: none !important;
        height: auto;
        margin: 0 !important;
        padding: 0.85em 0.75em 3.4em !important;
        overflow: auto;
        background: #141414;
        border-right: 1px solid #2c2c2c;
    }

    body.chat-app > .mailbox_panel {
        display: none !important;
    }

    body.chat-app > .message_panel {
        grid-column: 2;
        grid-row: 1 / span 2;
        display: flex !important;
        flex-direction: column;
        width: auto !important;
        max-width: none !important;
        max-height: none !important;
        height: auto;
        min-height: 0;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden;
        background: #1b1b1b;
    }

    body.chat-app > .account_panel.hidden,
    body.chat-app > .message_panel.hidden {
        display: none !important;
    }
}

body.chat-app .you {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.45em;
    margin: 0 0 0.85em;
    padding-bottom: 0.75em;
    border-bottom: 1px solid #2c2c2c;
}

body.chat-app .you-id {
    flex: 1 1 8rem;
    min-width: 0;
    text-align: left;
}

body.chat-app .you .account_card_label {
    display: block;
    font-size: 0.68em;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.55;
}

body.chat-app .you-presence {
    display: block;
    margin-top: 0.2em;
    color: #aaa;
    font-size: 0.85em;
}

body.chat-app .you .settings,
body.chat-app .you .logout,
body.chat-app .compose {
    appearance: none;
    border: 1px solid #555;
    background: #2a2a2a;
    color: #eee;
    font: inherit;
    line-height: 1.25;
    padding: 0.4em 0.7em;
    cursor: pointer;
}

body.chat-app .you .settings:hover,
body.chat-app .you .logout:hover,
body.chat-app .compose:hover {
    background: #3a3a3a;
    border-color: #777;
    color: #fff;
}

body.chat-app .compose {
    display: block;
    width: 100%;
    margin: 0 0 0.55em;
    text-align: left;
}

body.chat-app .account_panel .username {
    display: block;
    max-width: 100%;
    overflow: visible;
    font-style: normal;
    font-weight: 800;
    white-space: normal;
    text-overflow: clip;
    word-break: break-all;
}

body.chat-app .account_panel p {
    margin: 0.2em 0;
    font-style: normal;
}

body.chat-app .roster-search,
body.chat-app .add-contact input,
body.chat-app .join-room input,
body.chat-app .account_card select,
body.chat-app .account_card .status-text,
body.chat-app .composer-meta input[name="to"] {
    box-sizing: border-box;
    width: 100%;
    margin: 0.15em 0;
    padding: 0.4em 0.5em;
    border: 1px solid #444;
    background: #1c1c1c;
    color: #eee;
    font: inherit;
}

body.chat-app .add-contact button,
body.chat-app .join-room button {
    appearance: none;
    margin: 0.15em 0 0.35em;
    padding: 0.4em 0.7em;
    border: 1px solid #555;
    background: #2a2a2a;
    color: #eee;
    font: inherit;
    cursor: pointer;
}

body.chat-app .add-contact button:hover,
body.chat-app .join-room button:hover {
    background: #3a3a3a;
    border-color: #777;
    color: #fff;
}

body.chat-app .account_panel .mailbox_list {
    list-style: none;
    margin: 0.25em 0 0.7em;
    padding: 0;
}

body.chat-app .account_panel .mailbox {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

body.chat-app .account_panel .mailbox_name {
    display: block;
    flex: 1;
    padding: 0.45em 0.55em;
    color: #eee;
    text-decoration: none;
    border-radius: 0.35em;
}

body.chat-app .account_panel .mailbox_name:hover,
body.chat-app .account_panel .mailbox.open .mailbox_name {
    background: #2a2a2a;
}

body.chat-app .account_panel .onlyloggedin > a {
    display: block;
    margin: 0.28em 0;
    color: #ddd;
    text-decoration: none;
}

body.chat-app .account_panel .onlyloggedin > a:hover {
    color: #fff;
}

body.chat-app .chat-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.55em 1em;
    margin: 0;
    padding: 0.75em 0.95em;
    background: #141414;
    border-bottom: 1px solid #2c2c2c;
}

body.chat-app .chat-who {
    min-width: 8rem;
}

body.chat-app .chat-head .subject {
    font-size: 1.15em;
    font-weight: 800;
}

body.chat-app .chat-head .from {
    color: #aaa;
    font-size: 0.85em;
}

body.chat-app .encrypt {
    flex: 1 1 16rem;
    min-width: 12rem;
}

body.chat-app .encrypt-title {
    display: block;
    font-size: 0.92em;
}

body.chat-app .encrypt.is-on .encrypt-title { color: #b7d7a8; }
body.chat-app .encrypt.is-off .encrypt-title { color: #e7c2c2; }

body.chat-app .encrypt-note {
    margin: 0.2em 0 0;
    color: #aaa;
    font-size: 0.82em;
    line-height: 1.35;
}

body.chat-app .chat-actions {
    display: flex;
    gap: 0.4em;
}

body.chat-app .chat-actions button,
body.chat-app .back {
    appearance: none;
    border: 0;
    background: transparent;
    color: #bbb;
    font: inherit;
    cursor: pointer;
    padding: 0.2em 0;
}

body.chat-app .chat-actions button:hover,
body.chat-app .back:hover { color: #fff; }

body.chat-app .back { display: none; }

body.chat-app .message_panel .subject {
    font-size: 1.15em;
    font-weight: 800;
}

body.chat-app .message_panel .thread {
    flex: 1 1 auto;
    min-height: 8em;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.45em;
    margin: 0;
    padding: 0.8em;
}

body.chat-app .message_panel .thread:empty::before {
    content: "Pick a contact";
    margin: auto;
    color: #888;
}

body.chat-app .message_panel .thread > article {
    max-width: min(36rem, 78%);
    align-self: flex-start;
    margin: 0;
    padding: 0.45em 0.7em;
    background: #2a2a2a;
    border-radius: 0.7em 0.7em 0.7em 0.2em;
}

body.chat-app .message_panel .thread > article.mine {
    align-self: flex-end;
    background: #243028;
    border-radius: 0.7em 0.7em 0.2em 0.7em;
}

body.chat-app .message_panel .thread .headers {
    display: flex;
    gap: 0.55em;
    align-items: baseline;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
}

body.chat-app .message_panel .thread .from_header,
body.chat-app .message_panel .thread .date_header {
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    font-size: 0.75em;
    color: #9a9a9a;
}

body.chat-app .message_panel .thread .text {
    margin-top: 0.15em;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

body.chat-app .message_panel .thread .lock {
    margin-left: 0.45em;
    color: #8d8d8d;
}

body.chat-app .message_panel > .compose_panel {
    flex: 0 0 auto;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0.65em 0.85em calc(0.65em + 2.7rem) !important;
    background: #141414;
    border-top: 1px solid #2c2c2c;
}

body.chat-app .composer {
    display: flex;
    flex-direction: column;
    gap: 0.45em;
}

body.chat-app .composer-to {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
    color: #ccc;
    font-size: 0.9em;
}

body.chat-app .composer-to input {
    box-sizing: border-box;
    width: 100%;
    max-width: 28rem;
    margin: 0;
    padding: 0.4em 0.5em;
    border: 1px solid #444;
    background: #1c1c1c;
    color: #eee;
    font: inherit;
}

body.chat-app .composer-picked {
    display: flex;
    align-items: center;
    gap: 0.6em;
    color: #ddd;
    font-size: 0.9em;
}

body.chat-app .composer-file-clear {
    appearance: none;
    border: 0;
    background: transparent;
    color: #aaa;
    font: inherit;
    cursor: pointer;
}

body.chat-app .composer-file {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 3.2em;
    height: 3.2em;
    border: 1px solid #555;
    background: #2a2a2a;
    color: #eee;
    cursor: pointer;
}

body.chat-app .composer-file:hover {
    background: #3a3a3a;
    border-color: #777;
    color: #fff;
}

body.chat-app .composer-file.is-off {
    opacity: 0.4;
    cursor: default;
}

body.chat-app .composer-file svg {
    width: 1.25em;
    height: 1.25em;
}

body.chat-app .composer-file input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

body.chat-app .composer-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5em;
}

body.chat-app .composer-row textarea {
    flex: 1 1 auto;
    width: 100% !important;
    min-height: 3.2em;
    max-height: 9em;
    margin: 0;
    padding: 0.5em 0.6em;
    box-sizing: border-box;
    border: 1px solid #444;
    background: #1c1c1c;
    color: #eee;
    font: inherit;
    resize: vertical;
}

body.chat-app .compose_panel .send {
    text-decoration: none;
    cursor: pointer;
}

body.chat-app .compose_panel .send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 5.5em;
    min-height: 3.2em;
    padding: 0.35em 0.9em;
    background: #2f4a28;
    border: 1px solid #6a8f4e;
    color: #e8f5dc;
}

body.chat-app .compose_panel .send:hover {
    background: #3a5c30;
    border-color: #8ab86a;
}

@media (max-width: 48rem) {
    body.chat-app.mobile-layout[data-mobile-view="message"] > .message_panel {
        display: flex !important;
        flex-direction: column;
    }

    body.chat-app .back { display: inline-flex; }

    body.chat-app .message_panel > .compose_panel {
        padding-bottom: 0.7em !important;
    }
}
