:root {
    --app-primary: #2457a6;
    --app-primary-dark: #173d78;
    --app-teal: #1d7f72;
    --app-teal-soft: #e8f6f3;
    --app-amber: #c27a1a;
    --app-ink: #172033;
    --app-muted: #667085;
    --app-soft: #f5f7fb;
    --app-line: #e6eaf2;
    --app-surface: #ffffff;
    --app-surface-soft: #fbfcff;
    --app-shadow-sm: 0 10px 24px rgba(20, 31, 52, .06);
    --app-shadow-md: 0 18px 46px rgba(20, 31, 52, .10);
    --app-success: #198754;
    --app-warning: #b86e00;
    --app-danger: #c23434;
}

body {
    background: var(--app-soft);
    color: var(--app-ink);
    font-family: "Noto Sans Thai", "Segoe UI", system-ui, sans-serif;
}

a {
    text-decoration: none;
}

.navbar {
    box-shadow: 0 1px 12px rgba(20, 31, 52, 0.05);
}

.hero {
    background: linear-gradient(135deg, #f7fbff 0%, #ffffff 52%, #fff8ef 100%);
    border-bottom: 1px solid var(--app-line);
}

.hero-visual {
    background: #0f1f3a;
    color: #fff;
    min-height: 360px;
    position: relative;
    overflow: hidden;
}

.hero-visual::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px),
        linear-gradient(0deg, rgba(255,255,255,.08) 1px, transparent 1px);
    background-size: 34px 34px;
}

.hero-visual-inner {
    position: relative;
    z-index: 1;
}

.app-card,
.stat-card {
    background: #fff;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(20, 31, 52, 0.04);
}

.stat-card {
    padding: 1rem;
}

.icon-pill {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #e9f1ff;
    color: var(--app-primary);
}

.section-band {
    padding: 4rem 0;
}

.legal-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .4rem .7rem;
    border: 1px solid var(--app-line);
    border-radius: 999px;
    background: #fff;
    color: #344054;
    font-size: .9rem;
}

.app-sidebar {
    position: sticky;
    top: 86px;
}

.app-sidebar .list-group-item {
    border-color: var(--app-line);
}

.dashboard-shell {
    padding: 2rem 0;
}

.chat-shell {
    height: calc(100vh - 180px);
    min-height: 620px;
}

.chat-box {
    height: 100%;
    overflow-y: auto;
    background: #fff;
}

.chat-message {
    max-width: 78%;
    border-radius: 8px;
    padding: .75rem .9rem;
    line-height: 1.65;
}

.chat-message.user {
    margin-left: auto;
    background: #2457a6;
    color: #fff;
}

.chat-message.ai {
    margin-right: auto;
    background: #f2f5f9;
    color: var(--app-ink);
}

.typing-message {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    color: #526071;
}

.ai-typing {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}

.ai-typing i {
    width: .42rem;
    height: .42rem;
    border-radius: 50%;
    background: var(--app-primary);
    opacity: .35;
    animation: aiTypingPulse 1s infinite ease-in-out;
}

.ai-typing i:nth-child(2) {
    animation-delay: .14s;
}

.ai-typing i:nth-child(3) {
    animation-delay: .28s;
}

@keyframes aiTypingPulse {
    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: .35;
    }
    40% {
        transform: translateY(-3px);
        opacity: .9;
    }
}

.analysis-card {
    border-left: 4px solid var(--app-primary);
}

.level-low {
    color: var(--app-success);
}

.level-medium {
    color: var(--app-warning);
}

.level-high,
.level-critical {
    color: var(--app-danger);
}

.table td,
.table th {
    vertical-align: middle;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #e9f1ff;
    color: var(--app-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.small-muted {
    color: var(--app-muted);
    font-size: .92rem;
}

.footer-links a {
    color: var(--app-muted);
}

.footer-links a:hover {
    color: var(--app-primary);
}

.notification-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--app-danger);
    color: #fff;
    font-size: .7rem;
    line-height: 18px;
    text-align: center;
}

.notification-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--app-line);
}

.notification-item:last-child,
.contact-thread:last-child {
    border-bottom: 0 !important;
}

.notification-item.unread {
    background: #f7fbff;
    margin-inline: -.75rem;
    padding-inline: .75rem;
    border-radius: 8px;
}

.status-new,
.status-in_progress,
.status-closed {
    border: 1px solid transparent;
}

.status-new {
    background: #fff3cd;
    color: #664d03;
    border-color: #ffecb5;
}

.status-in_progress {
    background: #cff4fc;
    color: #055160;
    border-color: #b6effb;
}

.status-closed {
    background: #d1e7dd;
    color: #0f5132;
    border-color: #badbcc;
}

.active-filter {
    border-color: var(--app-primary);
    box-shadow: 0 10px 28px rgba(36, 87, 166, 0.11);
}

.legal-content p {
    color: var(--app-muted);
}

.review-row {
    background: #fbfcff;
}

.portal-card {
    display: flex;
    flex-direction: column;
}

.portal-icon {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e9f1ff;
    color: var(--app-primary);
    font-size: 1.7rem;
}

.portal-requirements {
    display: grid;
    gap: .4rem;
    margin: .25rem 0 1rem;
    padding: .9rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: #fbfcff;
    color: #475467;
    font-size: .92rem;
}

.portal-requirements i {
    color: var(--app-success);
    margin-right: .25rem;
}

.auth-section {
    padding: 3rem 0;
    background:
        linear-gradient(180deg, rgba(247, 249, 252, .96) 0%, rgba(238, 243, 248, .96) 100%),
        repeating-linear-gradient(135deg, rgba(36, 87, 166, .05) 0 1px, transparent 1px 18px);
}

.auth-shell {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(20, 31, 52, 0.13);
    animation: authRise .35s ease-out both;
}

.auth-side {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    padding: 2rem;
    color: #fff;
    background:
        linear-gradient(145deg, #172033 0%, #274760 58%, #2d6b5d 100%);
    overflow: hidden;
}

.auth-lawyer .auth-side {
    background:
        linear-gradient(145deg, #17352c 0%, #265c4b 55%, #8a6a25 100%);
}

.auth-admin .auth-side {
    background:
        linear-gradient(145deg, #181a26 0%, #32384e 56%, #6d3b3b 100%);
}

.auth-side::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px),
        linear-gradient(0deg, rgba(255,255,255,.08) 1px, transparent 1px);
    background-size: 36px 36px;
    opacity: .65;
}

.auth-side::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 42%;
    background: linear-gradient(0deg, rgba(0, 0, 0, .24), transparent);
}

.auth-side > * {
    position: relative;
    z-index: 1;
}

.auth-badge {
    width: fit-content;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    border-color: rgba(255, 255, 255, .28);
}

.auth-title {
    max-width: 620px;
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.25;
}

.auth-copy {
    max-width: 660px;
    margin: 0;
    color: rgba(255, 255, 255, .78);
    line-height: 1.8;
}

.auth-stage {
    display: grid;
    gap: .65rem;
    padding: .85rem;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 8px;
    background: rgba(255, 255, 255, .12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
    backdrop-filter: blur(10px);
}

.auth-stage-top,
.auth-stage-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.auth-stage-top {
    color: rgba(255, 255, 255, .70);
    font-size: .82rem;
    text-transform: uppercase;
}

.auth-stage-top strong {
    color: #fff;
}

.auth-stage-row {
    justify-content: flex-start;
    padding: .75rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, .10);
    transform: translateZ(0);
}

.auth-stage-row.is-active {
    background: rgba(255, 255, 255, .18);
}

.auth-stage-row i {
    width: 36px;
    height: 36px;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    font-size: 1.05rem;
}

.auth-stage-row strong,
.auth-stage-row span {
    display: block;
}

.auth-stage-row strong {
    color: #fff;
    font-size: .95rem;
}

.auth-stage-row span {
    color: rgba(255, 255, 255, .70);
    font-size: .83rem;
}

.auth-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.auth-meta-grid > div {
    padding: .85rem;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 8px;
    background: rgba(255, 255, 255, .10);
}

.auth-meta-grid span {
    display: block;
    color: rgba(255, 255, 255, .65);
    font-size: .82rem;
    margin-bottom: .25rem;
}

.auth-meta-grid strong {
    display: block;
    color: #fff;
    font-weight: 700;
}

.auth-requirements {
    margin-top: auto;
    padding-top: 1rem;
}

.auth-requirements h2 {
    margin-bottom: .8rem;
    font-size: 1rem;
    font-weight: 800;
}

.auth-check-list {
    display: grid;
    gap: .65rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.auth-check-list li {
    display: flex;
    gap: .55rem;
    align-items: flex-start;
    color: rgba(255, 255, 255, .86);
    line-height: 1.55;
}

.auth-check-list i {
    color: #9de6bf;
    margin-top: .16rem;
}

.auth-alt-box {
    display: grid;
    gap: .35rem;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, .20);
    border-radius: 8px;
    background: rgba(255, 255, 255, .12);
}

.auth-alt-box span {
    color: rgba(255, 255, 255, .76);
    line-height: 1.55;
}

.auth-alt-box a {
    color: #fff;
    font-weight: 700;
}

.auth-card {
    position: relative;
    padding: 2rem;
    background: #fff;
}

.auth-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, #2457a6, #2d8a6e, #b7791f);
}

.auth-switch {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .5rem;
    padding: .35rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: #f4f7fb;
    box-shadow: inset 0 1px 1px rgba(20, 31, 52, .04);
}

.auth-switch a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .55rem .6rem;
    border-radius: 6px;
    color: #344054;
    font-weight: 700;
    text-align: center;
    transition: transform .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease;
}

.auth-switch a.active {
    background: #fff;
    color: var(--app-primary);
    box-shadow: 0 6px 18px rgba(20, 31, 52, .08);
}

.auth-switch a:hover {
    transform: translateY(-1px);
}

.auth-eyebrow {
    display: inline-block;
    margin-bottom: .35rem;
    color: #6d3b3b;
    font-size: .82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.auth-form {
    margin: 0;
}

.auth-field {
    margin-bottom: 1rem;
}

.auth-input-icon {
    position: relative;
}

.auth-input-icon > i {
    position: absolute;
    z-index: 4;
    top: 29px;
    left: 1rem;
    transform: translateY(-50%);
    color: #667085;
}

.auth-field .form-control,
.auth-field .form-select {
    min-height: 58px;
    border-color: #d9e0ea;
    border-radius: 8px;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.auth-input-icon .form-control {
    padding-left: 3rem;
}

.auth-input-icon .form-floating > label {
    padding-left: 3rem;
}

.auth-input-icon .form-floating > .form-control:focus ~ label,
.auth-input-icon .form-floating > .form-control:not(:placeholder-shown) ~ label {
    transform: scale(.85) translateY(-.5rem) translateX(.65rem);
}

.auth-field .form-control:focus,
.auth-textarea:focus,
.auth-checkbox-item:has(input:focus) {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 .2rem rgba(36, 87, 166, .12);
}

.auth-field .form-control:focus {
    transform: translateY(-1px);
}

.auth-password-wrap .form-control {
    padding-right: 3.4rem;
}

.auth-password-toggle {
    position: absolute;
    z-index: 5;
    top: 9px;
    right: .55rem;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 8px;
    background: #eef3f8;
    color: #475467;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.auth-password-toggle:hover {
    background: #e1e9f4;
    color: var(--app-primary);
    transform: translateY(-1px);
}

.auth-caps-warning {
    margin: -.35rem 0 .75rem;
    color: #b86e00;
    font-size: .86rem;
}

.auth-caps-warning i {
    margin-right: .25rem;
}

.auth-textarea {
    border-color: #d9e0ea;
    border-radius: 8px;
}

.auth-submit {
    min-height: 50px;
    font-weight: 800;
    box-shadow: 0 12px 26px rgba(36, 87, 166, .24);
    transition: transform .18s ease, box-shadow .18s ease;
}

.auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(36, 87, 166, .28);
}

.auth-social {
    margin: 1rem 0 1.2rem;
}

.auth-divider {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: .85rem;
    color: var(--app-muted);
    font-size: .86rem;
    font-weight: 800;
}

.auth-divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e4eaf3;
}

.auth-divider span {
    position: relative;
    z-index: 1;
    padding: 0 .8rem;
    background: #fff;
}

.auth-social-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .75rem;
}

.auth-social-button {
    min-height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    padding: .75rem .8rem;
    border: 1px solid #d9e4f2;
    border-radius: 8px;
    background: linear-gradient(180deg, #fff, #f8fbff);
    color: #25324a;
    font-weight: 850;
    text-align: center;
    box-shadow: 0 10px 22px rgba(20, 31, 52, .06);
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.auth-social-button:hover {
    transform: translateY(-1px);
    border-color: rgba(36, 87, 166, .25);
    color: var(--app-primary);
    box-shadow: 0 14px 28px rgba(20, 31, 52, .10);
}

.auth-social-button i {
    font-size: 1.15rem;
}

.auth-social-button.is-google i {
    color: #db4437;
}

.auth-social-button em {
    padding: .2rem .4rem;
    border-radius: 999px;
    background: #edf2fb;
    color: #667085;
    font-size: .72rem;
    font-style: normal;
    font-weight: 800;
}

.profile-social-grid,
.social-admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .85rem;
}

.profile-social-item {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .9rem;
    border: 1px solid #d9e4f2;
    border-radius: 8px;
    background: #fbfcff;
}

.profile-social-item > i,
.social-admin-head > i {
    width: 40px;
    height: 40px;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #edf3fb;
    font-size: 1.15rem;
}

.profile-social-item i.is-google,
.social-admin-head i.is-google {
    color: #db4437;
}

.profile-social-item div {
    min-width: 0;
    display: grid;
    gap: .12rem;
}

.profile-social-item strong,
.profile-social-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-social-item span {
    color: var(--app-muted);
    font-size: .82rem;
}

.profile-social-item em,
.social-admin-head em {
    margin-left: auto;
    padding: .22rem .45rem;
    border-radius: 999px;
    background: #edf2fb;
    color: #667085;
    font-size: .72rem;
    font-style: normal;
    font-weight: 850;
    white-space: nowrap;
}

.profile-social-item em.is-connected,
.social-admin-head em.is-ready {
    background: #e9f7ef;
    color: #137044;
}

.social-admin-card {
    padding: 1rem;
}

.social-admin-head {
    display: flex;
    align-items: center;
    gap: .7rem;
    margin-bottom: .85rem;
}

.social-admin-head h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 850;
}

.social-admin-head span,
.social-admin-card label {
    color: var(--app-muted);
    font-size: .78rem;
}

.social-admin-card label {
    display: block;
    margin-bottom: .35rem;
    font-weight: 800;
    text-transform: uppercase;
}

.social-admin-card code,
.social-env-list code {
    display: block;
    padding: .65rem .7rem;
    border: 1px solid #e0e7f0;
    border-radius: 6px;
    background: #f8faff;
    color: #344054;
    overflow-wrap: anywhere;
}

.social-env-list {
    display: grid;
    gap: .55rem;
}

.auth-footnote {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem .8rem;
    align-items: center;
    margin-top: 1.2rem;
    color: var(--app-muted);
}

.auth-footnote a {
    font-weight: 700;
}

.auth-demo,
.auth-lock-note {
    display: flex;
    gap: .55rem;
    align-items: flex-start;
    margin-top: 1rem;
    padding: .85rem;
    border: 1px solid #e6eaf2;
    border-radius: 8px;
    background: #fbfcff;
    color: var(--app-muted);
    font-size: .92rem;
}

.auth-demo-card {
    display: flex;
    gap: .9rem;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding: .9rem;
    border: 1px solid #d9e4f2;
    border-radius: 8px;
    background: linear-gradient(180deg, #fbfcff, #f4f8fd);
}

.auth-demo-card > div {
    display: flex;
    gap: .65rem;
    align-items: flex-start;
    min-width: 0;
}

.auth-demo-card i {
    width: 36px;
    height: 36px;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #e9f1ff;
    color: var(--app-primary);
}

.auth-demo-card strong,
.auth-demo-card small {
    display: block;
}

.auth-demo-card small {
    color: var(--app-muted);
    overflow-wrap: anywhere;
}

.auth-demo-card .btn {
    flex: 0 0 auto;
    font-weight: 700;
}

.auth-demo-card .btn.is-done {
    background: var(--app-success);
    border-color: var(--app-success);
    color: #fff;
}

.auth-lock-note {
    margin-top: 0;
    background: #fff8e8;
    border-color: #f6ddb0;
    color: #6d4b10;
}

.auth-demo i,
.auth-lock-note i {
    color: var(--app-primary);
    margin-top: .14rem;
}

.auth-consent {
    display: flex;
    gap: .65rem;
    align-items: flex-start;
    width: 100%;
    padding: .9rem;
    border: 1px solid #e6eaf2;
    border-radius: 8px;
    background: #fbfcff;
    color: #344054;
    line-height: 1.55;
}

.auth-consent input {
    flex: 0 0 auto;
    margin-top: .22rem;
}

.auth-consent-compact {
    align-items: center;
    min-height: 58px;
    margin: 0;
}

.auth-form-section {
    display: inline-flex;
    gap: .5rem;
    align-items: center;
    margin-top: .4rem;
    color: #344054;
    font-weight: 800;
}

.auth-form-section i {
    color: var(--app-primary);
}

.auth-form-section em {
    margin-left: .35rem;
    padding: .15rem .45rem;
    border-radius: 999px;
    background: #e9f1ff;
    color: var(--app-primary);
    font-size: .78rem;
    font-style: normal;
}

.auth-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .6rem;
    margin-top: .75rem;
}

.auth-checkbox-item {
    display: flex;
    gap: .55rem;
    align-items: flex-start;
    min-height: 48px;
    padding: .75rem;
    border: 1px solid #e6eaf2;
    border-radius: 8px;
    background: #fbfcff;
    cursor: pointer;
}

.auth-checkbox-item input {
    margin-top: .18rem;
}

.auth-checkbox-item:has(input:checked) {
    border-color: rgba(36, 87, 166, .45);
    background: #f2f7ff;
    box-shadow: 0 8px 20px rgba(36, 87, 166, .08);
}

.auth-strength {
    display: grid;
    gap: .35rem;
    margin-top: .4rem;
}

.auth-strength-track {
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: #e6eaf2;
}

.auth-strength-bar {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #c23434;
    transition: width .22s ease, background .22s ease;
}

.auth-strength-bar.fair {
    background: #b86e00;
}

.auth-strength-bar.good {
    background: #2d8a6e;
}

.auth-strength-bar.strong {
    background: #198754;
}

.auth-strength-text,
.auth-file-hint {
    color: var(--app-muted);
    font-size: .84rem;
}

.auth-rule-row {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-top: .45rem;
}

.auth-rule-row span {
    display: inline-flex;
    gap: .2rem;
    align-items: center;
    padding: .2rem .45rem;
    border-radius: 999px;
    background: #f2f4f7;
    color: #667085;
    font-size: .78rem;
}

.auth-rule-row span.is-passed {
    background: #e9f8ef;
    color: #146c43;
}

.auth-file-hint {
    margin-top: .35rem;
    overflow-wrap: anywhere;
}

@keyframes authRise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 991.98px) {
    .auth-section {
        padding: 1.25rem 0;
    }

    .auth-side,
    .auth-card {
        padding: 1.5rem;
    }

    .auth-title {
        font-size: 1.55rem;
    }

    .auth-requirements {
        margin-top: 0;
    }

    .auth-stage {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .auth-switch,
    .auth-meta-grid,
    .auth-checkbox-grid {
        grid-template-columns: 1fr;
    }

    .auth-switch a {
        justify-content: flex-start;
    }

    .auth-demo-card {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-shell,
    .auth-switch a,
    .auth-field .form-control,
    .auth-submit,
    .auth-password-toggle,
    .auth-strength-bar {
        animation: none;
        transition: none;
    }
}

body.admin-page {
    background:
        linear-gradient(180deg, #f6f8fb 0%, #eef3f7 100%);
}

.admin-dashboard {
    padding-top: 1.5rem;
}

.admin-sidebar {
    display: grid;
    gap: .9rem;
}

.admin-profile-card {
    display: flex;
    gap: .85rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background:
        linear-gradient(145deg, #172033, #284159 62%, #2e685d);
    color: #fff;
    box-shadow: 0 14px 32px rgba(20, 31, 52, .10);
}

.admin-avatar {
    width: 44px;
    height: 44px;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, .14);
    font-size: 1.25rem;
}

.admin-profile-label,
.admin-profile-email {
    color: rgba(255, 255, 255, .72);
    font-size: .78rem;
}

.admin-profile-name {
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-nav {
    gap: .35rem;
    padding: .5rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(20, 31, 52, .06);
}

.admin-nav .list-group-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    border: 0;
    border-radius: 8px;
    color: #475467;
    font-weight: 700;
    transition: transform .18s ease, background .18s ease, color .18s ease;
}

.admin-nav .list-group-item span {
    display: inline-flex;
    gap: .6rem;
    align-items: center;
}

.admin-nav .list-group-item i {
    width: 22px;
    color: #667085;
}

.admin-nav .list-group-item:hover {
    background: #f4f7fb;
    color: var(--app-primary);
    transform: translateX(2px);
}

.admin-nav .list-group-item.active {
    background: #e9f1ff;
    color: var(--app-primary);
}

.admin-nav .list-group-item.active i {
    color: var(--app-primary);
}

.admin-nav .list-group-item em {
    min-width: 24px;
    height: 24px;
    padding: 0 .4rem;
    border-radius: 999px;
    background: #c23434;
    color: #fff;
    font-size: .75rem;
    font-style: normal;
    line-height: 24px;
    text-align: center;
}

.admin-public-link {
    display: flex;
    gap: .6rem;
    align-items: center;
    padding: .85rem 1rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: #fff;
    color: #475467;
    font-weight: 700;
}

.admin-public-link:hover {
    color: var(--app-primary);
}

.admin-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 1.25rem;
    align-items: stretch;
    padding: 1.5rem;
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(23, 32, 51, .96), rgba(39, 71, 96, .94) 55%, rgba(45, 107, 93, .94)),
        linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
    color: #fff;
    box-shadow: 0 20px 54px rgba(20, 31, 52, .16);
    overflow: hidden;
}

.admin-eyebrow {
    display: inline-flex;
    gap: .4rem;
    align-items: center;
    margin-bottom: .65rem;
    color: rgba(255, 255, 255, .78);
    font-size: .86rem;
    font-weight: 800;
    text-transform: uppercase;
}

.admin-hero h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.2;
}

.admin-hero p {
    max-width: 720px;
    margin: .75rem 0 0;
    color: rgba(255, 255, 255, .78);
    line-height: 1.75;
}

.admin-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-top: 1.2rem;
}

.admin-hero-actions .btn {
    font-weight: 800;
}

.admin-hero-panel {
    display: grid;
    align-content: center;
    gap: .25rem;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 8px;
    background: rgba(255, 255, 255, .12);
    text-align: center;
}

.admin-secure-ring {
    width: 58px;
    height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    font-size: 1.45rem;
}

.admin-hero-panel .small,
.admin-hero-panel span {
    color: rgba(255, 255, 255, .70);
    overflow-wrap: anywhere;
}

.admin-hero-panel strong {
    font-size: 1.1rem;
}

.admin-hero-panel em {
    justify-self: center;
    margin-top: .45rem;
    padding: .25rem .6rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    font-style: normal;
    font-size: .82rem;
}

.admin-stat-card {
    position: relative;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    min-height: 126px;
    padding: 1rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(20, 31, 52, .06);
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease;
}

.admin-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 36px rgba(20, 31, 52, .10);
}

.admin-stat-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--tone-color, var(--app-primary));
}

.admin-stat-card span,
.admin-stat-card small {
    display: block;
    color: var(--app-muted);
}

.admin-stat-card strong {
    display: block;
    margin: .2rem 0;
    color: var(--app-ink);
    font-size: 1.55rem;
    font-weight: 900;
    line-height: 1.15;
}

.admin-stat-card > i {
    width: 44px;
    height: 44px;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: color-mix(in srgb, var(--tone-color, var(--app-primary)) 12%, white);
    color: var(--tone-color, var(--app-primary));
    font-size: 1.35rem;
}

