:root {
    color-scheme: light;
    --font-sans: "Segoe UI Variable", "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    --ink: #172033;
    --ink-soft: #334155;
    --muted: #475569;
    --muted-strong: #334155;
    --line: #d8e1ea;
    --line-strong: #7c8da1;
    --line-hover: #94a3b8;
    --canvas: #f5f7fa;
    --panel: #ffffff;
    --panel-soft: #f1f5f9;
    --surface-hover: #f8fafc;
    --brand: #2563eb;
    --brand-hover: #1d4ed8;
    --brand-soft: #eff6ff;
    --brand-line: #bfdbfe;
    --sidebar-bright: #1e3a8a;
    --sidebar: #172033;
    --sidebar-deep: #0f172a;
    --sidebar-line: color-mix(in srgb, var(--shell-tint) 16%, transparent);
    --sidebar-text: #f8fafc;
    --sidebar-muted: var(--shell-tint);
    --accent: #93c5fd;
    --accent-ink: #1d4ed8;
    --info: #1d4ed8;
    --info-soft: #eff6ff;
    --info-line: #bfdbfe;
    --info-hover: #dbeafe;
    --process: #0f766e;
    --process-soft: #f0fdfa;
    --process-line: #99f6e4;
    --success: #047857;
    --success-soft: #ecfdf5;
    --success-line: #a7f3d0;
    --warning: #b45309;
    --warning-soft: #fffbeb;
    --warning-line: #fde68a;
    --danger: #b91c1c;
    --danger-soft: #fef2f2;
    --danger-line: #fecaca;
    --note: #6d28d9;
    --note-soft: #f5f3ff;
    --note-line: #ddd6fe;
    --neutral-soft: #f1f5f9;
    --neutral-ink: #475569;
    --neutral-line: #cbd5e1;
    --placeholder: #64748b;
    /* Filled actions and markers with white text; the dark theme keeps them blue while --brand turns light. */
    --workspace-action-bg: var(--brand);
    --workspace-action-hover: var(--brand-hover);
    --workspace-action-ink: #ffffff;
    --workspace-note-bg: var(--note);
    --workspace-note-ink: #ffffff;
    --workspace-danger-bg: var(--danger);
    /* Quiet surfaces inside cards: table and list heads, meta tiles, code. */
    --surface-subtle: #f8fafc;
    --shadow-xs: 0 1px 2px rgba(23, 32, 51, .04);
    --shadow-sm: 0 8px 24px rgba(23, 32, 51, .07);
    --shadow-lg: 0 28px 70px rgba(15, 23, 42, .16);
    --radius-sm: 9px;
    --radius-md: 13px;
    --radius-lg: 18px;
    --focus-ring-color: #2563eb;
    --focus: 0 0 0 3px var(--focus-ring-color);
    --app-content-max-width: 1920px;
    /* Personalizacja → Kolor: workspace-accents.css swaps the brand, bar and canvas tokens per account.
       Links follow the brand except in Grafit, where grey links would read as plain text. */
    --link: var(--brand);
    --link-hover: var(--brand-hover);
    /* Gradient ends next to --brand. */
    --brand-vivid: #60a5fa;
    /* Light text and lines on the coloured top bar. */
    --shell-tint: #bfdbfe;
}

* { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font: 14px/1.55 var(--font-sans);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

a {
    color: var(--link);
    text-decoration: none;
}

a:hover { color: var(--link-hover); }

:where(
    a[href],
    button,
    input,
    select,
    textarea,
    summary,
    [contenteditable="true"],
    [tabindex]:not([tabindex="-1"])
):focus-visible {
    outline: 3px solid var(--focus-ring-color, #2563eb) !important;
    outline-offset: 2px !important;
}

/* Text fields draw a 2px ring over their own border, like the message editor; a detached 3px ring read as a second, heavy frame. */
:where(
    input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="button"], [type="submit"], [type="reset"], [type="image"]),
    select,
    textarea
):focus-visible {
    outline-width: 2px !important;
    outline-offset: -1px !important;
}

@media (forced-colors: active) {
    :where(
        a[href],
        button,
        input,
        select,
        textarea,
        summary,
        [contenteditable="true"],
        [tabindex]:not([tabindex="-1"])
    ):focus-visible {
        box-shadow: none !important;
        outline-color: Highlight !important;
    }
}

img,
svg { display: block; }

.icon { flex: 0 0 auto; }

h1,
h2,
h3,
p { overflow-wrap: anywhere; }

h1 {
    margin: 0;
    font-size: clamp(1.75rem, 2.5vw, 2.2rem);
    font-weight: 720;
    letter-spacing: -.045em;
    line-height: 1.12;
}

h2 {
    margin: 0;
    font-size: 1.18rem;
    font-weight: 700;
    letter-spacing: -.025em;
    line-height: 1.28;
}

h3 {
    margin: 0;
    font-size: .98rem;
    font-weight: 700;
}

code {
    font-family: var(--font-mono);
    font-size: .9em;
}

.skip-link {
    position: fixed;
    z-index: 100;
    top: 12px;
    left: 12px;
    transform: translateY(-150%);
    border-radius: var(--radius-sm);
    background: var(--panel);
    box-shadow: var(--shadow-lg);
    color: var(--ink);
    font-weight: 700;
    padding: 10px 14px;
}

.skip-link:focus { transform: translateY(0); }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 1.14rem;
    font-weight: 760;
    letter-spacing: -.035em;
}

.brand:hover { color: #fff; }

.app-toolbar {
    display: flex;
    width: 100%;
    max-width: var(--app-content-max-width);
    min-height: 58px;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel);
    box-shadow: var(--shadow-xs);
    margin: 0 auto 26px;
    padding: 7px 8px 7px 16px;
}

.app-toolbar-start,
.app-toolbar-end {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
}

.app-toolbar-start { flex: 1 1 0; }

.app-toolbar-end {
    flex: 0 1 auto;
    margin-left: auto;
}

.app-toolbar-label {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 760;
    letter-spacing: .08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.account-menu { position: relative; }

.account-trigger {
    display: grid;
    min-width: min(290px, calc(100vw - 40px));
    align-items: center;
    gap: 10px;
    grid-template-columns: 34px minmax(0, 1fr) 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: var(--shadow-xs);
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    padding: 7px 10px 7px 8px;
    text-align: left;
    transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.account-trigger:hover,
.account-trigger:focus-visible {
    border-color: var(--brand-line);
    background: var(--panel-soft);
    box-shadow: var(--shadow-sm);
}

.account-avatar,
.avatar {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 760;
    letter-spacing: -.02em;
}

.account-avatar {
    width: 34px;
    height: 34px;
    background: var(--brand-soft);
    color: var(--brand);
}

.account-copy {
    display: grid;
    min-width: 0;
}

.account-copy strong,
.account-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-copy strong {
    color: var(--ink);
    font-size: .8rem;
    font-weight: 650;
}

.account-copy small {
    color: var(--muted);
    font-size: .7rem;
}

.account-popover {
    position: absolute;
    z-index: 40;
    top: calc(100% + 8px);
    right: 0;
    width: min(240px, calc(100vw - 40px));
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: var(--shadow-lg);
    padding: 6px;
}

.account-menu-link {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    font-size: .84rem;
    font-weight: 620;
    padding: 10px;
    text-align: left;
}

.account-menu-link:hover,
.account-menu-link:focus-visible {
    background: var(--brand-soft);
    color: var(--brand);
}

.account-popover form {
    border-top: 1px solid var(--line);
    margin-top: 4px;
    padding-top: 4px;
}

.account-avatar { position: relative; }

/* Unread „Aktualizacje”: a dot on the avatar and a badge on the menu link. */
.account-updates-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    /* The avatar itself is brand blue, so the dot uses the lighter accent. */
    background: var(--accent);
    box-shadow: 0 0 0 2px var(--sidebar);
}

.account-menu-badge {
    margin-left: auto;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: .68rem;
    font-weight: 720;
    line-height: 1;
    padding: 4px 8px;
}

.account-menu-logout { color: var(--danger); }

.account-menu-logout:hover,
.account-menu-logout:focus-visible {
    background: var(--danger-soft);
    color: var(--danger);
}

.icon-button {
    display: grid;
    border: 0;
    place-items: center;
    border-radius: 9px;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.app-main {
    min-width: 0;
    padding: 36px clamp(24px, 4vw, 58px) 64px;
}

.page {
    width: 100%;
    max-width: var(--app-content-max-width);
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.page-header-copy { min-width: 0; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--brand);
    font-size: .69rem;
    font-weight: 760;
    letter-spacing: .1em;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.eyebrow-inverse { color: var(--accent); }

.lead {
    max-width: 680px;
    color: var(--muted);
    font-size: .94rem;
    margin: 7px 0 0;
}

.muted { color: var(--muted); }

.page-actions,
.form-actions,
.inline-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
}

.button {
    display: inline-flex;
    min-height: 41px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--workspace-action-bg);
    border-radius: 10px;
    background: var(--workspace-action-bg);
    box-shadow: var(--shadow-xs);
    color: var(--workspace-action-ink);
    cursor: pointer;
    font-weight: 680;
    line-height: 1.2;
    padding: 9px 14px;
    transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.button:hover {
    border-color: var(--workspace-action-hover);
    background: var(--workspace-action-hover);
    color: var(--workspace-action-ink);
    box-shadow: 0 5px 14px color-mix(in srgb, var(--workspace-action-hover) 18%, transparent);
}

.button:active { transform: translateY(1px); }

.button.secondary {
    border-color: var(--line-strong);
    background: var(--panel);
    color: var(--ink-soft);
}

.button.secondary:hover {
    border-color: var(--line-hover);
    background: var(--panel-soft);
    color: var(--ink);
    box-shadow: var(--shadow-xs);
}

.button.danger {
    border-color: var(--danger-line);
    background: var(--panel);
    color: var(--danger);
}

.button.small {
    min-height: 35px;
    font-size: .8rem;
    padding: 7px 11px;
}

.button.full { width: 100%; }

button:disabled {
    cursor: wait;
    opacity: .62;
}

.card {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel);
    box-shadow: var(--shadow-xs);
}

.card-body { padding: 24px; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
    padding: 18px 22px;
}

.stack {
    display: grid;
    gap: 17px;
}

.stack.tight { gap: 11px; }

.grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
}

.form-card { max-width: 780px; }

.form-card-wide { max-width: 920px; }

.form-intro {
    display: flex;
    gap: 14px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 20px;
}

.form-intro-icon,
.empty-icon,
.mailbox-icon {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand);
}

.form-intro-icon {
    width: 42px;
    height: 42px;
}

.form-intro p { margin: 4px 0 0; }

label {
    display: inline-block;
    color: var(--ink-soft);
    font-size: .8rem;
    font-weight: 680;
    margin-bottom: 7px;
}

