/* ------------------------------------------------------------------
 * custom.css — Non-Tailwind patterns
 * Pseudo-elements, scrollbar, selection, print, reduced-motion,
 * JS-toggled classes, markdown content, reflection UI, animations
 * ------------------------------------------------------------------ */

/* ------------------------------------------------------------------
 * Base resets (from base.css)
 * ------------------------------------------------------------------ */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    border-width: 0;
    border-style: solid;
    border-color: var(--border-default);
}

html {
    scroll-behavior: smooth;
    height: 100%;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    overflow-x: hidden;
    height: 100%;
    line-height: 1.6;
    font-weight: 400;
    letter-spacing: -0.006em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Figtree', -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.025em;
    color: var(--text-primary);
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    outline: none;
}

textarea, input {
    font-family: 'Outfit', sans-serif;
}

pre {
    background: var(--bg-elevated);
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    border: 1px solid var(--border-subtle);
}

code {
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    background: var(--bg-elevated);
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 0.84em;
    color: var(--blue-700);
}

pre code {
    background: none;
    padding: 0;
    color: inherit;
    border-radius: 0;
}

/* ------------------------------------------------------------------
 * Scrollbar
 * ------------------------------------------------------------------ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--slate-300);
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--slate-400);
}

/* ------------------------------------------------------------------
 * Selection
 * ------------------------------------------------------------------ */

::selection {
    background-color: rgba(37, 99, 235, 0.15);
    color: var(--text-primary);
}

/* ------------------------------------------------------------------
 * Dot-grid backgrounds
 * ------------------------------------------------------------------ */

.animated-bg {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    background-color: var(--bg-page);
    background-image: radial-gradient(circle, var(--slate-200) 0.6px, transparent 0.6px);
    background-size: 24px 24px;
}

.messages-container {
    background-image: radial-gradient(circle, var(--slate-200) 0.5px, transparent 0.5px);
    background-size: 20px 20px;
}

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

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

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

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
    30%           { transform: translateY(-8px); opacity: 1; }
}

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

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-4px); }
    75%      { transform: translateX(4px); }
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes authGradientShift {
    0%   { transform: translate(0, 0) rotate(0deg); }
    33%  { transform: translate(2%, -3%) rotate(1deg); }
    66%  { transform: translate(-1%, 2%) rotate(-0.5deg); }
    100% { transform: translate(1%, -1%) rotate(0.5deg); }
}

@keyframes authCardEnter {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

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

@keyframes heroGradientShift {
    0%   { transform: translate(0, 0) rotate(0deg); }
    33%  { transform: translate(2%, -3%) rotate(1deg); }
    66%  { transform: translate(-1%, 2%) rotate(-0.5deg); }
    100% { transform: translate(1%, -1%) rotate(0.5deg); }
}

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

@keyframes reflection-fade {
    0%   { opacity: 0; }
    20%  { opacity: 0.7; }
    80%  { opacity: 0.5; }
    100% { opacity: 0.3; }
}

/* ------------------------------------------------------------------
 * Typing indicator (nth-child delays)
 * ------------------------------------------------------------------ */

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* ------------------------------------------------------------------
 * Sidebar active indicator (pseudo-element)
 * ------------------------------------------------------------------ */

.chat-history-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 55%;
    background: var(--accent);
    border-radius: 0 9999px 9999px 0;
}

/* CPanel sidebar active indicator */
.cpanel-sidebar__link--active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 55%;
    background: var(--accent);
    border-radius: 0 9999px 9999px 0;
}

/* ------------------------------------------------------------------
 * Auth page gradient background (pseudo-element)
 * ------------------------------------------------------------------ */

/* Auth page no longer uses ::before gradient — removed in split-panel redesign */

.auth-panel-right__orbs {
    background:
        radial-gradient(ellipse 500px 400px at 20% 30%, rgba(255, 255, 255, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 400px 350px at 75% 65%, rgba(99, 102, 241, 0.15) 0%, transparent 70%),
        radial-gradient(ellipse 350px 300px at 50% 85%, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
    animation: authGradientShift 12s ease-in-out infinite alternate;
}

/* ------------------------------------------------------------------
 * Auth button shimmer (pseudo-element)
 * ------------------------------------------------------------------ */

.auth-btn--primary {
    position: relative;
    overflow: hidden;
}

.auth-btn--primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.15) 50%, transparent 100%);
    transition: left 0.5s var(--ease-out);
}

.auth-btn--primary:hover::before {
    left: 100%;
}

/* ------------------------------------------------------------------
 * Auth divider lines (pseudo-elements)
 * ------------------------------------------------------------------ */

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(148, 163, 184, 0.4) 50%, transparent 100%);
}

/* ------------------------------------------------------------------
 * Select dropdown custom chevron
 * ------------------------------------------------------------------ */

select.auth-field__input {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
    cursor: pointer;
}

select.auth-field__input option {
    background: #FFFFFF;
    color: #0F172A;
}

/* ------------------------------------------------------------------
 * JS-toggled classes — sidebar
 * ------------------------------------------------------------------ */

.sidebar.open {
    left: 0;
    box-shadow: var(--shadow-xl);
}

/* ------------------------------------------------------------------
 * JS-toggled classes — model buttons
 * ------------------------------------------------------------------ */

.model-btn.active {
    background: var(--accent);
    color: var(--text-inverse);
    border-color: transparent;
    box-shadow: var(--shadow-blue);
}

