/* =============================================
   PSC ASSISTANT — CSS
   Only contains what Tailwind cannot handle:
   - CSS custom properties (design tokens)
   - Keyframe animations
   - Scrollbar styling
   - JS-generated dynamic classes (bubbles, FAQs, etc.)
   - Complex :focus-within / :nth-child selectors
   ============================================= */

:root {
    --psc-app-height: 100dvh;
    --psc-yellow: #D29C1B;
    --psc-yellow-soft: #E9C36A;
    --psc-green: #0B7A3B;
    --psc-green-deep: #075C2D;
    --psc-red: #C4484D;
    --psc-ink: #111111;
    --psc-muted: #6B7280;
    --psc-surface: rgba(255, 255, 255, 0.74);
    --psc-surface-strong: rgba(255, 255, 255, 0.92);
    --psc-surface-soft: rgba(255, 253, 246, 0.96);
    --psc-line: rgba(20, 20, 20, 0.08);
    --psc-line-strong: rgba(20, 20, 20, 0.14);
    --psc-panel-shadow:
        0 20px 48px rgba(15, 23, 42, 0.1),
        0 6px 18px rgba(15, 23, 42, 0.05);
    --psc-card-shadow:
        0 18px 34px rgba(15, 23, 42, 0.1),
        0 3px 10px rgba(15, 23, 42, 0.04);
    --psc-card-shadow-hover:
        0 26px 44px rgba(15, 23, 42, 0.13),
        0 10px 18px rgba(15, 23, 42, 0.06);
    --psc-composer-shadow:
        0 18px 36px rgba(15, 23, 42, 0.1),
        0 3px 10px rgba(15, 23, 42, 0.04);
    --psc-brand-gradient: linear-gradient(135deg, #C4484D 0%, #D29C1B 48%, #0B7A3B 100%);
    --psc-user-gradient: linear-gradient(135deg, #151515 0%, #1f7a48 135%);
    --psc-assistant-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 251, 232, 0.98) 100%);
    --psc-human-gradient: linear-gradient(180deg, rgba(242, 250, 245, 0.98) 0%, rgba(255, 255, 255, 0.98) 100%);
    --psc-system-gradient: linear-gradient(180deg, rgba(255, 248, 214, 0.98) 0%, rgba(255, 255, 255, 0.98) 100%);
    --psc-card-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 252, 239, 0.9) 100%);
    --psc-card-gradient-soft: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(252, 255, 253, 0.92) 100%);
}

html,
body {
    height: 100%;
    min-height: 100%;
}

body.psc-page {
    margin: 0;
    overflow: hidden;
    min-height: var(--psc-app-height);
    background:
        radial-gradient(circle at top right, rgba(210, 156, 27, 0.16), transparent 28%),
        radial-gradient(circle at 12% 20%, rgba(196, 72, 77, 0.1), transparent 24%),
        radial-gradient(circle at bottom left, rgba(45, 158, 95, 0.1), transparent 24%),
        #f7f3e8;
}

.chat-app-shell {
    align-items: stretch;
    min-height: var(--psc-app-height);
    height: var(--psc-app-height);
    max-height: var(--psc-app-height);
}

.surface-panel,
#chat-sidebar,
.chat-main {
    position: relative;
    isolation: isolate;
}

.surface-panel::before {
    content: "";
    position: absolute;
    inset: 1px 1px auto 1px;
    height: 28%;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0));
    pointer-events: none;
    z-index: -1;
}

.surface-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.3);
    pointer-events: none;
    mix-blend-mode: screen;
}

/* ---- Animated background ---- */

.psc-background::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 18% 22%, rgba(255, 245, 196, 0.35), transparent 24%),
        radial-gradient(circle at 22% 78%, rgba(196, 72, 77, 0.11), transparent 22%),
        radial-gradient(circle at 82% 18%, rgba(217, 255, 230, 0.22), transparent 24%),
        radial-gradient(circle at 50% 100%, rgba(255, 255, 255, 0.18), transparent 30%);
}

.psc-mesh,
.psc-orb,
.psc-grid {
    position: absolute;
}

.psc-mesh {
    filter: blur(38px);
    opacity: 0.52;
    animation: driftMesh 20s ease-in-out infinite alternate;
}

.psc-mesh-one {
    top: -14%;
    left: -16%;
    width: 52vw;
    height: 52vw;
    background: radial-gradient(circle at 35% 35%, rgba(210, 156, 27, 0.28), transparent 68%);
}

