/* Catch's own rules, on top of the Hub shell in app.css. They use the shell's tokens (--surface, --line, --ink...)
   so they follow the light and dark theme. */

/* The sidebar's heading above a group of links, such as the mailboxes. */
.nav-heading {
    margin: 22px 12px 6px;
    color: var(--quiet);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

    .admin-sidebar > nav > .nav-heading:first-child {
        margin-top: 0;
    }

@media (max-width: 760px) {
    .admin-sidebar > nav > .nav-heading {
        display: none;
    }
}

/* RadzenTabs reads as part of the page, as the Hub's tabs do: no panel padding, sentence-case labels. */
.page-tabs {
    margin-bottom: 18px;
}

    .page-tabs .rz-tabview-panel {
        padding: 24px 0 0;
    }

/* A mailbox's status and numbers on one quiet line under its heading. */
.mailbox-facts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 22px;
    list-style: none;
    margin: -14px 0 26px;
    padding: 0;
    color: var(--muted);
    font-size: 15px;
}

    .mailbox-facts li {
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

    .mailbox-facts .rzi {
        font-size: 17px;
        color: var(--quiet);
    }

/* The SMTP credentials: label and value side by side, with the copy buttons right after the value. */
.smtp-card {
    max-width: 760px;
}

.smtp-settings {
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
}

.smtp-row {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--line-soft);
}

    .smtp-row:first-child {
        border-top: 0;
    }

    .smtp-row dt {
        color: var(--muted);
        font-size: 14px;
        font-weight: 600;
    }

    .smtp-row dd {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
        margin: 0;
        min-width: 0;
    }

    .smtp-row code {
        font-size: 15px;
        overflow-wrap: anywhere;
    }

.smtp-password {
    letter-spacing: .02em;
}

.smtp-ports {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 22px;
    list-style: none;
    margin: 0;
    padding: 0;
}

    .smtp-ports li {
        display: inline-flex;
        align-items: baseline;
        gap: 8px;
    }

    .smtp-ports span {
        color: var(--muted);
        font-size: 14px;
    }

.smtp-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 14px 0 28px;
}

    .smtp-footer .field-help {
        margin: 0;
    }

.smtp-snippet-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

    .smtp-snippet-heading h3 {
        margin: 0;
        font-size: 15px;
        font-weight: 550;
    }

.smtp-snippet {
    margin: 0;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-hover);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: auto;
}

/* Two short fields side by side in a dialog. */
.settings-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

    .settings-row .settings-field {
        margin-bottom: 0;
    }

.settings-row-help {
    margin-bottom: 21px;
}

/* Giving a user access: the user picker and its button on one line above the list. */
.access-add {
    display: flex;
    gap: 10px;
    max-width: 640px;
}

    .access-add .rz-dropdown {
        flex: 1;
        min-width: 0;
    }

.access-add + .field-help {
    margin-bottom: 18px;
}

.mailbox-checklist {
    border: 0;
    margin: 0 0 8px;
    padding: 0;
    max-height: 50dvh;
    overflow-y: auto;
}

/* The mailboxes on the overview. */
.mailbox-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: 14px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.mailbox-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.mailbox-card-icon {
    display: flex;
    padding: 9px;
    border-radius: 9px;
    background: var(--accent-surface);
    color: var(--accent);
}

.mailbox-card-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

    .mailbox-card-copy strong {
        font-size: 16px;
        font-weight: 600;
        overflow-wrap: anywhere;
    }

    .mailbox-card-copy small {
        color: var(--muted);
        font-size: 14px;
    }

@media (max-width: 760px) {
    .smtp-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .smtp-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .settings-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

        .settings-row .settings-field {
            margin-bottom: 21px;
        }

    .access-add {
        flex-direction: column;
    }
}

