/* ===========================================================================
   jekaka — redesign
   Dark, glassy, gradient-driven UI with smooth motion.
   Class names are kept identical to the templates; only the look changes.
   =========================================================================== */

:root {
    --bg: #07080f;
    --bg-2: #0c0e1c;
    --panel: rgba(255, 255, 255, 0.045);
    --panel-strong: rgba(255, 255, 255, 0.07);
    --panel-solid: #11132260;
    --text: #eef1fb;
    --muted: #9aa3c0;
    --line: rgba(255, 255, 255, 0.10);
    --line-strong: rgba(255, 255, 255, 0.18);

    --accent: #7c5cff;
    --accent-2: #4f8bff;
    --accent-3: #22d3ee;
    --accent-soft: rgba(124, 92, 255, 0.16);
    --grad: linear-gradient(135deg, #7c5cff 0%, #4f8bff 50%, #22d3ee 100%);
    --grad-text: linear-gradient(120deg, #b7a6ff 0%, #7cc4ff 45%, #56e0e0 100%);

    --danger: #ff5470;
    --danger-dark: #d62f4d;
    --success: #34d399;

    --radius: 16px;
    --radius-sm: 11px;
    --shadow: 0 18px 50px rgba(4, 6, 16, 0.55);
    --glow: 0 0 0 1px rgba(124, 92, 255, 0.35), 0 14px 40px rgba(79, 139, 255, 0.28);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(1200px 700px at 12% -8%, rgba(124, 92, 255, 0.20), transparent 60%),
        radial-gradient(1000px 620px at 100% 0%, rgba(34, 211, 238, 0.14), transparent 55%),
        radial-gradient(900px 700px at 50% 120%, rgba(79, 139, 255, 0.16), transparent 60%),
        var(--bg);
    color: var(--text);
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.55;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Drifting aurora layer behind everything */
.bg-aurora {
    position: fixed;
    inset: -20vmax;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(38vmax 38vmax at 20% 30%, rgba(124, 92, 255, 0.28), transparent 60%),
        radial-gradient(34vmax 34vmax at 80% 20%, rgba(34, 211, 238, 0.20), transparent 60%),
        radial-gradient(40vmax 40vmax at 65% 85%, rgba(79, 139, 255, 0.22), transparent 60%);
    filter: blur(8px);
    animation: aurora-drift 24s var(--ease) infinite alternate;
}

.bg-grid {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(120% 90% at 50% 0%, #000 35%, transparent 78%);
    -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 35%, transparent 78%);
}

@keyframes aurora-drift {
    0%   { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
    50%  { transform: translate3d(3%, 2%, 0) rotate(6deg) scale(1.08); }
    100% { transform: translate3d(-3%, -2%, 0) rotate(-4deg) scale(1.04); }
}

a {
    color: var(--accent-2);
    text-decoration: none;
    overflow-wrap: anywhere;
    transition: color 0.18s ease;
}

a:hover {
    color: var(--accent-3);
}

/* ---------------------------------------------------------------- Top bar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 14px 6vw;
    background: rgba(8, 10, 20, 0.62);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.brand {
    position: relative;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: -0.02em;
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    background-size: 200% auto;
    animation: brand-shimmer 6s linear infinite;
}

@keyframes brand-shimmer {
    to { background-position: 200% center; }
}

.topbar nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.topbar nav > a {
    position: relative;
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--muted);
    font-weight: 600;
    transition: color 0.2s ease, background 0.2s ease;
}

.topbar nav > a::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 4px;
    height: 2px;
    border-radius: 2px;
    background: var(--grad);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s var(--ease);
}

.topbar nav > a:hover {
    color: var(--text);
    background: var(--panel);
}

.topbar nav > a:hover::after {
    transform: scaleX(1);
}

.nav-form {
    margin: 0;
}

.nav-form button {
    min-height: auto;
    padding: 8px 12px;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 600;
    box-shadow: none;
}

.nav-form button:hover {
    background: var(--panel);
    color: var(--text);
    transform: none;
    box-shadow: none;
}

.user {
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ------------------------------------------------------------------- Page */
.page {
    width: min(1140px, 90vw);
    margin: 42px auto 80px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 30px;
    animation: rise-in 0.7s var(--ease) both;
}

h1,
h2 {
    line-height: 1.12;
    margin: 0 0 12px;
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(36px, 5.4vw, 62px);
    font-weight: 900;
    overflow-wrap: anywhere;
}

.section-head h1,
.profile-hero h1 {
    background: linear-gradient(180deg, #ffffff 0%, #c4cae6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

h2 {
    font-size: 25px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

p {
    margin: 0 0 14px;
}

.section-head p {
    color: var(--muted);
    margin: 0;
    font-size: 17px;
}

/* ------------------------------------------------------------------ Grids */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 22px;
}

.cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    align-items: stretch;
}

/* ------------------------------------------------ Surfaces (cards/panels) */
.card,
.panel,
.article,
.comments {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.preview-card {
    position: relative;
    box-shadow: var(--shadow);
    transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
}

/* gradient hairline that lights up on hover */
.preview-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: var(--grad);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.35s var(--ease);
    pointer-events: none;
}

.preview-card:hover {
    transform: translateY(-8px);
    border-color: transparent;
    box-shadow: 0 28px 60px rgba(79, 139, 255, 0.22), var(--shadow);
}

.preview-card:hover::before {
    opacity: 1;
}

.card-media {
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 10;
    margin: 14px 14px 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background:
        radial-gradient(120% 120% at 0% 0%, rgba(124, 92, 255, 0.22), transparent 55%),
        radial-gradient(120% 120% at 100% 100%, rgba(34, 211, 238, 0.16), transparent 55%),
        #0c0f1f;
}

.cover,
.hero-image {
    display: block;
    width: 100%;
    object-fit: cover;
    background: #0c0f1f;
}

.cover {
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s var(--ease);
}

.preview-card:hover .cover {
    transform: scale(1.05);
}

.hero-image {
    max-height: 480px;
    margin: 20px 0;
    border-radius: var(--radius);
    border: 1px solid var(--line);
}

.card-body,
.panel,
.article,
.comments {
    padding: 24px;
}

.preview-card .card-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 11px;
    padding: 20px;
}

.preview-card .card-body h2,
.preview-card .card-body p {
    margin-bottom: 0;
}

.preview-card .button {
    align-self: flex-start;
    margin-top: auto;
}

.card-text {
    color: #c3cae0;
    overflow-wrap: anywhere;
}

.cover-placeholder {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    color: #6f7aa0;
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.article {
    margin-bottom: 22px;
    box-shadow: var(--shadow);
}

.text {
    font-size: 18px;
    color: #d7dcf0;
    white-space: pre-wrap;
}

.meta,
.empty {
    color: var(--muted);
    font-size: 14px;
}

.empty {
    padding: 28px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    text-align: center;
    background: var(--panel);
}

/* ---------------------------------------------------------------- Buttons */
.button,
button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 11px 20px;
    border: 0;
    border-radius: 12px;
    background: var(--grad);
    background-size: 160% 160%;
    color: #fff;
    font: inherit;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    text-align: center;
    overflow: hidden;
    box-shadow: 0 10px 26px rgba(79, 139, 255, 0.30);
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background-position 0.5s var(--ease);
}

/* shine sweep */
.button::before,
button:not(.nav-form button)::before {
    content: "";
    position: absolute;
    top: 0;
    left: -120%;
    width: 60%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.40), transparent);
    transform: skewX(-18deg);
    transition: left 0.6s var(--ease);
}

.button:hover,
button:hover {
    transform: translateY(-2px);
    background-position: 100% 0;
    box-shadow: 0 16px 38px rgba(79, 139, 255, 0.42);
}

.button:hover::before,
button:not(.nav-form button):hover::before {
    left: 130%;
}

.button:active,
button:active {
    transform: translateY(0);
}

.button.small {
    min-height: 36px;
    padding: 7px 14px;
    font-size: 14px;
}

.button.secondary {
    background: var(--panel-strong);
    border: 1px solid var(--line-strong);
    color: var(--text);
    box-shadow: none;
}

.button.secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
}

.button.danger,
.admin-row button {
    background: linear-gradient(135deg, #ff5470, #d62f4d);
    box-shadow: 0 10px 26px rgba(214, 47, 77, 0.32);
}

.button.danger:hover {
    box-shadow: 0 16px 36px rgba(214, 47, 77, 0.44);
}

/* ------------------------------------------------------------------ Forms */
.form {
    display: grid;
    gap: 18px;
}

.form label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-weight: 700;
    font-size: 14px;
}

input,
textarea {
    min-height: 46px;
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    padding: 12px 14px;
    background: rgba(8, 10, 22, 0.6);
    color: var(--text);
    font: inherit;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input::placeholder,
textarea::placeholder {
    color: #6c769a;
}

input:focus,
textarea:focus {
    outline: 0;
    border-color: var(--accent);
    background: rgba(8, 10, 22, 0.85);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

input[type="file"] {
    min-height: 48px;
    padding: 10px 12px;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 7px 14px;
    border: 0;
    border-radius: 9px;
    background: var(--panel-strong);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.narrow {
    max-width: 460px;
    margin: 0 auto;
}

.panel.narrow {
    box-shadow: var(--shadow);
    animation: rise-in 0.6s var(--ease) both;
}

.panel {
    box-shadow: var(--shadow);
}

/* ------------------------------------------------------------------ Flash */
.flash {
    margin-bottom: 22px;
    padding: 15px 18px;
    background: rgba(124, 92, 255, 0.10);
    border: 1px solid rgba(124, 92, 255, 0.32);
    border-left: 3px solid var(--accent);
    border-radius: 12px;
    color: #e6e3ff;
    animation: rise-in 0.4s var(--ease) both;
}

.flash p {
    margin: 0;
}

.flash p + p {
    margin-top: 6px;
}

/* --------------------------------------------------------------- Comments */
.comments {
    box-shadow: var(--shadow);
}

.comment {
    padding: 16px 0;
    border-top: 1px solid var(--line);
}

.inline-form {
    margin: 18px 0 10px;
}

/* ------------------------------------------------------------------ Admin */
.admin-actions {
    display: flex;
    gap: 14px;
    margin-bottom: 22px;
}

.admin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.admin-row div,
.admin-row form {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.admin-row button {
    min-height: 34px;
    padding: 6px 12px;
}

.answer {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* =====================================================================
   AI chat
   ===================================================================== */
.page:has(.app) {
    width: 100%;
    margin: 0;
    padding: 0;
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
    overflow: hidden;
}

body:has(.app) {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    height: 100dvh;
    overflow: hidden;
}

body:has(.app) .topbar {
    flex: 0 0 auto;
}

.app {
    display: flex;
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    overflow: hidden;
    background: transparent;
}

/* ---- Sidebar ---- */
.chat-sidebar {
    flex: 0 0 clamp(264px, 24vw, 332px);
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-right: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(16, 18, 34, 0.72), rgba(8, 10, 20, 0.55));
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.chat-sidebar-header {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px 18px;
    border-bottom: 1px solid var(--line);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    color: var(--text);
}

.sidebar-brand-mark {
    flex: 0 0 44px;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 14px;
    background: var(--grad);
    color: #fff;
    font-size: 21px;
    line-height: 1;
    box-shadow: 0 10px 26px rgba(124, 92, 255, 0.45);
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.12;
}

.sidebar-brand-text small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.sidebar-brand-text strong {
    font-size: 22px;
    font-weight: 800;
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.new-chat-form {
    margin: 0;
}

.new-chat-btn {
    width: 100%;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
}

.ai-limit {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.sidebar-chat-list {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 12px;
    scrollbar-gutter: stable;
}

.sidebar-chat-link {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    overflow: hidden;
    padding: 11px 13px;
    border: 1px solid transparent;
    border-radius: 12px;
    color: #c3cae0;
    font-weight: 600;
    line-height: 1.3;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.chat-link-dot {
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--line-strong);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.chat-link-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-chat-link:hover {
    background: var(--panel);
    color: var(--text);
    transform: translateX(2px);
}

.sidebar-chat-link.active {
    border-color: rgba(124, 92, 255, 0.45);
    background: var(--accent-soft);
    color: #fff;
}

.sidebar-chat-link.active .chat-link-dot {
    background: var(--accent-3);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18);
}

/* ---- Chat column ---- */
.chat {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background:
        radial-gradient(1100px 600px at 80% -12%, rgba(124, 92, 255, 0.09), transparent 60%),
        transparent;
}

.chat-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 84px;
    padding: 14px clamp(18px, 3vw, 34px);
    border-bottom: 1px solid var(--line);
    background: rgba(9, 11, 22, 0.5);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.chat-heading {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
}

.chat-avatar {
    flex: 0 0 46px;
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border-radius: 14px;
    background: var(--grad);
    color: #fff;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 0.04em;
    box-shadow: 0 10px 26px rgba(79, 139, 255, 0.42);
}

.chat-title-block {
    min-width: 0;
}

.chat-title-block span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    line-height: 1.1;
    text-transform: uppercase;
}

.chat-title-block h2 {
    max-width: 36vw;
    margin: 3px 0 0;
    overflow: hidden;
    color: var(--text);
    font-size: 20px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    min-width: 0;
}

.rename-form {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.rename-form label {
    display: block;
    min-width: 0;
    width: clamp(170px, 24vw, 320px);
}

.rename-form label span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.rename-form input {
    min-height: 42px;
    font-weight: 600;
}

.delete-chat-form {
    flex: 0 0 auto;
    margin: 0;
}

.icon-button {
    display: grid;
    place-items: center;
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    font-size: 16px;
    line-height: 1;
}

/* ---- Messages ---- */
.messages {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 28px clamp(18px, 6vw, 96px);
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
}

.messages::-webkit-scrollbar,
.sidebar-chat-list::-webkit-scrollbar {
    width: 10px;
}

.messages::-webkit-scrollbar-thumb,
.sidebar-chat-list::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 999px;
    background: rgba(124, 92, 255, 0.4);
    background-clip: content-box;
}

.message-row {
    display: flex;
    width: 100%;
    min-width: 0;
}

.message-row.is-new {
    animation: message-in 0.32s var(--ease) both;
}

.message-row.user,
.message-row.from-user {
    max-width: none;
    overflow: visible;
    justify-content: flex-end;
    white-space: normal;
}

.message-row.ai,
.message-row.from-ai {
    justify-content: flex-start;
}

.message-bubble {
    position: relative;
    min-width: 0;
    max-width: min(760px, 78%);
    padding: 14px 17px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel-strong);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 14px 34px rgba(4, 6, 16, 0.42);
    line-height: 1.55;
}

.message-row.ai .message-bubble,
.message-row.from-ai .message-bubble {
    border-top-left-radius: 6px;
}

.message-row.is-pending .message-bubble {
    color: var(--muted);
}

.message-row.user .message-bubble,
.message-row.from-user .message-bubble {
    border-color: transparent;
    border-top-right-radius: 6px;
    background: var(--grad);
    color: #fff;
    box-shadow: 0 16px 36px rgba(79, 139, 255, 0.34);
}

.message-author {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.message-row.ai .message-author::before,
.message-row.from-ai .message-author::before {
    content: "";
    flex: 0 0 7px;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--grad);
}

.message-row.user .message-author,
.message-row.from-user .message-author {
    color: rgba(255, 255, 255, 0.85);
}

.message-text {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    word-break: break-word;
}

.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 54px;
    min-height: 20px;
    vertical-align: middle;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.35;
    animation: typing-dot 1s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.16s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.32s;
}

.message-status {
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

/* ---- Welcome / empty ---- */
.ai-empty {
    margin: auto;
    color: var(--muted);
}

.ai-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-width: 560px;
    padding: 30px;
    text-align: center;
    animation: rise-in 0.5s var(--ease) both;
}

.ai-welcome-mark {
    display: grid;
    width: 68px;
    height: 68px;
    place-items: center;
    border-radius: 20px;
    background: var(--grad);
    color: #fff;
    font-size: 31px;
    box-shadow: 0 18px 44px rgba(124, 92, 255, 0.5);
}

.ai-welcome h3 {
    margin: 0;
    color: var(--text);
    font-size: 27px;
    line-height: 1.15;
}

.ai-welcome p {
    margin: 0;
    max-width: 420px;
    font-size: 15px;
}

.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 6px;
}

.ai-chip {
    padding: 10px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--panel);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.ai-chip:hover {
    border-color: rgba(124, 92, 255, 0.5);
    background: var(--accent-soft);
    transform: translateY(-2px);
}

/* ---- Composer ---- */
.chat-input {
    flex: 0 0 auto;
    position: relative;
    display: block;
    padding: 16px clamp(18px, 6vw, 96px) 22px;
    border-top: 1px solid var(--line);
    background: rgba(9, 11, 22, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.composer-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 20px;
    background: rgba(17, 19, 34, 0.72);
    box-shadow: 0 16px 40px rgba(4, 6, 16, 0.45);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.composer-box:focus-within {
    border-color: rgba(124, 92, 255, 0.55);
    box-shadow: var(--glow);
}

.chat-input textarea {
    width: 100%;
    min-height: 30px;
    max-height: 200px;
    min-width: 0;
    overflow-y: auto;
    resize: none;
    border: 0;
    padding: 4px 6px;
    background: transparent;
    box-shadow: none;
    line-height: 1.5;
}

.chat-input textarea:focus {
    border: 0;
    outline: none;
    box-shadow: none;
}

.composer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.token-usage {
    flex: 1 1 auto;
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
}

.token-usage span {
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.token-usage strong {
    color: var(--text);
    font-size: 13px;
}

.token-usage small {
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-input .send-button {
    flex: 0 0 auto;
    min-height: 44px;
    border-radius: 13px;
    padding-inline: 22px;
}

.chat-input[data-sending="true"] .send-button {
    opacity: 0.78;
    pointer-events: none;
}

.chat-input[data-sending="true"] .send-icon {
    animation: send-pulse 0.9s ease-in-out infinite;
}

.chat-input textarea:disabled {
    color: var(--muted);
    opacity: 1;
}

.chat-status {
    position: absolute;
    left: clamp(18px, 6vw, 96px);
    bottom: calc(100% + 4px);
    max-width: min(560px, calc(100% - 36px));
    margin: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-status.is-error {
    color: var(--danger);
}

.send-icon {
    display: none;
}

/* =====================================================================
   Profile
   ===================================================================== */
.profile-page {
    display: grid;
    gap: 22px;
}

.profile-hero,
.profile-card,
.profile-stat {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

/* ---- Hero ---- */
.profile-hero {
    position: relative;
    display: flex;
    align-items: center;
    gap: clamp(18px, 3.5vw, 38px);
    min-height: 250px;
    padding: clamp(26px, 4vw, 46px);
    overflow: hidden;
    box-shadow: var(--shadow);
    background:
        radial-gradient(130% 160% at 0% 0%, rgba(124, 92, 255, 0.30), transparent 52%),
        radial-gradient(120% 150% at 100% 100%, rgba(34, 211, 238, 0.20), transparent 54%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
    animation: rise-in 0.7s var(--ease) both;
}

/* sheen sweep across the hero */
.profile-hero::after {
    content: "";
    position: absolute;
    top: -60%;
    left: -30%;
    width: 50%;
    height: 220%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.07), transparent);
    transform: translateX(0) rotate(8deg);
    animation: hero-sheen 7s var(--ease) infinite;
    pointer-events: none;
}

@keyframes hero-sheen {
    0%, 58% { transform: translateX(0) rotate(8deg); opacity: 0; }
    66% { opacity: 1; }
    100% { transform: translateX(380%) rotate(8deg); opacity: 0; }
}

.profile-hero-orbs span {
    position: absolute;
    border-radius: 50%;
    filter: blur(46px);
    opacity: 0.55;
    pointer-events: none;
}

.profile-hero-orbs span:nth-child(1) {
    width: 220px;
    height: 220px;
    top: -70px;
    right: 12%;
    background: radial-gradient(circle, rgba(124, 92, 255, 0.85), transparent 70%);
    animation: orb-float 9s ease-in-out infinite;
}

.profile-hero-orbs span:nth-child(2) {
    width: 180px;
    height: 180px;
    bottom: -60px;
    right: 30%;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.7), transparent 70%);
    animation: orb-float 11s ease-in-out infinite reverse;
}

.profile-hero-orbs span:nth-child(3) {
    width: 160px;
    height: 160px;
    top: 28%;
    right: 4%;
    background: radial-gradient(circle, rgba(79, 139, 255, 0.75), transparent 70%);
    animation: orb-float 13s ease-in-out infinite;
}

@keyframes orb-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-18px, 16px) scale(1.12); }
}

/* ---- Avatar with rotating gradient ring ---- */
.profile-avatar-wrap {
    position: relative;
    z-index: 1;
    flex: 0 0 clamp(96px, 13vw, 142px);
    width: clamp(96px, 13vw, 142px);
    height: clamp(96px, 13vw, 142px);
}

.profile-avatar-ring {
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #7c5cff, #4f8bff, #22d3ee, #7c5cff);
    animation: spin 6s linear infinite;
    filter: drop-shadow(0 0 18px rgba(124, 92, 255, 0.55));
}

.profile-avatar-ring::after {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    background: #0b0d1a;
}

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

.profile-avatar {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--grad);
    color: #fff;
    font-size: clamp(40px, 7vw, 66px);
    font-weight: 900;
    line-height: 1;
    box-shadow: inset 0 2px 12px rgba(255, 255, 255, 0.28), 0 14px 34px rgba(79, 139, 255, 0.42);
}

.profile-status-dot {
    position: absolute;
    z-index: 2;
    right: 7px;
    bottom: 7px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--success);
    border: 3px solid #0b0d1a;
    animation: status-pulse 2s ease-in-out infinite;
}

@keyframes status-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); }
    50% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
}

