/*
 * Global_Zshield webmail — loaded after vendor/bootstrap-5.3.8/css/bootstrap.min.css.
 * Colours, radii and components follow emailserver.tenten.v4 (TENTEN customer portal palette).
 * No build step; no inline styles in the templates (CSP).
 */
:root {
    --brand: #1f5fad;
    --brand-dark: #194f91;
    --brand-ink: #174a87;
    --brand-soft: #ebf2fa;
    --ink: #1d2633;
    --muted: #5d6b7e;
    --line: #dde3ec;
    --field-line: #cdd4de;
    --surface: #ffffff;
    --page: #f2f4f7;
    --hover: #f6f9fd;
    --selected: #e4eefa;
    --danger: #c8324b;
    --radius: 14px;
    --shadow: 0 1px 2px rgb(20 33 52 / 5%), 0 6px 20px rgb(20 33 52 / 5%);
    --topbar-height: 3.75rem;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--page);
    --bs-primary: var(--brand);
    --bs-primary-rgb: 31, 95, 173;
    --bs-link-color: var(--brand);
    --bs-link-color-rgb: 31, 95, 173;
    --bs-link-hover-color: var(--brand-dark);
    --bs-link-hover-color-rgb: 25, 79, 145;
    --bs-border-color: var(--line);
    --bs-border-radius: 10px;
    --bs-font-sans-serif: "Roboto", -apple-system, "Segoe UI", system-ui, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
}

body {
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.005em;
}

/* ---------- buttons ---------- */
.btn {
    --bs-btn-font-weight: 500;
    --bs-btn-border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.btn-sm {
    --bs-btn-border-radius: 8px;
    --bs-btn-padding-x: 0.7rem;
}

.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-dark);
    --bs-btn-hover-border-color: var(--brand-dark);
    --bs-btn-active-bg: var(--brand-dark);
    --bs-btn-active-border-color: var(--brand-dark);
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
    box-shadow: 0 4px 12px rgb(31 95 173 / 22%);
}

.btn-outline-primary {
    --bs-btn-color: var(--brand);
    --bs-btn-border-color: #c3d5ec;
    --bs-btn-bg: var(--surface);
    --bs-btn-hover-bg: var(--brand-soft);
    --bs-btn-hover-color: var(--brand-dark);
    --bs-btn-hover-border-color: #9dbbe0;
    --bs-btn-active-bg: var(--brand-soft);
    --bs-btn-active-color: var(--brand-dark);
    --bs-btn-active-border-color: #9dbbe0;
}

.btn-outline-secondary {
    --bs-btn-color: #44506a;
    --bs-btn-border-color: var(--line);
    --bs-btn-bg: var(--surface);
    --bs-btn-hover-bg: #f1f4fa;
    --bs-btn-hover-color: var(--ink);
    --bs-btn-hover-border-color: #cfd7e6;
    --bs-btn-active-bg: #e9eef7;
    --bs-btn-active-color: var(--ink);
    --bs-btn-active-border-color: #cfd7e6;
}

.btn-icon {
    --bs-btn-padding-x: 0.45rem;
    --bs-btn-padding-y: 0.3rem;
    color: var(--muted);
    border: 0;
    background: transparent;
    border-radius: 8px;
}

.btn-icon:hover,
.btn-icon:focus-visible {
    color: var(--brand);
    background: var(--brand-soft);
}

.form-control,
.form-select,
.input-group-text {
    border-color: var(--field-line);
}

/* Bootstrap 5.3 paints fields with --bs-body-bg (the grey page colour here). */
.form-control,
.form-select {
    background-color: var(--surface);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--surface);
    border-color: #8fb1dc;
    box-shadow: 0 0 0 0.2rem rgb(31 95 173 / 15%);
}

.form-label {
    font-weight: 500;
    color: #34405a;
}

.error-message {
    display: block;
    margin-top: 0.3rem;
    color: var(--danger);
    font-size: 0.82rem;
    white-space: pre-line;
}

