.app-page {
    padding: 3rem 0 5rem;
}

.app-page--setup {
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.app-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.9fr);
    align-items: start;
}

.app-grid--single {
    grid-template-columns: minmax(0, 860px);
    justify-content: center;
}

.app-card,
.auth-panel {
    padding: clamp(1.5rem, 4vw, 2.5rem);
    border-radius: var(--site-radius-lg);
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: var(--site-shadow-strong);
}

.app-card h1,
.auth-panel h1 {
    margin: 0;
    font-family: "Aptos Display", "Trebuchet MS", "Segoe UI", sans-serif;
    font-size: clamp(2.1rem, 4vw, 3.3rem);
    line-height: 1.02;
    letter-spacing: -0.04em;
}

.app-card h2,
.auth-panel h2 {
    margin: 0;
    font-size: 1.55rem;
    letter-spacing: -0.03em;
}

.app-card--hero {
    display: grid;
    gap: 1.8rem;
}

.app-card--wide {
    grid-column: 1 / -1;
}

.app-lead {
    margin: 1rem 0 0;
    color: var(--site-text-muted);
    font-size: 1.05rem;
    line-height: 1.72;
}

.auth-layout {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
    align-items: start;
}

.panel-list {
    margin: 1.5rem 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.9rem;
}

.panel-list li {
    position: relative;
    padding-left: 1.35rem;
    line-height: 1.65;
    color: var(--site-text);
}

.panel-list li::before {
    content: "";
    position: absolute;
    top: 0.62rem;
    left: 0;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--site-accent), var(--site-primary));
}

.form-grid,
.field-grid {
    display: grid;
    gap: 1rem;
}

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

.field-group {
    margin: 0;
    padding: 0;
    border: 0;
}

.field {
    display: grid;
    gap: 0.45rem;
}

.field--full {
    grid-column: 1 / -1;
}

.field__label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--site-text);
}

.field__label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.field__input {
    width: 100%;
    min-height: 3.3rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(16, 33, 54, 0.14);
    border-radius: 16px;
    background: rgba(249, 251, 254, 0.9);
    color: var(--site-text);
    transition: border-color var(--site-transition), box-shadow var(--site-transition), background-color var(--site-transition);
}

.field__input:focus {
    border-color: rgba(16, 58, 107, 0.4);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(16, 58, 107, 0.08);
    outline: none;
}

.field__textarea {
    min-height: 10rem;
    resize: vertical;
}

.field__hint {
    color: var(--site-text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.field__error {
    color: #b03037;
    font-size: 0.92rem;
    line-height: 1.45;
}

.field-help {
    position: relative;
    flex: 0 0 auto;
}

.field-help__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    border: 1px solid rgba(16, 58, 107, 0.16);
    background: rgba(16, 58, 107, 0.06);
    color: var(--site-primary);
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.field-help__toggle::-webkit-details-marker {
    display: none;
}

.field-help__toggle:hover,
.field-help__toggle:focus-visible,
.field-help[open] .field-help__toggle {
    background: rgba(16, 58, 107, 0.12);
    border-color: rgba(16, 58, 107, 0.24);
    outline: none;
}

.field-help__panel {
    position: absolute;
    top: calc(100% + 0.55rem);
    right: 0;
    z-index: 20;
    width: min(21rem, 78vw);
    padding: 1rem 1.05rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(16, 33, 54, 0.1);
    box-shadow: 0 18px 40px rgba(16, 58, 107, 0.12);
}

.field-help__panel strong {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--site-text);
    font-size: 0.96rem;
}

.field-help__panel p {
    margin: 0.45rem 0 0;
    color: var(--site-text-muted);
    font-size: 0.9rem;
    line-height: 1.55;
}

.field-help__range {
    color: var(--site-primary);
    font-weight: 700;
}

.admin-limit-grid {
    align-items: start;
}

.admin-limit-field {
    padding: 1rem 1.05rem;
    border-radius: 20px;
    background: rgba(249, 251, 254, 0.92);
    border: 1px solid rgba(16, 33, 54, 0.08);
}

.captcha-box {
    padding: 1rem 1.1rem;
    border-radius: 20px;
    background: rgba(16, 58, 107, 0.05);
    border: 1px dashed rgba(16, 58, 107, 0.18);
}

.captcha-box__digits {
    margin-top: 0.55rem;
    font-family: "Consolas", "Courier New", monospace;
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    font-weight: 700;
    letter-spacing: 0.42em;
    color: var(--site-primary-deep);
}

.captcha-input {
    font-family: "Consolas", "Courier New", monospace;
    letter-spacing: 0.2em;
    font-size: 1.1rem;
}

.consent-box {
    display: grid;
    gap: 0.85rem;
    padding: 1rem 1.1rem;
    border-radius: 20px;
    background: rgba(16, 58, 107, 0.05);
    border: 1px solid rgba(16, 58, 107, 0.12);
}

.consent-box__list {
    display: grid;
    gap: 0.9rem;
}

.consent-box__label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    color: var(--site-text);
    line-height: 1.6;
}

.consent-box__label input {
    margin-top: 0.2rem;
    flex: 0 0 auto;
}

.consent-box__label a {
    color: var(--site-primary);
}

