:root {
    --chatv2-bg: #f5f2eb;
    --chatv2-bg-accent: #efe5d2;
    --chatv2-surface: rgba(255, 255, 255, 0.88);
    --chatv2-surface-strong: #ffffff;
    --chatv2-surface-muted: #f4efe6;
    --chatv2-border: rgba(63, 46, 24, 0.12);
    --chatv2-border-strong: rgba(63, 46, 24, 0.18);
    --chatv2-ink: #1d140c;
    --chatv2-muted: #6c5c4b;
    --chatv2-accent: #b85c38;
    --chatv2-accent-strong: #8f3d1e;
    --chatv2-accent-soft: #f3ddd0;
    --chatv2-user: #5d3fd3;
    --chatv2-user-strong: #4525b6;
    --chatv2-success: #1f7a58;
    --chatv2-shadow: 0 20px 60px rgba(44, 25, 12, 0.12);
    --chatv2-shadow-soft: 0 10px 30px rgba(44, 25, 12, 0.08);
    --chatv2-radius-xl: 30px;
    --chatv2-radius-lg: 22px;
    --chatv2-radius-md: 16px;
    --chatv2-radius-sm: 12px;
    --chatv2-keyboard-offset: 0px;
}

html,
body {
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(184, 92, 56, 0.12), transparent 30%),
        radial-gradient(circle at top right, rgba(93, 63, 211, 0.12), transparent 26%),
        linear-gradient(180deg, #f8f3ea 0%, var(--chatv2-bg) 40%, #f3ede2 100%);
    color: var(--chatv2-ink);
    overflow-x: hidden;
}

body.chat-v2-body {
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    padding-top: 84px;
    padding-bottom: 132px;
}

body.chat-v2-body .sam-menu {
    height: 80dvh;
    min-height: 80dvh;
    max-height: 80dvh;
}


.chat-v2-app {
    min-height: 100vh;
}

.chat-v2-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1200;
    padding: 16px 18px;
    background: rgba(248, 243, 234, 0.88);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(63, 46, 24, 0.08);
}

.chat-v2-header__bar {
    max-width: 1180px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
}

.chat-v2-header__leftgroup {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.chat-v2-header__rightgroup {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.chat-v2-header__back,
.chat-v2-header__attach {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--chatv2-border);
    background: rgba(255, 255, 255, 0.7);
    color: var(--chatv2-ink);
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    box-shadow: var(--chatv2-shadow-soft);
}

.chat-v2-header__back {
    appearance: none;
    cursor: pointer;
}

.chat-v2-header__auth {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-height: 44px;
    padding: 8px 14px;
    border-radius: 18px;
    border: 1px solid var(--chatv2-border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(243, 221, 208, 0.72));
    box-shadow: var(--chatv2-shadow-soft);
    color: var(--chatv2-ink);
    text-decoration: none;
    text-align: left;
}

.chat-v2-header__auth strong {
    display: block;
    max-width: 220px;
    font-size: 13px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-v2-header__auth-label {
    display: block;
    margin-bottom: 2px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--chatv2-accent-strong);
}

.chat-v2-header__auth--guest {
    background: linear-gradient(135deg, rgba(184, 92, 56, 0.12), rgba(93, 63, 211, 0.1));
}

.chat-v2-header__attach-count {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--chatv2-accent);
    color: #fff;
    font-size: 11px;
    line-height: 20px;
    text-align: center;
}

.chat-v2-header__title {
    text-align: center;
}

.chat-v2-header__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(63, 46, 24, 0.08);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--chatv2-accent-strong);
}

.chat-v2-main {
    padding: 18px;
}

.chat-v2-shell {
    max-width: 1180px;
    margin: 0 auto;
    display: grid;
    gap: 18px;
}

.chat-v2-shell--with-sidebar {
    position: relative;
}

