/* CSS Variables - Brand Colors */
:root {
    --color-brandWhite: #fffef6;
    --color-brandBlack: #292724;
    --color-brandBeige: #f9f4d2;
    --color-brandRed: #f5333f;
    --color-brandGrey: #7B736c;
    --color-brandBlue: #27aae1;
    --color-brandGreen: #8fb73e;
    --color-brandPurple: #a03c9b;
    --color-brandYellow: #decb00;

    --font-sans: "Work Sans", Helvetica Neue, Helvetica, Arial, sans-serif;
    --font-serif: "Zilla Slab", Courier Bold, Courier, Georgia, Times, Times New Roman, serif;

    --shadow-sm: 0 1px 2px rgba(41, 39, 36, 0.1);
    --shadow-md: 0 4px 6px rgba(41, 39, 36, 0.1);
    --radius: 8px;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base */
html {
    height: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-brandBlack);
    background-color: var(--color-brandWhite);
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Layout */
.container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    flex-shrink: 0;
}

.header-logo {
    flex-shrink: 0;
}

.header-logo img {
    height: 50px;
    width: auto;
    display: block;
}

.header-text {
    text-align: left;
    flex: 1;
}

.header h1 {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--color-brandRed);
    margin-bottom: 0.25rem;
}

.header-text .subtitle {
    font-size: 0.875rem;
    color: var(--color-brandBlack);
    margin: 0;
}

.subtitle {
    font-size: 0.875rem;
    color: var(--color-brandBlack);
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--color-brandBeige);
    border-radius: var(--radius);
    box-shadow: 0 0 0 1px rgba(41, 39, 36, 0.08),
                0 2px 4px rgba(41, 39, 36, 0.08),
                0 8px 16px rgba(41, 39, 36, 0.12);
    overflow: hidden;
    min-height: 0;
    position: relative;
}

/* Messages Area */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: inset 0 8px 8px -8px rgba(41, 39, 36, 0.15);
}

/* Individual Message */
.message {
    display: flex;
    max-width: 85%;
    position: relative;
}

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

.message.assistant {
    align-self: flex-start;
}

/* Message actions bar (below message, Claude-style) */
.message-actions {
    display: flex;
    gap: 0.25rem;
    padding-top: 0.375rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.message:hover .message-actions,
.message-actions:focus-within {
    opacity: 1;
}

.message-copy-btn {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--color-brandGrey);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background-color 0.15s;
}

.message-copy-btn:hover {
    color: var(--color-brandBlack);
    background: rgba(0, 0, 0, 0.05);
}

.message-copy-btn.copied {
    color: var(--color-brandGreen);
}

.message-content {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    line-height: 1.6;
}

.message.user .message-content {
    background: var(--color-brandBlue);
    color: white;
    border-bottom-right-radius: 2px;
}

.message.assistant .message-content {
    background: var(--color-brandWhite);
    color: var(--color-brandBlack);
    border-bottom-left-radius: 2px;
}

.message-content p {
    margin-bottom: 0.5rem;
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* Markdown content styling */
.message-content ul,
.message-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message-content li {
    margin-bottom: 0.25rem;
}

.message-content strong {
    font-weight: 600;
}

.message-content em {
    font-style: italic;
}

.message-content code {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.9em;
}

.message-content blockquote {
    border-left: 3px solid var(--color-brandGrey);
    margin: 0.5rem 0;
    padding-left: 1rem;
    color: var(--color-brandGrey);
}

.message-content h1,
.message-content h2,
.message-content h3 {
    font-family: var(--font-serif);
    margin: 1rem 0 0.5rem;
}

.message-content h1:first-child,
.message-content h2:first-child,
.message-content h3:first-child {
    margin-top: 0;
}

/* Loading indicator */
.message.loading .message-content {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 1rem 1.25rem;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--color-brandGrey);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Initial loading state for first-time visitors */
.message.initial-loading .message-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 1rem;
    min-height: 150px;
}