.psc-mesh-two {
    right: -18%;
    bottom: -22%;
    width: 58vw;
    height: 58vw;
    background: radial-gradient(circle at 40% 40%, rgba(45, 158, 95, 0.16), transparent 70%);
    animation-duration: 24s;
}

.psc-orb {
    border-radius: 999px;
    filter: blur(16px);
    opacity: 0.38;
    animation: floatOrb 16s ease-in-out infinite;
}

.psc-orb-one {
    top: 10%;
    right: 12%;
    width: 14rem;
    height: 14rem;
    background: radial-gradient(circle, rgba(255, 232, 135, 0.46), rgba(255, 232, 135, 0));
}

.psc-orb-two {
    left: 10%;
    bottom: 10%;
    width: 13rem;
    height: 13rem;
    background: radial-gradient(circle, rgba(143, 223, 178, 0.34), rgba(143, 223, 178, 0));
    animation-delay: 1.8s;
}

.psc-grid {
    inset: 0;
    background-image:
        linear-gradient(rgba(20, 20, 20, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(20, 20, 20, 0.025) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.44), transparent 75%);
    opacity: 0.22;
}

/* ---- Sidebar open state (toggled by JS) ---- */

body.sidebar-open {
    overflow: hidden;
}

body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
}

body.sidebar-open #chat-sidebar {
    transform: translateX(0);
}

#chat-sidebar,
.chat-main {
    box-shadow: var(--psc-panel-shadow);
    min-height: 0;
}

#chat-sidebar {
    position: relative;
    z-index: 20;
    scrollbar-gutter: stable;
    overscroll-behavior: contain;
}

.chat-main {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) auto;
    align-items: stretch;
    position: relative;
    z-index: 10;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.72)),
        linear-gradient(135deg, rgba(255, 245, 214, 0.32), rgba(255, 241, 241, 0.16) 40%, rgba(237, 255, 244, 0.18));
    min-height: 0;
}

.sidebar-new-chat {
    position: relative;
    overflow: hidden;
    box-shadow:
        0 18px 30px rgba(45, 158, 95, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.sidebar-new-chat::before {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0));
    pointer-events: none;
}

.sidebar-new-chat:active {
    transform: translateY(1px);
}

.chat-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.chat-thread {
    width: min(100%, 800px);
    min-height: 0;
    padding-top: 0.75rem;
    padding-bottom: 0.35rem;
}

.chat-scroll {
    overscroll-behavior-y: contain;
    scroll-behavior: smooth;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.welcome-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: clamp(18rem, 42vh, 23rem);
    gap: 0.75rem;
    padding-top: 1rem;
    padding-bottom: 2rem;
}

#welcome-state.hidden {
    display: none !important;
}

.psc-brand-shell {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 250, 240, 0.42)),
        linear-gradient(135deg, rgba(210, 156, 27, 0.08), rgba(196, 72, 77, 0.06) 48%, rgba(11, 122, 59, 0.08) 100%);
}

.psc-brand-lockup,
.psc-topbar-brand {
    display: grid;
    align-items: center;
    grid-template-columns: auto minmax(0, 1fr);
}

.psc-brand-lockup {
    gap: 0.9rem;
}

.psc-topbar-brand {
    gap: 0.78rem;
    min-width: 0;
}

.psc-hero-lockup {
    width: min(100%, 780px);
    display: grid;
    justify-items: center;
    gap: 0.95rem;
    padding: 1.1rem 1.25rem;
    border-radius: 1.8rem;
    border: 1px solid rgba(20, 20, 20, 0.08);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 251, 241, 0.9)),
        linear-gradient(135deg, rgba(210, 156, 27, 0.12), rgba(196, 72, 77, 0.08) 44%, rgba(11, 122, 59, 0.1) 100%);
    box-shadow: var(--psc-card-shadow);
}

.psc-brand-copy,
.psc-hero-copy {
    min-width: 0;
}

.psc-brand-copy {
    display: grid;
    gap: 0.1rem;
}

.psc-hero-copy {
    display: grid;
    gap: 0.42rem;
    justify-items: center;
    text-align: center;
}

.psc-brand-kicker,
.psc-hero-kicker {
    margin: 0;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(20, 20, 20, 0.5);
}

.psc-hero-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(210, 156, 27, 0.14);
    border: 1px solid rgba(210, 156, 27, 0.2);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: rgba(20, 20, 20, 0.76);
}

