:root {
    --app-max-width: 960px;
}

main.container {
    max-width: var(--app-max-width);
}

.narrow-card {
    max-width: 28rem;
}

.app-shell {
    display: flex;
    min-height: calc(100vh - 57px);
}


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

.app-main:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.email-frame {
    min-height: 60vh;
    background: #fff;
}

.mail-list {
    max-height: 60vh;
    min-height: 12rem;
    overflow-y: auto;
}

.compose-preview {
    max-width: 52rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}


.project-search {
    max-width: 24rem;
}
.min-w-0 {
    min-width: 0;
}

.ai-chat {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 22rem;
    overflow-y: auto;
}

.compose-body {
    min-height: 18rem;
    line-height: 1.5;
}
.compose-side {
    position: sticky;
    top: 1rem;
}
.compose-original {
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 22rem;
    overflow-y: auto;
}
.compose-form details > summary {
    cursor: pointer;
}

.kb-item {
    padding: 0.4rem 0;
    border-top: 1px solid var(--bs-border-color);
}
.kb-item:first-child {
    border-top: 0;
}
.kb-used {
    background: var(--bs-success-bg-subtle);
    margin: 0 -0.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    border-radius: 0.25rem;
}
.kb-snippet {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
#kb-items {
    max-height: 20rem;
    overflow-y: auto;
}

.compose-editor .compose-body {
    border-radius: 0 0 var(--bs-border-radius) var(--bs-border-radius);
    box-shadow: none;
}
.compose-busy {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    background: color-mix(in srgb, var(--bs-body-bg) 80%, transparent);
    font-weight: 500;
    border-radius: inherit;
}
.compose-flash {
    animation: compose-flash 1.6s ease-out;
}
@keyframes compose-flash {
    from { background-color: var(--bs-success-bg-subtle); }
    to { background-color: transparent; }
}
.ai-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.ai-dots i {
    display: inline-block;
    width: 0.4rem;
    height: 0.4rem;
    margin-right: 0.2rem;
    border-radius: 50%;
    background: currentColor;
    animation: ai-dot 1.1s infinite ease-in-out;
}
.ai-dots i:nth-child(2) { animation-delay: 0.15s; }
.ai-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes ai-dot {
    0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
    .compose-flash, .ai-dots i { animation: none; }
}

.inbox-nav .nav-link {
    padding: 0.3rem 0.6rem;
    border-radius: 0.4rem;
    color: var(--bs-body-color);
}
.inbox-nav .nav-link:hover:not(.active) {
    background: var(--bs-tertiary-bg);
}
.inbox-nav .nav-link.not-synced {
    opacity: 0.55;
    font-style: italic;
}
.inbox-nav-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--bs-secondary-color);
    margin: 1.25rem 0 0.35rem 0.6rem;
}
.inbox-views {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.mail-item {
    border-left: 3px solid transparent;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}
.mail-item.is-unread {
    border-left-color: var(--bs-primary);
}
.mail-subject {
    font-size: 0.92rem;
}
.mail-preview {
    opacity: 0.7;
}
.mail-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.3rem;
}
.mail-clip {
    opacity: 0.6;
}
.mail-item.active .mail-preview,
.mail-item.active .mail-clip {
    opacity: 0.9;
}

.ask-bar {
    display: flex;
    gap: 0.5rem;
}
.ask-bar .form-control {
    padding: 0.6rem 0.9rem;
}
.ask-panel {
    width: min(34rem, 100vw);
}
.ask-answer {
    max-height: calc(100vh - 14rem);
    overflow-y: auto;
}
.ask-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.ask-cite {
    display: inline-block;
    min-width: 1.15rem;
    padding: 0 0.3rem;
    margin: 0 0.1rem;
    border-radius: 0.6rem;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    font-size: 0.72rem;
    text-align: center;
    text-decoration: none;
    vertical-align: super;
    line-height: 1.3;
}