.initial-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.loading-text {
    font-size: 0.875rem;
    color: var(--color-brandGrey);
    margin: 0;
    animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

/* Input Area */
.input-area {
    position: relative;
    padding: 1rem;
    border-top: 1px solid var(--color-brandWhite);
    flex-shrink: 0;
}

#chat-form {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

#message-input {
    flex: 1;
    font-family: var(--font-sans);
    font-size: 1rem;
    padding: 0.75rem 1rem;
    border: 2px solid var(--color-brandGrey);
    border-radius: var(--radius);
    resize: none;
    min-height: 4.5em;
    max-height: min(50vh, 12em);
    line-height: 1.5;
    transition: border-color 0.2s;
    overflow-y: auto;
}

#message-input:focus {
    border-color: var(--color-brandBlue);
}

#message-input:focus:not(:focus-visible) {
    outline: none;
}

#message-input:focus-visible {
    outline: 2px solid var(--color-brandBlue);
    outline-offset: 2px;
}

#message-input:disabled {
    background: var(--color-brandBeige);
    cursor: not-allowed;
}

#send-btn {
    width: 44px;
    height: 44px;
    background: var(--color-brandBlue);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.1s;
    flex-shrink: 0;
}

#send-btn:hover:not(:disabled) {
    /* background: var(--color-BrandBlue); */
    opacity: 0.8;
}

#send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

#send-btn:disabled {
    background: var(--color-brandGrey);
    cursor: not-allowed;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--color-brandGrey);
}

/* Progress Bar */
.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius);
    transition: transform 0.15s, background-color 0.15s;
}

.progress-bar-container:hover {
    transform: translateY(-1px);
    background: rgba(0, 0, 0, 0.03);
}

.progress-bar-container:active {
    transform: translateY(0);
}

.progress-bar-container:focus-visible {
    outline: 2px solid var(--color-brandBlue);
    outline-offset: 2px;
}

.progress-bar {
    display: flex;
    gap: 3px;
    height: 8px;
    width: 140px;
}

.progress-bar__segment {
    flex: 1;
    background: var(--color-brandGrey);
    opacity: 0.25;
    border-radius: 2px;
    transition: background-color 0.4s, opacity 0.4s;
}

.progress-bar__segment[data-score="5"] {
    background: var(--color-brandYellow);
    opacity: 1;
}

.progress-bar__segment[data-score="10"] {
    background: var(--color-brandGreen);
    opacity: 1;
}

.progress-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-brandBlue);
    white-space: nowrap;
    user-select: none;
}

@keyframes progress-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.progress-bar-container.pulse {
    animation: progress-pulse 0.4s ease;
}

/* Char count - hidden by default, shown near limit */
.char-count {
    display: none;
    position: absolute;
    bottom: 0.25rem;
    right: 3.5rem;
    font-size: 0.6875rem;
    color: var(--color-brandRed);
    background: rgba(255, 254, 246, 0.9);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    pointer-events: none;
}

.char-count.visible {
    display: block;
}

/* Progress Popover */
.progress-popover {
    position: fixed;
    inset: 0;
    z-index: 1002;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 5rem;
    background: rgba(41, 39, 36, 0.4);
}

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

.progress-popover__content {
    background: var(--color-brandWhite);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(41, 39, 36, 0.2);
    padding: 1.25rem;
    max-width: 340px;
    width: calc(100% - 2rem);
}

.progress-popover__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.progress-popover__header h3 {
    font-family: var(--font-serif);
    font-size: 1.125rem;
    color: var(--color-brandRed);
    margin: 0;
}

.progress-popover__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-brandGrey);
    padding: 0.25rem;
    line-height: 1;
}

.progress-popover__close:hover {
    color: var(--color-brandBlack);
}

.progress-popover__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.progress-popover__list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-brandBlack);
}

.progress-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--color-brandGrey);
    opacity: 0.3;
    transition: background 0.3s, opacity 0.3s;
}

.progress-dot[data-score="5"] {
    background: var(--color-brandYellow);
    opacity: 1;
}

.progress-dot[data-score="10"] {
    background: var(--color-brandGreen);
    opacity: 1;
}

.progress-desc {
    color: var(--color-brandGrey);
    font-size: 0.8125rem;
}