.psc-brand-logo {
    display: block;
    object-fit: contain;
    object-position: center;
    flex-shrink: 0;
    filter: drop-shadow(0 10px 18px rgba(15, 23, 42, 0.14));
}

.psc-brand-logo-combined {
    width: 4.9rem;
    height: auto;
}

.psc-topbar-brand .psc-brand-logo-combined {
    width: 4rem;
}

.psc-hero-logo-combined {
    width: min(34vw, 7rem);
    height: auto;
}

.chat-composer-shell {
    position: relative;
    flex-shrink: 0;
    z-index: 2;
}

.chat-composer-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.24));
    pointer-events: none;
}

.chat-composer {
    display: flex;
    align-items: flex-end;
    position: relative;
    overflow: hidden;
    box-shadow: var(--psc-composer-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.chat-composer::before {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0)),
        linear-gradient(135deg, rgba(255, 252, 236, 0.65), rgba(244, 255, 250, 0.15));
    pointer-events: none;
}

#chat-input {
    position: relative;
    z-index: 1;
    font-size: 1rem;
    line-height: 1.58;
}

#send-button {
    position: relative;
    z-index: 1;
    box-shadow:
        0 16px 28px rgba(45, 158, 95, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

#send-button:active {
    transform: translateY(1px);
}

/* ---- Custom scrollbars ---- */

#chat-sidebar::-webkit-scrollbar,
.chat-scroll::-webkit-scrollbar {
    width: 6px;
}

#chat-sidebar::-webkit-scrollbar-track,
.chat-scroll::-webkit-scrollbar-track {
    background: transparent;
}

#chat-sidebar::-webkit-scrollbar-thumb,
.chat-scroll::-webkit-scrollbar-thumb {
    background: rgba(20, 20, 20, 0.14);
    border-radius: 999px;
}

/* ---- JS-generated FAQ items ---- */

.faq-group {
    display: grid;
    gap: 0.72rem;
}

.faq-group-title {
    padding-left: 0.14rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(20, 20, 20, 0.54);
}

.faq-list {
    display: grid;
    gap: 0.58rem;
}

.faq-item {
    position: relative;
    overflow: hidden;
    appearance: none;
    border: 1px solid rgba(20, 20, 20, 0.07);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 251, 237, 0.92));
    border-radius: 1.15rem;
    padding: 0.82rem 0.9rem;
    text-align: left;
    font: inherit;
    font-size: 0.88rem;
    line-height: 1.48;
    color: var(--psc-ink);
    cursor: pointer;
    box-shadow:
        0 12px 24px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.55);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.faq-item::before {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0));
    pointer-events: none;
}

.faq-item:hover,
.faq-item:focus-visible {
    transform: translate3d(3px, -2px, 0);
    border-color: rgba(244, 196, 0, 0.42);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 250, 229, 0.96));
    box-shadow: var(--psc-card-shadow-hover);
    outline: none;
}

/* ---- JS-generated suggestion cards ---- */

.suggestion-card {
    position: relative;
    overflow: hidden;
    appearance: none;
    border: 1px solid rgba(20, 20, 20, 0.08);
    border-radius: 1.35rem;
    background: var(--psc-card-gradient);
    padding: 0.9rem 0.95rem;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0;
    font: inherit;
    color: var(--psc-ink);
    cursor: pointer;
    box-shadow: var(--psc-card-shadow);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.suggestion-card::before {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0)),
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.28), transparent 32%);
    pointer-events: none;
}

.suggestion-card:hover,
.suggestion-card:focus-visible {
    transform: translate3d(0, -4px, 0) scale(1.01);
    border-color: rgba(244, 196, 0, 0.42);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(255, 249, 223, 0.94));
    box-shadow: var(--psc-card-shadow-hover);
    outline: none;
}

.suggestion-card-title {
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.34;
}

/* ---- JS-generated message rows ---- */

.message-row {
    margin-bottom: 1rem;
    animation: messageRise 0.24s ease both;
}

.message-row.user {
    display: flex;
    justify-content: flex-end;
}

.message-row.assistant {
    display: flex;
    justify-content: flex-start;
}

.assistant-cluster,
.user-cluster {
    display: flex;
    gap: 0.92rem;
    width: 100%;
}

.assistant-cluster {
    align-items: flex-end;
    max-width: min(86%, 100%);
}