.field-hint {
    color: var(--muted);
    font-size: .74rem;
    margin: 6px 0 0;
}

input,
textarea,
select {
    display: block;
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    outline: 0;
    background: var(--panel);
    color: var(--ink);
    padding: 10px 12px;
    transition: border-color 130ms ease, box-shadow 130ms ease, background-color 130ms ease;
}

input,
select { min-height: 43px; }

textarea {
    min-height: 190px;
    line-height: 1.6;
    resize: vertical;
}

input:hover,
textarea:hover,
select:hover { border-color: var(--line-hover); }

input:focus,
textarea:focus,
select:focus { border-color: var(--brand); }

input::placeholder,
textarea::placeholder { color: var(--placeholder); }

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--muted-strong);
    font-weight: 520;
    margin: 0;
}

.checkbox-label input {
    width: 17px;
    height: 17px;
    min-height: 0;
    accent-color: var(--brand);
}

.field-error {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--danger);
    font-size: .76rem;
    margin: 6px 0 0;
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
    border: 1px solid;
    border-radius: 11px;
    padding: 11px 13px;
}

.alert.success {
    border-color: var(--success-line);
    background: var(--success-soft);
    color: var(--success);
}

.alert.error {
    border-color: var(--danger-line);
    background: var(--danger-soft);
    color: var(--danger);
}

.alert[data-flash-success] {
    flex-wrap: wrap;
}

.alert[data-flash-success] > span {
    min-width: 0;
    flex: 1 1 240px;
}

.flash-undo-form {
    display: flex;
    flex: 0 0 auto;
    align-self: center;
    margin-left: auto;
}

.flash-undo-form .flash-undo-button {
    border-color: var(--success-line);
    background: var(--panel);
    color: var(--success);
    box-shadow: var(--shadow-xs);
}

.flash-undo-form .flash-undo-button:hover {
    border-color: var(--success);
    background: var(--panel);
    color: var(--success);
    box-shadow: 0 5px 14px rgba(4, 120, 87, .14);
}

.empty {
    display: grid;
    min-height: 310px;
    place-items: center;
    padding: 48px 24px;
    text-align: center;
}

.empty-content {
    display: grid;
    max-width: 510px;
    justify-items: center;
}

.empty-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 18px;
    border: 1px solid var(--brand-line);
}

.empty p {
    color: var(--muted);
    margin: 8px auto 21px;
}

.filters {
    display: flex;
    overflow-x: auto;
    gap: 7px;
    margin-bottom: 15px;
    padding: 1px 1px 3px;
    scrollbar-width: none;
}

.filters::-webkit-scrollbar { display: none; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.table-scroll-region {
    overflow-x: auto;
}

.table-scroll-region:focus-visible {
    outline: 3px solid var(--brand);
    outline-offset: 3px;
}

.filter {
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .74);
    color: var(--muted-strong);
    font-size: .78rem;
    font-weight: 580;
    padding: 6px 11px;
}

.filter:hover {
    border-color: var(--line-strong);
    background: var(--panel);
    color: var(--ink);
}

.filter.active {
    border-color: var(--brand-line);
    background: var(--brand-soft);
    color: var(--brand-hover);
    font-weight: 690;
}

.mailbox-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.mailbox-card {
    display: grid;
    min-width: 0;
    align-items: center;
    gap: 14px;
    grid-template-columns: 46px minmax(0, 1fr) 24px;
    color: var(--ink);
    padding: 20px;
    transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.mailbox-grid .mailbox-card {
    grid-template-columns: 46px minmax(0, 1fr) max-content;
}

.mailbox-grid .mailbox-type { justify-self: end; }

.mailbox-card:hover {
    border-color: var(--brand-line);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.mailbox-icon {
    width: 46px;
    height: 46px;
}

.mailbox-copy {
    display: grid;
    min-width: 0;
}

.mailbox-copy strong,
.mailbox-copy span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mailbox-copy strong {
    font-size: .96rem;
    letter-spacing: -.015em;
}

.mailbox-copy span {
    color: var(--muted);
    font-size: .78rem;
    margin-top: 2px;
}

.mailbox-card > .icon { color: var(--line-hover); }

.inbox-card { overflow: hidden; }

.inbox-toolbar {
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
    background: var(--panel-soft);
    color: var(--muted);
    font-size: .76rem;
    padding: 10px 18px;
}

.inbox-toolbar strong { color: var(--ink-soft); }

.conversation-row {
    display: grid;
    min-width: 0;
    align-items: center;
    gap: 14px;
    grid-template-columns: 40px minmax(155px, .75fr) minmax(240px, 1.5fr) auto 94px 18px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    padding: 14px 18px;
    transition: background-color 120ms ease;
}

.conversation-row:last-child { border-bottom: 0; }

.conversation-row:hover {
    background: var(--surface-hover);
    color: var(--ink);
}

.avatar {
    width: 38px;
    height: 38px;
    font-size: .78rem;
}

.conversation-customer,
.conversation-topic {
    display: grid;
    min-width: 0;
}

.conversation-customer strong,
.conversation-customer small,
.conversation-topic strong,
.conversation-topic small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-customer strong,
.conversation-topic strong {
    color: var(--ink);
    font-size: .84rem;
}

.conversation-customer small,
.conversation-topic small {
    color: var(--muted);
    font-size: .72rem;
    margin-top: 2px;
}

.conversation-topic strong { font-weight: 650; }

.conversation-row time {
    color: var(--muted);
    font-size: .72rem;
    text-align: right;
    white-space: nowrap;
}

.conversation-arrow { color: var(--line-hover); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .69rem;
    font-weight: 690;
    line-height: 1;
    padding: 6px 9px;
    white-space: nowrap;
}

.badge::before {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

.badge.active {
    border-color: var(--process-line);
    background: var(--process-soft);
    color: var(--process);
}

.badge.pending {
    border-color: var(--warning-line);
    background: var(--warning-soft);
    color: var(--warning);
}

.badge.closed {
    border-color: var(--success-line);
    background: var(--success-soft);
    color: var(--success);
}

.badge.spam {
    border-color: var(--neutral-line);
    background: var(--neutral-soft);
    color: var(--neutral-ink);
}

.badge.trash {
    border-color: var(--danger-line);
    background: var(--danger-soft);
    color: var(--danger);
}

.contact-labels {
    display: inline-flex;
    max-width: 100%;
    min-width: 0;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    vertical-align: middle;
}

.conversation-tag--contact svg {
    flex: 0 0 auto;
    color: var(--tag-dot);
}

.contact-label-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.contact-label-option {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    margin: 0;
}

.contact-label-option input {
    width: 17px;
    height: 17px;
    min-height: 0;
    flex: 0 0 auto;
    padding: 0;
    accent-color: var(--brand);
}

.contact-label-fieldset-hint {
    margin: 8px 0 0;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 16px;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 620;
}

/* Shared markup of $paginator->links() (resources/views/partials/pagination*.blade.php). */
.app-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin-top: 16px;
}

.app-pagination:first-child { margin-top: 0; }

.app-pagination-summary {
    margin: 0;
    color: var(--muted);
    font-size: .78rem;
    font-variant-numeric: tabular-nums;
}

.app-pagination-summary strong {
    color: var(--ink-soft);
    font-weight: 650;
}

.app-pagination-controls,
.app-pagination-pages {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.app-pagination-controls { margin-left: auto; }

.app-pagination-step,
.app-pagination-page {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--panel);
    color: var(--ink-soft);
    font-size: .8rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 6px 11px;
    text-decoration: none;
}

.app-pagination-page {
    min-width: 36px;
    padding-inline: 8px;
    font-variant-numeric: tabular-nums;
}

.app-pagination a:hover {
    border-color: var(--brand-line);
    background: var(--brand-soft);
    color: var(--brand-hover);
    text-decoration: none;
}

.app-pagination-page[aria-current="page"] {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand-hover);
}

.app-pagination-step[aria-disabled="true"] {
    border-color: transparent;
    background: transparent;
    color: var(--muted);
}

.app-pagination-gap {
    min-width: 14px;
    color: var(--muted);
    text-align: center;
}

.app-pagination .icon { flex: 0 0 auto; }

@media (max-width: 560px) {
    .app-pagination { justify-content: center; }
    .app-pagination-summary { width: 100%; text-align: center; }
    .app-pagination-controls { justify-content: center; margin-left: 0; }
    .app-pagination-step { padding-inline: 9px; }
    .app-pagination-step-label { display: none; }
}

@media print {
    .app-pagination-controls { display: none; }
}

.conversation-header { margin-bottom: 22px; }

.breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: .77rem;
    margin-bottom: 9px;
}

.breadcrumb .icon { color: var(--line-hover); }

.conversation-layout {
    display: grid;
    align-items: start;
    gap: 20px;
    grid-template-columns: minmax(0, 1fr) 270px;
}

.conversation-main {
    display: grid;
    min-width: 0;
    gap: 16px;
}

.timeline {
    display: grid;
    gap: 13px;
}

.message {
    overflow: hidden;
    border-left: 3px solid var(--neutral-line);
}

.message.agent { border-left-color: var(--process); }

.message.customer { border-left-color: var(--info); }

.message.note {
    border-left-color: var(--note);
    background: var(--note-soft);
}

.message.system { border-left-color: var(--neutral-ink); }

.message-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
    background: var(--panel-soft);
    padding: 13px 18px;
}

.message.note .message-head {
    border-bottom-color: var(--note-line);
    background: var(--note-soft);
}

.message-author {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
}

.message-author .avatar {
    width: 32px;
    height: 32px;
    font-size: .69rem;
}

.message-author-copy {
    display: grid;
    min-width: 0;
}

