:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-soft: #fafbfc;

    --sidebar: #17191d;
    --sidebar-hover: #252932;
    --sidebar-active: #30353f;

    --text: #20242a;
    --text-soft: #626b76;
    --text-light: #aeb5bf;

    --border: #e1e4e8;

    --accent: #20242a;
    --danger: #a52b2b;
    --success: #26945b;

    --radius: 10px;
    --radius-large: 16px;

    --shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

a {
    color: inherit;
}

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

button {
    cursor: pointer;
    border: 0;
}

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

form {
    margin: 0;
}

.muted {
    color: var(--text-soft);
}


/* ============================================================
   FORMS
   ============================================================ */

label {
    display: block;
    margin-top: 16px;
    margin-bottom: 6px;
    font-weight: 600;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid #cfd4da;
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--surface);
    color: var(--text);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #737b86;
    box-shadow: 0 0 0 3px rgba(115, 123, 134, 0.12);
}

textarea {
    resize: vertical;
}

button {
    padding: 10px 16px;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    font-weight: 600;
}

button:hover {
    filter: brightness(1.08);
}

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

.button-danger {
    background: var(--danger);
}

.button-small {
    padding: 7px 11px;
    font-size: 0.85rem;
}


/* ============================================================
   ERRORS
   ============================================================ */

.error {
    padding: 11px 14px;
    border-radius: 9px;
    border: 1px solid #e1aaaa;
    background: #fff3f3;
    color: #8d2020;
}

.error div {
    margin-top: 3px;
}

.global-error {
    margin: 16px 24px 0;
}


/* ============================================================
   AUTH
   ============================================================ */

.centered {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-large);
    padding: 24px;
    box-shadow: var(--shadow);
}

.auth-card {
    width: min(430px, 100%);
}

.auth-card h1 {
    margin-top: 0;
}

.auth-card button {
    width: 100%;
    margin-top: 20px;
}


/* ============================================================
   TOPBAR
   ============================================================ */

.topbar {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-mark {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: var(--accent);
    color: white;
    font-size: 0.78rem;
    font-weight: 800;
}

.brand-title {
    font-size: 0.98rem;
    font-weight: 750;
    line-height: 1.1;
}

.brand-subtitle {
    margin-top: 2px;
    color: var(--text-soft);
    font-size: 0.72rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-right form {
    margin: 0;
}

.topbar-link {
    text-decoration: none;
    color: var(--text-soft);
    font-size: 0.9rem;
}

.topbar-link:hover {
    color: var(--text);
}

.username {
    font-size: 0.9rem;
    font-weight: 600;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-soft);
    font-size: 0.82rem;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    background: var(--success);
}


/* ============================================================
   APP LAYOUT
   ============================================================ */

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

.layout {
    flex: 1;
    min-height: calc(100vh - 64px);
    display: grid;
    grid-template-columns: 285px minmax(0, 1fr);
}


/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--sidebar);
    color: white;
}

.sidebar-header {
    padding: 15px;
}

.new-chat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 13px;
    border: 1px solid #424852;
    border-radius: 9px;
    color: white;
    text-decoration: none;
    font-weight: 650;
}

.new-chat:hover {
    background: var(--sidebar-hover);
}

.new-chat-icon {
    font-size: 1.1rem;
}

.sidebar-section-title {
    padding: 6px 16px 8px;
    color: var(--text-light);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.conversation-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 9px 12px;
}

.conversation {
    display: block;
    padding: 11px 10px;
    margin-bottom: 4px;
    border-radius: 8px;
    text-decoration: none;
}

.conversation:hover {
    background: var(--sidebar-hover);
}

.conversation.active {
    background: var(--sidebar-active);
}

.conversation-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.88rem;
    font-weight: 600;
}

.conversation-model {
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #9da5b0;
    font-size: 0.72rem;
}

.sidebar-empty {
    padding: 10px 12px;
    color: #828995;
    font-size: 0.82rem;
}

.sidebar-footer {
    padding: 13px;
    border-top: 1px solid #2c3037;
}