.doc-row {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--bs-border-color);
}
.doc-row:hover {
    background: var(--bs-tertiary-bg);
}
.doc-kind {
    flex: 0 0 3rem;
    height: 3rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
}
.doc-kind-pdf { background: #dc354533; color: #ea868f; }
.doc-kind-word { background: #0d6efd33; color: #6ea8fe; }
.doc-kind-excel { background: #19875433; color: #75b798; }
.doc-kind-image { background: #ffc10733; color: #ffda6a; }
.doc-kind-cad { background: #6f42c133; color: #a98eda; }
.doc-main {
    flex: 1 1 auto;
    min-width: 0;
}
.doc-name {
    font-weight: 600;
    word-break: break-word;
}
.doc-snippet {
    color: var(--bs-secondary-color);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 0.15rem;
}
.doc-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.4rem;
}
.doc-actions {
    flex: 0 0 auto;
}

/* ---- inbox workspace ---- */
.inbox-workspace {
    display: grid;
    grid-template-columns: 13.5rem minmax(20rem, 26rem) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    flex: 1 1 auto;
    min-height: 30rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    overflow: hidden;
    background: var(--bs-body-bg);
}
.inbox-folders {
    padding: 0.9rem 0.6rem;
    border-right: 1px solid var(--bs-border-color);
    background: var(--bs-tertiary-bg);
    overflow-y: auto;
}
.inbox-listpane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-right: 1px solid var(--bs-border-color);
}
.inbox-listhead {
    padding: 0.75rem;
    border-bottom: 1px solid var(--bs-border-color);
}
.inbox-listpane .mail-list {
    flex: 1 1 auto;
    max-height: none;
    min-height: 0;
    border: 0;
    border-radius: 0;
}
.inbox-listpane .mail-list .list-group-item {
    border-left-width: 3px;
    border-right: 0;
    border-top: 0;
    border-radius: 0;
}
.inbox-liststatus {
    border-top: 1px solid var(--bs-border-color);
}
.inbox-detail {
    overflow-y: auto;
    min-width: 0;
    padding: 1rem 1.25rem;
}
.inbox-empty {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--bs-secondary-color);
    opacity: 0.8;
}
.inbox-banner {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.inbox-views {
    display: flex;
    gap: 0;
    margin-bottom: 0.6rem;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--bs-border-color);
}
.inbox-views .btn {
    flex: 1 1 auto;
    border: 0;
    border-radius: 0;
    font-size: 0.8rem;
    padding: 0.3rem 0.35rem;
    white-space: nowrap;
}
.inbox-views .btn + .btn {
    border-left: 1px solid var(--bs-border-color);
}
.inbox-toolbar {
    margin-bottom: 0;
}
@media (max-width: 991.98px) {
    .inbox-workspace {
        display: block;
        height: auto;
    }
    .inbox-folders,
    .inbox-listpane {
        border-right: 0;
        border-bottom: 1px solid var(--bs-border-color);
    }
    .inbox-listpane .mail-list {
        max-height: 60vh;
    }
    .inbox-detail {
        overflow: visible;
    }
}

/* message rows */
.mail-row {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
}
.mail-body {
    min-width: 0;
    flex: 1 1 auto;
}
.mail-avatar {
    flex: 0 0 2.1rem;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
}
.mail-avatar-lg {
    flex-basis: 2.6rem;
    width: 2.6rem;
    height: 2.6rem;
    font-size: 1rem;
}
.av-0 { background: #b86f52; }
.av-1 { background: #6f8f7a; }
.av-2 { background: #8a7aa8; }
.av-3 { background: #b08a4a; }
.av-4 { background: #a8606b; }
.av-5 { background: #6c8aa6; }
.av-6 { background: #7e8f55; }
.av-7 { background: #9a7b66; }
.mail-item .mail-from {
    font-size: 0.92rem;
}

/* message pane */
.msg-head {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--bs-border-color);
}
.msg-subject {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    flex: 1 1 18rem;
    word-break: break-word;
}
.msg-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 0 0 auto;
}
.msg-toolbar .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 500;
}
.msg-toolbar .btn-act-done:hover,
.msg-toolbar .btn-act-done:focus-visible {
    color: var(--app-badge-success-fg);
    background: var(--app-badge-success-bg);
}
.msg-toolbar .btn-act-delete:hover,
.msg-toolbar .btn-act-delete:focus-visible {
    color: var(--app-badge-danger-fg);
    background: var(--app-badge-danger-bg);
}
.msg-from {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-top: 0.85rem;
}
.msg-from > div {
    flex: 1 1 auto;
}
.msg-details summary {
    cursor: pointer;
    list-style-position: inside;
}
.msg-label {
    display: inline-block;
    min-width: 4rem;
    font-weight: 600;
}
.msg-files {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.85rem;
}
.ai-refine-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}
.ai-refine-row textarea {
    resize: vertical;
    min-height: 3rem;
}
.modal .compose-preview {
    max-height: 22rem;
    overflow-y: auto;
}

.ai-refine-row {
    padding: 0.5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.9rem;
    background: var(--bs-body-bg);
}
.ai-refine-row:focus-within {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.15rem color-mix(in srgb, var(--bs-primary) 25%, transparent);
}
.ai-refine-row textarea {
    border: 0;
    box-shadow: none;
    background: transparent;
    min-height: 4.5rem;
    font-size: 1rem;
    resize: none;
}

/* The inbox fills the screen: the page itself does not scroll, each pane does. */
.app-main-fill {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 57px);
    overflow-y: auto;
}
.app-main-fill > * {
    flex: 0 0 auto;
}
.app-main-fill > .inbox-workspace {
    flex: 1 1 auto;
}
.inbox-workspace > * {
    min-height: 0;
}
@media (max-width: 991.98px) {
    .app-main-fill {
        display: block;
        height: auto;
        overflow: visible;
    }
}

/* ---- inbox, flat like a native mail app: no frame, panes run to the edges and the bottom of the window ---- */
.app-main-fill {
    padding-bottom: 0 !important;
}
.app-main-fill > .inbox-workspace {
    border: 0;
    border-top: 1px solid var(--bs-border-color-translucent);
    border-radius: 0;
    margin-left: -1rem;
    margin-right: -1rem;
    background: transparent;
}
@media (min-width: 992px) {
    .app-main-fill > .inbox-workspace {
        margin-left: -1.5rem;
        margin-right: -1.5rem;
    }
}
.inbox-folders {
    border-right: 1px solid var(--bs-border-color-translucent);
    background: color-mix(in srgb, var(--bs-body-color) 4%, var(--bs-body-bg));
}
.inbox-listpane {
    border-right: 1px solid var(--bs-border-color-translucent);
}
.inbox-listhead {
    border-bottom: 0;
    padding-bottom: 0.35rem;
}
.inbox-liststatus {
    border-top: 0;
    font-size: 0.75rem;
    opacity: 0.7;
}
.inbox-listpane .mail-list {
    background: transparent;
    padding: 0.25rem 0.4rem 0.5rem;
}
.inbox-listpane .mail-list .mail-item {
    position: relative;
    border: 0;
    border-radius: 0.6rem;
    background: transparent;
    padding: 0.7rem 0.7rem 0.7rem 1.15rem;
    margin: 0;
}
.inbox-listpane .mail-list .mail-item + .mail-item::before {
    content: "";
    position: absolute;
    top: 0;
    left: 3.6rem;
    right: 0.7rem;
    border-top: 1px solid var(--bs-border-color-translucent);
}
.inbox-listpane .mail-list .mail-item:hover:not(.active) {
    background: var(--bs-tertiary-bg);
}
.inbox-listpane .mail-list .mail-item.is-unread::after {
    content: "";
    position: absolute;
    left: 0.4rem;
    top: 1.2rem;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--bs-primary);
}
.inbox-listpane .mail-list .mail-item.is-unread {
    border-left-color: transparent;
}
.inbox-listpane .mail-list .mail-item.active {
    background: rgba(var(--app-clay-rgb), 0.1);
    color: var(--bs-body-color);
    border-color: transparent;
    box-shadow: inset 3px 0 0 var(--app-clay);
}
.inbox-listpane .mail-list .mail-item.active::before,
.inbox-listpane .mail-list .mail-item.active + .mail-item::before {
    display: none;
}


.sig-preview-frame {
    height: 26rem;
}

.msg-project {
    margin-top: 0.85rem;
}
.msg-images {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    border-radius: 0.5rem;
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
}
.msg-images [data-images-text] {
    flex: 1 1 14rem;
}

/* The inbox is pinned to the window: top bar and workspace are fixed, so nothing (a taller window, a browser extension adding
   a block to the page) can make the page itself scroll or leave a gap below the panes. Only the panes scroll. */
@media (min-width: 992px) {
    body.page-fill {
        overflow: hidden;
    }
    body.page-fill .app-topbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 3.2rem;
        z-index: 1030;
        background: var(--bs-body-bg);
    }
    body.page-fill .app-shell {
        position: fixed;
        top: 3.2rem;
        left: 0;
        right: 0;
        bottom: 0;
        min-height: 0;
    }
    body.page-fill .app-main-fill {
        height: auto;
    }
}

/* recipient fields: addresses become chips, with suggestions while typing */
.chips-holder {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}
.chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    min-height: calc(1.5em + 0.5rem + 2px);
    padding: 0.15rem 0.4rem;
    cursor: text;
}
.input-group > .chips-holder > .chips {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.chip-entry {
    flex: 1 1 8rem;
    min-width: 6rem;
    border: 0;
    outline: 0;
    background: transparent;
    color: inherit;
    font-size: 0.875rem;
    padding: 0.15rem 0;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    max-width: 100%;
    padding: 0.05rem 0.25rem 0.05rem 0.55rem;
    border-radius: 1rem;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    font-size: 0.85rem;
    line-height: 1.6;
}
.chip-bad {
    background: var(--bs-danger-bg-subtle);
    color: var(--bs-danger-text-emphasis);
}
.chip-x {
    border: 0;
    background: transparent;
    color: inherit;
    opacity: 0.6;
    line-height: 1;
    font-size: 1rem;
    padding: 0 0.3rem;
    cursor: pointer;
}
.chip-x:hover {
    opacity: 1;
}
.chip-suggest {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 1050;
    max-height: 16rem;
    overflow-y: auto;
    margin-top: 0.15rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    background: var(--bs-body-bg);
    box-shadow: var(--bs-box-shadow);
}
.chip-option {
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
}
.chip-option:hover,
.chip-option.active {
    background: var(--bs-primary);
    color: #fff;
}
.chip-option.active .text-body-secondary,
.chip-option:hover .text-body-secondary {
    color: rgba(255, 255, 255, 0.8) !important;
}
.row-x {
    flex: 0 0 auto;
}

.row-x {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
    line-height: 1;
    font-size: 1.1rem;
}

.compose-attachments {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}

.row-x {
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    min-width: 2.4rem;
}
.input-group > .chips-holder + .btn {
    align-self: stretch;
}

/* versions written by the assistant: one collapsible card for each */
.ver-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.ver-card {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.6rem;
    background: var(--bs-body-bg);
}
.ver-card[open] {
    border-color: var(--bs-primary-border-subtle);
}
.ver-sum {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.8rem;
    cursor: pointer;
    list-style-position: inside;
}
.ver-title {
    font-weight: 600;
    white-space: nowrap;
}
.ver-ask {
    color: var(--bs-secondary-color);
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.ver-body {
    padding: 0.2rem 0.9rem 0.9rem;
}
.ver-note {
    font-size: 0.92rem;
}
.ver-text {
    margin: 0.75rem 0 0.6rem;
    padding: 0.7rem 0.85rem;
    border-radius: 0.5rem;
    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    font-family: inherit;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 18rem;
    overflow-y: auto;
}
.ver-questions {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: var(--bs-info-bg-subtle);
}
.ver-questions[inert] {
    opacity: 0.6;
}
.ver-error {
    border-color: var(--bs-danger);
}
.ver-working .ver-title {
    opacity: 0.7;
}

.kb-doc {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.35rem 0;
    border-top: 1px solid var(--bs-border-color);
}
.kb-doc:first-child {
    border-top: 0;
}
.kb-doc-info {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kb-doc-info a {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compose-attach-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.attach-pop-list {
    max-height: 16rem;
    overflow-y: auto;
}

.file-card {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    max-width: 16rem;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    background: var(--bs-body-bg);
    color: inherit;
    text-decoration: none;
}
a.file-card:hover,
.file-card:hover {
    background: var(--bs-tertiary-bg);
}
.file-open {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}
.file-icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.4rem;
    border-radius: 0.3rem;
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: #6c757d;
}
.file-icon.ft-xls { background: #1d6f42; }
.file-icon.ft-doc { background: #2b579a; }
.file-icon.ft-pdf { background: #c0392b; }
.file-icon.ft-ppt { background: #c4491c; }
.file-icon.ft-img { background: #7b4fa3; }
.file-icon.ft-zip { background: #8a6d1d; }
.file-icon.ft-dwg { background: #0d7a8a; }
.file-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}
.file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85rem;
    font-weight: 500;
}
.file-size {
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
}
.file-x {
    flex: none;
    border: 0;
    background: transparent;
    color: var(--bs-secondary-color);
    font-size: 1.2rem;
    line-height: 1;
    padding: 0 0.2rem;
}
.file-x:hover {
    color: var(--bs-danger);
}

.progress-widget {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}
.progress-ring .ring-track {
    stroke: var(--bs-border-color);
}
.progress-ring .ring-fill {
    stroke: var(--bs-primary);
    transition: stroke-dasharray 0.6s ease;
}
.progress-ring .ring-fill.ring-done {
    stroke: var(--bs-success);
}
.kbd-help {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1050;
    width: 18rem;
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    background: var(--bs-body-bg);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.25);
}
.kbd-help dl {
    display: grid;
    grid-template-columns: 5rem 1fr;
    gap: 0.25rem 0.5rem;
    margin: 0;
    font-size: 0.85rem;
}
.kbd-help dd {
    margin: 0;
}

.focus-wrap {
    max-width: 52rem;
    margin: 0 auto;
}
.focus-bar {
    height: 0.5rem;
    border-radius: 0.5rem;
    background: var(--bs-secondary-bg);
    overflow: hidden;
}
.focus-bar > span {
    display: block;
    height: 100%;
    background: var(--bs-primary);
    transition: width 0.4s ease;
}
.focus-bar > span.is-full {
    background: var(--bs-success);
}
.focus-frame {
    width: 100%;
    height: 22rem;
}
.focus-done-icon {
    font-size: 3rem;
    line-height: 1;
    color: var(--bs-success);
}

.health-dot {
    display: inline-block;
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    background: var(--bs-secondary-color);
    vertical-align: middle;
}
.health-dot.health-green { background: var(--bs-success); }
.health-dot.health-amber { background: var(--bs-warning); }
.health-dot.health-red { background: var(--bs-danger); }

.mail-clip.bi {
    font-size: 1rem;
    line-height: 1;
    vertical-align: middle;
}

/* AI insights card */
.ai-card {
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    background: var(--bs-tertiary-bg);
}
.ai-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.ai-card-head .bi-stars {
    color: var(--bs-primary);
}
.ai-lead {
    margin: 0 0 0.9rem;
    padding: 0.2rem 0 0.2rem 0.85rem;
    border-left: 4px solid var(--bs-primary);
    font-size: 1.02rem;
    line-height: 1.5;
}
.ai-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.6rem;
    margin-bottom: 1rem;
}
.ai-tile {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.6rem;
    background: var(--bs-body-bg);
}
.ai-tile-label {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
}
.ai-tile-value {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    margin-top: 0.15rem;
}
.ai-tile-quest {
    border-color: var(--bs-warning);
    box-shadow: 0 0 0 1px var(--bs-warning) inset;
}
.ai-meter {
    display: inline-flex;
    gap: 0.15rem;
}
.ai-meter i {
    width: 0.5rem;
    height: 1.1rem;
    border-radius: 0.2rem;
    background: var(--bs-border-color);
}
.ai-meter-green i.on { background: var(--bs-success); }
.ai-meter-amber i.on { background: var(--bs-warning); }
.ai-meter-red i.on { background: var(--bs-danger); }
.ai-sub {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}
.ai-points {
    list-style: none;
    margin: 0 0 0.9rem;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}
.ai-point {
    display: flex;
    gap: 0.7rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.6rem;
    background: var(--bs-body-bg);
}
.ai-point-n {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    font-size: 0.8rem;
    font-weight: 700;
}
.ai-point-body {
    min-width: 0;
    font-size: 0.92rem;
}
.ai-quote summary {
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--bs-secondary-color);
    margin-top: 0.2rem;
}
.ai-quote blockquote {
    margin: 0.3rem 0 0;
    padding-left: 0.6rem;
    border-left: 2px solid var(--bs-border-color);
    font-size: 0.82rem;
    font-style: italic;
    color: var(--bs-secondary-color);
}
.ai-callout {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.6rem;
    background: var(--bs-warning-bg-subtle);
    color: var(--bs-warning-text-emphasis);
    font-size: 0.88rem;
}
.ai-foot {
    margin: 0 0 0.75rem;
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
}

.nav-group-toggle {
    background: transparent;
    border: 0;
    text-align: left;
}
.nav-chevron {
    font-size: 0.7rem;
    transition: transform 0.15s ease;
}
.nav-group-toggle[aria-expanded="true"] .nav-chevron {
    transform: rotate(90deg);
}
.nav-sub {
    padding-left: 1.1rem;
}

.nav-sub.collapsing {
    transition: none;
}

.ai-track summary,
.ai-quote summary {
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--bs-secondary-color);
    margin-top: 0.2rem;
}
.ai-track summary:hover {
    color: var(--bs-primary);
}
.ai-track-form {
    margin: 0.4rem 0 0.2rem;
}
.ai-track-free {
    margin-bottom: 0.6rem;
}

.fu-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--bs-border-color);
    border-left-width: 4px;
    border-radius: 0.6rem;
    background: var(--bs-tertiary-bg);
}
.fu-bar.fu-overdue { border-left-color: var(--bs-danger); }
.fu-bar.fu-today { border-left-color: var(--bs-warning); }
.fu-bar.fu-upcoming { border-left-color: var(--bs-info); }
.fu-bar-text {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    min-width: 0;
}
.fu-bar-text .bi {
    margin-top: 0.15rem;
}
.fu-bar.fu-overdue .bi { color: var(--bs-danger); }
.fu-bar.fu-today .bi { color: var(--bs-warning); }
.fu-bar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.fu-scan {
    margin-top: 0.5rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.6rem;
    background: var(--bs-tertiary-bg);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--bs-secondary-color);
}
.empty-state .bi {
    font-size: 2.4rem;
    line-height: 1;
    color: var(--bs-primary);
    opacity: 0.8;
}
.empty-title {
    font-weight: 600;
    color: var(--bs-body-color);
}
.empty-text {
    max-width: 22rem;
    font-size: 0.9rem;
}

.fu-bar.fu-undated { border-left-color: var(--bs-secondary); }

.streak-fire {
    color: var(--bs-orange, #fd7e14);
}

/* The theme button shows the sun in dark mode (press for light) and the moon in light mode (press for dark). */
:root[data-bs-theme="dark"] .theme-moon,
:root[data-bs-theme="light"] .theme-sun {
    display: none;
}
.theme-toggle {
    border: 0;
    background: transparent;
    color: var(--bs-secondary-color);
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.35rem 0.5rem;
}
.theme-toggle:hover,
.theme-toggle:focus-visible {
    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
}

.user-menu-toggle {
    border: 0;
    background: transparent;
    color: var(--bs-body-color);
}
.user-menu-toggle:hover,
.user-menu-toggle:focus-visible,
.user-menu-toggle.show {
    background: var(--bs-tertiary-bg);
}

/* Settings: headings down the left, details on the right */
.settings-group {
    margin: 1rem 0 0.35rem;
    padding-left: 0.75rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
}
.settings-group:first-child {
    margin-top: 0;
}
.settings-nav .nav-link {
    color: var(--bs-body-color);
    padding: 0.5rem 0.75rem;
}
.settings-nav .nav-link:not(.active):hover {
    background: var(--bs-tertiary-bg);
}
.settings-content {
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    background: var(--bs-body-bg);
}
@media (min-width: 768px) {
    .settings-nav {
        position: sticky;
        top: 1rem;
    }
}

.settings-preview code {
    word-break: break-all;
}
.settings-doc-form section + section {
    padding-top: 1.25rem;
    border-top: 1px solid var(--bs-border-color);
}

/* Inbox columns: widths are percentages (the person's own, from the inbox-layout stylesheet) with a line between the columns to drag. */
.inbox-workspace {
    grid-template-columns: var(--col-folders, 14%) 6px var(--col-list, 27%) 6px minmax(0, 1fr);
}
.col-resizer {
    position: relative;
    cursor: col-resize;
    background: transparent;
    touch-action: none;
}
.col-resizer::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 2px;
    width: 2px;
    background: transparent;
    transition: background 0.15s ease;
}
.col-resizer:hover::after,
.col-resizer:focus-visible::after,
.col-resizer.is-dragging::after {
    background: var(--bs-primary);
}
body.is-resizing {
    cursor: col-resize;
    user-select: none;
}
body.is-resizing iframe {
    pointer-events: none;
}
@media (max-width: 991.98px) {
    .col-resizer {
        display: none;
    }
}

/* Long project, category and folder names end in three dots instead of running out of the column or wrapping. */
.inbox-nav .nav-link {
    min-width: 0;
}
.inbox-nav .nav-link > .text-truncate {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.inbox-nav .nav-link > .badge,
.inbox-nav .nav-link > .small {
    flex: 0 0 auto;
}
.inbox-nav .nav-sub,
.inbox-nav .nav-item {
    min-width: 0;
}
/* Bootstrap's .nav wraps its items; in a column that makes every item as wide as its longest text and the column's width is ignored,
   so long names never got their three dots. Not wrapping lets each item take the column's width. */
.inbox-nav,
.inbox-nav .nav-sub {
    flex-wrap: nowrap;
}

/* The project summary in the inbox's right-hand pane */
.project-pane {
    padding: 1.5rem;
    max-width: 52rem;
}
.project-pane-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}
.project-pane-summary {
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    background: var(--bs-tertiary-bg);
}
.compose-frame {
    display: block;
    width: 100%;
    height: 22rem;
    background: #ffffff;
}

/* A sideways swipe on the message list must not trigger the browser's back and forward gesture. */
html,
body,
.inbox-listpane,
.inbox-listpane .mail-list {
    overscroll-behavior-x: none;
}
.inbox-listpane .mail-list .mail-item {
    touch-action: pan-y;
}

/* pull to refresh */
.ptr {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 0;
    overflow: hidden;
    flex: 0 0 auto;
    color: var(--bs-secondary-color);
}
.ptr .spinner-border {
    opacity: 0.35;
    animation-play-state: paused;
}
.ptr.ptr-ready .spinner-border,
.ptr.ptr-spin .spinner-border {
    opacity: 1;
    animation-play-state: running;
}

/* search by meaning */
.mail-related {
    border-bottom: 1px solid var(--bs-border-color);
    flex: 0 0 auto;
}
.mail-related-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 0;
    background: transparent;
    color: var(--bs-secondary-color);
    font-size: 0.875rem;
    text-align: left;
}
.mail-related-toggle:not(:disabled):hover {
    color: var(--bs-body-color);
}
.mail-related-chevron {
    margin-left: auto;
    transition: transform 0.15s;
}
.mail-related.open .mail-related-chevron {
    transform: rotate(180deg);
}
.inbox-listpane .mail-related-rows {
    max-height: 45vh;
    overflow-y: auto;
}

/* drop files anywhere on the compose page */
.drop-veil {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--bs-body-bg-rgb), 0.85);
    pointer-events: none;
}
.drop-veil[hidden] {
    display: none;
}
.drop-veil-box {
    padding: 2.5rem 3.5rem;
    border: 2px dashed var(--bs-primary);
    border-radius: 1rem;
    background: var(--bs-body-bg);
    color: var(--bs-primary);
    font-size: 1.15rem;
    font-weight: 600;
    text-align: center;
}
.drop-veil-box .bi {
    display: block;
    font-size: 2.5rem;
}