.chat-v2-content {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.chat-v2-sidebar {
    position: fixed;
    top: 96px;
    left: 18px;
    bottom: 18px;
    width: min(360px, calc(100vw - 36px));
    z-index: 1300;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.58);
    box-shadow: var(--chatv2-shadow-soft);
    backdrop-filter: blur(18px);
    min-height: 240px;
    transform: translateX(calc(-100% - 26px));
    transition: transform 180ms ease;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.chat-v2-sidebar.is-open {
    transform: translateX(0);
}

.chat-v2-sidebar__header {
    display: grid;
    gap: 12px;
    flex: 0 0 auto;
}

.chat-v2-sidebar__heading {
    min-width: 0;
}

.chat-v2-sidebar__eyebrow {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--chatv2-accent-strong);
}

.chat-v2-sidebar__header h3 {
    margin: 6px 0 0;
    font-size: 26px;
    line-height: 1;
    letter-spacing: -0.04em;
}

.chat-v2-sidebar__controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-v2-sidebar__new {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--chatv2-accent), var(--chatv2-accent-strong));
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 16px 34px rgba(143, 61, 30, 0.2);
    flex: 1 1 auto;
}

.chat-v2-sidebar__minimize {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border: 1px solid rgba(63, 46, 24, 0.08);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.76);
    color: var(--chatv2-ink);
}

.chat-v2-conversation-list {
    display: grid;
    gap: 10px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

.chat-v2-conversation-list__empty {
    padding: 18px;
    border-radius: 18px;
    background: rgba(243, 221, 208, 0.6);
    border: 1px dashed rgba(143, 61, 30, 0.18);
    color: var(--chatv2-muted);
}

.chat-v2-conversation-list__empty strong {
    display: block;
    margin-bottom: 6px;
    color: var(--chatv2-ink);
}

.chat-v2-conversation-item {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 98px;
    height: 98px;
    padding: 12px;
    border: 1px solid rgba(63, 46, 24, 0.08);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--chatv2-ink);
    text-align: left;
    transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
    overflow: hidden;
}

.chat-v2-conversation-item:hover {
    transform: translateY(-1px);
    border-color: rgba(184, 92, 56, 0.2);
    box-shadow: 0 12px 24px rgba(44, 25, 12, 0.08);
}

.chat-v2-conversation-item.is-active {
    background: linear-gradient(180deg, rgba(243, 221, 208, 0.86), rgba(255, 255, 255, 0.92));
    border-color: rgba(184, 92, 56, 0.24);
}

.chat-v2-conversation-item__open {
    display: flex;
    align-items: flex-start;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
}

.chat-v2-conversation-item__title {
    display: block;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-v2-conversation-item__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    overflow: hidden;
}

.chat-v2-conversation-item__action {
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(63, 46, 24, 0.08);
    background: rgba(255, 255, 255, 0.7);
    color: var(--chatv2-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
    flex: 0 0 auto;
}

.chat-v2-conversation-item__action--danger {
    color: #9d2d2d;
    border-color: rgba(157, 45, 45, 0.16);
}

.chat-v2-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1240;
    background: rgba(20, 13, 9, 0.26);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
}

.chat-v2-sidebar-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.chat-v2-statusbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
    border-radius: var(--chatv2-radius-xl);
    background: var(--chatv2-surface);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--chatv2-shadow-soft);
}

.chat-v2-statusbar__left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.chat-v2-statusdot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #92a37b;
    box-shadow: 0 0 0 6px rgba(146, 163, 123, 0.16);
    flex: 0 0 auto;
}

.chat-v2-statusbar.is-thinking .chat-v2-statusdot {
    background: var(--chatv2-accent);
    box-shadow: 0 0 0 6px rgba(184, 92, 56, 0.18);
    animation: chatv2-pulse 1.2s infinite ease-in-out;
}

.chat-v2-statuscopy {
    min-width: 0;
}

.chat-v2-statuscopy strong {
    display: block;
    font-size: 14px;
    color: var(--chatv2-ink);
}

.chat-v2-statuscopy span {
    display: block;
    font-size: 12px;
    color: var(--chatv2-muted);
}