.tone-blue { --tone-color: #2457a6; }
.tone-green { --tone-color: #198754; }
.tone-amber { --tone-color: #b7791f; }
.tone-red { --tone-color: #c23434; }

.admin-panel-card {
    padding: 1rem;
}

.admin-card-heading {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.admin-card-heading h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 900;
}

.admin-card-heading p {
    margin: .25rem 0 0;
    color: var(--app-muted);
    font-size: .9rem;
}

.admin-card-heading > i {
    color: var(--app-primary);
    font-size: 1.35rem;
}

.admin-card-heading a {
    flex: 0 0 auto;
    font-weight: 800;
    font-size: .9rem;
}

.admin-progress-list {
    display: grid;
    gap: .85rem;
}

.admin-progress {
    height: 8px;
    overflow: hidden;
    margin-top: .45rem;
    border-radius: 999px;
    background: #edf1f7;
}

.admin-progress span {
    display: block;
    height: 100%;
    min-width: 8px;
    border-radius: inherit;
    background: linear-gradient(90deg, #2457a6, #2d8a6e);
}

.admin-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.admin-action-grid a {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: .75rem;
    align-items: center;
    padding: .85rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: #fbfcff;
    color: #344054;
}

.admin-action-grid a:hover {
    border-color: rgba(36, 87, 166, .35);
    box-shadow: 0 12px 24px rgba(36, 87, 166, .08);
}

.admin-action-grid i,
.admin-feed-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #e9f1ff;
    color: var(--app-primary);
}

.admin-action-grid span,
.admin-action-grid strong {
    display: block;
}

.admin-action-grid strong {
    font-size: 1.2rem;
}

.admin-feed-list {
    display: grid;
    gap: .65rem;
}

.admin-feed-list a {
    display: flex;
    gap: .75rem;
    align-items: center;
    padding: .75rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: #fbfcff;
    color: #344054;
}

.admin-feed-list a:hover {
    color: var(--app-primary);
    border-color: rgba(36, 87, 166, .35);
}

.admin-feed-list strong,
.admin-feed-list small {
    display: block;
}

.admin-feed-list small {
    color: var(--app-muted);
}

.dashboard-shell .col-lg-9 > h1:first-child,
.dashboard-shell .col-lg-9 > .d-flex:first-child h1 {
    letter-spacing: 0;
}

.dashboard-shell .col-lg-9 > h1:first-child {
    padding: 1rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(20, 31, 52, .05);
}

.dashboard-shell .app-card {
    box-shadow: 0 12px 30px rgba(20, 31, 52, .05);
}

.admin-table-toolbar {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    align-items: center;
    margin-bottom: .85rem;
}

.admin-table-search {
    position: relative;
    width: min(360px, 100%);
}

.admin-table-search i {
    position: absolute;
    top: 50%;
    left: .8rem;
    transform: translateY(-50%);
    color: #667085;
}

.admin-table-search input {
    padding-left: 2.3rem;
    border-radius: 8px;
}

.admin-table-actions {
    display: flex;
    gap: .5rem;
    align-items: center;
    white-space: nowrap;
}

.admin-row-count {
    color: var(--app-muted);
    font-size: .86rem;
}

.admin-data-table {
    margin-bottom: 0;
}

.admin-data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f7f9fc;
    color: #475467;
    font-size: .82rem;
    text-transform: uppercase;
}

.admin-data-table tbody tr {
    transition: background .18s ease;
}

.admin-data-table tbody tr:hover {
    background: #f8fbff;
}

.admin-status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: .2rem .55rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 800;
}

.admin-status-badge.success {
    background: #e9f8ef;
    color: #146c43;
}

.admin-status-badge.primary {
    background: #e9f1ff;
    color: #2457a6;
}

.admin-status-badge.warning {
    background: #fff4db;
    color: #8a5b00;
}

.admin-status-badge.danger {
    background: #ffecec;
    color: #a52828;
}

.admin-status-badge.secondary {
    background: #eef1f5;
    color: #475467;
}

.admin-scroll-top {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1020;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: var(--app-primary);
    color: #fff;
    box-shadow: 0 12px 26px rgba(20, 31, 52, .20);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity .18s ease, transform .18s ease;
}

.admin-scroll-top.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

@media (max-width: 991.98px) {
    .admin-hero {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
    }

    body.admin-page .dashboard-shell .row > .col-lg-9 {
        order: 1;
    }

    body.admin-page .dashboard-shell .row > .col-lg-3 {
        order: 2;
    }
}

@media (max-width: 767.98px) {
    .admin-hero {
        padding: 1rem;
    }

    .admin-hero h1 {
        font-size: 1.55rem;
    }

    .admin-action-grid,
    .admin-table-toolbar {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .admin-table-actions {
        justify-content: space-between;
    }
}

.conversation-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem;
    border-radius: 8px;
    background:
        linear-gradient(135deg, #172033, #2b5268 58%, #2d6b5d);
    color: #fff;
    box-shadow: 0 18px 44px rgba(20, 31, 52, .14);
}

.conversation-hero span {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: .4rem;
    color: rgba(255, 255, 255, .76);
    font-size: .85rem;
    font-weight: 800;
    text-transform: uppercase;
}

.conversation-hero h1 {
    margin: 0;
    font-size: 1.65rem;
    font-weight: 900;
}

.conversation-hero p {
    margin: .45rem 0 0;
    color: rgba(255, 255, 255, .78);
}

.conversation-hero > i {
    width: 58px;
    height: 58px;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, .14);
    font-size: 1.6rem;
}

.law-chat-layout,
.ai-chat-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
}

.ai-chat-layout {
    grid-template-columns: 280px minmax(0, 1fr) 320px;
}

.chat-contact-panel,
.ai-case-panel,
.chat-room-panel,
.ai-chat-room {
    min-height: 720px;
    overflow: hidden;
}

.chat-panel-head {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--app-line);
}

.chat-panel-head h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 900;
}

.chat-panel-head span {
    color: var(--app-muted);
    font-size: .85rem;
}

.chat-panel-head > i {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #e9f1ff;
    color: var(--app-primary);
}

.chat-contact-list {
    display: grid;
    gap: .35rem;
    max-height: 640px;
    overflow-y: auto;
    padding: .65rem;
}

.chat-contact {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto auto;
    gap: .75rem;
    align-items: center;
    padding: .75rem;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #344054;
}

.chat-contact-shell {
    position: relative;
    min-width: 0;
}

.chat-contact-shell .chat-contact {
    width: 100%;
}

.chat-contact.has-delete {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    padding-right: 2.55rem;
}

.case-delete-form {
    position: absolute;
    top: 50%;
    right: .52rem;
    z-index: 2;
    transform: translateY(-50%);
}

.case-delete-button {
    width: 30px;
    height: 30px;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(194, 52, 52, .18);
    border-radius: 8px;
    background: rgba(194, 52, 52, .08);
    color: var(--app-danger);
    opacity: 0;
    transform: scale(.92);
    transition: opacity .18s ease, transform .18s ease, background-color .18s ease, border-color .18s ease;
}

.chat-contact-shell:hover .case-delete-button,
.chat-contact-shell:focus-within .case-delete-button,
.chat-contact.active + .case-delete-form .case-delete-button {
    opacity: 1;
    transform: scale(1);
}

.case-delete-button:hover,
.case-delete-button:focus-visible {
    border-color: rgba(194, 52, 52, .35);
    background: rgba(194, 52, 52, .16);
}

.chat-unread-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 .35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #c73b4a;
    color: #fff;
    font-size: .72rem;
    line-height: 1;
}

.case-timeline {
    display: grid;
    gap: 0;
}

.case-timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr);
    gap: .7rem;
    min-height: 58px;
    padding-bottom: .8rem;
}

.case-timeline-item:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 7px;
    top: 15px;
    bottom: 0;
    width: 2px;
    background: rgba(36, 87, 166, .18);
}

.case-timeline-dot {
    position: relative;
    z-index: 1;
    width: 16px;
    height: 16px;
    margin-top: .2rem;
    border: 3px solid #dce9ff;
    border-radius: 50%;
    background: var(--app-primary);
}

.case-timeline-item strong,
.case-timeline-item small {
    display: block;
}

.case-timeline-item small {
    margin-top: .2rem;
    color: var(--app-muted);
}

.chat-contact:hover,
.chat-contact.active {
    background: #f2f7ff;
    border-color: rgba(36, 87, 166, .24);
    color: var(--app-primary);
}

.chat-contact strong,
.chat-contact small,
.chat-contact em {
    display: block;
}

.chat-contact small {
    color: var(--app-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-contact em {
    color: var(--app-muted);
    font-size: .75rem;
    font-style: normal;
}

.chat-avatar {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #e9f1ff;
    color: var(--app-primary);
}

.chat-avatar.lg {
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    font-size: 1.25rem;
}

.chat-room-panel,
.ai-chat-room {
    display: flex;
    flex-direction: column;
}

.chat-room-header {
    display: flex;
    gap: .8rem;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--app-line);
    background: #fff;
}

.chat-room-header h1,
.chat-room-header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 900;
}

.chat-room-header p {
    margin: .2rem 0 0;
    color: var(--app-muted);
    font-size: .9rem;
}

.chat-thread-window,
.ai-chat-window {
    flex: 1 1 auto;
    min-height: 420px;
    max-height: 540px;
    overflow-y: auto;
    padding: 1rem;
    background:
        linear-gradient(180deg, rgba(248, 251, 255, .92), rgba(245, 247, 251, .92)),
        repeating-linear-gradient(135deg, rgba(36, 87, 166, .04) 0 1px, transparent 1px 18px);
}

.chat-empty-state {
    display: grid;
    place-items: center;
    align-content: center;
    min-height: 320px;
    gap: .35rem;
    color: var(--app-muted);
    text-align: center;
}

.chat-empty-state i {
    color: var(--app-primary);
    font-size: 2rem;
}

.chat-empty-state strong {
    color: var(--app-ink);
}

.chat-composer-bar,
.ai-chat-composer {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .65rem;
    align-items: end;
    padding: .85rem;
    border-top: 1px solid var(--app-line);
    background: #fff;
}

.chat-composer-bar .form-control,
.ai-chat-composer .form-control {
    min-height: 48px;
    max-height: 120px;
    resize: vertical;
    border-radius: 8px;
}

.chat-composer-bar .conversation-tools {
    grid-column: 1 / -1;
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.chat-composer-bar .conversation-tool {
    min-height: 48px;
    flex-direction: row;
}

.chat-composer-bar .conversation-submit,
.ai-chat-composer .btn {
    width: 48px;
    height: 48px;
    border-radius: 8px;
}

.chat-composer-bar .conversation-file-preview,
.chat-composer-bar .conversation-recording {
    grid-column: 1 / -1;
    margin-top: 0;
}

.ai-chat-page > .container-fluid > .row > .col-lg-10,
.conversation-shell > .container-fluid > .row > .col-lg-10 {
    min-width: 0;
}

.ai-chat-row {
    display: flex;
    margin-bottom: .75rem;
}

.ai-chat-row.user {
    justify-content: flex-end;
}

.ai-chat-row.ai {
    justify-content: flex-start;
}

.ai-chat-composer {
    grid-template-columns: minmax(0, 1fr) repeat(4, 48px);
}

.ai-attach-button {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: #fbfcff;
    color: #475467;
    cursor: pointer;
}

.ai-attach-button:hover {
    color: var(--app-primary);
    border-color: rgba(36, 87, 166, .35);
}

.ai-voice-button.is-listening {
    background: #e8f1ff;
    border-color: rgba(36, 87, 166, .45);
    color: var(--app-primary);
    box-shadow: 0 0 0 4px rgba(36, 87, 166, .08);
}

.ai-file-preview,
.ai-voice-result {
    grid-column: 1 / -1;
}

.ai-file-preview {
    display: flex;
    gap: .55rem;
    align-items: center;
    padding: .65rem .75rem;
    border-radius: 8px;
    background: #f4f7fb;
    color: #475467;
}

.ai-file-preview span {
    font-weight: 800;
    overflow-wrap: anywhere;
}

.ai-file-preview small {
    margin-left: auto;
    color: var(--app-muted);
}

.ai-voice-result .alert {
    margin-bottom: 0;
}

.ai-analysis-column {
    min-width: 0;
}

.conversation-composer,
.conversation-thread {
    box-shadow: 0 14px 34px rgba(20, 31, 52, .06);
}

.conversation-secure {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .55rem;
    border-radius: 999px;
    background: #e9f8ef;
    color: #146c43;
    font-size: .78rem;
    font-weight: 800;
}

.conversation-tools {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .55rem;
}

.conversation-tool {
    display: inline-flex;
    min-height: 66px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .25rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: #fbfcff;
    color: #344054;
    font-weight: 800;
    cursor: pointer;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.conversation-tool:hover,
.conversation-tool.is-recording,
.conversation-tool.is-listening {
    border-color: rgba(36, 87, 166, .35);
    box-shadow: 0 10px 22px rgba(36, 87, 166, .08);
    color: var(--app-primary);
    transform: translateY(-1px);
}

.conversation-tool.is-recording {
    background: #fff1f1;
    color: #c23434;
}

.conversation-tool.is-listening {
    background: #eef6ff;
    color: var(--app-primary);
}

.conversation-file-preview,
.conversation-recording {
    display: flex;
    gap: .55rem;
    align-items: center;
    margin-top: .65rem;
    padding: .75rem;
    border-radius: 8px;
    background: #f4f7fb;
    color: #475467;
}

.conversation-file-preview i,
.conversation-recording i {
    color: var(--app-primary);
}

.conversation-file-preview span {
    font-weight: 800;
    overflow-wrap: anywhere;
}

.conversation-file-preview small {
    margin-left: auto;
    color: var(--app-muted);
}

.mic-help {
    display: grid;
    gap: .65rem;
}

.mic-help-title,
.mic-help-actions {
    display: flex;
    align-items: center;
    gap: .55rem;
    flex-wrap: wrap;
}

.mic-help-title i {
    font-size: 1.15rem;
}

.mic-help-text {
    color: #475467;
    line-height: 1.65;
}

.conversation-thread {
    max-height: 760px;
    overflow-y: auto;
}

.conversation-message {
    display: grid;
    gap: .45rem;
    padding: .85rem 0;
    border-bottom: 1px solid var(--app-line);
}

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

.conversation-message.mine {
    justify-items: end;
}

.conversation-message.theirs {
    justify-items: start;
}

.conversation-message-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .6rem;
    color: var(--app-muted);
    font-size: .82rem;
}

.conversation-bubble {
    max-width: min(100%, 520px);
    padding: .75rem .9rem;
    border-radius: 8px;
    background: #f2f5f9;
    color: var(--app-ink);
    line-height: 1.65;
}

.conversation-message.mine .conversation-bubble {
    background: #2457a6;
    color: #fff;
}

.conversation-image-link img {
    max-width: min(100%, 360px);
    max-height: 260px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--app-line);
    box-shadow: 0 10px 24px rgba(20, 31, 52, .10);
}

.conversation-audio,
.conversation-call-card,
.conversation-file-link {
    display: flex;
    gap: .65rem;
    align-items: center;
    max-width: min(100%, 520px);
    padding: .75rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: #fbfcff;
}

.conversation-audio i,
.conversation-call-card > div,
.conversation-file-link i {
    width: 40px;
    height: 40px;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #e9f1ff;
    color: var(--app-primary);
}

.conversation-audio audio {
    width: min(360px, 100%);
}

.conversation-call-card span {
    display: grid;
    min-width: 0;
}

.conversation-call-card small {
    color: var(--app-muted);
}

.conversation-call-card .btn {
    margin-left: auto;
    white-space: nowrap;
}

.call-room-section {
    min-height: calc(100vh - 160px);
    padding: 2rem 0;
    background:
        linear-gradient(180deg, rgba(247, 249, 252, .96), rgba(238, 243, 248, .96)),
        repeating-linear-gradient(135deg, rgba(36, 87, 166, .05) 0 1px, transparent 1px 18px);
}

.call-room {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 1rem;
    padding: 1.25rem;
    border-radius: 8px;
    background: linear-gradient(135deg, #172033, #263f59 55%, #2d6b5d);
    color: #fff;
    box-shadow: 0 24px 70px rgba(20, 31, 52, .18);
}

.call-room-badge {
    display: inline-flex;
    gap: .4rem;
    align-items: center;
    padding: .35rem .65rem;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
}

.call-room h1 {
    margin: 1rem 0 .5rem;
    font-weight: 900;
}

.call-room p,
.call-status,
.call-room-side span {
    color: rgba(255, 255, 255, .76);
}

.call-preview {
    display: flex;
    min-height: 340px;
    align-items: center;
    justify-content: center;
    margin: 1rem 0;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 8px;
    background: rgba(255, 255, 255, .10);
    overflow: hidden;
}

.call-stage {
    position: relative;
    margin: 1rem 0;
}

.call-stage .call-preview {
    margin: 0;
    flex-direction: column;
    gap: .7rem;
}

.call-local-preview {
    position: absolute;
    right: .85rem;
    bottom: .85rem;
    display: flex;
    width: min(180px, 32%);
    aspect-ratio: 4 / 3;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: .35rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .34);
    border-radius: 8px;
    background: rgba(15, 23, 42, .74);
    color: rgba(255, 255, 255, .82);
}

.call-local-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.call-local-preview .call-wave {
    height: 48px;
}

.call-local-preview .call-wave span {
    width: 7px;
}

.call-preview > i {
    font-size: 3rem;
    opacity: .85;
}

.call-preview video {
    width: 100%;
    height: 100%;
    max-height: 460px;
    object-fit: cover;
}

.call-preview audio {
    width: min(440px, 82%);
}

.call-controls {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
}

.call-controls .btn {
    font-weight: 800;
}

.call-status {
    margin-top: .75rem;
}

.call-room-side {
    display: grid;
    align-content: start;
    gap: .75rem;
}

.call-room-side > div {
    padding: .9rem;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 8px;
    background: rgba(255, 255, 255, .12);
}

.call-room-side strong,
.call-room-side span {
    display: block;
    overflow-wrap: anywhere;
}

.call-wave {
    display: flex;
    align-items: center;
    gap: .35rem;
    height: 84px;
}

.call-wave span {
    width: 12px;
    height: 24px;
    border-radius: 999px;
    background: #fff;
    animation: callWave 1s ease-in-out infinite;
}

.call-wave span:nth-child(2) { animation-delay: .12s; }
.call-wave span:nth-child(3) { animation-delay: .24s; }
.call-wave span:nth-child(4) { animation-delay: .36s; }

@keyframes callWave {
    0%, 100% { height: 22px; opacity: .58; }
    50% { height: 72px; opacity: 1; }
}

@media (max-width: 991.98px) {
    .call-room {
        grid-template-columns: 1fr;
    }

    .conversation-shell > .container > .row > .col-lg-9 {
        order: 1;
    }

    .conversation-shell > .container > .row > .col-lg-3 {
        order: 2;
    }

    .conversation-shell > .container-fluid > .row > .col-lg-10,
    .ai-chat-page > .container-fluid > .row > .col-lg-10 {
        order: 1;
    }

    .conversation-shell > .container-fluid > .row > .col-lg-2,
    .ai-chat-page > .container-fluid > .row > .col-lg-2 {
        order: 2;
    }

    .law-chat-layout,
    .ai-chat-layout {
        grid-template-columns: 1fr;
    }

    .law-chat-layout .chat-room-panel {
        order: 1;
    }

    .law-chat-layout .chat-contact-panel {
        order: 2;
    }

    .ai-chat-layout .ai-chat-room {
        order: 1;
    }

    .ai-chat-layout .ai-analysis-column {
        order: 2;
    }

    .ai-chat-layout .ai-case-panel {
        order: 3;
    }

    .chat-contact-panel,
    .ai-case-panel,
    .chat-room-panel,
    .ai-chat-room {
        min-height: auto;
    }

    .chat-contact-list {
        max-height: 300px;
    }
}