.consent-box--alert {
    background: linear-gradient(135deg, #ff2f2f 0%, #d11313 55%, #8f0000 100%);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 20px 48px rgba(143, 0, 0, 0.24);
}

.consent-box--alert .consent-box__label,
.consent-box--alert .field__hint,
.consent-box--alert .field__error {
    color: #ffffff;
}

.consent-box--alert .consent-box__label input {
    accent-color: #ffffff;
}

.consent-box--alert .consent-box__label a {
    color: #ffffff;
    text-decoration-color: rgba(255, 255, 255, 0.72);
}

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

.choice-card {
    display: grid;
    gap: 0.35rem;
    padding: 1rem 1.1rem;
    border-radius: 18px;
    border: 1px solid rgba(16, 33, 54, 0.12);
    background: rgba(249, 251, 254, 0.82);
    cursor: pointer;
}

.choice-card input {
    margin: 0 0 0.35rem;
}

.choice-card__title {
    font-weight: 700;
    color: var(--site-text);
}

.choice-card__text {
    color: var(--site-text-muted);
    line-height: 1.55;
}

[data-setup-form][data-driver="mysql"] [data-driver-section="sqlite"] {
    display: none;
}

[data-setup-form][data-driver="sqlite"] [data-driver-section="mysql"] {
    display: none;
}

.app-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.app-note {
    margin: 1.25rem 0 0;
    color: var(--site-text-muted);
    line-height: 1.6;
}

.app-note a,
.panel-list a {
    color: var(--site-primary);
}

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

.stat-card {
    padding: 1rem 1.1rem;
    border-radius: 20px;
    background: rgba(16, 58, 107, 0.05);
    border: 1px solid rgba(16, 58, 107, 0.08);
}

.stat-card__label {
    display: block;
    margin-bottom: 0.55rem;
    color: var(--site-text-muted);
    font-size: 0.9rem;
}

.stat-card strong {
    display: block;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

.section-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.case-list {
    display: grid;
    gap: 1rem;
}

.case-card {
    padding: 1.3rem;
    border-radius: 24px;
    background: rgba(249, 251, 254, 0.9);
    border: 1px solid rgba(16, 33, 54, 0.08);
}

.case-card__top {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
}

.case-card__eyebrow {
    display: inline-block;
    margin-bottom: 0.5rem;
    color: var(--site-primary);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.case-card h3 {
    margin: 0;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

.case-card__topic {
    margin: 0.85rem 0 0;
    color: var(--site-primary);
    font-weight: 700;
}

.case-card__description {
    margin: 0.75rem 0 0;
    color: var(--site-text-muted);
    line-height: 1.7;
}

.case-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem 1.5rem;
    margin-top: 1rem;
    color: var(--site-text-muted);
    font-size: 0.92rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-badge--new {
    background: rgba(16, 58, 107, 0.09);
    color: var(--site-primary);
}

.status-badge--in_progress {
    background: rgba(197, 155, 98, 0.16);
    color: #7d5a2c;
}

.status-badge--closed {
    background: rgba(69, 111, 78, 0.14);
    color: #2f6840;
}

.empty-state {
    padding: 1.5rem;
    border-radius: 24px;
    background: rgba(249, 251, 254, 0.9);
    border: 1px dashed rgba(16, 33, 54, 0.18);
}

.empty-state h3 {
    margin: 0;
}

.empty-state p {
    margin: 0.85rem 0 1.25rem;
    color: var(--site-text-muted);
    line-height: 1.65;
}

.profile-card {
    display: grid;
    gap: 1.2rem;
}

.profile-note {
    padding: 1rem 1.05rem;
    border-radius: 18px;
    background: rgba(16, 58, 107, 0.05);
}

.profile-note__label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--site-text-muted);
    font-size: 0.88rem;
}

.profile-note strong {
    display: block;
    font-size: 1rem;
}

.profile-note p {
    margin: 0.45rem 0 0;
    color: var(--site-text-muted);
}

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

.admin-shell {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.4fr);
    align-items: start;
}

.admin-directory,
.admin-insight,
.admin-activity-stack,
.admin-activity-group,
.admin-activity-list {
    display: grid;
    gap: 1rem;
}

.admin-user-list {
    display: grid;
    gap: 0.75rem;
    max-height: 780px;
    overflow: auto;
    padding-right: 0.25rem;
}

.admin-user-link,
.admin-activity-item {
    display: grid;
    gap: 0.45rem;
    padding: 1rem 1.05rem;
    border-radius: 20px;
    background: rgba(249, 251, 254, 0.94);
    border: 1px solid rgba(16, 33, 54, 0.08);
    transition: transform var(--site-transition), border-color var(--site-transition), box-shadow var(--site-transition);
}

.admin-user-link:hover,
.admin-user-link:focus-visible,
.admin-activity-item:hover,
.admin-activity-item:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(16, 58, 107, 0.22);
    box-shadow: 0 16px 30px rgba(16, 58, 107, 0.08);
}

.admin-user-link--active {
    background:
        radial-gradient(circle at top right, rgba(197, 155, 98, 0.16), transparent 45%),
        rgba(16, 58, 107, 0.08);
    border-color: rgba(16, 58, 107, 0.24);
}

.admin-user-link__main,
.admin-user-link__meta,
.admin-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.9rem;
}

.admin-user-link__main {
    align-items: baseline;
    justify-content: space-between;
}

.admin-user-link__main strong,
.admin-activity-item strong {
    color: var(--site-text);
    font-size: 1rem;
}

.admin-user-link__main span,
.admin-user-link__meta span,
.admin-detail-lead,
.admin-detail-meta span,
.admin-activity-item span {
    color: var(--site-text-muted);
    line-height: 1.55;
}

.admin-user-link__meta {
    font-size: 0.9rem;
}

.admin-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.admin-detail-header h3 {
    margin: 0;
    font-size: 1.45rem;
    letter-spacing: -0.03em;
}

.admin-detail-lead {
    margin: 0.55rem 0 0;
}

.admin-detail-meta {
    justify-content: flex-end;
    font-size: 0.92rem;
}

.admin-stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

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

.admin-status-list {
    display: grid;
    gap: 0.7rem;
}

.admin-status-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid rgba(16, 33, 54, 0.08);
}

.admin-status-item span {
    color: var(--site-text-muted);
}

.admin-status-item strong {
    font-size: 1rem;
    color: var(--site-text);
}

.admin-activity-item {
    background: #ffffff;
}

.admin-activity-item--static {
    cursor: default;
}

.admin-activity-item--static:hover,
.admin-activity-item--static:focus-visible {
    transform: none;
}

.admin-activity-item__amount {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    width: fit-content;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-weight: 700;
}

.admin-activity-item__amount--credit {
    background: rgba(69, 111, 78, 0.14);
    color: #2f6840;
}

.admin-activity-item__amount--debit {
    background: rgba(155, 41, 49, 0.08);
    color: #9b2931;
}

.admin-users-shell {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: minmax(240px, 20%) minmax(0, 1fr);
    align-items: start;
}

.admin-users-selection,
.admin-users-sidebar,
.admin-users-content {
    display: grid;
    gap: 1.25rem;
}

.admin-users-sidebar {
    position: sticky;
    top: 1rem;
}

.admin-users-directory {
    display: grid;
    gap: 0.75rem;
    max-height: 72vh;
    overflow: auto;
    padding-right: 0.2rem;
}

.admin-users-selection .admin-users-directory {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.admin-users-directory__item {
    display: grid;
    gap: 0.3rem;
    padding: 0.95rem 1rem;
    border-radius: 20px;
    background: rgba(249, 251, 254, 0.94);
    border: 1px solid rgba(16, 33, 54, 0.08);
    transition: transform var(--site-transition), border-color var(--site-transition), box-shadow var(--site-transition);
}

.admin-users-directory__item:hover,
.admin-users-directory__item:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(16, 58, 107, 0.22);
    box-shadow: 0 16px 30px rgba(16, 58, 107, 0.08);
}

.admin-users-directory__item--active {
    background:
        radial-gradient(circle at top right, rgba(197, 155, 98, 0.16), transparent 45%),
        rgba(16, 58, 107, 0.08);
    border-color: rgba(16, 58, 107, 0.24);
}

.admin-users-directory__item strong {
    color: var(--site-text);
    font-size: 0.98rem;
    word-break: break-word;
}

.admin-users-directory__item span,
.admin-users-meta span,
.admin-users-fact span {
    color: var(--site-text-muted);
    line-height: 1.55;
}

.admin-users-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.admin-users-tabs__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.7rem;
    padding: 0.7rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(16, 33, 54, 0.1);
    background: rgba(249, 251, 254, 0.92);
    color: var(--site-text-muted);
    font-weight: 700;
    transition: background var(--site-transition), color var(--site-transition), border-color var(--site-transition);
}

.admin-users-tabs__link:hover,
.admin-users-tabs__link:focus-visible,
.admin-users-tabs__link--active {
    background: rgba(16, 58, 107, 0.08);
    color: var(--site-primary);
    border-color: rgba(16, 58, 107, 0.2);
}