.chat-v2-capabilities {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.chat-v2-capability {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(63, 46, 24, 0.08);
    color: var(--chatv2-muted);
    font-size: 12px;
    font-weight: 600;
}

.chat-v2-capability--account {
    color: var(--chatv2-accent-strong);
    background: rgba(243, 221, 208, 0.82);
    border-color: rgba(184, 92, 56, 0.18);
}

.chat-v2-stage {
    position: relative;
    border-radius: 36px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.24)),
        rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: var(--chatv2-shadow);
    overflow: hidden;
}

.chat-v2-stage::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top left, rgba(184, 92, 56, 0.08), transparent 26%),
        radial-gradient(circle at bottom right, rgba(93, 63, 211, 0.08), transparent 22%);
    pointer-events: none;
}

.chat-v2-empty {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
    gap: 28px;
    padding: 34px;
    border-bottom: 1px solid rgba(63, 46, 24, 0.08);
}

.chat-v2-empty.is-hidden {
    display: none;
}

.chat-v2-empty:not(.is-hidden) + .chat-v2-scroll {
    min-height: 0;
    max-height: 0;
    padding: 0;
    overflow: hidden;
}

.chat-v2-hero h2 {
    margin: 0 0 16px;
    font-size: clamp(30px, 4vw, 52px);
    line-height: 0.98;
    letter-spacing: -0.04em;
    font-weight: 900;
    color: var(--chatv2-ink);
}

.chat-v2-hero p {
    margin: 0 0 18px;
    max-width: 760px;
    font-size: 17px;
    line-height: 1.65;
    color: var(--chatv2-muted);
}

.chat-v2-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chat-v2-meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(63, 46, 24, 0.08);
    font-size: 13px;
    font-weight: 700;
    color: var(--chatv2-ink);
}

.chat-v2-suggestions {
    display: grid;
    gap: 12px;
}

.chat-v2-suggestion-card {
    padding: 16px 18px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(63, 46, 24, 0.08);
}

.chat-v2-suggestion-card h3 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 800;
    color: var(--chatv2-ink);
}

.chat-v2-suggestion-card p {
    margin: 0;
    color: var(--chatv2-muted);
    font-size: 13px;
    line-height: 1.5;
}

.chat-v2-suggestion-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.chat-v2-suggestion {
    appearance: none;
    width: 100%;
    text-align: left;
    padding: 16px 16px 18px;
    border-radius: 22px;
    border: 1px solid rgba(63, 46, 24, 0.09);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.68));
    color: var(--chatv2-ink);
    box-shadow: var(--chatv2-shadow-soft);
    transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
    cursor: pointer;
}

.chat-v2-suggestion:hover,
.chat-v2-suggestion:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(44, 25, 12, 0.1);
    border-color: rgba(184, 92, 56, 0.22);
    outline: none;
}

.chat-v2-suggestion strong {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 800;
}

.chat-v2-suggestion span {
    display: block;
    color: var(--chatv2-muted);
    font-size: 12px;
    line-height: 1.5;
}

.chat-v2-scroll {
    position: relative;
    z-index: 1;
    min-height: 420px;
    max-height: calc(100vh - 320px);
    overflow-y: auto;
    padding: 22px 20px 44px;
}

.chat-v2-scroll::-webkit-scrollbar {
    width: 10px;
}

.chat-v2-scroll::-webkit-scrollbar-thumb {
    background: rgba(63, 46, 24, 0.18);
    border-radius: 999px;
}

.chat-v2-row {
    display: flex;
    margin: 0 auto 18px;
    max-width: 920px;
}

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

.chat-v2-row--assistant,
.chat-v2-row--system {
    justify-content: flex-start;
}

.chat-v2-card {
    width: min(100%, 760px);
    border-radius: 28px;
    border: 1px solid var(--chatv2-border);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--chatv2-shadow-soft);
    overflow: hidden;
}

.chat-v2-row--user .chat-v2-card {
    width: min(100%, 560px);
    background: linear-gradient(135deg, var(--chatv2-user), var(--chatv2-user-strong));
    color: #fff;
    border-color: rgba(255, 255, 255, 0.18);
}

.chat-v2-row--user .chat-v2-card,
.chat-v2-row--user .chat-v2-card * {
    color: #fff !important;
}

.chat-v2-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px 0;
}