@media (max-width: 767.98px) {
    .conversation-hero {
        align-items: flex-start;
    }

    .conversation-hero > i {
        display: none;
    }

    .conversation-tools {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chat-composer-bar,
    .ai-chat-composer {
        grid-template-columns: 1fr 48px;
    }

    .ai-attach-button {
        grid-column: auto;
    }

    .chat-composer-bar .conversation-tools {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .conversation-call-card,
    .conversation-audio {
        align-items: stretch;
        flex-direction: column;
    }

    .conversation-call-card .btn {
        margin-left: 0;
    }

    .call-preview {
        min-height: 240px;
    }
}

/* UI polish pass */
body {
    background:
        linear-gradient(180deg, #eef5ff 0, rgba(238, 245, 255, 0) 260px),
        linear-gradient(135deg, rgba(29, 127, 114, .10), rgba(194, 122, 26, .08) 42%, rgba(36, 87, 166, .08)),
        #f6f8fb;
}

.navbar {
    background: rgba(255, 255, 255, .88) !important;
    backdrop-filter: blur(18px);
    border-color: rgba(230, 234, 242, .86) !important;
    box-shadow: 0 10px 32px rgba(20, 31, 52, .07);
}

.navbar .container {
    min-height: 56px;
}

.navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    color: var(--app-ink) !important;
    letter-spacing: 0;
}

.navbar-brand .bi {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    margin-right: 0 !important;
    border-radius: 8px;
    background: linear-gradient(135deg, #eaf2ff, var(--app-teal-soft));
    color: var(--app-primary);
}

.navbar .nav-link {
    position: relative;
    border-radius: 8px;
    color: #475467;
    font-weight: 750;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    background: #f1f6ff;
    color: var(--app-primary);
}

.btn {
    border-radius: 8px;
    font-weight: 800;
}

.btn-primary {
    border-color: var(--app-primary);
    background: linear-gradient(135deg, var(--app-primary), var(--app-teal));
    box-shadow: 0 10px 22px rgba(36, 87, 166, .18);
}

.btn-primary:hover,
.btn-primary:focus {
    border-color: var(--app-primary-dark);
    background: linear-gradient(135deg, var(--app-primary-dark), #176f66);
}

.btn-outline-primary {
    color: var(--app-primary);
    border-color: rgba(36, 87, 166, .34);
    background: #fff;
}

.btn-light {
    border-color: var(--app-line);
    background: #fff;
}

.app-card,
.stat-card {
    border-color: rgba(214, 222, 235, .92);
    background: rgba(255, 255, 255, .96);
    box-shadow: var(--app-shadow-sm);
}

.dashboard-shell {
    padding: 1.4rem 0 2.4rem;
}

.app-sidebar {
    gap: .35rem;
    padding: .55rem;
    border: 1px solid rgba(214, 222, 235, .92);
    border-radius: 8px;
    background: rgba(255, 255, 255, .94);
    box-shadow: var(--app-shadow-sm);
}

.app-sidebar .list-group-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #475467;
    font-weight: 800;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.app-sidebar .list-group-item i {
    width: 22px;
    margin-right: 0 !important;
    color: #738197;
}

.app-sidebar .list-group-item:hover,
.app-sidebar .list-group-item.active {
    background: linear-gradient(135deg, #eef5ff, var(--app-teal-soft));
    color: var(--app-primary);
    transform: translateX(2px);
}

.app-sidebar .list-group-item:hover i,
.app-sidebar .list-group-item.active i {
    color: var(--app-primary);
}

.ai-chat-layout {
    grid-template-columns: 292px minmax(0, 1fr) 336px;
    gap: 1.1rem;
}

.ai-case-panel,
.ai-chat-room,
.ai-analysis-column .app-card {
    box-shadow: var(--app-shadow-md);
}

.ai-case-panel,
.ai-chat-room {
    min-height: calc(100vh - 126px);
}

.chat-panel-head {
    min-height: 72px;
    background: linear-gradient(180deg, #fff, #fbfcff);
}

.chat-panel-head h2 {
    font-size: 1.05rem;
}

.chat-contact-list {
    gap: .45rem;
    padding: .75rem;
}

.chat-contact {
    border-color: transparent;
    background: transparent;
    transition: background .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.chat-contact:hover,
.chat-contact.active {
    background: #fff;
    border-color: rgba(36, 87, 166, .18);
    box-shadow: 0 10px 24px rgba(20, 31, 52, .07);
    transform: translateY(-1px);
}

.chat-avatar {
    background: linear-gradient(135deg, #eaf2ff, var(--app-teal-soft));
}

.chat-room-header {
    min-height: 78px;
    background:
        linear-gradient(135deg, #ffffff 0%, #f7fbff 58%, #f3fbf8 100%);
}

.chat-room-header .chat-avatar.lg {
    background: linear-gradient(135deg, var(--app-primary), var(--app-teal));
    color: #fff;
    box-shadow: 0 12px 24px rgba(36, 87, 166, .18);
}

.chat-room-header h1,
.chat-room-header h2 {
    letter-spacing: 0;
}

.ai-room-actions {
    display: flex;
    align-items: center;
    gap: .55rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ai-ready-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-height: 32px;
    padding: .35rem .65rem;
    border: 1px solid rgba(29, 127, 114, .20);
    border-radius: 999px;
    background: var(--app-teal-soft);
    color: #176f66;
    font-size: .82rem;
    font-weight: 850;
    white-space: nowrap;
}

.chat-thread-window,
.ai-chat-window {
    max-height: calc(100vh - 300px);
    min-height: 500px;
    padding: 1.15rem;
    background:
        linear-gradient(180deg, rgba(248, 251, 255, .96), rgba(246, 248, 251, .96)),
        linear-gradient(90deg, rgba(36, 87, 166, .04) 1px, transparent 1px),
        linear-gradient(0deg, rgba(29, 127, 114, .04) 1px, transparent 1px);
    background-size: auto, 32px 32px, 32px 32px;
}

.chat-message {
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(20, 31, 52, .08);
}

.chat-message.user {
    background: linear-gradient(135deg, var(--app-primary), var(--app-teal));
}

.chat-message.ai {
    border: 1px solid rgba(214, 222, 235, .90);
    background: #fff;
}

.ai-chat-composer,
.chat-composer-bar {
    padding: .95rem;
    background: rgba(255, 255, 255, .96);
}

.ai-chat-composer .form-control,
.chat-composer-bar .form-control {
    border-color: rgba(214, 222, 235, .95);
    background: #fbfcff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72);
}

.ai-chat-composer .form-control:focus,
.chat-composer-bar .form-control:focus,
.admin-table-search input:focus {
    border-color: rgba(36, 87, 166, .44);
    box-shadow: 0 0 0 4px rgba(36, 87, 166, .10);
}

.ai-attach-button,
.conversation-tool {
    border-color: rgba(214, 222, 235, .95);
    background: #fff;
    box-shadow: 0 8px 18px rgba(20, 31, 52, .05);
}

.ai-attach-button:hover,
.conversation-tool:hover,
.conversation-tool.is-listening,
.ai-voice-button.is-listening {
    background: linear-gradient(135deg, #eef5ff, var(--app-teal-soft));
    border-color: rgba(36, 87, 166, .26);
    box-shadow: 0 12px 26px rgba(20, 31, 52, .08);
}

.analysis-card {
    border-left-color: var(--app-teal);
}

.ai-analysis-column .app-card {
    background: rgba(255, 255, 255, .94);
}

.ai-analysis-column h2,
.ai-analysis-column h5,
.ai-analysis-column h6 {
    letter-spacing: 0;
}

.footer-links a {
    font-weight: 750;
}

footer {
    background: rgba(255, 255, 255, .9) !important;
    box-shadow: 0 -10px 30px rgba(20, 31, 52, .04);
}

@media (max-width: 1199.98px) {
    .ai-chat-layout {
        grid-template-columns: 252px minmax(0, 1fr);
    }

    .ai-chat-layout .ai-analysis-column {
        grid-column: 1 / -1;
    }
}

@media (max-width: 991.98px) {
    .app-sidebar {
        position: static;
    }

    .ai-chat-layout,
    .law-chat-layout {
        grid-template-columns: 1fr;
    }

    .ai-case-panel,
    .ai-chat-room {
        min-height: auto;
    }

    .chat-thread-window,
    .ai-chat-window {
        max-height: none;
    }
}

@media (max-width: 767.98px) {
    .dashboard-shell {
        padding-top: .9rem;
    }

    .chat-room-header {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .ai-room-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .ai-chat-composer {
        grid-template-columns: minmax(0, 1fr) repeat(4, 46px);
    }

    .ai-chat-composer .form-control {
        grid-column: 1 / -1;
    }

    .ai-chat-composer .btn,
    .ai-attach-button {
        width: 46px;
        height: 46px;
    }
}

.theme-toggle {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .35rem .65rem;
    border: 1px solid rgba(214, 222, 235, .92);
    border-radius: 999px;
    background: #fff;
    color: #475467;
    font-size: .85rem;
    font-weight: 850;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(20, 31, 52, .05);
    transition: background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.theme-toggle:hover {
    border-color: rgba(36, 87, 166, .28);
    background: #f1f6ff;
    color: var(--app-primary);
}

.theme-toggle i {
    font-size: .98rem;
}

.navbar-quick-actions {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-left: auto;
}

.navbar-toggler {
    border-radius: 8px;
    border-color: rgba(214, 222, 235, .92);
    background: rgba(255, 255, 255, .72);
}

.navbar-collapse .d-flex {
    margin-left: .75rem;
}

@media (min-width: 992px) {
    .navbar-brand {
        order: 1;
    }

    .navbar-collapse {
        order: 2;
    }

    .navbar-quick-actions {
        order: 3;
        margin-left: .75rem;
    }
}

:root[data-theme="night"] {
    --app-primary: #74a7ff;
    --app-primary-dark: #4c82e6;
    --app-teal: #54d0bf;
    --app-teal-soft: rgba(84, 208, 191, .13);
    --app-amber: #f1bc62;
    --app-ink: #eef5ff;
    --app-muted: #aab6c8;
    --app-soft: #0e1422;
    --app-line: rgba(154, 168, 190, .22);
    --app-surface: #151e2f;
    --app-surface-soft: #11192a;
    --app-shadow-sm: 0 14px 30px rgba(0, 0, 0, .22);
    --app-shadow-md: 0 22px 52px rgba(0, 0, 0, .32);
    color-scheme: dark;
}

:root[data-theme="night"] body {
    background:
        linear-gradient(180deg, rgba(31, 55, 92, .58) 0, rgba(14, 20, 34, 0) 300px),
        linear-gradient(135deg, rgba(84, 208, 191, .10), rgba(241, 188, 98, .06) 46%, rgba(116, 167, 255, .11)),
        #0e1422;
    color: var(--app-ink);
}

:root[data-theme="night"] .navbar,
:root[data-theme="night"] footer {
    background: rgba(17, 25, 42, .90) !important;
    border-color: var(--app-line) !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, .24);
}

:root[data-theme="night"] .navbar-brand,
:root[data-theme="night"] .footer .fw-semibold,
:root[data-theme="night"] .text-dark {
    color: var(--app-ink) !important;
}

:root[data-theme="night"] .navbar-brand .bi,
:root[data-theme="night"] .chat-avatar,
:root[data-theme="night"] .icon-pill {
    background: linear-gradient(135deg, rgba(116, 167, 255, .22), rgba(84, 208, 191, .16));
    color: var(--app-primary);
}

:root[data-theme="night"] .navbar .nav-link,
:root[data-theme="night"] .footer-links a,
:root[data-theme="night"] .small-muted,
:root[data-theme="night"] .text-muted,
:root[data-theme="night"] .chat-room-header p,
:root[data-theme="night"] .chat-panel-head span,
:root[data-theme="night"] .chat-contact small,
:root[data-theme="night"] .chat-contact em {
    color: var(--app-muted) !important;
}

:root[data-theme="night"] .navbar .nav-link:hover,
:root[data-theme="night"] .navbar .nav-link.active {
    background: rgba(116, 167, 255, .12);
    color: var(--app-primary) !important;
}

:root[data-theme="night"] .theme-toggle,
:root[data-theme="night"] .navbar-toggler,
:root[data-theme="night"] .btn-light,
:root[data-theme="night"] .btn-outline-primary,
:root[data-theme="night"] .auth-social-button,
:root[data-theme="night"] .ai-attach-button,
:root[data-theme="night"] .conversation-tool {
    border-color: var(--app-line);
    background: rgba(21, 30, 47, .92);
    color: var(--app-ink);
}

:root[data-theme="night"] .navbar-toggler-icon {
    filter: invert(1) brightness(1.6);
}

:root[data-theme="night"] .theme-toggle:hover,
:root[data-theme="night"] .auth-social-button:hover,
:root[data-theme="night"] .ai-attach-button:hover,
:root[data-theme="night"] .conversation-tool:hover,
:root[data-theme="night"] .conversation-tool.is-listening,
:root[data-theme="night"] .ai-voice-button.is-listening {
    background: linear-gradient(135deg, rgba(116, 167, 255, .17), rgba(84, 208, 191, .12));
    color: var(--app-primary);
}

:root[data-theme="night"] .app-card,
:root[data-theme="night"] .stat-card,
:root[data-theme="night"] .app-sidebar,
:root[data-theme="night"] .admin-nav,
:root[data-theme="night"] .admin-public-link,
:root[data-theme="night"] .admin-stat-card,
:root[data-theme="night"] .admin-feed-list a,
:root[data-theme="night"] .auth-card,
:root[data-theme="night"] .auth-switch,
:root[data-theme="night"] .auth-demo-card,
:root[data-theme="night"] .auth-demo,
:root[data-theme="night"] .auth-lock-note,
:root[data-theme="night"] .auth-consent,
:root[data-theme="night"] .auth-checkbox-item,
:root[data-theme="night"] .profile-social-item,
:root[data-theme="night"] .border.rounded-2.bg-white,
:root[data-theme="night"] .bg-white {
    border-color: var(--app-line) !important;
    background: rgba(21, 30, 47, .94) !important;
    color: var(--app-ink);
}

:root[data-theme="night"] .hero {
    border-color: var(--app-line);
    background:
        linear-gradient(135deg, rgba(21, 30, 47, .96), rgba(17, 25, 42, .98) 54%, rgba(24, 48, 58, .90));
}

:root[data-theme="night"] .hero .lead,
:root[data-theme="night"] .hero p,
:root[data-theme="night"] .auth-divider,
:root[data-theme="night"] .auth-social-button em {
    color: var(--app-muted);
}

:root[data-theme="night"] .auth-divider::before {
    background: var(--app-line);
}

:root[data-theme="night"] .auth-divider span,
:root[data-theme="night"] .auth-switch a.active,
:root[data-theme="night"] .auth-social-button em {
    background: var(--app-surface);
}

:root[data-theme="night"] .profile-social-item > i,
:root[data-theme="night"] .social-admin-head > i,
:root[data-theme="night"] .profile-social-item em,
:root[data-theme="night"] .social-admin-head em,
:root[data-theme="night"] .social-admin-card code,
:root[data-theme="night"] .social-env-list code {
    border-color: var(--app-line);
    background: rgba(11, 17, 29, .62);
    color: var(--app-muted);
}

:root[data-theme="night"] .app-sidebar .list-group-item,
:root[data-theme="night"] .admin-nav .list-group-item,
:root[data-theme="night"] .chat-contact,
:root[data-theme="night"] .admin-public-link {
    color: var(--app-muted);
}

:root[data-theme="night"] .case-delete-button {
    border-color: rgba(248, 113, 113, .26);
    background: rgba(248, 113, 113, .10);
    color: #fca5a5;
}

:root[data-theme="night"] .app-sidebar .list-group-item:hover,
:root[data-theme="night"] .app-sidebar .list-group-item.active,
:root[data-theme="night"] .admin-nav .list-group-item:hover,
:root[data-theme="night"] .admin-nav .list-group-item.active,
:root[data-theme="night"] .chat-contact:hover,
:root[data-theme="night"] .chat-contact.active {
    background: linear-gradient(135deg, rgba(116, 167, 255, .16), rgba(84, 208, 191, .10));
    border-color: rgba(116, 167, 255, .22);
    color: var(--app-primary);
}

:root[data-theme="night"] .chat-panel-head,
:root[data-theme="night"] .chat-room-header,
:root[data-theme="night"] .ai-chat-composer,
:root[data-theme="night"] .chat-composer-bar {
    border-color: var(--app-line);
    background: linear-gradient(180deg, rgba(21, 30, 47, .98), rgba(17, 25, 42, .96));
}

:root[data-theme="night"] .chat-thread-window,
:root[data-theme="night"] .ai-chat-window,
:root[data-theme="night"] .chat-box {
    background:
        linear-gradient(180deg, rgba(13, 20, 34, .95), rgba(15, 23, 38, .95)),
        linear-gradient(90deg, rgba(116, 167, 255, .05) 1px, transparent 1px),
        linear-gradient(0deg, rgba(84, 208, 191, .04) 1px, transparent 1px);
    background-size: auto, 32px 32px, 32px 32px;
}

:root[data-theme="night"] .chat-message.ai,
:root[data-theme="night"] .conversation-bubble,
:root[data-theme="night"] .conversation-audio,
:root[data-theme="night"] .conversation-call-card,
:root[data-theme="night"] .conversation-file-link,
:root[data-theme="night"] .ai-file-preview {
    border-color: var(--app-line);
    background: rgba(21, 30, 47, .96);
    color: var(--app-ink);
}

:root[data-theme="night"] .chat-message.user,
:root[data-theme="night"] .conversation-message.mine .conversation-bubble,
:root[data-theme="night"] .btn-primary {
    background: linear-gradient(135deg, #356cc4, #208c7f);
    color: #fff;
}

:root[data-theme="night"] .ai-ready-pill {
    border-color: rgba(84, 208, 191, .26);
    background: rgba(84, 208, 191, .12);
    color: var(--app-teal);
}

:root[data-theme="night"] .form-control,
:root[data-theme="night"] .form-select,
:root[data-theme="night"] .ai-chat-composer .form-control,
:root[data-theme="night"] .chat-composer-bar .form-control,
:root[data-theme="night"] .admin-table-search input {
    border-color: var(--app-line);
    background: rgba(11, 17, 29, .88);
    color: var(--app-ink);
}

:root[data-theme="night"] .form-control::placeholder,
:root[data-theme="night"] textarea::placeholder {
    color: #7f8da2;
}

:root[data-theme="night"] .form-floating > .form-control::placeholder {
    color: transparent;
}

:root[data-theme="night"] .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--app-ink);
    --bs-table-border-color: var(--app-line);
}

:root[data-theme="night"] .admin-data-table thead th {
    background: rgba(11, 17, 29, .92);
    color: var(--app-muted);
}

:root[data-theme="night"] .admin-data-table tbody tr:hover,
:root[data-theme="night"] .notification-item.unread {
    background: rgba(116, 167, 255, .08);
}

:root[data-theme="night"] .alert {
    border-color: var(--app-line);
}

:root[data-theme="night"] .modal-content,
:root[data-theme="night"] .dropdown-menu {
    border-color: var(--app-line);
    background: var(--app-surface);
    color: var(--app-ink);
}

@media (max-width: 575.98px) {
    .theme-toggle span {
        display: none;
    }

    .auth-social-grid {
        grid-template-columns: 1fr;
    }

    .profile-social-grid,
    .social-admin-grid {
        grid-template-columns: 1fr;
    }
}

/* Thanai Khu Dee brand system */
:root {
    --app-primary: #0b5b52;
    --app-primary-dark: #083f39;
    --app-teal: #168b7d;
    --app-teal-soft: #e6f5f1;
    --app-amber: #c67b2f;
    --app-ink: #102a36;
    --app-muted: #63737b;
    --app-soft: #f4f8f7;
    --app-line: #dce7e4;
    --app-surface: #ffffff;
    --app-surface-soft: #f8fbfa;
    --app-shadow-sm: 0 10px 30px rgba(16, 42, 54, .06);
    --app-shadow-md: 0 22px 52px rgba(16, 42, 54, .10);
}

body {
    background: #f4f8f7;
    color: var(--app-ink);
}

.navbar {
    background: rgba(255, 255, 255, .94) !important;
    border-color: rgba(220, 231, 228, .9) !important;
    box-shadow: 0 8px 28px rgba(16, 42, 54, .06);
}

.navbar .container {
    min-height: 62px;
}

.navbar-brand {
    gap: .65rem;
    color: var(--app-ink) !important;
}

.brand-mark {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
}

.brand-wordmark {
    display: grid;
    gap: .05rem;
    line-height: 1;
}

.brand-wordmark strong {
    color: #0b433d;
    font-size: 1.1rem;
    font-weight: 900;
}

.brand-wordmark small {
    color: #77878d;
    font-size: .56rem;
    font-weight: 850;
    letter-spacing: .08em;
}

.navbar .nav-link {
    padding: .52rem .7rem !important;
    color: #53646a;
    font-size: .93rem;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    background: #ecf6f3;
    color: var(--app-primary);
}

.btn {
    border-radius: 7px;
    letter-spacing: 0;
}

.btn-primary {
    border-color: var(--app-primary);
    background: var(--app-primary);
    box-shadow: 0 10px 22px rgba(11, 91, 82, .16);
}

.btn-primary:hover,
.btn-primary:focus {
    border-color: var(--app-primary-dark);
    background: var(--app-primary-dark);
}

.btn-outline-primary {
    border-color: rgba(11, 91, 82, .3);
    background: #fff;
    color: var(--app-primary);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    border-color: var(--app-primary);
    background: #eaf5f2;
    color: var(--app-primary-dark);
}

.app-card,
.stat-card {
    border-color: var(--app-line);
    border-radius: 7px;
    background: rgba(255, 255, 255, .97);
    box-shadow: var(--app-shadow-sm);
}

.section-band {
    padding: 5rem 0;
}

.brand-kicker {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: var(--app-primary);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.brand-hero {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: center;
    min-height: clamp(540px, 72svh, 700px);
    overflow: hidden;
    background: #e9f0ed;
}

.brand-hero-image,
.brand-hero-shade {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.brand-hero-image {
    z-index: -2;
    object-fit: cover;
    object-position: center center;
}

.brand-hero-shade {
    z-index: -1;
    background: rgba(241, 247, 245, .34);
}

.brand-hero-content {
    padding-block: 4.5rem;
}

.brand-hero-copy {
    max-width: 650px;
}

.brand-hero h1 {
    margin: .7rem 0 .5rem;
    color: #083f39;
    font-size: clamp(4rem, 8vw, 7.6rem);
    font-weight: 950;
    line-height: .98;
    text-shadow: 0 2px 0 rgba(255, 255, 255, .5);
}

.brand-hero-lead {
    max-width: 620px;
    margin: 0;
    color: #183a40;
    font-size: clamp(1.08rem, 2vw, 1.42rem);
    font-weight: 650;
    line-height: 1.72;
}

.brand-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 1.75rem;
}

.brand-hero-actions .btn {
    min-height: 52px;
    display: inline-flex;
    align-items: center;
}

.brand-hero-note {
    max-width: 580px;
    display: flex;
    gap: .5rem;
    align-items: flex-start;
    margin-top: 1.4rem;
    color: #35575b;
    font-size: .9rem;
    font-weight: 700;
    line-height: 1.55;
}

.brand-hero-note i {
    color: var(--app-primary);
}

.trust-strip {
    border-block: 1px solid var(--app-line);
    background: #fff;
}

.trust-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.trust-grid > div {
    display: flex;
    gap: .8rem;
    align-items: center;
    min-height: 104px;
    padding: 1rem 1.15rem;
    border-right: 1px solid var(--app-line);
}

.trust-grid > div:first-child {
    border-left: 1px solid var(--app-line);
}

.trust-grid i {
    width: 38px;
    height: 38px;
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: #eaf5f2;
    color: var(--app-primary);
    font-size: 1.05rem;
}

.trust-grid strong,
.trust-grid small {
    display: block;
}

.trust-grid strong {
    color: var(--app-ink);
    font-size: .92rem;
}

.trust-grid small {
    margin-top: .15rem;
    color: var(--app-muted);
    font-size: .78rem;
    line-height: 1.45;
}

.brand-intro {
    background: #f4f8f7;
}

.section-heading {
    max-width: 680px;
    margin-bottom: 2rem;
}

.section-heading-row {
    max-width: none;
    display: flex;
    gap: 2rem;
    align-items: end;
    justify-content: space-between;
}

.section-heading h2 {
    margin: .45rem 0 .55rem;
    color: var(--app-ink);
    font-size: clamp(1.75rem, 3vw, 2.55rem);
    font-weight: 900;
    line-height: 1.22;
}

.section-heading p {
    max-width: 650px;
    margin: 0;
    color: var(--app-muted);
    line-height: 1.72;
}

.brand-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-block: 1px solid var(--app-line);
}

.brand-steps article {
    position: relative;
    padding: 2.2rem 1.7rem 2rem;
    border-right: 1px solid var(--app-line);
}

.brand-steps article:first-child {
    border-left: 1px solid var(--app-line);
}

.brand-step-number {
    display: block;
    margin-bottom: 1.25rem;
    color: var(--app-amber);
    font-size: .84rem;
    font-weight: 900;
}

.brand-steps i {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    margin-bottom: 1rem;
    border-radius: 50%;
    background: #e6f5f1;
    color: var(--app-primary);
    font-size: 1.15rem;
}

.brand-steps h3 {
    margin-bottom: .45rem;
    color: var(--app-ink);
    font-size: 1.08rem;
    font-weight: 850;
}

.brand-steps p {
    margin: 0;
    color: var(--app-muted);
    font-size: .94rem;
    line-height: 1.7;
}

.brand-category-section {
    background: #fff;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid var(--app-line);
    border-left: 1px solid var(--app-line);
}

.category-tile {
    min-height: 150px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: .75rem;
    align-items: start;
    padding: 1.2rem;
    border-right: 1px solid var(--app-line);
    border-bottom: 1px solid var(--app-line);
    background: #fff;
    color: var(--app-ink);
    transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}

.category-tile:hover {
    z-index: 1;
    background: #f1f9f7;
    color: var(--app-primary-dark);
    box-shadow: 0 16px 34px rgba(16, 42, 54, .08);
    transform: translateY(-3px);
}

.category-tile > i:first-child {
    color: var(--app-primary);
    font-size: 1.2rem;
}

.category-tile > i:last-child {
    color: #a3b1b2;
    font-size: .92rem;
}

.category-tile strong,
.category-tile small {
    display: block;
}

.category-tile strong {
    font-size: 1rem;
    font-weight: 850;
}

.category-tile small {
    margin-top: .45rem;
    color: var(--app-muted);
    font-size: .82rem;
    line-height: 1.55;
}

.lawyer-showcase {
    background: #eef5f3;
}

.lawyer-showcase-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.lawyer-showcase-card {
    padding: 1.25rem;
    border: 1px solid var(--app-line);
    border-radius: 7px;
    background: #fff;
    box-shadow: var(--app-shadow-sm);
}

.lawyer-showcase-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    background: #eaf5f2;
    color: var(--app-primary);
}

.verified-pill {
    display: inline-flex;
    gap: .25rem;
    align-items: center;
    padding: .28rem .48rem;
    border-radius: 999px;
    background: #e9f7ef;
    color: #14704a;
    font-size: .72rem;
    font-weight: 850;
}

.lawyer-showcase-card h3 {
    margin-bottom: .35rem;
    color: var(--app-ink);
    font-size: 1.05rem;
    font-weight: 850;
}

.lawyer-showcase-card > p {
    color: var(--app-muted);
    font-size: .88rem;
}

.lawyer-showcase-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
    margin: 1rem 0;
    padding-block: .85rem;
    border-block: 1px solid var(--app-line);
}

.lawyer-showcase-meta small,
.lawyer-showcase-meta strong {
    display: block;
}

.lawyer-showcase-meta small {
    color: var(--app-muted);
    font-size: .75rem;
}

.lawyer-showcase-meta strong {
    margin-top: .15rem;
    color: var(--app-ink);
}

.brand-care-band {
    padding: 4rem 0;
    border-top: 1px solid var(--app-line);
    background: #fff;
}

.brand-care-band .container {
    display: flex;
    gap: 2rem;
    align-items: center;
    justify-content: space-between;
}

.brand-care-band h2 {
    max-width: 680px;
    margin: .45rem 0;
    color: var(--app-ink);
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 900;
}

.brand-care-band p {
    max-width: 700px;
    margin: 0;
    color: var(--app-muted);
}

.brand-care-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: .75rem;
}

.footer-brand {
    display: inline-flex;
    gap: .65rem;
    align-items: center;
    color: var(--app-ink);
}

.footer-brand img {
    width: 34px;
    height: 34px;
}

.footer-brand span,
.footer-brand strong,
.footer-brand small {
    display: block;
}

.footer-brand small {
    margin-top: .15rem;
    color: var(--app-muted);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
}

footer {
    border-color: var(--app-line) !important;
    background: #fff !important;
    box-shadow: none;
}

.auth-section {
    background: #eef5f3;
}

.auth-shell {
    border-color: var(--app-line);
    box-shadow: 0 24px 64px rgba(16, 42, 54, .12);
}

.auth-side {
    background: #0b433d;
}

.auth-lawyer .auth-side {
    background: #163b55;
}

.auth-admin .auth-side {
    background: #292a40;
}

.auth-side::before {
    opacity: .22;
}

.auth-card::before {
    background: var(--app-primary);
}

.auth-eyebrow {
    color: var(--app-primary);
}

.app-sidebar {
    border-color: var(--app-line);
    background: rgba(255, 255, 255, .98);
}

.app-sidebar .list-group-item:hover,
.app-sidebar .list-group-item.active {
    background: #eaf5f2;
    color: var(--app-primary);
}

.conversation-hero,
.admin-hero {
    border-radius: 7px;
    background: #0b433d;
}

.admin-hero {
    background: #163b55;
}

.form-control,
.form-select {
    border-color: #d6e2df;
    border-radius: 7px;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(11, 91, 82, .54);
    box-shadow: 0 0 0 .2rem rgba(11, 91, 82, .1);
}

:root[data-theme="night"] {
    --app-primary: #63c6b8;
    --app-primary-dark: #8bd8cd;
    --app-teal: #63c6b8;
    --app-teal-soft: rgba(99, 198, 184, .13);
    --app-amber: #e0a865;
    --app-ink: #eff8f6;
    --app-muted: #aabdbd;
    --app-soft: #0f1a20;
    --app-line: rgba(178, 205, 202, .18);
    --app-surface: #17272d;
    --app-surface-soft: #132228;
}

:root[data-theme="night"] body {
    background: #0f1a20;
}

:root[data-theme="night"] .brand-wordmark strong,
:root[data-theme="night"] .brand-care-band h2,
:root[data-theme="night"] .section-heading h2,
:root[data-theme="night"] .brand-steps h3,
:root[data-theme="night"] .lawyer-showcase-card h3,
:root[data-theme="night"] .lawyer-showcase-meta strong {
    color: var(--app-ink);
}

:root[data-theme="night"] .trust-strip,
:root[data-theme="night"] .brand-category-section,
:root[data-theme="night"] .brand-care-band,
:root[data-theme="night"] .category-tile,
:root[data-theme="night"] .lawyer-showcase-card {
    border-color: var(--app-line);
    background: #17272d;
}

:root[data-theme="night"] .brand-intro,
:root[data-theme="night"] .lawyer-showcase {
    background: #122128;
}

:root[data-theme="night"] .category-tile:hover {
    background: #1d3438;
}

:root[data-theme="night"] .trust-grid strong,
:root[data-theme="night"] .category-tile {
    color: var(--app-ink);
}

:root[data-theme="night"] .badge.text-bg-light.text-dark {
    border: 1px solid rgba(99, 198, 184, .28);
    background: rgba(99, 198, 184, .13) !important;
    color: #bcebe4 !important;
}

@media (max-width: 991.98px) {
    .brand-hero {
        min-height: 610px;
    }

    .brand-hero-image {
        object-position: 62% center;
    }

    .brand-hero-shade {
        background: rgba(241, 247, 245, .64);
    }

    .trust-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .trust-grid > div:nth-child(3) {
        border-left: 1px solid var(--app-line);
    }

    .brand-care-band .container {
        display: grid;
    }

    .brand-care-actions {
        flex: 1 1 auto;
    }
}

@media (max-width: 767.98px) {
    .section-band {
        padding: 3.7rem 0;
    }

    .brand-hero {
        min-height: 590px;
    }

    .brand-hero-image {
        object-position: 66% center;
    }

    .brand-hero-shade {
        background: rgba(241, 247, 245, .76);
    }

    .brand-hero-content {
        align-self: end;
        padding-block: 3.2rem;
    }

    .brand-hero h1 {
        font-size: clamp(3.35rem, 15.5vw, 4.7rem);
    }

    .brand-hero-lead {
        font-size: 1.04rem;
    }

    .brand-hero-copy,
    .brand-hero-lead,
    .brand-hero-note {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .brand-hero-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .trust-grid,
    .brand-steps,
    .category-grid,
    .lawyer-showcase-grid {
        grid-template-columns: 1fr;
    }

    .trust-grid > div,
    .trust-grid > div:first-child,
    .trust-grid > div:nth-child(3) {
        min-height: 88px;
        border-left: 1px solid var(--app-line);
    }

    .brand-steps article,
    .brand-steps article:first-child {
        border-left: 1px solid var(--app-line);
        border-bottom: 1px solid var(--app-line);
    }

    .section-heading-row {
        display: grid;
        gap: 1rem;
    }

    .section-heading-row .btn {
        width: fit-content;
    }

    .brand-care-actions {
        display: grid;
    }
}

@media (max-width: 575.98px) {
    .brand-wordmark small {
        display: none;
    }

    .navbar .container {
        min-height: 56px;
    }

    .navbar-brand {
        margin-right: 0;
    }

    .navbar-quick-actions {
        gap: .35rem;
    }

    .navbar-toggler {
        width: 42px;
        height: 38px;
        padding: .3rem .45rem;
    }
}

/* 2026 workspace visual refresh */
:root {
    --app-primary: #08766b;
    --app-primary-dark: #075d55;
    --app-secondary: #2d61a6;
    --app-accent: #c8822d;
    --app-ink: #17313b;
    --app-muted: #64777e;
    --app-soft: #f4f7f6;
    --app-line: #dce6e3;
    --app-surface: #ffffff;
    --app-surface-soft: #f8fbfa;
    --app-shadow-sm: 0 8px 22px rgba(23, 49, 59, .06);
    --app-shadow-md: 0 18px 44px rgba(23, 49, 59, .10);
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background: var(--app-soft);
    color: var(--app-ink);
    letter-spacing: 0;
}

main {
    min-height: calc(100vh - 168px);
}

.container {
    --bs-gutter-x: 2rem;
}

.navbar {
    border-color: rgba(220, 230, 227, .88) !important;
    background: rgba(255, 255, 255, .92) !important;
    box-shadow: 0 4px 18px rgba(23, 49, 59, .055);
    backdrop-filter: blur(18px);
}

.navbar .container {
    min-height: 70px;
}

.brand-mark {
    width: 42px;
    height: 42px;
}

.brand-wordmark strong {
    color: #075d55;
    font-size: 1.12rem;
}

.brand-wordmark small {
    color: #71858a;
    font-size: .53rem;
    letter-spacing: .12em;
}

.navbar .nav-link {
    position: relative;
    margin-inline: .12rem;
    padding: .6rem .68rem !important;
    border-radius: 6px;
    background: transparent;
    color: #536970;
    font-weight: 750;
}

.navbar .nav-link:hover {
    background: #eff7f5;
    color: var(--app-primary);
}

.navbar .nav-link.active {
    background: transparent;
    color: var(--app-primary);
}

.navbar .nav-link.active::after {
    position: absolute;
    right: .7rem;
    bottom: .25rem;
    left: .7rem;
    height: 2px;
    border-radius: 999px;
    background: var(--app-primary);
    content: "";
}

.btn {
    min-height: 40px;
    padding: .52rem .9rem;
    border-radius: 6px;
    font-weight: 800;
    transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    border-color: var(--app-primary);
    background: var(--app-primary);
    box-shadow: 0 8px 18px rgba(8, 118, 107, .18);
}

.btn-primary:hover,
.btn-primary:focus {
    border-color: var(--app-primary-dark);
    background: var(--app-primary-dark);
    box-shadow: 0 10px 24px rgba(8, 93, 85, .2);
}

.btn-outline-primary {
    border-color: rgba(8, 118, 107, .34);
    background: transparent;
    color: var(--app-primary);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    border-color: rgba(8, 118, 107, .6);
    background: #ebf7f4;
    color: var(--app-primary-dark);
}

.app-card,
.stat-card {
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .97);
    box-shadow: var(--app-shadow-sm);
}

.form-control,
.form-select {
    min-height: 46px;
    border-color: #d5e1df;
    border-radius: 6px;
    background-color: rgba(255, 255, 255, .98);
}

textarea.form-control {
    min-height: auto;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(8, 118, 107, .66);
    box-shadow: 0 0 0 .2rem rgba(8, 118, 107, .11);
}

.section-band {
    padding: 4.7rem 0;
}

.legal-badge,
.brand-kicker {
    letter-spacing: .035em;
}

.brand-hero {
    min-height: clamp(530px, 69svh, 660px);
}

.brand-hero-shade {
    background: rgba(242, 248, 246, .43);
}

.brand-hero-copy {
    max-width: 680px;
}

.brand-hero h1 {
    margin-top: .8rem;
    color: #075d55;
    font-size: clamp(4.1rem, 8vw, 7.3rem);
    letter-spacing: 0;
    text-shadow: 0 2px 0 rgba(255, 255, 255, .56);
}

.brand-hero-note {
    padding: .75rem .9rem;
    border: 1px solid rgba(8, 118, 107, .18);
    border-radius: 6px;
    background: rgba(255, 255, 255, .48);
    backdrop-filter: blur(8px);
}

.trust-strip {
    background: rgba(255, 255, 255, .98);
}

.trust-grid > div {
    min-height: 96px;
}

.trust-grid i,
.brand-steps i {
    border-radius: 8px;
}

.brand-steps article {
    background: rgba(255, 255, 255, .34);
    transition: background .18s ease;
}

.brand-steps article:hover {
    background: rgba(255, 255, 255, .78);
}

.category-grid {
    gap: .8rem;
    border: 0;
}

.category-tile {
    min-height: 138px;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(23, 49, 59, .035);
}

.category-tile:hover {
    border-color: rgba(8, 118, 107, .3);
    background: #f1f9f7;
    box-shadow: 0 14px 26px rgba(23, 49, 59, .08);
}

.lawyer-showcase-card {
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(23, 49, 59, .055);
    transition: transform .18s ease, box-shadow .18s ease;
}

.lawyer-showcase-card:hover {
    box-shadow: 0 16px 34px rgba(23, 49, 59, .1);
    transform: translateY(-3px);
}

@media (prefers-reduced-motion: no-preference) {
    .brand-hero {
        --hero-motion-x: 0px;
        --hero-motion-y: 0px;
    }

    body.motion-ready .brand-hero-image {
        animation: brandHeroDrift 22s ease-in-out infinite alternate;
        transform-origin: center;
        transition: filter .3s ease;
        will-change: transform;
    }

    body.motion-ready .brand-hero.has-image-motion:hover .brand-hero-image {
        filter: saturate(1.06) contrast(1.03);
    }

    body.motion-ready .brand-hero .brand-kicker,
    body.motion-ready .brand-hero h1,
    body.motion-ready .brand-hero-lead,
    body.motion-ready .brand-hero-actions,
    body.motion-ready .brand-hero-note {
        animation: motionFadeUp .76s cubic-bezier(.2, .8, .2, 1) both;
    }

    body.motion-ready .brand-hero h1 {
        animation-delay: .08s;
    }

    body.motion-ready .brand-hero-lead {
        animation-delay: .18s;
    }

    body.motion-ready .brand-hero-actions {
        animation-delay: .28s;
    }

    body.motion-ready .brand-hero-note {
        animation-delay: .38s;
    }

    .motion-reveal {
        opacity: 0;
        transform: translateY(22px);
        transition:
            opacity .7s cubic-bezier(.2, .8, .2, 1),
            transform .7s cubic-bezier(.2, .8, .2, 1),
            box-shadow .18s ease,
            background-color .18s ease,
            border-color .18s ease;
        transition-delay: var(--motion-delay, 0ms);
        will-change: opacity, transform;
    }

    .motion-reveal.is-visible {
        opacity: 1;
        transform: translateY(0);
    }

    .brand-hero-actions .btn,
    .brand-care-actions .btn,
    .lawyer-showcase-card .btn {
        transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease;
    }

    .brand-hero-actions .btn:hover,
    .brand-care-actions .btn:hover,
    .lawyer-showcase-card .btn:hover {
        transform: translateY(-2px);
    }

    .trust-grid i,
    .brand-steps i,
    .category-tile > i:first-child {
        transition: transform .2s ease, color .2s ease, background-color .2s ease;
    }

    .trust-grid > div:hover i,
    .brand-steps article:hover i,
    .category-tile:hover > i:first-child {
        transform: translateY(-2px) scale(1.06);
    }

    .category-tile > i:last-child {
        transition: transform .2s ease, color .2s ease;
    }

    .category-tile:hover > i:last-child {
        color: var(--app-primary);
        transform: translate(3px, -3px);
    }

    .lawyer-showcase-card:hover .profile-avatar {
        transform: scale(1.03);
    }

    .profile-avatar {
        transition: transform .2s ease;
    }
}

@keyframes motionFadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes brandHeroDrift {
    0% {
        transform: translate3d(calc(var(--hero-motion-x, 0px) - 10px), calc(var(--hero-motion-y, 0px) - 3px), 0) scale(1.06);
    }

    45% {
        transform: translate3d(calc(var(--hero-motion-x, 0px) + 5px), calc(var(--hero-motion-y, 0px) + 2px), 0) scale(1.095);
    }

    100% {
        transform: translate3d(calc(var(--hero-motion-x, 0px) + 12px), calc(var(--hero-motion-y, 0px) - 1px), 0) scale(1.12);
    }
}

.profile-avatar {
    border-radius: 8px;
}

.profile-avatar.has-image,
.chat-avatar.has-image {
    overflow: hidden;
    padding: 0;
    background: #fff;
    color: transparent;
}

.profile-avatar img,
.chat-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: inherit;
}

.profile-avatar-xl {
    width: 96px;
    height: 96px;
    flex: 0 0 auto;
    font-size: 2rem;
}

.profile-upload-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid rgba(36, 87, 166, .14);
    border-radius: 8px;
    background: linear-gradient(135deg, #f8fbff, #f5fbf8);
}

@media (max-width: 575.98px) {
    .profile-upload-card {
        align-items: flex-start;
        flex-direction: column;
    }
}

.profile-page-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 210px;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1rem;
}

.profile-eyebrow {
    display: inline-flex;
    margin-bottom: .35rem;
    color: var(--app-primary);
    font-size: .76rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.profile-page-head h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 0;
}

.profile-page-head p {
    max-width: 660px;
    margin: .35rem 0 0;
    color: #65768d;
}

.profile-score-meter {
    display: grid;
    gap: .35rem;
    align-self: stretch;
    justify-content: stretch;
    min-width: 0;
}

.profile-score-meter span {
    color: #65768d;
    font-size: .82rem;
    font-weight: 800;
}

.profile-score-meter strong {
    color: #17253a;
    font-size: 1.8rem;
    line-height: 1;
}

.profile-score-bar {
    width: 100%;
    height: 9px;
    overflow: hidden;
    border-radius: 8px;
    background: rgba(36, 87, 166, .11);
}

.profile-score-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2457a6, #21a58e);
}

.profile-status-grid {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin-bottom: 1.1rem;
}

.profile-status-pill {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 34px;
    padding: .42rem .7rem;
    border: 1px solid rgba(36, 87, 166, .13);
    border-radius: 8px;
    background: rgba(36, 87, 166, .06);
    color: #31455e;
    font-size: .86rem;
    font-weight: 800;
}

.profile-status-pill.is-done {
    border-color: rgba(33, 165, 142, .28);
    background: rgba(33, 165, 142, .10);
    color: #116b5e;
}

.profile-status-pill.is-pending {
    border-color: rgba(221, 161, 60, .26);
    background: rgba(221, 161, 60, .10);
    color: #77521c;
}

.profile-section-title {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-bottom: .7rem;
    color: #223047;
    font-weight: 900;
}

.profile-section-title i {
    color: var(--app-primary);
}

.profile-photo-card {
    display: grid;
    grid-template-columns: 148px minmax(0, 1fr);
    gap: 1.25rem;
    align-items: center;
    padding: 1.15rem;
    border: 1px solid rgba(36, 87, 166, .16);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(247, 251, 255, .96)),
        linear-gradient(135deg, rgba(36, 87, 166, .08), rgba(39, 166, 139, .08));
    box-shadow: 0 14px 32px rgba(20, 31, 52, .08);
}

.profile-photo-card.is-dragover {
    border-color: rgba(36, 87, 166, .55);
    box-shadow: 0 18px 38px rgba(36, 87, 166, .16);
}

.profile-photo-card.is-invalid {
    border-color: rgba(220, 53, 69, .45);
}

.profile-photo-preview {
    display: grid;
    gap: .65rem;
    justify-items: center;
}

.profile-photo-frame {
    width: 132px;
    height: 132px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(36, 87, 166, .14);
    border-radius: 8px;
    background: linear-gradient(135deg, #edf5ff, #f3fbf8);
    color: var(--app-primary);
    font-size: 2.6rem;
    box-shadow: inset 0 0 0 7px rgba(255, 255, 255, .78);
}

.profile-photo-frame.has-image {
    background: #fff;
    color: transparent;
    box-shadow: 0 12px 26px rgba(20, 31, 52, .14);
}

.profile-photo-frame img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.profile-photo-status {
    display: inline-flex;
    max-width: 100%;
    padding: .35rem .65rem;
    border-radius: 8px;
    background: rgba(36, 87, 166, .08);
    color: #315070;
    font-size: .82rem;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
}

.profile-photo-body {
    min-width: 0;
}

.profile-photo-kicker {
    display: inline-flex;
    margin-bottom: .35rem;
    color: var(--app-primary);
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.profile-photo-body h2 {
    margin: 0;
    font-size: 1.18rem;
    font-weight: 800;
    letter-spacing: 0;
}

.profile-photo-body p {
    margin: .28rem 0 .95rem;
    color: #5f7086;
    overflow-wrap: anywhere;
}

.profile-photo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
}

.profile-photo-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 42px;
}

.profile-photo-button[disabled] {
    pointer-events: none;
}

.profile-photo-meta {
    margin-top: .7rem;
    color: #728198;
    font-size: .86rem;
}

.profile-save-bar {
    position: sticky;
    bottom: 1rem;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem;
    border: 1px solid rgba(36, 87, 166, .16);
    border-radius: 8px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 16px 36px rgba(18, 30, 50, .12);
    backdrop-filter: blur(16px);
}

.profile-save-bar strong,
.profile-save-bar span {
    display: block;
}

.profile-save-bar strong {
    color: #18263a;
    font-weight: 900;
}

.profile-save-bar span {
    color: #6c7b91;
    font-size: .88rem;
}

.profile-save-bar .btn {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    white-space: nowrap;
}

.profile-photo-card.is-invalid .profile-photo-meta {
    color: #b02a37;
    font-weight: 700;
}

:root[data-theme="night"] .profile-photo-card {
    border-color: rgba(148, 174, 214, .22);
    background:
        linear-gradient(135deg, rgba(18, 27, 43, .96), rgba(15, 35, 42, .92)),
        linear-gradient(135deg, rgba(116, 167, 255, .12), rgba(84, 208, 191, .10));
    box-shadow: 0 18px 36px rgba(0, 0, 0, .22);
}

:root[data-theme="night"] .profile-page-head p,
:root[data-theme="night"] .profile-score-meter span {
    color: #9eabc0;
}

:root[data-theme="night"] .profile-score-meter strong,
:root[data-theme="night"] .profile-section-title,
:root[data-theme="night"] .profile-save-bar strong {
    color: #f3f7ff;
}

:root[data-theme="night"] .profile-score-bar {
    background: rgba(148, 174, 214, .16);
}

:root[data-theme="night"] .profile-status-pill {
    border-color: rgba(148, 174, 214, .18);
    background: rgba(148, 174, 214, .10);
    color: #d8e4f7;
}

:root[data-theme="night"] .profile-status-pill.is-done {
    border-color: rgba(84, 208, 191, .28);
    background: rgba(84, 208, 191, .12);
    color: #b6fff1;
}

:root[data-theme="night"] .profile-status-pill.is-pending {
    border-color: rgba(245, 190, 98, .30);
    background: rgba(245, 190, 98, .12);
    color: #ffe0a7;
}

:root[data-theme="night"] .profile-save-bar {
    border-color: rgba(148, 174, 214, .22);
    background: rgba(18, 27, 43, .92);
    box-shadow: 0 18px 42px rgba(0, 0, 0, .24);
}

:root[data-theme="night"] .profile-save-bar span {
    color: #a8b5c8;
}

:root[data-theme="night"] .profile-photo-frame {
    border-color: rgba(148, 174, 214, .22);
    background: linear-gradient(135deg, rgba(116, 167, 255, .18), rgba(84, 208, 191, .14));
    box-shadow: inset 0 0 0 7px rgba(255, 255, 255, .04);
}

:root[data-theme="night"] .profile-photo-status {
    background: rgba(116, 167, 255, .14);
    color: #d5e5ff;
}

:root[data-theme="night"] .profile-photo-body p,
:root[data-theme="night"] .profile-photo-meta {
    color: #9eabc0;
}

@media (max-width: 767.98px) {
    .profile-page-head {
        grid-template-columns: 1fr;
    }

    .profile-page-head h1 {
        font-size: 1.65rem;
    }

    .profile-score-meter {
        max-width: 280px;
    }

    .profile-photo-card {
        grid-template-columns: 1fr;
    }

    .profile-photo-preview {
        justify-items: start;
    }

    .profile-photo-frame {
        width: 112px;
        height: 112px;
    }

    .profile-save-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .profile-save-bar .btn {
        width: 100%;
        justify-content: center;
    }
}

.site-footer {
    margin-top: 0 !important;
    padding-block: 1.35rem !important;
    background: #ffffff !important;
}

.site-footer .container > div {
    align-items: center;
}

.footer-links a {
    font-weight: 700;
}

.portal-page {
    min-height: calc(100vh - 142px);
    display: flex;
    align-items: center;
    background: #eff5f3;
}

.portal-page h1 {
    color: var(--app-ink);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 950 !important;
}

.portal-grid {
    max-width: 1060px;
    margin-inline: auto;
}

.portal-card {
    position: relative;
    overflow: hidden;
    padding: 1.6rem !important;
    border-top: 3px solid var(--app-primary);
    box-shadow: 0 14px 34px rgba(23, 49, 59, .08);
    transition: transform .18s ease, box-shadow .18s ease;
}

.portal-card:hover {
    box-shadow: 0 22px 44px rgba(23, 49, 59, .12);
    transform: translateY(-4px);
}

.portal-card-lawyer {
    border-top-color: var(--app-secondary);
}

.portal-card-lawyer .portal-icon {
    background: #eaf0fa;
    color: var(--app-secondary);
}

.portal-icon {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    font-size: 1.38rem;
}

.portal-requirements {
    border: 1px solid #e1e9e7;
    border-radius: 7px;
    background: #f8fbfa;
}

.auth-section {
    min-height: calc(100vh - 142px);
    display: flex;
    align-items: center;
    padding: 2.5rem 0;
    background: #eff5f3;
}

.auth-shell {
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 18px 46px rgba(23, 49, 59, .12);
}

.auth-side,
.auth-card {
    padding: 2rem;
}

.auth-side {
    background: #075d55;
}

.auth-lawyer .auth-side {
    background: #274f78;
}

.auth-admin .auth-side {
    background: #364152;
}

.auth-switch {
    gap: .4rem;
    padding: .28rem;
    border: 1px solid var(--app-line);
    border-radius: 7px;
    background: #f5f8f7;
}

.auth-switch a {
    border-radius: 5px;
}

.app-sidebar {
    overflow: hidden;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 8px 24px rgba(23, 49, 59, .055);
}

.app-sidebar .list-group-item {
    margin: .15rem .35rem;
    width: auto;
    border: 0;
    border-radius: 6px !important;
    color: #536970;
    font-weight: 750;
}

.app-sidebar .list-group-item:hover,
.app-sidebar .list-group-item.active {
    background: #eaf6f3;
    color: var(--app-primary);
}

.dashboard-shell {
    padding: 1.7rem 0 3rem;
}

.table {
    --bs-table-bg: transparent;
    border-color: var(--app-line);
}

.table thead th {
    color: #71848a;
    font-size: .76rem;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.table tbody tr {
    transition: background .16s ease;
}

.table tbody tr:hover {
    background: rgba(8, 118, 107, .045);
}

.notification-item {
    padding-inline: .85rem;
}

.notification-item.unread {
    background: #eff8f6;
}

:root[data-theme="night"] {
    --app-primary: #72d6c8;
    --app-primary-dark: #9de5dc;
    --app-secondary: #90b8ed;
    --app-accent: #e2ad6a;
    --app-ink: #edf7f5;
    --app-muted: #a9bcbd;
    --app-soft: #101a1e;
    --app-line: rgba(182, 207, 203, .18);
    --app-surface: #18282d;
    --app-surface-soft: #142329;
}

:root[data-theme="night"] .navbar {
    border-color: var(--app-line) !important;
    background: rgba(16, 26, 30, .92) !important;
}

:root[data-theme="night"] .navbar .nav-link:hover,
:root[data-theme="night"] .app-sidebar .list-group-item:hover,
:root[data-theme="night"] .app-sidebar .list-group-item.active {
    background: rgba(114, 214, 200, .11);
}

:root[data-theme="night"] .brand-hero-shade {
    background: rgba(16, 26, 30, .28);
}

:root[data-theme="night"] .brand-hero h1 {
    color: #d8f4ef;
    text-shadow: none;
}

:root[data-theme="night"] .brand-hero-lead,
:root[data-theme="night"] .brand-hero-note {
    color: #e6f3f1;
}

:root[data-theme="night"] .brand-hero-note {
    border-color: rgba(114, 214, 200, .22);
    background: rgba(16, 26, 30, .58);
}

:root[data-theme="night"] .site-footer,
:root[data-theme="night"] .portal-page,
:root[data-theme="night"] .auth-section {
    background: #101a1e !important;
}

:root[data-theme="night"] .portal-requirements,
:root[data-theme="night"] .auth-switch {
    border-color: var(--app-line);
    background: rgba(255, 255, 255, .035);
}

@media (max-width: 991.98px) {
    .navbar .container {
        min-height: 62px;
    }

    .navbar-collapse {
        padding-block: .65rem .85rem;
    }

    .navbar-collapse .d-flex {
        padding-top: .45rem;
    }

    .brand-hero {
        min-height: 590px;
    }

    .portal-page,
    .auth-section {
        align-items: flex-start;
    }
}

@media (max-width: 767.98px) {
    .container {
        --bs-gutter-x: 1.35rem;
    }

    .section-band {
        padding: 3.4rem 0;
    }

    .brand-hero {
        min-height: 570px;
    }

    .brand-hero-content {
        padding-block: 2.8rem;
    }

    .portal-card {
        padding: 1.2rem !important;
    }

    .auth-side,
    .auth-card {
        padding: 1.35rem;
    }

    .site-footer .container > div {
        align-items: flex-start;
    }
}

/* Refresh responsive safeguards */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

.brand-hero-copy,
.brand-hero-lead,
.brand-hero-note,
.portal-page > .container,
.portal-page h1,
.portal-page p,
.portal-card {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

:root[data-theme="night"] .portal-requirements {
    color: #c8d8d7;
}

:root[data-theme="night"] .portal-requirements .fw-semibold {
    color: #e8f5f3;
}

body.admin-page {
    background: var(--app-soft);
}

.admin-profile-card {
    background: #1f5260;
}

@media (max-width: 575.98px) {
    .navbar .container {
        flex-wrap: nowrap;
    }

    .navbar-brand {
        min-width: 0;
    }

    .brand-wordmark strong {
        font-size: 1.02rem;
    }

    .navbar-quick-actions {
        flex: 0 0 auto;
        margin-left: auto;
    }

    .theme-toggle {
        width: 40px;
        height: 38px;
        justify-content: center;
        padding: .3rem;
    }

    .theme-toggle span {
        display: none;
    }

    .portal-page {
        overflow: hidden;
    }

    .portal-page h1 {
        font-size: 1.8rem;
    }

    .portal-grid {
        margin-inline: 0;
    }

    .portal-grid > div {
        min-width: 0;
    }

    .brand-hero-lead,
    .brand-hero-note,
    .portal-page h1,
    .portal-page p,
    .portal-card p {
        word-break: break-all;
    }
}

/* Payment workflow */
.page-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.page-kicker {
    display: inline-flex;
    margin-bottom: .35rem;
    color: var(--app-primary);
    font-size: .76rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.empty-state {
    display: grid;
    justify-items: center;
    gap: .75rem;
    padding: 2rem;
    text-align: center;
}

.empty-state > i {
    width: 58px;
    height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #eaf6f3;
    color: var(--app-primary);
    font-size: 1.7rem;
}

.empty-state h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 900;
}

.empty-state p {
    max-width: 520px;
    margin: 0;
    color: var(--app-muted);
}

.booking-list {
    display: grid;
    gap: 1rem;
}

.booking-card,
.payment-panel {
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface);
    box-shadow: var(--app-shadow-sm);
}

.booking-card {
    display: grid;
    gap: 1rem;
    padding: 1.1rem;
}

.booking-card-head,
.payment-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.booking-title {
    min-width: 0;
}

.booking-id {
    display: inline-flex;
    margin-bottom: .35rem;
    color: var(--app-muted);
    font-size: .82rem;
    font-weight: 800;
}

.booking-title h2 {
    margin: 0;
    font-size: 1.18rem;
    font-weight: 900;
}

.booking-title p,
.payment-panel-head p,
.booking-flow-copy {
    margin: .35rem 0 0;
    color: var(--app-muted);
    line-height: 1.65;
}

.booking-title p {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    align-items: center;
}

.booking-price {
    display: grid;
    justify-items: end;
    gap: .25rem;
    text-align: right;
}

.booking-price strong,
.payment-panel-head h2 {
    margin: 0;
    color: var(--app-ink);
    font-size: 1.35rem;
    font-weight: 950;
}

.booking-price small,
.payment-status-chip span {
    color: var(--app-muted);
    font-size: .82rem;
}

.workflow-badge {
    display: inline-flex;
    align-items: center;
    gap: .38rem;
    width: fit-content;
    max-width: 100%;
    padding: .36rem .62rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 900;
    line-height: 1.25;
    white-space: normal;
}

.workflow-badge.tone-primary,
.payment-admin-stat.tone-info {
    border-color: rgba(8, 118, 107, .18);
    background: #eaf6f3;
    color: #075d55;
}

.workflow-badge.tone-info {
    border-color: rgba(45, 97, 166, .2);
    background: #edf4ff;
    color: #24528d;
}

.workflow-badge.tone-success,
.payment-admin-stat.tone-success {
    border-color: rgba(25, 135, 84, .18);
    background: #e9f7ef;
    color: #137044;
}

.workflow-badge.tone-warning,
.payment-admin-stat.tone-warning {
    border-color: rgba(194, 122, 26, .22);
    background: #fff5df;
    color: #8b560e;
}

.workflow-badge.tone-danger,
.payment-admin-stat.tone-danger {
    border-color: rgba(194, 52, 52, .22);
    background: #fff0f0;
    color: #a42b2b;
}

.payment-progress {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .65rem;
}

.payment-step {
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    padding: .75rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface-soft);
}

.payment-step-dot {
    width: 34px;
    height: 34px;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #eef4f2;
    color: var(--app-muted);
}

.payment-step strong,
.payment-step small {
    display: block;
    min-width: 0;
}

.payment-step strong {
    color: var(--app-ink);
    font-size: .9rem;
    font-weight: 900;
}

.payment-step small {
    color: var(--app-muted);
    font-size: .78rem;
    line-height: 1.35;
}

.payment-step.is-done {
    border-color: rgba(25, 135, 84, .22);
    background: #f0fbf5;
}

.payment-step.is-done .payment-step-dot {
    background: #dff5e8;
    color: #137044;
}

.payment-step.is-active {
    border-color: rgba(8, 118, 107, .32);
    background: #edf9f6;
    box-shadow: 0 10px 24px rgba(8, 118, 107, .08);
}

.payment-step.is-active .payment-step-dot {
    background: var(--app-primary);
    color: #fff;
}

.payment-step.is-danger {
    border-color: rgba(194, 52, 52, .26);
    background: #fff5f5;
}

.payment-step.is-danger .payment-step-dot {
    background: #ffe0e0;
    color: #a42b2b;
}

.booking-meta-grid,
.payment-bank-grid,
.payment-admin-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
}

.booking-meta-grid > div,
.payment-bank-item,
.payment-admin-stat {
    min-width: 0;
    padding: .85rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface-soft);
}

.booking-meta-grid span,
.payment-bank-item span,
.payment-admin-stat span {
    display: block;
    color: var(--app-muted);
    font-size: .78rem;
    font-weight: 800;
}

.booking-meta-grid strong,
.payment-bank-item strong,
.payment-admin-stat strong {
    display: block;
    margin-top: .2rem;
    color: var(--app-ink);
    font-weight: 900;
    overflow-wrap: anywhere;
}

.payment-note {
    display: flex;
    gap: .65rem;
    align-items: flex-start;
    padding: .85rem;
    border: 1px solid rgba(45, 97, 166, .18);
    border-radius: 8px;
    background: #f3f7ff;
}

.payment-note.is-danger {
    border-color: rgba(194, 52, 52, .22);
    background: #fff5f5;
}

.payment-note > i {
    color: var(--app-secondary);
    font-size: 1.1rem;
}

.payment-note.is-danger > i {
    color: var(--app-danger);
}

.payment-note strong,
.payment-note span {
    display: block;
}

.payment-note span {
    color: var(--app-muted);
    line-height: 1.55;
}

.payment-qr-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid rgba(8, 118, 107, .2);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(8, 118, 107, .08), rgba(45, 97, 166, .08));
}