/* Footer Actions */
.actions {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 0;
    flex-shrink: 0;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-brandBlack);
    background: var(--color-brandWhite);
    border: 2px solid var(--color-brandBeige);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.action-btn:hover:not(:disabled) {
    border-color: var(--color-brandBlue);
    color: var(--color-brandBlue);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.action-btn.warning:hover:not(:disabled) {
    border-color: var(--color-brandRed);
    color: var(--color-brandRed);
}

.btn-label-short {
    display: none;
}

.menu-btn {
    flex: 0 0 auto;
    padding: 0.75rem 0.9rem;
}

.menu-btn[hidden] {
    display: none;
}

/* Menu Drawer */
.menu-drawer {
    position: fixed;
    inset: 0;
    z-index: 1003;
    pointer-events: none;
}

.menu-drawer[aria-hidden="false"] {
    pointer-events: auto;
}

.menu-drawer__overlay {
    position: absolute;
    inset: 0;
    background: rgba(41, 39, 36, 0.4);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.menu-drawer[aria-hidden="false"] .menu-drawer__overlay {
    opacity: 1;
}

.menu-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    max-width: 85vw;
    background: var(--color-brandWhite);
    box-shadow: -8px 0 24px rgba(41, 39, 36, 0.15);
    transform: translateX(100%);
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.menu-drawer[aria-hidden="false"] .menu-drawer__panel {
    transform: translateX(0);
}

.menu-drawer__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-brandBeige);
    flex-shrink: 0;
}

.menu-drawer__header h2 {
    font-family: var(--font-serif);
    font-size: 1.125rem;
    color: var(--color-brandRed);
    margin: 0;
}

.menu-drawer__close {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--color-brandGrey);
    padding: 0 0.25rem;
    line-height: 1;
}

.menu-drawer__close:hover {
    color: var(--color-brandBlack);
}

.menu-drawer__body {
    position: relative;
    overflow: hidden;
    flex: 1;
}

/* Menu list (default view) */
.menu-list {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transform: translateX(0);
    transition: transform 0.2s ease;
}

.menu-drawer__body[data-view="detail"] .menu-list {
    transform: translateX(-100%);
}

.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1.25rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    color: var(--color-brandBlack);
    text-decoration: none;
    background: var(--color-brandWhite);
    border: none;
    border-bottom: 1px solid var(--color-brandBeige);
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background-color 0.15s;
}

.menu-item:hover,
.menu-item:focus-visible {
    background: var(--color-brandBeige);
    outline: none;
}

.menu-item__label {
    flex: 1;
}

.menu-item__icon {
    color: var(--color-brandGrey);
    flex-shrink: 0;
}

/* Menu detail view */
.menu-detail {
    position: absolute;
    inset: 0;
    padding: 1rem 1.25rem 1.5rem;
    overflow-y: auto;
    background: var(--color-brandWhite);
    display: none;
}

.menu-detail.active {
    display: block;
}

.menu-back {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: none;
    color: var(--color-brandBlue);
    cursor: pointer;
    padding: 0 0 0.75rem 0;
    font-family: var(--font-sans);
    font-size: 0.875rem;
}

.menu-back:hover {
    text-decoration: underline;
}

.menu-detail h3 {
    font-family: var(--font-serif);
    font-size: 1.125rem;
    color: var(--color-brandBlack);
    margin: 0 0 0.75rem 0;
}

.menu-detail p {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--color-brandBlack);
    margin: 0 0 0.75rem 0;
}

/* Menu forms (newsletter, future inquiry) */
.menu-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.menu-form__label {
    font-size: 0.85rem;
    color: var(--color-brandBlack);
    font-weight: 500;
    margin-top: 0.25rem;
}

.menu-form__req {
    color: var(--color-brandRed);
}

.menu-form input[type="email"],
.menu-form input[type="text"],
.menu-form textarea {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--color-brandBeige);
    border-radius: var(--radius);
    background: var(--color-brandWhite);
    color: var(--color-brandBlack);
    transition: border-color 0.2s;
}

.menu-form textarea {
    resize: vertical;
    min-height: 5rem;
    font-family: var(--font-sans);
}

.menu-form input[type="email"]:focus,
.menu-form input[type="text"]:focus,
.menu-form textarea:focus {
    outline: none;
    border-color: var(--color-brandBlue);
}

.menu-form__submit {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-brandWhite);
    background: var(--color-brandBlue);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.2s;
}

