/* Household — frontend foundation */

:root {
    --background: #f7f7f5;
    --surface: #ffffff;
    --surface-subtle: #f1f1ee;
    --text: #20201e;
    --text-muted: #74746e;
    --border: #deded8;
    --border-strong: #cfcfc8;
    --accent: #252523;
    --accent-text: #ffffff;
    --focus: #6f6f68;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);

    --radius-small: 10px;
    --radius-medium: 16px;
    --radius-large: 22px;

    --content-width: 860px;
}

* {
    box-sizing: border-box;
}

html {
    height: 100%;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont,
        "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: var(--background);
}

body {
    min-height: 100%;
    margin: 0;
    background: var(--background);
}

button,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

button:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    width: min(100%, var(--content-width));
    margin: 0 auto;
    padding: 24px 20px 18px;
}

.app-header h1 {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.2;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.app-header p {
    margin: 5px 0 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.4;
}

.chat {
    width: min(100%, var(--content-width));
    flex: 1;
    margin: 0 auto;
    padding: 8px 16px 20px;
    display: flex;
    flex-direction: column;
}

.messages {
    flex: 1;
    min-height: 280px;
    overflow-y: auto;
    padding: 16px 4px 28px;
    scroll-behavior: smooth;
}

.message-row {
    display: flex;
    width: 100%;
    margin-bottom: 14px;
}

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

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

.message {
    max-width: min(78%, 620px);
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-medium);
    box-shadow: var(--shadow);
}

.message p {
    margin: 0;
    font-size: 0.96rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.assistant-message {
    background: var(--surface);
    border-bottom-left-radius: var(--radius-small);
}

.user-message {
    color: var(--accent-text);
    background: var(--accent);
    border-color: var(--accent);
    border-bottom-right-radius: var(--radius-small);
}

.composer-area {
    width: 100%;
}

.status-message {
    min-height: 24px;
    padding: 0 4px 7px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.status-text {
    display: none;
}

.status-text.is-visible {
    display: inline;
}

.composer {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow);
}

.composer textarea {
    flex: 1;
    min-width: 0;
    min-height: 42px;
    max-height: 150px;
    resize: none;
    padding: 10px 8px 10px 10px;
    color: var(--text);
    background: transparent;
    border: 0;
    outline: 0;
    line-height: 1.4;
}

.composer textarea::placeholder {
    color: #96968f;
}

.composer textarea:focus-visible {
    outline: none;
}

.composer button {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 16px;
    color: var(--accent-text);
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 13px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: opacity 120ms ease;
}

.composer button:hover {
    opacity: 0.88;
}

.composer button:active {
    opacity: 0.75;
}

.composer button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

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

@media (min-width: 700px) {
    .app-header {
        padding: 30px 24px 20px;
    }

    .chat {
        padding: 8px 24px 28px;
    }

    .messages {
        padding-top: 24px;
    }

    .message {
        padding: 13px 16px;
    }
}

@media (max-width: 420px) {
    .app-header {
        padding: 20px 16px 14px;
    }

    .chat {
        padding: 4px 10px 12px;
    }

    .message {
        max-width: 86%;
    }

    .composer {
        gap: 6px;
        padding: 6px;
    }

    .composer button {
        padding: 0 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .messages {
        scroll-behavior: auto;
    }

    .composer button {
        transition: none;
    }
}