.payment-qr-card img {
    width: 148px;
    max-width: 38vw;
    aspect-ratio: 1;
    border: 8px solid #fff;
    border-radius: 8px;
    background: #fff;
    object-fit: contain;
    box-shadow: var(--app-shadow-sm);
}

.payment-method-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.payment-method-card {
    position: relative;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .85rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface-soft);
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.payment-method-card:hover,
.payment-method-card:has(input:checked) {
    border-color: rgba(8, 118, 107, .45);
    background: #f0faf7;
    transform: translateY(-1px);
}

.payment-method-card input {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    accent-color: var(--app-primary);
}

.payment-method-card span {
    width: 38px;
    height: 38px;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #e4f4f0;
    color: var(--app-primary);
}

.payment-method-card strong {
    min-width: 0;
    color: var(--app-ink);
    font-weight: 900;
}

.booking-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    align-items: center;
}

.review-form {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr) auto;
    gap: .65rem;
    align-items: end;
    padding-top: 1rem;
    border-top: 1px solid var(--app-line);
}

.payment-panel {
    display: grid;
    gap: 1rem;
    padding: 1.2rem;
}

.payment-status-chip {
    min-width: 150px;
    padding: .85rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface-soft);
    text-align: right;
}

.payment-status-chip strong {
    display: block;
    margin-top: .15rem;
    font-size: 1rem;
    font-weight: 900;
}