.menu-form__submit:hover:not(:disabled) {
    background: #1e92c7;
}

.menu-form__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.menu-form__status {
    font-size: 0.85rem;
    margin: 0.5rem 0 0 0;
    min-height: 1.25rem;
}

.menu-form__status.error {
    color: var(--color-brandRed);
}

.menu-form__status.success {
    color: var(--color-brandGreen);
}

/* Scroll to Bottom Button */
.scroll-to-bottom {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    color: var(--color-brandWhite);
    background: var(--color-brandBlue);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(39, 170, 225, 0.3);
    transition: background-color 0.2s, box-shadow 0.2s;
    z-index: 10;
    opacity: 0.85;
}

.scroll-to-bottom:hover {
    background: #1e92c7;
    opacity: 1;
    box-shadow: 0 4px 12px rgba(39, 170, 225, 0.4);
}

.scroll-to-bottom svg {
    flex-shrink: 0;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--color-brandBlack);
    color: var(--color-brandWhite);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.error {
    background: var(--color-brandRed);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast-close {
    background: none;
    border: none;
    color: var(--color-brandWhite);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
}

.toast-close:hover {
    opacity: 1;
}

.toast.success {
    background: var(--color-brandGreen);
}

/* Mobile: Position toast above footer */
@media (max-width: 600px) {
    .toast {
        bottom: 6rem;
    }
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 0.5rem;
    }

    .header {
        padding: 0.75rem 0;
        gap: 0.75rem;
    }

    .header-logo img {
        height: 40px;
    }

    .header h1 {
        font-size: 1.25rem;
    }

    .messages {
        padding: 0.75rem;
    }

    .message {
        max-width: 90%;
    }

    .message-actions {
        opacity: 1;
    }

    .actions {
        flex-direction: row;
        gap: 0.25rem;
        padding: 0.25rem 0;
    }

    .action-btn {
        padding: 0.5rem 0.375rem;
        font-size: 0.75rem;
        gap: 0.25rem;
    }

    .menu-btn {
        padding: 0.5rem 0.6rem;
    }

    .action-btn svg {
        width: 14px;
        height: 14px;
    }

    .btn-label-short {
        display: inline;
    }

    .btn-label-long {
        display: none;
    }

    .scroll-to-bottom {
        width: 32px;
        height: 32px;
        bottom: 0.75rem;
        right: 0.75rem;
    }

    .scroll-to-bottom svg {
        width: 16px;
        height: 16px;
    }

    .progress-bar {
        width: 110px;
        height: 6px;
    }

    .progress-popover {
        padding-top: 3.5rem;
    }
}

/* Scrollbar styling */
.messages::-webkit-scrollbar {
    width: 6px;
}

.messages::-webkit-scrollbar-track {
    background: transparent;
}

.messages::-webkit-scrollbar-thumb {
    background: var(--color-brandGrey);
    border-radius: 3px;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: var(--color-brandBlack);
}


/* Survey Modal Overlay */
.survey-overlay {
    position: fixed;
    inset: 0;
    background: rgba(41, 39, 36, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    padding: 1rem;
}

.survey-modal {
    background: var(--color-brandWhite);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(41, 39, 36, 0.2);
    padding: 1.5rem;
    max-width: 400px;
    width: 100%;
}

.survey-modal h3 {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    color: var(--color-brandRed);
    margin-bottom: 0.5rem;
}

.survey-modal > p {
    color: var(--color-brandGrey);
    margin-bottom: 1rem;
}

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

.survey-field label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
}

.rating-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.rating-container input[type="range"] {
    flex: 1;
    accent-color: var(--color-brandBlue);
}

.rating-value {
    font-weight: 600;
    color: var(--color-brandBlue);
    min-width: 1.5rem;
    text-align: center;
}

/* Star Rating */
.star-rating {
    display: flex;
    gap: 0.25rem;
}

.star-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.125rem;
    transition: transform 0.1s;
}

.star-btn svg {
    width: 24px;
    height: 24px;
    fill: var(--color-brandGrey);
    opacity: .5;
    transition: fill 0.15s;
}

.star-btn:hover {
    transform: scale(1.4);
}

