@font-face {
    font-family: "Ubuntu";
    src: url("/fonts/Ubuntu-Regular.ttf") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

:root {
    --color-crm-ink: #111827;
    --color-crm-paper: #f6f7fb;
    --color-crm-line: #d7dce5;
    --color-crm-sky: #0369a1;
    --color-crm-primary: #174ea6;
    --color-crm-navy: #0b2d5b;
    --color-crm-muted: #64748b;
    --color-crm-emerald: #047857;
    --color-crm-amber: #b45309;
}

html,
body {
    min-width: 320px;
    min-height: 100%;
    background: #f6f7fb;
    color: #020617;
    font-family: "Ubuntu", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

button,
input,
select,
textarea,
.font-sans,
.font-serif {
    font-family: "Ubuntu", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

button,
a,
summary {
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

:where(button, a, summary, label[for], [role="button"], input[type="button"], input[type="submit"], input[type="reset"]) {
    cursor: pointer;
}

:where(button:disabled, input:disabled, select:disabled, textarea:disabled, [aria-disabled="true"]) {
    cursor: not-allowed;
}

table {
    border-collapse: collapse;
}

/* Zero-pill discipline */
:where(
    button,
    input,
    select,
    textarea,
    summary,
    section,
    article,
    dialog,
    pre,
    .badge,
    [class*="rounded"]
) {
    border-radius: 0 !important;
}

/* Quill & Ubuntu font */
.crm-mail-editor .ql-editor,
.ql-font-ubuntu {
    font-family: "Ubuntu", Arial, Helvetica, sans-serif !important;
}

.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="ubuntu"]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="ubuntu"]::before {
    content: "Ubuntu";
    font-family: "Ubuntu", Arial, Helvetica, sans-serif !important;
}

.ql-snow .ql-picker.ql-font .ql-picker-label:not([data-value])::before,
.ql-snow .ql-picker.ql-font .ql-picker-item:not([data-value])::before {
    content: "Ubuntu";
}

/* CRM Auth layout */
.crm-auth-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(3, 105, 161, .07), transparent 42%),
        var(--color-crm-paper);
}

.crm-auth-card {
    display: grid;
    width: min(100%, 880px);
    min-height: 440px;
    grid-template-columns: minmax(220px, .72fr) minmax(0, 1.45fr);
    border: 1px solid #dbe2ea;
    background: #fff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .12);
}

.crm-auth-brand {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: #071b35;
    padding: 36px;
    color: #fff;
}

.crm-auth-brand span,
.crm-auth-eyebrow {
    color: #7dd3fc;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .22em;
    text-transform: uppercase;
}

.crm-auth-brand strong {
    margin-top: 10px;
    font-size: 30px;
    font-weight: 900;
}

.crm-auth-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(32px, 6vw, 64px);
}

.crm-auth-content h1 {
    margin: 10px 0 0;
    color: #020617;
    font-size: clamp(26px, 4vw, 36px);
    font-weight: 900;
    line-height: 1.15;
}

.crm-auth-description {
    margin: 16px 0 0;
    color: #475569;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.6;
}

.crm-auth-detail {
    margin-top: 20px;
    border-left: 4px solid #0369a1;
    background: #f1f5f9;
    padding: 14px 16px;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
}

.crm-auth-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
}

.crm-auth-primary,
.crm-auth-secondary {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
    text-decoration: none;
}

.crm-auth-primary {
    border: 1px solid #020617;
    background: #020617;
    color: #fff;
}

.crm-auth-primary:hover {
    background: #1e293b;
    border-color: #1e293b;
}

.crm-auth-secondary {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
}

.crm-auth-secondary:hover {
    background: #f1f5f9;
}

@media (max-width: 680px) {
    .crm-auth-card {
        grid-template-columns: 1fr;
    }

    .crm-auth-brand {
        min-height: 140px;
        padding: 24px;
    }

    .crm-auth-content {
        padding: 28px 20px;
    }
}