/* ------------------------------------------------------------------
 * JS-toggled classes — feedback buttons
 * ------------------------------------------------------------------ */

.fb-active-up {
    color: var(--success) !important;
    background: rgba(16, 185, 129, 0.1) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}

.fb-active-down {
    color: var(--error) !important;
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

/* ------------------------------------------------------------------
 * Auth form fields (used by crawl.html, profile.html templates)
 * ------------------------------------------------------------------ */

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.auth-field__label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.auth-field__input {
    width: 100%;
    height: 44px;
    padding: 0 0.75rem;
    border: 1.5px solid var(--border-primary);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    background: var(--bg-surface);
    transition: border-color 150ms var(--ease-out),
                box-shadow 150ms var(--ease-out);
    outline: none;
}

.auth-field__input--has-icon {
    padding-left: 42px;
}

/* Override Chrome autofill blue background */
.auth-field__input:-webkit-autofill,
.auth-field__input:-webkit-autofill:hover,
.auth-field__input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
    -webkit-text-fill-color: #0F172A !important;
    transition: background-color 5000s ease-in-out 0s;
}

.auth-field__input::placeholder {
    color: var(--text-tertiary);
}

.auth-field__input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

textarea.auth-field__input {
    height: auto;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    padding-right: 0.75rem;
    line-height: 1.5;
}

.auth-field__hint {
    font-size: 0.78rem;
    color: var(--text-tertiary);
}

/* ------------------------------------------------------------------
 * Profile tabs nav (used by crawl.html, profile.html)
 * ------------------------------------------------------------------ */

.profile-tabs__nav {
    display: flex;
    border-bottom: 1px solid var(--blue-200);
    padding: 0;
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.profile-tabs__btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: color 150ms var(--ease-out),
                border-color 150ms var(--ease-out),
                background 150ms var(--ease-out);
}

.profile-tabs__btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* ------------------------------------------------------------------
 * JS-toggled classes — auth field error
 * ------------------------------------------------------------------ */

.auth-field__input--error {
    border-color: var(--feedback-error, #F87171);
}

.auth-field__input--error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.auth-field__toggle-password {
    border-radius: 0 6px 6px 0;
}

/* ------------------------------------------------------------------
 * JS-toggled classes — profile tabs
 * ------------------------------------------------------------------ */

.profile-tabs__btn--active {
    color: var(--accent);
    border: none;
    border-bottom: 2px solid var(--accent);
    background: none;
    font-weight: 600;
}

.profile-tabs__panel {
    display: none;
}

.profile-tabs__panel--active {
    display: block;
    animation: profileFadeIn 0.2s var(--ease-out);
}

/* ------------------------------------------------------------------
 * JS-toggled classes — RAG selector
 * ------------------------------------------------------------------ */

.rag-selector__card--active {
    border-color: var(--accent);
    background: var(--blue-50);
}

.rag-selector__card--active .rag-selector__radio {
    border-color: var(--accent);
}

.rag-selector__card--active .rag-selector__radio-dot {
    background: var(--accent);
    transform: scale(1);
}

.rag-selector__card--active .rag-selector__icon {
    background: var(--accent);
    color: var(--text-inverse);
}

.rag-selector__card--active .rag-selector__stage {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.15);
    color: var(--blue-700);
}

.rag-selector__card--active .rag-selector__stage-arrow {
    color: var(--blue-400);
}

/* ------------------------------------------------------------------
 * JS-toggled classes — plan cards
 * ------------------------------------------------------------------ */

.plan-card--active {
    border-color: var(--blue-500);
    border-width: 2px;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15), 0 4px 20px rgba(37, 99, 235, 0.1);
}

.plan-card--active .plan-card__btn:not(.plan-card__btn--current) {
    background: var(--blue-600);
    color: #fff;
    border-color: var(--blue-600);
}

.plan-card--active .plan-card__btn:not(.plan-card__btn--current):hover {
    background: var(--blue-700);
    border-color: var(--blue-700);
}

/* ------------------------------------------------------------------
 * JS-toggled classes — crawl upload dragover
 * ------------------------------------------------------------------ */

.crawl-upload--dragover {
    border-color: var(--accent);
    background: rgba(37, 99, 235, 0.04);
}

.crawl-upload--dragover .crawl-upload__icon {
    color: var(--accent);
    transform: scale(1.1);
}

/* ------------------------------------------------------------------
 * JS-toggled classes — crawl progress/result
 * ------------------------------------------------------------------ */

.crawl-progress--active {
    display: flex;
}

.crawl-result--visible {
    display: block;
    animation: slideIn 0.3s var(--ease-out);
}

/* ------------------------------------------------------------------
 * JS-generated docs table (crawl.js, history)
 * ------------------------------------------------------------------ */

.docs-table__detail {
    display: none;
}

.docs-table__row {
    cursor: pointer;
    transition: background 150ms var(--ease-out);
}

.docs-table__row:hover td {
    background: var(--bg-recessed);
}

