: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: rgba(191, 219, 254, .16);
    --sidebar-text: #f8fafc;
    --sidebar-muted: #bfdbfe;
    --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;
    --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: 0 0 0 4px rgba(37, 99, 235, .22);
    --app-content-max-width: 1920px;
}

* { 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(--brand);
    text-decoration: none;
}

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

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); }

.app-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: 268px minmax(0, 1fr);
}

.app-shell.is-sidebar-collapsed {
    grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    height: 100vh;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    background:
        radial-gradient(circle at 12% 3%, rgba(147, 197, 253, .12), transparent 26%),
        linear-gradient(165deg, var(--sidebar) 0%, var(--sidebar-deep) 100%);
    color: var(--sidebar-text);
}

.sidebar-header {
    display: flex;
    min-height: 78px;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 12px;
}

.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; }

.brand-logo-mark { display: none; }

.brand-mark {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 11px;
    background: rgba(255, 255, 255, .09);
    color: var(--accent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

.sidebar-panel {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
}

.primary-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px 20px;
    scrollbar-color: rgba(255, 255, 255, .18) transparent;
    scrollbar-width: thin;
}

.nav-link {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 42px;
    align-items: center;
    gap: 11px;
    margin: 2px 0;
    border-radius: 11px;
    color: #dbeafe;
    font-size: .91rem;
    font-weight: 560;
    padding: 9px 11px;
    transition: background-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.nav-link > .icon { flex: 0 0 auto; }

.nav-link-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(255, 255, 255, .065);
    color: #fff;
}

.nav-link.active {
    background: rgba(37, 99, 235, .24);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(147, 197, 253, .18);
}

.nav-link.active::before {
    position: absolute;
    left: 0;
    width: 3px;
    height: 19px;
    border-radius: 0 4px 4px 0;
    background: var(--accent);
    content: "";
}

.nav-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--sidebar-muted);
    font-size: .68rem;
    font-weight: 730;
    letter-spacing: .095em;
    padding: 24px 10px 7px;
    text-transform: uppercase;
}

.nav-heading-action {
    display: grid;
    width: 25px;
    height: 25px;
    place-items: center;
    border-radius: 7px;
    color: var(--sidebar-muted);
}

.nav-heading-action:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.sidebar-collapse-toggle.icon-button {
    display: grid;
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
    background: rgba(255, 255, 255, .055);
    color: var(--sidebar-muted);
}

.sidebar-collapse-toggle.icon-button:hover,
.sidebar-collapse-toggle.icon-button:focus-visible {
    background: rgba(255, 255, 255, .11);
    color: #fff;
}

.sidebar-collapse-icon--expand { display: none; }

.app-shell.is-sidebar-collapsed .sidebar-collapse-icon--collapse { display: none; }

.app-shell.is-sidebar-collapsed .sidebar-collapse-icon--expand { display: block; }

.mailbox-link { align-items: flex-start; }

.mailbox-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    margin: 6px 5px 0 1px;
    border: 2px solid rgba(147, 197, 253, .72);
    border-radius: 50%;
}

.mailbox-link.active .mailbox-dot {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(147, 197, 253, .12);
}

.nav-link-copy {
    display: grid;
    min-width: 0;
    flex: 1;
}

.nav-link-copy > span,
.nav-link-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-link-copy small {
    color: var(--sidebar-muted);
    font-size: .72rem;
    font-weight: 450;
    margin-top: 1px;
}

.nav-empty {
    color: var(--sidebar-muted);
    font-size: .78rem;
    margin: 3px 11px 0;
}

.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--conversation {
    position: sticky;
    z-index: 10;
    top: 18px;
}

.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-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;
}

.mobile-nav-toggle { display: none; }

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

.app-shell.is-sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding-inline: 12px;
}

.app-shell.is-sidebar-collapsed .brand-logo-full { display: none; }

.app-shell.is-sidebar-collapsed .brand-logo-mark {
    display: grid;
    place-items: center;
}

.app-shell.is-sidebar-collapsed .primary-nav { padding-inline: 10px; }

.app-shell.is-sidebar-collapsed .nav-section-heading:not(.nav-section-heading--menu),
.app-shell.is-sidebar-collapsed .sidebar-mailboxes {
    display: none;
}

