:root {
    --fb-blue: #1877f2;
    --fb-blue-dark: #1664d9;
    --fb-bg: #f0f2f5;
    --fb-surface: #ffffff;
    --fb-border: #d9dde3;
    --fb-text: #1c1e21;
    --fb-muted: #65676b;
    --fb-soft: #eef3ff;
    --fb-green: #42b72a;
    --fb-danger: #fa3e3e;
    --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 10px 24px rgba(15, 23, 42, 0.08);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: 'Inter', Arial, sans-serif;
    color: var(--fb-text);
    background: radial-gradient(circle at top left, #ffffff 0%, #f7f9fd 38%, #eef2f8 100%);
}

body {
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

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

textarea,
input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    border: 1px solid var(--fb-border);
    border-radius: 14px;
    padding: 14px 16px;
    background: #fff;
    color: var(--fb-text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
    border-color: rgba(24, 119, 242, 0.45);
    box-shadow: 0 0 0 4px rgba(24, 119, 242, 0.12);
}

textarea {
    resize: vertical;
}

.button {
    border: none;
    border-radius: 999px;
    padding: 12px 22px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button.primary {
    background: linear-gradient(180deg, #2a82f3 0%, var(--fb-blue) 100%);
    color: #fff;
    box-shadow: 0 12px 24px rgba(24, 119, 242, 0.2);
}

.button.secondary {
    background: #e4e6eb;
    color: var(--fb-text);
}

.button.tiny {
    padding: 9px 16px;
    font-size: 0.9rem;
}

.button.full {
    width: 100%;
}

.ghost-link {
    color: var(--fb-blue);
    font-weight: 600;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
}

.ghost-link.strong {
    display: inline-block;
    margin-top: 8px;
}

.ghost-link.danger {
    color: var(--fb-danger);
}

.ghost-link.mini {
    font-size: 0.88rem;
}

.hero-badge,
.pill,
.status-chip,
.reaction-pill,
.emoji-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 999px;
    font-weight: 700;
}

.hero-badge,
.pill {
    padding: 7px 12px;
    background: var(--fb-soft);
    color: var(--fb-blue);
    font-size: 0.82rem;
}

.pill.soft {
    color: var(--fb-muted);
    background: #f4f5f7;
}

.alert {
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 16px;
    font-weight: 600;
}

.alert.success {
    background: rgba(66, 183, 42, 0.14);
    color: #1d6a10;
}

.alert.error {
    background: rgba(250, 62, 62, 0.12);
    color: #982626;
}

.alert.floating {
    box-shadow: var(--shadow-md);
}

.debug-note {
    color: #7d8592;
    font-size: 0.9rem;
}

.hidden {
    display: none !important;
}

.avatar {
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: inset 0 -8px 18px rgba(0, 0, 0, 0.12);
}

.avatar.small { width: 34px; height: 34px; font-size: 0.78rem; }
.avatar.large { width: 48px; height: 48px; font-size: 1rem; }
.avatar.xl { width: 62px; height: 62px; font-size: 1.2rem; }

.glass,
.glass-soft,
.facebook-card,
.hero-card,
.preview-card,
.auth-panel,
.fb-card {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(16px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 800;
}

.brand span,
.muted,
small,
.conversation-copy p,
.friend-copy p,
.friend-copy small,
.message-meta-top small,
.edited-note {
    color: var(--fb-muted);
}

.eyebrow {
    margin: 0 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.73rem;
    color: var(--fb-blue);
    font-weight: 800;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.section-heading h2,
.profile-card h1,
.chat-partner h2 {
    margin: 0;
}

.stack-form {
    display: grid;
    gap: 14px;
}

.stack-form label span {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.stack-form.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-form {
    gap: 12px;
}

.button-row {
    grid-column: 1 / -1;
}

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(180deg, #f5f7fb 0%, #eef2f8 100%);
}

.auth-shell {
    width: min(100%, 540px);
}

.auth-panel {
    border-radius: 30px;
    padding: 32px;
}

.auth-panel.wide {
    width: min(100%, 760px);
}

.auth-brand,
.fb-profile-row,
.chat-partner,
.friend-row,
.conversation-item,
.conversation-topline,
.sidebar-header,
.landing-topbar,
.hero-actions,
.preview-topbar,
.stats-row,
.message-toolbar,
.message-actions,
.edit-actions,
.composer-actions,
.chat-title-row {
    display: flex;
    align-items: center;
}

.auth-brand,
.fb-profile-row,
.friend-row,
.chat-partner,
.brand {
    gap: 14px;
}

.auth-copy,
.hero-copy {
    color: var(--fb-muted);
}

.auth-links {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 12px;
}

.auth-links.left {
    justify-content: flex-start;
}

.landing-shell {
    padding: 28px;
}

.landing-topbar,
.hero-grid {
    max-width: 1240px;
    margin: 0 auto;
}

.landing-topbar {
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.hero-card {
    border-radius: 32px;
    padding: 36px;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 28px;
}

.hero-title {
    font-size: clamp(2.2rem, 3.8vw, 4rem);
    line-height: 1.02;
    margin: 16px 0;
}

.hero-list {
    margin: 24px 0 0;
    padding-left: 18px;
    color: var(--fb-muted);
}

.hero-actions {
    gap: 14px;
    flex-wrap: wrap;
}

.preview-card {
    border-radius: 28px;
    padding: 18px;
}

.preview-window {
    background: linear-gradient(180deg, #f8fbff 0%, #eef2f8 100%);
    border-radius: 24px;
    padding: 16px;
}

.preview-topbar {
    gap: 8px;
    margin-bottom: 14px;
}

.preview-topbar span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d0d7e4;
}

.preview-chat.advanced {
    display: grid;
    grid-template-columns: 76px 1fr;
    gap: 16px;
}

.preview-sidebar {
    display: grid;
    gap: 12px;
}

.preview-contact,
.preview-message,
.preview-attachment,
.preview-reactions {
    border-radius: 18px;
    padding: 14px;
}

.preview-contact {
    display: grid;
    place-items: center;
    background: #dfe9ff;
    color: var(--fb-blue);
    font-weight: 800;
}

.preview-contact.active,
.preview-message.outgoing {
    background: var(--fb-blue);
    color: #fff;
}

.preview-conversation {
    display: grid;
    gap: 12px;
}

.preview-message.incoming,
.preview-attachment,
.preview-reactions {
    background: #fff;
}

.dashboard-page,
.fb-body {
    background: var(--fb-bg);
}

.fb-dashboard-layout {
    max-width: 1500px;
    margin: 0 auto;
    padding: 22px;
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr) 360px;
    gap: 22px;
    min-height: 100vh;
}

.fb-card,
.messenger-shell-card {
    border-radius: 26px;
    padding: 20px;
}

.fb-left-column,
.fb-right-column,
.fb-center-column {
    display: grid;
    gap: 18px;
    align-content: start;
}

.profile-card {
    padding: 22px;
}

.stats-row {
    justify-content: space-between;
    margin: 18px 0 8px;
    padding-top: 16px;
    border-top: 1px solid #edf0f4;
}

.stats-row div {
    display: grid;
    gap: 4px;
    text-align: center;
}

.stats-row strong {
    font-size: 1.2rem;
}

.checkbox-grid,
.request-list,
.conversation-list {
    display: grid;
    gap: 12px;
}

.check-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 16px;
    background: #f7f9fc;
    border: 1px solid #edf0f4;
}

.check-chip input {
    width: auto;
}

.friend-row,
.conversation-item {
    padding: 12px;
    border-radius: 18px;
    background: #f8fafc;
    border: 1px solid #edf0f4;
}

.friend-copy,
.conversation-copy,
.message-stack {
    min-width: 0;
}

.friend-copy strong,
.conversation-copy strong {
    display: block;
}

.friend-copy p,
.conversation-copy p {
    margin: 4px 0 0;
    font-size: 0.92rem;
}

.friend-copy.grow {
    flex: 1;
}

.friend-actions {
    margin-left: auto;
}

.friend-actions.vertical {
    display: grid;
    gap: 8px;
}

.friend-actions.split {
    gap: 8px;
}

.status-chip {
    padding: 8px 12px;
    font-size: 0.82rem;
}

.status-chip.waiting {
    background: #fff2d8;
    color: #8b5a00;
}

.status-chip.sent {
    background: #e8f0fe;
    color: var(--fb-blue);
}

.conversation-item {
    gap: 12px;
    transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}

.conversation-item:hover {
    transform: translateY(-1px);
    background: #fff;
}

.conversation-item.active {
    background: #e7f3ff;
    border-color: rgba(24, 119, 242, 0.16);
}

.conversation-item .conversation-copy {
    flex: 1;
}

.conversation-topline {
    justify-content: space-between;
    gap: 12px;
}

.unread-badge {
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--fb-blue);
    color: #fff;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.fb-chat-topbar {
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 18px;
    border-bottom: 1px solid #edf0f4;
}

.chat-title-row {
    gap: 10px;
    margin-bottom: 4px;
}

.chat-top-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.fb-stream {
    display: grid;
    gap: 14px;
    padding: 18px 2px;
    max-height: calc(100vh - 360px);
    overflow-y: auto;
}

.message-row {
    display: flex;
    gap: 10px;
}

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

.message-stack {
    max-width: min(78%, 680px);
    display: grid;
    gap: 8px;
}

.message-meta-top {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
}

.message-bubble {
    border-radius: 22px;
    padding: 14px 16px;
    box-shadow: var(--shadow-md);
    overflow-wrap: anywhere;
}

.message-bubble.mine {
    background: linear-gradient(180deg, #2a82f3 0%, var(--fb-blue) 100%);
    color: #fff;
    border-bottom-right-radius: 8px;
}

.message-bubble.other {
    background: #fff;
    border-bottom-left-radius: 8px;
}

.message-bubble.deleted {
    background: #f4f5f7;
    color: var(--fb-muted);
    box-shadow: none;
}

.message-text,
.deleted-copy {
    margin: 0;
    white-space: pre-wrap;
}

.attachment-card {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.32);
}

.message-bubble.other .attachment-card {
    background: #f3f5f8;
    border-color: #e4e8ee;
}

.edited-note {
    display: inline-block;
    margin-top: 10px;
}

.message-toolbar {
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.reactions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.reaction-pill,
.emoji-trigger {
    border: none;
    padding: 7px 12px;
    cursor: pointer;
    background: #edf2ff;
    color: var(--fb-text);
}

.reaction-pill.active {
    background: rgba(24, 119, 242, 0.16);
    color: var(--fb-blue);
}

.emoji-trigger {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #f3f5f8;
}

.edit-form {
    display: grid;
    gap: 10px;
    padding: 12px;
    border-radius: 18px;
    background: #f7f9fc;
    border: 1px solid #edf0f4;
}

.edit-actions,
.message-actions,
.composer-actions {
    gap: 10px;
}

.fb-composer {
    margin-top: 14px;
    border-radius: 22px;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #edf0f4;
}

.file-label {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 12px 16px;
    background: #e9efff;
    color: var(--fb-blue);
    font-weight: 700;
    cursor: pointer;
}

.file-label input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.empty-chat,
.empty-mini {
    text-align: center;
    color: var(--fb-muted);
}

.large-empty {
    min-height: 320px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
}

.empty-3d-shape {
    width: 94px;
    height: 94px;
    border-radius: 28px;
    background: linear-gradient(145deg, #dce9ff 0%, #ffffff 48%, #cfe0ff 100%);
    box-shadow: 0 22px 40px rgba(24, 119, 242, 0.16);
    transform: rotate(18deg);
}

.quick-open-form {
    margin-left: auto;
}

.inline-form {
    display: inline-flex;
}

@media (max-width: 1180px) {
    .fb-dashboard-layout {
        grid-template-columns: 1fr;
    }

    .fb-left-column,
    .fb-center-column,
    .fb-right-column {
        order: unset;
    }

    .hero-grid,
    .stack-form.two-col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .landing-shell,
    .fb-dashboard-layout,
    .auth-body {
        padding: 16px;
    }

    .hero-card,
    .fb-card,
    .auth-panel {
        padding: 18px;
        border-radius: 22px;
    }

    .landing-topbar,
    .auth-links,
    .fb-chat-topbar,
    .message-toolbar,
    .composer-actions,
    .friend-row.stacked-mobile {
        flex-direction: column;
        align-items: stretch;
    }

    .message-stack {
        max-width: 100%;
    }
}