.user-cluster {
    margin-left: auto;
    flex-direction: column;
    align-items: flex-end;
    max-width: min(70%, 100%);
}

.assistant-avatar {
    width: 2.65rem;
    height: 2.65rem;
    border-radius: 1rem;
    background-color: #fffdf8;
    background-image: url("../img/psc-commission-logo.png");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 78% auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    font-size: 0;
    line-height: 0;
    text-indent: -9999px;
    box-shadow:
        0 14px 24px rgba(15, 23, 42, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.26);
    flex-shrink: 0;
}

.assistant-avatar-human {
    background-image: none;
    background: linear-gradient(135deg, #0B7A3B 0%, #9de2bf 100%);
    color: var(--psc-ink);
    font-size: 0.8rem;
    line-height: 1;
    text-indent: 0;
}

.assistant-avatar-system {
    background-image: none;
    background: linear-gradient(135deg, #fff1af 0%, #C7A008 100%);
    color: var(--psc-ink);
    font-size: 0.8rem;
    line-height: 1;
    text-indent: 0;
}

.message-stack {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-width: 0;
    width: 100%;
}

.message-role-label,
.assistant-role-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.message-role-label {
    align-self: flex-end;
    color: rgba(20, 20, 20, 0.52);
}

.assistant-role-label {
    align-self: flex-start;
    color: rgba(20, 20, 20, 0.56);
}

.assistant-role-label-human {
    color: rgba(29, 124, 73, 0.9);
}

.assistant-role-label-system {
    color: rgba(158, 116, 0, 0.92);
}

.message-bubble {
    border-radius: 1.45rem;
    padding: 0.88rem 1rem;
    font-size: 0.94rem;
    line-height: 1.7;
    word-break: break-word;
    box-shadow:
        0 12px 24px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.assistant-bubble {
    background: var(--psc-assistant-gradient);
    color: var(--psc-ink);
    border: 1px solid var(--psc-line);
    border-bottom-left-radius: 0.52rem;
}

.human-bubble {
    background: var(--psc-human-gradient);
    border: 1px solid var(--psc-line);
    border-color: rgba(45, 158, 95, 0.18);
    border-bottom-left-radius: 0.52rem;
}

.user-bubble {
    align-self: flex-end;
    background: var(--psc-user-gradient);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom-right-radius: 0.52rem;
}

.system-bubble {
    background: var(--psc-system-gradient);
    border: 1px dashed rgba(244, 196, 0, 0.26);
    border-bottom-left-radius: 0.52rem;
}

.bubble-prose p {
    margin: 0 0 0.56em;
}

.bubble-prose p:last-child,
.bubble-prose ul:last-child,
.bubble-prose ol:last-child {
    margin-bottom: 0;
}

.bubble-prose ul,
.bubble-prose ol {
    margin: 0.56em 0;
    padding-left: 1.2rem;
}

.bubble-prose li {
    margin-bottom: 0.24em;
}

.bubble-prose strong {
    font-weight: 700;
}

.message-time {
    font-size: 0.72rem;
    color: rgba(20, 20, 20, 0.48);
}

.user-cluster .message-time {
    align-self: flex-end;
}

/* ---- Message summary grid (JS-generated) ---- */

.message-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.76rem;
}

.summary-item {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(20, 20, 20, 0.07);
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 251, 238, 0.9));
    padding: 0.78rem 0.82rem;
    box-shadow:
        0 10px 22px rgba(15, 23, 42, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.summary-item::before {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0));
    pointer-events: none;
}

.summary-label {
    margin-bottom: 0.28rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(20, 20, 20, 0.52);
}

.summary-value {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--psc-ink);
}

/* ---- Rich cards (JS-generated) ---- */

.rich-card-grid {
    display: grid;
    gap: 0.8rem;
}

.rich-card {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(20, 20, 20, 0.07);
    border-radius: 1.25rem;
    background: var(--psc-card-gradient-soft);
    padding: 0.92rem 0.95rem;
    box-shadow: var(--psc-card-shadow);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.rich-card::before {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0)),
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.22), transparent 28%);
    pointer-events: none;
}

.rich-card:hover,
.rich-card:focus-within {
    transform: translateY(-2px);
    box-shadow: var(--psc-card-shadow-hover);
}

.rich-card-title {
    margin: 0 0 0.38rem;
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--psc-ink);
}

.rich-card-description {
    margin: 0 0 0.82rem;
    font-size: 0.88rem;
    line-height: 1.56;
    color: var(--psc-muted);
}