.chat-v2-card__label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: var(--chatv2-ink);
}

.chat-v2-card__label::before {
    content: "";
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--chatv2-accent);
    box-shadow: 0 0 0 5px rgba(184, 92, 56, 0.14);
}

.chat-v2-card__mode {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border-radius: 999px;
    background: var(--chatv2-accent-soft);
    color: var(--chatv2-accent-strong);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.chat-v2-card__body {
    padding: 18px 20px 18px;
}

.chat-v2-card__body p:last-child {
    margin-bottom: 0;
}

.chat-v2-card__body--stack {
    display: grid;
    gap: 14px;
}

.chat-v2-card__body--thinking {
    padding-top: 12px;
}

.chat-v2-row--user .chat-v2-card__body {
    padding: 18px 20px;
}

.chat-v2-usertext {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.chat-v2-rich,
.chat-v2-rich * {
    color: inherit;
}

.chat-v2-rich {
    font-size: 15px;
    line-height: 1.7;
}

.chat-v2-rich p,
.chat-v2-rich ul,
.chat-v2-rich ol {
    margin-bottom: 12px;
}

.chat-v2-rich ul,
.chat-v2-rich ol {
    padding-left: 20px;
}

.chat-v2-rich a {
    color: var(--chatv2-accent-strong);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    word-break: break-word;
}

.chat-v2-rich .container,
.chat-v2-rich .container-fluid {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
}

.chat-v2-rich .card,
.chat-v2-rich .alert,
.chat-v2-rich pre,
.chat-v2-rich table,
.chat-v2-inline-image-shell {
    border-radius: 20px !important;
    overflow: hidden;
}

.chat-v2-rich .card {
    border: 1px solid rgba(63, 46, 24, 0.09);
    box-shadow: none;
}

.chat-v2-rich .alert-info,
.chat-v2-rich .alert-info * {
    color: #fff !important;
}

.chat-v2-rich .btn,
.chat-v2-rich button.option-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 16px;
    border: 0;
    background: linear-gradient(135deg, var(--chatv2-accent), var(--chatv2-accent-strong));
    color: #fff !important;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 12px 24px rgba(143, 61, 30, 0.16);
    white-space: normal;
}

.chat-v2-rich .btn + .btn,
.chat-v2-rich .btn + button.option-btn,
.chat-v2-rich button.option-btn + .btn,
.chat-v2-rich button.option-btn + button.option-btn {
    margin-left: 8px;
}

.chat-v2-rich .btn-outline-primary,
.chat-v2-rich .btn-outline-secondary,
.chat-v2-rich .btn-outline-success,
.chat-v2-rich .btn-outline-danger,
.chat-v2-rich .btn-outline-warning,
.chat-v2-rich .btn-outline-info,
.chat-v2-rich .btn-primary,
.chat-v2-rich .btn-secondary,
.chat-v2-rich .btn-success,
.chat-v2-rich .btn-danger,
.chat-v2-rich .btn-warning,
.chat-v2-rich .btn-info {
    color: #fff !important;
    border: 0;
}

.chat-v2-rich .btn:hover,
.chat-v2-rich .btn:focus-visible,
.chat-v2-rich button.option-btn:hover,
.chat-v2-rich button.option-btn:focus-visible {
    color: #fff !important;
    transform: translateY(-1px);
    outline: none;
}

.chat-v2-rich .list-group-item {
    border-color: rgba(63, 46, 24, 0.08);
}

.chat-v2-rich pre {
    padding: 18px;
    background: #21160f;
    color: #f5ece2;
}

.chat-v2-rich code {
    color: inherit;
}

.chat-v2-rich details {
    margin: 14px 0;
    padding: 12px 14px;
    border-radius: 18px;
    border: 1px solid rgba(63, 46, 24, 0.1);
    background: rgba(244, 239, 230, 0.72);
}

.chat-v2-rich summary {
    cursor: pointer;
    list-style: none;
    font-size: 13px;
    font-weight: 800;
    color: var(--chatv2-accent-strong);
}

.chat-v2-rich summary::-webkit-details-marker {
    display: none;
}

.chat-v2-rich summary::before {
    content: "+";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-right: 8px;
    border-radius: 50%;
    background: rgba(184, 92, 56, 0.14);
    color: var(--chatv2-accent-strong);
    font-size: 12px;
    line-height: 1;
}

.chat-v2-rich details[open] summary::before {
    content: "-";
}

.chat-v2-rich details > *:last-child {
    margin-bottom: 0;
}

.chat-v2-warning {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 196, 109, 0.2);
    color: #7a4b00;
    font-size: 13px;
    font-weight: 600;
}

