/* Global */
:root {
    --brand-surface: #f7f2eb;
    --brand-surface-strong: #f0e7db;
    --brand-surface-soft: #fbf8f3;
    --brand-card-bg: #ffffff;
    --brand-card-border: #d9cfc0;
    --brand-divider: #e6ddd1;
    --brand-text-primary: #1f1813;
    --brand-text-muted: #7c7166;
    --brand-heading: #0c0b0a;
    --brand-primary: #141414;
    --brand-accent: #b48743;
    --brand-shadow: rgba(23, 16, 12, 0.08);
}

* {
    box-sizing: border-box;
    font-family: 'Space Mono', 'IBM Plex Mono', 'Inconsolata', monospace;
    letter-spacing: 0.015em;
}

::selection {
    background: var(--brand-primary);
    color: #ffffff;
}

body,
html {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    height: 100%;
    background: linear-gradient(180deg, var(--brand-surface) 0%, var(--brand-surface-soft) 70%, #ffffff 100%);
    color: var(--brand-text-primary);
    overflow: hidden;
}

/* Base elements */
a {
    color: var(--brand-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

a:hover {
    border-bottom-color: var(--brand-primary);
    color: #000000;
}

strong {
    color: var(--brand-heading);
}

/* Layout */
.split-layout {
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: row;
    gap: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.split-layout__hero {
    flex: 1.45;
    height: 100%;
    padding: clamp(1rem, 2.5vw, 1.75rem);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background: radial-gradient(circle at top right, rgba(23, 16, 12, 0.05), transparent 60%), var(--brand-surface);
    position: relative;
    overflow-y: hidden;
    overflow-x: hidden;
    border-right: 1px solid var(--brand-divider);
}

.split-layout__panel {
    flex: 0 0 clamp(320px, 22vw, 420px);
    height: 100%;
    padding: clamp(1rem, 2.5vw, 1.75rem);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-card-bg);
    border-left: 1px solid var(--brand-divider);
    box-shadow: -40px 0 70px -50px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

@media (max-width: 1450px), (max-height: 750px) {
    .split-layout {
        flex-direction: column;
    }

    .split-layout__hero {
        display: none;
    }

    .split-layout__panel {
        flex: 1 1 100%;
        flex-basis: auto;
        width: 100%;
        max-width: 100%;
        border-left: none;
        box-shadow: none;
    }
}

@media (max-width: 1024px) {
    body,
    html {
        overflow: auto;
    }

    .split-layout {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .split-layout__hero {
        padding: 3rem 2rem;
        min-height: 55vh;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--brand-divider);
        overflow: visible;
    }

    .split-layout__panel {
        padding: 2.5rem 2rem;
        height: auto;
        border-left: none;
        box-shadow: none;
        overflow: visible;
        order: -1;
        margin-bottom: 2rem;
    }

    .conversation-flow {
        max-width: none;
        margin: 0;
    }
}

/* Hero flow */
.conversation-flow {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    column-gap: 0.6rem;
    row-gap: 1.6rem;
    align-items: stretch;
    align-content: center;
    margin: 0;
}

.flow-start {
    grid-column: 1;
    grid-row: 1 / -1;
    display: flex;
    align-items: stretch;
    justify-content: center;
    position: sticky;
    top: 50%;
    transform: translateY(-50%);
    height: max-content;
}

.flow-start::after {
    display: none;
}

.flow-branches {
    grid-column: 2 / span 4;
    display: grid;
    row-gap: 1.35rem;
    position: relative;
    align-content: center;
}

.flow-branches::before {
    content: "";
    position: absolute;
    left: -0.6rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(180deg, rgba(20, 20, 20, 0.35), rgba(20, 20, 20, 0));
}

.flow-branch {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    column-gap: 0.6rem;
    row-gap: 0.6rem;
}

.flow-branch::before {
    content: "";
    position: absolute;
    left: -0.6rem;
    top: 1.05rem;
    width: 1.2rem;
    height: 2px;
    background: linear-gradient(90deg, rgba(20, 20, 20, 0.4), rgba(20, 20, 20, 0));
}

.flow-branch__heading {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.flow-branch__line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(20, 20, 20, 0.25), rgba(20, 20, 20, 0));
}

.flow-connector__label {
    font-size: 0.78rem;
    color: var(--brand-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    white-space: nowrap;
}

.flow-branch__messages {
    grid-column: 1 / span 4;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    column-gap: 0.6rem;
    min-width: 0;
    overflow: visible;
}

.flow-branch__messages::-webkit-scrollbar {
    height: 6px;
}

.flow-branch__messages::-webkit-scrollbar-thumb {
    background: rgba(20, 20, 20, 0.2);
    border-radius: 999px;
}

.flow-branch__messages .flow-node,
.flow-start .flow-node {
    width: 100%;
    max-width: none;
    min-width: 0;
    box-sizing: border-box;
    justify-self: stretch;
}

.flow-node {
    background: var(--brand-card-bg);
    border: 1.5px solid var(--brand-card-border);
    border-radius: 18px;
    padding: 1.45rem;
    line-height: 1.55;
    color: var(--brand-text-primary);
    box-shadow: 0 18px 40px var(--brand-shadow);
}

.flow-node--start {
    background: var(--brand-surface-soft);
    border-color: rgba(20, 20, 20, 0.12);
}

.flow-node--human {
    background: var(--brand-primary);
    border-color: #000000;
    color: #ffffff;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.15);
}

.flow-node--success {
    border-color: var(--brand-accent);
    background: rgba(180, 135, 67, 0.08);
}

.flow-node--accent {
    border-color: var(--brand-accent);
    background: rgba(180, 135, 67, 0.12);
}

@media (max-width: 900px) {
    .conversation-flow {
        grid-template-columns: 1fr;
        gap: 2.8rem;
    }

    .flow-start {
        justify-content: flex-start;
        padding-right: 0;
    }

    .flow-start::after {
        display: none;
    }

    .flow-branches {
        gap: 2.2rem;
    }

    .flow-branches::before {
        display: none;
    }

    .flow-branch {
        padding-left: 0;
    }

    .flow-branch::before {
        display: none;
    }

    .flow-branch__heading {
        gap: 0.6rem;
    }

    .flow-branch__messages {
        flex-direction: column;
        gap: 1rem;
        overflow-x: visible;
    }

    .flow-branch__messages .flow-node {
        width: 100%;
        flex: 1 1 auto;
        max-width: none;
    }

    .flow-connector__label {
        white-space: normal;
    }
}

/* Panel card */
.panel-card {
    width: 100%;
    max-width: 380px;
    display: grid;
    gap: 2.6rem;
}

.panel-card__header {
    display: grid;
    gap: 0.75rem;
    text-align: center;
}

.panel-card__header .brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    font-size: 1rem;
    letter-spacing: 0.14em;
    color: var(--brand-primary);
    text-transform: uppercase;
}

.panel-card__header .brand img {
    width: 30px;
    height: 30px;
    filter: grayscale(1);
}

.panel-card__header h2 {
    margin: 0;
    font-size: 2rem;
    font-weight: 500;
    color: var(--brand-heading);
    letter-spacing: 0.04em;
}

.panel-card__header p {
    margin: 0;
    color: var(--brand-text-muted);
    font-size: 0.92rem;
    line-height: 1.6;
}

/* Forms */
.form-shell {
    display: grid;
    gap: 1.35rem;
}

/* Sits where the login form used to be: says where credentials are entered, so
   the panel does not look truncated now that it has only a button. */
.form-note {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  opacity: 0.75;
}

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

.form-field label {
    font-size: 0.82rem;
    color: var(--brand-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.form-field input,
.form-field textarea {
    width: 100%;
    border: 1.5px solid var(--brand-card-border);
    border-radius: 14px;
    padding: 0.9rem 1.1rem;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.96);
    color: var(--brand-text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-field textarea {
    resize: vertical;
    min-height: 120px;
}

.form-field input:focus,
.form-field textarea:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(20, 20, 20, 0.08);
    outline: none;
    background: #ffffff;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
    color: rgba(31, 24, 19, 0.35);
}

/* Buttons */
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
    border: none;
    border-radius: 14px;
    padding: 0.95rem 1.5rem;
    font-size: 0.96rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.btn-primary {
    background: var(--brand-primary);
    color: #ffffff;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
    text-transform: uppercase;
}

.btn-primary:hover {
    transform: translateY(-2px);
    background: #000000;
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: #ffffff;
    color: var(--brand-primary);
    border: 1.5px solid var(--brand-primary);
    text-transform: uppercase;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    background: var(--brand-primary);
    color: #ffffff;
}

.btn-ghost {
    background: transparent;
    color: var(--brand-text-muted);
    border: 1.5px solid var(--brand-card-border);
}

.btn-ghost:hover {
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.btn-stack {
    display: grid;
    gap: 0.8rem;
}

/* Inline helpers */
.panel-card__footer {
    display: grid;
    gap: 0.4rem;
    text-align: center;
    color: var(--brand-text-muted);
    font-size: 0.92rem;
}

.panel-card__footer a {
    font-weight: 500;
    border-bottom: 1px solid rgba(20, 20, 20, 0.2);
}

.panel-card__footer a:hover {
    border-bottom-color: var(--brand-primary);
}

/* Messages */
.form-message {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--brand-primary);
    display: none;
}

.form-message.visible {
    display: block;
}

.form-message.error {
    color: #b23d2a;
}

.form-message.success {
    color: #1a8f62;
}

/* Redirect fallback */
.redirect-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--brand-text-muted);
    font-size: 0.95rem;
    background: var(--brand-surface-soft);
}