.message-author-copy strong {
    overflow: hidden;
    font-size: .8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-author-copy small {
    color: var(--muted);
    font-size: .68rem;
}

.message-head time {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: .7rem;
}

.message-content { padding: 20px; }

.message-body {
    color: var(--ink-soft);
    font-size: .88rem;
    line-height: 1.68;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.message-html {
    min-width: 0;
    max-width: 100%;
    color: var(--ink-soft);
    line-height: 1.68;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}

.message-html > :first-child { margin-top: 0; }

.message-html > :last-child { margin-bottom: 0; }

.message-html p { margin: 0 0 1em; }

.message-html h1,
.message-html h2,
.message-html h3,
.message-html h4,
.message-html h5,
.message-html h6 {
    color: var(--ink);
    font-weight: 720;
    letter-spacing: -.02em;
    line-height: 1.28;
    margin: 1.45em 0 .62em;
    overflow-wrap: anywhere;
}

.message-html h1 { font-size: 1.45rem; }
.message-html h2 { font-size: 1.28rem; }
.message-html h3 { font-size: 1.12rem; }
.message-html h4 { font-size: 1rem; }
.message-html h5,
.message-html h6 { font-size: .9rem; }

.message-html ul,
.message-html ol {
    margin: 1em 0;
    padding-left: 1.45em;
}

.message-html li + li { margin-top: .32em; }

.message-html li > ul,
.message-html li > ol { margin: .4em 0 .2em; }

.message-html li::marker { color: #709087; }

.message-html a {
    color: var(--link);
    overflow-wrap: anywhere;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    word-break: break-word;
}

.message-html a:hover { color: var(--link-hover); }

.message-html a:focus-visible {
    border-radius: 3px;
    box-shadow: var(--focus);
    outline: 0;
}

.message-html blockquote {
    margin: 1.15em 0;
    border-left: 3px solid #b9d8cb;
    background: var(--panel-soft);
    color: var(--muted-strong);
    padding: .72em 1em;
}

.message-html blockquote > :first-child { margin-top: 0; }

.message-html blockquote > :last-child { margin-bottom: 0; }

.message-html .message-quoted {
    margin: 1.15em 0;
    border: 1px solid #d4e3dc;
    border-radius: var(--radius-sm);
    background: var(--panel-soft);
    color: var(--muted-strong);
}

.message-html .message-quoted__label,
.message-html details.message-quoted > summary {
    margin: 0;
    color: var(--ink-soft);
    font-size: .82em;
    font-weight: 650;
    padding: .72em 1em;
}

.message-html .message-quoted__label,
.message-html details.message-quoted[open] > summary {
    border-bottom: 1px solid #d4e3dc;
}

/* Folded on the reader's choice in Personalizacja. */
.message-html details.message-quoted > summary {
    cursor: pointer;
    user-select: none;
}

.message-html .message-quoted__hide { display: none; }

.message-html details.message-quoted[open] .message-quoted__show { display: none; }

.message-html details.message-quoted[open] .message-quoted__hide { display: inline; }

.message-html details.message-quoted > summary:focus-visible {
    border-radius: var(--radius-sm);
    box-shadow: var(--focus);
    outline: 0;
}

.message-html .message-quoted__content {
    padding: .9em 1em;
}

.message-html .message-quoted__content > :first-child { margin-top: 0; }

.message-html .message-quoted__content > :last-child { margin-bottom: 0; }

.message-html .message-quoted__content > blockquote {
    margin: 0;
    border-left: 0;
    background: transparent;
    padding: 0;
}

/* The sender's signature, folded on the reader's choice in Personalizacja. */
.message-html details.message-signature {
    margin: 1em 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel-soft);
    color: var(--muted-strong);
}

.message-html details.message-signature > summary {
    cursor: pointer;
    color: var(--ink-soft);
    font-size: .82em;
    font-weight: 650;
    padding: .64em .9em;
    user-select: none;
}

.message-html details.message-signature[open] > summary {
    border-bottom: 1px solid var(--line);
}

.message-html .message-signature__hide { display: none; }

.message-html details.message-signature[open] .message-signature__show { display: none; }

.message-html details.message-signature[open] .message-signature__hide { display: inline; }

.message-html details.message-signature > summary:focus-visible {
    border-radius: var(--radius-sm);
    box-shadow: var(--focus);
    outline: 0;
}

.message-html .message-signature__content {
    padding: .78em .9em;
}

.message-html .message-signature__content > :first-child { margin-top: 0; }

.message-html .message-signature__content > :last-child { margin-bottom: 0; }

.message-html .message-plain-text {
    white-space: pre-wrap;
}

.message-html hr {
    height: 1px;
    margin: 1.5em 0;
    border: 0;
    background: var(--line);
}

.message-html pre {
    max-width: 100%;
    overflow: visible;
    overflow-wrap: anywhere;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #f3f6f5;
    color: var(--ink-soft);
    font: .84em/1.58 var(--font-mono);
    padding: .85em 1em;
    tab-size: 4;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-html code {
    border-radius: 4px;
    background: #edf3f0;
    color: var(--ink-soft);
    font-family: var(--font-mono);
    font-size: .9em;
    overflow-wrap: anywhere;
    padding: .1em .28em;
    word-break: break-word;
}

.message-html pre code {
    border-radius: 0;
    background: transparent;
    color: inherit;
    font-size: inherit;
    overflow-wrap: inherit;
    padding: 0;
    white-space: inherit;
    word-break: inherit;
}

.message-html table {
    display: table;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    table-layout: fixed;
    border: 1px solid var(--line);
    border-collapse: separate;
    border-radius: var(--radius-sm);
    border-spacing: 0;
    background: var(--panel);
}

.message-html thead {
    background: #f1f6f3;
    color: var(--ink-soft);
}

.message-html tbody { background: var(--panel); }

.message-html tbody tr:nth-child(even) { background: #fbfcfb; }

.message-html th,
.message-html td {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    padding: .65rem .75rem;
    text-align: left;
    vertical-align: top;
    white-space: normal;
    word-break: break-word;
}

.message-html th {
    font-size: .78em;
    font-weight: 720;
}

.message-html tr > * + * { border-left: 1px solid var(--line); }

.message-html tbody tr + tr > * { border-top: 1px solid var(--line); }

.message-html img {
    max-width: 100%;
    height: auto;
}

.message-remote-images {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 20px 18px;
    border: 1px solid #d4e3dc;
    border-radius: var(--radius-sm);
    background: var(--panel-soft);
    color: var(--muted-strong);
    font-size: .78rem;
    padding: 10px 12px;
}

.message-remote-image-trust {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin: 0 20px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fbfcfb;
    color: var(--muted-strong);
    font-size: .78rem;
    padding: 10px 12px;
}

.message-remote-image-trust > span { flex-basis: 100%; }

.message-remote-images form { margin: 0; }

.message-remote-image-trust form { margin: 0; }

@media (max-width: 640px) {
    .message-html table { font-size: .92em; }

    .message-html th,
    .message-html td {
        min-width: 0;
        padding: .55rem .62rem;
    }
}

.attachments {
    margin-top: 18px;
    border-top: 1px solid var(--line);
    padding-top: 15px;
}

.attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 9px;
}

.attachment-chip {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--panel-soft);
    color: var(--ink-soft);
    font-size: .75rem;
    padding: 7px 9px;
}

.attachment-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-attachment-toolbar {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.message-attachment-toolbar > strong { min-width: 0; }

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

.message-attachment-item {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--panel-soft);
    padding: 5px 8px;
}

.message-attachment-header,
.message-attachment-meta {
    display: flex;
    min-width: 0;
    align-items: center;
}

.message-attachment-header {
    justify-content: space-between;
    gap: 8px;
}

.message-attachment-meta {
    flex: 1 1 auto;
    gap: 7px;
}

.message-attachment-meta > .icon {
    flex: 0 0 auto;
    color: var(--muted-strong);
}

.message-attachment-copy {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 1px 6px;
}

.message-attachment-name {
    min-width: 0;
    max-width: 100%;
    color: var(--ink-soft);
    font-size: .76rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

a.message-attachment-name {
    color: var(--ink-soft);
    text-decoration: none;
}

a.message-attachment-name:hover {
    color: var(--brand);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.message-attachment-copy small {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: .66rem;
    white-space: nowrap;
}

.message-attachment-actions {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
}

.message-attachment-download {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--ink-soft);
    cursor: pointer;
    font-size: .69rem;
    font-weight: 700;
    line-height: 1;
    padding: 6px 9px;
    text-decoration: none;
}

.message-attachment-download { flex: 0 0 auto; }

.message-attachment-download-all {
    max-width: 100%;
    text-align: center;
}

.message-attachment-download:hover {
    border-color: var(--brand-line);
    color: var(--brand);
}

.message-attachment-download:focus-visible {
    box-shadow: var(--focus);
    outline: 0;
}

@media (max-width: 680px) {
    .message-attachment-toolbar {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .message-attachment-download-all { margin-left: auto; }

    .message-attachment-header {
        align-items: flex-start;
        flex-wrap: wrap;
        row-gap: 6px;
    }

    /* A long name keeps its line; the preview and download buttons move below it. */
    .message-attachment-meta { flex-basis: 180px; }

    .message-attachment-actions { margin-left: auto; }
}

.delivery {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    color: var(--muted);
    font-size: .7rem;
    margin-top: 14px;
}

.reply-card {
    position: sticky;
    bottom: 18px;
    z-index: 3;
    box-shadow: 0 18px 42px rgba(23, 32, 51, .1);
}

.reply-card .card-body { padding: 20px; }

.reply-heading {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 14px;
}

.reply-form textarea {
    min-height: 145px;
    border-color: transparent;
    background: var(--panel-soft);
    box-shadow: inset 0 0 0 1px var(--line);
}

.reply-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 9px;
}

.side-card {
    position: sticky;
    top: 24px;
    overflow: hidden;
}

.side-card-section { padding: 18px; }

.side-card-section + .side-card-section { border-top: 1px solid var(--line); }

.side-card dl { margin: 0; }

.detail-row {
    display: grid;
    gap: 2px;
    margin-top: 14px;
}

.detail-row:first-child { margin-top: 0; }

.detail-row dt {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: .68rem;
    font-weight: 650;
}

.detail-row dd {
    margin: 0;
    color: var(--ink-soft);
    font-size: .8rem;
    font-weight: 560;
    overflow-wrap: anywhere;
}

.security-layout {
    display: grid;
    align-items: start;
    gap: 20px;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
}

.status-panel {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    border: 1px solid var(--success-line);
    border-radius: 12px;
    background: var(--success-soft);
    padding: 15px;
}

.status-panel .icon { color: var(--success); }

.section-divider {
    height: 1px;
    border: 0;
    background: var(--line);
    margin: 26px 0;
}

.code-block {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel-soft);
    color: var(--ink-soft);
    padding: 12px;
}

.recovery-list {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    list-style: none;
    margin: 20px 0;
    padding: 0;
}

.recovery-list li {
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--panel-soft);
    padding: 10px 12px;
    text-align: center;
}

.invitation-list {
    display: grid;
    margin-top: 10px;
}

.invitation-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-top: 1px solid var(--line);
    padding: 14px 0;
}

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

.invitation-copy {
    display: grid;
    min-width: 0;
}

.invitation-copy strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.invitation-copy small {
    color: var(--muted);
    margin-top: 2px;
}

.link-button {
    border: 0;
    background: none;
    color: var(--brand);
    cursor: pointer;
    font-weight: 620;
    padding: 0;
}

.link-button.danger { color: var(--danger); }

.auth-shell {
    display: grid;
    min-height: 100vh;
    min-height: 100svh;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    padding: 16px;
}