.profile-hero-text {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.profile-kicker {
    margin-bottom: 8px;
    color: var(--accent-3);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.profile-hero h1 {
    margin-bottom: 18px;
}

.profile-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--panel-strong);
    color: #c3cae0;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.15;
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.profile-badge:hover {
    transform: translateY(-2px);
}

.profile-badge.success {
    border-color: rgba(52, 211, 153, 0.4);
    background: rgba(52, 211, 153, 0.12);
    color: #6ee7b7;
}

.profile-badge.warning {
    border-color: rgba(251, 191, 36, 0.4);
    background: rgba(251, 191, 36, 0.12);
    color: #fcd34d;
}

.profile-badge.admin {
    border-color: rgba(124, 92, 255, 0.45);
    background: var(--accent-soft);
    color: #b7a6ff;
    box-shadow: 0 0 16px rgba(124, 92, 255, 0.25);
}

/* ---- Stats strip ---- */
.profile-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.profile-stat {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding: 18px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}

.profile-stat::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: var(--grad);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s var(--ease);
    pointer-events: none;
}

.profile-stat:hover {
    transform: translateY(-5px);
    border-color: transparent;
}

.profile-stat:hover::before {
    opacity: 1;
}

.profile-stat-icon {
    flex: 0 0 46px;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: var(--accent-soft);
    color: #b7a6ff;
}