.alert {
    border-radius: 10px;
}

/* ---------- top bar ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--topbar-height);
    background: var(--brand);
    color: #fff;
    box-shadow: 0 2px 12px rgb(20 33 52 / 18%);
}

.topbar .container-fluid {
    height: 100%;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}

.brand:hover {
    color: #fff;
}

.brand img {
    height: 28px;
    width: auto;
}

.brand-text {
    padding-left: 0.75rem;
    border-left: 1px solid rgb(255 255 255 / 35%);
    font-size: 0.95rem;
    opacity: 0.95;
}

.btn-topbar {
    --bs-btn-color: #fff;
    --bs-btn-border-color: rgb(255 255 255 / 45%);
    --bs-btn-bg: rgb(255 255 255 / 10%);
    --bs-btn-hover-color: var(--brand-dark);
    --bs-btn-hover-bg: #fff;
    --bs-btn-hover-border-color: #fff;
    --bs-btn-active-color: var(--brand-dark);
    --bs-btn-active-bg: #fff;
    --bs-btn-active-border-color: #fff;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 16rem;
    padding: 0.2rem 0.7rem 0.2rem 0.25rem;
    border: 0;
    border-radius: 999px;
    background: rgb(255 255 255 / 16%);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
}

.user-chip:hover,
.user-chip:focus-visible {
    background: rgb(255 255 255 / 26%);
}

.user-chip .user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-menu {
    --bs-dropdown-border-color: var(--line);
    --bs-dropdown-border-radius: 12px;
    --bs-dropdown-link-active-bg: var(--brand);
    box-shadow: var(--shadow);
}

.dropdown-header-user {
    padding: 0.5rem 1rem 0.65rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.dropdown-header-user strong {
    display: block;
    color: var(--ink);
    font-size: 0.9rem;
}

/* ---------- avatars ---------- */
.avatar {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    object-fit: cover;
}

.avatar-sm {
    width: 1.7rem;
    height: 1.7rem;
    font-size: 0.8rem;
}

.user-chip .avatar {
    background: #fff;
}

/* ---------- page frame ---------- */
.app-shell {
    display: flex;
    min-height: calc(100vh - var(--topbar-height));
}

.sidebar {
    flex: 0 0 15rem;
    padding: 1.25rem 1rem;
    border-right: 1px solid var(--line);
    background: var(--surface);
}

@media (min-width: 992px) {
    .sidebar {
        position: sticky;
        top: var(--topbar-height);
        height: calc(100vh - var(--topbar-height));
        overflow-y: auto;
    }
}

.compose-btn {
    --bs-btn-font-size: 0.95rem;
    --bs-btn-padding-y: 0.6rem;
    width: 100%;
    margin-bottom: 1.25rem;
}

.folder-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.2rem;
    padding: 0.55rem 0.8rem;
    border-radius: 10px;
    color: #44506a;
    font-weight: 500;
}

.folder-nav .nav-link .bi {
    font-size: 1.05rem;
    color: var(--muted);
}

.folder-nav .nav-link:hover {
    background: var(--hover);
    color: var(--ink);
}

.folder-nav .nav-link.active {
    background: var(--brand-soft);
    color: var(--brand-ink);
}

.folder-nav .nav-link.active .bi {
    color: var(--brand);
}

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 1.25rem;
}

/* ---------- panels ---------- */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--line);
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0;
    font-size: 1rem;
    font-weight: 650;
}

.panel-title .bi {
    color: var(--brand);
    font-size: 1.1rem;
}

.count {
    padding: 0.05rem 0.55rem;
    border-radius: 999px;
    background: #eef1f7;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.panel-empty {
    margin: 0;
    padding: 2.25rem 1rem;
    text-align: center;
    color: var(--muted);
}

