* { box-sizing: border-box; }

:root {
    --bg: #f7f7f8;
    --panel: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --accent: #111827;
    /* Layout widths for full-width style */
    --page-max: 1600px;      /* overall container max width */
    --content-max: 920px;    /* centered chat/content column */
    --bubble-ai: #ffffff;
    --bubble-ai-border: rgba(15, 23, 42, 0.08);
    --bubble-user: #4f46e5;
    --bubble-user-hover: #4338ca;
    --bubble-user-text: #f8fafc;
    --composer-shadow: 0 24px 40px -28px rgba(15, 23, 42, 0.45);
}

html, body, #root {
    height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Global hint text */
.hint { color: var(--muted); font-size: 13px; }

.container {
    /* Fill the viewport height */
    min-height: 100vh;
    /* Modern viewport units for mobile browsers */
    min-height: 100svh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0 auto;
    padding: 12px 6px;
    /* Expand container similar to ChatGPT full-width */
    width: min(var(--page-max), 100% - 24px);
}

.app-headbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    position: sticky;
    top: 12px;
    z-index: 30;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 24px;
    box-shadow: 0 18px 40px -28px rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.app-headbar .headbar-main { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-width: 0; flex: 1 1 auto; }
.app-headbar .headbar-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.app-headbar .headbar-title { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; }
.app-headbar .headbar-menu { position: relative; }
.app-headbar .headbar-toggles { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-left: auto; }
.app-headbar .headbar-side { margin-left: auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
.app-headbar .headbar-credits { padding: 4px 12px; border: 1px solid rgba(15, 23, 42, 0.08); border-radius: 9999px; background: rgba(255, 255, 255, 0.6); font-size: 13px; }
.app-headbar .header-actions { display: inline-flex; align-items: center; gap: 8px; }

@media (max-width: 720px) {
    .app-headbar { padding: 14px 16px; top: 8px; }
    .app-headbar .headbar-main { gap: 12px; }
    .app-headbar .headbar-toggles { width: 100%; margin-left: 0; justify-content: flex-start; }
    .app-headbar .headbar-side { width: 100%; justify-content: space-between; }
    .app-headbar .headbar-credits { order: 2; }
}

.tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    box-shadow: 0 12px 26px -24px rgba(15, 23, 42, 0.55);
}

.tabs button {
    padding: 6px 14px;
    border: 0;
    background: transparent;
    color: var(--muted);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease;
}

.tabs button:hover { background: rgba(15, 23, 42, 0.08); color: var(--text); }
.tabs button.active {
    background: #111827;
    color: var(--bubble-user-text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.header-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.header-actions .btn {
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    padding: 8px 16px;
    font-weight: 500;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.header-actions .btn:hover { background: rgba(15, 23, 42, 0.08); }
.header-actions .btn:active { transform: scale(0.98); }

.avatar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: rgba(255, 255, 255, 0.7);
    border-radius: 9999px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.avatar-btn:hover { background: rgba(15, 23, 42, 0.08); }
.avatar-btn:active { transform: scale(0.97); }
.avatar-btn img { height: 100%; border-radius: 50%; display: block; object-fit: cover; object-position: center; }

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
    padding: 6px 12px;
    border-radius: 9999px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.7);
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.toggle:hover { background: rgba(15, 23, 42, 0.08); color: var(--text); }
.toggle input { accent-color: var(--accent); }

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

.session code {
    background: #f2f2f3;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 12px;
}

.session button,
.ai2ai button {
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    border-radius: 10px;
    cursor: pointer;
}

.session input,
.ai2ai input {
    padding: 8px 10px;
    border: 1px solid var(--border);
    background: var(--panel);
    border-radius: 10px;
    min-width: 180px;
}

.chat {
    flex: 1;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 24px 20px 32px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    font-size: 15px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(246, 249, 255, 0.82) 100%);
    border: 1px solid rgba(15, 23, 42, 0.05);
    border-radius: 22px;
    box-shadow: var(--composer-shadow);
    position: relative;
    scroll-padding-block: 24px;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.chat-layout { display: flex; gap: 12px; align-items: stretch; flex: 1; min-height: 0; }
.chat-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.chat-main > .session,
.chat-main > .chat,
.chat-main > .suggestions,
.chat-main > .composer-bar {
    width: min(var(--content-max), 100%);
    margin-left: auto;
    margin-right: auto;
}

/* Home hero (new chat) */
.home-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(var(--content-max), 100%);
    margin: 6px auto 10px;
    padding: 28px 0 18px;
    gap: 12px;
}
.home-title { font-size: 24px; font-weight: 700; text-align: center; letter-spacing: 0.2px; margin-bottom: 28px; }
.home-input { display: flex; gap: 8px; width: 100%; }
.home-input textarea { flex: 1; resize: none; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); outline: none; }
.home-input button { padding: 10px 14px; border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 12px; cursor: pointer; }
.home-credits { width: 100%; text-align: right; }