.payment-upload-form {
    display: grid;
    gap: .8rem;
}

.payment-upload-box {
    display: grid;
    justify-items: center;
    gap: .45rem;
    padding: 1.35rem;
    border: 1px dashed rgba(8, 118, 107, .38);
    border-radius: 8px;
    background: #f4fbf9;
    color: var(--app-ink);
    text-align: center;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.payment-upload-box:hover {
    border-color: var(--app-primary);
    background: #edf9f6;
    transform: translateY(-1px);
}

.payment-upload-box > i {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #dff4ee;
    color: var(--app-primary);
    font-size: 1.45rem;
}

.payment-upload-box strong,
.payment-upload-box span {
    display: block;
}

.payment-upload-box span {
    color: var(--app-muted);
    line-height: 1.45;
}

.payment-preview {
    display: flex;
    gap: .8rem;
    align-items: center;
    padding: .8rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface-soft);
}

.payment-preview img,
.payment-preview > i {
    width: 76px;
    height: 76px;
    flex: 0 0 auto;
    border-radius: 8px;
}

.payment-preview img {
    object-fit: cover;
}

.payment-preview > i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff0f0;
    color: var(--app-danger);
    font-size: 2rem;
}

.payment-preview strong,
.payment-preview span {
    display: block;
    overflow-wrap: anywhere;
}

.payment-preview span {
    color: var(--app-muted);
    font-size: .86rem;
}

.payment-locked-note {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    padding: 1rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface-soft);
}

.payment-locked-note > i {
    color: var(--app-primary);
    font-size: 1.25rem;
}

.payment-locked-note strong,
.payment-locked-note span {
    display: block;
}

.payment-locked-note span {
    color: var(--app-muted);
    line-height: 1.55;
}

.payment-admin-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.payment-admin-stat {
    background: var(--app-surface);
}

.payment-admin-stat strong {
    font-size: 1.65rem;
}

.payment-admin-action {
    display: grid;
    gap: .55rem;
    min-width: 240px;
}

:root[data-theme="night"] .booking-card,
:root[data-theme="night"] .payment-panel,
:root[data-theme="night"] .booking-meta-grid > div,
:root[data-theme="night"] .payment-bank-item,
:root[data-theme="night"] .payment-admin-stat,
:root[data-theme="night"] .payment-status-chip,
:root[data-theme="night"] .payment-preview,
:root[data-theme="night"] .payment-locked-note {
    border-color: var(--app-line);
    background: var(--app-surface);
}

:root[data-theme="night"] .payment-step,
:root[data-theme="night"] .payment-upload-box,
:root[data-theme="night"] .payment-method-card {
    border-color: var(--app-line);
    background: var(--app-surface-soft);
}

:root[data-theme="night"] .payment-method-card:hover,
:root[data-theme="night"] .payment-method-card:has(input:checked),
:root[data-theme="night"] .payment-qr-card {
    border-color: rgba(114, 214, 200, .28);
    background: rgba(114, 214, 200, .08);
}

:root[data-theme="night"] .payment-step.is-active {
    border-color: rgba(114, 214, 200, .38);
    background: rgba(114, 214, 200, .09);
}

:root[data-theme="night"] .payment-step.is-done {
    border-color: rgba(111, 211, 154, .28);
    background: rgba(111, 211, 154, .08);
}

:root[data-theme="night"] .payment-step.is-danger,
:root[data-theme="night"] .payment-note.is-danger {
    border-color: rgba(255, 132, 132, .28);
    background: rgba(255, 132, 132, .08);
}

:root[data-theme="night"] .payment-note {
    border-color: rgba(144, 184, 237, .22);
    background: rgba(144, 184, 237, .08);
}

:root[data-theme="night"] .workflow-badge.tone-primary,
:root[data-theme="night"] .payment-admin-stat.tone-info {
    background: rgba(114, 214, 200, .13);
    color: #c8f3ee;
}

:root[data-theme="night"] .workflow-badge.tone-info {
    background: rgba(144, 184, 237, .14);
    color: #d8e8ff;
}

:root[data-theme="night"] .workflow-badge.tone-success,
:root[data-theme="night"] .payment-admin-stat.tone-success {
    background: rgba(111, 211, 154, .12);
    color: #c8f5d9;
}

:root[data-theme="night"] .workflow-badge.tone-warning,
:root[data-theme="night"] .payment-admin-stat.tone-warning {
    background: rgba(226, 173, 106, .14);
    color: #ffe2b6;
}

:root[data-theme="night"] .workflow-badge.tone-danger,
:root[data-theme="night"] .payment-admin-stat.tone-danger {
    background: rgba(255, 132, 132, .13);
    color: #ffd0d0;
}

@media (max-width: 991.98px) {
    .payment-progress,
    .booking-meta-grid,
    .payment-bank-grid,
    .payment-method-grid,
    .payment-admin-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    .page-heading-row,
    .booking-card-head,
    .payment-panel-head {
        display: grid;
    }

    .booking-price,
    .payment-status-chip {
        justify-items: start;
        text-align: left;
    }

    .payment-progress,
    .booking-meta-grid,
    .payment-bank-grid,
    .payment-method-grid,
    .payment-admin-stats,
    .review-form {
        grid-template-columns: 1fr;
    }

    .payment-qr-card {
        display: grid;
    }

    .payment-admin-action {
        min-width: 0;
    }
}

/* Recommended lawyer cards */
.lawyer-match-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: 1rem;
    align-items: stretch;
}

.lawyer-match-grid.is-chat {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

.lawyer-match-rail-wrap {
    position: relative;
    margin-inline: -.35rem;
}

.lawyer-match-rail-wrap::before,
.lawyer-match-rail-wrap::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: .9rem;
    z-index: 2;
    width: 46px;
    pointer-events: none;
}

.lawyer-match-rail-wrap::before {
    left: 0;
    background: linear-gradient(90deg, var(--app-soft), transparent);
}

.lawyer-match-rail-wrap::after {
    right: 0;
    background: linear-gradient(270deg, var(--app-soft), transparent);
}

.lawyer-match-rail {
    display: flex;
    grid-template-columns: none;
    gap: 1.15rem;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    padding: .25rem .35rem 1rem;
    scroll-padding-inline: .35rem;
    scroll-snap-type: x mandatory;
    scrollbar-color: rgba(99, 198, 184, .62) rgba(148, 163, 184, .18);
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.lawyer-match-rail::-webkit-scrollbar {
    height: 10px;
}

.lawyer-match-rail::-webkit-scrollbar-track {
    border-radius: 999px;
    background: rgba(148, 163, 184, .16);
}

.lawyer-match-rail::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--app-primary), var(--app-secondary)) border-box;
}

.lawyer-match-rail > .lawyer-match-card {
    flex: 0 0 clamp(340px, 48vw, 590px);
    scroll-snap-align: start;
}

.lawyer-match-rail > .alert {
    flex: 1 0 100%;
}

:root[data-theme="night"] .lawyer-match-rail-wrap::before {
    background: linear-gradient(90deg, var(--app-soft), transparent);
}

:root[data-theme="night"] .lawyer-match-rail-wrap::after {
    background: linear-gradient(270deg, var(--app-soft), transparent);
}

.lawyer-match-card {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .85rem;
    padding: 1rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: linear-gradient(160deg, var(--app-surface) 0%, var(--app-surface-soft) 100%);
    box-shadow: var(--app-shadow-sm);
}

.lawyer-match-head {
    min-width: 0;
    display: flex;
    gap: .8rem;
    align-items: flex-start;
}

.lawyer-match-head .profile-avatar {
    flex: 0 0 auto;
}

.lawyer-match-title {
    min-width: 0;
    flex: 1 1 auto;
}

.lawyer-match-title h2 {
    margin: 0;
    color: var(--app-ink);
    font-size: 1.02rem;
    font-weight: 950;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.lawyer-match-meta,
.lawyer-match-badges,
.lawyer-match-facts,
.lawyer-match-tags,
.lawyer-match-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}

.lawyer-match-meta {
    margin-top: .3rem;
    color: var(--app-muted);
    font-size: .84rem;
    line-height: 1.45;
}

.lawyer-match-meta span,
.lawyer-match-facts span {
    min-width: 0;
    display: inline-flex;
    gap: .28rem;
    align-items: center;
}

.lawyer-match-badges {
    margin-top: .55rem;
}

.match-score-badge,
.match-verified-badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    max-width: 100%;
    padding: .32rem .52rem;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 900;
    line-height: 1.2;
    white-space: normal;
}

.match-score-badge {
    background: #e9f1ff;
    color: #2258a6;
}

.match-verified-badge {
    background: #e6f7ef;
    color: #117547;
}

.match-score-meter {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--app-line);
}

.match-score-meter span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--app-primary), var(--app-secondary));
}

.lawyer-match-context {
    padding: .75rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface);
}

.lawyer-match-context span {
    display: block;
    color: var(--app-muted);
    font-size: .76rem;
    font-weight: 900;
}

.lawyer-match-context strong {
    display: block;
    margin-top: .16rem;
    color: var(--app-ink);
    font-size: .92rem;
    overflow-wrap: anywhere;
}

.lawyer-match-reason {
    margin: 0;
    color: var(--app-muted);
    line-height: 1.65;
}

.lawyer-match-facts {
    color: var(--app-muted);
    font-size: .84rem;
}

.lawyer-match-facts .bi-star-fill {
    color: #d79a1e;
}

.lawyer-match-facts .bi-circle-fill {
    color: var(--app-primary);
    font-size: .45rem;
}

.lawyer-match-tags span {
    padding: .28rem .5rem;
    border: 1px solid var(--app-line);
    border-radius: 999px;
    background: var(--app-surface);
    color: var(--app-muted);
    font-size: .78rem;
    font-weight: 800;
}

.lawyer-match-actions {
    margin-top: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lawyer-match-actions .btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: normal;
    line-height: 1.25;
}

.lawyer-match-actions .btn-light {
    border-color: var(--app-line);
}

:root[data-theme="night"] .lawyer-match-card,
:root[data-theme="night"] .lawyer-match-context,
:root[data-theme="night"] .lawyer-match-tags span {
    border-color: var(--app-line);
    background: var(--app-surface);
}

:root[data-theme="night"] .match-score-badge {
    background: rgba(144, 184, 237, .14);
    color: #d8e8ff;
}

:root[data-theme="night"] .match-verified-badge {
    background: rgba(111, 211, 154, .12);
    color: #c8f5d9;
}

@media (max-width: 767.98px) {
    .case-delete-button {
        opacity: 1;
        transform: scale(1);
    }

    .lawyer-match-rail-wrap {
        margin-inline: -.85rem;
    }

    .lawyer-match-rail {
        padding-inline: .85rem;
        scroll-padding-inline: .85rem;
    }

    .lawyer-match-rail > .lawyer-match-card {
        flex-basis: min(86vw, 420px);
    }

    .lawyer-match-actions {
        grid-template-columns: 1fr;
    }
}

/* AI chat workspace balance */
.ai-chat-page {
    --ai-shell-sidebar: clamp(208px, 12vw, 232px);
    --ai-work-gap: .75rem;
    --ai-case-width: clamp(208px, 14vw, 240px);
    --ai-analysis-width: clamp(300px, 21vw, 370px);
}

.ai-chat-page > .container-fluid {
    width: 100%;
    max-width: none;
    margin-inline: auto;
    padding-inline: clamp(.75rem, 1vw, 1.5rem) !important;
}

.ai-chat-page > .container-fluid > .row {
    --bs-gutter-x: var(--ai-work-gap);
}

@media (min-width: 992px) {
    .ai-chat-page > .container-fluid > .row > .col-lg-2 {
        flex: 0 0 var(--ai-shell-sidebar);
        max-width: var(--ai-shell-sidebar);
    }

    .ai-chat-page > .container-fluid > .row > .col-lg-10 {
        flex: 1 1 0;
        max-width: calc(100% - var(--ai-shell-sidebar));
    }

    .ai-chat-page .ai-case-panel,
    .ai-chat-page .ai-chat-room,
    .ai-chat-page .ai-analysis-column {
        height: calc(100dvh - 112px);
        min-height: 560px;
    }

    .ai-chat-page .app-sidebar .list-group-item {
        min-height: 48px;
        padding: .74rem .85rem;
        font-size: .95rem;
    }

    .ai-chat-page .ai-sidebar-counselor {
        margin-top: .75rem;
    }

    .ai-chat-page .ai-sidebar-counselor-figure {
        width: min(142px, 82%);
    }

    .ai-chat-page .ai-sidebar-counselor-figure img {
        max-height: 178px;
    }
}

.ai-chat-page .ai-chat-layout {
    grid-template-columns: var(--ai-case-width) minmax(0, 1fr) var(--ai-analysis-width);
    gap: var(--ai-work-gap);
    min-height: calc(100dvh - 112px);
}

.ai-chat-page .ai-case-panel,
.ai-chat-page .ai-chat-room {
    min-height: calc(100dvh - 112px);
}

.ai-chat-page .ai-chat-room {
    overflow: hidden;
}

.ai-chat-page .chat-room-header {
    min-height: 64px;
    padding: .75rem .85rem;
}

.ai-chat-page .chat-room-header > div:nth-child(2) {
    min-width: 0;
}

.ai-chat-page .chat-room-header h1,
.ai-chat-page .chat-room-header p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-chat-page .ai-chat-window {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    padding: .85rem;
}

.ai-chat-page .chat-message {
    max-width: min(720px, 76%);
    line-height: 1.65;
}

.ai-chat-page .ai-chat-row.ai .chat-message {
    margin-right: auto;
}

.ai-chat-page .ai-chat-row.user .chat-message {
    margin-left: auto;
}

.ai-chat-page .ai-chat-composer {
    grid-template-columns: minmax(0, 1fr) repeat(4, 44px);
    gap: .55rem;
    align-items: end;
}

.ai-chat-page .ai-chat-composer textarea {
    min-height: 44px;
    max-height: 132px;
}

.ai-chat-page .ai-attach-button,
.ai-chat-page .ai-chat-composer .btn {
    width: 44px;
    height: 44px;
}

.ai-chat-page .ai-analysis-column {
    min-width: 0;
    max-height: calc(100dvh - 112px);
    overflow-y: auto;
    padding-right: .15rem;
    scrollbar-gutter: stable;
}

.ai-chat-page .ai-analysis-column .app-card {
    box-shadow: var(--app-shadow-sm);
}

.ai-chat-page .ai-analysis-column .row > [class*="col-md-"] {
    flex: 0 0 100%;
    width: 100%;
}

.ai-chat-page .ai-analysis-column .lawyer-match-grid,
.ai-chat-page .ai-analysis-column .lawyer-match-grid.is-chat {
    grid-template-columns: 1fr;
}

.ai-chat-page .ai-analysis-column .lawyer-match-card {
    padding: .85rem;
}

.ai-chat-page .ai-analysis-column .lawyer-match-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ai-chat-page .ai-analysis-column .lawyer-match-actions .btn {
    min-height: 38px;
    padding-inline: .55rem;
    font-size: .86rem;
}

.ai-chat-page .chat-contact-list {
    max-height: calc(100dvh - 198px);
}

.ai-chat-page .chat-contact {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    padding: .68rem;
}

.ai-chat-page .chat-contact .chat-avatar {
    width: 38px;
    height: 38px;
}

.ai-chat-page .chat-contact strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-sidebar-counselor {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
    padding: .7rem .4rem 0;
    overflow: hidden;
    border: 1px solid rgba(99, 198, 184, .18);
    border-radius: 8px;
    background:
        radial-gradient(circle at 50% 20%, rgba(99, 198, 184, .18), transparent 58%),
        linear-gradient(180deg, rgba(19, 45, 51, .35), rgba(12, 31, 36, .08));
    box-shadow: 0 18px 40px rgba(8, 27, 34, .16);
}

.ai-sidebar-counselor-figure {
    position: relative;
    display: inline-flex;
    justify-content: center;
    width: min(172px, 92%);
    transform-origin: 50% 95%;
    animation: aiSidebarCounselorWiggle 3.1s ease-in-out infinite;
}

.ai-sidebar-counselor-figure img {
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    filter: drop-shadow(0 16px 20px rgba(0, 0, 0, .24));
    transform-origin: 50% 95%;
    pointer-events: none;
}

.ai-sidebar-counselor-img.is-open {
    opacity: 1;
    animation:
        aiCounselorFloat 4.2s ease-in-out infinite,
        aiSidebarCounselorOpenEyes 5.4s ease-in-out infinite;
}

.ai-sidebar-counselor-img.is-closed {
    position: absolute;
    inset: 0;
    height: 100%;
    opacity: 0;
    animation:
        aiCounselorFloat 4.2s ease-in-out infinite,
        aiSidebarCounselorCloseEyes 5.4s ease-in-out infinite;
}

@media (min-width: 1440px) {
    .ai-chat-page .ai-chat-layout {
        grid-template-columns: minmax(220px, 246px) minmax(0, 1fr) minmax(315px, 380px);
    }
}

@media (min-width: 1760px) {
    .ai-chat-page {
        --ai-shell-sidebar: 240px;
        --ai-case-width: 248px;
        --ai-analysis-width: 400px;
    }
}