/* ---------- mailbox (list + reading pane) ---------- */
.mail-layout {
    display: grid;
    grid-template-columns: minmax(18rem, 26rem) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.mail-layout.is-mobile {
    grid-template-columns: minmax(0, 1fr);
}

.mail-list-panel {
    overflow: hidden;
}

@media (min-width: 992px) {
    .mail-list-panel .mail-list {
        max-height: calc(100vh - var(--topbar-height) - 7rem);
        overflow-y: auto;
    }

    .mail-detail-panel {
        position: sticky;
        top: calc(var(--topbar-height) + 1.25rem);
    }
}

.mail-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.mail-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--line);
    border-left: 3px solid transparent;
    cursor: pointer;
}

.mail-item:last-child {
    border-bottom: 0;
}

.mail-item:hover {
    background: var(--hover);
}

.mail-item:focus-visible {
    outline: 2px solid #8fb1dc;
    outline-offset: -2px;
}

.mail-item.is-selected {
    background: var(--selected);
    border-left-color: var(--brand);
}

.mail-item-body {
    flex: 1 1 auto;
    min-width: 0;
}

.mail-item-top {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.mail-from {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.mail-date {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 0.78rem;
}

.mail-attach {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 0.85rem;
}

.mail-subject,
.mail-to {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
}

.mail-subject {
    color: #34405a;
}

.mail-to {
    color: var(--muted);
    font-size: 0.8rem;
}

.mail-detail-panel {
    min-height: 16rem;
}

.mail-detail-loading {
    display: grid;
    place-items: center;
    min-height: 16rem;
    color: var(--brand);
}

.mail-detail-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--line);
}

.mail-detail-subject {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 650;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}

.mail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.mail-sender {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem 0;
}

.mail-sender-name {
    font-weight: 600;
}

.mail-sender-date {
    color: var(--muted);
    font-size: 0.82rem;
}

.mail-body {
    padding: 1rem 1.25rem 1.5rem;
    overflow-wrap: anywhere;
}

.mail-body img {
    max-width: 100%;
    height: auto;
}

/* "Images are hidden" bar above a mail body with remote images (SEC-24). */
.remote-content-notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
    margin: 0.75rem 1.25rem 0;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fafbfd;
    color: var(--muted);
    font-size: 0.85rem;
}

.remote-content-notice > .bi {
    color: var(--brand);
}

.remote-content-notice .btn-link {
    padding: 0;
    font-size: inherit;
    font-weight: 500;
    text-decoration: none;
}

.mail-body blockquote {
    margin: 0 0 0 0.8ex;
    padding-left: 1ex;
    border-left: 2px solid #ccc;
}

.attachment-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
    gap: 0.75rem;
    margin: 0;
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid var(--line);
    list-style: none;
}

.attachment {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid #d3e0f1;
    border-radius: 12px;
    background: var(--brand-soft);
    min-width: 0;
}

.attachment-icon {
    flex: 0 0 auto;
    color: var(--brand);
    font-size: 1.4rem;
}

.attachment-thumb {
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 8px;
    object-fit: cover;
}

.attachment-info {
    flex: 1 1 auto;
    min-width: 0;
}

.attachment-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    text-decoration: none;
}

.mailbox-attachment-size {
    color: var(--muted);
    font-size: 0.78rem;
}

/* ---------- compose ---------- */
.compose-modal .modal-content {
    border: 0;
    border-radius: var(--radius);
    overflow: hidden;
}

.compose-modal .modal-header {
    background: var(--brand);
    color: #fff;
}

.compose-modal .btn-close {
    filter: invert(1) grayscale(1) brightness(2);
}

.compose-field {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 1.25rem;
    border-bottom: 1px solid var(--line);
}

.compose-field > .compose-label {
    flex: 0 0 4rem;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.compose-field .input {
    flex: 1 1 auto;
    min-width: 0;
}

.compose-field .form-control {
    border: 0;
    box-shadow: none;
    padding-left: 0;
}

.recipients {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    min-height: 2.4rem;
}

.recipients .recipients-entry {
    flex: 1 1 10rem;
    min-width: 8rem;
    border: 0;
    outline: 0;
    padding: 0.35rem 0;
    background: transparent;
}

.recipient-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.3rem 0.15rem 0.6rem;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-ink);
    font-size: 0.82rem;
    font-weight: 500;
}