.app-shell.is-sidebar-collapsed .nav-section-heading--menu {
    justify-content: center;
    padding: 18px 0 9px;
}

.app-shell.is-sidebar-collapsed .nav-section-label,
.app-shell.is-sidebar-collapsed .nav-link-label {
    display: none;
}

.app-shell.is-sidebar-collapsed .sidebar-collapse-toggle.icon-button {
    width: 38px;
    height: 38px;
}

.app-shell.is-sidebar-collapsed .nav-link {
    width: 46px;
    min-height: 46px;
    justify-content: center;
    margin: 4px auto;
    padding: 11px;
}

.app-shell.is-sidebar-collapsed .nav-link.active::before {
    height: 22px;
}

.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(--brand);
    border-radius: 10px;
    background: var(--brand);
    box-shadow: var(--shadow-xs);
    color: #fff;
    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(--brand-hover);
    background: var(--brand-hover);
    color: #fff;
    box-shadow: 0 5px 14px rgba(29, 78, 216, .18);
}

.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);
    box-shadow: var(--focus);
}

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);
}

.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; }

.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);
}

.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;
}

.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(--brand);
    overflow-wrap: anywhere;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    word-break: break-word;
}

.message-html a:hover { color: var(--brand-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 details.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 details.message-quoted > summary {
    cursor: pointer;
    color: var(--ink-soft);
    font-size: .82em;
    font-weight: 650;
    padding: .72em 1em;
    user-select: none;
}

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

.message-html details.message-quoted > blockquote {
    margin: 0;
    border-left: 0;
    background: transparent;
    padding: 0 1em .9em;
}

.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;
}

.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;
    grid-template-columns: minmax(360px, .9fr) minmax(480px, 1.1fr);
}

.auth-brand-panel {
    position: relative;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    overflow: hidden;
    background:
        radial-gradient(circle at 75% 20%, rgba(147, 197, 253, .18), transparent 26%),
        radial-gradient(circle at 15% 85%, rgba(45, 212, 191, .12), transparent 30%),
        linear-gradient(145deg, var(--sidebar-bright) 0%, var(--sidebar-deep) 100%);
    color: #fff;
    padding: clamp(34px, 5vw, 68px);
}

.auth-brand-panel::after {
    position: absolute;
    right: -100px;
    bottom: -130px;
    width: 360px;
    height: 360px;
    border: 1px solid rgba(147, 197, 253, .18);
    border-radius: 50%;
    box-shadow:
        0 0 0 46px rgba(147, 197, 253, .05),
        0 0 0 92px rgba(147, 197, 253, .03);
    content: "";
}

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

.auth-brand-copy {
    position: relative;
    z-index: 1;
    max-width: 560px;
    margin: auto 0;
    padding: 70px 0;
}

.auth-brand-copy h2 {
    font-size: clamp(2.5rem, 5vw, 4.7rem);
    font-weight: 680;
    letter-spacing: -.065em;
    line-height: .98;
}

.auth-brand-copy p {
    max-width: 480px;
    color: #dbeafe;
    font-size: clamp(.98rem, 1.5vw, 1.12rem);
    margin: 22px 0 0;
}

.auth-proof {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    color: #bfdbfe;
    font-size: .75rem;
}

.auth-proof span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.auth-proof .icon { color: var(--accent); }

.auth-main {
    display: grid;
    min-width: 0;
    place-items: center;
    background:
        linear-gradient(rgba(37, 99, 235, .025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, .025) 1px, transparent 1px),
        var(--canvas);
    background-size: 28px 28px;
    padding: 32px;
}

.auth-card-wrap {
    width: min(100%, 470px);
}

.auth-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, .96);
    box-shadow: var(--shadow-lg);
}

.auth-card .card-body { padding: clamp(26px, 4vw, 38px); }

.auth-card h1 { font-size: clamp(1.7rem, 4vw, 2.05rem); }

.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: 25px; }

.auth-form .button { width: 100%; }

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

@media (max-width: 1100px) {
    .app-shell { grid-template-columns: 238px minmax(0, 1fr); }
    .app-shell.is-sidebar-collapsed { grid-template-columns: 72px minmax(0, 1fr); }
    .conversation-row { grid-template-columns: 40px minmax(140px, .75fr) minmax(200px, 1.4fr) auto 82px; }
    .conversation-arrow { display: none; }
    .auth-shell { grid-template-columns: minmax(330px, .8fr) minmax(450px, 1.2fr); }
}

