:root {
    --bg: #f8f5ed;
    --bg-strong: #f0ebdd;
    --surface: rgba(255, 255, 255, 0.82);
    --surface-strong: rgba(255, 255, 255, 0.96);
    --surface-muted: rgba(245, 249, 240, 0.9);
    --line: rgba(17, 17, 17, 0.08);
    --line-strong: rgba(17, 17, 17, 0.16);
    --text: #141414;
    --muted: #5b5b53;
    --brand: #109010;
    --brand-strong: #0b740b;
    --brand-soft: #e7f6e7;
    --brand-ghost: #f4fbf1;
    --brand-tint: rgba(16, 144, 16, 0.12);
    --danger: #a35a49;
    --warning: #b07b32;
    --shadow: 0 24px 60px rgba(20, 20, 20, 0.08);
    --radius-xl: 2rem;
    --radius-lg: 1.5rem;
    --radius-md: 1.1rem;
    --radius-sm: 0.85rem;
    --shell: 1220px;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(16, 144, 16, 0.13), transparent 30%),
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.92), transparent 24%),
        linear-gradient(180deg, #fcfbf6 0%, #f8f5ed 55%, #f1ede2 100%);
    text-rendering: optimizeLegibility;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(17, 17, 17, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(17, 17, 17, 0.025) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: radial-gradient(circle at center, black 42%, transparent 82%);
    z-index: -1;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

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

button,
input,
textarea {
    font: inherit;
}

img {
    display: block;
    max-width: 100%;
}

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

.hidden {
    display: none !important;
}

.shell {
    width: min(calc(100% - 2rem), var(--shell));
    margin: 0 auto;
}

.page-section {
    padding: 4.5rem 0;
}

.page-section--compact {
    padding: 3rem 0;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    width: fit-content;
    padding: 0.6rem 0.95rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.9);
    color: var(--brand-strong);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.eyebrow--soft {
    background: rgba(231, 246, 231, 0.95);
}

.section-title,
.landing-title,
.auth-title {
    margin: 0;
    font-size: clamp(2.15rem, 3vw + 1rem, 4.6rem);
    line-height: 0.96;
    letter-spacing: -0.06em;
    font-weight: 700;
    text-wrap: balance;
}

.section-copy,
.landing-copy,
.auth-copy {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
    font-size: 1rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 2.95rem;
    padding: 0 1.15rem;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    transition:
        transform 160ms ease,
        border-color 160ms ease,
        background-color 160ms ease,
        color 160ms ease,
        box-shadow 160ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button--primary {
    background: var(--brand);
    color: #fdfbf7;
    box-shadow: 0 18px 32px rgba(16, 144, 16, 0.18);
}

.button--primary:hover {
    background: var(--brand-strong);
}

.button--secondary {
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.84);
    color: var(--text);
}

.button--secondary:hover {
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.96);
}

.button--ghost {
    border-color: transparent;
    background: transparent;
    color: var(--muted);
}

.button--ghost:hover {
    color: var(--brand-strong);
    background: var(--brand-tint);
}

.button--full {
    width: 100%;
}

.button--icon {
    width: 2.95rem;
    min-width: 2.95rem;
    padding: 0;
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.72);
    color: var(--text);
}

.button--icon span {
    display: block;
    width: 1rem;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.brand-lockup__type {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.16rem;
    min-width: 0;
}

.brand-lockup__bia {
    width: 11.5rem;
    height: 3.7rem;
    object-fit: cover;
    object-position: center;
    flex: none;
}

.brand-lockup__mark {
    width: 2.8rem;
    height: 2.8rem;
    object-fit: contain;
    flex: none;
}

.brand-lockup__name {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.brand-lockup__tag {
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.brand-lockup--inverse .brand-lockup__tag {
    color: #fdfbf7;
}

.brand-lockup--compact .brand-lockup__mark {
    width: 2.2rem;
    height: 2.2rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 0.5rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.82);
    color: var(--brand-strong);
    font-size: 0.75rem;
    font-weight: 700;
}

.status-pill--muted {
    background: var(--brand-soft);
}

.site-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 1rem 0 0;
}

.site-nav__inner,
.workspace-topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.site-nav__inner,
.workspace-topbar__inner,
.auth-panel,
.hero-card,
.steps-shell,
.cta-panel,
.admin-hero,
.surface-panel,
.conversation-sidebar,
.chat-stage,
.auth-story {
    border: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
}

.site-nav__inner {
    padding: 0.9rem 1rem;
    border-radius: 999px;
}

.site-nav__actions,
.workspace-topbar__actions,
.workspace-topbar__left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.landing-hero {
    padding: 2.25rem 0 0;
}

.landing-hero__inner {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 420px);
    gap: 1.25rem;
    align-items: stretch;
}