.recipient-chip button {
    display: inline-grid;
    place-items: center;
    width: 1.2rem;
    height: 1.2rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    line-height: 1;
}

.recipient-chip button:hover {
    background: rgb(31 95 173 / 15%);
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem;
    padding: 0.4rem 1rem;
    border-bottom: 1px solid var(--line);
    background: #fafbfd;
}

.editor-area {
    min-height: 16rem;
    max-height: 50vh;
    padding: 1rem 1.25rem;
    overflow-y: auto;
    outline: 0;
}

.editor-area:empty::before {
    content: attr(data-placeholder);
    color: #98a2b3;
}

.editor-area blockquote {
    margin: 0 0 0 0.8ex;
    padding-left: 1ex;
    border-left: 2px solid #ccc;
}

.dropzone-area {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    column-gap: 0.5rem;
    row-gap: 0.1rem;
    margin: 0.75rem 1.25rem 0;
    padding: 0.5rem 0.9rem;
    border: 1px dashed #b9c9df;
    border-radius: 10px;
    background: #fafbfd;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.3;
    text-align: center;
    cursor: pointer;
}

.dropzone-area .bi {
    color: var(--brand);
    font-size: 1.1rem;
    line-height: 1;
}

.dropzone-area strong {
    color: var(--ink);
    font-weight: 500;
}

.dropzone-area span {
    font-size: 0.78rem;
}

.dropzone-area.is-dragover,
.dropzone-area:hover {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.attach-queue {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
    padding: 0.75rem 1.25rem 0;
    list-style: none;
}

.attach-queue li {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    max-width: 100%;
    padding: 0.3rem 0.4rem 0.3rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 0.85rem;
}

.attach-queue .attach-size {
    color: var(--muted);
    font-size: 0.78rem;
}

.compose-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
}

.compose-page {
    max-width: 60rem;
    margin: 0 auto;
}

/* ---------- account card (change password) + auth pages ---------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem 1rem;
    background: var(--page);
    font-size: 0.9rem;
}

.auth-card {
    position: relative;
    width: 100%;
    max-width: 30rem;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.auth-card::before,
.auth-card::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: var(--brand-soft);
    opacity: 0.6;
    pointer-events: none;
}

.auth-card::before {
    top: -9rem;
    right: -7rem;
    width: 17.5rem;
    height: 17.5rem;
}

.auth-card::after {
    bottom: 6rem;
    left: -5.5rem;
    width: 10rem;
    height: 10rem;
}

.auth-inline {
    margin: 1rem auto 2rem;
}

.auth-body {
    position: relative;
    z-index: 1;
    padding: 2.5rem 2.25rem 2rem;
}

.auth-brand {
    display: block;
    width: 150px;
    height: auto;
    margin: 0 auto 2rem;
}

.auth-eyebrow {
    margin: -0.9rem 0 1.4rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand);
}

.auth-title {
    margin: 0 0 1.1rem;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.auth-form .input {
    margin-bottom: 1rem;
}

.auth-form .form-control {
    padding: 0.65rem 0.85rem;
}

.auth-form .btn-primary {
    width: 100%;
    padding: 0.65rem 1rem;
}

/* ---------- error pages ---------- */
.error-code {
    margin: 0 0 0.25rem;
    font-size: 4.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--brand);
    text-align: center;
}

.error-title {
    margin: 0 0 0.5rem;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
}

.error-text {
    margin: 0 0 1.5rem;
    text-align: center;
    color: var(--muted);
}

/* ---------- message boxes (flash) — same style as emailserver's notices ---------- */
.notice {
    --notice: var(--brand-ink);
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 0 0 1rem;
    padding: 11px 14px;
    border: 1px solid color-mix(in srgb, var(--notice) 30%, transparent);
    border-radius: 10px;
    background: var(--brand-soft);
    color: var(--notice);
    font-size: 0.86rem;
    line-height: 1.5;
    animation: notice-in 0.25s ease-out;
}