.chat-v2-thinking {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 20px;
}

.chat-v2-thinking__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--chatv2-accent);
    opacity: 0.35;
    animation: chatv2-thinking-bounce 1s infinite ease-in-out;
}

.chat-v2-thinking__dot:nth-child(2) {
    animation-delay: 0.16s;
}

.chat-v2-thinking__dot:nth-child(3) {
    animation-delay: 0.32s;
}

.chat-v2-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.chat-v2-image-card {
    overflow: hidden;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.chat-v2-image-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    background: rgba(255, 255, 255, 0.12);
}

.chat-v2-image-card__meta {
    padding: 10px 12px;
    font-size: 11px;
    color: inherit;
    opacity: 0.84;
}

.chat-v2-image-placeholder {
    display: grid;
    place-items: center;
    aspect-ratio: 1 / 1;
    background: rgba(255, 255, 255, 0.28);
    font-size: 12px;
    color: inherit;
}

.chat-v2-inline-image-shell {
    background: var(--chatv2-surface-muted);
    border: 1px solid rgba(63, 46, 24, 0.1);
}

.chat-v2-inline-image-shell img {
    width: 100%;
    max-height: 540px;
    object-fit: contain;
    display: block;
    background: #fff;
}

.chat-v2-inline-image-shell__meta {
    padding: 12px 14px;
    color: var(--chatv2-muted);
    font-size: 12px;
    font-weight: 600;
}

.chat-v2-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 20px 16px;
    color: var(--chatv2-muted);
    font-size: 12px;
}

.chat-v2-row--user .chat-v2-card__footer {
    color: rgba(255, 255, 255, 0.8);
}

.chat-v2-copy {
    border: 0;
    background: transparent;
    padding: 0;
    color: inherit;
    font-weight: 700;
}

.chat-v2-composer {
    position: fixed;
    left: 18px;
    right: 18px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + var(--chatv2-keyboard-offset, 0px) + 6px);
    z-index: 1200;
}

.chat-v2-composer__inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 14px;
    border-radius: 32px;
    background: rgba(248, 243, 234, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.66);
    box-shadow: var(--chatv2-shadow);
    backdrop-filter: blur(20px);
}

.chat-v2-attachment-preview {
    display: none;
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(63, 46, 24, 0.08);
}

.chat-v2-attachment-preview.is-visible {
    display: block;
}


.chat-v2-attachment-preview__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.chat-v2-attachment-preview__title {
    font-size: 13px;
    font-weight: 800;
    color: var(--chatv2-ink);
}

.chat-v2-attachment-preview__clear {
    border: 0;
    background: transparent;
    color: var(--chatv2-accent-strong);
    font-size: 12px;
    font-weight: 800;
}

.chat-v2-attachment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.chat-v2-attachment-card {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    background: var(--chatv2-surface-strong);
    border: 1px solid rgba(63, 46, 24, 0.09);
}

.chat-v2-attachment-card img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.chat-v2-attachment-card__meta {
    padding: 10px;
}

.chat-v2-attachment-card__name {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--chatv2-ink);
    font-size: 11px;
    font-weight: 700;
}

.chat-v2-attachment-card__size {
    display: block;
    margin-top: 4px;
    color: var(--chatv2-muted);
    font-size: 10px;
}

.chat-v2-attachment-card__remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 50%;
    background: rgba(29, 20, 12, 0.72);
    color: #fff;
    font-size: 14px;
    line-height: 24px;
    text-align: center;
}

.chat-v2-form {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: end;
}

.chat-v2-form__attach,
.chat-v2-form__send {
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--chatv2-shadow-soft);
}