.landing-hero__copy,
.hero-card,
.cta-panel,
.auth-story {
    padding: 2rem;
    border-radius: var(--radius-xl);
}

.landing-hero__copy {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: center;
}

.landing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
}

.hero-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 251, 241, 0.92)),
        radial-gradient(circle at top right, rgba(16, 144, 16, 0.12), transparent 42%);
}

.hero-card__badge,
.chat-stage__badge {
    width: fit-content;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-size: 0.78rem;
    font-weight: 700;
}

.hero-card__window {
    display: grid;
    gap: 0.75rem;
}

.hero-card__message {
    max-width: 90%;
    padding: 0.9rem 1rem;
    border-radius: 1rem;
    font-size: 0.95rem;
    line-height: 1.55;
}

.hero-card__message--assistant {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
}

.hero-card__message--user {
    margin-left: auto;
    background: var(--brand-soft);
    color: var(--brand-strong);
}

.signal-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.65rem;
    color: var(--muted);
}

.signal-list li {
    position: relative;
    padding-left: 1rem;
}

.signal-list li::before {
    content: "";
    position: absolute;
    top: 0.45rem;
    left: 0;
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 999px;
    background: var(--brand);
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    gap: 1.25rem;
    align-items: start;
}

.section-copy-block,
.feature-stack,
.steps-shell {
    border-radius: var(--radius-xl);
}

.section-copy-block {
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feature-stack {
    display: grid;
    gap: 1rem;
}

.feature-item,
.step-card,
.auth-note,
.admin-stat {
    padding: 1.35rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.82);
}

.feature-item strong,
.step-card h3,
.auth-note strong,
.admin-stat strong {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 1rem;
    font-weight: 700;
}

.feature-item p,
.step-card p,
.auth-note span,
.admin-content p,
.conversation-sidebar__copy,
.auth-panel__header p,
.empty-note {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.steps-shell {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    padding: 1rem;
}

.step-card span {
    display: inline-flex;
    margin-bottom: 0.75rem;
    color: var(--brand-strong);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.cta-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 460px);
    gap: 1.25rem;
    align-items: stretch;
    width: min(calc(100% - 2rem), 1180px);
    margin: 0 auto;
    padding: 1.5rem 0;
}

.auth-story,
.auth-panel {
    border-radius: var(--radius-xl);
}

.auth-story {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 2rem;
}

.auth-notes {
    display: grid;
    gap: 0.9rem;
}

.auth-panel-wrap {
    display: flex;
}

.auth-panel {
    width: 100%;
    padding: 2rem;
}

.auth-panel__header {
    display: grid;
    gap: 0.45rem;
    margin-bottom: 1.25rem;
}

.auth-panel__header h2 {
    margin: 0;
    font-size: 1.8rem;
    letter-spacing: -0.04em;
}

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

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

.form-field span,
.demo-credentials dt {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
}

.field-input,
.chat-input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.94);
    color: var(--text);
    padding: 0.95rem 1rem;
    outline: none;
    transition:
        border-color 140ms ease,
        box-shadow 140ms ease,
        background-color 140ms ease;
}

.field-input:focus,
.chat-input:focus {
    border-color: rgba(16, 144, 16, 0.3);
    box-shadow: 0 0 0 4px rgba(231, 246, 231, 0.95);
}

.form-alert {
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(163, 90, 73, 0.18);
    background: rgba(250, 237, 232, 0.96);
    color: var(--danger);
}