.auth-brand-panel {
    position: relative;
    isolation: isolate;
    display: flex;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--shell-tint) 12%, transparent);
    border-radius: 20px;
    background:
        radial-gradient(ellipse at 85% 78%, rgba(91, 131, 160, .22), transparent 60%),
        linear-gradient(155deg, #1c3049, #101c2e);
    color: #f3f6fa;
    --focus-ring-color: var(--accent);
    padding: clamp(32px, 4.4vw, 72px);
}

.auth-brand { position: relative; z-index: 1; }

.auth-brand-copy {
    position: relative;
    z-index: 1;
    margin-top: clamp(64px, 12vh, 150px);
}

.auth-brand-copy h2 {
    font-size: clamp(2.35rem, 3.6vw, 4rem);
    font-weight: 520;
    letter-spacing: -.055em;
    line-height: 1.12;
}

.auth-eyebrow {
    display: block;
    margin-bottom: 16px;
    color: var(--muted);
    font-size: .68rem;
    font-weight: 650;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.auth-brand-copy .auth-eyebrow {
    color: #b4c5d9;
    margin-bottom: 24px;
}

/* Quiet, purely decorative geometry; no application data or module previews. */
.auth-art {
    position: relative;
    width: min(100%, 420px);
    min-height: 180px;
    flex: 1 0 180px;
    margin: 30px auto;
    pointer-events: none;
}

.auth-art-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 68%;
    aspect-ratio: 1.22;
    border: 1px solid rgba(185, 211, 233, .25);
    border-radius: 30px;
    transform: translate(-50%, -50%) rotate(-28deg) skew(8deg, 8deg);
}

.auth-art-frame-back { margin: -30px 0 0 -24px; opacity: .45; }
.auth-art-frame-middle { background: rgba(175, 207, 233, .025); }
.auth-art-frame-front {
    margin: 30px 0 0 24px;
    border-color: rgba(190, 218, 242, .42);
    background: linear-gradient(135deg, rgba(195, 221, 241, .075), rgba(195, 221, 241, .01));
}

.auth-art-point {
    position: absolute;
    top: calc(50% + 34px);
    left: 22%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dfc7a0;
    box-shadow: 0 0 0 7px rgba(223, 199, 160, .07);
}

.auth-brand-caption {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    color: #b4c5d9;
    font-size: .75rem;
}

.auth-brand-caption > span {
    width: 28px;
    height: 1px;
    background: #bca789;
}

.auth-main {
    display: grid;
    min-width: 0;
    grid-template-rows: 1fr auto;
    justify-items: center;
    gap: 48px;
    padding: 64px clamp(32px, 5vw, 80px) 24px;
}

.auth-card-wrap {
    width: min(100%, 400px);
    align-self: center;
}

.auth-card {
    min-width: 0;
}

.auth-card .card-body { padding: 0; }

.auth-card h1 {
    font-size: clamp(1.9rem, 3vw, 2.25rem);
    font-weight: 650;
    letter-spacing: -.045em;
    line-height: 1.18;
}

.auth-card .lead { margin-top: 12px; font-size: .875rem; }

.auth-kicker {
    display: inline-grid;
    width: 42px;
    height: 42px;
    place-items: center;
    margin-bottom: 22px;
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand);
}

.auth-form { margin-top: 32px; gap: 22px; }

.auth-form input:not([type="checkbox"], [type="radio"], [type="hidden"]) {
    min-height: 49px;
    border-radius: 8px;
    padding-inline: 14px;
}

.auth-form .button {
    width: 100%;
    min-height: 49px;
    border-radius: 8px;
    box-shadow: none;
    font-weight: 600;
}

.auth-form .button .icon { margin-left: 4px; }

.auth-form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: .8rem;
}

.auth-form-options .checkbox-label,
.auth-form-options > a {
    min-height: 32px;
}

.auth-form-options > a { display: inline-flex; align-items: center; }

.auth-form-options a:hover,
.auth-footer-link a:hover { text-decoration: underline; text-underline-offset: 3px; }

.auth-access-note {
    margin: 28px 0 0;
    border-top: 1px solid var(--line);
    padding-top: 22px;
    color: var(--muted);
    font-size: .75rem;
    line-height: 1.7;
    text-align: center;
}

.auth-page-footer {
    display: grid;
    justify-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: .68rem;
    text-align: center;
}

.auth-page-footer > span:first-child {
    display: flex;
    align-items: center;
    gap: 7px;
}

.auth-footer-link {
    text-align: center;
    font-size: .8rem;
}

@media (min-width: 861px) and (max-height: 800px) {
    .auth-brand-copy { margin-top: 48px; }
    .auth-main { gap: 32px; padding-top: 40px; }
}

@media (max-width: 1100px) {
    .conversation-row { grid-template-columns: 40px minmax(140px, .75fr) minmax(200px, 1.4fr) auto 82px; }
    .conversation-arrow { display: none; }
}

@media (max-width: 860px) {

    .app-main { padding: 28px 20px 54px; }
    .conversation-layout { grid-template-columns: 1fr; }
    .side-card {
        position: static;
        order: -1;
    }
    .security-layout { grid-template-columns: 1fr; }
    .reply-card { bottom: 10px; }
    .auth-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; padding: 12px; }
    .auth-brand-panel { min-height: 88px; justify-content: center; border-radius: 12px; padding: 18px 24px; }
    .auth-brand-panel .auth-brand.brand-logo { width: 144px; }
    .auth-brand-copy,
    .auth-art,
    .auth-brand-caption { display: none; }
    .auth-main { gap: 48px; padding: 48px 24px 16px; }
}

@media (max-width: 680px) {
    .app-toolbar {
        min-height: 52px;
        gap: 10px;
        margin-bottom: 20px;
        padding: 6px 8px 6px 12px;
    }
    .page-header { display: grid; gap: 16px; }
    .page-actions,
    .page-actions .button { width: 100%; }
    .conversation-row {
        gap: 11px;
        grid-template-columns: 38px minmax(0, 1fr) auto;
        padding: 13px 14px;
    }
    .conversation-customer { display: none; }
    .conversation-row .badge { display: none; }
    .conversation-topic small { display: block; }
    .conversation-row time { font-size: .68rem; }
    .inbox-toolbar { padding-inline: 14px; }
    .message-head {
        align-items: flex-start;
        padding: 12px 14px;
    }
    .message-head time { white-space: normal; text-align: right; }
    .message-content { padding: 16px; }
    .card-body { padding: 20px; }
    .form-actions {
        display: grid;
        grid-template-columns: 1fr;
    }
    .form-actions .button { width: 100%; }
    .reply-actions {
        display: grid;
        grid-template-columns: 1fr;
    }
    .reply-actions .button { width: 100%; }
    .recovery-list { grid-template-columns: 1fr; }
    .auth-main { padding-inline: 16px; }
    .invitation-row { align-items: flex-start; flex-direction: column; }
    .account-trigger { min-width: 0; }
    .account-trigger .account-copy small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

.signature-html-editor {
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(0, 1fr) minmax(320px, .8fr);
}

.signature-html-editor__source,
.signature-html-editor__preview-panel {
    min-width: 0;
}

.signature-html-editor__textarea {
    font-family: Consolas, "SFMono-Regular", Menlo, monospace;
    font-size: .78rem;
    line-height: 1.55;
    min-height: 520px;
    resize: vertical;
    tab-size: 4;
}

.signature-html-editor__preview-label {
    display: block;
    font-size: .82rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.signature-html-editor__preview {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    display: block;
    min-height: 520px;
    width: 100%;
}

@media (max-width: 980px) {
    .signature-html-editor {
        grid-template-columns: 1fr;
    }

    .signature-html-editor__textarea,
    .signature-html-editor__preview {
        min-height: 420px;
    }
}
/* Components introduced by the dashboard and access-control merge. */

.brand-logo { width: 108px; }
.brand-logo .brand-logo-image {
    display: block;
    width: 100%;
    height: auto;
}

.auth-brand.brand-logo { width: 172px; max-width: 100%; }

.module-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.module-card {
    display: flex;
    min-height: 168px;
    flex-direction: column;
    color: var(--ink);
    padding: 20px;
    transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.module-card-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    margin-bottom: 15px;
    border: 1px solid var(--brand-line);
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand);
}
a.module-card:hover {
    border-color: var(--brand-line);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}
.module-card-product {
    color: var(--brand);
    font-size: .7rem;
    font-weight: 720;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.module-card-title {
    display: block;
    font-size: 1.15rem;
    margin-top: 8px;
}
.module-card-description {
    color: var(--muted);
    margin-top: 5px;
}
.module-card-status {
    color: var(--brand);
    font-size: .78rem;
    font-weight: 680;
    margin-top: auto;
    padding-top: 18px;
}
.module-card.disabled {
    background: var(--panel-soft);
    box-shadow: none;
}
.module-card.disabled .module-card-product,
.module-card.disabled .module-card-status { color: var(--muted); }
.module-card.disabled .module-card-icon {
    border-color: var(--line);
    background: var(--neutral-soft);
    color: var(--muted);
}

.heading-with-type {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
}
.conversation-subject-heading {
    font-size: clamp(1.25rem, 1.6vw, 1.5rem);
}
.mailbox-type {
    display: inline-flex;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--neutral-soft);
    color: var(--neutral-ink);
    font-size: .67rem;
    font-weight: 700;
    line-height: 1;
    padding: 6px 8px;
    white-space: nowrap;
}
.mailbox-type.personal {
    background: var(--info-soft);
    color: var(--info);
}
.mailbox-type.shared {
    background: var(--process-soft);
    color: var(--process);
}

.form-fieldset {
    min-width: 0;
    margin: 0;
    border: 0;
    padding: 0;
}
.form-fieldset legend {
    color: var(--ink-soft);
    font-size: .8rem;
    font-weight: 680;
    margin-bottom: 9px;
    padding: 0;
}

[x-cloak] {
    display: none !important;
}

.choice-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.recipient-panel {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-soft);
    padding: 16px;
}

.recipient-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: .82rem;
}

.reply-copy-toggle {
    color: var(--brand);
    cursor: pointer;
    font-weight: 700;
}

.reply-copy-grid {
    margin-top: 12px;
}

.reply-copy-grid textarea,
.form-fieldset textarea {
    min-height: 86px;
}
.choice-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.choice-card {
    display: grid;
    gap: 4px;
    grid-template-columns: auto minmax(0, 1fr);
    margin: 0;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    cursor: pointer;
    padding: 15px;
    transition: border-color 130ms ease, background-color 130ms ease, box-shadow 130ms ease;
}
.choice-card:hover { border-color: var(--line-hover); }
.choice-card:has(input:checked) {
    border-color: var(--brand);
    background: var(--brand-soft);
    box-shadow: var(--focus);
}
.choice-card input {
    width: auto;
    min-height: 0;
    margin: 4px 7px 0 0;
    padding: 0;
    accent-color: var(--brand);
}
.choice-card strong,
.choice-card span { display: block; }
.choice-card > span > span {
    color: var(--muted);
    font-size: .75rem;
    font-weight: 450;
    margin-top: 3px;
}

