:root {
    color-scheme: dark;
    --bg: #070b16;
    --bg-elevated: #0d1324;
    --panel: rgba(17, 25, 45, 0.88);
    --panel-solid: #11192d;
    --panel-soft: #151f36;
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #eef2ff;
    --muted: #96a0b8;
    --muted-strong: #b8c0d4;
    --accent: #7c6cff;
    --accent-2: #4da3ff;
    --accent-soft: rgba(124, 108, 255, 0.16);
    --success: #4dd7a8;
    --warning: #ffbf69;
    --danger: #ff6b82;
    --danger-soft: rgba(255, 107, 130, 0.14);
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --topbar-height: 72px;
    --composer-max: 390px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
}

body {
    min-height: 100dvh;
}

button,
input,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    color: inherit;
}

svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

code,
pre {
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

[hidden] {
    display: none !important;
}

/* Auth / Installer */
.auth-page {
    position: relative;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 15% 20%, rgba(77, 163, 255, 0.17), transparent 32rem),
        radial-gradient(circle at 85% 80%, rgba(124, 108, 255, 0.18), transparent 34rem),
        linear-gradient(145deg, #070b16 0%, #0a1020 52%, #080c17 100%);
}

.auth-page::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.24;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(circle at center, black, transparent 82%);
}

.auth-shell {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    min-height: 100dvh;
    padding: 28px 18px;
}

.auth-shell-wide {
    padding-block: 42px;
}

.auth-card {
    width: min(100%, 470px);
    padding: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: rgba(13, 19, 36, 0.86);
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
}