.profile-stat-icon svg {
    width: 24px;
    height: 24px;
}

.profile-stat > div {
    min-width: 0;
}

.profile-stat-label {
    margin: 0 0 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.profile-stat-value {
    margin: 0;
    color: var(--text);
    font-size: 16px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Layout & cards ---- */
.profile-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.58fr);
    gap: 22px;
    align-items: start;
}

.profile-card {
    min-width: 0;
    padding: 24px;
    box-shadow: var(--shadow);
}

.profile-info-card,
.profile-actions-card,
.profile-roblox-card {
    display: grid;
    gap: 20px;
}

.profile-roblox-card {
    grid-column: 1 / -1;
}

.profile-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
}

.profile-details div {
    position: relative;
    min-width: 0;
    padding: 16px 16px 16px 20px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(8, 10, 22, 0.45);
    transition: transform 0.25s var(--ease), background 0.25s var(--ease);
}

.profile-details div::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--grad);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.25s var(--ease);
}

.profile-details div:hover {
    transform: translateY(-3px);
    background: rgba(124, 92, 255, 0.08);
}

.profile-details div:hover::before {
    transform: scaleY(1);
}

.profile-details dt {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.profile-details dd {
    margin: 0;
    color: var(--text);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.profile-actions {
    display: grid;
    gap: 11px;
}

.profile-actions .button {
    width: 100%;
    justify-content: flex-start;
    gap: 10px;
}

.btn-icon {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
}

/* ------------------------------------------------------------- Roblox link */
.roblox-link-box {
    display: grid;
    gap: 18px;
}

.studio-roblox-link {
    margin-bottom: 22px;
    box-shadow: var(--shadow);
}

.studio-roblox-link .roblox-link-box {
    padding-top: 0;
    border-top: 0;
}

.roblox-link-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.roblox-code-card {
    display: grid;
    gap: 8px;
    margin-top: 16px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(8, 10, 22, 0.5);
}

.roblox-code {
    width: fit-content;
    padding: 12px 18px;
    border: 1px dashed rgba(124, 92, 255, 0.55);
    border-radius: 10px;
    background: rgba(124, 92, 255, 0.10);
    color: #fff;
    font-family: "Courier New", monospace;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: 6px;
    animation: code-glow 2.2s ease-in-out infinite;
}

@keyframes code-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(124, 92, 255, 0); }
    50%      { box-shadow: 0 0 26px 2px rgba(124, 92, 255, 0.35); }
}