.demo-credentials {
    display: grid;
    gap: 1rem;
    margin-top: 1.2rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--line);
}

.demo-credentials strong {
    display: block;
    margin-bottom: 0.3rem;
}

.demo-credentials dl {
    margin: 0;
    display: grid;
    gap: 0.75rem;
}

.demo-credentials dd {
    margin: 0.25rem 0 0;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text);
}

.auth-panel__footer {
    display: flex;
    justify-content: center;
    margin-top: 1.2rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--line);
}

.workspace-page {
    min-height: 100vh;
    padding: 1rem 0;
}

.workspace-topbar {
    margin-bottom: 1rem;
}

.workspace-topbar__inner {
    padding: 0.95rem 1rem;
    border-radius: 999px;
}

.workspace-topbar__left {
    min-width: 0;
}

.workspace-user {
    color: var(--muted);
    font-size: 0.92rem;
    white-space: nowrap;
}

.workspace-app {
    display: grid;
    grid-template-columns: 310px minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
    min-height: calc(100vh - 7rem);
}

.conversation-sidebar,
.chat-stage {
    border-radius: var(--radius-xl);
}

.conversation-sidebar {
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

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

.conversation-sidebar__header h2 {
    margin: 0.55rem 0 0;
    font-size: 1.35rem;
    letter-spacing: -0.04em;
}

.conversation-list {
    display: grid;
    gap: 0.7rem;
    margin-top: 1rem;
    overflow: auto;
}

.conversation-empty-state {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px dashed var(--line);
    color: var(--muted);
    font-size: 0.92rem;
}

.conversation-item {
    display: grid;
    gap: 0.35rem;
    width: 100%;
    padding: 0.95rem 1rem;
    border: 1px solid transparent;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.76);
    text-align: left;
    cursor: pointer;
    transition:
        transform 140ms ease,
        border-color 140ms ease,
        background-color 140ms ease;
}

.conversation-item:hover {
    transform: translateY(-1px);
    border-color: var(--line);
}

.conversation-item.is-active {
    border-color: rgba(16, 144, 16, 0.18);
    background: rgba(244, 251, 241, 0.96);
}

.conversation-item__title {
    font-weight: 600;
    letter-spacing: -0.02em;
}

.conversation-item__preview {
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.45;
}

.conversation-item__meta {
    color: var(--muted);
    font-size: 0.78rem;
}

.chat-stage {
    display: flex;
    flex-direction: column;
    padding: 1.4rem;
    gap: 1rem;
    min-width: 0;
}

.chat-stage__header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
}

.chat-stage__header h1 {
    margin: 0.55rem 0 0.4rem;
    font-size: clamp(1.7rem, 2vw + 1rem, 2.6rem);
    letter-spacing: -0.05em;
}

.chat-stage__header p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.chat-messages {
    flex: 1;
    min-height: 420px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: auto;
    padding: 0.35rem 0.1rem 0.35rem 0;
}

.chat-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
}

.chat-empty__card {
    max-width: 26rem;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px dashed var(--line);
    background: rgba(255, 255, 255, 0.54);
    text-align: center;
    color: var(--muted);
}

.chat-empty__card strong {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--text);
}

.message-row {
    display: flex;
}

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

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

.message-bubble {
    max-width: min(100%, 44rem);
    padding: 1rem 1.05rem;
    border-radius: 1.25rem;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 14px 28px rgba(20, 20, 20, 0.05);
}

.message-row--user .message-bubble {
    border-color: rgba(16, 144, 16, 0.14);
    background: rgba(231, 246, 231, 0.98);
    color: var(--brand-strong);
}

.message-row--error .message-bubble {
    border-color: rgba(163, 90, 73, 0.18);
    background: rgba(251, 240, 236, 0.98);
}

.message-content {
    line-height: 1.7;
    white-space: normal;
}

.message-content p {
    margin: 0;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.55rem;
    color: var(--muted);
    font-size: 0.78rem;
}

.message-channel {
    padding: 0.18rem 0.45rem;
    border-radius: 999px;
    background: rgba(231, 246, 231, 0.95);
    color: var(--brand-strong);
    font-weight: 700;
}