@media (max-width: 1199.98px) {
    .ai-chat-page .ai-chat-layout {
        grid-template-columns: minmax(200px, 230px) minmax(0, 1fr);
        min-height: auto;
    }

    .ai-chat-page .ai-analysis-column {
        grid-column: 1 / -1;
        height: auto;
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    .ai-chat-page .ai-analysis-column .lawyer-match-grid,
    .ai-chat-page .ai-analysis-column .lawyer-match-grid.is-chat {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    }
}

@media (max-width: 991.98px) {
    .ai-chat-page > .container-fluid {
        padding-inline: .85rem;
    }

    .ai-sidebar-counselor {
        display: none;
    }

    .ai-chat-page .ai-chat-layout {
        grid-template-columns: 1fr;
    }

    .ai-chat-page .ai-case-panel,
    .ai-chat-page .ai-chat-room {
        min-height: auto;
    }

    .ai-chat-page .chat-contact-list {
        max-height: 260px;
    }

    .ai-chat-page .ai-chat-window {
        min-height: 460px;
    }
}

@media (max-width: 767.98px) {
    .ai-chat-page .chat-room-header h1,
    .ai-chat-page .chat-room-header p {
        white-space: normal;
    }

    .ai-chat-page .chat-message {
        max-width: 92%;
    }

    .ai-chat-page .ai-chat-composer {
        grid-template-columns: 1fr repeat(4, 44px);
    }

    .ai-chat-page .ai-chat-composer textarea {
        grid-column: 1 / -1;
    }

    .ai-chat-page .ai-analysis-column .lawyer-match-actions {
        grid-template-columns: 1fr;
    }
}

/* AI chat premium workspace */
.ai-chat-page {
    background:
        linear-gradient(135deg, rgba(99, 198, 184, .08), transparent 36%),
        linear-gradient(180deg, var(--app-soft), rgba(245, 247, 251, .88));
}

.ai-chat-page .ai-case-panel,
.ai-chat-room-pro,
.ai-chat-page .ai-analysis-column .app-card {
    border-color: rgba(36, 87, 166, .12);
    box-shadow: 0 18px 46px rgba(18, 35, 53, .08);
}

.ai-chat-room-pro {
    background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(248, 251, 255, .98));
}

.ai-chat-room-pro .chat-room-header {
    position: relative;
    min-height: 104px;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: .75rem;
    padding: .95rem;
    border-bottom: 0;
    background:
        linear-gradient(135deg, rgba(8, 118, 107, .12), rgba(36, 87, 166, .10)),
        linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(250, 253, 255, .96));
}

.ai-chat-room-pro .chat-room-header::after {
    content: "";
    position: absolute;
    right: .95rem;
    bottom: 0;
    left: .95rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(8, 118, 107, .22), transparent);
}

.ai-chat-room-pro .chat-room-header .chat-avatar.lg {
    width: 54px;
    height: 54px;
    border: 1px solid rgba(8, 118, 107, .2);
    background: linear-gradient(135deg, #e8fbf7, #eaf1ff);
    color: var(--app-primary);
    box-shadow: 0 12px 28px rgba(8, 118, 107, .13);
}

.ai-chat-room-pro .chat-room-header h1 {
    color: var(--app-ink);
    font-size: clamp(1.12rem, 1.55vw, 1.42rem);
    line-height: 1.25;
}

.ai-chat-room-pro .chat-room-header p {
    max-width: 760px;
    margin-bottom: 0;
    color: #5c7285;
    line-height: 1.42;
}

.ai-room-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    justify-content: flex-end;
}

.ai-ready-pill {
    display: inline-flex;
    align-items: center;
    gap: .42rem;
    min-height: 32px;
    padding: .38rem .62rem;
    border: 1px solid rgba(29, 127, 114, .18);
    border-radius: 999px;
    background: rgba(29, 127, 114, .10);
    color: #136c58;
    font-size: .78rem;
    font-weight: 900;
}

.ai-ready-pill .bi-circle-fill,
.ai-ready-pill .bi-shield-check {
    color: #20b486;
    font-size: .58rem;
}

.ai-room-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .5rem;
    padding: .62rem .75rem;
    border-bottom: 1px solid var(--app-line);
    background: rgba(255, 255, 255, .72);
}

.ai-room-metrics span {
    min-width: 0;
    display: grid;
    gap: .12rem;
    padding: .54rem .65rem;
    border: 1px solid rgba(36, 87, 166, .10);
    border-radius: 8px;
    background: var(--app-surface);
}

.ai-room-metrics small,
.ai-room-metrics strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-room-metrics small {
    color: var(--app-muted);
    font-size: .7rem;
    font-weight: 800;
}

.ai-room-metrics strong {
    color: var(--app-ink);
    font-size: .84rem;
    font-weight: 950;
}

.ai-prompt-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .55rem;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--app-line);
    background: rgba(248, 251, 255, .86);
}

.ai-prompt-strip button {
    min-width: 0;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: .5rem;
    padding: .65rem .75rem;
    border: 1px solid rgba(36, 87, 166, .12);
    border-radius: 8px;
    background: var(--app-surface);
    color: var(--app-ink);
    font-weight: 850;
    text-align: left;
    transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease;
}

.ai-prompt-strip button:hover {
    border-color: rgba(8, 118, 107, .28);
    background: #eefbf8;
    color: var(--app-primary-dark);
    transform: translateY(-1px);
}

.ai-prompt-strip i {
    color: var(--app-primary);
}

.ai-prompt-strip span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-chat-room-pro .ai-chat-window {
    background:
        linear-gradient(180deg, rgba(251, 253, 255, .96), rgba(244, 249, 250, .96)),
        linear-gradient(90deg, rgba(8, 118, 107, .045) 1px, transparent 1px),
        linear-gradient(0deg, rgba(36, 87, 166, .035) 1px, transparent 1px);
    background-size: auto, 36px 36px, 36px 36px;
}

.ai-chat-room-pro .ai-chat-row {
    gap: .55rem;
}

.ai-chat-room-pro .chat-message {
    border: 1px solid rgba(36, 87, 166, .10);
    box-shadow: 0 12px 26px rgba(18, 35, 53, .065);
}

.ai-chat-room-pro .chat-message.ai {
    background: rgba(255, 255, 255, .96);
}

.ai-chat-room-pro .chat-message.user {
    border-color: rgba(36, 87, 166, .22);
    background: linear-gradient(135deg, #2359aa, #1d8f82);
}

.ai-chat-room-pro .ai-chat-composer {
    gap: .55rem;
    padding: .7rem .85rem .85rem;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(14px);
}

.ai-chat-room-pro .ai-chat-composer textarea {
    border-radius: 8px;
    background: var(--app-surface);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
}

.ai-chat-room-pro .ai-attach-button,
.ai-chat-room-pro .ai-chat-composer .btn {
    border-radius: 8px;
}

.ai-insight-card {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.ai-insight-head {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: .75rem;
    align-items: start;
}

.ai-insight-head > span {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(29, 127, 114, .11);
    color: var(--app-primary);
}

.ai-insight-head h2 {
    margin: 0;
    color: var(--app-ink);
    font-size: 1rem;
    font-weight: 950;
}

.ai-insight-head p {
    margin: .15rem 0 0;
    color: var(--app-muted);
    font-size: .82rem;
    line-height: 1.5;
}

.ai-insight-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .55rem;
}

.ai-insight-grid div {
    min-width: 0;
    padding: .72rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface-soft);
}

.ai-insight-grid small,
.ai-insight-grid strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-insight-grid small {
    color: var(--app-muted);
    font-size: .75rem;
    font-weight: 800;
}

.ai-insight-grid strong {
    color: var(--app-ink);
    font-weight: 950;
}

.ai-insight-steps {
    display: grid;
    gap: .45rem;
}

.ai-insight-steps span {
    display: flex;
    gap: .45rem;
    align-items: center;
    color: var(--app-muted);
    font-size: .84rem;
    font-weight: 750;
}

.ai-insight-steps i {
    color: var(--app-primary);
}

.ai-analysis-column .analysis-card {
    display: grid;
    gap: .9rem;
    overflow: hidden;
}

.ai-analysis-column .analysis-card h5 {
    margin-bottom: .15rem !important;
    color: var(--app-ink);
    font-size: 1.02rem;
    letter-spacing: 0;
}

.ai-analysis-column .analysis-card .row {
    display: grid;
    grid-template-columns: 1fr;
    gap: .75rem !important;
    margin: 0;
}

.ai-analysis-column .analysis-card .row > [class*="col-"] {
    width: 100%;
    max-width: 100%;
    padding: 0;
}

.ai-analysis-column .analysis-card .col-md-6,
.ai-analysis-column .analysis-card .col-12 {
    min-width: 0;
    padding: .78rem;
    border: 1px solid rgba(99, 198, 184, .18);
    border-radius: 10px;
    background:
        linear-gradient(135deg, rgba(99, 198, 184, .08), rgba(36, 87, 166, .04)),
        rgba(255, 255, 255, .78);
}

.ai-analysis-column .analysis-card .small,
.ai-analysis-column .analysis-card .small-muted,
.ai-analysis-column .analysis-card .text-muted {
    color: var(--app-muted) !important;
    line-height: 1.55;
}

.ai-analysis-column .analysis-card .fw-semibold {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--app-ink);
    line-height: 1.45;
}

.ai-analysis-column .analysis-card ul,
.ai-analysis-column .analysis-card ol {
    display: grid;
    gap: .5rem;
    margin: .55rem 0 0 !important;
    padding: 0 !important;
    list-style: none;
}

.ai-analysis-column .analysis-card li {
    position: relative;
    min-width: 0;
    padding: .62rem .7rem .62rem 2.05rem;
    border: 1px solid rgba(99, 198, 184, .16);
    border-radius: 10px;
    background: rgba(255, 255, 255, .72);
    color: var(--app-ink);
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.ai-analysis-column .analysis-card li::before {
    content: "";
    position: absolute;
    top: .92rem;
    left: .82rem;
    width: .5rem;
    height: .5rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #63c6b8, #8fb7ff);
    box-shadow: 0 0 0 4px rgba(99, 198, 184, .12);
}

.ai-analysis-column .analysis-card .badge {
    max-width: 100%;
    white-space: normal;
    text-align: left;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.ai-analysis-column .analysis-card .border.rounded-2.p-2.bg-white {
    display: grid;
    gap: .5rem;
    padding: .72rem !important;
    border-color: rgba(99, 198, 184, .18) !important;
    border-radius: 10px !important;
    background: rgba(255, 255, 255, .72) !important;
}

.ai-analysis-column .analysis-card .border.rounded-2.p-2.bg-white > div {
    min-width: 0;
    overflow-wrap: anywhere;
}

.ai-analysis-column .analysis-card .mt-1 {
    display: flex;
    flex-wrap: wrap;
    gap: .38rem;
    margin-top: .45rem !important;
}

.ai-analysis-column .analysis-card .border-top {
    margin-top: 0 !important;
    padding: .9rem .78rem 0 !important;
}

:root[data-theme="night"] .ai-chat-page {
    background:
        linear-gradient(135deg, rgba(99, 198, 184, .08), transparent 38%),
        linear-gradient(180deg, #0f1a20, #101b22);
}

:root[data-theme="night"] .ai-chat-room-pro,
:root[data-theme="night"] .ai-chat-room-pro .chat-room-header,
:root[data-theme="night"] .ai-room-metrics,
:root[data-theme="night"] .ai-prompt-strip,
:root[data-theme="night"] .ai-chat-room-pro .ai-chat-composer {
    background: rgba(19, 34, 40, .95);
}

:root[data-theme="night"] .ai-chat-room-pro .chat-room-header {
    background:
        linear-gradient(135deg, rgba(99, 198, 184, .13), rgba(99, 130, 198, .09)),
        rgba(19, 34, 40, .96);
}

:root[data-theme="night"] .ai-chat-room-pro .chat-room-header p {
    color: #aabdbd;
}

:root[data-theme="night"] .ai-room-metrics span,
:root[data-theme="night"] .ai-prompt-strip button,
:root[data-theme="night"] .ai-insight-grid div {
    border-color: var(--app-line);
    background: var(--app-surface-soft);
}

:root[data-theme="night"] .ai-prompt-strip button:hover {
    background: rgba(99, 198, 184, .11);
    color: var(--app-ink);
}

:root[data-theme="night"] .ai-chat-room-pro .ai-chat-window {
    background:
        linear-gradient(180deg, rgba(15, 26, 32, .96), rgba(18, 33, 40, .96)),
        linear-gradient(90deg, rgba(99, 198, 184, .05) 1px, transparent 1px),
        linear-gradient(0deg, rgba(99, 198, 184, .04) 1px, transparent 1px);
    background-size: auto, 36px 36px, 36px 36px;
}

:root[data-theme="night"] .ai-chat-room-pro .chat-message.ai {
    border-color: var(--app-line);
    background: rgba(23, 39, 45, .96);
}

:root[data-theme="night"] .ai-analysis-column .analysis-card .col-md-6,
:root[data-theme="night"] .ai-analysis-column .analysis-card .col-12,
:root[data-theme="night"] .ai-analysis-column .analysis-card li,
:root[data-theme="night"] .ai-analysis-column .analysis-card .border.rounded-2.p-2.bg-white {
    border-color: rgba(99, 198, 184, .22) !important;
    background:
        linear-gradient(135deg, rgba(99, 198, 184, .08), rgba(143, 183, 255, .04)),
        rgba(15, 26, 32, .62) !important;
}

@media (max-width: 1199.98px) {
    .ai-room-metrics,
    .ai-prompt-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 767.98px) {
    .ai-chat-room-pro .chat-room-header {
        min-height: auto;
    }

    .ai-room-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .ai-room-metrics,
    .ai-prompt-strip,
    .ai-insight-grid {
        grid-template-columns: 1fr;
    }
}

/* Floating AI counselor */
.ai-chat-page .ai-chat-room {
    position: relative;
}

.ai-counselor-widget {
    --counselor-x: 0px;
    --counselor-y: 0px;
    position: absolute;
    right: 1rem;
    bottom: 5.35rem;
    z-index: 8;
    width: min(138px, 22vw);
    transform: translate3d(var(--counselor-x), var(--counselor-y), 0);
    transition: width .22s ease, transform .18s ease;
}

.ai-counselor-card {
    position: relative;
    min-height: 164px;
    padding: .45rem;
    border: 1px solid rgba(99, 198, 184, .28);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .66), rgba(255, 255, 255, .86)),
        radial-gradient(circle at 50% 20%, rgba(99, 198, 184, .30), transparent 58%);
    box-shadow: 0 18px 44px rgba(11, 36, 45, .18);
    cursor: grab;
    user-select: none;
    backdrop-filter: blur(16px);
}

.ai-counselor-widget.is-dragging .ai-counselor-card {
    cursor: grabbing;
    box-shadow: 0 24px 58px rgba(11, 36, 45, .25);
}

.ai-counselor-toggle {
    position: absolute;
    top: .55rem;
    right: .55rem;
    z-index: 2;
    width: 32px;
    height: 32px;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(99, 198, 184, .32);
    border-radius: 8px;
    background: rgba(255, 255, 255, .82);
    color: var(--app-primary);
}

.ai-counselor-status {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .55rem;
    border-radius: 999px;
    background: rgba(20, 130, 98, .11);
    color: #136c58;
    font-size: .76rem;
    font-weight: 900;
}

.ai-counselor-status i {
    color: #1fc78f;
    font-size: .5rem;
    animation: aiCounselorPulse 1.8s ease-in-out infinite;
}

.ai-counselor-portrait {
    height: 154px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    margin: 0;
    pointer-events: none;
}

.ai-counselor-portrait img {
    width: auto;
    max-width: 100%;
    max-height: 164px;
    object-fit: contain;
    filter: drop-shadow(0 18px 22px rgba(4, 18, 25, .20));
    transform-origin: 50% 95%;
    animation: aiCounselorFloat 4.2s ease-in-out infinite;
}

.ai-counselor-bubble {
    position: relative;
    display: grid;
    gap: .15rem;
    padding: .68rem .72rem;
    border: 1px solid rgba(99, 198, 184, .22);
    border-radius: 8px;
    background: rgba(255, 255, 255, .9);
    color: #183a40;
    box-shadow: 0 10px 28px rgba(11, 36, 45, .11);
}

.ai-counselor-bubble::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 44px;
    width: 16px;
    height: 16px;
    border-left: 1px solid rgba(99, 198, 184, .22);
    border-top: 1px solid rgba(99, 198, 184, .22);
    background: rgba(255, 255, 255, .9);
    transform: rotate(45deg);
}

.ai-counselor-bubble strong,
.ai-counselor-bubble span {
    position: relative;
    z-index: 1;
    display: block;
}

.ai-counselor-bubble strong {
    font-size: .88rem;
    font-weight: 950;
}

.ai-counselor-bubble span {
    color: #5f7374;
    font-size: .76rem;
    line-height: 1.45;
}

.ai-counselor-widget.is-collapsed {
    width: 88px;
}

.ai-counselor-widget.is-collapsed .ai-counselor-card {
    min-height: 108px;
    padding: .45rem;
}

.ai-counselor-widget.is-collapsed .ai-counselor-status,
.ai-counselor-widget.is-collapsed .ai-counselor-bubble {
    display: none;
}

.ai-counselor-widget.is-collapsed .ai-counselor-portrait {
    height: 98px;
    margin: 0;
}

.ai-counselor-widget.is-collapsed .ai-counselor-portrait img {
    max-height: 112px;
}

.ai-counselor-widget.is-collapsed .ai-counselor-toggle i {
    transform: rotate(180deg);
}

@media (min-width: 768px) {
    .ai-chat-page .ai-chat-window {
        padding-right: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ai-counselor-status i,
    .ai-counselor-portrait img,
    .ai-sidebar-counselor-figure,
    .ai-sidebar-counselor-figure img {
        animation: none;
    }
}

@keyframes aiSidebarCounselorWiggle {
    0%,
    100% {
        transform: rotate(0deg);
    }

    15% {
        transform: rotate(-2deg);
    }

    28% {
        transform: rotate(2deg);
    }

    42% {
        transform: rotate(-1deg);
    }

    56% {
        transform: rotate(1deg);
    }

    70% {
        transform: rotate(0deg);
    }
}

@keyframes aiSidebarCounselorOpenEyes {
    0%,
    88%,
    95%,
    100% {
        opacity: 1;
    }

    90%,
    93% {
        opacity: 0;
    }
}

@keyframes aiSidebarCounselorCloseEyes {
    0%,
    88%,
    95%,
    100% {
        opacity: 0;
    }

    90%,
    93% {
        opacity: 1;
    }
}

@keyframes aiCounselorFloat {
    0%,
    100% {
        transform: translateY(0) rotate(-1deg);
    }

    50% {
        transform: translateY(-8px) rotate(1deg);
    }
}

@keyframes aiCounselorPulse {
    0%,
    100% {
        opacity: .45;
        transform: scale(.85);
    }

    50% {
        opacity: 1;
        transform: scale(1.18);
    }
}

:root[data-theme="night"] .ai-counselor-card {
    border-color: rgba(99, 198, 184, .26);
    background:
        linear-gradient(180deg, rgba(18, 34, 40, .78), rgba(13, 26, 32, .92)),
        radial-gradient(circle at 50% 20%, rgba(99, 198, 184, .18), transparent 60%);
    box-shadow: 0 22px 58px rgba(0, 0, 0, .34);
}

:root[data-theme="night"] .ai-counselor-toggle,
:root[data-theme="night"] .ai-counselor-bubble {
    border-color: rgba(99, 198, 184, .22);
    background: rgba(18, 34, 40, .88);
    color: #e9f7f4;
}

:root[data-theme="night"] .ai-counselor-bubble::before {
    border-color: rgba(99, 198, 184, .22);
    background: rgba(18, 34, 40, .88);
}

:root[data-theme="night"] .ai-counselor-bubble span {
    color: #b8cac8;
}

:root[data-theme="night"] .ai-counselor-status {
    background: rgba(99, 198, 184, .14);
    color: #bff3eb;
}

@media (max-width: 767.98px) {
    .ai-counselor-widget {
        right: .65rem;
        bottom: 5.15rem;
        width: 86px;
    }

    .ai-counselor-card {
        min-height: 104px;
        padding: .35rem;
    }

    .ai-counselor-status,
    .ai-counselor-bubble {
        display: none;
    }

    .ai-counselor-portrait {
        height: 94px;
        margin: 0;
    }

    .ai-counselor-portrait img {
        max-height: 102px;
    }
}

/* Availability, booking wizard, and public lawyer profile */
.availability-hero,
.booking-wizard-hero,
.lawyer-public-hero {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 1.25rem;
    padding: 1.5rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface);
    box-shadow: var(--app-shadow-sm);
}

.availability-hero h1,
.booking-wizard-hero h1,
.lawyer-public-hero h1 {
    margin: .35rem 0 .45rem;
    color: var(--app-ink);
    font-size: clamp(1.45rem, 2.2vw, 2.15rem);
    font-weight: 800;
    letter-spacing: 0;
}

.availability-hero p,
.booking-wizard-hero p,
.lawyer-public-hero p {
    margin: 0;
    color: var(--app-muted);
    line-height: 1.7;
}

.availability-hero-stats,
.booking-stepper,
.lawyer-public-actions {
    min-width: 260px;
    display: grid;
    gap: .75rem;
}

.availability-hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.availability-hero-stats > div,
.booking-field-panel,
.lawyer-fee-card,
.public-slot-list > div,
.lawyer-review-list article,
.lawyer-next-slot {
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface-soft);
}

.availability-hero-stats > div {
    padding: 1rem;
}

.availability-hero-stats span,
.lawyer-fee-card span,
.lawyer-next-slot span {
    display: block;
    color: var(--app-muted);
    font-size: .86rem;
}

.availability-hero-stats strong,
.lawyer-fee-card strong {
    display: block;
    margin-top: .25rem;
    color: var(--app-ink);
    font-size: 1.65rem;
    font-weight: 800;
}

.availability-form-card,
.availability-list-card,
.booking-wizard-card,
.lawyer-public-card,
.lawyer-search-card {
    box-shadow: var(--app-shadow-sm);
}

.availability-slot-list {
    display: grid;
    gap: .75rem;
    max-height: 640px;
    overflow: auto;
    padding-right: .25rem;
}

.availability-slot {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: .9rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface);
}

.availability-slot.is-booked {
    background: rgba(36, 87, 166, .06);
}

.availability-slot-date strong,
.availability-slot-date span,
.availability-slot .availability-type,
.availability-slot .availability-status {
    display: block;
}

.availability-slot-date span,
.availability-slot .availability-type {
    color: var(--app-muted);
    font-size: .88rem;
}

.availability-slot .availability-status {
    color: var(--app-teal);
    font-weight: 700;
}

.availability-slot.is-booked .availability-status {
    color: var(--app-primary);
}

.empty-state.soft {
    padding: 2rem;
    border: 1px dashed var(--app-line);
    border-radius: 8px;
    background: var(--app-surface-soft);
}

.booking-stepper {
    align-content: center;
}

.booking-stepper span {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .65rem .75rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    color: var(--app-muted);
    background: var(--app-surface-soft);
    font-weight: 700;
}

.booking-stepper span.active {
    border-color: rgba(29, 127, 114, .35);
    color: var(--app-teal);
    background: var(--app-teal-soft);
}

.booking-field-panel {
    height: 100%;
    padding: 1rem;
}

.booking-field-panel .form-label {
    display: block;
    margin-top: .3rem;
    color: var(--app-ink);
    font-weight: 800;
}

.booking-field-panel small {
    display: block;
    margin-top: .5rem;
    color: var(--app-muted);
    line-height: 1.55;
}

.booking-panel-index {
    display: inline-flex;
    width: 2.1rem;
    height: 2.1rem;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #eaf1ff;
    color: var(--app-primary);
    font-weight: 800;
    font-size: .8rem;
}

.booking-slot-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.booking-price-pill {
    flex: 0 0 auto;
    padding: .45rem .65rem;
    border-radius: 8px;
    background: #fff6e9;
    color: var(--app-amber);
    font-weight: 800;
}

.booking-slot-picker {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
    margin-top: 1rem;
}

.booking-slot-button {
    min-height: 92px;
    padding: .85rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface);
    color: var(--app-ink);
    text-align: left;
}

.booking-slot-button:hover,
.booking-slot-button.is-selected {
    border-color: rgba(29, 127, 114, .48);
    background: var(--app-teal-soft);
}

.booking-slot-button strong,
.booking-slot-button span,
.booking-slot-button em {
    display: block;
}

.booking-slot-button span {
    color: var(--app-primary);
    font-weight: 800;
}

.booking-slot-button em {
    margin-top: .2rem;
    color: var(--app-muted);
    font-style: normal;
    font-size: .82rem;
}

.booking-slot-empty {
    padding: 1rem;
    border: 1px dashed var(--app-line);
    border-radius: 8px;
    color: var(--app-muted);
    background: var(--app-surface);
}

.booking-submit-btn {
    min-width: 240px;
}

.lawyer-public-hero {
    align-items: flex-start;
}

.lawyer-public-profile {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.lawyer-public-avatar {
    width: 116px;
    height: 116px;
    flex: 0 0 auto;
    border-radius: 8px;
}

.lawyer-trust-row {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin-top: .9rem;
}

.lawyer-trust-row span,
.lawyer-rating-badge,
.lawyer-category-cloud span {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .45rem .65rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface-soft);
    color: var(--app-ink);
    font-weight: 700;
}

.lawyer-trust-row i,
.lawyer-rating-badge i {
    color: var(--app-amber);
}

.lawyer-public-actions {
    width: min(100%, 300px);
}

.lawyer-fee-card {
    padding: 1rem;
}