.local-badge {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    color: #dce0e5;
}

.local-badge strong {
    display: block;
    font-size: 0.78rem;
}

.local-badge small {
    display: block;
    margin-top: 2px;
    color: #8f97a2;
    font-size: 0.68rem;
}


/* ============================================================
   CHAT AREA
   ============================================================ */

.chat-area {
    min-width: 0;
    min-height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.chat-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 15px 24px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--border);
}

.chat-header-info {
    min-width: 0;
}

.chat-header h1 {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1rem;
}

.chat-header form {
    margin: 0;
}

.model-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #eef0f2;
    color: var(--text-soft);
    font-size: 0.72rem;
}


/* ============================================================
   WELCOME
   ============================================================ */

.welcome {
    width: min(900px, calc(100% - 40px));
    margin: auto auto 10px;
    padding: 50px 20px 20px;
    text-align: center;
}

.welcome-icon {
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    border-radius: 15px;
    background: white;
    border: 1px solid var(--border);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    font-size: 1.5rem;
}

.welcome h1 {
    margin: 0 0 8px;
    font-size: 1.8rem;
}

.welcome > p {
    max-width: 650px;
    margin: 0 auto;
    color: var(--text-soft);
}

.welcome-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 28px;
    text-align: left;
}

.feature-card {
    padding: 15px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.feature-card strong {
    display: block;
    margin-bottom: 4px;
}

.feature-card span {
    display: block;
    color: var(--text-soft);
    font-size: 0.8rem;
    line-height: 1.45;
}


/* ============================================================
   MESSAGES
   ============================================================ */

.messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 24px max(24px, calc((100% - 980px) / 2));
}

.message {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 12px;
    max-width: 950px;
    margin: 0 auto 28px;
}

.message-avatar {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
    border-radius: 9px;
    background: #e8eaed;
    color: #4b535d;
    font-size: 0.68rem;
    font-weight: 800;
}

.message.user .message-avatar {
    background: #dce8ff;
    color: #345c9b;
}

.message-column {
    min-width: 0;
}

.message-header {
    margin-bottom: 6px;
    font-size: 0.82rem;
}

.message-content {
    position: relative;
    min-width: 0;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.message.user .message-content {
    white-space: pre-wrap;
}

.message.assistant .message-content {
    padding: 1px 0;
}

.message-copy-button {
    float: right;
    margin: 0 0 8px 12px;
    padding: 5px 9px;
    background: #eef0f2;
    color: #565e68;
    border-radius: 7px;
    font-size: 0.72rem;
}

.message-copy-button:hover {
    background: #e0e3e7;
}

.message-copy-button.copied {
    background: #dff3e7;
    color: #207747;
}


/* ============================================================
   STREAMING
   ============================================================ */

.message-content.streaming::after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-left: 5px;
    border-radius: 50%;
    background: #707780;
    animation: blink 0.9s infinite;
}

@keyframes blink {
    0%,
    100% {
        opacity: 0.25;
    }

    50% {
        opacity: 1;
    }
}


/* ============================================================
   MARKDOWN
   ============================================================ */