/* project counts: unread or all mail */
.inbox-nav[data-counts="unread"] [data-count="total"],
.inbox-nav[data-counts="total"] [data-count="unread"] {
    display: none;
}
.nav-counts-switch {
    display: inline-flex;
    flex: none;
    gap: 0.2rem;
    margin-left: auto;
    padding-right: 0.75rem;
}
.nav-counts-switch button {
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    background: transparent;
    color: var(--bs-secondary-color);
    font-size: 0.7rem;
    line-height: 1.4;
    padding: 0 0.55rem;
}
.nav-counts-switch button.on {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-secondary-color);
}

/* live status in the inbox header */
.inbox-live {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.9rem;
    white-space: nowrap;
}
.inbox-live-menu {
    min-width: 17rem;
}
.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.status-chip .spin {
    display: inline-block;
    animation: live-spin 1s linear infinite;
}
.inbox-live .live-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}
.inbox-live .live-item[hidden] {
    display: none;
}
.inbox-live .live-label {
    color: var(--bs-body-color);
    font-weight: 600;
}
.inbox-live .live-sync-icon {
    font-size: 1.35rem;
    color: var(--bs-secondary-color);
}
.inbox-live .spin {
    display: inline-block;
    animation: live-spin 1s linear infinite;
}
@keyframes live-spin {
    to { transform: rotate(360deg); }
}
.inbox-live [data-live="ai"] .ring-fill {
    stroke: #8a78b0;
}
.inbox-live [data-live="docs"] .ring-fill {
    stroke: #5f9f8f;
}
.inbox-live [data-live] .ring-fill.ring-done {
    stroke: var(--bs-success);
}
.inbox-live .live-sync {
    padding: 0.2rem 0.4rem;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: inherit;
    cursor: pointer;
}
.inbox-live .live-sync:hover {
    background: var(--bs-tertiary-bg);
}