.star-btn.active svg,
.star-btn.hovered svg {
    fill: var(--color-brandYellow);
    opacity: 1;
    transform: scale(1.2);
}


.survey-field select,
.survey-field textarea,
.survey-field input:not([type="checkbox"]) {
    width: 100%;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--color-brandGrey);
    border-radius: var(--radius);
}

.survey-field select:focus,
.survey-field textarea:focus,
.survey-field input:not([type="checkbox"]):focus {
    border-color: var(--color-brandBlue);
}

.survey-field select:focus:not(:focus-visible),
.survey-field textarea:focus:not(:focus-visible),
.survey-field input:not([type="checkbox"]):focus:not(:focus-visible) {
    outline: none;
}

.survey-field select:focus-visible,
.survey-field textarea:focus-visible,
.survey-field input:not([type="checkbox"]):focus-visible {
    outline: 2px solid var(--color-brandBlue);
    outline-offset: 2px;
}

.survey-field textarea {
    resize: vertical;
    min-height: 60px;
}

.survey-name-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.survey-name-row input {
    flex: 1;
    min-width: 0;
}

#survey-email {
    width: 100%;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--color-brandGrey);
    border-radius: var(--radius);
}

#survey-email:focus {
    border-color: var(--color-brandBlue);
}

#survey-email:focus:not(:focus-visible) {
    outline: none;
}

#survey-email:focus-visible {
    outline: 2px solid var(--color-brandBlue);
    outline-offset: 2px;
}

.survey-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.survey-btn {
    flex: 1;
    padding: 0.625rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    transition: opacity 0.2s, border-color 0.2s, color 0.2s;
}

.survey-btn.primary {
    background: var(--color-brandBlue);
    color: white;
    border: none;
}

.survey-btn.primary:hover {
    opacity: 0.9;
}

.survey-btn.secondary {
    background: transparent;
    color: var(--color-brandGrey);
    border: 2px solid var(--color-brandGrey);
}

.survey-btn.secondary:hover {
    border-color: var(--color-brandBlack);
    color: var(--color-brandBlack);
}/* Inline Feedback Prompt */
.feedback-prompt {
    margin-top: 0.75rem;
}

.feedback-divider {
    height: 1px;
    background: var(--color-brandGrey);
    opacity: 0.3;
    margin-bottom: 0.75rem;
}

.feedback-content {
    background: var(--color-brandWhite);
    border-radius: var(--radius);
    border: var(--color-brandBlue) 2px solid;
    padding: 0.75rem;
}

.feedback-question {
    font-size: 0.875rem;
    color: var(--color-brandBlack);
    margin-bottom: 0.5rem;
}

.feedback-ratings {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex-wrap: wrap;
}

.rating-btn {
    background: var(--color-brandWhite);
    border: 2px solid transparent;
    border-radius: var(--radius);
    padding: 0.375rem 0.5rem;
    font-size: 1.25rem;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s, background-color 0.15s;
}

.rating-btn:hover {
    border-color: var(--color-brandBlue);
    transform: scale(1.1);
}

.rating-btn.selected {
    border-color: var(--color-brandBlue);
    background: rgba(39, 170, 225, 0.1);
}

.feedback-dismiss {
    background: none;
    border: none;
    color: var(--color-brandBlack);
    cursor: pointer;
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
    margin-left: auto;
    opacity: 0.8;
}

.feedback-dismiss:hover {
    color: var(--color-brandBlack);
    opacity: 1;
}

.feedback-comment-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.feedback-comment-label {
    display: block;
    width: 100%;
    font-size: 0.8125rem;
    color: var(--color-brandGrey);
    margin-bottom: 0;
}

.feedback-comment {
    flex: 1;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-brandGrey);
    border-radius: var(--radius);
}

.feedback-comment:focus {
    border-color: var(--color-brandBlue);
}

.feedback-comment:focus:not(:focus-visible) {
    outline: none;
}

.feedback-comment:focus-visible {
    outline: 2px solid var(--color-brandBlue);
    outline-offset: 2px;
}

.feedback-submit {
    background: var(--color-brandBlue);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    cursor: pointer;
}

.feedback-submit:hover {
    opacity: 0.9;
}

