:root {
    --bg: #f7faf9;
    --panel: #ffffff;
    --panel-soft: #f1fbf8;
    --text: #111827;
    --muted: #7b8494;
    --line: #e5e7eb;
    --accent: #13c2a3;
    --accent-dark: #0fa88d;
    --accent-soft: #dff8f2;
    --incoming: #f1f1f4;
    --shadow: 0 18px 40px rgba(17, 24, 39, 0.08);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(19, 194, 163, 0.11), transparent 32%),
        linear-gradient(135deg, #f9fbfb, #eef5f3);
    color: var(--text);
}

/* Shared branding */

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 1.45rem;
    color: var(--accent-dark);
}

.brand-icon,
.feature-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(19, 194, 163, 0.22);
}

/* Auth pages */

.auth-page {
    width: min(1180px, calc(100vw - 48px));
    min-height: 720px;
    margin: 48px auto;
    display: grid;
    grid-template-columns: 0.95fr 1.25fr;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 34px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.auth-brand-panel {
    padding: 58px;
    background:
        radial-gradient(circle at 20% 75%, rgba(19, 194, 163, 0.14), transparent 28%),
        linear-gradient(180deg, #f2fbf8, #ffffff);
    display: flex;
    flex-direction: column;
    gap: 38px;
}

.brand-copy h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.12;
    margin: 0 0 18px;
    letter-spacing: -0.04em;
}

.brand-copy p,
.subtitle,
.feature-item p,
.security-card p,
.secure-footnote {
    color: var(--muted);
    line-height: 1.6;
}

.security-graphic {
    flex: 1;
    display: grid;
    place-items: center;
    min-height: 220px;
}

.shield {
    width: 180px;
    height: 180px;
    border-radius: 42px;
    display: grid;
    place-items: center;
    font-size: 4rem;
    background: linear-gradient(145deg, rgba(19, 194, 163, 0.18), rgba(19, 194, 163, 0.42));
    box-shadow: 0 28px 60px rgba(19, 194, 163, 0.25);
}

.security-note,
.sidebar-security {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 0.95rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
    background: var(--accent);
}

.feature-list {
    display: grid;
    gap: 24px;
}

.feature-item {
    display: flex;
    gap: 18px;
    align-items: flex-start;
}

.feature-item h3 {
    margin: 0 0 4px;
    font-size: 1rem;
}

.feature-item p {
    margin: 0;
    max-width: 280px;
}

.security-card {
    background: rgba(223, 248, 242, 0.65);
    border: 1px solid rgba(19, 194, 163, 0.12);
    border-radius: var(--radius-md);
    padding: 22px;
}

.security-card p {
    margin: 8px 0 0;
}

.auth-form-panel {
    display: grid;
    place-items: center;
    padding: 58px;
}

.auth-card {
    width: min(520px, 100%);
    background: var(--panel);
    border: 1px solid rgba(229, 231, 235, 0.75);
    border-radius: var(--radius-lg);
    padding: 46px;
    box-shadow: var(--shadow);
}

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

.subtitle {
    margin: 8px 0 30px;
}

.auth-card label {
    display: block;
    font-size: 0.92rem;
    color: #374151;
    margin-bottom: 10px;
    font-weight: 650;
}

.input-group {
    height: 58px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0 16px;
    margin-bottom: 18px;
    background: #ffffff;
}

.input-group:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(19, 194, 163, 0.12);
}

.input-icon {
    opacity: 0.65;
}

.input-group input {
    flex: 1;
    border: 0;
    outline: 0;
    min-width: 0;
    font: inherit;
    color: var(--text);
}

.input-group input::placeholder {
    color: #a0a7b4;
}

.ghost-button,
.menu-button {
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
}

.form-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin: 6px 0 26px;
}