/* selected and active states are calm: a soft tint and a thin clay edge, not a solid block */
.inbox-views .btn.is-on {
    background: var(--bs-secondary-bg);
    color: var(--bs-emphasis-color);
    font-weight: 600;
}
.inbox-nav .nav-link.active {
    background: var(--bs-secondary-bg);
    color: var(--bs-emphasis-color);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--app-clay);
}
.inbox-nav .nav-link.active .badge {
    background-color: var(--bs-body-bg) !important;
}
.banner-icon {
    color: var(--bs-secondary-color);
    text-decoration: none;
    font-size: 0.8rem;
}
.banner-icon:hover {
    color: var(--bs-body-color);
}
.filter-menu {
    min-width: 15rem;
}
.filter-toggle .badge {
    margin-left: 0.15rem;
}

/* message header: smaller subject, project as one quiet line */
.msg-subject {
    font-size: 1.1rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.msg-project {
    margin-top: 0.6rem;
}
.msg-project [data-project-note] {
    display: inline-block;
    max-width: 18rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    font-size: 0.78rem;
}
.msg-project .form-select-sm {
    max-width: 16rem;
}

/* in "Unread" mode every project is still listed; those with nothing unread are dimmed so the ones with unread mail stand out */
.inbox-nav[data-counts="unread"] .nav-item-quiet .nav-link {
    opacity: 0.5;
}
.inbox-nav[data-counts="unread"] .nav-item-quiet .nav-link:hover,
.inbox-nav[data-counts="unread"] .nav-item-quiet .nav-link:focus-visible {
    opacity: 1;
}

/* conversation list under a message */
.msg-thread {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--bs-border-color);
}
.msg-thread-title {
    font-family: var(--app-serif);
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.6rem;
}
.msg-thread-title span {
    font-family: var(--bs-body-font-family);
    font-size: 0.78rem;
    font-weight: 400;
    margin-left: 0.35rem;
}
.msg-thread-list {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.thread-item {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: var(--bs-border-radius);
    color: var(--bs-body-color);
    text-decoration: none;
    font-size: 0.85rem;
    box-shadow: inset 3px 0 0 transparent;
}
.thread-item:hover {
    background: var(--bs-tertiary-bg);
}
.thread-item.is-current {
    background: rgba(var(--app-clay-rgb), 0.1);
    box-shadow: inset 3px 0 0 var(--app-clay);
}
.thread-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}
.thread-date {
    flex: none;
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
}
.thread-preview {
    color: var(--bs-secondary-color);
    font-size: 0.8rem;
}

/* the email text can be folded away to leave room for the AI analysis and the conversation */
.msg-body-bar {
    margin: 0.5rem 0 0.4rem;
}
.msg-body-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 0;
    background: transparent;
    color: var(--bs-secondary-color);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.15rem 0.3rem;
    margin-left: -0.3rem;
    border-radius: var(--bs-border-radius-sm);
}
.msg-body-toggle:hover {
    color: var(--bs-body-color);
    background: var(--bs-tertiary-bg);
}
.msg-body-toggle .when-closed {
    display: none;
    text-transform: none;
    letter-spacing: 0;
}
#mail-detail[data-body="collapsed"] .msg-body {
    display: none;
}
#mail-detail[data-body="collapsed"] .msg-body-toggle .when-open {
    display: none;
}
#mail-detail[data-body="collapsed"] .msg-body-toggle .when-closed {
    display: inline;
}
#mail-detail[data-body="collapsed"] .msg-body-chevron {
    transform: rotate(-90deg);
}
.msg-body-chevron {
    transition: transform 0.15s;
}