.access-edit-fields {
    border: 0;
    display: grid;
    gap: 20px;
    margin: 0;
    min-inline-size: 0;
    padding: 0;
}

.module-access-list {
    display: grid;
    gap: 14px;
}

.module-access-row {
    min-width: 0;
    margin: 0;
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    padding: 17px;
}

.module-access-row legend {
    max-width: 100%;
    margin: 0 0 13px;
    padding: 0;
}

.module-access-title,
.module-access-description {
    display: block;
}

.module-access-title {
    color: var(--ink);
    font-size: .96rem;
    font-weight: 760;
}

.module-access-description {
    color: var(--muted);
    font-size: .8rem;
    font-weight: 450;
    line-height: 1.45;
    margin-top: 3px;
}

.module-access-options {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.module-access-option {
    display: grid;
    min-width: 0;
    gap: 7px;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    padding: 12px;
    transition: border-color 130ms ease, background-color 130ms ease, box-shadow 130ms ease;
}

.module-access-option:hover { border-color: var(--line-hover); }

.module-access-option:has(input:checked) {
    border-color: var(--brand);
    background: var(--brand-soft);
    box-shadow: var(--focus);
}

.module-access-option input {
    width: auto;
    min-height: 0;
    margin: 3px 0 0;
    padding: 0;
    accent-color: var(--brand);
}

.module-access-option strong,
.module-access-option span { display: block; }

.module-access-option > span > span {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 450;
    line-height: 1.35;
    margin-top: 4px;
}

.module-access-note {
    margin: 0;
    border-left: 3px solid var(--brand-line);
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.5;
    padding-left: 11px;
}

.filter {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.filter-count {
    min-width: 20px;
    border-radius: 999px;
    background: var(--neutral-soft);
    color: var(--neutral-ink);
    font-size: .66rem;
    font-weight: 700;
    padding: 1px 6px;
    text-align: center;
}
.filter.active .filter-count {
    background: var(--brand-line);
    color: var(--brand-hover);
}

.inbox-card { overflow: hidden; }
.conversation-row {
    grid-template-columns: 10px minmax(150px, .8fr) minmax(260px, 1.6fr) 115px;
}
.conversation-row.shared {
    grid-template-columns: 10px minmax(150px, .8fr) minmax(260px, 1.6fr) minmax(120px, .55fr) 115px;
}
.conversation-row.unread { background: var(--info-soft); }
.conversation-row.unread:hover { background: var(--info-hover); }
.conversation-content,
.conversation-assignee {
    display: grid;
    min-width: 0;
}
.conversation-customer strong,
.conversation-customer span,
.conversation-assignee strong,
.conversation-assignee span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.conversation-customer span,
.conversation-assignee span {
    color: var(--muted);
    font-size: .72rem;
    margin-top: 2px;
}
.conversation-subject-line {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
}
.unread-label {
    flex: 0 0 auto;
    border: 1px solid var(--info-line);
    border-radius: 999px;
    background: var(--info-soft);
    color: var(--info);
    font-size: .62rem;
    font-weight: 760;
    line-height: 1;
    padding: 4px 6px;
    white-space: nowrap;
}
.conversation-subject {
    overflow: hidden;
    color: var(--ink);
    font-size: .84rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.conversation-row.unread .conversation-subject,
.conversation-row.unread .conversation-customer strong { font-weight: 780; }
.conversation-preview {
    display: block;
    overflow: hidden;
    color: var(--muted);
    font-size: .72rem;
    margin-top: 3px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.conversation-time {
    color: var(--muted);
    font-size: .72rem;
    text-align: right;
    white-space: nowrap;
}
.side-section {
    margin-top: 18px;
    border-top: 1px solid var(--line);
    padding-top: 18px;
}
.side-card-body { padding: 18px; }
.side-card-body dt {
    color: var(--muted);
    font-size: .7rem;
    margin-top: 12px;
}
.side-card-body dd {
    color: var(--ink-soft);
    margin: 2px 0 0;
    overflow-wrap: anywhere;
}
.recent-conversations h3 {
    font-size: .9rem;
}
.recent-conversation-list {
    list-style: none;
    margin: 9px 0 0;
    padding: 0;
}
.recent-conversation-item + .recent-conversation-item {
    border-top: 1px solid var(--line);
}
.recent-conversation-link {
    display: grid;
    gap: 3px;
    border-radius: var(--radius-sm);
    color: var(--ink-soft);
    margin-inline: -4px;
    padding: 10px 4px;
}
.recent-conversation-link:hover {
    background: var(--surface-hover);
    color: var(--ink);
}
.recent-conversation-link:focus-visible {
    outline: 3px solid var(--focus-ring-color);
    outline-offset: 1px;
}
.recent-conversation-subject {
    display: -webkit-box;
    overflow: hidden;
    color: var(--ink);
    font-size: .78rem;
    font-weight: 650;
    line-height: 1.35;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.recent-conversation-meta {
    color: var(--muted);
    font-size: .68rem;
}
.customer-profile {
    display: grid;
    gap: 12px;
}
.customer-profile-identity {
    display: grid;
    gap: 3px;
    min-width: 0;
}
.customer-profile-name {
    color: var(--ink);
    font-size: .96rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.customer-profile-email {
    font-size: .78rem;
    overflow-wrap: anywhere;
}
.customer-profile-source {
    align-items: center;
    color: var(--ink-soft);
    display: flex;
    flex-wrap: wrap;
    font-size: .69rem;
    gap: 5px;
    margin: -4px 0 0;
}
.customer-profile-source--automatic {
    color: var(--muted);
}
.customer-profile-source a {
    font-weight: 700;
}
.customer-profile-details {
    margin: 0;
}
.customer-profile-details dt {
    color: var(--muted);
    font-size: .68rem;
    margin-top: 10px;
}
.customer-profile-details dd {
    color: var(--ink-soft);
    font-size: .78rem;
    margin: 2px 0 0;
    overflow-wrap: anywhere;
}
.customer-profile-note {
    white-space: pre-line;
}
.customer-profile-directory-link {
    display: inline-flex;
    font-size: .76rem;
    font-weight: 700;
    margin-top: 14px;
}
.conversation-details-section h3 {
    font-size: .9rem;
}
.customer-search-card {
    margin-bottom: 18px;
}
.customer-search {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(220px, 1fr) auto;
}
.customer-search-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}
.customer-directory {
    overflow: hidden;
}
.customer-entry {
    align-items: center;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
}
.customer-entry-link {
    align-items: center;
    color: var(--ink);
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1.2fr) minmax(190px, .8fr) auto;
    min-width: 0;
    padding: 17px 12px 17px 19px;
}
.customer-entry-actions {
    align-items: center;
    display: flex;
    padding: 17px 19px 17px 6px;
}
.customer-entry-actions form {
    margin: 0;
}
.customer-contact-action {
    box-shadow: none;
}
.customer-entry + .customer-entry {
    border-top: 1px solid var(--line);
}
.customer-entry:hover {
    background: var(--surface-hover);
}
.customer-entry-link:hover {
    color: var(--ink);
    text-decoration: none;
}
.customer-entry-link:focus-visible,
.customer-conversation-link:focus-visible {
    outline: 3px solid var(--focus-ring-color);
    outline-offset: -3px;
}
.customer-entry-identity,
.customer-entry-meta,
.customer-conversation-main,
.customer-conversation-meta {
    display: grid;
    gap: 4px;
    min-width: 0;
}
.customer-entry-identity strong,
.customer-conversation-main strong {
    overflow-wrap: anywhere;
}
.customer-entry-identity span,
.customer-entry-meta,
.customer-conversation-main span,
.customer-conversation-meta {
    color: var(--muted);
    font-size: .76rem;
    overflow-wrap: anywhere;
}
.customer-entry-meta,
.customer-conversation-meta {
    text-align: right;
}
.customer-show-layout {
    align-items: start;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(250px, .45fr) minmax(0, 1fr);
}
.customer-profile-card .customer-profile {
    margin-top: 14px;
}
.customer-conversation-history-heading {
    align-items: start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 8px;
}
.customer-conversation-history-heading h2 {
    margin-bottom: 3px;
}
.customer-conversation-history-heading p {
    margin: 0;
}
.customer-conversation-link {
    align-items: center;
    color: var(--ink);
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-inline: -18px;
    padding: 13px 18px;
}
.customer-conversation-link + .customer-conversation-link {
    border-top: 1px solid var(--line);
}
.customer-conversation-link:hover {
    background: var(--surface-hover);
    text-decoration: none;
}
@media (max-width: 800px) {
    .customer-entry-link {
        grid-template-columns: minmax(0, 1fr) auto;
    }
    .customer-entry-meta {
        grid-column: 1 / -1;
        text-align: left;
    }
    .customer-show-layout {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 560px) {
    .customer-search {
        grid-template-columns: 1fr;
    }
    .customer-search-actions {
        align-items: stretch;
        flex-direction: column;
    }
    .customer-search-actions .button {
        width: 100%;
    }
    .customer-entry {
        grid-template-columns: 1fr;
    }
    .customer-entry-link {
        grid-template-columns: minmax(0, 1fr) auto;
        padding-bottom: 12px;
    }
    .customer-entry-meta {
        grid-column: 1 / -1;
    }
    .customer-entry-actions {
        padding: 0 19px 17px;
    }
    .customer-entry-actions form,
    .customer-contact-action {
        width: 100%;
    }
    .customer-conversation-link {
        grid-template-columns: minmax(0, 1fr);
    }
    .customer-entry-meta,
    .customer-conversation-meta {
        text-align: left;
    }
}
.message > .message-body { padding: 20px; }
.message > .attachments { margin: 0 20px 18px; }
.message > .delivery { margin: 0; padding: 0 20px 18px; }
.button.compact {
    min-height: 34px;
    padding: 6px 10px;
    white-space: nowrap;
}

@media (max-width: 1100px) {
    .module-access-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .conversation-row,
    .conversation-row.shared {
        grid-template-columns: 10px minmax(140px, .75fr) minmax(200px, 1.4fr) minmax(110px, .55fr) 82px;
    }
    .conversation-row.personal {
        grid-template-columns: 10px minmax(140px, .75fr) minmax(200px, 1.4fr) 82px;
    }
}

@media (max-width: 680px) {
    .choice-grid { grid-template-columns: 1fr; }
    .module-access-row { padding: 15px; }
    .module-access-options { grid-template-columns: 1fr; }
    .conversation-row,
    .conversation-row.shared,
    .conversation-row.personal {
        grid-template-columns: 8px minmax(0, 1fr) 82px;
    }
    .conversation-customer,
    .conversation-assignee { display: none; }
    .conversation-content { display: grid; }
}

/* Conversation workspace */
.conversation-layout--chat {
    height: auto;
    align-items: start;
}

.conversation-layout--chat .conversation-main {
    display: grid;
    gap: 0;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel);
    box-shadow: var(--shadow-xs);
}

.conversation-message-list {
    min-height: 0;
    overflow: visible;
    scroll-padding-block: 20px;
    background: var(--surface-hover);
    border-bottom: 1px solid var(--line);
    padding: 20px;
}

.conversation-message-list:focus-visible {
    outline: 3px solid var(--focus-ring-color);
    outline-offset: -3px;
}

.conversation-message-list .timeline {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 18px;
}

.conversation-message-list .message {
    align-self: stretch;
    width: 100%;
    max-width: none;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.conversation-message-list .message.agent {
    align-self: stretch;
    border: 0;
}

.conversation-message-list .message.note,
.conversation-message-list .message.system {
    align-self: stretch;
    max-width: none;
    border: 0;
}

.conversation-message-list .message-head {
    min-width: 0;
    flex-wrap: wrap;
    border: 0;
    background: transparent;
    padding: 0 4px 4px;
}

.conversation-message-head-actions,
.message-reply-actions {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.conversation-message-head-actions {
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.message-reply-action {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    gap: 5px;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--muted);
    font-size: .68rem;
    font-weight: 700;
    line-height: 1;
    padding: 5px 8px;
    text-decoration: none;
}

.message-reply-action:hover {
    border-color: var(--brand-line);
    background: var(--brand-soft);
    color: var(--brand-hover);
}

.message-reply-action:focus-visible {
    outline: 3px solid var(--focus-ring-color);
    outline-offset: 1px;
}

.conversation-message-list .message-head strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.conversation-message-list .message.agent .message-head {
    justify-content: flex-end;
}

.conversation-message-list .message.note .message-head {
    justify-content: space-between;
}

.conversation-message-list .message.system .message-head {
    border: 0;
    background: transparent;
    justify-content: center;
}

.internal-note-heading {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 6px;
    color: var(--note);
}

.internal-note-author {
    overflow: hidden;
    color: var(--ink-soft);
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-message-list .message-bubble {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 5px var(--radius-lg) var(--radius-lg) var(--radius-lg);
    background: var(--panel);
    box-shadow: var(--shadow-xs);
}

.conversation-message-list .message.agent .message-bubble {
    border-color: var(--brand-line);
    border-radius: var(--radius-lg) 5px var(--radius-lg) var(--radius-lg);
    background: var(--brand-soft);
}

.conversation-message-list .message.note .message-bubble {
    border-color: var(--note-line);
    border-radius: var(--radius-md);
    background: var(--note-soft);
}

.conversation-message-list .message.note-administrative .message-bubble {
    border-color: var(--warning-line);
    background: var(--warning-soft);
}

.conversation-message-list .message.note-administrative .internal-note-heading { color: var(--warning); }

.conversation-message-list .message.system .message-bubble {
    border-color: var(--neutral-line);
    border-radius: var(--radius-md);
    background: var(--neutral-soft);
}

.conversation-message-list .message-bubble > .message-body {
    padding: 12px 16px 16px;
}

.conversation-message-list .message-bubble > .delivery {
    margin: 0;
    padding: 0 16px 12px;
}

/* Keep delivery metadata available without giving it the visual weight of the message. */
.conversation-message-list .message.agent .message-bubble > .delivery:last-child {
    width: fit-content;
    max-width: calc(100% - 20px);
    align-items: center;
    gap: 4px;
    margin: -5px 10px 8px auto;
    border: 1px solid var(--brand-line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--muted);
    font-size: .64rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
    padding: 3px 7px;
}

.conversation-message-list .message-bubble > .attachments {
    margin: 0 16px 14px;
}

.conversation-message-list .message-remote-images,
.conversation-message-list .message-remote-image-trust {
    margin: 0 16px 14px;
}

.conversation-latest-marker {
    height: 1px;
    scroll-margin-top: 20px;
}

.conversation-composer-actions {
    display: grid;
    min-height: 0;
    background: var(--panel);
}

.conversation-composer-toolbar {
    display: flex;
    min-width: 0;
    min-height: 52px;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    padding: 4px 8px;
    scrollbar-color: var(--line-strong) transparent;
    scrollbar-width: thin;
}

.conversation-composer-toolbar::-webkit-scrollbar { height: 5px; }

.conversation-composer-toolbar::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: var(--line-strong);
}

.conversation-composer-action {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
    font: inherit;
    font-size: .84rem;
    font-weight: 680;
    line-height: 1.2;
    padding: 8px 12px;
    transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
    white-space: nowrap;
}

.conversation-composer-action:hover {
    border-color: var(--line);
    background: var(--surface-hover);
    color: var(--ink);
}

.conversation-composer-action:focus-visible {
    outline: 3px solid var(--focus-ring-color);
    outline-offset: 1px;
}

.conversation-composer-action[aria-pressed="true"],
.conversation-composer-action.is-active,
.conversation-composer-action.active {
    border-color: var(--brand-line);
    background: var(--brand-soft);
    color: var(--brand-hover);
}

.conversation-composer-action--forward[aria-pressed="true"],
.conversation-composer-action--forward.is-active,
.conversation-composer-action--forward.active {
    border-color: var(--info-line);
    background: var(--info-soft);
    color: var(--info);
}

.conversation-composer-action--note[aria-pressed="true"],
.conversation-composer-action--note.is-active,
.conversation-composer-action--note.active {
    border-color: var(--note-line);
    background: var(--note-soft);
    color: var(--note);
}

.conversation-composer-panel {
    min-height: 0;
    max-height: min(38vh, 300px);
    max-height: min(38dvh, 300px);
    overflow: auto;
    overscroll-behavior: contain;
    border-top: 1px solid var(--line);
    background: var(--panel);
    padding: 12px 16px 14px;
}

.conversation-composer-panel[hidden] { display: none; }

.reply-target {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid var(--brand-line);
    border-radius: var(--radius-md);
    background: var(--brand-soft);
    color: var(--ink-soft);
    padding: 10px 12px;
}

.reply-target-icon {
    display: inline-flex;
    flex: 0 0 auto;
    color: var(--brand-hover);
    padding-top: 1px;
}

.reply-target-copy {
    display: grid;
    min-width: 0;
    flex: 1 1 auto;
    gap: 2px;
}

.reply-target-copy > strong {
    color: var(--ink);
    font-size: .82rem;
}

.reply-target-copy > small {
    color: var(--muted);
    font-size: .7rem;
}

.reply-target-recipients {
    display: grid;
    gap: 2px;
    margin-top: 4px;
    color: var(--muted);
    font-size: .72rem;
    overflow-wrap: anywhere;
}

.reply-target-recipients b { color: var(--ink-soft); }

.reply-target-close {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: var(--brand-hover);
    cursor: pointer;
    font: inherit;
    font-size: .72rem;
    font-weight: 700;
    padding: 3px 0 3px 8px;
}

.reply-target-close:focus-visible {
    border-radius: 4px;
    outline: 3px solid var(--focus-ring-color);
    outline-offset: 2px;
}

.conversation-composer-panel .reply-form > div:first-child > textarea,
.conversation-composer-panel .reply-form > .quick-replies + div > textarea {
    min-height: 88px;
    max-height: 170px;
}
.conversation-composer-panel .quick-replies {
    display: grid;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel-soft);
}

.conversation-composer-panel .quick-replies-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.conversation-composer-panel .quick-replies-header label {
    margin: 0;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
}

.conversation-composer-panel .quick-replies-manage {
    font-size: .78rem;
    font-weight: 700;
}

.conversation-composer-panel .quick-replies-picker {
    display: flex;
    align-items: center;
    gap: 8px;
}

.conversation-composer-panel .quick-replies-picker select {
    min-width: 0;
    flex: 1 1 auto;
    margin: 0;
}

.conversation-composer-panel .quick-replies-insert {
    flex: 0 0 auto;
    min-height: 38px;
}

.conversation-composer-panel .form-actions,
.conversation-composer-panel .reply-actions {
    margin-top: 10px;
}

.conversation-layout--chat .reply-card {
    position: static;
    z-index: auto;
    max-height: none;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: var(--panel);
    box-shadow: none;
}

.conversation-layout--chat .reply-card + .reply-card {
    border-top: 1px solid var(--line);
}

.reply-card-summary {
    display: flex;
    min-height: 64px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
    list-style: none;
    padding: 11px 16px;
}

.reply-card-summary::-webkit-details-marker { display: none; }

.reply-card-summary-copy {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    color: var(--brand);
}

.reply-card--note .reply-card-summary-copy { color: var(--note); }

.reply-card--note[open] .reply-card-summary { background: var(--note-soft); }

.reply-card-summary-copy > span {
    display: grid;
    min-width: 0;
    gap: 1px;
}

.reply-card-summary-copy strong {
    color: var(--ink);
    font-size: .9rem;
}

.reply-card-summary-copy small {
    overflow: hidden;
    color: var(--muted);
    font-size: .74rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reply-card-chevron {
    color: var(--muted);
    transition: transform 150ms ease;
}

.reply-card[open] .reply-card-summary { border-bottom: 1px solid var(--line); }

.reply-card[open] .reply-card-chevron { transform: rotate(180deg); }

.reply-card-content { padding: 16px; }

.reply-card-content .reply-form > div:first-child > textarea {
    min-height: 108px;
    max-height: 220px;
}

.conversation-readonly {
    display: grid;
    gap: 2px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
    color: var(--muted);
    padding: 15px 16px;
}

.conversation-readonly strong { color: var(--ink); }

.conversation-layout--chat .side-card {
    position: static;
    align-self: start;
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
}

@media (min-width: 861px) and (max-width: 1100px) {
    .conversation-layout--chat {
        height: auto;
        grid-template-columns: minmax(0, 1fr);
    }

    .conversation-layout--chat .conversation-main {
        height: auto;
    }
}

@media (max-width: 860px) {
    .conversation-layout--chat .conversation-main {
        display: block;
        overflow: visible;
    }

    .conversation-layout--chat .conversation-message-list {
        overflow: visible;
    }

    .conversation-composer-actions {
        max-height: none;
    }

    .conversation-layout--chat .side-card {
        order: initial;
        max-height: none;
    }
}

@media (max-width: 680px) {
    .conversation-message-list { padding: 16px; }

    .conversation-message-list .message-head {
        gap: 10px;
        padding-inline: 2px;
    }

    .conversation-message-list .message-head time { font-size: .66rem; }

    .conversation-message-list .message-bubble > .message-body { padding: 11px 14px 14px; }

    .conversation-message-list .message-bubble > .delivery { padding-inline: 14px; }

    .conversation-message-list .message-remote-images,
    .conversation-message-list .message-remote-image-trust { margin-inline: 14px; }

    .reply-card-summary,
    .reply-card-content { padding-inline: 14px; }
    .conversation-composer-panel .quick-replies-picker {
        align-items: stretch;
        flex-direction: column;
    }

    .conversation-composer-panel .quick-replies-insert {
        width: 100%;
    }

}

.conversation-message-list .message-bubble > .message-body.message-presentation {
    overflow: hidden;
    padding: 0;
}

.message-presentation-frame {
    display: block;
    width: 100%;
    min-height: 96px;
    border: 0;
    background: #fff;
}

/* Conversation tags */
.conversation-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
}

.conversation-tags[hidden] { display: none; }

.conversation-tag {
    --tag-background: var(--neutral-soft);
    --tag-border: var(--neutral-line);
    --tag-ink: var(--neutral-ink);
    --tag-dot: var(--neutral-ink);
    display: inline-flex;
    max-width: 100%;
    min-width: 0;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--tag-border);
    border-radius: 999px;
    background: var(--tag-background);
    color: var(--tag-ink);
    font-size: .72rem;
    font-weight: 690;
    line-height: 1.2;
    padding: 4px 8px;
    white-space: nowrap;
}

.conversation-tag[data-tag-color="slate"],
.tag-color-option[data-tag-color="slate"] {
    --tag-background: #f1f5f9;
    --tag-border: #cbd5e1;
    --tag-ink: #334155;
    --tag-dot: #64748b;
}

.conversation-tag[data-tag-color="blue"],
.tag-color-option[data-tag-color="blue"] {
    --tag-background: #eff6ff;
    --tag-border: #bfdbfe;
    --tag-ink: #1d4ed8;
    --tag-dot: #2563eb;
}

.conversation-tag[data-tag-color="cyan"],
.tag-color-option[data-tag-color="cyan"] {
    --tag-background: #ecfeff;
    --tag-border: #a5f3fc;
    --tag-ink: #0e7490;
    --tag-dot: #0891b2;
}

.conversation-tag[data-tag-color="green"],
.tag-color-option[data-tag-color="green"] {
    --tag-background: #ecfdf5;
    --tag-border: #a7f3d0;
    --tag-ink: #047857;
    --tag-dot: #059669;
}

.conversation-tag[data-tag-color="amber"],
.tag-color-option[data-tag-color="amber"] {
    --tag-background: #fffbeb;
    --tag-border: #fde68a;
    --tag-ink: #b45309;
    --tag-dot: #d97706;
}

.conversation-tag[data-tag-color="orange"],
.tag-color-option[data-tag-color="orange"] {
    --tag-background: #fff7ed;
    --tag-border: #fed7aa;
    --tag-ink: #c2410c;
    --tag-dot: #ea580c;
}

.conversation-tag[data-tag-color="red"],
.tag-color-option[data-tag-color="red"] {
    --tag-background: #fef2f2;
    --tag-border: #fecaca;
    --tag-ink: #b91c1c;
    --tag-dot: #dc2626;
}

.conversation-tag[data-tag-color="violet"],
.tag-color-option[data-tag-color="violet"] {
    --tag-background: #f5f3ff;
    --tag-border: #ddd6fe;
    --tag-ink: #6d28d9;
    --tag-dot: #7c3aed;
}

.conversation-tag-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--tag-dot);
}

.conversation-tag-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-tag--archived {
    border-style: dashed;
}

.conversation-tag-archive {
    flex: 0 0 auto;
    font-size: .61rem;
    font-weight: 720;
    text-transform: uppercase;
}

.conversation-row-tags {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-top: 5px;
}

.conversation-row-tags .conversation-tag {
    max-width: min(100%, 19ch);
}

.conversation-tag--compact {
    font-size: .63rem;
    gap: 4px;
    padding: 3px 6px;
}

.conversation-tag--compact .conversation-tag-dot {
    width: 6px;
    height: 6px;
}

.conversation-tag--compact .conversation-tag-archive { display: none; }

.conversation-tag-more {
    display: inline-flex;
    min-height: 22px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--muted);
    font-size: .65rem;
    font-weight: 720;
    line-height: 1;
    padding: 3px 6px;
    white-space: nowrap;
}

.conversation-tag-filter {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 9px;
    margin: 0 0 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel);
    box-shadow: var(--shadow-xs);
    padding: 10px 12px;
}