.lawyer-fee-card small {
    display: block;
    margin-top: .25rem;
    color: var(--app-teal);
    font-weight: 700;
}

.lawyer-public-card h2 {
    margin-bottom: .35rem;
    font-size: 1.2rem;
    font-weight: 800;
}

.lawyer-bio {
    color: var(--app-muted);
    line-height: 1.8;
}

.lawyer-category-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.lawyer-card-icon {
    display: inline-flex;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #eaf1ff;
    color: var(--app-primary);
}

.public-slot-list,
.lawyer-review-list {
    display: grid;
    gap: .75rem;
}

.public-slot-list > div {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: .75rem;
    padding: .85rem;
}

.public-slot-list span,
.public-slot-list em {
    color: var(--app-muted);
    font-style: normal;
    font-size: .9rem;
}

.public-slot-empty {
    padding: 1rem;
    border: 1px dashed var(--app-line);
    border-radius: 8px;
    color: var(--app-muted);
    background: var(--app-surface-soft);
}

.lawyer-review-list article {
    padding: 1rem;
}

.lawyer-review-list article > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.lawyer-review-list p {
    margin: .5rem 0 0;
    color: var(--app-muted);
    line-height: 1.65;
}

.lawyer-next-slot {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .7rem;
}

.lawyer-next-slot i {
    color: var(--app-primary);
}

:root[data-theme="night"] .availability-hero,
:root[data-theme="night"] .booking-wizard-hero,
:root[data-theme="night"] .lawyer-public-hero,
:root[data-theme="night"] .availability-hero-stats > div,
:root[data-theme="night"] .booking-field-panel,
:root[data-theme="night"] .lawyer-fee-card,
:root[data-theme="night"] .public-slot-list > div,
:root[data-theme="night"] .lawyer-review-list article,
:root[data-theme="night"] .lawyer-next-slot,
:root[data-theme="night"] .availability-slot,
:root[data-theme="night"] .booking-slot-button,
:root[data-theme="night"] .booking-slot-empty,
:root[data-theme="night"] .public-slot-empty,
:root[data-theme="night"] .empty-state.soft {
    border-color: var(--app-line);
    background: var(--app-surface);
}

:root[data-theme="night"] .booking-stepper span,
:root[data-theme="night"] .lawyer-trust-row span,
:root[data-theme="night"] .lawyer-rating-badge,
:root[data-theme="night"] .lawyer-category-cloud span {
    border-color: var(--app-line);
    background: var(--app-surface-soft);
    color: var(--app-ink);
}

:root[data-theme="night"] .booking-stepper span.active,
:root[data-theme="night"] .booking-slot-button:hover,
:root[data-theme="night"] .booking-slot-button.is-selected {
    border-color: rgba(114, 214, 200, .36);
    background: rgba(114, 214, 200, .11);
}

:root[data-theme="night"] .booking-price-pill {
    background: rgba(226, 173, 106, .14);
    color: #ffe2b6;
}

:root[data-theme="night"] .booking-panel-index,
:root[data-theme="night"] .lawyer-card-icon {
    background: rgba(144, 184, 237, .14);
    color: #d8e8ff;
}

@media (max-width: 991.98px) {
    .availability-hero,
    .booking-wizard-hero,
    .lawyer-public-hero,
    .lawyer-public-profile,
    .booking-slot-head {
        display: grid;
    }

    .availability-hero-stats,
    .booking-stepper,
    .lawyer-public-actions {
        width: 100%;
        min-width: 0;
    }

    .booking-slot-picker {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .availability-slot,
    .public-slot-list > div {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .availability-hero,
    .booking-wizard-hero,
    .lawyer-public-hero,
    .booking-wizard-card {
        padding: 1rem;
    }

    .availability-hero-stats,
    .booking-slot-picker {
        grid-template-columns: 1fr;
    }

    .lawyer-public-avatar {
        width: 92px;
        height: 92px;
    }

    .booking-submit-btn {
        width: 100%;
        min-width: 0;
    }
}

.trust-list,
.expertise-list,
.lawyer-report-list {
    display: grid;
    gap: .85rem;
}

.trust-list > div,
.expertise-list > div,
.lawyer-report-grid > div,
.payment-review-grid > div {
    padding: .85rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface-soft);
}

.trust-list span,
.expertise-list span,
.lawyer-report-grid span,
.payment-review-grid span {
    display: block;
    color: var(--app-muted);
    font-size: .85rem;
}

.trust-list strong,
.expertise-list strong,
.lawyer-report-grid strong,
.payment-review-grid strong {
    display: block;
    margin-top: .2rem;
    color: var(--app-ink);
    font-weight: 800;
    overflow-wrap: anywhere;
}

.trust-metric-grid,
.lawyer-report-grid,
.payment-review-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.trust-metric-grid > div {
    min-height: 92px;
    display: grid;
    align-content: center;
    gap: .2rem;
    padding: .9rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface-soft);
}

.trust-metric-grid strong {
    color: var(--app-primary);
    font-size: 1.55rem;
    font-weight: 900;
}

.trust-metric-grid span {
    color: var(--app-muted);
    font-size: .86rem;
}

.report-card {
    display: grid;
    gap: 1rem;
}

.lawyer-report-form,
.lawyer-report-action {
    display: grid;
    grid-template-columns: minmax(180px, 260px) 1fr auto;
    gap: .75rem;
    align-items: start;
}

.lawyer-report-card {
    padding: 1rem;
}

.lawyer-report-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.lawyer-report-head h2 {
    margin: .55rem 0 .2rem;
    font-size: 1.18rem;
    font-weight: 800;
}

.lawyer-report-head p,
.lawyer-report-grid small {
    margin: 0;
    color: var(--app-muted);
}

.payment-checkout-wizard {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
    margin-bottom: 1.25rem;
}

.payment-checkout-step {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    padding: .85rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface-soft);
}

.payment-checkout-step > span {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #eaf1ff;
    color: var(--app-primary);
}

.payment-checkout-step strong,
.payment-checkout-step small {
    display: block;
}

.payment-checkout-step small {
    color: var(--app-muted);
    line-height: 1.45;
}

.payment-checkout-step.is-done {
    border-color: rgba(29, 127, 114, .24);
    background: rgba(29, 127, 114, .08);
}

.payment-checkout-step.is-active {
    border-color: rgba(36, 87, 166, .34);
    background: rgba(36, 87, 166, .08);
}

.payment-checkout-step.is-danger {
    border-color: rgba(194, 52, 52, .28);
    background: rgba(194, 52, 52, .07);
}

.payment-review-grid {
    margin: 1rem 0;
}

.admin-daily-chart {
    min-height: 230px;
    display: grid;
    grid-template-columns: repeat(14, minmax(0, 1fr));
    gap: .65rem;
    align-items: end;
    padding: 1rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface-soft);
}

.admin-daily-bar {
    min-width: 0;
    display: grid;
    gap: .5rem;
    justify-items: center;
}

.admin-daily-bars {
    width: 100%;
    height: 170px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
}

.admin-daily-bars span {
    width: 12px;
    min-height: 8px;
    border-radius: 8px 8px 2px 2px;
}

.admin-daily-bars .is-booking,
.admin-chart-legend .is-booking {
    background: var(--app-primary);
}

.admin-daily-bars .is-revenue,
.admin-chart-legend .is-revenue {
    background: var(--app-teal);
}

.admin-daily-bar small {
    color: var(--app-muted);
    font-size: .76rem;
    white-space: nowrap;
}

.admin-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: .9rem;
    color: var(--app-muted);
}

.admin-chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}

.admin-chart-legend i {
    width: 12px;
    height: 12px;
    display: inline-block;
    border-radius: 3px;
}

:root[data-theme="night"] .trust-list > div,
:root[data-theme="night"] .expertise-list > div,
:root[data-theme="night"] .lawyer-report-grid > div,
:root[data-theme="night"] .payment-review-grid > div,
:root[data-theme="night"] .trust-metric-grid > div,
:root[data-theme="night"] .payment-checkout-step,
:root[data-theme="night"] .admin-daily-chart {
    border-color: var(--app-line);
    background: var(--app-surface-soft);
}

:root[data-theme="night"] .payment-checkout-step > span {
    background: rgba(144, 184, 237, .14);
    color: #d8e8ff;
}

:root[data-theme="night"] .payment-checkout-step.is-done {
    border-color: rgba(114, 214, 200, .28);
    background: rgba(114, 214, 200, .09);
}

:root[data-theme="night"] .payment-checkout-step.is-active {
    border-color: rgba(144, 184, 237, .32);
    background: rgba(144, 184, 237, .10);
}

:root[data-theme="night"] .payment-checkout-step.is-danger {
    border-color: rgba(255, 132, 132, .28);
    background: rgba(255, 132, 132, .08);
}

@media (max-width: 991.98px) {
    .payment-checkout-wizard,
    .admin-daily-chart {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .lawyer-report-form,
    .lawyer-report-action {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .trust-metric-grid,
    .lawyer-report-grid,
    .payment-review-grid,
    .payment-checkout-wizard,
    .admin-daily-chart {
        grid-template-columns: 1fr;
    }

    .admin-daily-bars {
        height: 90px;
    }
}

.ai-knowledge-page .knowledge-hero {
    display: flex;
    justify-content: space-between;
    gap: 1.25rem;
    align-items: stretch;
    overflow: hidden;
}

.knowledge-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(90px, 1fr));
    gap: .75rem;
    min-width: 320px;
}

.knowledge-stats-grid > div {
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface-soft);
    padding: .9rem;
}

.knowledge-stats-grid span {
    display: block;
    color: var(--app-muted);
    font-size: .82rem;
}

.knowledge-stats-grid strong {
    display: block;
    margin-top: .35rem;
    font-size: 1.55rem;
    line-height: 1;
}

.knowledge-document-list {
    display: grid;
    gap: .85rem;
    max-height: 720px;
    overflow: auto;
    padding-right: .2rem;
}

.knowledge-source-preset-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .9rem;
}

.knowledge-source-preset {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface-soft);
    padding: 1rem;
}

.knowledge-source-preset-head {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: .75rem;
    align-items: start;
}

.knowledge-source-preset-head > span {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: var(--app-primary);
    background: rgba(37, 99, 235, .12);
    font-size: 1.2rem;
}

.knowledge-source-preset h3 {
    margin: 0;
    color: var(--app-ink);
    font-size: 1rem;
    font-weight: 900;
    line-height: 1.35;
}

.knowledge-source-preset p {
    margin: .25rem 0 0;
    overflow-wrap: anywhere;
}

.knowledge-document-item {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: start;
    gap: .9rem;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface-soft);
    padding: .95rem;
}

.knowledge-document-item.is-archived {
    opacity: .68;
}

.knowledge-document-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: var(--app-teal);
    background: rgba(20, 184, 166, .12);
    font-size: 1.25rem;
}

.ai-knowledge-source-list {
    display: grid;
    gap: .55rem;
}

.ai-knowledge-source-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: .65rem;
    align-items: start;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface-soft);
    padding: .7rem;
}

.ai-knowledge-source-item > span {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(37, 99, 235, .12);
    color: var(--app-primary);
    font-weight: 800;
    font-size: .8rem;
}

:root[data-theme="night"] .knowledge-stats-grid > div,
:root[data-theme="night"] .knowledge-document-item,
:root[data-theme="night"] .knowledge-source-preset,
:root[data-theme="night"] .ai-knowledge-source-item {
    border-color: var(--app-line);
    background: var(--app-surface-soft);
}

@media (max-width: 1199.98px) {
    .ai-knowledge-page .knowledge-hero,
    .knowledge-document-item {
        grid-template-columns: 1fr;
    }

    .ai-knowledge-page .knowledge-hero {
        display: grid;
    }

    .knowledge-stats-grid {
        min-width: 0;
    }

    .knowledge-source-preset-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .knowledge-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Premium motion system */
html {
    scroll-behavior: smooth;
}

html,
body,
.navbar,
.site-footer,
.app-card,
.stat-card,
.admin-stat-card,
.payment-panel,
.btn,
.form-control,
.form-select,
.chat-message,
.app-sidebar .list-group-item,
.admin-nav .list-group-item {
    transition:
        background-color .34s ease,
        color .34s ease,
        border-color .34s ease,
        box-shadow .34s ease,
        transform .22s ease;
}

body.motion-ready {
    position: relative;
    overflow-x: hidden;
}

body.motion-ready > main,
body.motion-ready > nav,
body.motion-ready > footer,
body.motion-ready > .container {
    position: relative;
    z-index: 1;
}

.legal-aura {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    opacity: .86;
}

.legal-aura::before,
.legal-aura::after {
    content: "";
    position: absolute;
    inset: -22%;
    background:
        linear-gradient(115deg, transparent 0 42%, rgba(37, 99, 235, .08) 42.3% 42.8%, transparent 43.1% 100%),
        linear-gradient(64deg, transparent 0 54%, rgba(20, 184, 166, .09) 54.2% 54.7%, transparent 55% 100%);
    background-size: 240px 240px, 320px 320px;
    animation: legalAuraLines 28s linear infinite;
}

.legal-aura::after {
    background:
        radial-gradient(circle at 18% 22%, rgba(20, 184, 166, .14), transparent 28%),
        radial-gradient(circle at 78% 18%, rgba(37, 99, 235, .12), transparent 32%),
        radial-gradient(circle at 52% 88%, rgba(194, 122, 26, .10), transparent 28%);
    animation: legalAuraGlow 16s ease-in-out infinite alternate;
}

.legal-aura-icon {
    position: absolute;
    left: var(--aura-left);
    top: var(--aura-top);
    width: var(--aura-size);
    height: var(--aura-size);
    display: grid;
    place-items: center;
    color: rgba(37, 99, 235, .14);
    font-size: var(--aura-size);
    line-height: 1;
    filter: drop-shadow(0 18px 28px rgba(20, 184, 166, .12));
    animation: legalAuraIconFloat 18s ease-in-out infinite;
    animation-delay: var(--aura-delay);
}

.motion-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1085;
    width: 100%;
    height: 3px;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(99, 198, 184, .95), rgba(96, 165, 250, .95), rgba(245, 158, 11, .82));
    transform: scaleX(var(--motion-scroll-progress, 0));
    transform-origin: left center;
    box-shadow:
        0 0 16px rgba(99, 198, 184, .38),
        0 0 28px rgba(96, 165, 250, .18);
    transition: transform .12s linear;
}

.motion-cursor-aura {
    position: fixed;
    z-index: 0;
    left: var(--cursor-x, 50vw);
    top: var(--cursor-y, 50vh);
    width: 320px;
    height: 320px;
    border-radius: 999px;
    pointer-events: none;
    opacity: 0;
    background:
        radial-gradient(circle, rgba(99, 198, 184, .16), rgba(96, 165, 250, .08) 34%, transparent 68%);
    filter: blur(4px);
    transform: translate(-50%, -50%) scale(.82);
    transition:
        opacity .24s ease,
        transform .24s ease;
}

.motion-cursor-aura.is-active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

:root[data-theme="night"] .legal-aura {
    opacity: 1;
}

:root[data-theme="night"] .legal-aura::before {
    background:
        linear-gradient(115deg, transparent 0 42%, rgba(99, 198, 184, .11) 42.3% 42.8%, transparent 43.1% 100%),
        linear-gradient(64deg, transparent 0 54%, rgba(96, 165, 250, .10) 54.2% 54.7%, transparent 55% 100%);
    background-size: 260px 260px, 340px 340px;
}

:root[data-theme="night"] .legal-aura-icon {
    color: rgba(99, 198, 184, .16);
}

body.motion-page-ready main {
    animation: motionPageReveal .72s cubic-bezier(.2, .8, .2, 1) both;
}

.motion-reveal {
    opacity: 0;
    transform: translateY(22px) scale(.985);
    filter: blur(6px);
}

.motion-reveal.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
    transition:
        opacity .64s ease var(--motion-delay, 0ms),
        transform .64s cubic-bezier(.2, .8, .2, 1) var(--motion-delay, 0ms),
        filter .64s ease var(--motion-delay, 0ms),
        background-color .34s ease,
        border-color .34s ease,
        box-shadow .34s ease;
}

.motion-premium-card {
    position: relative;
    overflow: hidden;
    --motion-card-tilt-x: 0deg;
    --motion-card-tilt-y: 0deg;
    --motion-card-glow-x: 50%;
    --motion-card-glow-y: 50%;
    will-change: transform, box-shadow;
}

.motion-premium-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .18), transparent 28%),
        linear-gradient(115deg, transparent 0 64%, rgba(99, 198, 184, .14) 70%, transparent 78%);
    opacity: 0;
    transform: translateX(-18%);
    transition: opacity .28s ease, transform .45s ease, background .28s ease;
    pointer-events: none;
}

.motion-premium-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 22px 54px rgba(15, 40, 58, .14);
}

.motion-premium-card:hover::after {
    opacity: 1;
    transform: translateX(0);
}

.motion-premium-card.is-tilting {
    transform:
        perspective(900px)
        rotateX(var(--motion-card-tilt-x))
        rotateY(var(--motion-card-tilt-y))
        translateY(-5px);
}

.motion-premium-card.is-tilting::after {
    opacity: 1;
    background:
        radial-gradient(circle at var(--motion-card-glow-x) var(--motion-card-glow-y), rgba(255, 255, 255, .24), transparent 34%),
        linear-gradient(115deg, transparent 0 62%, rgba(99, 198, 184, .16) 70%, transparent 80%);
}

.lawyer-match-card.motion-premium-card:hover,
.lawyer-card.motion-premium-card:hover,
.public-lawyer-card.motion-premium-card:hover,
.lawyer-showcase-card.motion-premium-card:hover {
    border-color: rgba(20, 184, 166, .42);
    box-shadow:
        0 22px 54px rgba(15, 40, 58, .16),
        0 0 0 1px rgba(20, 184, 166, .12);
}

.motion-magnetic {
    position: relative;
    overflow: hidden;
    transform: translate3d(var(--magnet-x, 0), var(--magnet-y, 0), 0);
    will-change: transform;
}

.btn,
.theme-toggle,
.case-delete-button,
.ai-attach-button {
    position: relative;
    overflow: hidden;
}

.motion-magnetic::after {
    content: "";
    position: absolute;
    top: -120%;
    bottom: -120%;
    left: -34%;
    width: 30%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .42), transparent);
    transform: translateX(-140%) rotate(18deg);
    transition: transform .6s ease;
    pointer-events: none;
}

.motion-magnetic:hover::after,
.motion-magnetic:focus-visible::after {
    transform: translateX(520%) rotate(18deg);
}

.motion-ripple {
    position: absolute;
    left: var(--ripple-x);
    top: var(--ripple-y);
    z-index: 0;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    pointer-events: none;
    background: rgba(255, 255, 255, .46);
    transform: translate(-50%, -50%) scale(0);
    animation: motionRipple .62s ease-out both;
}

.motion-magnetic > *,
.btn > *,
.theme-toggle > *,
.case-delete-button > *,
.ai-attach-button > * {
    position: relative;
    z-index: 1;
}

body.motion-route-leave main {
    animation: motionRouteLeave .22s ease both;
}

.ai-chat-row.motion-chat-row {
    animation: chatBubbleEnter .34s cubic-bezier(.2, .8, .2, 1) both;
    animation-delay: var(--motion-delay, 0ms);
}

.ai-chat-row.motion-chat-row.is-new .chat-message {
    animation: chatBubbleGlow .72s ease both;
}

.typing-message {
    position: relative;
    overflow: hidden;
}

.typing-message::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(99, 198, 184, .16), transparent);
    transform: translateX(-120%);
    animation: typingSoftScan 1.4s ease-in-out infinite;
    pointer-events: none;
}

.motion-panel-pop {
    animation: motionPanelPop .45s cubic-bezier(.2, .8, .2, 1) both;
}

body.ai-counselor-nudge .ai-sidebar-counselor {
    box-shadow:
        0 18px 40px rgba(8, 27, 34, .16),
        0 0 0 1px rgba(99, 198, 184, .22),
        0 0 32px rgba(99, 198, 184, .18);
}

body.ai-counselor-nudge .ai-sidebar-counselor-figure {
    animation: aiSidebarCounselorNudge .78s cubic-bezier(.2, .8, .2, 1) both;
}

body.ai-thinking .ai-chat-room-pro .chat-room-header,
body.ai-thinking .ai-chat-room .chat-room-header {
    box-shadow:
        inset 0 -1px 0 rgba(99, 198, 184, .22),
        0 18px 44px rgba(99, 198, 184, .10);
}

body.ai-thinking .ai-ready-pill {
    animation: aiReadyPulse 1.08s ease-in-out infinite;
}

.payment-result-pop {
    animation: paymentResultPop .54s cubic-bezier(.2, .8, .2, 1) both;
}

.payment-success-motion {
    position: relative;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: .85rem;
    align-items: center;
    border: 1px solid rgba(25, 135, 84, .28);
    border-radius: 8px;
    background:
        radial-gradient(circle at 12% 50%, rgba(25, 135, 84, .16), transparent 32%),
        rgba(25, 135, 84, .08);
    color: #14532d;
    padding: .95rem;
}

.payment-success-ring {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, #16a34a, #0f766e);
    box-shadow: 0 0 0 0 rgba(25, 135, 84, .28);
    animation: paymentSuccessPulse 1.25s ease-out infinite;
}

.payment-success-ring i {
    animation: paymentSuccessCheck .46s cubic-bezier(.2, .8, .2, 1) both;
}

.chat-emoji-trigger.is-open,
.chat-emoji-trigger:focus-visible {
    color: #0f766e;
    border-color: rgba(99, 198, 184, .58);
    box-shadow: 0 0 0 4px rgba(99, 198, 184, .12);
}

.chat-emoji-panel {
    position: absolute;
    right: .85rem;
    bottom: calc(100% + .65rem);
    z-index: 45;
    width: min(380px, calc(100vw - 2rem));
    overflow: hidden;
    border: 1px solid rgba(99, 198, 184, .32);
    border-radius: 14px;
    background:
        radial-gradient(circle at 16% 0%, rgba(99, 198, 184, .18), transparent 38%),
        rgba(255, 255, 255, .98);
    box-shadow: 0 22px 56px rgba(20, 31, 52, .18);
    backdrop-filter: blur(18px);
    transform-origin: right bottom;
    animation: chatEmojiPanelIn .18s ease-out both;
}

.chat-emoji-panel[hidden] {
    display: none;
}

.chat-emoji-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .35rem;
    padding: .6rem;
    border-bottom: 1px solid rgba(214, 222, 235, .78);
}

.chat-emoji-tabs button,
.chat-emoji-grid button,
.chat-sticker-grid button {
    border: 0;
    cursor: pointer;
}

.chat-emoji-tabs button {
    min-height: 38px;
    border-radius: 10px;
    background: transparent;
    color: #64748b;
    font-weight: 800;
}

.chat-emoji-tabs button.active {
    color: #0f766e;
    background: rgba(99, 198, 184, .15);
}

.chat-emoji-section {
    display: none;
    max-height: 360px;
    overflow-y: auto;
    padding: .75rem;
}

.chat-emoji-section.is-active {
    display: block;
}

.chat-emoji-group + .chat-emoji-group {
    margin-top: .85rem;
}

.chat-emoji-group strong {
    display: block;
    margin-bottom: .45rem;
    color: var(--app-ink);
    font-size: .86rem;
}

.chat-emoji-grid,
.chat-sticker-grid {
    display: grid;
    gap: .45rem;
}

.chat-emoji-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
}

.chat-emoji-grid button {
    width: 100%;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(241, 245, 249, .88);
    font-size: 1.22rem;
    transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
}

.chat-sticker-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.chat-sticker-pack + .chat-sticker-pack {
    margin-top: .9rem;
}

.chat-sticker-pack-title {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: .55rem;
    color: var(--app-ink);
    font-size: .86rem;
    font-weight: 950;
}

.chat-sticker-grid button {
    position: relative;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    padding: .35rem;
    border-radius: 14px;
    background: rgba(241, 245, 249, .78);
    transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
}

.chat-sticker-grid img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 8px 14px rgba(20, 31, 52, .12));
}

.chat-emoji-grid button:hover,
.chat-sticker-grid button:hover {
    transform: translateY(-2px) scale(1.03);
    background: rgba(99, 198, 184, .18);
    box-shadow: 0 12px 24px rgba(20, 31, 52, .13);
}

