/* ============================================================================
 * SureLife Rich Chat Message Typography & Layout
 * Shared across global chat widget, client portal chat, and staff support hub.
 * ========================================================================== */

.slc-rich-msg {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    font-size: inherit;
    line-height: 1.55;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.slc-rich-msg .slc-fmt-p {
    margin: 0;
}

.slc-rich-msg .slc-fmt-heading {
    margin: 0.45rem 0 0.1rem;
    padding-bottom: 0.28rem;
    font-weight: 700;
    font-size: 0.88em;
    letter-spacing: -0.01em;
    border-bottom: 1px solid rgba(16, 185, 129, 0.24);
    color: #065f46;
}

.slc-rich-msg .slc-fmt-heading:first-child {
    margin-top: 0;
}

.slc-rich-msg strong {
    font-weight: 700;
}

.slc-rich-msg em {
    font-style: italic;
    opacity: 0.92;
}

.slc-rich-msg code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.88em;
    padding: 0.08rem 0.32rem;
    border-radius: 0.3rem;
    background: rgba(15, 23, 42, 0.08);
}

.slc-rich-msg .slc-fmt-list,
.slc-rich-msg .slc-fmt-ol,
.slc-rich-msg .slc-fmt-checklist {
    margin: 0.08rem 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.slc-rich-msg .slc-fmt-list > li:not(.slc-fmt-card-item) {
    position: relative;
    padding-left: 0.95rem;
}

.slc-rich-msg .slc-fmt-list > li:not(.slc-fmt-card-item)::before {
    content: "";
    position: absolute;
    left: 0.15rem;
    top: 0.58em;
    width: 0.34rem;
    height: 0.34rem;
    border-radius: 9999px;
    background: #10b981;
}

/* Mini-card styling for structured Plan / Branch bullets with sub-details */
.slc-rich-msg .slc-fmt-list > li.slc-fmt-card-item {
    padding: 0.5rem 0.65rem;
    border-radius: 0.65rem;
    background: rgba(16, 185, 129, 0.07);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.slc-rich-msg .slc-fmt-card-title {
    font-size: 1em;
    line-height: 1.4;
}

.slc-rich-msg .slc-fmt-sublist {
    margin: 0.32rem 0 0.05rem;
    padding: 0.18rem 0 0.18rem 0.68rem;
    list-style: none;
    border-left: 2px solid rgba(16, 185, 129, 0.35);
    display: flex;
    flex-direction: column;
    gap: 0.24rem;
}

.slc-rich-msg .slc-fmt-sublist > li {
    position: relative;
    padding-left: 0.65rem;
    font-size: 0.93em;
    line-height: 1.45;
    opacity: 0.96;
}

.slc-rich-msg .slc-fmt-sublist > li::before {
    content: "•";
    position: absolute;
    left: 0;
    top: 0;
    color: #10b981;
    font-weight: 700;
}

.slc-rich-msg .slc-fmt-checklist > li {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
}

.slc-rich-msg .slc-fmt-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.05rem;
    height: 1.05rem;
    margin-top: 0.16em;
    border-radius: 9999px;
    background: rgba(16, 185, 129, 0.16);
    color: #059669;
    font-size: 0.72em;
    font-weight: 800;
    line-height: 1;
}

.slc-rich-msg .slc-fmt-ol {
    counter-reset: slc-step;
    gap: 0.45rem;
}

.slc-rich-msg .slc-fmt-ol > li {
    counter-increment: slc-step;
    position: relative;
    padding-left: 1.45rem;
}

.slc-rich-msg .slc-fmt-ol > li::before {
    content: counter(slc-step) ".";
    position: absolute;
    left: 0;
    top: 0;
    font-weight: 700;
    color: #059669;
    font-size: 0.92em;
}

.slc-rich-msg .slc-fmt-link {
    color: #059669;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.slc-rich-msg .slc-fmt-link:hover {
    color: #047857;
}

.slc-rich-msg .slc-fmt-tel {
    text-decoration: none;
    border-bottom: 1px dashed rgba(16, 185, 129, 0.55);
}

.slc-rich-msg .slc-fmt-table-wrap {
    width: 100%;
    overflow-x: auto;
    border-radius: 0.5rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    margin: 0.2rem 0;
}

.slc-rich-msg .slc-fmt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.slc-rich-msg .slc-fmt-table th,
.slc-rich-msg .slc-fmt-table td {
    padding: 0.35rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.slc-rich-msg .slc-fmt-table th {
    font-weight: 700;
    background: rgba(16, 185, 129, 0.12);
}

/* Dark theme harmonization across Tailwind .dark / data-theme attributes */
[data-theme="dark"] .slc-rich-msg .slc-fmt-heading,
[data-theme-mode="dark"] .slc-rich-msg .slc-fmt-heading,
.dark .slc-rich-msg .slc-fmt-heading,
html.dark .slc-rich-msg .slc-fmt-heading,
body.dark .slc-rich-msg .slc-fmt-heading {
    color: #6ee7b7;
    border-bottom-color: rgba(110, 231, 183, 0.26);
}

[data-theme="dark"] .slc-rich-msg .slc-fmt-list > li.slc-fmt-card-item,
[data-theme-mode="dark"] .slc-rich-msg .slc-fmt-list > li.slc-fmt-card-item,
.dark .slc-rich-msg .slc-fmt-list > li.slc-fmt-card-item,
html.dark .slc-rich-msg .slc-fmt-list > li.slc-fmt-card-item,
body.dark .slc-rich-msg .slc-fmt-list > li.slc-fmt-card-item {
    background: rgba(16, 185, 129, 0.09);
    border-color: rgba(110, 231, 183, 0.22);
}

[data-theme="dark"] .slc-rich-msg .slc-fmt-check,
[data-theme-mode="dark"] .slc-rich-msg .slc-fmt-check,
.dark .slc-rich-msg .slc-fmt-check,
html.dark .slc-rich-msg .slc-fmt-check,
body.dark .slc-rich-msg .slc-fmt-check {
    background: rgba(52, 211, 153, 0.2);
    color: #6ee7b7;
}

[data-theme="dark"] .slc-rich-msg .slc-fmt-ol > li::before,
[data-theme-mode="dark"] .slc-rich-msg .slc-fmt-ol > li::before,
.dark .slc-rich-msg .slc-fmt-ol > li::before,
html.dark .slc-rich-msg .slc-fmt-ol > li::before,
body.dark .slc-rich-msg .slc-fmt-ol > li::before,
[data-theme="dark"] .slc-rich-msg .slc-fmt-link,
[data-theme-mode="dark"] .slc-rich-msg .slc-fmt-link,
.dark .slc-rich-msg .slc-fmt-link,
html.dark .slc-rich-msg .slc-fmt-link,
body.dark .slc-rich-msg .slc-fmt-link {
    color: #6ee7b7;
}

[data-theme="dark"] .slc-rich-msg .slc-fmt-link:hover,
.dark .slc-rich-msg .slc-fmt-link:hover {
    color: #a7f3d0;
}

[data-theme="dark"] .slc-rich-msg code,
.dark .slc-rich-msg code {
    background: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .slc-rich-msg .slc-fmt-sublist,
.dark .slc-rich-msg .slc-fmt-sublist {
    border-left-color: rgba(110, 231, 183, 0.34);
}