.chat-v2-form__attach {
    background: var(--chatv2-surface-strong);
    color: var(--chatv2-accent-strong);
    border: 1px solid rgba(63, 46, 24, 0.08);
}

.chat-v2-form__send {
    background: linear-gradient(135deg, var(--chatv2-accent), var(--chatv2-accent-strong));
    color: #fff;
}

.chat-v2-form__inputwrap {
    padding: 8px 12px;
    border-radius: 26px;
    background: var(--chatv2-surface-strong);
    border: 1px solid rgba(63, 46, 24, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.chat-v2-form__input {
    width: 100%;
    min-height: 40px;
    max-height: 180px;
    border: 0;
    outline: none;
    resize: vertical;
    background: transparent;
    color: var(--chatv2-ink);
    font-size: 15px;
    line-height: 1.6;
}

.chat-v2-form__input::placeholder {
    color: #85776b;
}

.chat-v2-sheet .modal-content {
    border-radius: 28px;
    border: 1px solid rgba(63, 46, 24, 0.08);
    overflow: hidden;
}

.chat-v2-sheet .modal-header,
.chat-v2-sheet .modal-body {
    padding: 20px;
}

.chat-v2-sheet__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 18px;
    border-radius: 20px;
    border: 1px solid rgba(63, 46, 24, 0.08);
    background: #fff;
    color: var(--chatv2-ink);
    font-weight: 700;
}

.chat-v2-sheet__option + .chat-v2-sheet__option {
    margin-top: 12px;
}

.chat-v2-help-modal .modal-dialog {
    max-width: 960px;
    margin: 96px auto 128px;
}

.chat-v2-help-modal .modal-content {
    background: rgba(248, 243, 234, 0.98);
}

.chat-v2-help-modal__subtitle {
    color: var(--chatv2-muted);
    font-size: 13px;
    line-height: 1.5;
}

.chat-v2-help-modal__section + .chat-v2-help-modal__section {
    margin-top: 18px;
}

.chat-v2-guest-modal .modal-dialog {
    max-width: 920px;
    margin: 92px auto 132px;
}

.chat-v2-guest-modal .modal-content {
    border: 0;
    border-radius: 32px;
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(93, 63, 211, 0.12), transparent 28%),
        radial-gradient(circle at bottom left, rgba(184, 92, 56, 0.16), transparent 34%),
        linear-gradient(180deg, rgba(252, 248, 242, 0.98), rgba(244, 236, 223, 0.98));
    box-shadow: 0 30px 90px rgba(44, 25, 12, 0.18);
}

.chat-v2-guest-modal .modal-body {
    padding: 0;
}

.chat-v2-guest-modal__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
    gap: 0;
}

.chat-v2-guest-modal__copy {
    padding: 34px 32px 34px 34px;
}

.chat-v2-guest-modal__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(63, 46, 24, 0.08);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--chatv2-accent-strong);
}

.chat-v2-guest-modal__copy h2 {
    margin: 18px 0 12px;
    font-size: clamp(28px, 4vw, 44px);
    line-height: 0.98;
    letter-spacing: -0.04em;
}

.chat-v2-guest-modal__copy p {
    margin: 0 0 20px;
    font-size: 16px;
    line-height: 1.65;
    color: var(--chatv2-muted);
}

.chat-v2-guest-modal__bullets {
    display: grid;
    gap: 14px;
}

.chat-v2-guest-modal__bullet {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(63, 46, 24, 0.08);
}

.chat-v2-guest-modal__bullet ion-icon {
    font-size: 22px;
    color: var(--chatv2-accent);
    margin-top: 2px;
}

.chat-v2-guest-modal__bullet strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.chat-v2-guest-modal__bullet span {
    display: block;
    font-size: 13px;
    line-height: 1.55;
    color: var(--chatv2-muted);
}

.chat-v2-guest-modal__actions {
    display: grid;
    align-content: center;
    gap: 12px;
    padding: 34px;
    background: rgba(255, 255, 255, 0.52);
    border-left: 1px solid rgba(63, 46, 24, 0.08);
}