.feedback-thanks {
    font-size: 0.875rem;
    color: var(--color-brandGreen);
    font-weight: 500;
    text-align: center;
    padding: 0.5rem;
}

/* Email Capture Prompt */
.email-prompt {
    margin-top: 0.75rem;
}

.email-prompt-content {
    background: var(--color-brandWhite);
    border-radius: var(--radius);
    padding: 0.75rem;
    border: var(--color-brandBlue) 2px solid;
}

.email-prompt-question {
    font-size: 0.875rem;
    color: var(--color-brandBlack);
    margin-bottom: 0.5rem;
}

.email-prompt-form {
    display: flex;
    gap: 0.5rem;
}

.email-prompt-input {
    flex: 1;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-brandGrey);
    border-radius: var(--radius);
}

.email-prompt-input:focus {
    border-color: var(--color-brandBlue);
}

.email-prompt-input:focus:not(:focus-visible) {
    outline: none;
}

.email-prompt-input:focus-visible {
    outline: 2px solid var(--color-brandBlue);
    outline-offset: 2px;
}

.email-prompt-input.shake {
    animation: shake 0.4s ease-in-out;
    border-color: var(--color-brandRed);
}

.email-prompt-submit {
    background: var(--color-brandBlue);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    cursor: pointer;
}

.email-prompt-submit:hover {
    opacity: 0.9;
}

.email-prompt-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.email-prompt-dismiss {
    background: none;
    border: none;
    color: var(--color-brandGrey);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    padding: 0.25rem 0;
    margin-top: 0.25rem;
}

.email-prompt-dismiss:hover {
    color: var(--color-brandBlack);
}

.email-prompt-success {
    color: var(--color-brandGreen);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Inline Survey (for completed objectives) */
.inline-survey {
    margin-top: 1rem;
}

.inline-survey-content {
    background: var(--color-brandWhite);
    border-radius: var(--radius);
    border: var(--color-brandBlue) 2px solid;
    padding: 1rem;
}

.inline-survey-title {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-brandRed);
    margin-bottom: 0.75rem;
}

.inline-survey-field {
    margin-bottom: 0.75rem;
}

.inline-survey-label {
    font-size: 0.875rem;
    color: var(--color-brandBlack);
    margin-bottom: 0.5rem;
}

.inline-survey-options {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    align-items: center;
}

.survey-option-btn {
    background: var(--color-brandBeige);
    border: 2px solid transparent;
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.survey-option-btn:hover {
    border-color: var(--color-brandBlue);
}

.survey-option-btn.selected {
    border-color: var(--color-brandBlue);
    background: rgba(39, 170, 225, 0.1);
}

.inline-survey-dismiss {
    background: none;
    border: none;
    color: var(--color-brandBlack);
    opacity: 0.8;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 0.875rem;
    margin-left: auto;
}

.inline-survey-dismiss:hover {
    color: var(--color-brandBlack);
    opacity: 1;
}

.inline-survey-followup {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(123, 115, 108, 0.2);
}

.inline-survey-comment-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.inline-survey-comment {
    flex: 1;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-brandGrey);
    border-radius: var(--radius);
}

.inline-survey-comment:focus {
    border-color: var(--color-brandBlue);
}

.inline-survey-comment:focus:not(:focus-visible) {
    outline: none;
}

.inline-survey-comment:focus-visible {
    outline: 2px solid var(--color-brandBlue);
    outline-offset: 2px;
}

.inline-survey-submit {
    background: var(--color-brandBlue);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    cursor: pointer;
}

.inline-survey-submit:hover {
    opacity: 0.9;
}

.inline-survey-email-row {
    margin-bottom: 0.5rem;
}

.inline-survey-name,
.inline-survey-lastname,
.inline-survey-email {
    flex: 1;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-brandGrey);
    border-radius: var(--radius);
    margin-bottom:.3em;
}

.inline-survey-name:focus,
.inline-survey-lastname:focus,
.inline-survey-email:focus {
    border-color: var(--color-brandBlue);
}

.inline-survey-name:focus:not(:focus-visible),
.inline-survey-lastname:focus:not(:focus-visible),
.inline-survey-email:focus:not(:focus-visible) {
    outline: none;
}

