:root {
    --bg: #f4f0e8;
    --bg-soft: #fbf8f2;
    --panel: rgba(255, 255, 255, 0.78);
    --panel-strong: #fffdf8;
    --line: rgba(29, 28, 26, 0.1);
    --text: #1d1c1a;
    --muted: #60584d;
    --brand: #1f6a5e;
    --brand-strong: #0f4d43;
    --accent: #d78642;
    --danger: #a94838;
    --shadow: 0 20px 60px rgba(51, 39, 20, 0.12);
    --radius-lg: 28px;
    --radius-md: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: "Segoe UI", "Helvetica Neue", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(215, 134, 66, 0.18), transparent 30%),
        radial-gradient(circle at top right, rgba(31, 106, 94, 0.18), transparent 28%),
        linear-gradient(180deg, #f7f2ea 0%, #f2ede4 100%);
}
a { color: inherit; }
.page-shell {
    width: min(1140px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 80px;
}
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(18px);
    background: rgba(244, 240, 232, 0.8);
    border-bottom: 1px solid var(--line);
}
.site-header-inner {
    width: min(1140px, calc(100% - 32px));
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 0;
}
.brand { text-decoration: none; }
.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.brand-dot {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--brand));
    box-shadow: 0 0 0 8px rgba(215, 134, 66, 0.12);
}
.site-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.nav-link, .button, .text-link { text-decoration: none; }
.nav-link {
    padding: 10px 14px;
    border-radius: 999px;
    color: var(--muted);
}
.nav-link:hover {
    background: rgba(255, 255, 255, 0.6);
    color: var(--text);
}
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 600;
    cursor: pointer;
}
.button-primary {
    color: white;
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    box-shadow: 0 14px 32px rgba(15, 77, 67, 0.22);
}
.button-secondary {
    background: rgba(255, 255, 255, 0.62);
    border-color: var(--line);
}
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
    gap: 24px;
    align-items: stretch;
    padding: 44px 0 28px;
}
.hero-copy, .hero-panel, .card, .auth-card, .flash {
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.hero-copy, .hero-panel, .auth-card { padding: 30px; }
.hero h1, .section-heading h1, .section-heading h2, .auth-card h1 {
    margin: 0;
    line-height: 1.05;
    letter-spacing: -0.04em;
}
.hero h1 {
    font-size: clamp(2.6rem, 7vw, 5.4rem);
    max-width: 11ch;
}
.hero-text {
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.75;
}
.eyebrow {
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.78rem;
    color: var(--brand-strong);
    font-weight: 700;
}
.hero-actions, .form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 22px;
}
.feature-list {
    margin: 18px 0 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.8;
}
.section-block { padding: 28px 0 8px; }
.section-heading { margin-bottom: 18px; }
.section-heading h2, .section-heading h1 {
    font-size: clamp(2rem, 4vw, 3.3rem);
    max-width: 14ch;
}
.grid { display: grid; gap: 18px; }
.two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.services-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { padding: 24px; }
.card-spotlight {
    background: linear-gradient(160deg, rgba(31, 106, 94, 0.92), rgba(15, 77, 67, 0.92));
    color: white;
}
.card p, .service-card p { color: inherit; line-height: 1.7; }
.service-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.badge, .service-kind {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    background: rgba(31, 106, 94, 0.12);
    color: var(--brand-strong);
}
.auth-body { min-height: 100vh; }
.auth-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 88px);
}
.auth-card { width: min(720px, 100%); }
.form-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 22px;
}
.form-grid .full { grid-column: 1 / -1; }
label span {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}
input {
    width: 100%;
    min-height: 50px;
    padding: 0 16px;
    border-radius: 16px;
    border: 1px solid rgba(29, 28, 26, 0.14);
    background: rgba(255, 253, 248, 0.92);
    font: inherit;
}
input:focus {
    outline: 2px solid rgba(31, 106, 94, 0.24);
    border-color: var(--brand);
}
.field-error, .field-error-box { color: var(--danger); }
.field-error {
    display: block;
    margin-top: 8px;
}
.field-error-box {
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(169, 72, 56, 0.08);
    border: 1px solid rgba(169, 72, 56, 0.12);
}
.flash-wrap { padding-top: 20px; }
.flash {
    padding: 16px 18px;
    margin-bottom: 14px;
}
.flash-success { border-left: 5px solid var(--brand); }
.flash-error { border-left: 5px solid var(--danger); }
.text-link {
    display: inline-flex;
    align-items: center;
    color: var(--brand-strong);
    font-weight: 600;
}
.inline-form { margin-top: 12px; }