@media (max-width: 860px) {
    .app-shell { display: block; }
    .app-shell.is-sidebar-collapsed { display: block; }
    .sidebar {
        position: sticky;
        z-index: 20;
        height: auto;
        min-height: 66px;
        overflow: visible;
    }
    .app-toolbar--conversation { top: 76px; }
    .sidebar-header {
        min-height: 66px;
        padding: 12px 16px;
    }
    .app-shell.is-sidebar-collapsed .sidebar-header {
        justify-content: space-between;
        padding: 12px 16px;
    }
    .app-shell.is-sidebar-collapsed .brand-logo-full { display: inline-flex; }
    .app-shell.is-sidebar-collapsed .brand-logo-mark { display: none; }
    .mobile-nav-toggle {
        display: grid;
        width: 39px;
        height: 39px;
        border: 1px solid rgba(255, 255, 255, .12);
        background: rgba(255, 255, 255, .06);
    }
    .sidebar-panel {
        position: absolute;
        top: 66px;
        right: 0;
        left: 0;
        display: none;
        max-height: calc(100vh - 66px);
        border-top: 1px solid var(--sidebar-line);
        background: var(--sidebar-deep);
        box-shadow: var(--shadow-lg);
    }
    .sidebar-panel.is-open { display: flex; }
    .primary-nav { padding-top: 14px; }
    .sidebar-collapse-toggle,
    .app-shell.is-sidebar-collapsed .sidebar-collapse-toggle { display: none; }
    .app-shell.is-sidebar-collapsed .nav-section-heading:not(.nav-section-heading--menu),
    .app-shell.is-sidebar-collapsed .sidebar-mailboxes { display: block; }
    .app-shell.is-sidebar-collapsed .nav-section-heading--menu {
        justify-content: space-between;
        padding: 24px 10px 7px;
    }
    .app-shell.is-sidebar-collapsed .nav-section-label,
    .app-shell.is-sidebar-collapsed .nav-link-label { display: inline; }
    .app-shell.is-sidebar-collapsed .nav-link {
        width: auto;
        min-height: 42px;
        justify-content: flex-start;
        margin: 2px 0;
        padding: 9px 11px;
    }
    .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 { display: block; }
    .auth-brand-panel { display: none; }
    .auth-main { min-height: 100vh; }
}

@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: 18px; }
    .auth-card .card-body { padding: 25px 22px; }
    .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;
    }
}
/* Components introduced by the dashboard and access-control merge. */

.brand-logo { width: 142px; }
.brand-logo .brand-logo-image {
    width: 100%;
    height: auto;
    filter: brightness(0) invert(1);
}
.brand-logo.brand-logo-mark { width: 38px; }
.brand-logo-mark .brand-mark-image {
    display: block;
    width: 38px;
    height: 38px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}
.auth-brand.brand-logo { width: 168px; }
.nav-link-disabled {
    color: var(--sidebar-muted);
    cursor: default;
    opacity: .72;
}
.nav-link-disabled:hover {
    background: transparent;
    color: var(--sidebar-muted);
}

.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); }
.unread-dot {
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: transparent;
}
.conversation-row.unread .unread-dot {
    background: var(--brand);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.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;
}
.side-conversation-inbox-chip {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 3px;
    border: 1px solid var(--note-line);
    border-radius: 999px;
    background: var(--note-soft);
    color: var(--note);
    font-size: .62rem;
    font-weight: 760;
    line-height: 1;
    padding: 3px 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 rgba(37, 99, 235, .32);
    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 rgba(37, 99, 235, .32);
    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 {
    align-items: stretch;
}

.conversation-layout--chat .conversation-main {
    display: grid;
    gap: 0;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr) auto;
    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: auto;
    overscroll-behavior: contain;
    scroll-padding-block: 20px;
    background: var(--surface-hover);
    border-bottom: 1px solid var(--line);
    padding: 20px;
}

.conversation-message-list:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .32);
    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;
    border: 0;
    background: transparent;
    padding: 0 4px 4px;
}

.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-bottom: 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 rgba(37, 99, 235, .32);
    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; }