/* AI insights: a quiet, editorial card instead of boxes inside a box */
.ai-card {
    padding: 1.35rem 1.5rem 1.1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 1.1rem;
    background: var(--app-surface);
    box-shadow: var(--bs-box-shadow-sm);
}
.ai-card-head {
    margin-bottom: 0.9rem;
}
.ai-card-head h3 {
    font-family: var(--app-serif);
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.ai-card-head .bi-stars {
    color: var(--app-clay);
}
.ai-card-head .small {
    font-size: 0.74rem !important;
    letter-spacing: 0.02em;
}
.ai-lead {
    margin: 0 0 1.25rem;
    padding: 0.1rem 0 0.1rem 1rem;
    border-left: 2px solid rgba(var(--app-clay-rgb), 0.55);
    font-family: var(--app-serif);
    font-size: 1.12rem;
    line-height: 1.6;
    color: var(--bs-emphasis-color);
}
.ai-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin: 0 0 1.4rem;
    border-top: 1px solid var(--bs-border-color);
    border-bottom: 1px solid var(--bs-border-color);
}
.ai-tile {
    flex: 1 1 9rem;
    padding: 0.8rem 1rem;
    border: 0;
    border-left: 1px solid var(--bs-border-color);
    border-radius: 0;
    background: transparent;
}
.ai-tile:first-child {
    border-left: 0;
    padding-left: 0;
}
.ai-tile-label {
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--bs-secondary-color);
}
.ai-tile-value {
    font-size: 0.95rem;
    font-weight: 500;
    margin-top: 0.3rem;
    line-height: 1.3;
}
.ai-tile-value .bi {
    color: var(--bs-secondary-color);
}
.ai-tile-quest {
    box-shadow: none;
    border-color: var(--bs-border-color);
}
.ai-tile-quest .ai-tile-value,
.ai-tile-quest .ai-tile-value .bi {
    color: var(--app-clay);
}
.ai-meter i {
    width: 0.38rem;
    height: 0.95rem;
    border-radius: 0.3rem;
}
.ai-meter-green i.on { background: #7aa874; }
.ai-meter-amber i.on { background: #cfa84e; }
.ai-meter-red i.on { background: #c4685a; }
.ai-sub {
    margin: 0 0 0.35rem;
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
}
.ai-sub .bi {
    display: none;
}
.ai-points {
    gap: 0;
    margin-bottom: 1.1rem;
}
.ai-point {
    gap: 0.85rem;
    padding: 0.85rem 0;
    border: 0;
    border-top: 1px solid var(--bs-border-color);
    border-radius: 0;
    background: transparent;
}
.ai-point:last-child {
    border-bottom: 1px solid var(--bs-border-color);
}
.ai-point-n {
    width: 1.5rem;
    height: 1.5rem;
    margin-top: 0.1rem;
    border: 1px solid rgba(var(--app-clay-rgb), 0.5);
    background: transparent;
    color: var(--app-clay);
    font-size: 0.72rem;
    font-weight: 500;
}
.ai-point-body {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 1.25rem;
    row-gap: 0.15rem;
    font-size: 0.93rem;
    line-height: 1.5;
}
.ai-point-body > div:first-child {
    flex: 1 0 100%;
}
.ai-point-body details[open] {
    flex: 1 0 100%;
}
.ai-track summary,
.ai-quote summary {
    margin-top: 0.15rem;
    font-size: 0.76rem;
    color: var(--bs-tertiary-color);
}
.ai-track summary:hover,
.ai-quote summary:hover {
    color: var(--bs-body-color);
}
.ai-quote summary .bi-patch-check-fill {
    color: #7aa874 !important;
}
.ai-callout {
    margin-bottom: 1rem;
    padding: 0.7rem 0.9rem;
    border-left: 3px solid #cfa84e;
    border-radius: 0 var(--bs-border-radius) var(--bs-border-radius) 0;
    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    font-size: 0.88rem;
}
.ai-callout .bi {
    color: #b88f35;
}
.ai-foot {
    margin: 0.4rem 0 0.6rem;
    font-size: 0.72rem;
    color: var(--bs-tertiary-color);
}
.ai-tile-value {
    white-space: nowrap;
}
.inbox-live .live-detail {
    font-size: 0.72rem;
    color: var(--bs-tertiary-color);
    white-space: normal;
    max-width: 15rem;
}

/* the project note is a small pill; the full reason shows on hover */
.msg-project [data-project-note] {
    padding: 0.12rem 0.65rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 2rem;
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    cursor: help;
}
.msg-project [data-project-note]:empty {
    display: none;
}

/* Refresh the analysis: a quiet pill, right-aligned */
form[data-analyse] {
    display: flex;
    justify-content: flex-end;
}
.ai-refresh {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.85rem;
    border-radius: 2rem;
    border-color: var(--bs-border-color);
    color: var(--bs-secondary-color);
    font-size: 0.76rem;
    letter-spacing: 0.02em;
    text-decoration: none;
}
.ai-refresh:hover,
.ai-refresh:focus-visible {
    background: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}
.ai-refresh:hover .bi {
    transform: rotate(180deg);
}
.ai-refresh .bi {
    transition: transform 0.3s ease;
}

/* projects page */
.projects-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.projects-title {
    font-family: var(--app-serif);
    font-size: 1.9rem;
    font-weight: 500;
    margin: 0 0 0.6rem;
}

.pc {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    height: 100%;
    position: relative;
    padding: 1.25rem 1.3rem 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 1.1rem;
    background: var(--app-surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.pc:hover {
    border-color: rgba(var(--app-clay-rgb), 0.45);
    box-shadow: var(--bs-box-shadow);
}
.pc-archived {
    opacity: 0.65;
}
.pc-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}
.pc-code {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.pc-code a {
    color: var(--app-clay);
    text-decoration: none;
}
.pc-name {
    margin: 0.2rem 0 0;
    font-family: var(--app-serif);
    font-size: 1.2rem;
    font-weight: 500;
    line-height: 1.25;
}
.pc-client {
    margin-top: 0.15rem;
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
}
.pc-know {
    flex: none;
    color: var(--app-clay);
    font-size: 0.95rem;
    position: relative;
    z-index: 2;
}
.pc-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin: 0;
    border-top: 1px solid var(--bs-border-color);
    border-bottom: 1px solid var(--bs-border-color);
}
.pc-stats > div {
    display: flex;
    flex-direction: column;
    padding: 0.65rem 0 0.6rem 0.75rem;
    border-left: 1px solid var(--bs-border-color);
}
.pc-stats > div:first-child {
    border-left: 0;
    padding-left: 0;
}
.pc-stats dd {
    margin: 0;
    font-family: var(--app-serif);
    font-size: 1.35rem;
    line-height: 1.1;
    color: var(--bs-tertiary-color);
}
.pc-stats > div:first-child dd,
.pc-stats > div.on dd {
    color: var(--bs-emphasis-color);
}
.pc-stats > div.tone-green dd { color: #6b9a65; }
.pc-stats > div.tone-amber dd { color: #b88f35; }
.pc-stats > div.tone-red dd { color: #c0604f; }
.pc-stats dt {
    margin-top: 0.2rem;
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
}
.pc-spark rect {
    fill: rgba(var(--app-clay-rgb), 0.35);
}
.pc-spark rect.now {
    fill: var(--app-clay);
}
.pc-spark rect.z {
    fill: var(--bs-border-color);
}
.pc-activity-foot {
    display: flex;
    justify-content: space-between;
    margin-top: 0.3rem;
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
}
.pc-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 0.2rem;
    font-size: 0.74rem;
    color: var(--bs-tertiary-color);
}
.pc-actions {
    display: inline-flex;
    gap: 0.9rem;
    position: relative;
    z-index: 2;
}
.pc-actions a {
    color: var(--bs-secondary-color);
    text-decoration: none;
}
.pc-actions a:hover {
    color: var(--app-clay);
}
.project-search {
    max-width: 24rem;
}
.project-add-tabs .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.9rem;
    border-radius: 2rem;
    color: var(--bs-secondary-color);
    font-size: 0.85rem;
}
.project-add-tabs .nav-link.active {
    background: var(--bs-secondary-bg);
    color: var(--bs-emphasis-color);
    font-weight: 500;
}

/* projects header: a strip like the one in the AI card, with an icon, a figure and a short note in each cell */
.projects-head {
    margin-bottom: 1.1rem;
}
.projects-title {
    margin-bottom: 0.15rem;
}
.projects-sub {
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
}
.projects-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    margin: 0 0 1.5rem;
    border-top: 1px solid var(--bs-border-color);
    border-bottom: 1px solid var(--bs-border-color);
}
.projects-strip-cell {
    padding: 1rem 1.25rem 0.9rem;
    border-left: 1px solid var(--bs-border-color);
}
.projects-strip-cell:first-child {
    border-left: 0;
    padding-left: 0;
}
.projects-strip dt {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
}
.projects-strip dt .bi {
    font-size: 0.85rem;
    color: var(--app-clay);
}
.projects-strip dd {
    margin: 0.35rem 0 0.1rem;
    font-family: var(--app-serif);
    font-size: 2rem;
    line-height: 1.1;
    color: var(--bs-emphasis-color);
}
.projects-strip-hint {
    font-size: 0.75rem;
    color: var(--bs-tertiary-color);
}
.projects-strip-cell.tone-green dd { color: #6b9a65; }
.projects-strip-cell.tone-amber dd { color: #b88f35; }
.projects-strip-cell.tone-red dd { color: #c0604f; }

/* project detail page */
.pj-crumb {
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
}
.pj-crumb a {
    color: var(--bs-secondary-color);
    text-decoration: none;
}
.pj-crumb a:hover {
    color: var(--app-clay);
}
.pj-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.pj-code {
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--app-clay);
}
.pj-name {
    margin: 0.2rem 0 0.5rem;
    font-family: var(--app-serif);
    font-size: 2.1rem;
    font-weight: 500;
    line-height: 1.15;
}
.pj-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
}
.pj-alias {
    padding: 0.08rem 0.6rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 2rem;
    background: var(--bs-tertiary-bg);
    font-size: 0.75rem;
}
.pj-desc {
    max-width: 46rem;
    margin: 0.75rem 0 0;
    color: var(--bs-secondary-color);
}
.pj-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-self: flex-start;
}
.pj-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}
@media (min-width: 992px) {
    .pj-grid {
        grid-template-columns: minmax(0, 1fr) 21rem;
    }
}
.pj-main,
.pj-side {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}
.pj-card {
    padding: 1.2rem 1.35rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 1.1rem;
    background: var(--app-surface);
}
.pj-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.8rem;
}
.pj-card-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    font-family: var(--app-serif);
    font-size: 1.05rem;
    font-weight: 500;
}
.pj-card-title .bi {
    color: var(--app-clay);
    font-size: 0.95rem;
}
.pj-card-note,
.pj-card-link {
    font-size: 0.74rem;
    color: var(--bs-secondary-color);
    text-decoration: none;
}
.pj-card-link:hover {
    color: var(--app-clay);
}
.pj-overview {
    padding-bottom: 1rem;
}
.pj-overview-body {
    min-height: 3rem;
    font-size: 0.95rem;
    line-height: 1.6;
}
.pj-overview-body .ps-heading {
    margin: 1.1rem 0 0.35rem;
    font-family: var(--bs-body-font-family);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
}
.pj-overview-body .ps-heading:first-child {
    margin-top: 0;
}
.pj-overview-body p:first-of-type {
    font-family: var(--app-serif);
    font-size: 1.12rem;
    line-height: 1.6;
    color: var(--bs-emphasis-color);
}
.pj-overview-body ul {
    padding-left: 1.1rem;
}
.pj-overview-body li {
    margin-bottom: 0.3rem;
}
.pj-convos {
    display: flex;
    flex-direction: column;
}
.pj-convo {
    display: flex;
    gap: 0.8rem;
    padding: 0.75rem 0.5rem;
    margin: 0 -0.5rem;
    border-top: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    color: inherit;
    text-decoration: none;
}
.pj-convo:first-child {
    border-top: 0;
}
.pj-convo:hover {
    background: var(--bs-tertiary-bg);
}
.pj-convo-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.pj-convo-top {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}
.pj-convo-who,
.pj-convo-subject {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
}
.pj-convo-who.unread,
.pj-convo-subject.unread {
    font-weight: 600;
}
.pj-convo-date {
    flex: none;
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
}
.pj-convo-preview {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
}
.pj-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.pj-list li {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--bs-border-color);
    font-size: 0.86rem;
}
.pj-list li:first-child {
    border-top: 0;
    padding-top: 0;
}
.pj-list-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-wrap: anywhere;
}
.pj-list-main a {
    color: var(--bs-body-color);
    text-decoration: none;
}
.pj-list-main a:hover {
    color: var(--app-clay);
}
.pj-list-sub {
    font-size: 0.74rem;
    color: var(--bs-secondary-color);
}
.pj-list-end {
    flex: none;
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
}
.pj-details summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    list-style: none;
}
.pj-details summary::-webkit-details-marker {
    display: none;
}
.pj-details[open] summary {
    margin-bottom: 0.9rem;
}
.pj-details .card-body {
    padding: 0;
}
.pj-sources a {
    color: var(--bs-secondary-color);
}

/* project conversation */
.pchat-tools {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.pchat-tools .form-select {
    max-width: 15rem;
    font-size: 0.8rem;
}
.pchat-thread {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 32rem;
    overflow-y: auto;
    margin-bottom: 0.9rem;
}
.pchat-thread:empty {
    display: none;
}
.pchat-user {
    align-self: flex-end;
    max-width: 85%;
}
.pchat-bubble {
    padding: 0.55rem 0.9rem;
    border-radius: 1rem 1rem 0.25rem 1rem;
    background: rgba(var(--app-clay-rgb), 0.12);
    font-size: 0.92rem;
    white-space: pre-wrap;
}
.pchat-assistant {
    align-self: stretch;
    padding-left: 0.9rem;
    border-left: 2px solid rgba(var(--app-clay-rgb), 0.45);
}
.pchat-answer {
    font-size: 0.93rem;
    line-height: 1.6;
}
.pchat-answer p {
    margin: 0 0 0.6rem;
}
.pchat-answer ul {
    padding-left: 1.1rem;
    margin-bottom: 0.6rem;
}
.pchat-warn {
    font-size: 0.8rem;
    color: #8a6a1c;
}
.pchat-sources summary {
    cursor: pointer;
    font-size: 0.76rem;
    color: var(--bs-tertiary-color);
}
.pchat-sources ol {
    margin: 0.4rem 0 0;
    padding-left: 1.2rem;
    font-size: 0.78rem;
    color: var(--bs-secondary-color);
}
.pchat-sources a {
    color: var(--bs-secondary-color);
}
.pchat-wait,
.pchat-error {
    font-size: 0.88rem;
    color: var(--bs-secondary-color);
}
.pchat-error {
    color: var(--bs-danger-text-emphasis);
}
.pchat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.9rem;
}
.pchat-chip {
    padding: 0.25rem 0.8rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 2rem;
    background: transparent;
    color: var(--bs-secondary-color);
    font-size: 0.8rem;
}
.pchat-chip:hover {
    border-color: rgba(var(--app-clay-rgb), 0.5);
    color: var(--bs-body-color);
}
.pchat-form {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}
.pchat-form textarea {
    resize: none;
    min-height: 2.6rem;
    max-height: 9rem;
    border-radius: 1.3rem;
    padding: 0.6rem 1rem;
}
.pchat-form .btn {
    border-radius: 2rem;
    padding-left: 1.2rem;
    padding-right: 1.2rem;
}
.pchat-tools .btn {
    white-space: nowrap;
}