.chat-v2-guest-modal__primary,
.chat-v2-guest-modal__dismiss {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    border-radius: 18px;
    font-weight: 700;
    text-decoration: none;
    transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.chat-v2-guest-modal__primary {
    background: linear-gradient(135deg, var(--chatv2-accent), var(--chatv2-accent-strong));
    color: #fff;
    box-shadow: 0 18px 36px rgba(143, 61, 30, 0.22);
}

.chat-v2-guest-modal__dismiss {
    border: 0;
    background: transparent;
    color: var(--chatv2-muted);
}

body.dark-mode-active,
body.dark-mode-active html {
    background:
        radial-gradient(circle at top left, rgba(184, 92, 56, 0.12), transparent 30%),
        radial-gradient(circle at top right, rgba(93, 63, 211, 0.12), transparent 26%),
        linear-gradient(180deg, #130f0c 0%, #17120f 50%, #1b1511 100%);
    color: #f6eee4;
}

body.dark-mode-active .chat-v2-header,
body.dark-mode-active .chat-v2-composer__inner,
body.dark-mode-active .chat-v2-statusbar,
body.dark-mode-active .chat-v2-card,
body.dark-mode-active .chat-v2-attachment-preview,
body.dark-mode-active .chat-v2-suggestion-card,
body.dark-mode-active .chat-v2-suggestion,
body.dark-mode-active .chat-v2-meta-pill,
body.dark-mode-active .chat-v2-capability,
body.dark-mode-active .chat-v2-form__attach,
body.dark-mode-active .chat-v2-form__inputwrap {
    background: rgba(28, 22, 18, 0.86);
    color: #f6eee4;
    border-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode-active .chat-v2-inline-image-shell,
body.dark-mode-active .chat-v2-surface-muted,
body.dark-mode-active .chat-v2-attachment-card,
body.dark-mode-active .chat-v2-sidebar,
body.dark-mode-active .chat-v2-conversation-item,
body.dark-mode-active .chat-v2-guest-modal__bullet,
body.dark-mode-active .chat-v2-guest-modal__actions,
body.dark-mode-active .chat-v2-header__auth {
    background: rgba(40, 31, 25, 0.88);
}


body.dark-mode-active .chat-v2-sidebar__minimize,
body.dark-mode-active .chat-v2-conversation-item__action {
    background: rgba(30, 24, 20, 0.82);
    border-color: rgba(255, 255, 255, 0.08);
    color: #f6eee4;
}

body.dark-mode-active .chat-v2-card__label,
body.dark-mode-active .chat-v2-hero h2,
body.dark-mode-active .chat-v2-suggestion strong,
body.dark-mode-active .chat-v2-statuscopy strong,
body.dark-mode-active .chat-v2-attachment-preview__title,
body.dark-mode-active .chat-v2-attachment-card__name {
    color: #fff;
}

body.dark-mode-active .chat-v2-statuscopy span,
body.dark-mode-active .chat-v2-rich,
body.dark-mode-active .chat-v2-rich *,
body.dark-mode-active .chat-v2-suggestion span,
body.dark-mode-active .chat-v2-attachment-card__size,
body.dark-mode-active .chat-v2-inline-image-shell__meta,
body.dark-mode-active .chat-v2-conversation-item__preview,
body.dark-mode-active .chat-v2-guest-modal__bullet span {
    color: rgba(246, 238, 228, 0.78);
}

body.dark-mode-active .chat-v2-header__auth-label,
body.dark-mode-active .chat-v2-capability--account {
    color: #f0b08c;
}

body.dark-mode-active .chat-v2-form__input {
    color: #fff;
}

body.dark-mode-active .chat-v2-form__input::placeholder {
    color: rgba(246, 238, 228, 0.52);
}

@keyframes chatv2-pulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.12);
        opacity: 0.75;
    }
}

@keyframes chatv2-thinking-bounce {
    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.35;
    }
    40% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