.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-top: 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;
    max-height: 100%;
    min-height: 0;
    overflow: auto;
}

@media (min-width: 861px) {
    .conversation-layout--chat {
        height: max(420px, calc(100vh - 220px));
        height: max(420px, calc(100dvh - 220px));
        height: var(--conversation-workspace-height, max(420px, calc(100dvh - 220px)));
    }
}

@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: max(420px, calc(100vh - 220px));
        height: max(420px, calc(100dvh - 220px));
        height: var(--conversation-workspace-height, max(420px, calc(100dvh - 220px)));
    }

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

@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: 160px;
    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-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;
    opacity: .8;
}

.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 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) {
    .app-toolbar--conversation .app-toolbar-label,
    .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-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 side conversations */
.side-conversations {
    min-width: 0;
}

.side-conversations-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.side-conversations-heading h3 {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--ink);
    font-size: .9rem;
    margin: 0;
}

.side-conversations-heading h3 .icon { color: var(--note); }

.side-conversations-heading p {
    color: var(--muted);
    font-size: .72rem;
    line-height: 1.4;
    margin: 4px 0 0;
}

.side-conversations-create-button {
    flex: 0 0 auto;
    gap: 5px;
}

.side-conversation-list {
    display: grid;
    gap: 7px;
    margin-top: 12px;
}

.side-conversation-card {
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel);
    color: var(--ink-soft);
    cursor: pointer;
    font: inherit;
    text-align: left;
    padding: 9px 10px;
    transition: background-color 130ms ease, border-color 130ms ease, box-shadow 130ms ease;
}

.side-conversation-card:hover {
    border-color: var(--note-line);
    background: var(--note-soft);
}

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

.side-conversation-card.is-active {
    border-color: var(--note-line);
    background: var(--note-soft);
}

.side-conversation-card-main {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.side-conversation-card-title {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 6px;
}

.side-conversation-card-title strong {
    min-width: 0;
    overflow: hidden;
    color: var(--ink);
    font-size: .79rem;
    font-weight: 720;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.side-conversation-card-people,
.side-conversation-card-meta {
    overflow: hidden;
    color: var(--muted);
    font-size: .68rem;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.side-conversation-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.side-conversation-card-chevron {
    flex: 0 0 auto;
    color: var(--muted);
}

.side-conversation-unread {
    display: inline-grid;
    min-width: 18px;
    height: 18px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 999px;
    background: var(--note);
    color: #fff;
    font-size: .61rem;
    font-weight: 780;
    line-height: 1;
    padding-inline: 4px;
}

.side-conversation-status {
    display: inline-flex;
    width: fit-content;
    flex: 0 0 auto;
    align-items: center;
    border: 1px solid var(--success-line);
    border-radius: 999px;
    background: var(--success-soft);
    color: var(--success);
    font-size: .63rem;
    font-weight: 730;
    line-height: 1.1;
    padding: 3px 6px;
}

.side-conversation-status.is-closed {
    border-color: var(--neutral-line);
    background: var(--neutral-soft);
    color: var(--muted-strong);
}

.side-conversations-empty {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: .74rem;
    line-height: 1.45;
    padding: 4px 0;
}

.side-conversation-drawer {
    position: fixed;
    z-index: 45;
    top: 84px;
    right: clamp(20px, 4vw, 58px);
    bottom: 20px;
    display: grid;
    width: min(540px, calc(100vw - 330px));
    min-width: min(360px, calc(100vw - 330px));
    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-lg);
}

.side-conversation-drawer--thread {
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.side-conversation-drawer-header {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
    padding: 15px 18px;
}

.side-conversation-drawer-header > div:first-child {
    min-width: 0;
}

.side-conversation-drawer-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--note);
    font-size: .68rem;
    font-weight: 760;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.side-conversation-drawer-header h2 {
    overflow: hidden;
    color: var(--ink);
    font-size: 1.02rem;
    line-height: 1.25;
    margin: 4px 0 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.side-conversation-participant-summary {
    overflow: hidden;
    color: var(--muted);
    font-size: .74rem;
    line-height: 1.35;
    margin: 4px 0 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.side-conversation-drawer-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

.side-conversation-form {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 18px;
}

.side-conversation-form textarea {
    min-height: 122px;
    max-height: 280px;
}

.side-conversation-people-fieldset {
    min-width: 0;
    border: 0;
    margin: 0;
    padding: 0;
}

.side-conversation-people-fieldset legend {
    color: var(--ink-soft);
    font-size: .8rem;
    font-weight: 680;
    padding: 0;
}

.side-conversation-people-options {
    display: grid;
    gap: 6px;
    margin-top: 10px;
}

.side-conversation-person-option {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel);
    color: var(--ink-soft);
    cursor: pointer;
    font-size: .8rem;
    font-weight: 620;
    margin: 0;
    padding: 8px 9px;
}

.side-conversation-person-option:hover { border-color: var(--line-hover); }

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

.side-conversation-person-option:has(input:checked) {
    border-color: var(--note-line);
    background: var(--note-soft);
    color: var(--note);
}

.side-conversation-person-option input {
    width: 17px;
    height: 17px;
    min-height: 0;
    flex: 0 0 auto;
    accent-color: var(--note);
    margin: 0;
    padding: 0;
}

.side-conversation-privacy-note {
    display: inline-flex;
    align-items: flex-start;
    gap: 6px;
    color: var(--note);
    font-size: .74rem;
    line-height: 1.42;
    margin: 0;
}

.side-conversation-privacy-note .icon { flex: 0 0 auto; margin-top: 1px; }

.side-conversation-message-list {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    background: var(--surface-hover);
    padding: 16px;
}

.side-conversation-message-list:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .32);
    outline-offset: -3px;
}

.side-conversation-message {
    display: grid;
    gap: 4px;
    margin-bottom: 13px;
}

.side-conversation-message.is-own .side-conversation-message-meta {
    justify-content: flex-end;
}

.side-conversation-message-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: .69rem;
    padding-inline: 3px;
}