/* Featured agent highlight under hero */
.home-feature { width: min(var(--content-max), 100%); margin: 10px auto 0; }
.home-feature-head { display: flex; align-items: center; justify-content: space-between; margin: 8px 0; }
.home-feature-body { display: block; }
.home-feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; width: 100%; }
.home-feature-grid .profile-card-shell {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08), 0 18px 32px -20px rgba(79, 70, 229, 0.35);
}
.sidebar {
    width: 280px;
    flex: 0 0 280px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(242, 246, 255, 0.72) 100%);
    border-radius: 22px;
    display: flex;
    flex-direction: column;
    padding: 14px 0;
    box-shadow: 0 28px 48px -36px rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    position: sticky;
    top: 120px;
    max-height: calc(100vh - 148px);
    z-index: 20;
    overflow: hidden;
}
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 12px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    margin-bottom: 6px;
}
.sidebar-header h3 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.sidebar-list { overflow: auto; display: flex; flex-direction: column; gap: 6px; padding: 0 12px 12px; }
.sidebar-list::-webkit-scrollbar { width: 6px; }
.sidebar-list::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.1); border-radius: 9999px; }
.conv {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    padding: 12px 14px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    border-radius: 16px;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.conv:hover {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(15, 23, 42, 0.06);
    box-shadow: 0 20px 32px -32px rgba(15, 23, 42, 0.55);
    transform: translateY(-1px);
}
.conv.active {
    background: rgba(79, 70, 229, 0.14);
    border-color: rgba(79, 70, 229, 0.4);
    box-shadow: 0 20px 40px -32px rgba(79, 70, 229, 0.6);
}
.conv-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(15, 23, 42, 0.1);
    object-fit: cover;
    object-position: center;
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 18px -16px rgba(15, 23, 42, 0.6);
}
.conv-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conv-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.conv-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.conv-snippet { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 860px) {
    .chat-layout { flex-direction: column; }
    .sidebar {
        width: 100%;
        flex-basis: auto;
        max-height: 280px;
        position: relative;
        top: unset;
        box-shadow: 0 18px 32px -28px rgba(15, 23, 42, 0.45);
    }
}

.msg {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 0 6px;
}

.msg.user { justify-content: flex-end; }

.msg.ai { justify-content: flex-start; }

.msg-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(15, 23, 42, 0.06);
    background: #eef2ff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex: 0 0 auto;
    box-shadow: 0 16px 32px -24px rgba(15, 23, 42, 0.45);
}

.msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.bubble {
    max-width: min(75%, 620px);
    padding: 12px 16px;
    border-radius: 22px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--bubble-ai);
    border: 1px solid var(--bubble-ai-border);
    color: var(--text);
    box-shadow: 0 16px 32px -26px rgba(15, 23, 42, 0.5);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.bubble:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 36px -26px rgba(15, 23, 42, 0.55);
}

.msg.ai .bubble {
    border-bottom-left-radius: 8px;
}

.msg.user .bubble {
    background: linear-gradient(135deg, var(--bubble-user) 0%, var(--bubble-user-hover) 100%);
    color: var(--bubble-user-text);
    border: 0;
    border-bottom-right-radius: 8px;
    box-shadow: 0 22px 40px -24px rgba(67, 56, 202, 0.65);
}

.msg.user .bubble a { color: inherit; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.4); }
.msg.user .bubble strong { color: inherit; }

.bubble-text {
    display: block;
    white-space: pre-wrap;
}

.bubble-media {
    margin-top: 10px;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 18px 40px -26px rgba(15, 23, 42, 0.45);
}

.bubble-media img {
    display: block;
    width: 100%;
    height: auto;
}

.thinking {
    color: var(--muted);
    font-size: 13px;
    margin: 12px auto;
    text-align: center;
}