.checkbox-label {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    margin: 0 !important;
    color: var(--muted) !important;
    font-weight: 500 !important;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.terms {
    margin: 8px 0 24px !important;
}

a,
.text-link {
    color: var(--accent-dark);
    text-decoration: none;
    font-weight: 700;
}

.primary-button {
    width: 100%;
    height: 60px;
    border: 0;
    border-radius: var(--radius-sm);
    color: #ffffff;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 16px 30px rgba(19, 194, 163, 0.23);
}

.divider {
    display: flex;
    align-items: center;
    gap: 18px;
    color: var(--muted);
    margin: 26px 0;
}

.divider::before,
.divider::after {
    content: "";
    height: 1px;
    background: var(--line);
    flex: 1;
}

.switch-auth,
.secure-footnote {
    text-align: center;
    margin: 0;
}

/* Chat */

.chat-page {
    width: min(1220px, calc(100vw - 48px));
    height: min(760px, calc(100vh - 72px));
    margin: 36px auto;
    display: grid;
    grid-template-columns: 340px 1fr;
    overflow: hidden;
    border-radius: 30px;
    background: var(--panel);
    border: 1px solid rgba(229, 231, 235, 0.8);
    box-shadow: var(--shadow);
}

.chat-sidebar {
    padding: 36px 30px;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-brand {
    font-size: 1.2rem;
    margin-bottom: 42px;
}

.chat-sidebar h1 {
    margin: 0 0 24px;
    font-size: 2rem;
    letter-spacing: -0.04em;
}

.thread-list {
    display: grid;
    gap: 14px;
}

.thread-card {
    min-height: 78px;
    display: grid;
    grid-template-columns: 48px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    color: inherit;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.04);
    position: relative;
}

.thread-card.active {
    background: var(--accent-soft);
    border-color: rgba(19, 194, 163, 0.18);
}

.thread-card.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 5px;
    border-radius: 999px;
    background: var(--accent);
}

.thread-avatar {
    width: 46px;
    height: 46px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: #d6f5ee;
    color: var(--accent-dark);
    font-weight: 800;
}

.thread-info {
    display: grid;
    gap: 4px;
}

.thread-info span,
.thread-card small {
    color: var(--muted);
}

.thread-card.active small {
    color: var(--accent-dark);
}

.sidebar-security {
    margin-top: auto;
}

.chat-main {
    display: grid;
    grid-template-rows: 104px 1fr 96px;
    min-width: 0;
}

.chat-header {
    padding: 28px 34px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h2 {
    margin: 0 0 8px;
    font-size: 1.75rem;
    letter-spacing: -0.04em;
}

.chat-header p {
    margin: 0;
    color: var(--muted);
    display: flex;
    gap: 10px;
    align-items: center;
}

.menu-button {
    font-size: 2rem;
}

.message-area {
    padding: 32px 34px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    background:
        radial-gradient(circle at 80% 20%, rgba(19, 194, 163, 0.06), transparent 28%),
        #ffffff;
}

.message-row {
    display: flex;
}

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

.message-row.incoming {
    justify-content: flex-start;
}

.message-bubble {
    max-width: min(460px, 70%);
    padding: 18px 22px;
    border-radius: 22px;
    color: #4b5563;
    line-height: 1.55;
}

.incoming .message-bubble {
    background: var(--incoming);
    border-top-left-radius: 8px;
}

.outgoing .message-bubble {
    background: var(--accent-soft);
    border-bottom-right-radius: 8px;
}

.message-composer {
    display: grid;
    grid-template-columns: 1fr 58px;
    gap: 14px;
    align-items: center;
    padding: 18px 34px 26px;
    border-top: 1px solid rgba(229, 231, 235, 0.65);
}

.message-composer input {
    height: 62px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 24px;
    font: inherit;
    outline: 0;
}

.message-composer input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(19, 194, 163, 0.12);
}

.message-composer button {
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 999px;
    color: white;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    cursor: pointer;
    font-size: 1.25rem;
    box-shadow: 0 14px 28px rgba(19, 194, 163, 0.24);
}

@media (max-width: 900px) {
    .auth-page {
        grid-template-columns: 1fr;
    }

    .auth-brand-panel {
        display: none;
    }

    .chat-page {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100vh;
        width: 100%;
        margin: 0;
        border-radius: 0;
    }

    .chat-sidebar {
        display: none;
    }

    .message-bubble {
        max-width: 88%;
    }
}