.side-conversation-message-meta strong {
    min-width: 0;
    overflow: hidden;
    color: var(--ink-soft);
    font-size: .74rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.side-conversation-message-meta time {
    flex: 0 0 auto;
    white-space: nowrap;
}

.side-conversation-message-bubble {
    max-width: 92%;
    border: 1px solid var(--note-line);
    border-radius: 5px var(--radius-lg) var(--radius-lg) var(--radius-lg);
    background: var(--panel);
    color: var(--ink);
    font-size: .84rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
    padding: 10px 12px;
    white-space: pre-wrap;
}

.side-conversation-message.is-own .side-conversation-message-bubble {
    justify-self: end;
    border-color: var(--brand-line);
    border-radius: var(--radius-lg) 5px var(--radius-lg) var(--radius-lg);
    background: var(--brand-soft);
}

.side-conversation-latest-marker {
    height: 1px;
    scroll-margin-bottom: 16px;
}

.side-conversation-reply-form {
    display: grid;
    gap: 8px;
    border-top: 1px solid var(--line);
    background: var(--panel);
    padding: 12px 16px 14px;
}

.side-conversation-reply-form textarea {
    min-height: 82px;
    max-height: 170px;
}

.side-conversation-reply-actions {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.side-conversation-reply-actions .button {
    flex: 0 0 auto;
}

.side-conversation-closed-note {
    border-top: 1px solid var(--line);
    background: var(--neutral-soft);
    color: var(--muted-strong);
    font-size: .78rem;
    line-height: 1.45;
    padding: 14px 16px;
}

@media (max-width: 860px) {
    .side-conversation-drawer {
        top: 138px;
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto;
        min-width: 0;
    }
}

@media (max-width: 560px) {
    .side-conversation-drawer-header,
    .side-conversation-reply-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .side-conversation-drawer-actions {
        justify-content: flex-start;
    }

    .side-conversation-drawer-actions .button,
    .side-conversation-reply-actions .button {
        width: 100%;
    }

    .side-conversation-message-list {
        padding: 13px;
    }
}

/* 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(--info-line);
    background: var(--info-soft);
    color: var(--info);
}

.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 {
    border-color: var(--process-line);
    background: var(--process-soft);
    color: var(--process);
}

.conversation-sla-chip--at_risk {
    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-chip--paused,
.conversation-sla-chip--cancelled {
    border-color: var(--neutral-line);
    background: var(--neutral-soft);
    color: var(--neutral-ink);
}

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

.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,
    .conversation-subject-line .conversation-sla-chip {
        display: none;
    }
}