.notice-icon {
    flex: 0 0 auto;
    margin-top: 1px;
    font-size: 1.05rem;
}

.notice .message {
    flex: 1 1 auto;
    min-width: 0;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.notice-close {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 1.5rem;
    height: 1.5rem;
    margin: -2px -4px -2px 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--notice);
    font-size: 0.75rem;
    opacity: 0.7;
    transition: background-color 0.15s, opacity 0.15s;
}

.notice-close:hover,
.notice-close:focus-visible {
    background: color-mix(in srgb, var(--notice) 14%, transparent);
    opacity: 1;
}

.notice.is-err {
    --notice: #b3362b;
    background: #fbecea;
}

.notice.is-ok {
    --notice: #1e7a4f;
    background: #e7f3ed;
}

@keyframes notice-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
}

/* ---------- toasts (top-right): icon, title, text, close, countdown bar ---------- */
.toast-area {
    z-index: 1090;
}

.note {
    --note: #17683f;
    --note-bg: #e3f4ea;
    --note-line: #b5dfc6;
    --bs-toast-bg: var(--note-bg);
    --bs-toast-max-width: 24rem;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 0.9rem 1rem;
    border: 1px solid var(--note-line);
    border-radius: 14px;
    background: var(--note-bg);
    color: var(--note);
    box-shadow: 0 14px 34px rgb(20 33 58 / 14%), 0 2px 6px rgb(20 33 58 / 6%);
    overflow: hidden;
}

.note-warn {
    --note: #7a4a00;
    --note-bg: #fff4d6;
    --note-line: #f1d48a;
}

.note-err {
    --note: #a32d23;
    --note-bg: #fde8e5;
    --note-line: #f2b8b1;
}

.note-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: color-mix(in srgb, var(--note) 14%, transparent);
    color: var(--note);
    font-size: 1.05rem;
}

.note-text {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.88rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.note-title {
    display: block;
    margin-bottom: 0.1rem;
    font-size: 0.92rem;
    font-weight: 650;
}

.note-close {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--note);
    font-size: 0.8rem;
    opacity: 0.75;
    transition: background-color 0.15s, opacity 0.15s;
}

.note-close:hover,
.note-close:focus-visible {
    background: color-mix(in srgb, var(--note) 14%, transparent);
    opacity: 1;
}

/* Thin bar that runs down while the notification is on screen (5s = TOAST_MS in app.js). */
.note-bar {
    position: absolute;
    inset: auto 0 0;
    height: 3px;
    background: color-mix(in srgb, var(--note) 55%, transparent);
    transform-origin: left;
}

.note.show .note-bar {
    animation: note-countdown 5s linear forwards;
}

.toast.note.show {
    animation: note-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes note-countdown {
    to {
        transform: scaleX(0);
    }
}

@keyframes note-in {
    from {
        opacity: 0;
        transform: translateX(1.5rem);
    }
}

/* ---------- loading layer + busy buttons (no double click) ---------- */
.page-loading {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgb(15 23 42 / 35%);
    cursor: progress;
    animation: page-loading-in 0.15s ease-out;
}

.page-loading[hidden] {
    display: none;
}

.page-loading-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 100%;
    padding: 0.9rem 1.25rem;
    border-radius: 12px;
    background: #fff;
    color: #1e293b;
    font-weight: 500;
    box-shadow: 0 10px 30px rgb(15 23 42 / 25%);
}