/* Thought-before-answer streaming UI */
.msg.ai.thought .bubble {
    border-style: dashed;
    border-color: rgba(79, 70, 229, 0.35);
    background: rgba(255, 255, 255, 0.72);
}
.thought-label {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}
.thought-stream {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Thought bar shown as a separate panel (not attached to input) */
.thought-sticky {
    position: relative;
    z-index: 26;
    width: min(var(--content-max), 100%);
    margin: 16px auto 12px;
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.16);
    box-shadow: 0 24px 44px -28px rgba(67, 56, 202, 0.55);
}

.thought-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 0;
    background: rgba(79, 70, 229, 0.18);
    color: var(--bubble-user);
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.thought-close:hover { transform: scale(1.05); }
.thought-close:active { transform: scale(0.95); }

.suggestions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 0 0;
    position: sticky;
    bottom: 110px;
    background: linear-gradient(to top, rgba(247, 247, 248, 0.92) 45%, rgba(247, 247, 248, 0));
    z-index: 25;
}
.suggestions .hint { color: var(--muted); font-size: 13px; }
.suggestions button {
    padding: 8px 14px;
    border: 0;
    background: rgba(79, 70, 229, 0.12);
    color: var(--bubble-user);
    border-radius: 9999px;
    cursor: pointer;
    max-width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    transition: transform 0.18s ease, background-color 0.18s ease;
}

.suggestions button:hover {
    transform: translateY(-1px);
    background: rgba(79, 70, 229, 0.2);
}

.composer-bar {
    position: sticky;
    bottom: 0;
    padding: 18px 0 8px;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    background: linear-gradient(to bottom, rgba(247, 247, 248, 0) 0%, var(--bg) 55%);
    z-index: 30;
}

.chat-main > .session {
    position: sticky;
    top: 50px;
    z-index: 25;
    background: linear-gradient(to bottom, rgba(247, 247, 248, 0.95) 70%, rgba(247, 247, 248, 0));
    padding-bottom: 6px;
}

.chat-main > .composer-bar {
    width: min(var(--content-max), 100%);
    margin-left: auto;
    margin-right: auto;
}

.composer {
    flex: 1;
    border-radius: 26px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--composer-shadow);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    min-height: 56px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.composer textarea {
    flex: 1;
    resize: none;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    padding: 0;
    max-height: 160px;
}

.composer textarea:focus { outline: none; }
.composer textarea::placeholder { color: rgba(100, 116, 139, 0.9); }

.composer:focus-within {
    border-color: rgba(79, 70, 229, 0.4);
    box-shadow: 0 18px 40px -28px rgba(79, 70, 229, 0.45);
}