.message-content p {
    margin: 0 0 1em;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4 {
    line-height: 1.25;
    margin: 1.3em 0 0.6em;
}

.message-content ul,
.message-content ol {
    padding-left: 25px;
}

.message-content li {
    margin: 4px 0;
}

.message-content blockquote {
    margin: 1em 0;
    padding-left: 14px;
    border-left: 4px solid #c8cdd3;
    color: #616974;
}

.message-content table {
    width: 100%;
    margin: 16px 0;
    border-collapse: collapse;
}

.message-content th,
.message-content td {
    padding: 8px 10px;
    border: 1px solid #d8dce1;
    text-align: left;
}

.message-content code {
    padding: 2px 5px;
    border-radius: 5px;
    background: #eef0f2;
    font-family:
        "SFMono-Regular",
        Consolas,
        "Liberation Mono",
        monospace;
    font-size: 0.88em;
}

.message-content pre {
    margin: 0;
    padding: 15px;
    overflow: auto;
    border-radius: 10px;
    background: #1d2025;
    color: white;
}

.message-content pre code {
    padding: 0;
    background: transparent;
    color: inherit;
    font-size: 0.88rem;
}

.code-wrapper {
    position: relative;
    margin: 15px 0;
}

.code-wrapper .copy-code-button {
    position: absolute;
    z-index: 2;
    top: 8px;
    right: 8px;
    padding: 5px 9px;
    background: rgba(255, 255, 255, 0.14);
    color: #e4e7eb;
    font-size: 0.72rem;
}

.code-wrapper .copy-code-button:hover {
    background: rgba(255, 255, 255, 0.23);
}


/* ============================================================
   COMPOSER
   ============================================================ */

.composer-wrapper {
    flex-shrink: 0;
    padding: 10px 24px 18px;
    background:
        linear-gradient(
            to bottom,
            rgba(245, 246, 248, 0),
            rgba(245, 246, 248, 1) 18%
        );
}

.prompt-form {
    width: min(950px, 100%);
    margin: 0 auto;
    padding: 11px 13px 9px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 15px;
    box-shadow:
        0 6px 25px
        rgba(0, 0, 0, 0.07);
}

.composer-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-selector label {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.75rem;
    font-weight: 650;
}

.model-selector select {
    width: auto;
    min-width: 230px;
    padding: 5px 8px;
    border: 0;
    background: transparent;
    box-shadow: none;
    font-size: 0.78rem;
    font-weight: 650;
}

.model-selector select:focus {
    box-shadow: none;
}

.generation-status {
    color: var(--text-soft);
    font-size: 0.72rem;
}

.generation-status.generating {
    color: #565e68;
}

.textarea-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
}

.textarea-wrapper textarea {
    min-height: 44px;
    max-height: 220px;
    padding: 10px 52px 10px 2px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    resize: none;
    line-height: 1.5;
}

.textarea-wrapper textarea:focus {
    border: 0;
    box-shadow: none;
}

.send-button {
    position: absolute;
    right: 3px;
    bottom: 3px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 9px;
}

.send-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.send-button.stop {
    background: var(--danger);
}

.stop-icon {
    width: 11px;
    height: 11px;
    border-radius: 3px;
    background: white;
}

.composer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
    padding: 2px 2px 0;
}

.composer-help,
.composer-local {
    color: #858d97;
    font-size: 0.68rem;
}

kbd {
    padding: 2px 5px;
    border: 1px solid #d6d9de;
    border-bottom-width: 2px;
    border-radius: 4px;
    background: #f4f5f6;
    font-size: 0.65rem;
}


/* ============================================================
   ADMINISTRATION
   ============================================================ */

.admin-page {
    max-width: 1000px;
    margin: 30px auto;
    padding: 0 20px;
    display: grid;
    gap: 24px;
}

.admin-card {
    padding: 24px;
}

.admin-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.admin-card h1,
.admin-card h2 {
    margin-top: 0;
}

.admin-card h1 {
    margin-bottom: 5px;
}

.admin-card h2 {
    margin-top: 24px;
    margin-bottom: 14px;
    font-size: 1.05rem;
}

.admin-info {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 11px 13px;
    border-radius: 9px;
    background: #f1f3f5;
    color: #59616b;
    font-size: 0.82rem;
}

.admin-info strong {
    color: #30363d;
}

.admin-create-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 14px;
    align-items: end;
}

.admin-create-form label {
    margin-top: 0;
}

.admin-create-button button {
    height: 42px;
    white-space: nowrap;
}

.user-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border);
}

.user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 17px 0;
    border-bottom: 1px solid var(--border);
}

.user-info {
    min-width: 0;
}

.user-name {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-weight: 700;
}

.role-badge {
    padding: 3px 7px;
    border-radius: 999px;
    background: #e8edf8;
    color: #415b8c;
    font-size: 0.66rem;
    font-weight: 700;
}