/* Blazor validation & error states */
.validation-message {
    color: #dc2626;
    font-size: 0.75rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

.invalid {
    border-color: #dc2626 !important;
}

.valid.modified:not([type=checkbox]) {
    border-color: #16a34a !important;
}

#blazor-error-ui {
    background: #020617;
    bottom: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
}

#blazor-error-ui .reload {
    color: #7dd3fc;
    margin-left: 0.5rem;
    text-decoration: underline;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 0.75rem;
}
/* MailServer shell follows the OAuth navigation and sheet conventions. */
:root {
    --mail-ink: #111827;
    --mail-canvas: #f6f7fb;
    --mail-border: #d7dce5;
    --mail-accent: #0369a1;
    --mail-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
*, *::before, *::after { border-radius: 0 !important; }
html, body { margin: 0; min-width: 320px; }
h1:focus { outline: none; }
:where(a, button, input, select, textarea, summary):focus-visible {
    outline: 2px solid var(--mail-accent) !important;
    outline-offset: 2px;
}
.mail-shell { display: flex; flex-direction: column; min-height: 100dvh; color: var(--mail-ink); background: var(--mail-canvas); }
.mail-topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--mail-border); }
.mail-brand { display: flex; flex-direction: column; margin-right: auto; border-left: 4px solid var(--mail-accent); padding-left: 12px; text-decoration: none; color: var(--mail-ink); }
.mail-brand span, .mail-sidebar-heading span { color: var(--mail-accent); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .15em; }
.mail-brand strong { font-size: 18px; font-weight: 900; }
.mail-modules { display: none; align-self: stretch; gap: 8px; }
.mail-module { display: flex; align-items: center; padding: 0 20px; border-bottom: 3px solid transparent; color: #64748b; font-size: 13px; font-weight: 700; text-decoration: none; }
.mail-module:hover, .mail-module.is-active { color: var(--mail-accent); background: var(--mail-canvas); border-bottom-color: var(--mail-accent); }
.mail-icon-button, .mail-outline-button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; border: 1px solid var(--mail-border); padding: 6px 12px; background: #fff; color: var(--mail-ink); font-size: 13px; font-weight: 700; }
.mail-icon-button { width: 36px; flex: none; font-size: 22px; }
.mail-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; display: flex; flex-direction: column; width: min(272px, calc(100vw - 48px)); height: 100dvh; background: #fff; border-right: 1px solid var(--mail-border); transform: translateX(-100%); visibility: hidden; }
.mail-sidebar.is-open { transform: translateX(0); visibility: visible; }
.mail-sidebar-heading { display: flex; justify-content: space-between; gap: 12px; padding: 20px; border-bottom: 1px solid var(--mail-border); }
.mail-sidebar-heading div { display: flex; flex-direction: column; gap: 8px; }
.mail-sidebar-heading strong { color: #0b2d5b; font-size: 18px; font-weight: 900; }
.mail-side-links { flex: 1; min-height: 0; padding: 12px; overflow-y: auto; }
.mail-side-link { display: flex; align-items: center; min-height: 38px; border-left: 3px solid transparent; padding: 8px 12px; color: #64748b; font-size: 13px; font-weight: 700; text-decoration: none; }
.mail-side-link:hover { background: var(--mail-canvas); color: var(--mail-ink); border-left-color: var(--mail-accent); }
.mail-side-link.is-active { background: var(--mail-canvas); color: var(--mail-accent); border-left-color: var(--mail-accent); font-weight: 900; }
.mail-mobile-modules summary { padding: 12px; font-size: 14px; font-weight: 900; cursor: pointer; }
.mail-mobile-modules details > .mail-side-link { margin-left: 12px; }
.mail-desktop-links { display: none; }
.mail-account { display: flex; flex-direction: column; gap: 8px; padding: 20px; border-top: 1px solid var(--mail-border); font-size: 12px; }
.mail-account > span { color: #64748b; }
.mail-account form, .mail-account button { width: 100%; }
.mail-backdrop { position: fixed; inset: 0; z-index: 50; background: #11182799; border: none; }
.mail-content { min-width: 0; }
.mail-content-inner { width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px; }
.mail-shell h1 { color: #0b2d5b; }
.mail-content :is(table, [class*="sheet"], .mailbox-messages) { min-width: 0; }
.mail-content table { width: 100%; border-collapse: collapse; font-size: 12px; }
.mail-content th { height: 36px; background: var(--mail-canvas); color: #64748b; text-align: left; text-transform: uppercase; font-weight: 900; font-size: 11px; }
.mail-content :is(td, th) { padding: 6px 12px; border-right: 1px solid var(--mail-border); border-bottom: 1px solid var(--mail-border); }
.mail-content :is(td, td input, td select, td textarea, .mail-data-row, .mail-data-row input) { font-family: var(--mail-mono) !important; }
.mail-content tbody tr:hover, .mail-data-row:hover { background: var(--mail-canvas); }
.mail-table-scroll { max-height: min(600px, 65dvh); overflow: auto; scrollbar-gutter: stable; overscroll-behavior: contain; border-top: 1px solid var(--mail-border); }
.mail-table-header { display: grid; grid-template-columns: minmax(170px, 4fr) minmax(150px, 3fr) 105px 155px 85px; min-width: 720px; position: sticky; top: 0; z-index: 2; background: var(--mail-canvas); border-bottom: 1px solid var(--mail-border); font-size: 11px; font-weight: 900; text-transform: uppercase; color: #64748b; }
.mail-table-header > div, .mail-data-row > div { padding: 8px 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-right: 1px solid var(--mail-border); }
.mail-data-row { display: grid; grid-template-columns: minmax(170px, 4fr) minmax(150px, 3fr) 105px 155px 85px; min-width: 720px; height: 52px; align-items: center; border-bottom: 1px solid var(--mail-border); font-size: 12px; }
.mail-shell :is(.mail-table-scroll, .mail-side-links, .mail-modal .modal-body, .mailbox-messages) { scrollbar-width: thin; scrollbar-color: #94a3b8 #f1f5f9; }
.mail-shell ::-webkit-scrollbar { width: 8px; height: 8px; }
.mail-shell ::-webkit-scrollbar-thumb { background: #94a3b8; border: 2px solid #f1f5f9; }
.mail-shell ::-webkit-scrollbar-track { background: #f1f5f9; }
@media (max-width: 639px) { .mail-content-inner { padding: 16px; } }
@media (min-width: 1278px) {
    .mail-shell { display: grid; grid-template-columns: 256px minmax(0, 1fr); grid-template-rows: 72px 1fr; }
    .mail-topbar { grid-column: 1 / -1; }
    .mail-sidebar { grid-column: 1; grid-row: 2; position: sticky; top: 72px; width: 256px; height: calc(100dvh - 72px); visibility: visible; transform: none; z-index: 20; }
    .mail-content { grid-column: 2; grid-row: 2; }
    .mail-modules { display: flex; }
    .mail-desktop-links { display: block; }
    .mail-mobile-only, .mail-mobile-modules, .mail-backdrop { display: none; }
}

/* Mailbox folder selection follows the same route selection colours. */
.mail-content [aria-current="page"] { background: var(--mail-canvas) !important; color: var(--mail-accent) !important; box-shadow: inset 3px 0 var(--mail-accent); }

.mail-mobile-modules summary { list-style: none; display: flex; align-items: center; justify-content: space-between; }
.mail-mobile-modules summary::-webkit-details-marker { display: none; }
.mail-mobile-modules summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-right: 4px; }
.mail-mobile-modules details[open] > summary::after { transform: rotate(225deg); }

.mail-table-scroll table { min-width: 720px; }
.mail-table-scroll thead { position: sticky; top: 0; z-index: 2; }
.mail-content .badge { display: inline-flex; align-items: center; padding: 2px 6px; border: 1px solid var(--mail-border); font-size: 11px; }
.mail-content .text-bg-success { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.mail-content .text-bg-secondary { background: #f1f5f9; color: #64748b; }