/* ---- Action buttons (JS-generated) ---- */

.action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.66rem;
}

.chat-action {
    position: relative;
    overflow: hidden;
    appearance: none;
    border: 1px solid transparent;
    border-radius: 999px;
    min-height: 2.65rem;
    padding: 0.72rem 0.96rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--psc-ink);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.chat-action::before {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0));
    pointer-events: none;
}

.chat-action:hover,
.chat-action:focus-visible {
    transform: translateY(-2px);
    outline: none;
}

.chat-action-primary {
    background: var(--psc-brand-gradient);
    box-shadow:
        0 14px 26px rgba(45, 158, 95, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.chat-action-secondary {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 250, 235, 0.92));
    border-color: rgba(20, 20, 20, 0.08);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.06);
}

.chat-action-ghost {
    background: rgba(255, 255, 255, 0.72);
    border-color: rgba(20, 20, 20, 0.08);
    color: var(--psc-muted);
}

/* ---- Feedback (JS-generated) ---- */

.feedback-row,
.feedback-reasons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
}

.feedback-label,
.feedback-note {
    font-size: 0.8rem;
    color: rgba(20, 20, 20, 0.56);
}

.feedback-button,
.feedback-chip {
    appearance: none;
    border: 1px solid var(--psc-line);
    background: rgba(255, 255, 255, 0.94);
    border-radius: 999px;
    padding: 0.46rem 0.82rem;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--psc-ink);
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.feedback-button:hover,
.feedback-button:focus-visible,
.feedback-chip:hover,
.feedback-chip:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(244, 196, 0, 0.42);
    background: rgba(255, 253, 246, 0.98);
    outline: none;
}

/* ---- Typing indicator dots ---- */

.typing-bubble span {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    background: rgba(20, 20, 20, 0.46);
    animation: pulseDot 1.1s ease-in-out infinite;
}

.typing-bubble span:nth-child(2) { animation-delay: 0.16s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.32s; }

/* ---- Responsive refinements ---- */

@media (max-width: 1279.98px) {
    .chat-thread {
        width: min(100%, 760px);
    }

    .welcome-state {
        min-height: clamp(17rem, 40vh, 21rem);
        padding-bottom: 1.75rem;
    }

    .welcome-suggestions {
        gap: 0.75rem;
    }

    .assistant-cluster {
        max-width: min(90%, 100%);
    }

    .user-cluster {
        max-width: min(74%, 100%);
    }

    .psc-hero-lockup {
        width: min(100%, 720px);
    }
}

@media (max-width: 1023.98px) {
    .chat-thread {
        width: min(100%, 700px);
    }

    .welcome-state {
        min-height: clamp(16rem, 38vh, 20rem);
        padding-top: 0.75rem;
        padding-bottom: 1.35rem;
    }

    .message-row {
        margin-bottom: 0.9rem;
    }

    .assistant-avatar {
        width: 2.45rem;
        height: 2.45rem;
    }

    .psc-topbar-brand .psc-brand-logo-combined {
        width: 3.7rem;
    }

    .psc-hero-lockup {
        gap: 0.95rem;
        padding: 1rem;
    }

    .psc-hero-logo-combined {
        width: min(35vw, 6.2rem);
    }
}