@media (max-width: 991px) {
    .chat-v2-shell--with-sidebar {
        grid-template-columns: 1fr;
    }

    .chat-v2-sidebar {
        top: 86px;
        left: 12px;
        bottom: 12px;
        width: min(360px, calc(100vw - 24px));
    }

    .chat-v2-empty {
        grid-template-columns: 1fr;
    }

    .chat-v2-suggestion-grid {
        grid-template-columns: 1fr;
    }

    .chat-v2-statusbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .chat-v2-capabilities {
        justify-content: flex-start;
    }

    .chat-v2-scroll {
        max-height: none;
        min-height: 340px;
        padding-bottom: 52px;
    }

    .chat-v2-card {
        width: 100%;
    }

    .chat-v2-guest-modal__grid {
        grid-template-columns: 1fr;
    }

    .chat-v2-guest-modal__actions {
        border-left: 0;
        border-top: 1px solid rgba(63, 46, 24, 0.08);
    }
}

@media (max-width: 767px) {
    body.chat-v2-body {
        padding-top: 62px;
        padding-bottom: 144px;
    }

    .chat-v2-header {
        padding: 8px 10px;
    }

    .chat-v2-header__bar {
        grid-template-columns: auto 1fr auto;
        gap: 6px;
        align-items: center;
    }

    .chat-v2-header__leftgroup {
        gap: 6px;
        flex-wrap: nowrap;
    }

    .chat-v2-header__rightgroup {
        gap: 6px;
        flex-wrap: nowrap;
        justify-content: flex-end;
    }

    .chat-v2-header__back,
    .chat-v2-header__attach {
        min-height: 40px;
        width: 40px;
        padding: 0;
    }

    .chat-v2-header__auth {
        min-height: 40px;
        padding: 0 10px;
        max-width: 96px;
        border-radius: 14px;
        align-items: center;
        justify-content: center;
    }

    .chat-v2-header__auth strong {
        max-width: 76px;
        font-size: 12px;
        text-align: center;
    }

    .chat-v2-header__auth-label,
    .chat-v2-header__back span,
    .chat-v2-header__attach > span:not(.chat-v2-header__attach-count) {
        display: none;
    }

    .chat-v2-header__title {
        min-width: 0;
        text-align: center;
    }

    .chat-v2-header__eyebrow {
        max-width: 100%;
        padding: 5px 8px;
        font-size: 10px;
        letter-spacing: 0.05em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .chat-v2-main {
        padding: 12px;
    }

    .chat-v2-empty {
        padding: 22px 18px;
        gap: 18px;
    }

    .chat-v2-hero p {
        font-size: 15px;
    }

    .chat-v2-scroll {
        padding: 16px 12px 52px;
    }

    .chat-v2-row {
        margin-bottom: 14px;
    }

    .chat-v2-card__header {
        padding: 14px 16px 0;
    }

    .chat-v2-card__body {
        padding: 14px 16px 16px;
    }

    .chat-v2-card__footer {
        padding: 0 16px 14px;
    }

    .chat-v2-composer {
        left: 12px;
        right: 12px;
        bottom: calc(env(safe-area-inset-bottom, 0px) + var(--chatv2-keyboard-offset, 0px) + 2px);
    }

    .chat-v2-composer__inner {
        padding: 12px;
        border-radius: 24px;
    }

    .chat-v2-form {
        grid-template-columns: auto 1fr auto;
        gap: 10px;
    }

    .chat-v2-form__attach,
    .chat-v2-form__send {
        width: 48px;
        height: 48px;
        border-radius: 18px;
    }

    .chat-v2-form__input {
        min-height: 52px;
        font-size: 14px;
    }


    .chat-v2-help-modal .modal-dialog {
        margin: 82px 12px 144px;
    }

    .chat-v2-sidebar {
        top: 74px;
        left: 12px;
        width: min(340px, calc(100vw - 24px));
    }

    .chat-v2-sidebar__controls {
        align-items: stretch;
    }

    .chat-v2-conversation-item {
        min-height: 94px;
        height: 94px;
    }

    .chat-v2-guest-modal .modal-dialog {
        margin: 76px 12px 120px;
    }

    .chat-v2-guest-modal__copy,
    .chat-v2-guest-modal__actions {
        padding: 22px 18px;
    }

}