.admin-users-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.9rem;
}

.admin-users-facts {
    display: grid;
    gap: 0.8rem;
}

.admin-users-fact {
    display: grid;
    gap: 0.25rem;
    padding: 0.95rem 1rem;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid rgba(16, 33, 54, 0.08);
}

.admin-users-fact strong {
    color: var(--site-text);
}

.admin-users-danger {
    background: rgba(155, 41, 49, 0.05);
    border-color: rgba(155, 41, 49, 0.12);
}

.detail-hero {
    gap: 1.5rem;
}

.detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.section-caption {
    color: var(--site-text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: right;
}

.resource-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
}

.resource-panel {
    display: grid;
    gap: 1rem;
    padding: 1.35rem;
    border-radius: 24px;
    background: rgba(249, 251, 254, 0.92);
    border: 1px solid rgba(16, 33, 54, 0.08);
}

.resource-panel h3 {
    margin: 0;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

.resource-panel--spaced {
    margin-top: 1.5rem;
}

.resource-list {
    display: grid;
    gap: 1rem;
}

.resource-card {
    padding: 1.2rem;
    border-radius: 22px;
    background: #ffffff;
    border: 1px solid rgba(16, 33, 54, 0.08);
}

.resource-card--compact {
    padding: 1rem 1.1rem;
}

.resource-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.resource-card h3 {
    margin: 0;
    font-size: 1.08rem;
    letter-spacing: -0.02em;
}

.resource-card__meta {
    margin: 0.7rem 0 0;
    color: var(--site-text-muted);
    line-height: 1.6;
}

.resource-card__text {
    margin: 0.75rem 0 0;
    color: var(--site-text);
    line-height: 1.72;
}

.resource-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.resource-actions--top {
    margin-top: 1.15rem;
}

.section-note {
    margin: 0;
    color: var(--site-text-muted);
    line-height: 1.65;
}

.subtle-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: rgba(16, 58, 107, 0.08);
    color: var(--site-primary);
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.subtle-badge--status {
    background: rgba(197, 155, 98, 0.18);
    color: #7d5a2c;
}

.subtle-badge--status-success {
    background: rgba(69, 111, 78, 0.16);
    color: #2f6840;
}

.subtle-badge--status-warning {
    background: rgba(197, 155, 98, 0.18);
    color: #7d5a2c;
}

.subtle-badge--status-danger {
    background: rgba(176, 48, 55, 0.14);
    color: #a02b33;
}

.subtle-badge--status-neutral {
    background: rgba(16, 33, 54, 0.08);
    color: var(--site-text-muted);
}

.subtle-badge--ai-ready {
    background: rgba(69, 111, 78, 0.16);
    color: #2f6840;
}

.subtle-badge--ai-processing,
.subtle-badge--ai-pending {
    background: rgba(16, 58, 107, 0.08);
    color: var(--site-primary);
}

.subtle-badge--ai-error {
    background: rgba(176, 48, 55, 0.14);
    color: #a02b33;
}

.subtle-badge--chat-draft {
    background: rgba(16, 58, 107, 0.08);
    color: var(--site-primary);
}

.subtle-badge--chat-ready {
    background: rgba(69, 111, 78, 0.16);
    color: #2f6840;
}

.subtle-badge--chat-processing {
    background: rgba(197, 155, 98, 0.18);
    color: #7d5a2c;
    animation: anxb-status-pulse 1.8s ease-in-out infinite;
}

.subtle-badge--chat-error {
    background: rgba(176, 48, 55, 0.14);
    color: #a02b33;
}

.subtle-badge--chat-archived {
    background: rgba(16, 33, 54, 0.08);
    color: var(--site-text-muted);
}

.text-link {
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    cursor: pointer;
    color: var(--site-primary);
}

.text-link:hover,
.text-link:focus-visible {
    color: var(--site-primary-deep);
}

.text-link--danger {
    color: #b03037;
}

.text-link--danger:hover,
.text-link--danger:focus-visible {
    color: #8f1d24;
}

.field__textarea--compact {
    min-height: 7rem;
}

.field__file {
    padding-block: 0.75rem;
    background: rgba(255, 255, 255, 0.94);
}

.empty-state--compact {
    padding: 1.25rem;
}

.placeholder-card--inner {
    max-width: none;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.placeholder-card--inner .placeholder-card__lead {
    margin: 0;
}

.setup-note p {
    margin: 0;
    color: var(--site-text-muted);
    line-height: 1.68;
}

.message-list {
    display: grid;
    gap: 0.9rem;
}

.message-card {
    padding: 1rem 1.1rem;
    border-radius: 22px;
    border: 1px solid rgba(16, 33, 54, 0.08);
    background: #ffffff;
}

.message-card--user {
    background: rgba(16, 58, 107, 0.05);
}

.message-card--assistant {
    background: rgba(249, 251, 254, 0.96);
}

.message-card--system {
    background: rgba(176, 48, 55, 0.05);
    border-color: rgba(176, 48, 55, 0.16);
}

.message-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.7rem;
    color: var(--site-text-muted);
    font-size: 0.9rem;
}

.message-card__body {
    color: var(--site-text);
    line-height: 1.72;
}

.message-sources {
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px solid rgba(16, 33, 54, 0.08);
}

.message-sources__title {
    display: block;
    margin-bottom: 0.55rem;
    color: var(--site-primary);
    font-size: 0.92rem;
}

.message-sources__list {
    margin: 0;
    padding-left: 1.1rem;
    display: grid;
    gap: 0.45rem;
}

.message-sources__item {
    color: var(--site-text-muted);
    line-height: 1.5;
}

.button--danger {
    color: #ffffff;
    background: linear-gradient(135deg, #9b2931 0%, #c53d47 100%);
    box-shadow: 0 18px 34px rgba(155, 41, 49, 0.22);
}

.button--danger:hover,
.button--danger:focus-visible {
    background: linear-gradient(135deg, #872229 0%, #b3343e 100%);
}

.button--danger-ghost {
    color: #9b2931;
    background: rgba(155, 41, 49, 0.08);
    border-color: rgba(155, 41, 49, 0.18);
}

.button--danger-ghost:hover,
.button--danger-ghost:focus-visible {
    background: rgba(155, 41, 49, 0.14);
}

.case-shell,
.chat-shell {
    display: grid;
    gap: 1.5rem;
    align-items: start;
}

.case-shell {
    grid-template-columns: minmax(0, 1fr);
}

.chat-shell {
    grid-template-columns: minmax(0, 1fr);
}

.case-sidebar,
.chat-sidebar {
    position: sticky;
    top: 1rem;
    display: grid;
    gap: 1rem;
}

.chat-sidebar {
    max-height: calc(100vh - 2rem);
    overflow: auto;
}

.case-sidebar__top,
.chat-sidebar__top {
    display: grid;
    gap: 0.75rem;
}

.case-sidebar__top .eyebrow,
.chat-sidebar__top .eyebrow {
    margin-bottom: 0;
}

.case-sidebar__stats {
    display: grid;
    gap: 0.75rem;
}

.case-sidebar__stat {
    display: grid;
    gap: 0.2rem;
    padding: 0.95rem 1rem;
    border-radius: 18px;
    background: rgba(16, 58, 107, 0.05);
}

.case-sidebar__stat span {
    color: var(--site-text-muted);
    font-size: 0.88rem;
}

.case-sidebar__stat strong {
    font-size: 1rem;
}

.case-sidebar__actions {
    display: grid;
    gap: 0.75rem;
}

.case-danger {
    display: grid;
    gap: 0.85rem;
    padding: 1rem 1.05rem;
    border-radius: 20px;
    background: rgba(155, 41, 49, 0.06);
    border: 1px solid rgba(155, 41, 49, 0.1);
}

.case-danger p {
    margin: 0;
    color: var(--site-text-muted);
    line-height: 1.6;
}

.case-main {
    display: grid;
    gap: 1.5rem;
}

.case-main--full {
    max-width: 1120px;
    width: 100%;
    margin: 0 auto;
}

.case-section {
    display: grid;
    gap: 1.25rem;
}

.upload-dropzone {
    position: relative;
    display: block;
    cursor: pointer;
}

.upload-dropzone.is-uploading {
    cursor: progress;
}

.upload-dropzone__input,
.chat-upload-form__input {
    position: absolute;
    inset: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.chat-upload-form {
    display: contents;
}

.upload-dropzone__body {
    display: grid;
    place-items: center;
    gap: 0.55rem;
    min-height: 112px;
    padding: 1.1rem 1rem;
    border-radius: 26px;
    border: 1px dashed rgba(16, 58, 107, 0.22);
    background:
        radial-gradient(circle at top left, rgba(197, 155, 98, 0.12), transparent 42%),
        rgba(249, 251, 254, 0.96);
    text-align: center;
    transition: border-color var(--site-transition), transform var(--site-transition), box-shadow var(--site-transition);
}

.upload-dropzone:hover .upload-dropzone__body,
.upload-dropzone.is-dragover .upload-dropzone__body {
    border-color: rgba(16, 58, 107, 0.38);
    box-shadow: 0 18px 40px rgba(16, 58, 107, 0.08);
    transform: translateY(-2px);
}

.upload-dropzone.is-uploading .upload-dropzone__body,
[data-chat-upload-area].is-uploading .chat-composer__input,
[data-chat-upload-area].is-uploading .composer-plus {
    cursor: progress;
    opacity: 0.82;
    box-shadow: none;
    transform: none;
}

.upload-dropzone__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.7rem;
    height: 2.7rem;
    border-radius: 50%;
    background: rgba(16, 58, 107, 0.08);
    color: var(--site-primary);
    font-size: 1.55rem;
    line-height: 1;
}

.upload-dropzone__hint {
    color: var(--site-text-muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.upload-progress {
    display: grid;
    gap: 0.55rem;
    margin-top: 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: 18px;
    background: rgba(16, 58, 107, 0.08);
    color: var(--site-primary);
}

.upload-progress[hidden] {
    display: none;
}

.upload-progress[data-state="error"] {
    background: rgba(173, 53, 53, 0.1);
    color: #8f2f2f;
}

.upload-progress[data-state="success"] {
    background: rgba(29, 122, 74, 0.12);
    color: #145938;
}

.upload-progress__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.upload-progress__label,
.upload-progress__percent {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.4;
}

.upload-progress__percent {
    white-space: nowrap;
}

.upload-progress__track {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 0.45rem;
    border-radius: 999px;
    background: rgba(16, 58, 107, 0.14);
}

.upload-progress__bar {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: currentColor;
    transition: width 0.18s ease-out;
}

.upload-progress__detail {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.file-stack,
.chat-row-list {
    display: grid;
    gap: 0.9rem;
}

.file-row,
.chat-row {
    display: grid;
    gap: 0.9rem;
    padding: 1.2rem;
    border-radius: 24px;
    background: rgba(249, 251, 254, 0.94);
    border: 1px solid rgba(16, 33, 54, 0.08);
}

.file-row__main,
.file-row__meta,
.chat-row__head,
.chat-row__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
}

.file-row__main {
    align-items: flex-start;
}

.file-row__info {
    display: grid;
    gap: 0.35rem;
}

.file-row__info h3,
.chat-row__head h3 {
    margin: 0;
    font-size: 1.08rem;
    letter-spacing: -0.02em;
}

.file-row__info p,
.chat-row__text {
    margin: 0;
    color: var(--site-text-muted);
    line-height: 1.65;
}

.file-row__meta {
    justify-content: flex-start;
    color: var(--site-text-muted);
    font-size: 0.9rem;
}

.file-row__summary {
    margin: 0;
    color: var(--site-text);
    line-height: 1.7;
}

.chat-create-card {
    display: grid;
    gap: 1rem;
    padding: 1.35rem;
    border-radius: 24px;
    background: rgba(249, 251, 254, 0.92);
    border: 1px solid rgba(16, 33, 54, 0.08);
}

.chat-create-card h3 {
    margin: 0;
}

.billing-list {
    display: grid;
    gap: 1rem;
}

.billing-row {
    display: grid;
    gap: 0.9rem;
    padding: 1.2rem;
    border-radius: 24px;
    background: rgba(249, 251, 254, 0.94);
    border: 1px solid rgba(16, 33, 54, 0.08);
}

.billing-row__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.billing-row__top h3 {
    margin: 0;
    font-size: 1.08rem;
    letter-spacing: -0.02em;
}

.billing-row__amount {
    display: inline-flex;
    align-items: center;
    min-height: 2.4rem;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-weight: 700;
    white-space: nowrap;
}

.billing-row__amount--credit {
    background: rgba(69, 111, 78, 0.14);
    color: #2f6840;
}

.billing-row__amount--debit {
    background: rgba(155, 41, 49, 0.08);
    color: #9b2931;
}

.billing-row__metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem 1rem;
    color: var(--site-text-muted);
    font-size: 0.9rem;
}

.billing-row__summary {
    margin: 0;
    color: var(--site-text-muted);
    line-height: 1.6;
}

.chat-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
}

.chat-row__body {
    display: grid;
    gap: 0.8rem;
}

.chat-sidebar__section {
    display: grid;
    gap: 0.75rem;
    padding: 1rem 1.05rem;
    border-radius: 20px;
    background: rgba(16, 58, 107, 0.05);
}

.chat-sidebar__label {
    color: var(--site-text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.chat-sidebar__text {
    margin: 0;
    color: var(--site-text-muted);
    line-height: 1.65;
}

.chat-nav,
.chat-file-list {
    display: grid;
    gap: 0.6rem;
}

.chat-attachments-panel {
    display: grid;
    gap: 0.7rem;
    margin: 0;
}

.chat-attachments-panel__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    background: rgba(249, 251, 254, 0.82);
    border: 1px solid rgba(16, 33, 54, 0.08);
    cursor: pointer;
    list-style: none;
    transition: border-color var(--site-transition), box-shadow var(--site-transition), background-color var(--site-transition);
}

.chat-attachments-panel__summary::-webkit-details-marker {
    display: none;
}

.chat-attachments-panel__summary:hover,
.chat-attachments-panel[open] .chat-attachments-panel__summary {
    border-color: rgba(16, 58, 107, 0.18);
    box-shadow: 0 10px 22px rgba(16, 58, 107, 0.08);
    background: #ffffff;
}

.chat-attachments-panel__summary-main {
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

.chat-attachments-panel__summary-main strong {
    color: var(--site-text);
    font-size: 0.96rem;
}

.chat-attachments-panel__summary-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    flex-shrink: 0;
}

.chat-attachments-panel__chevron {
    width: 0.75rem;
    height: 0.75rem;
    border-right: 2px solid rgba(16, 58, 107, 0.52);
    border-bottom: 2px solid rgba(16, 58, 107, 0.52);
    transform: rotate(45deg) translateY(-1px);
    transition: transform var(--site-transition);
}

.chat-attachments-panel[open] .chat-attachments-panel__chevron {
    transform: rotate(-135deg) translateY(-1px);
}

.chat-attachments-panel__body {
    display: grid;
    gap: 0.9rem;
    padding: 1rem 1.05rem;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(16, 33, 54, 0.08);
    box-shadow: 0 16px 34px rgba(15, 32, 53, 0.1);
}

.chat-attachments-panel:not([open]) .chat-attachments-panel__body {
    display: none;
}

.chat-attachments-panel__empty {
    margin: 0;
    color: var(--site-text-muted);
    line-height: 1.6;
}

.case-files-panel {
    margin-top: 0.15rem;
}

.chat-nav__item,
.chat-file-pill {
    display: grid;
    gap: 0.28rem;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(16, 33, 54, 0.08);
    transition: border-color var(--site-transition), transform var(--site-transition), box-shadow var(--site-transition);
}

.chat-nav__item:hover,
.chat-nav__item:focus-visible,
.chat-file-pill:hover,
.chat-file-pill:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(16, 58, 107, 0.2);
    box-shadow: 0 12px 24px rgba(16, 58, 107, 0.08);
}

.chat-nav__item--active {
    background: rgba(16, 58, 107, 0.09);
    border-color: rgba(16, 58, 107, 0.2);
}

.chat-file-pill--active {
    background: rgba(16, 58, 107, 0.06);
    border-color: rgba(16, 58, 107, 0.26);
    box-shadow: 0 14px 30px rgba(16, 58, 107, 0.1);
}

.chat-nav__title,
.chat-file-pill__title {
    font-weight: 700;
    color: var(--site-text);
}

.chat-file-pill__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.chat-nav__meta,
.chat-file-pill__meta {
    color: var(--site-text-muted);
    font-size: 0.86rem;
    line-height: 1.5;
}

.chat-file-pill__meta--status {
    color: var(--site-primary);
    font-weight: 600;
}

.chat-file-pill__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-top: 0.2rem;
}

.app-page--chat {
    padding-top: 1.2rem;
    padding-bottom: 2rem;
}

.chat-main {
    display: grid;
    gap: 1rem;
}

.chat-main--full {
    max-width: 880px;
    width: 100%;
    margin: 0 auto;
}

.chat-main__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 1.25rem;
    min-width: 0;
}

.chat-main__header > div {
    min-width: 0;
    flex: 1 1 auto;
}

.chat-main__header h1 {
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

.chat-main__lead {
    margin: 0.75rem 0 0;
    color: var(--site-text-muted);
    line-height: 1.65;
}

.chat-main__status {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chat-thread {
    display: grid;
    gap: 0.9rem;
    align-content: start;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.35rem;
}

.chat-empty {
    padding: 1.5rem;
    border-radius: 24px;
    border: 1px dashed rgba(16, 33, 54, 0.18);
    background: rgba(249, 251, 254, 0.92);
}

.chat-empty h3,
.chat-empty p {
    margin: 0;
}

.chat-empty p {
    margin-top: 0.8rem;
    color: var(--site-text-muted);
    line-height: 1.65;
}

.chat-bubble {
    max-width: 100%;
    width: 100%;
    min-width: 0;
    padding: 1rem 1.15rem;
    border-radius: 16px;
    border: 1px solid rgba(16, 33, 54, 0.08);
    background: #ffffff;
    margin-left: 0;
    margin-right: 0;
}

.chat-bubble--assistant {
    border-bottom-left-radius: 8px;
    background: rgba(249, 251, 254, 0.96);
}

.chat-bubble--user {
    border-bottom-right-radius: 8px;
    background: rgba(16, 58, 107, 0.06);
    border-color: rgba(16, 58, 107, 0.14);
}

.chat-bubble--system {
    width: 100%;
    background: rgba(176, 48, 55, 0.06);
    border-color: rgba(176, 48, 55, 0.16);
}

.chat-bubble--pending {
    border-style: dashed;
    background:
        linear-gradient(135deg, rgba(16, 58, 107, 0.06), rgba(197, 155, 98, 0.08)),
        rgba(249, 251, 254, 0.98);
}

.chat-bubble__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.7rem;
    color: var(--site-text-muted);
    font-size: 0.88rem;
}

.chat-bubble__body {
    line-height: 1.72;
    color: var(--site-text);
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;
}

.chat-bubble__body p,
.chat-bubble__body li,
.chat-bubble__body h1,
.chat-bubble__body h2,
.chat-bubble__body h3,
.chat-bubble__body h4,
.chat-bubble__body h5,
.chat-bubble__body h6,
.chat-bubble__body a {
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;
}

.chat-bubble__body code {
    overflow-wrap: anywhere;
    word-break: break-all;
}

.message-sources__item,
.message-sources__item a {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.chat-bubble__body > :first-child {
    margin-top: 0;
}

.chat-bubble__body > :last-child {
    margin-bottom: 0;
}

.chat-bubble__body p,
.chat-bubble__body ul,
.chat-bubble__body ol,
.chat-bubble__body pre,
.chat-bubble__body blockquote,
.chat-bubble__body table,
.chat-bubble__body hr {
    margin: 0.9rem 0 0;
}

.chat-bubble__body h1,
.chat-bubble__body h2,
.chat-bubble__body h3,
.chat-bubble__body h4,
.chat-bubble__body h5,
.chat-bubble__body h6 {
    margin: 1.15rem 0 0.55rem;
    line-height: 1.3;
    font-weight: 700;
    color: var(--site-primary-deep);
}

.chat-bubble__body h1 {
    font-size: 1.34rem;
}

.chat-bubble__body h2 {
    font-size: 1.22rem;
}

.chat-bubble__body h3 {
    font-size: 1.1rem;
}

.chat-bubble__body h4,
.chat-bubble__body h5,
.chat-bubble__body h6 {
    font-size: 1rem;
}

.chat-bubble__body ul,
.chat-bubble__body ol {
    padding-left: 1.35rem;
}

.chat-bubble__body li + li {
    margin-top: 0.35rem;
}

.chat-bubble__body li > ul,
.chat-bubble__body li > ol {
    margin-top: 0.5rem;
}

.chat-bubble__body blockquote {
    padding: 0.85rem 1rem;
    border-left: 4px solid rgba(16, 58, 107, 0.24);
    border-radius: 18px;
    background: rgba(16, 58, 107, 0.06);
    color: var(--site-text-muted);
}

.chat-bubble__body blockquote > :first-child {
    margin-top: 0;
}

.chat-bubble__body blockquote > :last-child {
    margin-bottom: 0;
}

.chat-bubble__body hr {
    border: 0;
    height: 1px;
    background: rgba(16, 33, 54, 0.14);
}

.chat-bubble__body code,
.chat-markdown__image-label {
    display: inline-block;
    padding: 0.14rem 0.4rem;
    border-radius: 8px;
    background: rgba(16, 33, 54, 0.08);
    font-family: "Cascadia Code", "Consolas", monospace;
    font-size: 0.92em;
}

.chat-markdown__image-label {
    color: var(--site-text-muted);
}

.chat-bubble__body pre {
    padding: 0.95rem 1rem;
    border-radius: 18px;
    overflow: auto;
    background: #0f2035;
    color: #eef4ff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.chat-bubble__body pre code {
    display: block;
    padding: 0;
    background: transparent;
    color: inherit;
    font-size: 0.9rem;
    line-height: 1.68;
}

.chat-bubble__body a {
    color: var(--site-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

.chat-bubble__body table {
    display: block;
    width: max-content;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    border-spacing: 0;
    border: 1px solid var(--site-line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
}

.chat-bubble__body thead tr {
    background: rgba(16, 58, 107, 0.07);
}

.chat-bubble__body th,
.chat-bubble__body td {
    padding: 0.65rem 0.8rem;
    border-right: 1px solid var(--site-line);
    border-bottom: 1px solid var(--site-line);
    text-align: left;
    vertical-align: top;
}

.chat-bubble__body th:last-child,
.chat-bubble__body td:last-child {
    border-right: 0;
}

.chat-bubble__body tbody tr:last-child td {
    border-bottom: 0;
}

.chat-bubble__state {
    display: inline-flex;
    margin-left: 0.45rem;
    color: var(--site-primary);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.chat-progress {
    margin-top: 0.9rem;
    padding-top: 0.85rem;
    border-top: 1px solid rgba(16, 33, 54, 0.08);
}

.chat-progress__list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.7rem;
}

.chat-progress__item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.7rem;
    align-items: start;
}

.chat-progress__marker {
    width: 0.9rem;
    height: 0.9rem;
    margin-top: 0.18rem;
    border-radius: 50%;
    background: rgba(16, 58, 107, 0.16);
    box-shadow: inset 0 0 0 1px rgba(16, 58, 107, 0.14);
}

.chat-progress__item--done .chat-progress__marker {
    background: rgba(44, 115, 78, 0.18);
    box-shadow: inset 0 0 0 1px rgba(44, 115, 78, 0.24);
}

.chat-progress__item--current .chat-progress__marker {
    background: rgba(16, 58, 107, 0.9);
    box-shadow: 0 0 0 6px rgba(16, 58, 107, 0.08);
    animation: anxb-status-pulse 1.4s ease-in-out infinite;
}

.chat-progress__content {
    display: grid;
    gap: 0.2rem;
}

.chat-progress__label {
    font-size: 0.92rem;
    line-height: 1.45;
}

.chat-progress__detail,
.chat-progress__summary {
    margin: 0;
    color: var(--site-text-muted);
    font-size: 0.9rem;
    line-height: 1.55;
}

.chat-progress__summary {
    margin-top: 0.85rem;
    color: var(--site-primary);
    font-weight: 700;
}

.chat-progress__current-file {
    margin-top: 0.85rem;
    padding: 0.8rem 0.9rem;
    border-radius: 16px;
    background: rgba(16, 58, 107, 0.06);
    border: 1px solid rgba(16, 58, 107, 0.12);
}

.chat-progress__current-file-title,
.chat-progress__current-file-name,
.chat-progress__current-file-meta {
    display: block;
}

.chat-progress__current-file-title {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--site-primary);
}

.chat-progress__current-file-name,
.chat-progress__current-file-meta {
    margin: 0.35rem 0 0;
}

.chat-progress__current-file-name {
    color: var(--site-text);
    font-weight: 600;
    line-height: 1.5;
}

.chat-progress__current-file-meta {
    color: var(--site-text-muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

/* ── Clarification bubble ── */

.chat-bubble--clarification {
    border-left: 3px solid #f59e0b;
    background: rgba(245, 158, 11, 0.04);
}

.chat-bubble__badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.12rem 0.55rem;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.4;
    vertical-align: middle;
}

.chat-bubble__badge--clarification {
    color: #92400e;
    background: rgba(245, 158, 11, 0.14);
}

/* ── Confidence indicator ── */

.chat-bubble__badge--confidence-high {
    color: #065f46;
    background: rgba(16, 185, 129, 0.14);
}

.chat-bubble__badge--confidence-medium {
    color: #92400e;
    background: rgba(245, 158, 11, 0.14);
}

.chat-bubble__badge--confidence-low {
    color: #6b7280;
    background: rgba(107, 114, 128, 0.12);
}

/* ── Context card ── */

.chat-context-card {
    margin-top: 0.9rem;
    padding-top: 0.7rem;
    border-top: 1px solid rgba(16, 33, 54, 0.08);
    font-size: 0.88rem;
}

.chat-context-card__summary {
    cursor: pointer;
    color: var(--site-text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    user-select: none;
    list-style: none;
}

.chat-context-card__summary::-webkit-details-marker {
    display: none;
}

.chat-context-card__summary::before {
    content: "\25B6";
    display: inline-block;
    margin-right: 0.4rem;
    font-size: 0.7rem;
    transition: transform 0.15s ease;
}

.chat-context-card[open] .chat-context-card__summary::before {
    transform: rotate(90deg);
}

.chat-context-card__list {
    margin: 0.5rem 0 0;
    padding-left: 1.1rem;
    display: grid;
    gap: 0.3rem;
    color: var(--site-text-muted);
    line-height: 1.55;
}

.chat-context-card__reason {
    font-style: italic;
    opacity: 0.8;
}

/* ── Quick reply buttons ── */

.chat-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(245, 158, 11, 0.18);
}

.chat-quick-reply {
    padding: 0.42rem 1rem;
    border: 1.5px solid rgba(16, 58, 107, 0.18);
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(249, 251, 254, 0.95) 0%, rgba(240, 245, 252, 0.95) 100%);
    color: var(--site-primary, #103a6b);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.45;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 3px rgba(16, 33, 54, 0.06);
}

.chat-quick-reply:hover {
    background: linear-gradient(135deg, rgba(16, 58, 107, 0.08) 0%, rgba(16, 58, 107, 0.04) 100%);
    border-color: rgba(16, 58, 107, 0.32);
    box-shadow: 0 2px 6px rgba(16, 33, 54, 0.1);
    transform: translateY(-1px);
}

.chat-quick-reply:active {
    background: rgba(16, 58, 107, 0.12);
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(16, 33, 54, 0.08);
}

.chat-composer-stack {
    position: sticky;
    bottom: 1rem;
    display: grid;
    gap: 0.6rem;
    z-index: 7;
}

.chat-attachments-section {
    margin-top: 0.2rem;
}

/* ── Inline pill composer (chat-view): icons-inside-input ──
   Specificity .chat-composer.chat-composer--pill (2 classes) overrides base .chat-composer
   regardless of file order — pill becomes flex one-liner instead of inheriting 3-col grid. */
.chat-composer.chat-composer--pill {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.45rem;
    border-radius: 22px;
    border: 1px solid rgba(16, 33, 54, 0.14);
    background: rgba(249, 251, 254, 0.95);
    transition: border-color var(--site-transition), box-shadow var(--site-transition), background-color var(--site-transition);
    grid-template-columns: none;
}

.chat-composer.chat-composer--pill:focus-within {
    background: #ffffff;
    border-color: rgba(16, 58, 107, 0.4);
    box-shadow: 0 0 0 4px rgba(16, 58, 107, 0.08);
}

.chat-composer.chat-composer--pill .chat-composer__input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 2.4rem;
    max-height: 240px;
    padding: 0.5rem 0.5rem;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    line-height: 1.5;
    width: auto;
}

.chat-composer.chat-composer--pill .chat-composer__input:focus {
    outline: none;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

.chat-composer.chat-composer--pill .chat-composer__input:disabled,
.chat-composer.chat-composer--pill .chat-composer__input[readonly] {
    background: transparent;
}

.composer-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.3rem;
    height: 2.3rem;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--site-text-muted, #5b6b7e);
    border-radius: 999px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color var(--site-transition), color var(--site-transition), transform var(--site-transition);
}

.composer-icon svg {
    width: 1.2rem;
    height: 1.2rem;
}

.composer-icon:hover:not(:disabled),
.composer-icon:focus-visible:not(:disabled) {
    background: rgba(16, 58, 107, 0.08);
    color: var(--site-primary, #103a6b);
    outline: none;
}

.composer-icon:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.composer-icon--send {
    background: var(--site-primary, #103a6b);
    color: #ffffff;
}

.composer-icon--send:hover:not(:disabled),
.composer-icon--send:focus-visible:not(:disabled) {
    background: var(--site-primary-deep, #0c2a52);
    color: #ffffff;
    transform: translateY(-1px);
}

.composer-icon--send svg {
    width: 1.05rem;
    height: 1.05rem;
}

.composer-icon__badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 10px;
    background: var(--site-primary, #103a6b);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* ── Files popover (above composer) ── */
.chat-files-popover {
    background: #ffffff;
    border: 1px solid rgba(16, 33, 54, 0.1);
    border-radius: 18px;
    box-shadow: 0 18px 40px rgba(15, 32, 53, 0.14);
    padding: 0.5rem 0.6rem;
    max-height: 50vh;
    overflow-y: auto;
}

.chat-files-popover[hidden] {
    display: none;
}

/* Reuse existing chat-attachments-panel inside popover but flatten the nested chrome */
.chat-files-popover .chat-attachments-panel {
    gap: 0.5rem;
    margin: 0;
}

.chat-files-popover .chat-attachments-panel__summary {
    display: none;
}

/* Override default <details> hide-when-not-open: in popover the body is always visible.
   Specificity (0,4,0) beats existing .chat-attachments-panel:not([open]) .chat-attachments-panel__body (0,3,0). */
.chat-files-popover .chat-attachments-panel .chat-attachments-panel__body,
.chat-files-popover .chat-attachments-panel:not([open]) .chat-attachments-panel__body {
    display: grid;
    gap: 0.6rem;
    padding: 0.4rem;
    border-radius: 14px;
    background: transparent;
    border: none;
    box-shadow: none;
}

.chat-composer {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: end;
}

.chat-composer--busy {
    opacity: 0.92;
}

.composer-plus {
    width: 3.2rem;
    height: 3.2rem;
    border: 1px solid rgba(16, 33, 54, 0.12);
    border-radius: 18px;
    background: rgba(249, 251, 254, 0.95);
    color: var(--site-primary);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    transition: transform var(--site-transition), background-color var(--site-transition), border-color var(--site-transition);
}

.composer-plus:hover,
.composer-plus:focus-visible {
    transform: translateY(-1px);
    background: #ffffff;
    border-color: rgba(16, 58, 107, 0.24);
}

.composer-plus:disabled,
.chat-composer .button:disabled {
    cursor: wait;
    opacity: 0.7;
    transform: none;
    box-shadow: none;
}

.chat-composer__input {
    width: 100%;
    min-height: 3.3rem;
    max-height: 280px;
    padding: 0.9rem 1rem;
    border-radius: 20px;
    border: 1px solid rgba(16, 33, 54, 0.14);
    background: rgba(249, 251, 254, 0.95);
    color: var(--site-text);
    resize: none;
    transition: border-color var(--site-transition), box-shadow var(--site-transition), background-color var(--site-transition);
}

.chat-composer__input:focus {
    outline: none;
    background: #ffffff;
    border-color: rgba(16, 58, 107, 0.4);
    box-shadow: 0 0 0 4px rgba(16, 58, 107, 0.08);
}

.chat-composer__input:disabled {
    cursor: wait;
    color: var(--site-text-muted);
    background: rgba(249, 251, 254, 0.72);
}

.chat-composer__input[readonly] {
    cursor: wait;
    color: var(--site-text-muted);
    background: rgba(249, 251, 254, 0.72);
}

.composer-send {
    min-width: 8.5rem;
    min-height: 3.2rem;
}

.chat-upload-feedback {
    margin: 0;
}

.site-body--modal-open {
    overflow: hidden;
}

.upload-warning-modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: rgba(66, 0, 0, 0.52);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--site-transition);
    z-index: 1000;
}

.upload-warning-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.upload-warning-modal__dialog {
    width: min(100%, 560px);
    display: grid;
    gap: 1rem;
    padding: 1.5rem;
    border-radius: 28px;
    background: linear-gradient(180deg, #ff3d3d 0%, #b10000 100%);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 28px 60px rgba(66, 0, 0, 0.3);
}

.upload-warning-modal__title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.upload-warning-modal__text {
    margin: 0;
    font-size: 1rem;
    line-height: 1.65;
}

.upload-warning-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-end;
}

.upload-warning-modal__button {
    min-width: 7.5rem;
    min-height: 3rem;
    padding: 0.8rem 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: transform var(--site-transition), box-shadow var(--site-transition), background-color var(--site-transition);
}

.upload-warning-modal__button:hover,
.upload-warning-modal__button:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(66, 0, 0, 0.22);
    outline: none;
}

.upload-warning-modal__button--secondary {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.upload-warning-modal__button--primary {
    background: #ffffff;
    color: #9c0000;
}

[data-chat-upload-area].is-dragover .chat-composer__input,
[data-chat-upload-area].is-dragover .composer-plus {
    border-color: rgba(16, 58, 107, 0.3);
    box-shadow: 0 0 0 4px rgba(16, 58, 107, 0.08);
    background: #ffffff;
}

/* Case-create chat-style layout */
.chat-bubble--welcome {
    border-style: solid;
    border-color: rgba(16, 58, 107, 0.18);
    background: linear-gradient(145deg, rgba(16, 58, 107, 0.04), rgba(197, 155, 98, 0.05));
}

.chat-thread--welcome {
    flex: 1;
    min-height: 0;
    padding: 1.25rem 0.75rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.case-create-attachments {
    padding: 0.6rem 0.85rem;
    background: rgba(16, 58, 107, 0.04);
    border: 1px solid rgba(16, 33, 54, 0.08);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.case-create-attachments__label {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--site-text-muted, #5b6472);
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

.case-create-attachments__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.case-create-attachments__item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.6rem;
    align-items: center;
    padding: 0.35rem 0.6rem;
    background: #ffffff;
    border: 1px solid rgba(16, 33, 54, 0.06);
    border-radius: 10px;
    font-size: 0.85rem;
}

.case-create-attachments__icon {
    color: var(--site-primary, #103a6b);
}

.case-create-attachments__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.case-create-attachments__size {
    color: var(--site-text-muted, #5b6472);
    font-variant-numeric: tabular-nums;
    font-size: 0.78rem;
}

.case-create-hint {
    margin: 0;
    font-size: 0.78rem;
    color: var(--site-text-muted, #5b6472);
    text-align: center;
}

[data-case-create-stack].case-create-stack--drag .chat-composer__input,
[data-case-create-stack].case-create-stack--drag .composer-plus {
    border-color: rgba(16, 58, 107, 0.3);
    box-shadow: 0 0 0 4px rgba(16, 58, 107, 0.08);
    background: #ffffff;
}

.btn--active {
    opacity: 0.85;
    pointer-events: none;
}

@keyframes anxb-status-pulse {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.68;
    }
}

@media (max-width: 1180px) {
    .case-shell,
    .chat-shell {
        grid-template-columns: 1fr;
    }

    .case-sidebar,
    .chat-sidebar {
        position: static;
        max-height: none;
    }
}

@media (max-width: 960px) {
    .app-grid,
    .auth-layout,
    .admin-users-shell {
        grid-template-columns: 1fr;
    }

    .app-card--wide {
        grid-column: auto;
    }

    .admin-users-sidebar {
        position: static;
    }

    .admin-users-selection .admin-users-directory {
        grid-template-columns: 1fr;
    }

    .admin-shell,
    .admin-detail-grid,
    .stat-grid,
    .resource-grid,
    .choice-grid,
    .field-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .app-page {
        padding: 2rem 0 4rem;
    }

    .section-header {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-detail-header,
    .admin-user-link__main,
    .admin-users-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .detail-head,
    .case-card__top {
        flex-direction: column;
    }

    .section-caption {
        text-align: left;
    }

    .field-help__panel {
        right: auto;
        left: 0;
        width: min(20rem, calc(100vw - 4rem));
    }

    .chat-main {
        min-height: auto;
        grid-template-rows: auto auto auto auto;
    }

    .chat-main__header,
    .chat-row,
    .chat-row__head,
    .chat-file-pill__top {
        display: grid;
    }

    .chat-attachments-panel__summary {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .chat-attachments-panel__summary-main {
        min-width: 0;
        width: 100%;
    }

    .chat-attachments-panel__summary-meta {
        width: 100%;
        justify-content: space-between;
    }

    .chat-thread {
        max-height: none;
        min-height: 0;
        overflow: visible;
        padding-right: 0;
    }

    .chat-composer {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .composer-send {
        grid-column: 1 / -1;
        width: 100%;
    }

    .upload-warning-modal {
        padding: 1rem;
    }

    .upload-warning-modal__dialog {
        padding: 1.25rem;
        border-radius: 24px;
    }

    .upload-warning-modal__actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .upload-warning-modal__button {
        width: 100%;
    }
}

/* ---------- Responsive: Small Mobile ---------- */
@media (max-width: 480px) {
    .app-page {
        padding: 1.5rem 0 3rem;
    }

    .app-card,
    .auth-panel {
        padding: 1rem;
        border-radius: 16px;
    }

    .app-card h1,
    .auth-panel h1 {
        font-size: 1.75rem;
    }

    .captcha-box__digits {
        font-size: 1.4rem;
        letter-spacing: 0.3em;
    }
}

/* ---------- Responsive: Mobile chat content wrap & overflow ---------- */
@media (max-width: 720px) {
    .chat-bubble {
        overflow: hidden;
    }

    .chat-bubble__body pre {
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    .chat-bubble__body table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .chat-bubble__body th,
    .chat-bubble__body td {
        min-width: 8rem;
    }

    .message-sources__list {
        padding-left: 1rem;
    }
}

@media (max-width: 480px) {
    .chat-quick-replies {
        gap: 0.4rem;
    }

    .chat-quick-reply {
        padding: 0.35rem 0.7rem;
        font-size: 0.8rem;
        flex: 0 1 auto;
        min-width: 0;
        max-width: 100%;
        word-break: break-word;
        overflow-wrap: anywhere;
    }
}

/* ---------- Desktop chat layout: compact header, flex-fill thread, compact composer ---------- */
@media (min-width: 769px) {
    .chat-main__header {
        padding: 0.5rem 1rem;
        gap: 0.6rem;
        align-items: center;
    }

    .chat-main__header h1 {
        font-size: 1.1rem;
        line-height: 1.25;
        margin: 0;
    }

    .chat-main__header .eyebrow {
        font-size: 0.72rem;
        letter-spacing: 0.1em;
        margin: 0 0 0.15rem;
        line-height: 1.3;
        max-height: 2.6em;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .chat-main__header .eyebrow::before {
        display: none;
    }

    .chat-main__status {
        gap: 0.35rem;
        flex: 0 0 auto;
    }

    .chat-main__status .subtle-badge {
        min-height: 1.5rem;
        padding: 0.2rem 0.6rem;
        font-size: 0.74rem;
    }

    .chat-layout__main > .chat-main {
        gap: 0.4rem;
        min-height: 0;
    }

    .chat-layout__main .chat-thread {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        padding-right: 0.35rem;
    }

    .chat-layout__main .chat-composer-stack {
        position: static;
        bottom: auto;
        flex-shrink: 0;
        gap: 0.45rem;
    }

    .chat-layout__main .chat-attachments-section {
        margin-top: 0;
        flex-shrink: 0;
    }

    .chat-layout__main .composer-plus {
        width: 2.6rem;
        height: 2.6rem;
        font-size: 1.4rem;
        border-radius: 14px;
    }

    .chat-layout__main .chat-composer__input {
        min-height: 2.6rem;
        padding: 0.55rem 0.9rem;
        border-radius: 16px;
    }

    .chat-layout__main .composer-send {
        min-width: 6.5rem;
        min-height: 2.6rem;
        padding: 0.5rem 1.1rem;
    }

    .chat-layout__main .chat-attachments-panel {
        gap: 0.4rem;
    }

    .chat-layout__main .chat-attachments-panel__summary {
        padding: 0.45rem 0.85rem;
        border-radius: 14px;
    }

    .chat-layout__main .chat-attachments-panel__summary-main strong {
        font-size: 0.88rem;
    }

    .chat-layout__main .chat-attachments-panel__body {
        padding: 0.75rem 0.85rem;
        border-radius: 16px;
    }
}