.inline-survey-name:focus-visible,
.inline-survey-lastname:focus-visible,
.inline-survey-email:focus-visible {
    outline: 2px solid var(--color-brandBlue);
    outline-offset: 2px;
}


/* Welcome Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(41, 39, 36, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    padding: 1rem;
}

.modal-overlay.hidden {
    display: none;
}

.welcome-modal {
    background: var(--color-brandWhite);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(41, 39, 36, 0.2);
    max-width: 480px;
    width: 100%;
    text-align: center;
    padding: 2.5rem;
}

.welcome-modal h2 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--color-brandRed);
}

.welcome-modal p {
    margin-bottom: 1.5rem;
    color: var(--color-brandGrey);
}

#welcome-form {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

#welcome-input {
    font-family: var(--font-sans);
    font-size: 1rem;
    padding: 0.75rem 1rem;
    border: 2px solid var(--color-brandGrey);
    border-radius: var(--radius);
    width: 200px;
    transition: border-color 0.2s;
}

#welcome-input:focus {
    border-color: var(--color-brandBlue);
}

#welcome-input:focus:not(:focus-visible) {
    outline: none;
}

#welcome-input:focus-visible {
    outline: 2px solid var(--color-brandBlue);
    outline-offset: 2px;
}

#welcome-input.shake {
    animation: shake 0.4s ease-in-out;
    border-color: var(--color-brandRed);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.welcome-submit {
    padding: 0.75rem;
    background: var(--color-brandBlue);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, opacity 0.2s;
}

.welcome-submit:hover {
    opacity: 0.85;
}

/* Greeting cycle — no extra CSS needed, types directly into the input field */

/* Skip intro link */
.skip-intro-link {
    display: inline-block;
    margin-top: 1rem;
    font-size: 0.8125rem;
    color: var(--color-brandGrey);
    text-decoration: none;
}

.skip-intro-link:hover {
    text-decoration: underline;
}

/* SMARTIE bar pulse animation (triggered during orientation) */
.smartie-pulse {
    animation: smartie-glow 1s ease-in-out infinite !important;
    transition: none !important;
}

@keyframes smartie-glow {
    0%, 100% { box-shadow: none; transform: scale(1); }
    50% { box-shadow: 0 0 20px rgba(222, 203, 0, 0.7), 0 0 40px rgba(222, 203, 0, 0.3); transform: scale(1.05); }
}

/* Orientation email widget (inline in message 3) */
.orientation-email-widget {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(41, 39, 36, 0.1);
}

.orientation-email-widget p {
    font-size: 0.875rem;
    color: var(--color-brandBlack);
    margin-bottom: 0.5rem;
}

.orientation-email-widget .orientation-email-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.orientation-email-widget .orientation-email-input {
    flex: 1;
    min-width: 180px;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(41, 39, 36, 0.2);
    border-radius: var(--radius);
    background: var(--color-brandWhite);
}

.orientation-email-widget .orientation-email-input:focus {
    border-color: var(--color-brandBlue);
    outline: none;
}

.orientation-email-widget .orientation-email-input:focus-visible {
    outline: 2px solid var(--color-brandBlue);
    outline-offset: 2px;
}

.orientation-email-widget .orientation-email-submit {
    background: var(--color-brandBlue);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    cursor: pointer;
}

.orientation-email-widget .orientation-email-submit:hover {
    opacity: 0.9;
}

.orientation-email-widget .orientation-email-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.orientation-email-skip {
    background: none;
    border: none;
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    color: var(--color-brandGrey);
    cursor: pointer;
    padding: 0.25rem 0;
    margin-top: 0.25rem;
}

.orientation-email-skip:hover {
    color: var(--color-brandBlack);
}

.orientation-email-success {
    color: var(--color-brandGreen);
    font-size: 0.875rem;
}

@media (max-width: 600px) {
    .orientation-email-widget .orientation-email-form {
        flex-direction: column;
    }
    .orientation-email-widget .orientation-email-input {
        min-width: auto;
        width: 100%;
    }
    .orientation-email-widget .orientation-email-submit {
        width: 100%;
    }
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-brandBlue);
    color: white;
    padding: 0.5rem 1rem;
    z-index: 100;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
}