@media (max-width: 767.98px) {
    .chat-app-shell {
        display: block !important;
        padding: 0 !important;
        gap: 0 !important;
        height: var(--psc-app-height);
        min-height: var(--psc-app-height);
        max-height: var(--psc-app-height);
        overflow: hidden;
    }

    #chat-sidebar {
        position: fixed !important;
        inset: 0 auto 0 0 !important;
        z-index: 50 !important;
        width: min(84vw, 304px) !important;
        height: var(--psc-app-height) !important;
        min-height: var(--psc-app-height) !important;
        max-height: var(--psc-app-height) !important;
        border-top-left-radius: 0 !important;
        border-bottom-left-radius: 0 !important;
        border-top-right-radius: 1.6rem !important;
        border-bottom-right-radius: 1.6rem !important;
        background: rgba(255, 255, 255, 0.96) !important;
        box-shadow:
            0 24px 44px rgba(15, 23, 42, 0.2),
            0 8px 22px rgba(15, 23, 42, 0.12) !important;
        transform: translate3d(-105%, 0, 0);
        will-change: transform;
    }

    .chat-main {
        display: grid !important;
        grid-template-rows: auto minmax(0, 1fr) auto !important;
        width: 100% !important;
        height: var(--psc-app-height) !important;
        min-height: var(--psc-app-height) !important;
        max-height: var(--psc-app-height) !important;
        border-radius: 0 !important;
        border-left-width: 0 !important;
        border-right-width: 0 !important;
        box-shadow: none !important;
    }

    .chat-topbar,
    .chat-composer-shell {
        flex-shrink: 0;
    }

    .chat-scroll {
        min-height: 0 !important;
        height: auto !important;
        max-height: none !important;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .chat-thread {
        width: 100%;
        max-width: 100%;
        min-height: 0;
    }

    .surface-panel::before,
    .surface-panel::after {
        display: none;
    }

    .psc-mesh {
        filter: blur(28px);
        opacity: 0.34;
    }

    .psc-orb {
        opacity: 0.26;
    }

    .psc-grid {
        opacity: 0.12;
    }

    .chat-main {
        background: rgba(255, 255, 255, 0.88);
    }

    .chat-thread {
        width: min(100%, 100%);
        padding-top: 0.5rem;
        padding-bottom: 0.1rem;
    }

    .welcome-state {
        min-height: auto;
        gap: 0.6rem;
        padding-top: 0.5rem;
        padding-bottom: 0.45rem;
    }

    .welcome-suggestions {
        display: none;
    }

    .assistant-cluster,
    .user-cluster {
        max-width: 100%;
        gap: 0.7rem;
    }

    .user-cluster {
        max-width: min(88%, 100%);
    }

    .assistant-cluster {
        align-items: flex-start;
    }

    .assistant-avatar {
        width: 2.3rem;
        height: 2.3rem;
        border-radius: 0.85rem;
    }

    .message-bubble {
        padding: 0.82rem 0.92rem;
        font-size: 0.92rem;
    }

    .chat-composer {
        box-shadow:
            0 12px 22px rgba(15, 23, 42, 0.08),
            0 2px 8px rgba(15, 23, 42, 0.04);
    }

    .chat-action {
        min-height: 2.55rem;
        padding: 0.68rem 0.88rem;
    }

    .action-group {
        gap: 0.5rem;
    }

    .psc-brand-lockup {
        gap: 0.75rem;
        padding-right: 3.1rem;
    }

    .psc-brand-logo-combined {
        width: 4.2rem;
    }

    .psc-topbar-brand {
        gap: 0.65rem;
    }

    .psc-topbar-brand .psc-brand-logo-combined {
        width: 3.2rem;
    }

    .psc-hero-lockup {
        gap: 0.78rem;
        padding: 0.9rem 0.82rem;
        border-radius: 1.45rem;
    }

    .psc-hero-logo-combined {
        width: 5.4rem;
    }
}

@media (max-width: 767.98px) and (orientation: landscape) {
    .welcome-state {
        min-height: 12.5rem;
        padding-top: 0.25rem;
        padding-bottom: 0.75rem;
    }
}

@media (max-width: 560px) {
    .faq-item,
    .suggestion-card,
    .rich-card {
        border-radius: 1.1rem;
    }

    .welcome-state {
        min-height: auto;
    }

    .assistant-cluster {
        max-width: 100%;
    }

    .user-cluster {
        max-width: min(92%, 100%);
    }

    .message-summary {
        grid-template-columns: 1fr;
    }

    .psc-brand-lockup,
    .psc-topbar-brand,
    .psc-hero-lockup {
        gap: 0.58rem;
    }

    .psc-brand-kicker,
    .psc-hero-kicker {
        font-size: 0.62rem;
        letter-spacing: 0.1em;
    }

    .psc-brand-logo-combined {
        width: 3.7rem;
    }

    .psc-topbar-brand .psc-brand-logo-combined {
        width: 2.9rem;
    }

    .psc-hero-pill {
        padding: 0.38rem 0.68rem;
        font-size: 0.68rem;
    }

    .psc-hero-logo-combined {
        width: 4.85rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---- Keyframes ---- */

@keyframes driftMesh {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(3%, -3%, 0) scale(1.08); }
}

@keyframes floatOrb {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50%       { transform: translate3d(0, -16px, 0); }
}

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

@keyframes pulseDot {
    0%, 80%, 100% { transform: scale(0.84); opacity: 0.45; }
    40%            { transform: scale(1); opacity: 1; }
}