.chat-layout {
    align-items: stretch;
}

.chat-shell {
    display: grid;
    gap: 18px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: 22px;
}

.chat-messages {
    min-height: 360px;
    max-height: 60vh;
    overflow: auto;
    display: grid;
    gap: 12px;
    padding: 8px;
    background: rgba(255, 253, 248, 0.74);
    border-radius: 22px;
    border: 1px solid var(--line);
}

.chat-bubble {
    max-width: min(82%, 760px);
    padding: 14px 16px;
    border-radius: 20px;
    box-shadow: 0 10px 24px rgba(31, 27, 20, 0.08);
}

.chat-bubble-user {
    margin-left: auto;
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    color: white;
}

.chat-bubble-assistant {
    margin-right: auto;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(29, 28, 26, 0.08);
}

.chat-bubble-meta {
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.7;
    margin-bottom: 8px;
}

.chat-bubble-body {
    white-space: pre-wrap;
    line-height: 1.7;
}

.chat-form {
    display: grid;
    gap: 12px;
}

.chat-label {
    font-weight: 700;
    color: var(--brand-strong);
}

.chat-input {
    width: 100%;
    min-height: 140px;
    resize: vertical;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(29, 28, 26, 0.14);
    background: rgba(255, 253, 248, 0.96);
    font: inherit;
}

.chat-input:focus {
    outline: 2px solid rgba(31, 106, 94, 0.24);
    border-color: var(--brand);
}

.chat-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.chat-status {
    color: var(--muted);
    font-weight: 600;
}

.account-layout {
    align-items: stretch;
}

.account-card {
    display: grid;
    gap: 16px;
}

.account-card-profile {
    align-content: start;
    justify-items: start;
}

.account-avatar {
    width: 124px;
    height: 124px;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid rgba(29, 28, 26, 0.08);
    box-shadow: 0 16px 36px rgba(31, 27, 20, 0.14);
    background: rgba(255, 255, 255, 0.92);
}

.nav-link-account {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.nav-avatar {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid rgba(29, 28, 26, 0.12);
    background: rgba(255,255,255,0.9);
}

.account-helper {
    color: var(--muted);
    line-height: 1.7;
}

input[type="file"] {
    padding: 14px;
}

.avatar-modal {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
}

.avatar-modal.hidden {
    display: none;
}

.avatar-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 17, 14, 0.62);
    backdrop-filter: blur(10px);
}

.avatar-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(720px, calc(100% - 24px));
    background: rgba(251, 248, 242, 0.98);
    border-radius: 28px;
    box-shadow: 0 28px 80px rgba(23, 20, 16, 0.28);
    padding: 22px;
    display: grid;
    gap: 18px;
}

.avatar-modal-header,
.avatar-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.avatar-modal-close {
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
}

.avatar-modal-body {
    display: grid;
    gap: 18px;
}

.avatar-editor-wrap {
    display: flex;
    justify-content: center;
}

.avatar-editor {
    position: relative;
    width: min(420px, 78vw);
    height: min(420px, 78vw);
    overflow: hidden;
    border-radius: 28px;
    background: linear-gradient(135deg, #dde1e6, #c8ccd1);
    cursor: grab;
    touch-action: none;
}

.avatar-editor:active {
    cursor: grabbing;
}

.avatar-editor-image {
    position: absolute;
    left: 0;
    top: 0;
    user-select: none;
    pointer-events: none;
}

.avatar-editor-mask {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, transparent 0 45%, rgba(20, 17, 14, 0.45) 45.5% 100%);
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.9);
    border-radius: 28px;
    pointer-events: none;
}

.avatar-controls {
    display: grid;
    gap: 10px;
}

.avatar-controls input[type="range"] {
    width: 100%;
}

@media (max-width: 900px) {
    .hero,
    .two-up,
    .services-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .site-header-inner {
        align-items: flex-start;
        flex-direction: column;
    }

    .avatar-modal-dialog {
        width: calc(100% - 16px);
        padding: 18px;
    }
}