.installer-card {
    width: min(100%, 760px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-mark {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    font-size: 20px;
    font-weight: 800;
    box-shadow: 0 10px 28px rgba(92, 112, 255, 0.35);
}

.brand > div {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.brand strong {
    overflow: hidden;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand span:not(.brand-mark) {
    color: var(--muted);
    font-size: 12px;
}

.brand-large .brand-mark {
    width: 50px;
    height: 50px;
    border-radius: 17px;
    font-size: 24px;
}

.brand-large strong {
    font-size: 18px;
}

.auth-heading {
    margin: 44px 0 28px;
}

.eyebrow {
    margin: 0 0 8px;
    color: #a99fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.auth-heading h1,
.success-panel h1 {
    margin: 0;
    font-size: clamp(28px, 5vw, 38px);
    letter-spacing: -0.04em;
}

.auth-heading > p:last-child,
.success-panel p {
    margin: 12px 0 0;
    color: var(--muted);
    line-height: 1.65;
}

.auth-form {
    display: grid;
    gap: 18px;
}

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

.field {
    display: grid;
    gap: 8px;
}

.field-full {
    grid-column: 1 / -1;
}

.field > span,
.fieldset-label {
    color: var(--muted-strong);
    font-size: 13px;
    font-weight: 650;
}

.field input {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 13px;
    outline: none;
    background: rgba(255, 255, 255, 0.045);
    color: var(--text);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field input:focus {
    border-color: rgba(124, 108, 255, 0.75);
    background: rgba(255, 255, 255, 0.065);
    box-shadow: 0 0 0 4px rgba(124, 108, 255, 0.12);
}

.account-fieldset {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 4px 0;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.025);
}

.account-fieldset legend {
    padding: 0 10px;
    color: #c9c3ff;
    font-weight: 750;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 13px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 750;
    transition: transform 0.15s ease, filter 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

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

.button:active {
    transform: translateY(1px) scale(0.99);
}

.button:disabled {
    cursor: not-allowed;
    filter: grayscale(0.45);
    opacity: 0.55;
}

.button-primary {
    background: linear-gradient(135deg, var(--accent), #5c8dff);
    color: white;
    box-shadow: 0 12px 26px rgba(97, 96, 255, 0.24);
}

.button-wide {
    width: 100%;
}

.button-ghost {
    border-color: var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted-strong);
}

.button-small {
    min-height: 34px;
    padding-inline: 13px;
    border-radius: 999px;
    font-size: 12px;
}

.alert {
    margin-bottom: 20px;
    padding: 13px 15px;
    border-radius: 13px;
    line-height: 1.5;
}

.alert-error {
    border: 1px solid rgba(255, 107, 130, 0.28);
    background: var(--danger-soft);
    color: #ffc3cd;
}

.auth-footnote {
    margin: 24px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
    text-align: center;
}

.success-panel {
    display: grid;
    justify-items: center;
    padding-block: 24px 8px;
    text-align: center;
}

.success-panel .button {
    margin-top: 26px;
}

.success-icon {
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    margin-bottom: 20px;
    border-radius: 50%;
    background: rgba(77, 215, 168, 0.14);
    color: var(--success);
    font-size: 34px;
    font-weight: 800;
}

/* Chat layout */
.chat-page {
    overflow: hidden;
    background:
        radial-gradient(circle at 10% 0%, rgba(77, 163, 255, 0.12), transparent 30rem),
        radial-gradient(circle at 95% 15%, rgba(124, 108, 255, 0.11), transparent 34rem),
        var(--bg);
}

.chat-app {
    display: grid;
    grid-template-rows: var(--topbar-height) minmax(0, 1fr) auto;
    width: 100%;
    height: 100dvh;
}

.topbar {
    position: relative;
    z-index: 10;
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
    align-items: center;
    gap: 18px;
    min-height: var(--topbar-height);
    padding: 10px 22px;
    border-bottom: 1px solid var(--border);
    background: rgba(8, 12, 23, 0.8);
    backdrop-filter: blur(22px);
}

.partner-state {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.035);
}

.partner-state > div {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.partner-state strong,
.partner-state span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.partner-state strong {
    font-size: 12px;
}

.partner-state span {
    color: var(--muted);
    font-size: 10px;
}

.status-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #65708a;
    box-shadow: 0 0 0 4px rgba(101, 112, 138, 0.1);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(77, 215, 168, 0.12), 0 0 18px rgba(77, 215, 168, 0.45);
}

.topbar-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.topbar-actions form {
    margin: 0;
}

.user-chip {
    max-width: 170px;
    overflow: hidden;
    padding: 7px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted-strong);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.icon-button {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted-strong);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-button:hover {
    border-color: var(--border-strong);
    background: rgba(255, 255, 255, 0.075);
    color: var(--text);
}

.chat-main {
    position: relative;
    min-height: 0;
    overflow: hidden;
}

.messages-toolbar {
    position: absolute;
    top: 10px;
    left: 50%;
    z-index: 4;
    transform: translateX(-50%);
}

.messages {
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 34px max(22px, calc((100vw - 1040px) / 2)) 26px;
    scroll-behavior: smooth;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
    scrollbar-width: thin;
}

.messages::-webkit-scrollbar,
.modal-content::-webkit-scrollbar,
#message-input::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

.messages::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb,
#message-input::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.16);
    background-clip: padding-box;
}

.initial-loader,
.empty-state {
    display: grid;
    place-items: center;
    gap: 12px;
    min-height: 100%;
    color: var(--muted);
    text-align: center;
}

.empty-state-inner {
    max-width: 420px;
    padding: 30px;
}

.empty-state-icon {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--accent-soft);
    color: #a99fff;
    font-size: 30px;
}

.empty-state h2 {
    margin: 0;
    color: var(--text);
    font-size: 22px;
}

.empty-state p {
    margin: 10px 0 0;
    line-height: 1.65;
}

.spinner {
    width: 26px;
    height: 26px;
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.date-separator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 26px 0 20px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.date-separator::before,
.date-separator::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.message-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    width: 100%;
    margin: 8px 0;
    animation: message-in 0.2s ease-out both;
}

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

@keyframes message-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.avatar {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 32px;
    height: 32px;
    margin-bottom: 3px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--panel-soft);
    color: #bdc6dc;
    font-size: 12px;
    font-weight: 800;
}

.message-row.mine .avatar {
    order: 2;
    background: rgba(124, 108, 255, 0.14);
    color: #c9c3ff;
}

.message-card {
    position: relative;
    width: fit-content;
    max-width: min(82%, 860px);
    min-width: 160px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 18px 18px 18px 6px;
    background: rgba(20, 29, 50, 0.9);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.13);
}

.message-row.mine .message-card {
    border-color: rgba(124, 108, 255, 0.24);
    border-radius: 18px 18px 6px 18px;
    background: linear-gradient(145deg, rgba(53, 47, 106, 0.92), rgba(32, 40, 78, 0.94));
}

.message-card.is-pasting {
    width: min(82%, 860px);
    border-radius: 18px;
}

.message-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 12px 0;
}