.chat-sticker-message {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.chat-sticker-message img {
    width: clamp(96px, 15vw, 148px);
    height: clamp(96px, 15vw, 148px);
    object-fit: contain;
    filter: drop-shadow(0 14px 20px rgba(20, 31, 52, .18));
    animation: chatStickerPop .24s cubic-bezier(.2, .9, .2, 1) both;
}

.chat-sticker-message.is-motion img {
    width: clamp(108px, 16vw, 160px);
    height: clamp(108px, 16vw, 160px);
    animation-name: chatStickerPop, var(--sticker-motion-name, motionStickerFloat);
    animation-duration: .24s, var(--sticker-motion-duration, 1.4s);
    animation-timing-function: cubic-bezier(.2, .9, .2, 1), var(--sticker-motion-ease, ease-in-out);
    animation-delay: 0s, .24s;
    animation-iteration-count: 1, infinite;
    animation-fill-mode: both, both;
    transform-origin: var(--sticker-motion-origin, 50% 82%);
    will-change: transform, filter;
}

.chat-sticker-grid button.is-motion img {
    animation-name: var(--sticker-motion-name, motionStickerFloat);
    animation-duration: var(--sticker-motion-duration, 1.4s);
    animation-timing-function: var(--sticker-motion-ease, ease-in-out);
    animation-iteration-count: infinite;
    animation-fill-mode: both;
    transform-origin: var(--sticker-motion-origin, 50% 82%);
    will-change: transform, filter;
}

.sticker-motion-cat-01 {
    --sticker-motion-name: motionStickerBounce;
    --sticker-motion-duration: 1.05s;
    --sticker-motion-ease: cubic-bezier(.42, 0, .18, 1);
}

.sticker-motion-cat-02 {
    --sticker-motion-name: motionStickerWiggle;
    --sticker-motion-duration: 1.18s;
}

.sticker-motion-cat-03 {
    --sticker-motion-name: motionStickerFloat;
    --sticker-motion-duration: 1.55s;
}

.sticker-motion-cat-04 {
    --sticker-motion-name: motionStickerSquish;
    --sticker-motion-duration: 1.2s;
}

.sticker-motion-cat-05 {
    --sticker-motion-name: motionStickerHeartbeat;
    --sticker-motion-duration: 1.08s;
}

.sticker-motion-cat-06 {
    --sticker-motion-name: motionStickerSleep;
    --sticker-motion-duration: 1.75s;
}

.sticker-motion-cat-07 {
    --sticker-motion-name: motionStickerShake;
    --sticker-motion-duration: .72s;
}

.sticker-motion-cat-08 {
    --sticker-motion-name: motionStickerPeek;
    --sticker-motion-duration: 1.28s;
}

.sticker-motion-cat-09 {
    --sticker-motion-name: motionStickerVibrate;
    --sticker-motion-duration: .62s;
}

.sticker-motion-dive-01 {
    --sticker-motion-name: motionStickerSwim;
    --sticker-motion-duration: 1.25s;
}

.sticker-motion-dive-02 {
    --sticker-motion-name: motionStickerBubbleBob;
    --sticker-motion-duration: 1.45s;
}

.sticker-motion-dive-03 {
    --sticker-motion-name: motionStickerDash;
    --sticker-motion-duration: .95s;
}

.sticker-motion-dive-04 {
    --sticker-motion-name: motionStickerRoll;
    --sticker-motion-duration: 1.25s;
}

.sticker-motion-dive-05 {
    --sticker-motion-name: motionStickerWave;
    --sticker-motion-duration: 1.2s;
    --sticker-motion-origin: 56% 72%;
}

.sticker-motion-dive-06 {
    --sticker-motion-name: motionStickerDrift;
    --sticker-motion-duration: 1.65s;
}

.sticker-motion-dive-07 {
    --sticker-motion-name: motionStickerDive;
    --sticker-motion-duration: 1.12s;
}

.sticker-motion-dive-08 {
    --sticker-motion-name: motionStickerPopPulse;
    --sticker-motion-duration: 1.1s;
}

.sticker-motion-dive-09 {
    --sticker-motion-name: motionStickerLoveSway;
    --sticker-motion-duration: 1.35s;
}

.conversation-bubble:has(.chat-sticker-message),
.chat-message:has(.chat-sticker-message) {
    padding: .15rem;
    border: 0;
    background: transparent !important;
    box-shadow: none;
}

:root[data-theme="night"] .chat-emoji-panel {
    border-color: rgba(99, 198, 184, .28);
    background:
        radial-gradient(circle at 16% 0%, rgba(99, 198, 184, .18), transparent 38%),
        rgba(18, 33, 40, .98);
    box-shadow: 0 22px 56px rgba(0, 0, 0, .35);
}

:root[data-theme="night"] .chat-emoji-tabs {
    border-bottom-color: rgba(125, 146, 170, .18);
}

:root[data-theme="night"] .chat-emoji-tabs button,
:root[data-theme="night"] .chat-emoji-group strong,
:root[data-theme="night"] .chat-sticker-pack-title {
    color: #c8d7e1;
}

:root[data-theme="night"] .chat-emoji-tabs button.active {
    color: #8af2df;
    background: rgba(99, 198, 184, .16);
}

:root[data-theme="night"] .chat-emoji-grid button,
:root[data-theme="night"] .chat-sticker-grid button {
    background: rgba(15, 26, 32, .72);
}

:root[data-theme="night"] .chat-emoji-grid button:hover,
:root[data-theme="night"] .chat-sticker-grid button:hover {
    background: rgba(99, 198, 184, .18);
}

:root[data-theme="night"] .payment-success-motion {
    color: #dcfce7;
    background:
        radial-gradient(circle at 12% 50%, rgba(52, 211, 153, .20), transparent 34%),
        rgba(20, 184, 166, .10);
}

.theme-toggle {
    overflow: hidden;
}

.theme-toggle i {
    transition: transform .34s ease, color .34s ease;
}

.theme-toggle:hover i {
    transform: rotate(-16deg) scale(1.08);
}

@keyframes legalAuraLines {
    0% {
        transform: translate3d(0, 0, 0) rotate(0deg);
    }

    100% {
        transform: translate3d(120px, -90px, 0) rotate(.001deg);
    }
}

@keyframes legalAuraGlow {
    0% {
        transform: translate3d(-2%, 1%, 0) scale(1);
        opacity: .68;
    }

    100% {
        transform: translate3d(2%, -1%, 0) scale(1.08);
        opacity: 1;
    }
}

@keyframes legalAuraIconFloat {
    0%,
    100% {
        transform: translate3d(0, 0, 0) rotate(-5deg);
        opacity: .38;
    }

    50% {
        transform: translate3d(18px, -22px, 0) rotate(7deg);
        opacity: .78;
    }
}

@keyframes motionPageReveal {
    0% {
        opacity: .72;
        transform: translateY(12px);
        filter: blur(5px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

@keyframes motionRouteLeave {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }

    100% {
        opacity: .7;
        transform: translateY(-8px) scale(.992);
        filter: blur(4px);
    }
}

@keyframes motionRipple {
    0% {
        opacity: .42;
        transform: translate(-50%, -50%) scale(.25);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(18);
    }
}

@keyframes aiReadyPulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(99, 198, 184, 0);
        transform: translateY(0);
    }

    50% {
        box-shadow: 0 0 0 5px rgba(99, 198, 184, .12);
        transform: translateY(-1px);
    }
}

@keyframes chatBubbleEnter {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(.985);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes chatBubbleGlow {
    0% {
        box-shadow: 0 0 0 rgba(99, 198, 184, 0);
    }

    44% {
        box-shadow: 0 0 0 4px rgba(99, 198, 184, .13);
    }

    100% {
        box-shadow: 0 0 0 rgba(99, 198, 184, 0);
    }
}

@keyframes typingSoftScan {
    0% {
        transform: translateX(-120%);
    }

    100% {
        transform: translateX(120%);
    }
}

@keyframes motionPanelPop {
    0% {
        opacity: .3;
        transform: translateX(18px);
        filter: blur(5px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
        filter: blur(0);
    }
}

@keyframes aiSidebarCounselorNudge {
    0%,
    100% {
        transform: translateY(0) rotate(0deg) scale(1);
    }

    28% {
        transform: translateY(-8px) rotate(-4deg) scale(1.04);
    }

    56% {
        transform: translateY(2px) rotate(3deg) scale(.99);
    }
}

@keyframes paymentResultPop {
    0% {
        opacity: .4;
        transform: translateY(12px) scale(.98);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes paymentSuccessPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(25, 135, 84, .28);
    }

    100% {
        box-shadow: 0 0 0 14px rgba(25, 135, 84, 0);
    }
}

@keyframes paymentSuccessCheck {
    0% {
        transform: scale(.2) rotate(-18deg);
        opacity: 0;
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes chatEmojiPanelIn {
    0% {
        opacity: 0;
        transform: translateY(8px) scale(.98);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes chatStickerPop {
    0% {
        opacity: .25;
        transform: translateY(8px) scale(.9) rotate(-2deg);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0);
    }
}

@keyframes motionStickerBounce {
    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    44% {
        transform: translateY(-12px) scale(1.04);
    }

    72% {
        transform: translateY(2px) scale(.98);
    }
}

@keyframes motionStickerWiggle {
    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-7deg);
    }

    55% {
        transform: rotate(7deg);
    }

    78% {
        transform: rotate(-3deg);
    }
}

@keyframes motionStickerFloat {
    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-9px) scale(1.025);
    }
}

@keyframes motionStickerSquish {
    0%,
    100% {
        transform: scale(1, 1);
    }

    42% {
        transform: scale(1.08, .93) translateY(4px);
    }

    68% {
        transform: scale(.96, 1.05) translateY(-4px);
    }
}

@keyframes motionStickerHeartbeat {
    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 14px 20px rgba(20, 31, 52, .18));
    }

    28%,
    56% {
        transform: scale(1.09);
        filter: drop-shadow(0 16px 22px rgba(236, 72, 153, .22));
    }

    42% {
        transform: scale(.98);
    }
}

@keyframes motionStickerSleep {
    0%,
    100% {
        transform: translateY(0) rotate(0);
        opacity: 1;
    }

    50% {
        transform: translateY(5px) rotate(-2deg);
        opacity: .82;
    }
}

@keyframes motionStickerShake {
    0%,
    100% {
        transform: translateX(0);
    }

    18% {
        transform: translateX(-5px) rotate(-1deg);
    }

    36% {
        transform: translateX(5px) rotate(1deg);
    }

    54% {
        transform: translateX(-3px) rotate(-.5deg);
    }

    72% {
        transform: translateX(3px) rotate(.5deg);
    }
}

@keyframes motionStickerPeek {
    0%,
    100% {
        transform: translateX(0) rotate(0);
    }

    45% {
        transform: translateX(9px) rotate(3deg);
    }

    70% {
        transform: translateX(-4px) rotate(-1deg);
    }
}

@keyframes motionStickerVibrate {
    0%,
    100% {
        transform: translate(0, 0);
    }

    20% {
        transform: translate(-2px, 1px);
    }

    40% {
        transform: translate(2px, -1px);
    }

    60% {
        transform: translate(-1px, -2px);
    }

    80% {
        transform: translate(1px, 2px);
    }
}

@keyframes motionStickerSwim {
    0%,
    100% {
        transform: translateX(-6px) rotate(-3deg);
    }

    50% {
        transform: translateX(8px) rotate(4deg);
    }
}

@keyframes motionStickerBubbleBob {
    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    35% {
        transform: translateY(-8px) scale(1.03);
    }

    70% {
        transform: translateY(3px) scale(.99);
    }
}

@keyframes motionStickerDash {
    0%,
    100% {
        transform: translateX(-10px) rotate(-5deg);
    }

    50% {
        transform: translateX(12px) rotate(6deg);
    }
}

@keyframes motionStickerRoll {
    0%,
    100% {
        transform: rotate(-7deg) translateY(0);
    }

    50% {
        transform: rotate(7deg) translateY(-4px);
    }
}

@keyframes motionStickerWave {
    0%,
    100% {
        transform: rotate(0) translateY(0);
    }

    30% {
        transform: rotate(-6deg) translateY(-4px);
    }

    65% {
        transform: rotate(8deg) translateY(2px);
    }
}

@keyframes motionStickerDrift {
    0%,
    100% {
        transform: translate(0, 0) rotate(0);
    }

    33% {
        transform: translate(7px, -7px) rotate(2deg);
    }

    66% {
        transform: translate(-5px, 4px) rotate(-2deg);
    }
}

@keyframes motionStickerDive {
    0%,
    100% {
        transform: translateY(0) rotate(0);
    }

    45% {
        transform: translateY(12px) rotate(-5deg);
    }

    72% {
        transform: translateY(-5px) rotate(2deg);
    }
}

@keyframes motionStickerPopPulse {
    0%,
    100% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.12) rotate(-2deg);
    }

    68% {
        transform: scale(.97) rotate(1deg);
    }
}

@keyframes motionStickerLoveSway {
    0%,
    100% {
        transform: translateY(0) rotate(-3deg);
        filter: drop-shadow(0 14px 20px rgba(20, 31, 52, .18));
    }

    50% {
        transform: translateY(-7px) rotate(5deg);
        filter: drop-shadow(0 16px 24px rgba(236, 72, 153, .22));
    }
}

/* Professional UX suitability layer */
:root {
    --app-primary: #1d4f86;
    --app-primary-dark: #12375f;
    --app-teal: #12756d;
    --app-ink: #142033;
    --app-muted: #637083;
    --app-soft: #f4f7fb;
    --app-line: #dce4ef;
    --app-surface-soft: #f9fbfd;
    --app-shadow-sm: 0 8px 22px rgba(17, 35, 58, .055);
    --app-shadow-md: 0 16px 40px rgba(17, 35, 58, .085);
}

body {
    line-height: 1.72;
    background:
        linear-gradient(180deg, rgba(244, 247, 251, .98), rgba(250, 252, 255, .96)),
        var(--app-soft);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.navbar {
    min-height: 72px;
    border-bottom-color: rgba(220, 228, 239, .92) !important;
    background: rgba(255, 255, 255, .94) !important;
    box-shadow: 0 1px 0 rgba(17, 35, 58, .06);
    backdrop-filter: blur(14px);
}

.navbar .nav-link {
    padding: .58rem .76rem;
    border-radius: 8px;
    font-weight: 820;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    background: #eef5fb;
    color: var(--app-primary-dark);
}

.app-card,
.stat-card,
.admin-stat-card,
.payment-panel,
.lawyer-match-card,
.lawyer-search-card,
.lawyer-showcase-card,
.category-tile {
    border-color: rgba(190, 203, 221, .78);
    background: rgba(255, 255, 255, .98);
    box-shadow: var(--app-shadow-sm);
}

.app-card {
    overflow: clip;
}

.btn {
    min-height: 40px;
    padding-inline: .9rem;
    border-radius: 8px;
    font-weight: 850;
}

.btn-sm {
    min-height: 34px;
}

.btn-lg {
    min-height: 48px;
    padding-inline: 1.15rem;
}

.btn-primary {
    border-color: #1d4f86;
    background: linear-gradient(135deg, #1d4f86, #126f67);
    box-shadow: 0 9px 18px rgba(29, 79, 134, .16);
}

.btn-primary:hover,
.btn-primary:focus {
    border-color: #12375f;
    background: linear-gradient(135deg, #12375f, #0e5f59);
    box-shadow: 0 10px 20px rgba(18, 55, 95, .18);
}

.btn-outline-primary {
    color: var(--app-primary-dark);
    border-color: rgba(29, 79, 134, .32);
    background: rgba(255, 255, 255, .92);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    border-color: rgba(18, 55, 95, .48);
    background: #eef5fb;
    color: var(--app-primary-dark);
}

.motion-premium-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(17, 35, 58, .10);
}

body.workspace-page .legal-aura,
body.admin-page .legal-aura {
    opacity: .24;
}

body.workspace-page .motion-cursor-aura,
body.admin-page .motion-cursor-aura {
    display: none;
}

body.workspace-page .motion-premium-card.is-tilting,
body.admin-page .motion-premium-card.is-tilting {
    transform: translateY(-2px);
}

.dashboard-shell {
    padding-block: 1.35rem 2.25rem;
}

.dashboard-shell > .container-fluid {
    max-width: 1580px;
}

.app-sidebar {
    border-color: rgba(190, 203, 221, .78);
    background: rgba(255, 255, 255, .96);
    box-shadow: var(--app-shadow-sm);
}

.app-sidebar .list-group-item {
    min-height: 46px;
    padding: .62rem .82rem;
    color: #45546a;
}

.app-sidebar .list-group-item:hover,
.app-sidebar .list-group-item.active {
    background: #edf6f4;
    color: #0f625b;
    transform: none;
}

.brand-hero {
    min-height: min(680px, calc(100vh - 72px));
    border-bottom: 1px solid rgba(220, 228, 239, .92);
}

.brand-hero-shade {
    background:
        linear-gradient(90deg, rgba(9, 22, 38, .80) 0%, rgba(9, 22, 38, .60) 44%, rgba(9, 22, 38, .18) 100%),
        linear-gradient(180deg, rgba(9, 22, 38, .12), rgba(9, 22, 38, .48));
}

.brand-hero-copy {
    max-width: 680px;
}

.brand-hero h1 {
    line-height: 1.04;
    letter-spacing: 0;
}

.brand-hero-lead {
    max-width: 640px;
}

.trust-grid > div,
.brand-steps article,
.category-tile,
.lawyer-showcase-card {
    border-radius: 10px;
}

.category-tile {
    min-height: 140px;
    align-items: flex-start;
}

.category-tile strong,
.lawyer-showcase-card h3,
.lawyer-search-card h2,
.lawyer-match-title h2 {
    letter-spacing: 0;
}

.lawyer-search-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    gap: .85rem;
}

.lawyer-search-card > p {
    display: -webkit-box;
    min-height: 4.5em;
    margin: 0;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.lawyer-search-card .btn {
    align-self: flex-start;
    margin-top: auto;
}

.lawyer-next-slot {
    display: flex;
    gap: .45rem;
    align-items: flex-start;
    padding: .62rem .7rem;
    border: 1px solid rgba(18, 117, 109, .18);
    border-radius: 8px;
    background: #eef9f7;
    color: #185f58;
    font-weight: 800;
    line-height: 1.45;
}

.ai-chat-page {
    background:
        linear-gradient(180deg, rgba(244, 247, 251, .98), rgba(248, 251, 253, .98)),
        var(--app-soft);
}

.ai-chat-layout {
    grid-template-columns: minmax(232px, 260px) minmax(520px, 1fr) minmax(280px, 318px);
    gap: .9rem;
    align-items: start;
}

.ai-chat-page .ai-case-panel,
.ai-chat-room-pro,
.ai-chat-page .ai-analysis-column .app-card {
    border-color: rgba(190, 203, 221, .76);
    box-shadow: var(--app-shadow-sm);
}

.ai-case-panel,
.ai-chat-room {
    min-height: calc(100vh - 132px);
}

.ai-chat-room-pro {
    background: #fff;
}

.ai-chat-room-pro .chat-room-header {
    min-height: 88px;
    padding: 1rem 1.1rem;
    background:
        linear-gradient(135deg, rgba(238, 246, 244, .96), rgba(245, 249, 253, .98));
}

.ai-chat-room-pro .chat-room-header .chat-avatar.lg {
    width: 50px;
    height: 50px;
    box-shadow: none;
}

.ai-room-metrics {
    gap: .45rem;
    padding: .62rem .8rem;
    background: #fff;
}

.ai-room-metrics span {
    padding: .52rem .62rem;
    border-radius: 8px;
    background: #f8fafc;
}

.ai-chat-room-pro .ai-chat-window {
    height: min(62vh, 640px);
    min-height: 420px;
    background:
        linear-gradient(180deg, rgba(248, 251, 253, .98), rgba(244, 248, 250, .98));
    background-size: auto;
}

.ai-chat-room-pro .chat-message {
    max-width: min(720px, 82%);
    border-color: rgba(190, 203, 221, .80);
    border-radius: 10px;
    box-shadow: 0 8px 18px rgba(17, 35, 58, .055);
    font-size: .98rem;
}

.ai-chat-room-pro .chat-message.ai {
    background: #fff;
    color: var(--app-ink);
}

.ai-chat-room-pro .chat-message.user {
    border-color: rgba(29, 79, 134, .28);
    background: linear-gradient(135deg, #1d4f86, #126f67);
}

.ai-chat-room-pro .ai-chat-composer {
    position: sticky;
    bottom: 0;
    padding: .72rem .85rem;
    border-top: 1px solid rgba(220, 228, 239, .95);
    background: rgba(255, 255, 255, .96);
}

.ai-chat-room-pro .ai-chat-composer textarea {
    min-height: 48px;
    max-height: 132px;
    border-color: rgba(190, 203, 221, .92);
    background: #fff;
}

.ai-chat-room-pro .ai-attach-button,
.ai-chat-room-pro .ai-chat-composer .btn {
    width: 48px;
    min-width: 48px;
    height: 48px;
}

.ai-insight-card,
.analysis-card {
    line-height: 1.62;
}

.ai-insight-grid {
    gap: .55rem;
}

.ai-insight-grid div {
    border-radius: 8px;
    background: #f8fafc;
}

:root[data-theme="night"] body {
    background:
        linear-gradient(180deg, #08141c, #0d1b2a),
        #08141c;
}

:root[data-theme="night"] .navbar {
    border-bottom-color: rgba(72, 93, 119, .72) !important;
    background: rgba(8, 20, 28, .94) !important;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .045);
}

:root[data-theme="night"] .navbar .nav-link:hover,
:root[data-theme="night"] .navbar .nav-link.active,
:root[data-theme="night"] .app-sidebar .list-group-item:hover,
:root[data-theme="night"] .app-sidebar .list-group-item.active {
    background: rgba(32, 111, 103, .20);
    color: #8ee3d8;
}

:root[data-theme="night"] .app-card,
:root[data-theme="night"] .stat-card,
:root[data-theme="night"] .admin-stat-card,
:root[data-theme="night"] .payment-panel,
:root[data-theme="night"] .lawyer-match-card,
:root[data-theme="night"] .lawyer-search-card,
:root[data-theme="night"] .lawyer-showcase-card,
:root[data-theme="night"] .category-tile,
:root[data-theme="night"] .app-sidebar {
    border-color: rgba(72, 93, 119, .68);
    background: rgba(17, 28, 43, .98);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .20);
}

:root[data-theme="night"] .btn-outline-primary {
    color: #a7d8ff;
    border-color: rgba(111, 163, 220, .42);
    background: rgba(17, 28, 43, .92);
}

:root[data-theme="night"] .btn-outline-primary:hover,
:root[data-theme="night"] .btn-outline-primary:focus {
    background: rgba(29, 79, 134, .26);
    color: #d7ecff;
}

:root[data-theme="night"] .lawyer-next-slot {
    border-color: rgba(84, 210, 196, .24);
    background: rgba(18, 117, 109, .16);
    color: #b8fff6;
}

:root[data-theme="night"] .ai-chat-page {
    background:
        linear-gradient(180deg, rgba(8, 20, 28, .98), rgba(13, 27, 42, .98)),
        #08141c;
}

:root[data-theme="night"] .ai-chat-room-pro,
:root[data-theme="night"] .ai-chat-room-pro .ai-chat-composer,
:root[data-theme="night"] .ai-room-metrics {
    background: rgba(17, 28, 43, .98);
}

:root[data-theme="night"] .ai-chat-room-pro .chat-room-header {
    background:
        linear-gradient(135deg, rgba(18, 117, 109, .18), rgba(29, 79, 134, .18)),
        rgba(17, 28, 43, .98);
}

:root[data-theme="night"] .ai-room-metrics span,
:root[data-theme="night"] .ai-insight-grid div {
    border-color: rgba(72, 93, 119, .62);
    background: rgba(11, 23, 35, .92);
}

:root[data-theme="night"] .ai-chat-room-pro .ai-chat-window {
    background:
        linear-gradient(180deg, rgba(11, 23, 35, .98), rgba(10, 20, 31, .98));
}

:root[data-theme="night"] .ai-chat-room-pro .chat-message.ai {
    border-color: rgba(72, 93, 119, .68);
    background: rgba(17, 28, 43, .98);
    color: #e6edf7;
}

:root[data-theme="night"] .ai-chat-room-pro .ai-chat-composer textarea {
    border-color: rgba(72, 93, 119, .78);
    background: rgba(8, 20, 28, .96);
    color: #e6edf7;
}

@media (max-width: 1499.98px) {
    .ai-chat-layout {
        grid-template-columns: minmax(232px, 272px) minmax(0, 1fr);
    }

    .ai-chat-layout .ai-analysis-column {
        grid-column: 2;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: .85rem;
    }

    .ai-chat-layout .ai-analysis-column > .app-card,
    .ai-chat-layout .ai-analysis-column > div {
        margin-top: 0 !important;
    }
}

@media (max-width: 1199.98px) {
    .ai-chat-layout {
        grid-template-columns: 1fr;
    }

    .ai-case-panel,
    .ai-chat-room {
        min-height: auto;
    }

    .ai-chat-layout .ai-analysis-column {
        grid-column: auto;
        grid-template-columns: 1fr;
    }

    .ai-chat-room-pro .ai-chat-window {
        height: min(62vh, 560px);
        min-height: 360px;
    }
}

@media (max-width: 767.98px) {
    .legal-aura-icon {
        opacity: .42;
    }

    .motion-cursor-aura {
        display: none;
    }

    .motion-premium-card:hover {
        transform: none;
    }

    .chat-emoji-panel {
        right: .65rem;
        left: .65rem;
        width: auto;
    }

    .chat-emoji-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

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

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .001ms !important;
    }

    .motion-reveal {
        opacity: 1;
        transform: none;
        filter: none;
    }

    .legal-aura,
    .motion-cursor-aura,
    .motion-scroll-progress {
        display: none;
    }

    .motion-premium-card.is-tilting {
        transform: none;
    }
}
