:root {
    --ikea-blue: #0058a3;
    --ikea-yellow: #ffdb00;
    --ink: #17202a;
    --muted: #667085;
    --line: #d8dee8;
    --surface: #ffffff;
    --soft: #f4f7fb;
    --success: #157f4f;
    --danger: #b42318;
    --shadow: 0 20px 60px rgba(15, 35, 55, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: #eef3f8;
    font-family: Arial, Helvetica, sans-serif;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.hidden {
    display: none !important;
}

.public-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 18px 24px;
}

.brand-wrap {
    width: min(1120px, 100%);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
}

.brand-identity {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 22px;
}

.ikea-logo {
    width: 136px;
    height: auto;
    display: block;
}

.brand-kicker,
.eyebrow {
    margin: 0 0 4px;
    color: var(--ikea-blue);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h1 {
    margin: 0;
    font-size: clamp(22px, 3vw, 34px);
    line-height: 1.12;
    letter-spacing: 0;
}

h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.22;
    letter-spacing: 0;
}

.access-screen,
.app-layout {
    width: min(1120px, calc(100% - 32px));
    margin: 32px auto;
}

.access-screen {
    min-height: calc(100vh - 140px);
    display: grid;
    place-items: center;
}

.access-panel,
.conversation-card,
.chat-panel,
.spec-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.access-panel {
    width: min(420px, 100%);
    padding: 32px;
}

.access-logo {
    width: 150px;
    margin-bottom: 24px;
}

.access-form,
.start-form {
    display: grid;
    gap: 12px;
    margin-top: 22px;
}

label {
    color: #344054;
    font-size: 14px;
    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid #c7d0dd;
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    outline: none;
}

input,
select {
    min-height: 44px;
    padding: 10px 12px;
}

textarea {
    resize: vertical;
    min-height: 76px;
    max-height: 220px;
    padding: 12px 14px;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--ikea-blue);
    box-shadow: 0 0 0 3px rgba(0, 88, 163, 0.13);
}

.form-error,
.status-line {
    margin: 0;
    color: var(--danger);
    font-size: 14px;
}

.primary-button,
.secondary-button,
.quiet-button,
.icon-button {
    border: 0;
    border-radius: 6px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    letter-spacing: 0;
}

.primary-button {
    padding: 0 18px;
    color: #071321;
    background: var(--ikea-yellow);
}

.primary-button:hover {
    background: #f3cf00;
}

.secondary-button {
    padding: 0 16px;
    color: #ffffff;
    background: var(--ikea-blue);
}

.secondary-button:hover {
    background: #004b8d;
}

.quiet-button {
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line);
    color: var(--ikea-blue);
    background: #ffffff;
}

.quiet-button:hover {
    border-color: #bfd2e4;
    background: #e9f2fb;
}

.quiet-button svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.icon-button {
    width: 48px;
    color: var(--ikea-blue);
    background: #e9f2fb;
}

.icon-button svg,
.send-button svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.icon-button.recording {
    color: #ffffff;
    background: var(--danger);
}

.app-layout {
    display: grid;
    gap: 20px;
}

.conversation-card {
    padding: 28px;
}

.chat-panel {
    min-height: 660px;
    display: grid;
    grid-template-rows: auto 1fr auto auto;
}

.chat-topbar {
    padding: 20px 22px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.readiness-widget {
    width: min(280px, 100%);
    display: grid;
    gap: 8px;
}

.readiness-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.readiness-meta strong {
    color: var(--ikea-blue);
    font-size: 15px;
}

.readiness-threshold {
    margin: -3px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.2;
}

.readiness-track {
    height: 10px;
    overflow: hidden;
    border: 1px solid #bfd2e4;
    border-radius: 999px;
    background: #eef3f8;
}

.readiness-track span {
    width: 0%;
    height: 100%;
    display: block;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--ikea-blue), var(--success));
    transition: width 220ms ease;
}

.messages {
    min-height: 360px;
    max-height: 58vh;
    overflow: auto;
    padding: 22px;
    background: linear-gradient(180deg, #f9fbfd 0%, #f2f6fa 100%);
}

.message {
    display: flex;
    margin: 0 0 14px;
}

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

.message-body {
    max-width: min(680px, 88%);
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    line-height: 1.48;
    white-space: pre-wrap;
}

.message-user .message-body {
    color: #071321;
    background: #fff4a8;
    border-color: #efd45d;
}

.composer {
    padding: 18px 22px;
    border-top: 1px solid var(--line);
    background: #ffffff;
}

.composer-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.send-button {
    min-width: 124px;
}

.status-line {
    min-height: 24px;
    padding: 0 22px 18px;
    color: var(--muted);
}

.spec-panel {
    padding: 24px;
}

.spec-panel pre {
    margin: 18px 0 0;
    padding: 18px;
    max-height: 680px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    color: #243142;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
}

@media (max-width: 720px) {
    .public-header {
        padding: 16px;
    }

    .brand-wrap {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 14px;
    }

    .brand-identity {
        align-items: flex-start;
        gap: 14px;
    }

    .ikea-logo {
        width: 98px;
        flex: 0 0 auto;
    }

    .public-logout-form {
        width: 100%;
    }

    .quiet-button {
        width: 100%;
    }

    .access-screen,
    .app-layout {
        width: calc(100% - 20px);
        margin: 16px auto;
    }

    .access-panel,
    .conversation-card,
    .spec-panel {
        padding: 20px;
    }

    .chat-topbar {
        align-items: stretch;
        flex-direction: column;
        padding: 16px;
    }

    .readiness-widget {
        width: 100%;
    }

    .messages {
        padding: 16px;
        max-height: 54vh;
    }

    .message-body {
        max-width: 94%;
    }

    .composer {
        padding: 14px;
    }

    .composer-actions {
        justify-content: stretch;
    }

    .send-button {
        flex: 1;
    }
}
