:root {
    --bg: #0f172a;
    --panel: #111827;
    --text: #f8fafc;
    --muted: #94a3b8;
    --accent: #6366f1;
    --border: #1f2937;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: radial-gradient(circle at 20% 20%, #1f2937, #0b1224 45%, #0b1224);
    color: var(--text);
    min-height: 100%;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

body::-webkit-scrollbar {
    width: 0;
    height: 0;
}

a {
    color: inherit;
}

.page {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
}

.chat-shell {
    width: 100%;
    min-height: 100%;
    padding: 0px;
    display: flex;
    align-items: stretch;
    max-height: 100%;
    box-sizing: border-box;
}

.panel {
    background: linear-gradient(145deg, rgba(99, 102, 241, 0.1), rgba(14, 165, 233, 0.08));
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    width: min(700px, 100%);
    min-height: 400px;
}

.title {
    margin: 0 0 8px;
    font-size: 32px;
}

.subtitle {
    margin: 0 0 16px;
    color: var(--muted);
}

.form {
    display: grid;
    gap: 16px;
    margin-top: 8px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--muted);
}

input,
textarea,
button {
    font: inherit;
}

.hidden {
    display: none !important;
}

.file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

input,
textarea {
    background: #0b1224;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--text);
    outline: none;
    transition: border-color 150ms ease;
}

textarea {
    resize: vertical;
}

input:focus,
textarea:focus {
    border-color: var(--accent);
}

.color-picker {
    width: 100%;
    height: 52px;
    padding: 0;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: transparent;
    cursor: pointer;
    appearance: none;
}

.color-picker::-webkit-color-swatch,
.color-picker::-moz-color-swatch {
    border-radius: 10px;
    border: none;
}

.cta {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    border: none;
    color: white;
    padding: 12px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.35);
}

.ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px;
    border-radius: 12px;
    cursor: pointer;
}

.error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: #fecdd3;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 12px;
}

.note {
    color: var(--muted);
    margin: 0 0 4px;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 12px;
    color: var(--muted);
    margin: 0 0 4px;
}

.pill {
    background: color-mix(in srgb, var(--accent, #6366f1) 25%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent, #6366f1) 40%, transparent);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 999px;
}

.chat-body {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    flex: 1;
    min-height: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.messages {
    background: #0b1224;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    position: relative;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
    min-height: 0;
    flex: 1;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.messages::-webkit-scrollbar {
    display: none;
}

.message {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 12px 10px;
    cursor: pointer;
    transition: border-color 150ms ease;
    align-self: flex-start;
    width: fit-content;
    max-width: min(80ch, 100%);
    text-align: left;
}

.message.own {
    align-self: flex-end;
}

.message.unread {
    border-color: var(--accent);
}

.message-response {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 6px;
}

.message-meta {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: var(--muted);
}

.username {
    flex: 1;
    text-align: left;
    font-weight: 700;
    color: color-mix(in srgb, var(--accent), white 20%);
}

.timestamp {
    color: var(--muted);
    margin-right: 0.5rem;
}

.badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-right: 0.5rem;
}

.badge {
    padding: 4px 8px;
    border-radius: 10px;
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: #fbbf24;
    font-size: 12px;
}


.message-text {
    margin-top: 6px;
    line-height: 1.5;
    word-break: break-word;
}

.message-image {
    margin-top: 8px;
    width: fit-content;
}

.message-image img {
    border-radius: 10px;
    border: 1px solid var(--border);
    display: block;
    background: rgba(255, 255, 255, 0.04);
    max-width: 500px;
    max-height: 300px;
}

.message-file {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

.message-file a {
    color: var(--accent, #7c3aed);
    font-weight: 600;
    text-decoration: none;
    word-break: break-word;
}

.message-file a:hover {
    text-decoration: underline;
}

.image-preview {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 10px;
    display: grid;
    gap: 8px;
}

.image-preview .preview-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.image-preview__frame {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    display: flex;
    justify-content: center;
}

.image-preview__frame img {
    max-width: 220px;
    max-height: 220px;
    border-radius: 8px;
}

.file-preview {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 10px;
    display: grid;
    gap: 8px;
}

.file-preview__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.file-preview__name {
    font-weight: 600;
    word-break: break-word;
}

.composer {
    display: grid;
    gap: 12px;
}

.composer form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message-field {
    gap: 6px;
}

.message-field .input-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.attachment {
    position: relative;
    display: flex;
    align-items: center;
    align-self: stretch;
}

.input-action {
    background: #0b1224;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 10px;
    width: 52px;
    height: 52px;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 22px;
    transition: border-color 150ms ease, background-color 150ms ease;
}

.input-action:hover,
.input-action:focus-visible {
    border-color: var(--accent);
    outline: none;
    background: color-mix(in srgb, #0b1224 90%, var(--accent));
}

.attachment-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: #0b1224;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px;
    display: grid;
    gap: 6px;
    min-width: 160px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    z-index: 10;
}

.attachment-menu button {
    background: transparent;
    color: var(--text);
    border: none;
    text-align: left;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
}

.attachment-menu button:hover,
.attachment-menu button:focus-visible {
    background: rgba(99, 102, 241, 0.15);
    outline: none;
}

.message-field textarea {
    flex: 1;
    min-height: 52px;
    height: 52px;
    resize: none;
}

.chat-shell.uploading .message-field textarea {
    outline: 2px dashed var(--accent);
    outline-offset: 2px;
}

.composer .cta {
    align-self: flex-start;
    height: 52px;
    padding-inline: 18px;
}

.reply {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 12px;
    border-radius: 12px;
}

.reply.hidden {
    display: none;
}

.scroll-bottom {
    position: absolute;
    bottom: 106px;
    right: 32px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    z-index: 999;
}


.chat-shell.offline .chat-header .pill::after {
    content: ' (Offline)';
    color: #fca5a5;
}

.image-overlay {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    padding: 20px;
}

.image-overlay.hidden {
    display: none;
}

.image-overlay__content {
    margin: 0;
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: grid;
    gap: 8px;
    justify-items: center;
}

.image-overlay__content img {
    width: auto;
    max-width: 90vw;
    height: 85vh;
    object-fit: contain;
}

.image-overlay__content figcaption {
    color: var(--muted);
    text-align: center;
}

.image-overlay__close {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.9);
    color: white;
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 18px;
}

button[type="submit"]
{
    align-self: flex-start;
    height: 52px;
    display: flex;
    align-items: center;
    justify-items: center;
}

button[type="submit"] svg
{
    width: 30px;
    height: 30px;
}

.ReplyUser
{
	margin-right: 3px;
}