/* waiting on others, grouped by person */
.pj-person {
    padding: 0.7rem 0;
    border-top: 1px solid var(--bs-border-color);
}
.pj-person:first-of-type {
    border-top: 0;
    padding-top: 0;
}
.pj-person-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}
.pj-person-name {
    font-weight: 500;
    font-size: 0.9rem;
}
.pj-draft {
    flex: none;
    padding: 0.12rem 0.6rem;
    border: 1px solid rgba(var(--app-clay-rgb), 0.45);
    border-radius: 2rem;
    color: var(--app-clay);
    font-size: 0.72rem;
    text-decoration: none;
    white-space: nowrap;
}
.pj-draft:hover {
    background: rgba(var(--app-clay-rgb), 0.1);
}
.pj-person .pj-list li {
    border-top: 0;
    padding: 0.2rem 0;
}

/* documents page */
.doc-strip {
    grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
    margin-bottom: 0.6rem;
}
.doc-cell {
    display: flex;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
    transition: background 0.15s ease;
}
.doc-strip .doc-cell:first-child {
    padding-left: 1.25rem;
}
.doc-cell:hover {
    background: var(--bs-tertiary-bg);
}
.doc-cell.is-on {
    background: var(--bs-secondary-bg);
    box-shadow: inset 0 -2px 0 var(--app-clay);
}
.doc-cell-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
}
.doc-cell-label .bi {
    font-size: 0.85rem;
    color: var(--app-clay);
}
.doc-cell-n {
    margin: 0.35rem 0 0.1rem;
    font-family: var(--app-serif);
    font-size: 1.75rem;
    line-height: 1.1;
    color: var(--bs-emphasis-color);
}
.doc-note {
    margin: 0 0 1.1rem;
    font-size: 0.78rem;
    color: var(--bs-tertiary-color);
}
.doc-filters {
    margin-bottom: 1.1rem;
}
.doc-search {
    border-radius: 2rem;
    padding-left: 1rem;
}
.doc-filters .form-select {
    border-radius: 2rem;
}
.doc-list {
    border: 1px solid var(--bs-border-color);
    border-radius: 1.1rem;
    background: var(--app-surface);
    padding: 0.35rem 1rem;
}
.doc-row {
    padding: 0.95rem 0.5rem;
    margin: 0 -0.5rem;
    border-bottom: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}