.role-badge.user-role {
    background: #eef0f2;
    color: #646c76;
}

.user-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 5px;
    color: var(--text-soft);
    font-size: 0.73rem;
}

.active-indicator {
    color: #25804f;
    font-weight: 650;
}

.inactive-indicator {
    color: #9a3434;
    font-weight: 650;
}

.user-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.user-actions form {
    margin: 0;
}

.password-details {
    position: relative;
}

.password-details summary {
    list-style: none;
    padding: 7px 10px;
    border-radius: 7px;
    background: #eef0f2;
    color: #4f5862;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 650;
}

.password-details summary::-webkit-details-marker {
    display: none;
}

.password-form {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    display: flex;
    gap: 7px;
    width: 300px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: white;
    box-shadow:
        0 10px 30px
        rgba(0, 0, 0, 0.12);
}

.password-form input {
    min-width: 0;
    padding: 7px 9px;
    font-size: 0.8rem;
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 850px) {

    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        max-height: 190px;
    }

    .sidebar-footer {
        display: none;
    }

    .sidebar-section-title {
        padding-top: 2px;
    }

    .topbar {
        padding: 0 13px;
    }

    .topbar-link,
    .connection-status {
        display: none;
    }

    .username {
        display: none;
    }

    .messages {
        padding: 18px 14px;
    }

    .message {
        grid-template-columns: 32px minmax(0, 1fr);
        gap: 9px;
        margin-bottom: 22px;
    }

    .message-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.6rem;
    }

    .chat-header {
        padding: 12px 15px;
    }

    .composer-wrapper {
        padding: 8px 10px 11px;
    }

    .welcome {
        width: calc(100% - 28px);
        padding-top: 28px;
    }

    .welcome h1 {
        font-size: 1.45rem;
    }

    .welcome-features {
        grid-template-columns: 1fr;
    }

    .composer-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .model-selector {
        width: 100%;
    }

    .model-selector select {
        min-width: 0;
        flex: 1;
    }

    .composer-local {
        display: none;
    }

    .admin-create-form {
        grid-template-columns: 1fr;
    }

    .admin-create-button button {
        width: 100%;
    }

    .user-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .user-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .password-form {
        position: fixed;
        left: 12px;
        right: 12px;
        top: auto;
        bottom: 12px;
        width: auto;
    }
}


@media (max-width: 500px) {

    .brand-subtitle {
        display: none;
    }

    .brand-mark {
        width: 31px;
        height: 31px;
    }

    .topbar-right button {
        padding: 8px 10px;
        font-size: 0.78rem;
    }

    .chat-header h1 {
        font-size: 0.92rem;
    }

    .button-small {
        padding: 6px 8px;
        font-size: 0.73rem;
    }

    .composer-help {
        font-size: 0.63rem;
    }
}

/* ============================================================
   ADVANCED CHAT
   ============================================================ */

.conversation-item {
    position: relative;
}

.conversation-item.active {
    background: transparent;
}

.conversation-item.active .conversation {
    background: var(--sidebar-active);
}

.conversation-item:hover .conversation {
    background: var(--sidebar-hover);
}


.conversation-heading {
    display: flex;
    align-items: center;
    gap: 7px;
}

.conversation-heading h1 {
    min-width: 0;
}

.icon-button {
    width: 28px;
    height: 28px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border-radius: 7px;

    background: transparent;
    color: var(--text-soft);

    font-size: 0.9rem;
}

.icon-button:hover {
    background: #eef0f2;
    color: var(--text);
}

.conversation-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.settings-summary {
    color: var(--text-soft);
    font-size: 0.72rem;
}


.message-actions {
    display: inline-flex;

    margin-left: 8px;

    gap: 5px;

    opacity: 0;

    transition: opacity 0.15s ease;
}

.message:hover .message-actions {
    opacity: 1;
}

.message-action {
    padding: 3px 7px;

    border-radius: 6px;

    background: #eef0f2;

    color: #5b6470;

    font-size: 0.68rem;

    font-weight: 600;
}