.page-loading-spinner {
    flex: none;
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid var(--brand-soft);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes page-loading-in {
    from {
        opacity: 0;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn.is-busy {
    opacity: 0.85;
    cursor: progress;
}

.btn.is-busy > .bi {
    display: none;
}

.btn.is-busy::before {
    content: "";
    width: 1rem;
    height: 1rem;
    border: 2px solid rgb(255 255 255 / 45%);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.btn[class*="btn-outline-"].is-busy::before,
.dropdown-item.is-busy::before {
    border-color: rgb(0 0 0 / 15%);
    border-top-color: currentcolor;
}

/* ---------- language switch (flag menu, like emailserver) ---------- */
.lang-flag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.45rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
}

.lang-flag img,
.lang-menu img {
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgb(0 0 0 / 12%);
}

.topbar .lang-flag {
    color: #fff;
}

.lang-flag:hover,
.lang-flag:focus-visible {
    background: rgb(255 255 255 / 18%);
}

.auth-page .lang-flag:hover,
.auth-page .lang-flag:focus-visible {
    background: var(--brand-soft);
}

.lang-menu {
    min-width: 11rem;
}

.lang-menu form {
    margin: 0;
}

.lang-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.lang-menu .is-current {
    font-weight: 600;
    color: var(--brand-ink);
    background: var(--brand-soft);
}

.auth-lang {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 2;
}

/* ---------- dialogs (compose) ---------- */
.modal {
    backdrop-filter: blur(3px);
}

.modal-backdrop {
    --bs-backdrop-bg: #14213a;
    --bs-backdrop-opacity: 0.45;
}

.modal.fade .modal-dialog {
    opacity: 0;
    transform: translateY(1.25rem) scale(0.96);
    transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.25), opacity 0.2s ease-out;
}

.modal.show .modal-dialog {
    opacity: 1;
    transform: none;
}

.compose-modal .modal-content {
    border-radius: 18px;
    box-shadow: 0 30px 70px rgb(20 33 58 / 28%), 0 2px 6px rgb(20 33 58 / 10%);
}

.compose-modal .modal-title {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-weight: 650;
}

.modal-icon {
    display: grid;
    place-items: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 10px;
    background: rgb(255 255 255 / 18%);
    color: #fff;
    font-size: 1.1rem;
}

.attach-queue li > .bi {
    color: var(--brand);
}

/* ---------- responsive ---------- */
@media (max-width: 991.98px) {
    .app-main {
        padding: 0.75rem;
    }

    .mail-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .sidebar.offcanvas-lg {
        --bs-offcanvas-width: 17rem;
    }
}

@media (max-width: 575.98px) {
    .brand-text {
        display: none;
    }

    .auth-body {
        padding: 2rem 1.25rem 1.5rem;
    }
}

/* Confirmation dialog (logout): light header with a brand icon, like emailserver. */
.confirm-modal .modal-content {
    border: 0;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 30px 70px rgb(20 33 58 / 28%), 0 2px 6px rgb(20 33 58 / 10%);
}

.confirm-modal .modal-content::before {
    content: "";
    height: 4px;
    background: linear-gradient(90deg, var(--brand-dark), var(--brand), #6fb3e0);
}

.confirm-modal .modal-header {
    gap: 0.85rem;
    padding: 1.2rem 1.5rem 1rem;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, var(--brand-soft), var(--surface));
}

.confirm-modal .modal-icon {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 12px;
    background: var(--brand);
    box-shadow: 0 6px 14px rgb(31 95 173 / 28%);
}

.confirm-modal .modal-title {
    margin: 0;
    font-weight: 700;
}

.confirm-modal .modal-body {
    padding: 1.25rem 1.5rem;
    color: #34405a;
}

.confirm-modal .modal-footer {
    gap: 0.5rem;
    margin: 0;
    padding: 0.9rem 1.5rem 1.2rem;
    border-top: 0;
}

.dropdown-menu button.dropdown-item {
    display: flex;
    align-items: center;
}

/* Bootstrap 5.3 paints dialogs, dropdowns and toasts with --bs-body-bg (grey page colour). */
.modal-content,
.dropdown-menu {
    --bs-modal-bg: var(--surface);
    --bs-dropdown-bg: var(--surface);
    background-color: var(--surface);
}

/* Cloudflare Turnstile widget of the login form */
.turnstile-box {
    display: flex;
    justify-content: center;
    min-height: 65px;
    margin: 0.25rem 0 1rem;
}