.conversation-tag-filter-field {
    display: grid;
    flex: 1 1 260px;
    gap: 5px;
}

.conversation-tag-filter-field label {
    margin: 0;
    font-size: .73rem;
}

.conversation-tag-filter-field select {
    min-width: 0;
    min-height: 37px;
    padding-block: 7px;
}

.conversation-tag-filter-clear {
    display: inline-flex;
    min-height: 35px;
    align-items: center;
    font-size: .78rem;
    font-weight: 650;
    padding-inline: 4px;
}

.conversation-tags-menu {
    position: relative;
    flex: 0 0 auto;
}

.conversation-tags-trigger { gap: 7px; }

.conversation-tags-trigger-count {
    display: inline-grid;
    min-width: 18px;
    min-height: 18px;
    place-items: center;
    border-radius: 999px;
    background: var(--neutral-soft);
    color: var(--muted-strong);
    font-size: .66rem;
    font-weight: 760;
    padding-inline: 4px;
}

.conversation-tags-popover {
    position: absolute;
    z-index: 40;
    top: calc(100% + 8px);
    left: 0;
    width: min(360px, calc(100vw - 40px));
    max-height: min(60vh, 480px);
    max-height: min(60dvh, 480px);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel);
    box-shadow: var(--shadow-lg);
    padding: 15px;
}