.message-action:hover {
    background: #e1e4e8;
}

.message-stats {
    margin-top: 5px;

    color: #9299a2;

    font-size: 0.68rem;
}


.generation-settings {
    margin-bottom: 10px;
}

.generation-settings summary {
    cursor: pointer;

    color: var(--text-soft);

    font-size: 0.76rem;

    font-weight: 650;
}

.generation-settings summary:hover {
    color: var(--text);
}


.settings-grid {
    display: grid;

    grid-template-columns:
        1.2fr 1.3fr 1fr;

    gap: 14px;

    margin-top: 13px;

    padding-top: 13px;

    border-top: 1px solid var(--border);
}

.setting {
    min-width: 0;
}

.setting label {
    margin: 0;

    font-size: 0.74rem;
}

.setting select {
    margin-top: 5px;
}

.setting-label {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;

    color: var(--text-soft);

    font-size: 0.72rem;
}

.setting-label span {
    color: var(--text-soft);
    font-size: 0.7rem;
}

.setting input[type="range"] {
    width: 100%;

    margin-top: 9px;

    padding: 0;

    border: 0;

    box-shadow: none;
}

.range-labels {
    display: flex;

    justify-content: space-between;

    margin-top: 3px;

    color: #9aa1aa;

    font-size: 0.63rem;
}


.active-model {
    display: flex;

    align-items: center;

    gap: 6px;

    min-width: 0;

    overflow: hidden;
}

.model-label {
    color: var(--text-soft);

    font-size: 0.71rem;
}

#active-model-name {
    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

    font-size: 0.75rem;

    font-weight: 650;
}


.edit-banner {
    display: none;

    align-items: center;

    justify-content: space-between;

    gap: 10px;

    margin-bottom: 8px;

    padding: 7px 9px;

    border-radius: 7px;

    background: #fff5db;

    color: #765a18;

    font-size: 0.74rem;
}

.edit-banner.visible {
    display: flex;
}

.edit-banner button {
    padding: 4px 7px;

    background: transparent;

    color: inherit;

    font-size: 0.72rem;
}


.message-content.streaming {
    min-height: 22px;
}


.message-copy-button {
    float: right;

    margin:
        0 0 8px 10px;

    padding:
        4px 7px;

    border-radius: 6px;

    background:
        #eef0f2;

    color:
        #5b6470;

    font-size:
        0.68rem;
}

.message-copy-button:hover {
    background:
        #e1e4e8;
}

.message-copy-button.copied {
    background:
        #dff3e7;

    color:
        #207747;
}


/* ============================================================
   MODAL
   ============================================================ */

.modal {
    position: fixed;

    inset: 0;

    z-index: 100;
}

.modal-backdrop {
    position: absolute;

    inset: 0;

    background:
        rgba(20, 23, 27, 0.45);
}

.modal-card {
    position: relative;

    width:
        min(430px, calc(100% - 30px));

    margin:
        20vh auto 0;

    padding: 22px;

    border:
        1px solid var(--border);

    border-radius:
        14px;

    background:
        white;

    box-shadow:
        0 20px 60px
        rgba(0, 0, 0, 0.22);
}

.modal-card h2 {
    margin-top: 0;

    font-size: 1.05rem;
}

.modal-actions {
    display: flex;

    justify-content: flex-end;

    gap: 8px;

    margin-top: 15px;
}


/* ============================================================
   MOBILE ADVANCED CHAT
   ============================================================ */

@media (max-width: 850px) {

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .message-actions {
        opacity: 1;
    }

    .conversation-heading {
        max-width: 100%;
    }

    .conversation-meta {
        gap: 5px;
    }

}

@media (max-width: 500px) {

    .message-actions {
        display: flex;

        margin-left: 0;

        margin-top: 5px;
    }

    .message-header {
        display: flex;

        flex-direction: column;

        align-items: flex-start;
    }

    .message-action {
        font-size: 0.63rem;
    }

}