/* Visually Hidden (screen-reader only) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Email collection modal */
.email-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(41, 39, 36, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.email-modal {
    background: var(--color-brandWhite);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(41, 39, 36, 0.2);
    padding: 2rem;
    width: 100%;
    max-width: 420px;
}

.email-modal h3 {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    color: var(--color-brandRed);
    margin-bottom: 0.5rem;
}

.email-modal > p {
    color: var(--color-brandGrey);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.email-modal-field {
    margin-bottom: 0.75rem;
}

.email-modal-field label {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.email-modal-field label .required {
    color: var(--color-brandRed);
}

.email-modal-field input {
    width: 100%;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--color-brandGrey);
    border-radius: var(--radius);
    box-sizing: border-box;
}

.email-modal-field input:focus {
    border-color: var(--color-brandBlue);
    outline: none;
}

.email-modal-field input:focus-visible {
    outline: 2px solid var(--color-brandBlue);
    outline-offset: 2px;
}

.email-modal-field input.shake {
    animation: shake 0.4s ease-in-out;
    border-color: var(--color-brandRed);
}

.email-modal-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.email-modal-submit {
    flex: 1;
    background: var(--color-brandBlue);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 0.625rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

.email-modal-submit:hover {
    opacity: 0.9;
}

.email-modal-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.email-modal-cancel {
    flex: 1;
    background: transparent;
    color: var(--color-brandGrey);
    border: 2px solid var(--color-brandGrey);
    border-radius: var(--radius);
    padding: 0.625rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

.email-modal-cancel:hover {
    border-color: var(--color-brandBlack);
    color: var(--color-brandBlack);
}

/* Email prompt "Yes" button */
.email-prompt-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.email-prompt-yes {
    background: var(--color-brandBlue);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 0.375rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

.email-prompt-yes:hover {
    opacity: 0.9;
}

/* Email consent checkbox */
.email-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--color-brandGrey);
    margin-top: 0.5rem;
    cursor: pointer;
    line-height: 1.4;
}

.email-consent-label input[type="checkbox"] {
    margin-top: 0.2rem;
    flex-shrink: 0;
}

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

/* Debug Panel */
#debug-panel {
    position: fixed;
    bottom: 10px;
    right: 10px;
    z-index: 10000;
    font-family: var(--font-sans);
    font-size: 13px;
}

#debug-toggle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--color-brandGrey);
    background: var(--color-brandWhite);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#debug-body {
    position: absolute;
    bottom: 44px;
    right: 0;
    width: 280px;
    max-height: 70vh;
    overflow-y: auto;
    background: var(--color-brandWhite);
    border: 2px solid var(--color-brandGrey);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

#debug-body h4 {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--color-brandRed);
}

.debug-section {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(123, 115, 108, 0.2);
}

.debug-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.debug-section h5 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-brandGrey);
    margin-bottom: 6px;
}

.debug-section button {
    background: var(--color-brandBlue);
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: var(--radius);
    font-size: 12px;
    cursor: pointer;
    margin: 2px;
}

.debug-section button:hover {
    opacity: 0.85;
}

.debug-section label {
    display: block;
    font-size: 12px;
    margin: 4px 0;
    color: var(--color-brandBlack);
}

#debug-state {
    font-family: monospace;
    font-size: 11px;
    white-space: pre-wrap;
    word-break: break-all;
    background: #f5f5f0;
    padding: 6px;
    border-radius: 4px;
    max-height: 150px;
    overflow-y: auto;
    margin: 0;
}

.input-area.input-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.feedback-nudge {
    background: rgba(39, 170, 225, 0.08);
    border: 1px solid rgba(39, 170, 225, 0.25);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    margin: 0 1rem 0.5rem;
    font-size: 0.8125rem;
    color: var(--color-brandBlack);
    cursor: pointer;
    text-align: center;
    transition: background 0.15s;
    animation: nudge-fade-in 0.3s ease-out;
}

.feedback-nudge:hover {
    background: rgba(39, 170, 225, 0.15);
}

.feedback-nudge-icon {
    color: var(--color-brandBlue);
    margin-right: 0.25rem;
}

@keyframes nudge-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