.conversation-tags-fieldset,
.tag-color-fieldset {
    min-width: 0;
    border: 0;
    margin: 0;
    padding: 0;
}

.conversation-tags-fieldset legend,
.tag-color-fieldset legend {
    color: var(--ink-soft);
    font-size: .8rem;
    font-weight: 700;
    padding: 0;
}

.conversation-tags-fieldset .field-hint { margin-top: 3px; }

.conversation-tag-choice-list {
    display: grid;
    gap: 6px;
    margin-top: 11px;
}

.conversation-tag-choice {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel);
    cursor: pointer;
    margin: 0;
    padding: 8px 9px;
    transition: background-color 130ms ease, border-color 130ms ease, box-shadow 130ms ease;
}

.conversation-tag-choice:hover { border-color: var(--line-hover); }

.conversation-tag-choice:focus-within {
    border-color: var(--brand);
    box-shadow: var(--focus);
}

.conversation-tag-choice:has(input:checked) {
    border-color: var(--brand-line);
    background: var(--brand-soft);
}

.conversation-tag-choice input {
    width: 17px;
    height: 17px;
    min-height: 0;
    flex: 0 0 auto;
    accent-color: var(--brand);
    margin: 0;
    padding: 0;
}

.conversation-tag-choice .conversation-tag { max-width: calc(100% - 26px); }

.conversation-tags-empty,
.conversation-tags-archive-note {
    color: var(--muted);
    font-size: .75rem;
    line-height: 1.45;
    margin: 0;
}

.conversation-tags-archive-note {
    margin-top: 11px;
    border-left: 3px solid var(--neutral-line);
    padding-left: 9px;
}

.conversation-tags-status {
    display: flex;
    min-height: 22px;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: .74rem;
    line-height: 1.4;
    margin: 0;
}

.conversation-tags-status[hidden],
.conversation-tags-popover .form-actions[hidden] { display: none; }

.conversation-tags-status::before {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: currentColor;
    content: '';
    opacity: .55;
}

.conversation-tags-status.is-saving { color: var(--info); }
.conversation-tags-status.is-saved { color: var(--success); }
.conversation-tags-status.is-error { color: var(--danger); }

/* Conversation tag catalog */
.conversation-tag-catalog-layout {
    display: grid;
    align-items: start;
    gap: 20px;
    grid-template-columns: minmax(280px, .72fr) minmax(0, 1.28fr);
}

.conversation-tag-catalog-create {
    position: sticky;
    top: 95px;
}

.conversation-tag-catalog-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.conversation-tag-catalog-heading p {
    color: var(--muted);
    font-size: .8rem;
    line-height: 1.5;
    margin: 5px 0 0;
}

.conversation-tag-catalog-icon {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 11px;
    background: var(--brand-soft);
    color: var(--brand);
}

.tag-color-fieldset legend { margin-bottom: 8px; }

.tag-color-options {
    display: grid;
    gap: 7px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tag-color-option {
    --tag-background: var(--neutral-soft);
    --tag-border: var(--neutral-line);
    --tag-ink: var(--neutral-ink);
    --tag-dot: var(--neutral-ink);
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel);
    color: var(--ink-soft);
    cursor: pointer;
    font-size: .72rem;
    font-weight: 620;
    margin: 0;
    padding: 7px 8px;
    transition: background-color 130ms ease, border-color 130ms ease, box-shadow 130ms ease;
}

.tag-color-option:hover { border-color: var(--line-hover); }

.tag-color-option:focus-within {
    border-color: var(--brand);
    box-shadow: var(--focus);
}

.tag-color-option:has(input:checked) {
    border-color: var(--tag-border);
    background: var(--tag-background);
    color: var(--tag-ink);
}

.tag-color-option input {
    width: 15px;
    height: 15px;
    min-height: 0;
    flex: 0 0 auto;
    accent-color: var(--tag-dot);
    margin: 0;
    padding: 0;
}

.tag-color-option-swatch {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--tag-dot);
}

.conversation-tag-catalog-count {
    color: var(--muted);
    font-size: .75rem;
    margin: 4px 0 0;
}

.conversation-tag-catalog-entries { padding: 0; }

.conversation-tag-catalog-entry {
    border-top: 1px solid var(--line);
}

.conversation-tag-catalog-entry:first-child { border-top: 0; }

.conversation-tag-catalog-summary {
    display: flex;
    min-height: 62px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
    list-style: none;
    padding: 12px 18px;
}

.conversation-tag-catalog-summary::-webkit-details-marker { display: none; }

.conversation-tag-catalog-summary-main {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 9px;
}

.conversation-tag-catalog-summary-action {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: .74rem;
    font-weight: 650;
}

.conversation-tag-catalog-summary-action .icon { transition: transform 150ms ease; }

.conversation-tag-catalog-entry[open] .conversation-tag-catalog-summary {
    border-bottom: 1px solid var(--line);
    background: var(--surface-hover);
}

.conversation-tag-catalog-entry[open] .conversation-tag-catalog-summary-action .icon { transform: rotate(180deg); }

.conversation-tag-catalog-entry-body {
    display: grid;
    gap: 15px;
    padding: 17px 18px 18px;
}