/* A mailbox: the list and the open message side by side on wide screens, one at a time on narrow ones. */
.mail-view {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

@media (min-width: 1280px) {
    .mail-view {
        grid-template-columns: minmax(420px, 5fr) minmax(0, 7fr);
    }

    .mail-detail {
        position: sticky;
        top: 20px;
    }

    .mail-back {
        display: none !important;
    }
}

@media (max-width: 1279px) {
    .mail-view.has-message .mail-list,
    .mail-view:not(.has-message) .mail-detail {
        display: none;
    }

    .mail-back {
        margin-bottom: 18px;
    }
}

.mail-placeholder {
    margin-top: 0;
    padding: 60px 20px;
}

.cell-ellipsis {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-subject {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

    .mail-subject .rzi {
        font-size: 16px;
        color: var(--quiet);
    }

.mail-grid .rz-data-row {
    cursor: pointer;
}

    .mail-grid .rz-data-row.selected-row > td {
        background: var(--accent-surface);
    }

/* The message: subject and actions, then who and when, then the tabs. */
.message-view {
    min-width: 0;
    padding: 22px 24px 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.message-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

    .message-heading h2 {
        margin: 0;
        font-size: 22px;
        font-weight: 500;
        line-height: 1.3;
        overflow-wrap: anywhere;
    }

.message-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.message-meta {
    display: grid;
    gap: 4px;
    margin: 16px 0 6px;
    font-size: 15px;
}

    .message-meta > div {
        display: grid;
        grid-template-columns: 90px minmax(0, 1fr);
        gap: 10px;
    }

    .message-meta dt {
        color: var(--muted);
    }

    .message-meta dd {
        margin: 0;
        overflow-wrap: anywhere;
    }

.message-envelope {
    color: var(--muted);
    font-size: 14px;
}

.message-tabs .rz-tabview-panel {
    padding-top: 16px;
}

.message-html-toolbar, .message-raw-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-bottom: 12px;
}

    .message-html-toolbar .checkbox-field {
        margin: 0;
    }

    .message-html-toolbar .field-help, .message-raw-toolbar .field-help {
        margin: 0;
    }

.message-raw-toolbar {
    justify-content: space-between;
}

/* Mail is written for a white page, so the frame stays white in the dark theme too. */
.message-html {
    display: block;
    width: 100%;
    height: 70dvh;
    min-height: 420px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color-scheme: light;
}

.message-text, .message-raw {
    margin: 0;
    padding: 14px 16px;
    max-height: 70dvh;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-hover);
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.message-raw {
    white-space: pre;
    overflow-wrap: normal;
}

.message-headers {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

    .message-headers th, .message-headers td {
        padding: 7px 10px;
        border-bottom: 1px solid var(--line-soft);
        text-align: left;
        vertical-align: top;
    }

    .message-headers th {
        width: 220px;
        color: var(--muted);
        font-weight: 600;
        white-space: nowrap;
    }

    .message-headers td {
        overflow-wrap: anywhere;
        font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
        font-size: 13px;
    }

.message-attachments {
    display: grid;
    gap: 8px;
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
}

    .message-attachments li {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        border: 1px solid var(--line);
        border-radius: 8px;
    }

    .message-attachments .rzi {
        color: var(--quiet);
    }

.attachment-name {
    font-weight: 600;
    min-width: 0;
    overflow-wrap: anywhere;
}

.attachment-meta {
    color: var(--muted);
    font-size: 14px;
}

.message-attachments .secondary-button {
    margin-left: auto;
    flex-shrink: 0;
}

/* The sidebar's mailbox names may be long; the new-message count stays visible. */
.nav-link-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The overview's cards are links to the mailboxes. */
a.mailbox-card {
    height: 100%;
    color: var(--ink);
    transition: border-color .2s ease, background .2s ease;
}

    a.mailbox-card:hover {
        border-color: var(--accent);
        background: var(--surface-hover);
    }

.mailbox-card-arrow {
    margin-left: auto;
    color: var(--quiet);
}

@media (max-width: 760px) {
    .message-view {
        padding: 16px 14px 6px;
    }

    .message-heading {
        flex-direction: column;
    }

    .message-meta > div {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .message-headers th {
        width: auto;
        white-space: normal;
    }

    .message-attachments li {
        flex-wrap: wrap;
    }

    .message-html {
        height: 60dvh;
    }
}