.composer-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.composer-actions button {
    padding: 11px 22px;
    border: 0;
    border-radius: 9999px;
    background: linear-gradient(135deg, var(--bubble-user) 0%, var(--bubble-user-hover) 100%);
    color: var(--bubble-user-text);
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 18px 38px -24px rgba(79, 70, 229, 0.6);
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.composer-actions button:hover { transform: translateY(-1px); box-shadow: 0 20px 40px -20px rgba(79, 70, 229, 0.65); }
.composer-actions button:active { transform: translateY(0); }
.composer-actions button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.composer-meta {
    font-size: 12px;
    color: var(--muted);
    text-align: right;
}

@media (max-width: 640px) {
    .chat { padding: 18px 12px 26px; border-radius: 18px; }
    .msg { padding: 0; }
    .bubble { max-width: 100%; }
    .composer { padding: 10px 14px; border-radius: 22px; }
    .composer-actions { gap: 6px; }
    .composer-actions button { padding: 10px 18px; }
    .suggestions { bottom: 96px; }
}

.ai2ai {
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    background: var(--panel);
}

.ai2ai .row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.bubble p { margin: 0.25em 0; }
.bubble pre { background: #0b1115; color: #e6edf3; padding: 10px; border-radius: 8px; overflow: auto; }
.bubble code { background: #f3f4f6; padding: 0 4px; border-radius: 4px; }

/* Feed */
.feed {
    width: min(680px, 100%);
    margin: 0 auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.04);
}

.timeline {
    display: flex;
    flex-direction: column;
}

.timeline-card {
    background: var(--panel);
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.timeline-card:last-child {
    border-bottom: none;
}

.timeline-card.composer {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.timeline-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--border);
    object-fit: cover;
    object-position: center;
    background: var(--panel);
}

.composer-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.composer-input {
    width: 100%;
    border: 0;
    background: transparent;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    resize: vertical;
    min-height: 72px;
    padding: 0;
}

.composer-input::placeholder {
    color: var(--muted);
}

.composer-input:focus {
    outline: none;
}

.composer-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.composer-field {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

.composer-field:focus {
    outline: 2px solid rgba(17, 24, 39, 0.1);
    outline-offset: 0;
}

.composer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.admin-compose {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-compose-header {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.admin-compose-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.timeline-card.post {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.post-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.post-header-body {
    flex: 1;
    min-width: 0;
}

.post-header-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.post-author {
    font-weight: 600;
    color: var(--text);
}

.post-handle,
.post-time {
    color: var(--muted);
}

.post-dot {
    color: var(--muted);
}

.post-header-sub {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12.5px;
    color: var(--muted);
}

.post-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(17, 24, 39, 0.1);
    color: #111827;
}

.post-pill-update {
    background: rgba(16, 185, 129, 0.14);
    color: #047857;
}

.post-pill-release {
    background: rgba(37, 99, 235, 0.16);
    color: #1d4ed8;
}

.post-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.post-title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}

.post-text {
    color: var(--text);
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.post-image {
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--border);
    object-fit: cover;
    background: #f9fafb;
}

.post-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 4px;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 9999px;
    border: 0;
    background: transparent;
    font-size: 13px;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
    background: rgba(17, 24, 39, 0.08);
    color: var(--text);
}

.icon-btn.active {
    color: #e11d48;
}

.icon-btn:focus-visible {
    outline: 2px solid rgba(17, 24, 39, 0.16);
    outline-offset: 2px;
}

.timeline-skeletons {
    display: flex;
    flex-direction: column;
}

.feed-comments {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feed-comment-compose {
    display: flex;
    align-items: center;
    gap: 8px;
}

.feed-comment-compose input {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
}

.feed-comment-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feed-comment {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.feed-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    object-fit: cover;
    object-position: center;
    background: var(--panel);
}

.feed-comment-body {
    flex: 1;
    min-width: 0;
}

.feed-comment-head {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
}

.feed-comment-author {
    font-weight: 600;
    color: var(--text);
}

.feed-comment-text {
    margin-top: 4px;
    color: var(--text);
    line-height: 1.55;
}

@media (max-width: 720px) {
    .feed {
        border-radius: 16px;
    }

    .timeline-card {
        padding: 16px;
    }

    .composer-meta {
        grid-template-columns: 1fr;
    }
}

/* Skeletons */
.skeleton { position: relative; overflow: hidden; }
.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.04), transparent);
    transform: translateX(-100%);
    animation: shimmer 1.2s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skeleton-line { height: 12px; border-radius: 6px; background: #f3f4f6; }
.skeleton-avatar { width: 42px; height: 42px; border-radius: 50%; background: #f3f4f6; border: 1px solid var(--border); }

.profile-card { position: relative; display: block; height: 100%; }
.profile-card-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 22px 20px 20px;
    border-radius: 20px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(243, 246, 255, 0.88) 100%);
    box-shadow: 0 28px 46px -36px rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    overflow: hidden;
    min-height: 0;
}
.profile-accent {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}
.profile-accent-bg {
    position: absolute;
    inset: -45% -30% 55% -30%;
    background-size: cover;
    background-position: center;
    filter: blur(36px);
    opacity: 0.7;
    transform: translateZ(0);
}
.profile-card-shell > *:not(.profile-accent) { position: relative; z-index: 1; }
.profile-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(255, 255, 255, 0.9);
    color: #111827;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    box-shadow: 0 10px 30px -24px rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.profile-close:hover { background: rgba(255, 255, 255, 0.97); }
.profile-main {
    display: flex;
    align-items: center;
    gap: 14px;
}
.profile-avatar-wrap {
    width: 64px;
    height: 64px;
    padding: 3px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.55), rgba(14, 165, 233, 0.35));
    box-shadow: 0 18px 34px -26px rgba(15, 23, 42, 0.6);
}
.profile-avatar {
    width: 100%;
    height: 100%;
    border-radius: 16px;
    object-fit: cover;
    object-position: center;
    background: rgba(255, 255, 255, 0.92);
    border: 2px solid rgba(255, 255, 255, 0.95);
    display: block;
}
.profile-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.profile-name { font-weight: 700; font-size: 16px; color: #0f172a; }
.profile-handle { color: var(--muted); font-size: 13px; }
.profile-title { font-size: 13.5px; color: #1f2937; }
.profile-bio {
    margin: 0;
    color: #1f2937;
    font-size: 14px;
    line-height: 1.6;
}
.profile-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.profile-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.82);
    border-radius: 9999px;
    color: #0f172a;
    text-decoration: none;
    font-size: 12.5px;
    box-shadow: 0 12px 24px -24px rgba(15, 23, 42, 0.6);
    transition: background 0.2s ease, border-color 0.2s ease;
}
.profile-links a:hover {
    background: rgba(15, 23, 42, 0.08);
    border-color: rgba(15, 23, 42, 0.14);
}
.profile-actions { display: flex; gap: 8px; }
.profile-actions .btn {
    flex: 1;
    padding: 11px 14px;
    border-radius: 14px;
    font-weight: 600;
}
.profile-rail {
    width: 300px;
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-self: flex-start;
    position: sticky;
    top: 120px;
    max-height: calc(100vh - 148px);
    padding: 6px 0;
    z-index: 18;
}
.profile-rail > * { flex-shrink: 0; }
@media (max-width: 1080px) {
    .profile-rail { display: none; }
}