.docs-table__num {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.docs-table__title-wrap {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;       /* allow flex children to shrink below content size */
}

/* Ensure the Page cell constrains content for truncation */
td:has(.docs-table__title-wrap) {
    overflow: hidden;
}

.docs-table__page-link {
    color: var(--accent);
    text-decoration: none;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.35;
    display: block;
    transition: color 150ms var(--ease-out);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.docs-table__page-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.docs-table__page-path {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.docs-table__edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.7rem;
    transition: all 150ms var(--ease-out);
    flex-shrink: 0;
    opacity: 0;
}

.docs-table__row:hover .docs-table__edit-btn {
    opacity: 1;
}

.docs-table__edit-btn:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.docs-table__edit-btn .material-symbols-outlined {
    font-size: 0.75rem;
}

.docs-table__title-input {
    width: 100%;
    padding: 4px 8px;
    border: 1.5px solid var(--blue-400);
    border-radius: 4px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--bg-surface);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.docs-table__date-wrap {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.docs-table__edit-date-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.7rem;
    transition: all 150ms var(--ease-out);
    flex-shrink: 0;
    opacity: 0;
    padding: 0;
}

.docs-table__row:hover .docs-table__edit-date-btn {
    opacity: 1;
}

.docs-table__edit-date-btn:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.docs-table__edit-date-btn .material-symbols-outlined {
    font-size: 0.75rem;
}

.docs-table__date-input {
    width: 130px;
    padding: 3px 6px;
    border: 1.5px solid var(--blue-400);
    border-radius: 4px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    color: var(--text-primary);
    background: var(--bg-surface);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

td.docs-table__preview {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
    color: var(--text-secondary);
    font-size: 0.825rem;
    line-height: 1.45;
    cursor: pointer;
    position: relative;
}

.docs-table__preview-text {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.docs-table__expand-icon {
    font-size: 0.6rem;
    color: var(--text-tertiary);
    margin-left: 0.25rem;
    transition: transform 150ms var(--ease-out);
    vertical-align: middle;
}

td.docs-table__date {
    padding: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
    font-family: 'Outfit', sans-serif;
    font-variant-numeric: tabular-nums;
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

td.docs-table__words {
    padding: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Page column (contains title + path) */
td:has(.docs-table__title-wrap) {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

.docs-table__detail-content {
    padding: 1rem 1.25rem;
    font-family: 'Outfit', sans-serif;
    font-size: 0.825rem;
    line-height: 1.65;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-recessed);
    border-bottom: 1px solid var(--border-default);
}

.docs-table__empty {
    text-align: center;
    padding: 2.5rem 1rem;
    border-bottom: none;
}

.docs-table__empty .material-symbols-outlined {
    display: block;
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
    color: var(--text-tertiary);
    opacity: 0.35;
}

.docs-table__empty-hint {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-top: 0.25rem;
}

/* ------------------------------------------------------------------
 * JS-generated pagination (crawl.js, history)
 * ------------------------------------------------------------------ */

.docs-pager__info {
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.docs-pager__nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.docs-pager__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    border: 1px solid var(--border-default);
    border-radius: 4px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 150ms var(--ease-out);
}

.docs-pager__btn:hover:not(:disabled):not(.docs-pager__btn--active) {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.docs-pager__btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.docs-pager__btn--active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.docs-pager__ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 32px;
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

/* ------------------------------------------------------------------
 * JS-generated crawl upload items (crawl.js)
 * ------------------------------------------------------------------ */

.crawl-upload__item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-default);
    border-radius: 6px;
    background: var(--bg-surface);
}

.crawl-upload__item-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.crawl-upload__item-info .material-symbols-outlined {
    color: var(--error);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.crawl-upload__item-name {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crawl-upload__item-size {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.crawl-upload__item-url {
    flex: 1;
    min-width: 0;
    padding: 4px 8px;
    border: 1px solid var(--border-default);
    border-radius: 4px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    color: var(--text-primary);
    background: var(--bg-surface);
    outline: none;
    transition: border-color 150ms var(--ease-out);
}

.crawl-upload__item-url:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.crawl-upload__item-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: 4px;
    flex-shrink: 0;
    transition: all 150ms var(--ease-out);
}

.crawl-upload__item-remove:hover {
    background: rgba(239, 68, 68, 0.08);
    color: var(--error);
}

.crawl-upload__item-remove .material-symbols-outlined {
    font-size: 0.8rem;
}

/* ------------------------------------------------------------------
 * JS-generated crawl result stats
 * ------------------------------------------------------------------ */

.crawl-result--success {
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.crawl-result--success .crawl-result__title {
    color: var(--success);
}

.crawl-result--error {
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.crawl-result--error .crawl-result__title {
    color: var(--error);
}

.crawl-result__stat {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.crawl-result__stat .material-symbols-outlined {
    font-size: 0.85rem;
}

/* OCR hand-off note — full-width so it sits below the stat chips (parent
 * is flex-wrap). Scanned PDFs are OCR'd async; completion shows in the
 * Notifications page, not here. */
.crawl-result__note {
    flex-basis: 100%;
    margin-top: 0.15rem;
    font-style: italic;
    opacity: 0.85;
}

/* ------------------------------------------------------------------
 * JS-toggled classes — docs table expand
 * ------------------------------------------------------------------ */

.docs-table__row--expanded .docs-table__expand-icon {
    transform: rotate(180deg);
}

.docs-table__row--expanded td {
    background: var(--bg-hover);
}

.docs-table__detail--open {
    display: table-row;
    animation: slideIn 0.2s var(--ease-out);
}

/* ------------------------------------------------------------------
 * Document detail/edit modal
 * ------------------------------------------------------------------ */

#docDetailPanel {
    animation: scaleIn 0.2s var(--ease-out);
}

.doc-detail__content {
    background: var(--bg-recessed);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 1.25rem 1.5rem;
    max-height: 50vh;
    overflow-y: auto;
}

.doc-detail__flash {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 1rem;
    animation: fadeIn 0.2s var(--ease-out);
}

.doc-detail__flash--success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.doc-detail__flash--error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ------------------------------------------------------------------
 * JS-toggled classes — brochure nav scroll
 * ------------------------------------------------------------------ */

.br-nav--scrolled {
    padding: 0.75rem 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px) saturate(1.4);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

/* ------------------------------------------------------------------
 * JS-toggled classes — brochure hamburger
 * ------------------------------------------------------------------ */

.br-nav__hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.br-nav__hamburger.active span:nth-child(2) {
    opacity: 0;
}

.br-nav__hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ------------------------------------------------------------------
 * JS-toggled classes — brochure drawer
 * ------------------------------------------------------------------ */

.br-nav__drawer.open {
    right: 0;
}

.br-nav__drawer-overlay.open {
    opacity: 1;
}

/* ------------------------------------------------------------------
 * Brochure scroll reveal
 * ------------------------------------------------------------------ */

.br-reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.br-reveal--left {
    transform: translateX(-24px);
}

.br-reveal--right {
    transform: translateX(24px);
}

.br-reveal--scale {
    transform: scale(0.95);
}

.br-visible {
    opacity: 1 !important;
    transform: translateY(0) translateX(0) scale(1) !important;
}

/* ------------------------------------------------------------------
 * Brochure stagger (nth-child delays)
 * ------------------------------------------------------------------ */

.br-stagger > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.br-stagger.br-visible > *:nth-child(1) { transition-delay: 0ms; }
.br-stagger.br-visible > *:nth-child(2) { transition-delay: 100ms; }
.br-stagger.br-visible > *:nth-child(3) { transition-delay: 200ms; }
.br-stagger.br-visible > *:nth-child(4) { transition-delay: 300ms; }
.br-stagger.br-visible > *:nth-child(5) { transition-delay: 400ms; }
.br-stagger.br-visible > *:nth-child(6) { transition-delay: 500ms; }

.br-stagger.br-visible > * {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* ------------------------------------------------------------------
 * Brochure hero background pseudo-elements
 * ------------------------------------------------------------------ */

.br-hero__bg::before {
    content: '';
    position: absolute;
    top: -40%;
    left: -20%;
    width: 140%;
    height: 140%;
    background:
        radial-gradient(ellipse 600px 500px at 25% 30%, rgba(59, 130, 246, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 500px 400px at 70% 60%, rgba(37, 99, 235, 0.05) 0%, transparent 70%),
        radial-gradient(ellipse 400px 350px at 50% 80%, rgba(59, 130, 246, 0.04) 0%, transparent 70%),
        radial-gradient(ellipse 350px 300px at 80% 20%, rgba(6, 182, 212, 0.03) 0%, transparent 70%);
    animation: heroGradientShift 12s ease-in-out infinite alternate;
}

.br-hero__bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 120%, rgba(255, 255, 255, 0.8) 0%, transparent 60%),
        radial-gradient(circle at 50% -10%, rgba(255, 255, 255, 0.5) 0%, transparent 50%);
}

/* Brochure hero pattern — topographic contour SVG.
 * Lives in templates/brochure/partials/_topo_pattern.html.
 * No mask — fills corner to corner. */

/* ------------------------------------------------------------------
 * Brochure nav active link
 * ------------------------------------------------------------------ */

.br-nav-link {
    position: relative;
}

.br-nav-link--active {
    color: var(--blue-600, #2563eb) !important;
}

.br-nav-link--active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: var(--blue-600, #2563eb);
    border-radius: 1px;
}

/* ------------------------------------------------------------------
 * Brochure how-it-works connecting line (pseudo-element)
 * ------------------------------------------------------------------ */

/* Pipeline connecting line is now inline in the template */

/* ------------------------------------------------------------------
 * Brochure feature card top border (pseudo-element)
 * ------------------------------------------------------------------ */

.br-feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.4), transparent);
    opacity: 0;
    transition: opacity 0.4s;
}

.br-feature-card:hover::before {
    opacity: 1;
}

/* Brochure tech featured card top border */
.br-tech-card--featured::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--brochure-gradient);
}

/* ------------------------------------------------------------------
 * Brochure section label dot (pseudo-element)
 * ------------------------------------------------------------------ */

.br-section__label::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
}

/* ------------------------------------------------------------------
 * Brochure CTA background (pseudo-element in custom.css)
 * ------------------------------------------------------------------ */

.br-final-cta__bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 600px 400px at 50% 50%, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

/* ------------------------------------------------------------------
 * Markdown content (nested element styling)
 * ------------------------------------------------------------------ */

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.markdown-content p {
    margin-bottom: 0.75rem;
}

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

.markdown-content ul,
.markdown-content ol {
    padding-left: 1.5rem;
    margin-top: 0;
    margin-bottom: 0.25rem;
}

.markdown-content li {
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    line-height: 1.5;
}

.markdown-content li p {
    margin: 0;
}

.markdown-content a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid rgba(37, 99, 235, 0.2);
    transition: border-color 150ms var(--ease-out);
}

.markdown-content a:hover {
    border-bottom-color: var(--accent);
}

/* ------------------------------------------------------------------
 * Sources panel + attachments — 2026-05-17 redesign
 *
 * Replaces the previous <details>/<summary> "Sources ⌄" treatment with
 * a discrete button trigger (count-first lowercase label) and a
 * CSS-grid 0fr→1fr panel transition. Mirrors the embedded widget
 * (packages/server/.../static/widget/src/ui/styles.js) so the chat
 * page, chat-share preview, and the widget on tenants' own sites
 * all render the same shape.
 *
 * Markup contract (see markdown-utils.js::wrapSourcesAsCollapsible):
 *   <div class="sources-collapsible">
 *     <button class="sources-trigger" aria-expanded="false">…</button>
 *     <div class="sources-panel">
 *       <div class="sources-panel__inner">
 *         <a class="source-chip">…</a> × N
 *       </div>
 *     </div>
 *   </div>
 *   <div class="attachments-row">
 *     <a class="attachment" data-file-type="pdf|doc|...">…</a> × N
 *   </div>
 * ------------------------------------------------------------------ */

/* The trigger + panel extend bubble-edge-to-bubble-edge by negating
   the parent ``.message-content`` padding (px-5 py-3 → 1.25rem / 0.75rem).
   ``.message-content`` adds overflow:hidden below so the trigger's
   background and border-top don't poke past the bubble's rounded
   corners. Matches docs/design/2026-05-17-sources-panel-redesign.html. */
.markdown-content .sources-collapsible {
    margin-top: 0.75rem;
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    margin-bottom: -0.75rem;
    border-radius: 0;
    overflow: hidden;
}

.message-content {
    overflow: hidden;
}

.markdown-content .sources-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 12px;
    /* Plain band (no blue fill); the bold blue icon + "N sources"
       carry the affordance. Neutral top border just separates it from
       the answer. */
    background: transparent;
    border: none;
    border-top: 1px solid #e2e8f0;
    color: var(--text-secondary, #64748b);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 200ms var(--ease-out, ease-out),
                color 200ms var(--ease-out, ease-out);
}

.markdown-content .sources-trigger:hover,
.markdown-content .sources-trigger:focus-visible {
    background: #f1f5f9;
    color: var(--accent, #2563eb);
    outline: none;
}

.markdown-content .sources-trigger:focus-visible {
    box-shadow: 0 0 0 2px rgba(191, 219, 254, 0.6);
}

.markdown-content .sources-trigger__label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.markdown-content .sources-trigger__icon {
    font-size: 16px;
    color: var(--accent, #2563eb);
    /* Full axis set (Google defaults) with only weight bumped, so the
       icon goes bolder without resetting FILL/GRAD/opsz. */
    font-variation-settings: 'FILL' 0, 'wght' 600, 'GRAD' 0, 'opsz' 24;
}

.markdown-content .sources-trigger__count {
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-weight: 700;
    color: var(--accent, #2563eb);
}

.markdown-content .sources-trigger__noun {
    font-weight: 700;
    color: var(--accent, #2563eb);
}

.markdown-content .sources-trigger:hover .sources-trigger__count {
    color: var(--accent, #2563eb);
}

.markdown-content .sources-trigger__chevron {
    font-size: 17px;
    color: var(--text-tertiary, #94a3b8);
    transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.markdown-content .sources-trigger[aria-expanded="true"] .sources-trigger__chevron {
    transform: rotate(180deg);
}

.markdown-content .sources-panel {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

.markdown-content .sources-panel.is-open {
    grid-template-rows: 1fr;
}

/* The grid-collapse trick needs the direct grid child to be a plain
   ``overflow: hidden`` block — making it a flex container (as
   before) kept its intrinsic height non-zero and chips leaked past
   the bubble's bottom edge while collapsed. The chip layout lives
   on a nested ``.sources-panel__content`` wrapper. */
.markdown-content .sources-panel__inner {
    overflow: hidden;
}
.markdown-content .sources-panel__content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 14px 12px;
    background: rgba(239, 246, 255, 0.3);
    border-top: 1px solid rgba(219, 234, 254, 0.6);
}

.markdown-content .source-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    padding: 2px 8px;
    border-radius: 4px;
    background: white;
    border: 1px solid rgba(191, 219, 254, 0.8);
    color: var(--accent, #2563eb);
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.78rem;
    text-decoration: none;
    line-height: 1.45;
    transition: background 150ms var(--ease-out, ease-out),
                border-color 150ms var(--ease-out, ease-out);
    max-width: 100%;
}

.markdown-content .source-chip:hover {
    background: rgba(239, 246, 255, 1);
    border-color: rgb(147, 197, 253);
}

.markdown-content .source-chip__icon {
    font-size: 14px;
    flex-shrink: 0;
}

.markdown-content .source-chip__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 360px;
}

@media (prefers-reduced-motion: reduce) {
    .markdown-content .sources-panel,
    .markdown-content .sources-trigger__chevron {
        transition: none;
    }
}

/* ------------------------------------------------------------------
 * Attachments row — per-file-type chips beneath the message
 *
 * One chip per cited file whose URL extension matches a known type.
 * data-file-type drives the color/icon — JS just sets the attr.
 * ------------------------------------------------------------------ */

.message-body .attachments-row {
    margin-top: 0.5rem;
    padding-left: 2px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.message-body .attachment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 8px;
    border-radius: 4px;
    background: white;
    border: 1px solid;
    color: var(--text-secondary, #64748b);
    font-size: 0.8rem;
    text-decoration: none;
    transition: background 150ms var(--ease-out, ease-out),
                border-color 150ms var(--ease-out, ease-out);
}

.message-body .attachment__name {
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    color: var(--text-secondary, #64748b);
}

.message-body .attachment:hover .attachment__name {
    color: var(--text-primary, #0f172a);
}

.message-body .attachment__icon {
    font-size: 14px;
}

.message-body .attachment__action {
    font-size: 12px;
    color: var(--text-tertiary, #94a3b8);
    margin-left: 2px;
}

/* PDF — rose */
.message-body .attachment[data-file-type="pdf"] {
    border-color: rgba(254, 205, 211, 0.8);
}
.message-body .attachment[data-file-type="pdf"] .attachment__icon {
    color: rgb(244, 63, 94);
}
.message-body .attachment[data-file-type="pdf"]:hover {
    background: rgba(255, 241, 242, 0.6);
    border-color: rgb(253, 164, 175);
}
.message-body .attachment[data-file-type="pdf"]:hover .attachment__action {
    color: rgb(225, 29, 72);
}

/* DOC / DOCX — blue */
.message-body .attachment[data-file-type="doc"],
.message-body .attachment[data-file-type="docx"] {
    border-color: rgba(191, 219, 254, 0.8);
}
.message-body .attachment[data-file-type="doc"] .attachment__icon,
.message-body .attachment[data-file-type="docx"] .attachment__icon {
    color: rgb(59, 130, 246);
}
.message-body .attachment[data-file-type="doc"]:hover,
.message-body .attachment[data-file-type="docx"]:hover {
    background: rgba(239, 246, 255, 0.6);
    border-color: rgb(147, 197, 253);
}
.message-body .attachment[data-file-type="doc"]:hover .attachment__action,
.message-body .attachment[data-file-type="docx"]:hover .attachment__action {
    color: rgb(37, 99, 235);
}

/* TXT — slate */
.message-body .attachment[data-file-type="txt"] {
    border-color: rgb(203, 213, 225);
}
.message-body .attachment[data-file-type="txt"] .attachment__icon {
    color: rgb(100, 116, 139);
}
.message-body .attachment[data-file-type="txt"]:hover {
    background: rgb(248, 250, 252);
    border-color: rgb(148, 163, 184);
}
.message-body .attachment[data-file-type="txt"]:hover .attachment__action {
    color: rgb(71, 85, 105);
}

/* MD — violet */
.message-body .attachment[data-file-type="md"] {
    border-color: rgba(221, 214, 254, 0.8);
}
.message-body .attachment[data-file-type="md"] .attachment__icon {
    color: rgb(139, 92, 246);
}
.message-body .attachment[data-file-type="md"]:hover {
    background: rgba(245, 243, 255, 0.6);
    border-color: rgb(196, 181, 253);
}
.message-body .attachment[data-file-type="md"]:hover .attachment__action {
    color: rgb(124, 58, 237);
}

/* CSV / XLS / XLSX — emerald */
.message-body .attachment[data-file-type="csv"],
.message-body .attachment[data-file-type="xls"],
.message-body .attachment[data-file-type="xlsx"] {
    border-color: rgba(167, 243, 208, 0.8);
}
.message-body .attachment[data-file-type="csv"] .attachment__icon,
.message-body .attachment[data-file-type="xls"] .attachment__icon,
.message-body .attachment[data-file-type="xlsx"] .attachment__icon {
    color: rgb(16, 185, 129);
}
.message-body .attachment[data-file-type="csv"]:hover,
.message-body .attachment[data-file-type="xls"]:hover,
.message-body .attachment[data-file-type="xlsx"]:hover {
    background: rgba(236, 253, 245, 0.6);
    border-color: rgb(110, 231, 183);
}
.message-body .attachment[data-file-type="csv"]:hover .attachment__action,
.message-body .attachment[data-file-type="xls"]:hover .attachment__action,
.message-body .attachment[data-file-type="xlsx"]:hover .attachment__action {
    color: rgb(5, 150, 105);
}

/* PPT / PPTX — amber */
.message-body .attachment[data-file-type="ppt"],
.message-body .attachment[data-file-type="pptx"] {
    border-color: rgba(253, 230, 138, 0.8);
}
.message-body .attachment[data-file-type="ppt"] .attachment__icon,
.message-body .attachment[data-file-type="pptx"] .attachment__icon {
    color: rgb(245, 158, 11);
}
.message-body .attachment[data-file-type="ppt"]:hover,
.message-body .attachment[data-file-type="pptx"]:hover {
    background: rgba(255, 251, 235, 0.6);
    border-color: rgb(252, 211, 77);
}
.message-body .attachment[data-file-type="ppt"]:hover .attachment__action,
.message-body .attachment[data-file-type="pptx"]:hover .attachment__action {
    color: rgb(217, 119, 6);
}

/* ------------------------------------------------------------------
 * Message content code blocks (nested styling)
 * ------------------------------------------------------------------ */

.message-content pre {
    background: var(--bg-elevated);
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.75rem 0;
    border: 1px solid var(--border-subtle);
    font-size: 0.84rem;
}

.message-content code {
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    background: var(--bg-elevated);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.84em;
    color: var(--blue-700);
}

.message-content pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* ------------------------------------------------------------------
 * References section (rendered from markdown: hr + bold heading + ol)
 * ------------------------------------------------------------------ */

.message-text hr {
    border: none;
    border-top: 1px solid var(--border-default);
    margin: 14px 0;
}

.message-text ol {
    list-style: decimal;
    padding-left: 20px;
    margin: 6px 0 0;
}

.message-text ol li {
    margin: 3px 0;
    padding-left: 4px;
    line-height: 1.5;
}

/* Message links */
.message-text a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid rgba(37, 99, 235, 0.2);
    transition: border-color 150ms var(--ease-out);
}

.message-text a:hover {
    border-bottom-color: var(--accent);
}

/* ------------------------------------------------------------------
 * Reflection UI (streaming reflection phases)
 * ------------------------------------------------------------------ */

.reflection-draft {
    max-height: 2000px;
    overflow: hidden;
    opacity: 0.4;
    transition: max-height 0.6s ease, opacity 0.4s ease;
}

.reflection-draft.collapsed {
    max-height: 0;
    opacity: 0;
}

.reflection-token {
    display: inline;
    animation: reflection-fade 3s ease forwards;
}

/* ------------------------------------------------------------------
 * Docs article typography (nested element styling)
 * ------------------------------------------------------------------ */

.docs-article h2 {
    font-family: 'Figtree', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-default);
    letter-spacing: -0.01em;
}

.docs-article h2:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.docs-article h3 {
    font-family: 'Figtree', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.docs-article p {
    font-family: 'Outfit', sans-serif;
    font-size: 0.925rem;
    color: var(--text-secondary);
    line-height: 1.75;
    margin-bottom: 1rem;
}

.docs-article ul,
.docs-article ol {
    font-family: 'Outfit', sans-serif;
    font-size: 0.925rem;
    color: var(--text-secondary);
    line-height: 1.75;
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.docs-article li {
    margin-bottom: 0.5rem;
}

.docs-article strong {
    color: var(--text-primary);
    font-weight: 600;
}

.docs-article a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.docs-article a:hover {
    text-decoration: underline;
}

.docs-article code {
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
    font-size: 0.825rem;
    background: var(--bg-elevated);
    color: var(--accent);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    border: 1px solid var(--border-default);
}

/* Docs code blocks (dark background) */
.docs-code-block code,
.bg-slate-900 code {
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
    font-size: 0.825rem;
    color: #e2e8f0;
    background: none !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    line-height: 1.7;
    display: block;
    white-space: pre;
}

.bg-slate-900 pre {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Highlight.js overrides for dark code blocks */
.bg-slate-900 .hljs {
    background: transparent !important;
    padding: 0 !important;
}

/* ------------------------------------------------------------------
 * Docs step numbering (counter-increment)
 * ------------------------------------------------------------------ */

.docs-steps {
    counter-reset: doc-step;
    margin-bottom: 1.25rem;
}

.docs-step {
    counter-increment: doc-step;
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-default);
}

.docs-step:last-child {
    border-bottom: none;
}

.docs-step__number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--blue-500);
    background: var(--blue-50);
    color: var(--blue-600);
    font-family: 'Figtree', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}

.docs-step__number::before {
    content: counter(doc-step);
}

.docs-step__body h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.docs-step__body p {
    margin-bottom: 0.5rem;
}

/* ------------------------------------------------------------------
 * Copy button success state
 * ------------------------------------------------------------------ */

.copy-btn.copy-success {
    color: var(--success) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}

/* ------------------------------------------------------------------
 * Material icon spin
 * ------------------------------------------------------------------ */

.material-symbols-outlined.spin {
    animation: spin 1s linear infinite;
}

/* ------------------------------------------------------------------
 * Auth spinner
 * ------------------------------------------------------------------ */

.auth-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ------------------------------------------------------------------
 * Toggle switch (pseudo-element for knob)
 * ------------------------------------------------------------------ */

.rag-switch__track {
    display: block;
    width: 44px;
    height: 24px;
    background: var(--slate-300);
    border-radius: 12px;
    transition: background 0.2s;
    cursor: pointer;
    position: relative;
}

.rag-switch__track::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.rag-switch--on .rag-switch__track {
    background: var(--accent);
}

.rag-switch--on .rag-switch__track::before {
    transform: translateX(20px);
}

/* ------------------------------------------------------------------
 * System dark mode auto-detect
 * ------------------------------------------------------------------ */

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-page: #0B0F1A;
        --bg-surface: #111827;
        --bg-elevated: #1E293B;
        --bg-recessed: #0F172A;
        --bg-hover: #1E293B;
        --bg-active: rgba(37, 99, 235, 0.15);
        --border-subtle: rgba(255, 255, 255, 0.04);
        --border-default: rgba(255, 255, 255, 0.08);
        --border-strong: rgba(255, 255, 255, 0.13);
        --text-primary: #F1F5F9;
        --text-secondary: #94A3B8;
        --text-tertiary: #64748B;
        --white-bg: #111827;
        --light-gray: #1E293B;
        --gray-border: rgba(255, 255, 255, 0.08);
    }

    .animated-bg {
        background-color: #0B0F1A;
        background-image: radial-gradient(circle, rgba(255, 255, 255, 0.03) 0.5px, transparent 0.5px);
    }
}

/* ------------------------------------------------------------------
 * Print styles
 * ------------------------------------------------------------------ */

@media print {
    .sidebar,
    .navbar-custom,
    .chat-header,
    .input-container,
    .powered-by,
    .animated-bg {
        display: none !important;
    }

    .chat-main {
        width: 100% !important;
    }

    .messages-container {
        padding: 0;
        background: white;
        background-image: none;
    }

    .message {
        max-width: 100%;
        page-break-inside: avoid;
    }
}

/* ------------------------------------------------------------------
 * Reduced motion
 * ------------------------------------------------------------------ */

@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;
    }

    .br-reveal,
    .br-stagger > * {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .br-hero__bg::before {
        animation: none;
    }

    .br-hero__badge,
    .br-hero__title,
    .br-hero__subtitle,
    .br-hero__ctas,
    .br-hero__trust {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .br-hero__badge-dot {
        animation: none;
    }

    .auth-page::before {
        animation: none;
    }

    .auth-card {
        animation: none;
    }

    .auth-alert {
        animation: none;
    }

    .auth-btn--primary::before {
        display: none;
    }
}

/* ------------------------------------------------------------------
 * Brochure redesign (2026-06) — floating proof chips
 * Used by the hero widget stage and the auth brand panels.
 * ------------------------------------------------------------------ */

@keyframes brChipBob {
    0%, 100% { transform: translateY(0) rotate(var(--chip-tilt, 0deg)); }
    50%      { transform: translateY(-9px) rotate(var(--chip-tilt, 0deg)); }
}

.br-float-chip {
    position: absolute;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.8rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border: 1px solid var(--blue-200);
    box-shadow: 0 10px 30px -10px rgba(37, 99, 235, 0.25);
    font-family: 'Figtree', sans-serif;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--slate-700);
    white-space: nowrap;
    animation: brChipBob 6.5s ease-in-out infinite;
}

/* ------------------------------------------------------------------
 * Brochure redesign — how-it-works rail pulse
 * ------------------------------------------------------------------ */

@keyframes brRailPulse {
    0%   { left: -10%; opacity: 0; }
    12%  { opacity: 1; }
    88%  { opacity: 1; }
    100% { left: 105%; opacity: 0; }
}

.br-rail-pulse {
    position: absolute;
    top: 0;
    left: -10%;
    width: 90px;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--blue-600), transparent);
    animation: brRailPulse 3.6s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

/* ------------------------------------------------------------------
 * Brochure redesign — industries tabs (JS-toggled)
 * ------------------------------------------------------------------ */

.br-ind-tab--active {
    background: #fff !important;
    border-color: var(--blue-300) !important;
    color: var(--blue-700) !important;
    box-shadow: 0 8px 24px -8px rgba(37, 99, 235, 0.3);
}

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

.br-ind-panel--enter {
    animation: brIndEnter 0.45s var(--ease-out);
}

/* ------------------------------------------------------------------
 * Brochure redesign — footer wordmark
 * ------------------------------------------------------------------ */

.br-footer-wordmark {
    font-family: 'Figtree', sans-serif;
    font-size: clamp(4rem, 15.5vw, 13.5rem);
    font-weight: 900;
    letter-spacing: -0.05em;
    line-height: 0.78;
    text-align: center;
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.14) 0%, rgba(37, 99, 235, 0.015) 90%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    user-select: none;
    pointer-events: none;
    transform: translateY(0.08em);
}

/* ------------------------------------------------------------------
 * Auth redesign (2026-06) — card beam, strength meter, hints
 * ------------------------------------------------------------------ */

@keyframes authBeam {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

.auth-card-beam {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        var(--blue-200) 0%, var(--blue-600) 35%, #22D3EE 50%,
        var(--blue-600) 65%, var(--blue-200) 100%);
    background-size: 220% 100%;
    animation: authBeam 4s linear infinite;
}

.auth-strength { display: none; flex-direction: column; gap: 0.3rem; margin-top: 0.2rem; }
.auth-strength.on { display: flex; }
.auth-strength__bars { display: flex; gap: 0.3rem; }
.auth-strength__bars span {
    flex: 1;
    height: 4px;
    border-radius: 999px;
    background: var(--slate-200);
    transition: background 250ms var(--ease-out);
}
.auth-strength__label {
    font-size: 0.74rem;
    font-weight: 500;
    color: var(--slate-400);
    display: flex;
    justify-content: space-between;
}
.auth-strength[data-score="1"] span:nth-child(-n+1) { background: #F87171; }
.auth-strength[data-score="2"] span:nth-child(-n+2) { background: #FBBF24; }
.auth-strength[data-score="3"] span:nth-child(-n+3) { background: var(--blue-500); }
.auth-strength[data-score="4"] span:nth-child(-n+4) { background: #34D399; }
.auth-strength[data-score="1"] .auth-strength__verdict { color: #DC2626; }
.auth-strength[data-score="2"] .auth-strength__verdict { color: #B45309; }
.auth-strength[data-score="3"] .auth-strength__verdict { color: var(--blue-600); }
.auth-strength[data-score="4"] .auth-strength__verdict { color: #059669; }

.auth-match-hint { display: none; align-items: center; gap: 0.3rem; font-size: 0.78rem; }
.auth-match-hint.on { display: flex; }
.auth-match-hint .material-symbols-outlined { font-size: 0.95rem; }
.auth-match-hint--ok { color: #059669; }
.auth-match-hint--no { color: #DC2626; }

.auth-capslock {
    display: none;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: #B45309;
}
.auth-capslock .material-symbols-outlined { font-size: 0.9rem; }
.auth-capslock.on { display: flex; }

@keyframes authStatePop {
    0%   { transform: scale(0.6); opacity: 0; }
    60%  { transform: scale(1.08); }
    100% { transform: scale(1); opacity: 1; }
}
.auth-state-pop { animation: authStatePop 0.45s var(--ease-out); }

@media (prefers-reduced-motion: reduce) {
    .br-float-chip,
    .br-rail-pulse,
    .auth-card-beam,
    .auth-state-pop { animation: none; }
    .br-ind-panel--enter { animation: none; }
}