.message-retry {
    margin-top: 0.8rem;
}

.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.typing-indicator__dots {
    display: inline-flex;
    gap: 0.35rem;
}

.typing-indicator__dots span {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: var(--brand);
    animation: bounce 1.2s infinite ease-in-out;
}

.typing-indicator__dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-indicator__dots span:nth-child(3) {
    animation-delay: 0.3s;
}

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

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

.chat-composer__field {
    min-width: 0;
}

.chat-input {
    min-height: 3.4rem;
    max-height: 12rem;
    resize: vertical;
    line-height: 1.5;
}

.sidebar-backdrop {
    display: none;
}

.surface-panel {
    border-radius: var(--radius-xl);
    padding: 1.25rem;
}

.surface-panel__header {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.surface-panel__title {
    margin: 0;
    font-size: 1.15rem;
    letter-spacing: -0.03em;
}

.surface-panel__subtitle {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.admin-page {
    display: grid;
    gap: 1rem;
    padding-bottom: 1.5rem;
}

.admin-hero {
    display: grid;
    gap: 1rem;
    padding: 1.8rem;
    border-radius: var(--radius-xl);
}

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

.admin-stat span {
    color: var(--muted);
    font-size: 0.84rem;
}

.admin-stat strong {
    margin-top: 0.45rem;
    font-size: 1.7rem;
    letter-spacing: -0.05em;
}

.admin-grid {
    display: grid;
    gap: 1rem;
}

.admin-feed {
    display: grid;
    gap: 0.75rem;
}

.admin-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.85rem;
    padding: 1rem;
    border-radius: 1.1rem;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.74);
}

.admin-dot {
    width: 0.7rem;
    height: 0.7rem;
    margin-top: 0.4rem;
    border-radius: 999px;
    background: var(--brand);
}

.admin-dot--danger {
    background: var(--danger);
}

.admin-dot--warning {
    background: var(--warning);
}

.admin-content {
    min-width: 0;
}

.admin-content strong {
    display: block;
    margin-bottom: 0.2rem;
}

.row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-bottom: 0.35rem;
    color: var(--muted);
    font-size: 0.82rem;
}

[data-reveal] {
    opacity: 0;
    transform: translateY(18px);
    transition:
        opacity 480ms ease,
        transform 480ms ease;
}

[data-reveal].is-visible {
    opacity: 1;
    transform: translateY(0);
}

.mobile-only {
    display: none;
}

@media (max-width: 980px) {
    .landing-hero__inner,
    .content-grid,
    .auth-shell,
    .workspace-app,
    .steps-shell,
    .admin-stats {
        grid-template-columns: 1fr;
    }

    .workspace-app {
        min-height: auto;
    }

    .conversation-sidebar {
        position: fixed;
        top: 1rem;
        left: 1rem;
        bottom: 1rem;
        width: min(86vw, 340px);
        z-index: 40;
        transform: translateX(-110%);
        transition: transform 220ms ease;
    }

    .workspace-page.workspace-page--sidebar-open .conversation-sidebar {
        transform: translateX(0);
    }

    .workspace-page.workspace-page--sidebar-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(17, 17, 17, 0.18);
        z-index: 30;
    }

    .mobile-only {
        display: inline-flex;
    }

    .workspace-topbar__actions {
        gap: 0.55rem;
    }

    .workspace-user {
        display: none;
    }
}

@media (max-width: 720px) {
    .shell {
        width: min(calc(100% - 1rem), var(--shell));
    }

    .site-nav__inner,
    .workspace-topbar__inner {
        border-radius: 1.25rem;
    }

    .site-nav__actions {
        display: none;
    }

    .landing-hero__copy,
    .hero-card,
    .auth-story,
    .auth-panel,
    .chat-stage,
    .conversation-sidebar,
    .admin-hero,
    .surface-panel {
        padding: 1.25rem;
    }

    .brand-lockup__bia {
        width: 9.5rem;
        height: 3rem;
    }

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

    .button--primary,
    .button--secondary,
    .button--ghost {
        width: 100%;
    }

    .landing-actions {
        flex-direction: column;
    }

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