.doc-row:last-child {
    border-bottom: 0;
}
.doc-kind {
    flex: 0 0 2.8rem;
    height: 3.2rem;
    border-radius: 0.6rem;
    font-size: 0.64rem;
    letter-spacing: 0.06em;
}
.doc-kind-pdf { background: rgba(184, 87, 74, 0.14); color: #b8574a; }
.doc-kind-word { background: rgba(79, 115, 150, 0.16); color: #4f7396; }
.doc-kind-excel { background: rgba(92, 138, 88, 0.16); color: #5c8a58; }
.doc-kind-image { background: rgba(167, 130, 47, 0.16); color: #a7822f; }
.doc-kind-cad { background: rgba(123, 100, 168, 0.16); color: #7b64a8; }
[data-bs-theme="dark"] .doc-kind-pdf { color: #e0897d; }
[data-bs-theme="dark"] .doc-kind-word { color: #8fb1d1; }
[data-bs-theme="dark"] .doc-kind-excel { color: #8fbe8a; }
[data-bs-theme="dark"] .doc-kind-image { color: #d9b65e; }
[data-bs-theme="dark"] .doc-kind-cad { color: #b7a3dd; }
.doc-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.6rem;
}
.doc-name {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--bs-body-color);
    text-decoration: none;
    overflow-wrap: anywhere;
}
.doc-name:hover {
    color: var(--app-clay);
}
.doc-size {
    font-size: 0.74rem;
    color: var(--bs-tertiary-color);
}
.doc-meta {
    margin-top: 0.15rem;
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.doc-meta a {
    color: var(--bs-secondary-color);
    text-decoration-color: var(--bs-border-color);
}
.doc-meta a:hover {
    color: var(--app-clay);
}
.doc-snippet {
    margin-top: 0.4rem;
    padding-left: 0.75rem;
    border-left: 2px solid var(--bs-border-color);
    font-size: 0.82rem;
    font-style: italic;
    color: var(--bs-secondary-color);
}
.doc-tags {
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.5rem;
}
.doc-chip {
    padding: 0.08rem 0.6rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 2rem;
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
    font-size: 0.72rem;
    text-decoration: none;
}
.doc-chip-project {
    border-color: rgba(var(--app-clay-rgb), 0.4);
    background: rgba(var(--app-clay-rgb), 0.08);
    color: var(--app-clay);
}
.doc-state {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.74rem;
    color: var(--bs-secondary-color);
}
.doc-state::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--bs-border-color);
}
.doc-state-read::before { background: #7aa874; }
.doc-state-waiting::before { background: #cfa84e; }
.doc-state-failed::before { background: #c4685a; }
.doc-state-skipped::before { background: var(--bs-tertiary-color); }
.doc-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.doc-row:hover .doc-actions,
.doc-actions:focus-within {
    opacity: 1;
}
.doc-act {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 50%;
    color: var(--bs-secondary-color);
    text-decoration: none;
}
.doc-act:hover {
    border-color: rgba(var(--app-clay-rgb), 0.5);
    color: var(--app-clay);
}
@media (hover: none) {
    .doc-actions {
        opacity: 1;
    }
}

/* import status */
.imp-queue {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    align-items: center;
    margin-bottom: 1.1rem;
    padding: 0.7rem 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 2rem;
    background: var(--app-surface);
    font-size: 0.82rem;
    color: var(--bs-secondary-color);
}
.imp-queue b {
    color: var(--bs-body-color);
    font-weight: 600;
}
.imp-queue .bi {
    color: var(--app-clay);
    margin-right: 0.15rem;
}
.imp-queue-item.bad b,
.imp-queue-item.bad .bi {
    color: #c0604f;
}
.imp-queue-ai {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.imp-meter {
    display: inline-block;
    width: 5rem;
    height: 0.35rem;
    border-radius: 1rem;
    background: var(--bs-border-color);
    overflow: hidden;
    vertical-align: middle;
}
.imp-meter > span {
    display: block;
    height: 100%;
    border-radius: 1rem;
    background: var(--app-clay);
}
.imp-meter-wide {
    width: 100%;
    max-width: 14rem;
}
.imp-card {
    margin-bottom: 1.25rem;
}
.imp-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.1rem;
}
.imp-name {
    margin: 0;
    font-family: var(--app-serif);
    font-size: 1.35rem;
    font-weight: 500;
}
.imp-sub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 1rem;
    margin-top: 0.3rem;
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
}
.imp-sub b {
    color: var(--bs-body-color);
    font-weight: 500;
}
.imp-status {
    padding: 0.08rem 0.65rem;
    border-radius: 2rem;
    font-size: 0.72rem;
    text-transform: capitalize;
}
.imp-status-ok { background: var(--app-badge-success-bg); color: var(--app-badge-success-fg); }
.imp-status-bad { background: var(--app-badge-danger-bg); color: var(--app-badge-danger-fg); }
.imp-status-off { background: var(--app-badge-neutral-bg); color: var(--app-badge-neutral-fg); }
.imp-error {
    margin-bottom: 1rem;
    padding: 0.55rem 0.9rem;
    border-left: 3px solid #c0604f;
    border-radius: 0 var(--bs-border-radius) var(--bs-border-radius) 0;
    background: var(--bs-tertiary-bg);
    font-size: 0.84rem;
}
.imp-rings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    border-top: 1px solid var(--bs-border-color);
    border-bottom: 1px solid var(--bs-border-color);
}
.imp-ringbox {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-left: 1px solid var(--bs-border-color);
}
.imp-ringbox:first-child {
    border-left: 0;
    padding-left: 0;
}
.imp-ring-title {
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
}
.imp-ring-n {
    margin: 0.15rem 0;
    font-family: var(--app-serif);
    font-size: 1.45rem;
    line-height: 1.15;
    color: var(--bs-emphasis-color);
}
.imp-ring-hint {
    font-size: 0.76rem;
    color: var(--bs-tertiary-color);
}
.imp-ring .ring-track {
    stroke: var(--bs-border-color);
}
.imp-ring.ring-ai .ring-fill { stroke: #8a78b0; }
.imp-ring.ring-docs .ring-fill { stroke: #5f9f8f; }
.imp-ring .ring-fill.ring-done { stroke: var(--bs-success); }
.imp-range {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin: 1rem 0 0.4rem;
}
.imp-range-label {
    font-size: 0.82rem;
    font-weight: 500;
}
.imp-range-note {
    flex: 1 1 18rem;
    font-size: 0.75rem;
    color: var(--bs-tertiary-color);
}
.imp-sub-title {
    margin: 1.2rem 0 0.4rem;
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
}
.imp-folders {
    display: flex;
    flex-direction: column;
}
.imp-folder {
    display: grid;
    grid-template-columns: minmax(8rem, 1.2fr) minmax(6rem, 2fr) minmax(7rem, 0.9fr) minmax(8rem, 1fr) 6rem;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--bs-border-color);
    font-size: 0.85rem;
}
.imp-folder:first-child {
    border-top: 0;
}
.imp-folder-n,
.imp-folder-time {
    color: var(--bs-secondary-color);
    font-variant-numeric: tabular-nums;
}
.imp-folder-time {
    text-align: right;
    font-size: 0.76rem;
}
.imp-state {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--bs-secondary-color);
}
.imp-state::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--bs-border-color);
}
.imp-state-ok::before { background: #7aa874; }
.imp-state-busy::before { background: #cfa84e; }
.imp-state-wait::before { background: var(--bs-tertiary-color); }
.imp-errors {
    margin-top: 1rem;
    font-size: 0.82rem;
}
.imp-errors summary {
    cursor: pointer;
    color: var(--bs-secondary-color);
}
@media (max-width: 767px) {
    .imp-folder {
        grid-template-columns: 1fr auto;
    }
    .imp-folder .imp-meter-wide,
    .imp-folder-time {
        display: none;
    }
}

/* selecting several emails: the avatar becomes a tick, and a bar offers actions for the selection */
.mail-avatar[data-select] {
    position: relative;
    cursor: pointer;
}
.mail-check {
    display: none;
    font-size: 1.15rem;
}
.mail-item.is-selected .mail-initial,
.mail-avatar[data-select]:hover .mail-initial {
    display: none;
}
.mail-item.is-selected .mail-check,
.mail-avatar[data-select]:hover .mail-check {
    display: inline;
}
.mail-avatar[data-select]:hover {
    box-shadow: 0 0 0 3px var(--bs-secondary-bg);
}
.mail-item.is-selected .mail-avatar {
    background: var(--app-clay);
}
.mail-item.is-selected {
    background: var(--bs-secondary-bg);
}
/* a floating bar at the bottom centre of the screen while emails are selected */
.bulkbar {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    z-index: 1060;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    max-width: calc(100vw - 1.5rem);
    padding: 0.6rem 0.9rem;
    overflow-x: auto;
    white-space: nowrap;
    border-radius: 1rem;
    background: #2a2723;
    color: #fff;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    transform: translate(-50%, 6rem);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
}
.bulkbar.is-open {
    transform: translate(-50%, 0);
    opacity: 1;
    pointer-events: auto;
}
.bulkbar-count {
    flex: 0 0 auto;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    font-variant-numeric: tabular-nums;
}
.bulkbar-sep {
    flex: 0 0 auto;
    width: 1px;
    height: 1.25rem;
    background: rgba(255, 255, 255, 0.15);
}
.bulkbar .bulk-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex: 0 0 auto;
    padding: 0.4rem 0.75rem;
    border: 0;
    border-radius: 0.65rem;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    transition: background 0.15s ease, transform 0.1s ease;
}
.bulkbar .bulk-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}
.bulkbar .bulk-btn:active {
    transform: scale(0.95);
}
.bulkbar .bulk-btn-primary {
    background: var(--app-clay);
}
.bulkbar .bulk-select {
    flex: 0 0 auto;
    width: auto;
    max-width: 9.5rem;
    padding: 0.4rem 1.6rem 0.4rem 0.7rem;
    border: 0;
    border-radius: 0.65rem;
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}
.bulkbar .bulk-select option {
    color: #000;
}
.bulkbar .bulk-link {
    flex: 0 0 auto;
    padding: 0.2rem 0.4rem;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.78rem;
}
.bulkbar .bulk-link:hover {
    color: #fff;
}
.bulkbar.is-busy {
    opacity: 0.7;
    pointer-events: none;
}
.bulk-note {
    flex: 0 1 auto;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.8);
}
.bulk-note:empty {
    display: none;
}

.bulkbar .bulk-btn-outline {
    background: transparent;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.bulkbar .bulk-btn-outline:hover {
    background: rgba(255, 255, 255, 0.12);
}
.bulkbar [hidden] {
    display: none;
}
#send-attachments[hidden] {
    display: none !important;
}
.imp-ring-pct {
    margin-left: 0.4rem;
    font-family: var(--bs-body-font-family);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--app-clay);
}

/* SharePoint filing: the small status chip beside an attachment, and the folder picker */
.filing-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.1rem 0.55rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    background: transparent;
    color: var(--bs-secondary-color);
    font-size: 0.76rem;
    line-height: 1.5;
    text-decoration: none;
    cursor: pointer;
}
button.filing-chip:hover {
    border-color: var(--app-clay);
    color: var(--app-clay);
}
.filing-chip.is-saved {
    border-color: var(--bs-success-border-subtle);
    background: var(--bs-success-bg-subtle);
    color: var(--bs-success-text-emphasis);
}
.filing-chip-text {
    max-width: 22rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.filing-chip.has-suggestion {
    border-color: var(--app-clay);
    color: var(--bs-body-color);
}

/* The attachment card with its SharePoint row underneath (the email view) */
.file-unit {
    display: inline-flex;
    flex-direction: column;
    max-width: 100%;
    min-width: 17rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.8rem;
    background: var(--app-surface, var(--bs-body-bg));
    overflow: hidden;
}
.file-unit > .file-card {
    border: 0;
    border-radius: 0;
    background: transparent;
}
.filing-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.5rem 0.8rem;
    border: 0;
    border-top: 1px solid var(--bs-border-color);
    background: var(--bs-tertiary-bg);
    color: var(--bs-secondary-color);
    font-size: 0.8rem;
    line-height: 1.3;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.filing-row > .bi {
    flex: 0 0 auto;
    font-size: 1.05rem;
}
.filing-row .filing-chip-text {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    white-space: normal;
}
.filing-row .filing-label {
    margin-right: 0.25rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.filing-row .filing-main {
    color: var(--bs-secondary-color);
}
.filing-row .filing-sep {
    margin: 0 0.3rem;
    color: var(--bs-tertiary-color);
}
.filing-row .filing-sub,
.filing-row strong {
    color: var(--bs-body-color);
    font-weight: 600;
}
.filing-row .filing-go {
    flex: 0 0 auto;
    padding: 0.15rem 0.6rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.6rem;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    font-size: 0.75rem;
    white-space: nowrap;
}
button.filing-row:hover {
    background: var(--bs-secondary-bg);
}
button.filing-row:hover .filing-go {
    border-color: var(--app-clay);
    color: var(--app-clay);
}
.filing-row.has-suggestion > .bi {
    color: var(--app-clay);
}
.filing-row.is-saved {
    background: var(--bs-success-bg-subtle);
    color: var(--bs-success-text-emphasis);
}
.filing-row.is-saved strong {
    color: inherit;
}

/* Several attachments: one tidy list, a row per file with its SharePoint state on the same line */
.msg-files-head {
    margin: 0.25rem 0 0.4rem;
}
.msg-files.is-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.8rem;
    background: var(--app-surface, var(--bs-body-bg));
    overflow: hidden;
}
.msg-files.is-list .file-unit {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    min-width: 0;
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--bs-border-color);
    border-radius: 0;
    background: transparent;
}
.msg-files.is-list .file-unit:last-child {
    border-bottom: 0;
}
.msg-files.is-list .file-unit > .file-card {
    flex: 1 1 16rem;
    max-width: none;
    min-width: 0;
}
.msg-files.is-list .file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.msg-files.is-list .filing-row {
    flex: 0 1 auto;
    width: auto;
    max-width: 100%;
    margin: 0.3rem 0.6rem;
    border: 0;
    border-radius: 999px;
    padding: 0.3rem 0.8rem;
}
.msg-files.is-list .file-unit > .file-card {
    flex: 1 1 12rem;
}
.msg-files.is-list .filing-row {
    flex: 0 1 30rem;
    min-width: 0;
}
.msg-files.is-list .filing-row .filing-chip-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.msg-files.is-list .filing-row .filing-go {
    flex: none;
}

/* The notification bell */
.notif-toggle {
    position: relative;
    color: inherit;
}
.notif-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 1.1rem;
    padding: 0 0.25rem;
    border-radius: 999px;
    background: var(--bs-danger);
    color: #fff;
    font-size: 0.68rem;
    line-height: 1.1rem;
    text-align: center;
}
.notif-menu {
    width: 22rem;
    max-width: 92vw;
    padding: 0;
}
.notif-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--bs-border-color);
}
.notif-list {
    max-height: 22rem;
    overflow-y: auto;
}
.notif-empty {
    padding: 1rem 0.9rem;
    color: var(--bs-secondary-color);
    font-size: 0.875rem;
}
.notif-item {
    display: block;
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--bs-border-color);
    color: inherit;
    text-decoration: none;
}
.notif-item:last-child {
    border-bottom: 0;
}
.notif-item:hover {
    background: var(--bs-tertiary-bg);
}
.notif-item.is-unread .notif-title {
    font-weight: 700;
}
.notif-item.is-unread::before {
    content: "";
    float: right;
    width: 0.5rem;
    height: 0.5rem;
    margin: 0.35rem 0 0 0.5rem;
    border-radius: 50%;
    background: var(--bs-primary);
}
.notif-title,
.notif-body,
.notif-time {
    display: block;
}
.notif-body {
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
}
.notif-time {
    font-size: 0.72rem;
    color: var(--bs-secondary-color);
}

/* A choice offered in the project conversation (quick or full answer) */
.pchat-choice {
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.8rem;
    background: var(--app-surface, var(--bs-body-bg));
    font-size: 0.9rem;
}

/* Ask about the project from the inbox's project pane */
.project-ask {
    display: flex;
    gap: 0.5rem;
    margin: 0.9rem 0;
}
.project-ask .form-control {
    flex: 1 1 auto;
    min-width: 0;
}