.message-author {
    min-width: 0;
    overflow: hidden;
    color: var(--muted-strong);
    font-size: 11px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-time {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 10px;
}

.pasting-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 7px;
    padding: 2px 6px;
    border: 1px solid rgba(169, 159, 255, 0.2);
    border-radius: 999px;
    background: rgba(124, 108, 255, 0.1);
    color: #bbb2ff;
    font-size: 8px;
    font-weight: 850;
    letter-spacing: 0.08em;
    vertical-align: 1px;
}

.message-body-wrap {
    position: relative;
    margin-top: 7px;
}

.message-body {
    overflow-wrap: anywhere;
    padding: 3px 13px 11px;
    color: #edf1ff;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
}

.message-body.code-like {
    overflow-x: auto;
    padding: 12px 14px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.055);
    background: rgba(3, 7, 16, 0.38);
    color: #dfe7ff;
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 12.5px;
    line-height: 1.58;
    overflow-wrap: normal;
    white-space: pre;
}

.message-body a {
    color: #8fc6ff;
    text-decoration: underline;
    text-decoration-color: rgba(143, 198, 255, 0.42);
    text-underline-offset: 3px;
}

.message-body-wrap.collapsed .message-body {
    max-height: 320px;
    overflow: hidden;
}

.message-body-wrap.collapsed::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 90px;
    pointer-events: none;
    background: linear-gradient(transparent, rgba(17, 25, 45, 0.98));
}

.message-row.mine .message-body-wrap.collapsed::after {
    background: linear-gradient(transparent, rgba(34, 40, 80, 0.99));
}

.message-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 0 9px 9px;
}

.message-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 0 9px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 9px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.045);
    color: var(--muted-strong);
    font-size: 10px;
    font-weight: 750;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.message-action svg {
    width: 14px;
    height: 14px;
}

.message-action:hover {
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.message-action.danger:hover {
    border-color: rgba(255, 107, 130, 0.25);
    background: var(--danger-soft);
    color: #ff9aaa;
}

.message-meta {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    padding: 0 12px 9px;
    color: rgba(210, 216, 236, 0.58);
    font-size: 9px;
}

.read-mark {
    color: #8fc6ff;
}

.deleted-card {
    min-width: 220px;
    padding: 12px 14px;
    border-style: dashed;
    background: rgba(255, 255, 255, 0.025) !important;
    color: var(--muted);
    font-size: 12px;
    font-style: italic;
}

.new-messages-button {
    position: absolute;
    right: max(22px, calc((100vw - 1040px) / 2));
    bottom: 18px;
    z-index: 5;
    min-height: 40px;
    padding: 0 15px;
    border: 1px solid rgba(124, 108, 255, 0.42);
    border-radius: 999px;
    cursor: pointer;
    background: linear-gradient(135deg, #5d55d8, #4a82da);
    color: white;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 14px 34px rgba(40, 55, 130, 0.42);
}

/* Composer */
.composer-wrap {
    position: relative;
    z-index: 8;
    padding: 0 max(18px, calc((100vw - 1080px) / 2)) max(14px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: rgba(8, 12, 23, 0.9);
    backdrop-filter: blur(24px);
}

.composer {
    margin-top: 12px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(18, 27, 47, 0.9);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
}

.composer:focus-within {
    border-color: rgba(124, 108, 255, 0.34);
    box-shadow: 0 0 0 4px rgba(124, 108, 255, 0.07), 0 -8px 30px rgba(0, 0, 0, 0.12);
}

.composer-toolbar,
.composer-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.composer-toolbar {
    padding: 0 2px 8px;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.tool-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 0 8px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

.tool-button:hover {
    background: rgba(255, 255, 255, 0.055);
    color: var(--text);
}

.tool-button svg {
    width: 14px;
    height: 14px;
}

.enter-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 10px;
    cursor: pointer;
    user-select: none;
}

.enter-toggle input {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
}

.composer-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 46px;
    align-items: end;
    gap: 9px;
}

#message-input {
    width: 100%;
    min-height: 46px;
    max-height: 320px;
    resize: none;
    overflow-y: auto;
    padding: 12px 13px;
    border: 0;
    border-radius: 12px;
    outline: none;
    background: rgba(255, 255, 255, 0.035);
    color: var(--text);
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", ui-monospace, monospace;
    font-size: 13px;
    line-height: 1.5;
    tab-size: 4;
}

#message-input::placeholder {
    color: #707b94;
}