/* =====================================================================
   Keyframes & motion
   ===================================================================== */
@keyframes rise-in {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes typing-dot {
    0%, 80%, 100% { opacity: 0.32; transform: translateY(0); }
    40%           { opacity: 0.9; transform: translateY(-4px); }
}

@keyframes send-pulse {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-2px); }
}

/* Scroll reveal (driven by base.html observer) */
[data-reveal] {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
    will-change: opacity, transform;
}

[data-reveal].in-view {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    .bg-aurora,
    .brand,
    .code-glow,
    .messages {
        animation: none !important;
        scroll-behavior: auto;
    }

    *,
    [data-reveal] {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }

    [data-reveal] {
        opacity: 1;
        transform: none;
    }

    .message-row.is-new,
    .typing-indicator span,
    .chat-input[data-sending="true"] .send-icon {
        animation: none;
    }
}

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 720px) {
    .topbar {
        display: block;
        padding: 12px 0 10px;
        overflow: hidden;
    }

    .brand {
        display: block;
        width: calc(100% - 32px);
        margin: 0 16px 10px;
        font-size: 22px;
    }

    .topbar nav {
        flex-wrap: nowrap;
        gap: 8px;
        overflow-x: auto;
        padding: 0 16px 2px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .topbar nav::-webkit-scrollbar {
        display: none;
    }

    .topbar nav > a,
    .topbar nav .user {
        flex: 0 0 auto;
        min-height: 36px;
        display: inline-flex;
        align-items: center;
        border: 1px solid var(--line);
        border-radius: 999px;
        padding: 7px 14px;
        background: var(--panel);
        color: var(--text);
        font-size: 14px;
        line-height: 1.2;
    }

    .topbar nav > a::after {
        display: none;
    }

    .topbar nav .user {
        max-width: 140px;
        color: var(--muted);
    }

    .topbar nav .button.small {
        min-height: 36px;
        padding: 7px 14px;
    }

    .topbar nav::after {
        content: "";
        flex: 0 0 8px;
    }

    .page {
        width: 100%;
        margin: 0 auto 40px;
        padding: 20px 14px 0;
    }

    .section-head {
        display: block;
        margin-bottom: 20px;
    }

    h1 {
        font-size: clamp(30px, 11vw, 44px);
    }

    h2 {
        font-size: 21px;
    }

    .grid,
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .card-body,
    .panel,
    .article,
    .comments {
        padding: 18px;
    }

    .card-media {
        aspect-ratio: 16 / 10;
        margin: 12px 12px 0;
    }

    .hero-image {
        max-height: 360px;
    }

    .text {
        font-size: 16px;
        overflow-wrap: anywhere;
    }

    .button,
    button {
        width: 100%;
        min-height: 46px;
    }

    .button.small,
    .nav-form button {
        width: auto;
    }

    .narrow {
        max-width: none;
    }

    .profile-hero {
        align-items: flex-start;
        flex-direction: column;
        min-height: 0;
        padding: 22px;
    }

    .profile-avatar-wrap {
        width: 84px;
        height: 84px;
        flex-basis: 84px;
    }

    .profile-avatar {
        font-size: 36px;
    }

    .profile-stats {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .profile-stat {
        padding: 14px;
    }

    .profile-layout,
    .profile-details {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .profile-card {
        padding: 18px;
    }

    .profile-actions .button {
        justify-content: center;
    }

    .roblox-link-head {
        display: block;
    }

    .roblox-code {
        width: 100%;
        font-size: clamp(24px, 9vw, 32px);
        text-align: center;
        letter-spacing: 4px;
    }

    .admin-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 16px;
    }

    .admin-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .admin-row div,
    .admin-row form {
        width: 100%;
        align-items: stretch;
    }

    .admin-row div {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .admin-row a {
        display: inline-flex;
        min-height: 38px;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--line-strong);
        border-radius: 10px;
        padding: 7px 12px;
        color: var(--text);
        font-weight: 700;
        background: var(--panel);
    }

    .admin-row button {
        width: 100%;
        min-height: 38px;
    }

    /* --- AI chat mobile --- */
    .page:has(.app) {
        margin: 0;
        padding: 0;
    }

    body:has(.app) .topbar {
        display: none;
    }

    .app {
        flex-direction: column;
        height: 100dvh;
    }

    .chat-sidebar {
        flex: 0 0 auto;
        width: 100%;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .chat-sidebar-header {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
        padding: max(12px, env(safe-area-inset-top)) 14px 10px;
        border-bottom: 0;
    }

    .sidebar-brand {
        flex: 1 1 auto;
        gap: 10px;
    }

    .sidebar-brand-mark {
        flex-basis: 36px;
        width: 36px;
        height: 36px;
        border-radius: 11px;
        font-size: 17px;
    }

    .sidebar-brand-text small {
        display: none;
    }

    .sidebar-brand-text strong {
        font-size: 19px;
    }

    .new-chat-btn {
        width: auto;
        min-height: 36px;
        padding: 7px 14px;
        font-size: 13px;
    }

    .ai-limit {
        display: none;
    }

    .sidebar-chat-list {
        flex: 0 0 auto;
        flex-direction: row;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0 14px 12px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-chat-list::-webkit-scrollbar {
        display: none;
    }

    .sidebar-chat-link {
        flex: 0 0 auto;
        width: min(58vw, 230px);
        max-width: none;
        padding: 9px 13px;
        border: 1px solid var(--line);
        border-radius: 999px;
        background: var(--panel);
        font-size: 13px;
        line-height: 1.25;
    }

    .sidebar-chat-link:hover {
        transform: none;
    }

    .chat-header {
        display: flex;
        align-items: center;
        gap: 10px;
        min-height: 0;
        padding: 10px 14px;
    }

    .chat-heading {
        gap: 8px;
    }

    .chat-avatar {
        flex-basis: 34px;
        width: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: 11px;
    }

    .chat-title-block span {
        display: none;
    }

    .chat-title-block h2 {
        max-width: 100%;
        margin: 0;
        font-size: 17px;
        font-weight: 750;
    }

    .chat-actions {
        display: none;
    }

    .messages {
        flex: 1 1 auto;
        gap: 16px;
        padding: 18px 14px 12px;
    }

    .message-bubble {
        max-width: 86%;
        padding: 12px 15px;
        font-size: 15px;
    }

    .message-status {
        display: none;
    }

    .message-author {
        display: none;
    }

    .ai-welcome {
        gap: 12px;
        padding: 18px 8px;
    }

    .ai-welcome-mark {
        width: 58px;
        height: 58px;
        font-size: 26px;
    }

    .ai-welcome h3 {
        font-size: 22px;
    }

    .chat-input {
        padding: 10px 12px max(12px, env(safe-area-inset-bottom));
    }

    .composer-box {
        gap: 8px;
        padding: 10px 12px;
        border-radius: 18px;
    }

    .chat-input textarea {
        max-height: 140px;
        font-size: 16px;
    }

    .composer-bar {
        gap: 10px;
    }

    .token-usage {
        font-size: 10px;
    }

    .token-usage small {
        display: none;
    }

    .chat-input .send-button {
        min-height: 40px;
        padding-inline: 0;
        width: 44px;
        min-width: 44px;
        border-radius: 50%;
        font-size: 18px;
    }

    .chat-status {
        left: 14px;
        bottom: calc(100% + 6px);
        max-width: calc(100% - 28px);
        font-size: 12px;
    }

    .send-label {
        display: none;
    }

    .send-icon {
        display: inline;
    }
}

@media (max-width: 420px) {
    .page {
        padding-inline: 10px;
    }

    .card-body,
    .panel,
    .article,
    .comments {
        padding: 15px;
    }

    .admin-row div {
        grid-template-columns: 1fr;
    }

    .sidebar-brand-text strong {
        font-size: 17px;
    }

    .sidebar-chat-link {
        width: min(66vw, 220px);
    }

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