/* Focus mode: the AI summary above the message and the conversation so far below it */
.focus-ai {
    margin: 0 0 0.9rem;
    padding: 0.8rem 1rem;
    border: 1px solid var(--bs-border-color);
    border-left: 3px solid var(--bs-primary);
    border-radius: 0.6rem;
    background: var(--app-surface, var(--bs-body-bg));
}
.focus-ai.is-preparing {
    color: var(--bs-secondary-color);
    font-size: 0.9rem;
}
.focus-ai-head {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
    font-size: 0.8rem;
}
.focus-ai-title {
    font-weight: 600;
}
.focus-ai-meta {
    color: var(--bs-secondary-color);
}
.focus-ai-summary {
    margin: 0 0 0.4rem;
}
.focus-ai-points {
    margin: 0 0 0.4rem;
    padding-left: 1.2rem;
    font-size: 0.9rem;
}
.focus-ai-warn {
    margin: 0;
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
}
.focus-context {
    margin-top: 1rem;
}
.focus-context-title {
    font-size: 0.95rem;
    margin: 0 0 0.4rem;
}
.focus-context-list {
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.6rem;
    overflow: hidden;
}
.focus-context-list li + li {
    border-top: 1px solid var(--bs-border-color);
}
.focus-context-list a {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.1rem 0.8rem;
    padding: 0.5rem 0.8rem;
    color: inherit;
    text-decoration: none;
}
.focus-context-list a:hover {
    background: var(--bs-tertiary-bg);
}
.focus-context-who {
    font-weight: 600;
    font-size: 0.9rem;
}
.focus-context-date {
    font-size: 0.78rem;
    color: var(--bs-secondary-color);
}
.focus-context-preview {
    grid-column: 1 / -1;
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
}

/* What the attached documents say, in the AI insights and in Focus mode */
.ai-docs {
    margin: 0 0 0.8rem;
    padding: 0;
    list-style: none;
}
.ai-docs li {
    padding: 0.45rem 0.7rem;
    border-left: 3px solid var(--bs-border-color);
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}
.ai-docs strong {
    display: block;
    font-size: 0.82rem;
}
.ai-docs span {
    display: block;
    color: var(--bs-secondary-color);
}

/* The clear (x) in search boxes: a soft round icon in the theme colours instead of the browser's blue cross */
input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    width: 1.15rem;
    height: 1.15rem;
    margin-left: 0.4rem;
    cursor: pointer;
    background-color: var(--bs-secondary-color);
    opacity: 0.55;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0M5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0M5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293z'/%3E%3C/svg%3E") center / contain no-repeat;
}
input[type="search"]::-webkit-search-cancel-button:hover {
    opacity: 1;
    background-color: var(--bs-primary);
}

/* Sort out: one group of unfiled mail at a time */
.sortout .sortout-kind {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
}
.sortout-samples {
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.6rem;
    overflow: hidden;
}
.sortout-samples li {
    padding: 0.45rem 0.8rem;
}
.sortout-samples li + li {
    border-top: 1px solid var(--bs-border-color);
}
.sortout-samples a {
    display: block;
    color: inherit;
    text-decoration: none;
}
.sortout-samples a:hover .sortout-subject {
    text-decoration: underline;
}
.sortout-subject {
    display: block;
    font-size: 0.9rem;
}
.sortout-from {
    display: block;
    font-size: 0.78rem;
    color: var(--bs-secondary-color);
}
.sortout-suggest {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    border-radius: 0.6rem;
    background: var(--bs-tertiary-bg);
    font-size: 0.9rem;
}
.sortout-suggest.is-strong {
    border-left: 3px solid var(--bs-primary);
}

.sortout-careful {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.6rem;
    padding: 0.6rem 0.8rem;
    border-radius: 0.6rem;
    background: color-mix(in srgb, var(--bs-warning) 14%, transparent);
    border-left: 3px solid var(--bs-warning);
    font-size: 0.9rem;
}

.sortout-samples.is-all {
    max-height: 26rem;
    overflow-y: auto;
}

.notif-row {
    position: relative;
    border-bottom: 1px solid var(--bs-border-color);
}
.notif-row:last-child {
    border-bottom: 0;
}
.notif-row .notif-item {
    border-bottom: 0;
    padding-right: 2.2rem;
}
.notif-close {
    position: absolute;
    top: 0.35rem;
    right: 0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--bs-secondary-color);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}
.notif-close:hover {
    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
}

/* Banners: a soft tint, a coloured edge and a small icon, instead of a solid coloured block */
.alert {
    --alert-accent: var(--bs-secondary);
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.75rem 1rem;
    border: 1px solid color-mix(in srgb, var(--alert-accent) 28%, var(--bs-border-color));
    border-left: 4px solid var(--alert-accent);
    border-radius: 0.7rem;
    background: color-mix(in srgb, var(--alert-accent) 9%, var(--bs-body-bg));
    color: var(--bs-body-color);
    font-size: 0.92rem;
    line-height: 1.45;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}
.alert::before {
    flex: none;
    margin-top: 0.05rem;
    font-family: bootstrap-icons;
    font-size: 1.05rem;
    line-height: 1.3;
    color: var(--alert-accent);
    content: "\f430";
}
.alert-success { --alert-accent: var(--bs-success); }
.alert-success::before { content: "\f26a"; }
.alert-danger { --alert-accent: var(--bs-danger); }
.alert-danger::before { content: "\f332"; }
.alert-warning { --alert-accent: var(--bs-warning); }
.alert-warning::before { content: "\f33a"; }
.alert-info,
.alert-primary { --alert-accent: var(--bs-info); }
.alert-secondary,
.alert-light { --alert-accent: var(--bs-secondary); }
.alert > * {
    min-width: 0;
}
.alert .btn-close {
    position: static;
    flex: none;
    margin: 0 0 0 auto;
    padding: 0.35rem;
    font-size: 0.7rem;
    opacity: 0.45;
}
.alert .btn-close:hover {
    opacity: 0.9;
}
.alert-dismissible {
    padding-right: 1rem;
}
.alert a {
    color: inherit;
    text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
}
.alert ul {
    margin: 0;
    padding-left: 1.1rem;
}

/* Icons are plain and neutral: no colour of their own (they take the colour of the text around them) */
.bi,
.alert::before,
.streak-fire {
    color: inherit !important;
}
.alert::before {
    color: var(--bs-secondary-color) !important;
}
.badge .bi,
.btn-primary .bi {
    color: inherit !important;
}

/* The sign-in page */
.login-page {
    min-height: 100vh;
    background:
        radial-gradient(60rem 28rem at 50% -8rem, color-mix(in srgb, var(--bs-primary) 10%, transparent), transparent 70%),
        var(--bs-body-bg);
}
.login-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
}
.login-card {
    width: 100%;
    max-width: 26rem;
    padding: 2.4rem 2rem 2rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 1.2rem;
    background: var(--app-surface, var(--bs-body-bg));
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 18px 40px -18px rgb(0 0 0 / 0.35);
    text-align: center;
}
.login-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.4rem;
    height: 3.4rem;
    margin-bottom: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    background: var(--bs-tertiary-bg);
    font-size: 1.6rem;
}
.login-title {
    margin: 0 0 0.25rem;
    font-size: 1.7rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.login-lead {
    margin: 0 0 1.6rem;
    color: var(--bs-secondary-color);
}
.login-card .alert {
    text-align: left;
    margin-bottom: 1.2rem;
}
.login-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.8rem;
    background: var(--bs-body-color);
    color: var(--bs-body-bg);
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.login-button:hover,
.login-button:focus-visible {
    color: var(--bs-body-bg);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px -10px rgb(0 0 0 / 0.5);
}
.login-points {
    margin: 1.6rem 0 0;
    padding: 1.1rem 0 0;
    border-top: 1px solid var(--bs-border-color);
    list-style: none;
    text-align: left;
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
}
.login-points li {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    margin-bottom: 0.55rem;
}
.login-points li:last-child {
    margin-bottom: 0;
}
.login-points .bi {
    flex: none;
    margin-top: 0.1rem;
}
.login-foot {
    margin: 1.2rem 0 0;
    font-size: 0.78rem;
    color: var(--bs-tertiary-color);
}

/* Clear the day: today's incoming mail, how much of it is cleared */
.today-meter {
    min-width: 11rem;
}
.today-meter-bar {
    height: 0.32rem;
    margin-top: 0.3rem;
    border-radius: 999px;
    background: var(--bs-tertiary-bg);
    overflow: hidden;
}
.today-meter-bar > span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--bs-body-color);
    opacity: 0.75;
    transition: width 0.5s ease;
}
.today-meter.is-caught-up .today-meter-bar > span {
    opacity: 1;
}
.today-meter.is-caught-up [data-today-text] {
    font-weight: 600;
}

/* Sort out: the running total */
.sortout-campaign {
    margin-bottom: 0.8rem;
}
.sortout-campaign-bar {
    height: 0.4rem;
    margin-top: 0.4rem;
    border-radius: 999px;
    background: var(--bs-tertiary-bg);
    overflow: hidden;
}
.sortout-campaign-bar > span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--bs-body-color);
    opacity: 0.75;
    transition: width 0.5s ease;
}

/* Settings, Folder structure: the standard folders, read-only */
.folder-main {
    margin: 0 0 1.1rem;
    padding: 0.8rem 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.8rem;
    background: var(--app-surface, var(--bs-body-bg));
}
.folder-main-title {
    margin: 0 0 0.25rem;
}
.folder-code {
    display: inline-block;
    min-width: 3.1rem;
    font-variant-numeric: tabular-nums;
    color: var(--bs-secondary-color);
}
.folder-subs {
    margin: 0.4rem 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.9rem;
}
.folder-subs li {
    padding: 0.35rem 0;
    border-top: 1px solid var(--bs-border-color);
}
.folder-rule {
    display: block;
    margin-left: 3.1rem;
    font-size: 0.82rem;
    color: var(--bs-secondary-color);
}