.conversation-tag-catalog-danger-form {
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.conversation-tag-catalog-danger-form p,
.conversation-tag-catalog-archived-notice {
    color: var(--muted);
    font-size: .75rem;
    line-height: 1.45;
    margin: 0 0 10px;
}

.conversation-tag-catalog-archived-notice {
    margin-bottom: 0;
    border-left: 3px solid var(--neutral-line);
    padding-left: 10px;
}

.conversation-tag-catalog-entry--archived .conversation-tag-catalog-summary { background: rgba(241, 245, 249, .55); }

.conversation-tag-catalog-empty {
    display: grid;
    min-height: 170px;
    place-items: center;
    align-content: center;
    gap: 8px;
    color: var(--muted);
    padding: 24px;
    text-align: center;
}

.conversation-tag-catalog-empty .icon { color: var(--line-hover); }

.conversation-tag-catalog-empty p {
    max-width: 290px;
    font-size: .8rem;
    margin: 0;
}

.conversation-tag-catalog-archived { margin-top: 20px; }

@media (max-width: 980px) {
    .conversation-tag-catalog-layout { grid-template-columns: 1fr; }

    .conversation-tag-catalog-create { position: static; }
}

@media (max-width: 680px) {
    .conversation-tags-trigger-label { display: none; }

    .conversation-tags-popover {
        width: min(360px, calc(100vw - 32px));
    }

    .conversation-tag-filter {
        align-items: stretch;
        padding: 10px;
    }

    .conversation-tag-filter .button { flex: 1 1 auto; }

    .conversation-tag-filter-clear {
        justify-content: center;
        flex: 1 1 auto;
    }

    .conversation-tag-catalog-summary,
    .conversation-tag-catalog-entry-body { padding-inline: 14px; }

    .conversation-tag-catalog-summary { gap: 10px; }

    .conversation-tag-catalog-summary-main { gap: 7px; }

    .conversation-tag-catalog-summary-action { font-size: 0; }

    .conversation-tag-catalog-summary-action .icon {
        width: 18px;
        height: 18px;
    }
}
/* Conversation presence */
.conversation-presence,
.conversation-row-presence {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.conversation-presence { margin-top: 10px; }

.conversation-row-presence { margin-top: 5px; }

.conversation-presence:empty,
.conversation-row-presence:empty { display: none; }

.conversation-presence-chip {
    --presence-background: var(--info-soft);
    --presence-border: var(--info-line);
    --presence-ink: var(--info);
    display: inline-flex;
    min-width: 0;
    max-width: 100%;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--presence-border);
    border-radius: 999px;
    background: var(--presence-background);
    color: var(--presence-ink);
    font-size: .75rem;
    font-weight: 650;
    line-height: 1.25;
    padding: 4px 8px;
}

.conversation-presence-chip[data-conversation-presence-activity="replying"] {
    --presence-background: var(--brand-soft);
    --presence-border: var(--brand-line);
    --presence-ink: var(--brand-hover);
}

.conversation-presence-chip[data-conversation-presence-activity="forwarding"] {
    --presence-background: var(--process-soft);
    --presence-border: var(--process-line);
    --presence-ink: var(--process);
}

.conversation-presence-chip[data-conversation-presence-activity="writing_note"] {
    --presence-background: var(--note-soft);
    --presence-border: var(--note-line);
    --presence-ink: var(--note);
}

.conversation-presence-name,
.conversation-presence-activity {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-presence-name { color: var(--ink-soft); }

.conversation-presence-separator {
    flex: 0 0 auto;
    color: var(--line-strong);
}

.conversation-row-presence .conversation-presence-chip {
    font-size: .67rem;
    padding: 3px 7px;
}

@media (max-width: 680px) {
    .conversation-presence-chip {
        width: fit-content;
        max-width: 100%;
    }
}
/* Conversation snooze */
.conversation-snooze-menu {
    position: relative;
    flex: 0 0 auto;
}

.conversation-snooze-trigger { gap: 7px; }

.conversation-snooze-popover {
    position: absolute;
    z-index: 40;
    top: calc(100% + 8px);
    left: 0;
    width: min(330px, calc(100vw - 40px));
    max-height: min(60vh, 500px);
    max-height: min(60dvh, 500px);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel);
    box-shadow: var(--shadow-lg);
    padding: 15px;
}

.conversation-snooze-popover-title {
    color: var(--ink);
    font-size: .88rem;
    font-weight: 760;
    margin: 0;
}

.conversation-snooze-popover .field-hint {
    margin: 3px 0 12px;
}

.conversation-snooze-preset-list {
    display: grid;
    gap: 7px;
}

.conversation-snooze-preset {
    display: flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel);
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    font-size: .8rem;
    font-weight: 700;
    text-align: left;
    padding: 8px 10px;
    transition: background-color 130ms ease, border-color 130ms ease, box-shadow 130ms ease;
}

.conversation-snooze-preset:hover {
    border-color: var(--brand-line);
    background: var(--brand-soft);
}

.conversation-snooze-preset:focus-visible {
    border-color: var(--brand);
    outline: 0;
    box-shadow: var(--focus);
}

.conversation-snooze-preset small {
    color: var(--muted);
    font-size: .71rem;
    font-weight: 620;
    white-space: nowrap;
}

.conversation-snooze-custom-form {
    display: grid;
    gap: 7px;
    border-top: 1px solid var(--line);
    margin-top: 12px;
    padding-top: 12px;
}

.conversation-snooze-custom-form label {
    color: var(--ink-soft);
    font-size: .76rem;
    font-weight: 700;
    margin: 0;
}

.conversation-snooze-custom-form .button {
    justify-self: start;
    margin-top: 2px;
}

.conversation-awaiting-reply-trigger.is-active {
    border-color: var(--warning-line);
    background: var(--warning-soft);
    color: var(--warning);
}

.conversation-awaiting-reply-trigger.is-overdue {
    border-color: var(--danger-line);
    background: var(--danger-soft);
    color: var(--danger);
}

.conversation-awaiting-reply-current {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    border: 1px solid var(--warning-line);
    border-radius: var(--radius-sm);
    background: var(--warning-soft);
    color: var(--warning);
    font-size: .73rem;
    line-height: 1.4;
    margin-bottom: 12px;
    padding: 9px 10px;
}

.conversation-awaiting-reply-current.is-overdue {
    border-color: var(--danger-line);
    background: var(--danger-soft);
    color: var(--danger);
}

.conversation-awaiting-reply-current .icon { flex: 0 0 auto; }

.conversation-awaiting-reply-current span { display: grid; }

.conversation-awaiting-reply-current small {
    color: var(--ink-soft);
    font-size: .67rem;
}

.conversation-awaiting-reply-cancel-form {
    border-top: 1px solid var(--line);
    margin-top: 12px;
    padding-top: 12px;
}

.conversation-awaiting-reply-chip {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--warning-line);
    border-radius: 999px;
    background: var(--warning-soft);
    color: var(--warning);
    font-size: .68rem;
    font-weight: 720;
    line-height: 1.2;
    padding: 5px 8px;
}

.conversation-awaiting-reply-chip.is-overdue {
    border-color: var(--danger-line);
    background: var(--danger-soft);
    color: var(--danger);
}

.conversation-awaiting-reply-chip--compact {
    font-size: .63rem;
    padding: 4px 7px;
}

.conversation-awaiting-reply-chip .icon { flex: 0 0 auto; }

.conversation-snooze-chip {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--warning-line);
    border-radius: 999px;
    background: var(--warning-soft);
    color: var(--warning);
    font-size: .72rem;
    font-weight: 700;
    line-height: 1.2;
    padding: 6px 9px;
}

.conversation-snooze-chip time { white-space: nowrap; }

.conversation-snooze-actor {
    color: var(--ink-soft);
    font-weight: 620;
    white-space: nowrap;
}

.conversation-snooze-chip--compact {
    font-size: .64rem;
    padding: 4px 7px;
}

.conversation-snooze-chip--compact .icon {
    flex: 0 0 auto;
}

@media (max-width: 680px) {
    .conversation-snooze-menu { position: static; }

    .conversation-snooze-popover {
        right: 8px;
        left: auto;
    }

    .conversation-row .conversation-snooze-chip--compact {
        display: inline-flex;
    }
}

/* Conversation priority and SLA */
.conversation-priority-chip,
.conversation-sla-chip {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .65rem;
    font-weight: 740;
    line-height: 1;
    padding: 4px 7px;
    white-space: nowrap;
}

.conversation-priority-chip--low {
    border-color: var(--neutral-line);
    background: var(--neutral-soft);
    color: var(--neutral-ink);
}

.conversation-priority-chip--normal {
    border-color: var(--neutral-line);
    background: var(--neutral-soft);
    color: var(--neutral-ink);
}

.conversation-priority-chip--high {
    border-color: var(--warning-line);
    background: var(--warning-soft);
    color: var(--warning);
}

.conversation-priority-chip--urgent {
    border-color: var(--danger-line);
    background: var(--danger-soft);
    color: var(--danger);
}

.conversation-sla-chip--on_track,
.conversation-sla-chip--met {
    border-color: var(--success-line);
    background: var(--success-soft);
    color: var(--success);
}

.conversation-sla-chip--at_risk,
.conversation-sla-chip--paused,
.conversation-sla-chip--cancelled {
    border-color: var(--warning-line);
    background: var(--warning-soft);
    color: var(--warning);
}

.conversation-sla-chip--breached {
    border-color: var(--danger-line);
    background: var(--danger-soft);
    color: var(--danger);
}

.conversation-sla-details dd {
    display: grid;
    justify-items: start;
    gap: 4px;
}

.conversation-sla-details small {
    color: var(--muted);
    font-size: .7rem;
}

@media (max-width: 680px) {
    .conversation-subject-line .conversation-priority-chip {
        display: none;
    }
}

/* Calm Dark: sign-in pages follow the device theme until an account chooses one. */
@media screen {
    html[data-workspace-theme="dark"] .auth-brand-panel {
        background:
            radial-gradient(ellipse at 85% 78%, rgba(91, 131, 160, .15), transparent 60%),
            linear-gradient(155deg, #19293e, #101a29);
    }

    /* Neutral alerts draw their border in the text colour; a mid-tone line keeps them calm on graphite. */
    html[data-workspace-theme="dark"] .alert:not(.success):not(.error) {
        border-color: var(--line-strong);
    }

    html[data-workspace-theme="dark"] .conversation-tag-catalog-entry--archived .conversation-tag-catalog-summary {
        background: rgba(34, 43, 55, .55);
    }
}

/* Zdjęcie profilowe wypełnia dowolny okrągły awatar; bez zdjęcia zostaje inicjał. */
.user-avatar-image {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
    background: inherit;
}