.send-button {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    background: linear-gradient(135deg, var(--accent), #4e93f7);
    color: white;
    box-shadow: 0 10px 25px rgba(85, 88, 220, 0.28);
    transition: transform 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
}

.send-button:hover {
    filter: brightness(1.1);
}

.send-button:active {
    transform: scale(0.96);
}

.send-button:disabled {
    cursor: not-allowed;
    filter: grayscale(0.45);
    opacity: 0.45;
}

.composer-meta {
    padding: 7px 4px 0;
    color: var(--muted);
    font-size: 9px;
}

.character-warning {
    color: var(--warning) !important;
}

.character-danger {
    color: var(--danger) !important;
}

.draft-restored {
    position: absolute;
    top: -30px;
    left: 50%;
    padding: 6px 10px;
    border: 1px solid rgba(77, 215, 168, 0.25);
    border-radius: 999px;
    background: rgba(10, 28, 28, 0.95);
    color: #91e8c9;
    font-size: 10px;
    transform: translateX(-50%);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 22px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(1, 3, 9, 0.74);
    backdrop-filter: blur(12px);
}

.modal-card {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(1100px, 100%);
    height: min(84dvh, 900px);
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: 22px;
    background: #0d1426;
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.62);
}

.modal-header,
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-color: var(--border);
}

.modal-header {
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.modal-footer {
    border-top: 1px solid var(--border);
}

.modal-footer span {
    color: var(--muted);
    font-size: 11px;
}

.modal-content {
    margin: 0;
    overflow: auto;
    padding: 22px;
    background: #080d19;
    color: #e3eaff;
    font-size: 13px;
    line-height: 1.65;
    tab-size: 4;
    white-space: pre;
}

/* Toasts */
.toast-region {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 150;
    display: grid;
    gap: 8px;
    width: min(360px, calc(100vw - 36px));
    pointer-events: none;
}

.toast {
    padding: 12px 14px;
    border: 1px solid var(--border-strong);
    border-radius: 13px;
    background: rgba(20, 29, 50, 0.96);
    color: var(--text);
    font-size: 12px;
    line-height: 1.45;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.35);
    animation: toast-in 0.18s ease-out both;
}

.toast.success {
    border-color: rgba(77, 215, 168, 0.26);
}

.toast.error {
    border-color: rgba(255, 107, 130, 0.3);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 760px) {
    :root {
        --topbar-height: 64px;
    }

    .auth-card {
        padding: 25px 20px;
    }

    .installer-form,
    .account-fieldset {
        grid-template-columns: 1fr;
    }

    .topbar {
        grid-template-columns: 1fr auto;
        gap: 10px;
        padding-inline: 12px;
    }

    .topbar .brand span:not(.brand-mark),
    .user-chip {
        display: none;
    }

    .partner-state {
        position: absolute;
        left: 50%;
        max-width: 42vw;
        transform: translateX(-50%);
    }

    .topbar-actions {
        grid-column: 2;
    }

    .messages {
        padding: 28px 10px 20px;
    }

    .message-card,
    .message-card.is-pasting {
        max-width: 88%;
        width: fit-content;
    }

    .message-card.is-pasting {
        width: 88%;
    }

    .avatar {
        display: none;
    }

    .composer-wrap {
        padding-inline: 8px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    .composer {
        margin-top: 7px;
        border-radius: 15px;
    }

    .tool-button span,
    .enter-toggle span,
    #send-hint {
        display: none;
    }

    .modal {
        padding: 8px;
    }

    .modal-card {
        height: calc(100dvh - 16px);
        border-radius: 16px;
    }

    .modal-footer {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