/* Modern Auth (split layout) */
.auth-shell {
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
}
.auth-left {
    position: relative;
    overflow: hidden;
    border-right: 1px solid var(--border);
    background:
        radial-gradient(900px 600px at 10% 15%, #e8eaff 0%, transparent 40%),
        radial-gradient(800px 600px at 85% 70%, #ffe8f0 0%, transparent 50%),
        linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
}
.auth-left::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(700px 400px at 40% 20%, rgba(17, 24, 39, 0.06), transparent 60%);
}
.auth-hero {
    height: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 28px 28px 28px 32px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark {
    width: 30px; height: 30px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; letter-spacing: 0.2px; color: #111827;
    background: linear-gradient(135deg, #a7f3d0, #93c5fd);
    border: 1px solid rgba(17,24,39,0.08);
}
.brand-name { font-weight: 700; letter-spacing: 0.2px; }
.hero-title { font-size: clamp(28px, 4.2vw, 46px); line-height: 1.1; margin: 14px 0 10px; font-weight: 800; }
.hero-subtitle { color: #374151; font-size: clamp(14px, 2.2vw, 16px); margin: 0 0 12px; }
.hero-highlights { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-chip { font-size: 12.5px; color: #111827; background: #fff; border: 1px solid var(--border); padding: 4px 10px; border-radius: 9999px; box-shadow: 0 1px 1px rgba(0,0,0,0.02); }

.auth-right {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
}
.auth-card {
    width: min(440px, 100%);
    border: 1px solid var(--border);
    background: var(--panel);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
}
.auth-title { margin: 2px 0 4px; font-size: 22px; font-weight: 700; }
.auth-subtitle { margin: 0 0 14px; color: var(--muted); }
.auth-google { width: 100%; font-weight: 600; padding: 12px 14px; }
.auth-fineprint { margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.auth-footer { margin-top: 14px; text-align: center; }

@media (max-width: 980px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-left { border-right: 0; border-bottom: 1px solid var(--border); }
    .auth-hero { max-width: 720px; padding: 20px; }
}

/* Minimal Auth and Form Enhancements (legacy center-aligned) */
.auth { text-align: center; }
.auth p { color: var(--muted); margin: 8px 0 14px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    border-radius: 9999px;
    cursor: pointer;
    font-weight: 500;
}
.btn:focus-visible {
    outline: 2px solid #11182722;
    outline-offset: 2px;
}
.btn:hover { background: #f3f4f6; }

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover { background: #0f172a; border-color: #0f172a; }

.btn-google {
    background: var(--panel);
    border-color: var(--border);
    color: var(--text);
}
.btn-google:hover { background: #f3f4f6; }
.btn-google svg { width: 18px; height: 18px; display: block; }

.bio-card {
    flex: 1;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.02);
}

.form-label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 6px;
}

.form-textarea {
    width: 100%;
    resize: vertical;
    min-height: 84px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    color: var(--text);
    outline: none;
}
.form-textarea::placeholder { color: #9ca3af; }
.bio-actions { margin-top: 8px; }

/* Modal (settings) */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 50;
}
.modal {
    width: min(640px, 100%);
    max-height: 85vh;
    overflow: auto;
    border: 1px solid var(--border);
    background: var(--panel);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-close { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border); background: var(--panel); cursor: pointer; }
.user-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); object-fit: cover; object-position: center; }
.user-meta { display: flex; flex-direction: column; }
.user-name { font-weight: 600; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.field { margin-bottom: 8px; }
.actions { display: flex; align-items: center; gap: 8px; }

/* Dropdown for templates/agents */
.dropdown-wrap { position: relative; }
.dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 320px;
    max-height: 60vh;
    overflow: auto;
    border: 1px solid var(--border);
    background: var(--panel);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    padding: 8px;
    z-index: 40;
}
.dropdown-header { display: flex; align-items: center; justify-content: space-between; margin: 2px 4px 6px; }
.dropdown-list { display: flex; flex-direction: column; }
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: 0;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
}
.dropdown-item:hover { background: #f7f7f8; }
.dropdown-avatar { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border); object-fit: cover; object-position: center; }
.dropdown-body { flex: 1; min-width: 0; }
.dropdown-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dropdown-sub { font-size: 12px; }

/* API Docs */
.api-docs-shell { width: min(var(--page-max), 100% - 24px); margin: 8px auto 16px; }
.api-docs { display: flex; flex-direction: column; gap: 12px; }

.api-docs-header {
    border: 1px solid var(--border);
    background: var(--panel);
    border-radius: 14px;
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
.api-docs-header .hero .title { font-size: 22px; font-weight: 700; letter-spacing: 0.2px; }
.api-docs-header .hero .subtitle { color: var(--muted); margin-top: 4px; }
.api-docs-header .info-cards { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.api-docs-header .info-card { border: 1px solid var(--border); background: #f9fafb; border-radius: 12px; padding: 10px 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.api-docs-header .info-card .label { font-weight: 600; font-size: 12px; color: var(--muted); margin-right: 6px; }
.api-docs-header .info-card code { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 2px 6px; font-size: 12px; }

.api-docs-grid { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
.api-docs-sidebar { position: sticky; top: 64px; height: max-content; }
.toc { border: 1px solid var(--border); background: var(--panel); border-radius: 12px; padding: 10px; }
.toc-title { font-weight: 600; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.toc nav { display: flex; flex-direction: column; gap: 2px; }
.toc-link { display: block; padding: 6px 8px; border-radius: 8px; color: #374151; text-decoration: none; font-size: 14px; }
.toc-link:hover { background: #f7f7f8; }
.toc-link.active { background: #111827; color: #fff; }
.toc-link.level-h3 { padding-left: 18px; font-size: 13px; }

/* Docs content */
.docs {
    border: 1px solid var(--border);
    background: var(--panel);
    border-radius: 12px;
    padding: 18px 20px;
    line-height: 1.6;
}
.docs h1 { font-size: 28px; margin: 0 0 12px; position: relative; }
.docs h2 { font-size: 20px; margin: 20px 0 8px; position: relative; }
.docs h3 { font-size: 16px; margin: 14px 0 6px; position: relative; }
.docs p { margin: 10px 0; }
.docs ul { margin: 8px 0 8px 22px; padding: 0; }
.docs li { margin: 6px 0; }
.docs a { color: #2563eb; text-decoration: none; }
.docs a:hover { text-decoration: underline; }
.docs code { background: #f3f4f6; border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; font-size: 13px; }
.docs pre { position: relative; background: #0b1021; color: #e5e7eb; border-radius: 10px; padding: 12px 14px; overflow: auto; border: 1px solid #0b1021; }
.docs pre code { background: transparent; border: 0; color: inherit; padding: 0; }
.docs hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.docs .heading-anchor { position: absolute; right: -28px; opacity: 0; color: #9ca3af; text-decoration: none; }
.docs h1:hover .heading-anchor,
.docs h2:hover .heading-anchor,
.docs h3:hover .heading-anchor { opacity: 1; }

/* Code copy button */
.copy-btn { position: absolute; top: 8px; right: 8px; border: 1px solid #1f2937; background: #111827; color: #e5e7eb; border-radius: 8px; padding: 4px 8px; font-size: 12px; cursor: pointer; }
.copy-btn:hover { background: #0b0f1e; }

/* HTTP method badges */
.http-method { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .3px; padding: 2px 6px; border-radius: 9999px; margin-right: 6px; border: 1px solid transparent; }
.http-method.get { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.http-method.post { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.http-method.put { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.http-method.delete { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.http-method.patch { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }

@media (max-width: 900px) {
    .api-docs-grid { grid-template-columns: 1fr; }
    .api-docs-sidebar { position: static; }
}
