* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Pastel Theme: Cream, Coffee, Pastel Orange */
:root {
    --bg-primary: #fdfbf7;        /* warm white */
    --bg-secondary: #fffef9;      /* pure cream */
    --bg-tertiary: #f5efe6;       /* light coffee cream */
    --text-primary: #4a3f35;      /* coffee brown */
    --text-secondary: #8b7d6b;    /* muted coffee */
    --accent: #f4a574;            /* pastel orange */
    --accent-hover: #e8956a;      /* deeper pastel orange */
    --accent-light: #fff5ed;      /* very light peach */
    --user-msg: #fff8f0;          /* cream peach */
    --user-border: #f5d5b8;       /* soft peach border */
    --assistant-msg: #faf6f0;     /* warm cream */
    --assistant-border: #e8ddd0;  /* coffee cream border */
    --border: #ece4d9;            /* warm border */
    --success: #a8c5a0;           /* pastel sage green */
}

html, body {
    height: 100%;
    height: 100dvh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
}

/* App layout */
.app {
    display: flex;
    flex-direction: column;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}
.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    transition: background 0.15s;
}
.icon-btn:hover {
    background: var(--bg-tertiary);
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 300px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    z-index: 1000;
    transform: translateX(0); /* Open by default on desktop */
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.sidebar.closed {
    transform: translateX(-100%);
}
/* Legacy class for backwards compat */
.sidebar.open {
    transform: translateX(0);
}
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 1.1rem;
}
.editable-name {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.15s;
}
.editable-name:hover {
    background: var(--bg-tertiary);
}
.editable-name-input {
    font-size: 1.1rem;
    font-weight: 700;
    padding: 4px 8px;
    border: 2px solid var(--accent);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    width: 150px;
}
.editable-name-input:focus {
    outline: none;
}
.sidebar-section {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}
.section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 14px;
    font-weight: 700;
}
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}
.sidebar-item:hover, .sidebar-item.active {
    background: var(--bg-tertiary);
}
.sidebar-item .emoji {
    font-size: 1.3rem;
}
.sidebar-empty {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 8px 0;
}
.sidebar-add {
    background: transparent;
    border: none;
    color: var(--accent);
    cursor: pointer;
    padding: 10px 0;
    font-size: 0.9rem;
    font-weight: 600;
}
.sidebar-add:hover {
    text-decoration: underline;
}
.sidebar-chat {
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    transition: background 0.15s;
}
.sidebar-chat:hover {
    background: var(--bg-tertiary);
}
.sidebar-chat .chat-name {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.sidebar-chat .chat-icon {
    font-size: 1.1rem;
}
.sidebar-chat .chat-delete-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}
.sidebar-chat:hover .chat-delete-btn {
    opacity: 1;
}
.sidebar-chat .chat-delete-btn:hover {
    color: #c0392b;
}
.sidebar-member {
    padding: 10px 14px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    transition: background 0.15s;
}
.sidebar-member:hover {
    background: var(--bg-tertiary);
}
.member-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}
.assistant-item {
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    background: var(--bg-tertiary);
    transition: background 0.15s;
}
.assistant-item:hover {
    background: var(--accent-light);
}
.sidebar-footer {
    margin-top: auto;
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.sidebar-footer button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    text-align: left;
    padding: 0;
}
.sidebar-footer button:hover {
    color: var(--accent);
}
.sidebar-footer-row {
    display: flex;
    gap: 16px;
}

/* Apps list */
/* Quick links */
.quick-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.quick-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    width: 100%;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.15s;
}
.quick-link:hover {
    background: var(--border);
}
.quick-link .emoji {
    font-size: 1.1rem;
}

.apps-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.app-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--accent-light);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    width: 100%;
    color: var(--text-primary);
    transition: all 0.15s;
}
.app-btn:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}
.app-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}
.app-name {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chat area */
.chat {
    flex: 1 1 0; /* Can grow and shrink, base size 0 */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    min-height: 0;
}
.messages {
    flex: 1 1 0; /* Can grow and shrink, base size 0 */
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Messages */
.message {
    max-width: 80%;
    width: fit-content;
    padding: 14px 18px;
    border-radius: 20px;
    word-wrap: break-word;
}
.message.user {
    align-self: flex-end;
    background: var(--user-msg);
    border: 1px solid var(--user-border);
    border-bottom-right-radius: 6px;
}
.message.assistant {
    align-self: flex-start;
    background: var(--assistant-msg);
    border: 1px solid var(--assistant-border);
    border-bottom-left-radius: 6px;
}
.message-header {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    margin-bottom: 6px;
}
.sender-name {
    font-weight: 700;
    color: var(--text-primary);
}
.message-time {
    color: var(--text-secondary);
    margin-left: auto;
}
.pin-msg-btn, .delete-msg-btn {
    opacity: 0;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0 4px;
    line-height: 1;
    transition: opacity 0.15s, color 0.15s;
}
.message:hover .pin-msg-btn,
.message:hover .delete-msg-btn {
    opacity: 1;
}
.pin-msg-btn:hover {
    color: var(--accent);
}
.delete-msg-btn:hover {
    color: #e74c3c;
}
.message.pinned {
    border-left: 3px solid var(--accent);
    background: rgba(255, 178, 107, 0.1);
}
.message.pinned .pin-msg-btn {
    opacity: 1;
}
.message-content {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.55;
    font-size: 0.95rem;
}
.message-content a {
    color: var(--accent);
    text-decoration: none;
    word-break: break-all;
}
.message-content a:hover {
    text-decoration: underline;
}

/* Typing indicator */
.message.typing {
    display: flex;
    gap: 5px;
    padding: 18px 22px;
}
.message.typing span {
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}
.message.typing span:nth-child(2) { animation-delay: 0.2s; }
.message.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Embeds */
.embed {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    margin-top: 8px;
    margin-bottom: 8px;
    max-width: 360px;
    align-self: flex-start;
}
.embed-header {
    font-weight: 700;
    margin-bottom: 14px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Shopping list */
.list-items {
    display: flex;
    flex-direction: column;
}
.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.list-item:last-child {
    border-bottom: none;
}
.list-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--success);
    border-radius: 4px;
}
.list-item span {
    font-size: 0.95rem;
    flex: 1;
}
.list-item .delete-item-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0;
    transition: opacity 0.15s;
}
.list-item:hover .delete-item-btn {
    opacity: 1;
}
.list-item .delete-item-btn:hover {
    color: var(--error);
}
.list-item.checked span {
    text-decoration: line-through;
    color: var(--text-secondary);
}
.clear-completed-btn {
    margin-top: 14px;
    padding: 10px 18px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.15s;
}
.clear-completed-btn:hover {
    background: var(--border);
    color: var(--text-primary);
}

/* Vibe app embed */
.vibe-app-container {
    max-width: 100%;
    width: 100%;
    position: relative;
}
.vibe-app-container iframe {
    width: 100%;
    height: 450px;
    border: none;
    border-radius: 12px;
    background: white;
}
.vibe-app-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: white;
    padding: 0;
    margin: 0;
    max-width: none;
    border-radius: 0;
}
.vibe-app-container.fullscreen .embed-header {
    display: none;
}
.vibe-app-container.fullscreen iframe {
    height: 100%;
    border-radius: 0;
}
.vibe-app-controls {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 10;
}
.vibe-fullscreen-btn {
    background: var(--accent);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.15s;
}
.vibe-fullscreen-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}
.vibe-app-container.fullscreen .vibe-app-controls {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 10001;
}
.vibe-app-container.fullscreen .vibe-fullscreen-btn {
    width: 50px;
    height: 50px;
    font-size: 1.4rem;
}

/* Input area */
.input-area {
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.input-row {
    display: flex;
    gap: 8px;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
}
#message-input {
    flex: 1 1 auto;
    min-width: 0; /* Allow shrinking */
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: 20px;
    padding: 8px 14px;
    color: var(--text-primary);
    font-size: 1rem;
    font-size: 16px; /* Prevent iOS zoom on focus */
    resize: none;
    max-height: 150px;
    line-height: 1.4;
    transition: border-color 0.15s;
    -webkit-appearance: none; /* Remove iOS styling */
    overflow: hidden; /* Hide scrollbar */
    overflow-y: auto;
}
#message-input::-webkit-scrollbar {
    display: none; /* Hide scrollbar on webkit */
}
#message-input {
    -ms-overflow-style: none; /* Hide scrollbar on IE/Edge */
    scrollbar-width: none; /* Hide scrollbar on Firefox */
}
#message-input:focus {
    outline: none;
    border-color: var(--accent);
}
#message-input::placeholder {
    color: var(--text-secondary);
}
#send-btn {
    background: var(--accent);
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}
#send-btn svg {
    width: 18px;
    height: 18px;
}
#send-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}
#send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
#send-btn svg {
    color: white;
}
#voice-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.15s;
}
#voice-btn svg {
    width: 20px;
    height: 20px;
}
#voice-btn:hover {
    color: var(--accent);
}
#voice-btn.recording {
    color: #ef4444;
}

/* Welcome */
.welcome {
    text-align: center;
    padding: 80px 24px;
}
.welcome h2 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 1.6rem;
    font-weight: 700;
}
.welcome p {
    color: var(--text-secondary);
    font-size: 1rem;
}
.welcome-invite {
    display: flex;
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
}
.welcome-invite input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.85rem;
}
.welcome-invite input:focus {
    outline: none;
    border-color: var(--accent);
}
.welcome-invite button {
    padding: 10px 18px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
}
.welcome-invite button:hover {
    background: var(--accent-hover);
}

/* Onboarding */
.onboarding {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px;
    padding-top: 48px;
    padding-bottom: 48px;
    background: var(--bg-primary);
    overflow-y: auto;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}
.onboarding-content {
    max-width: 420px;
    width: 100%;
}
.onboarding h1 {
    text-align: center;
    margin-bottom: 8px;
    font-size: 2rem;
}
.onboarding-content > p {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 36px;
}
.card {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 20px;
}
.card h2 {
    font-size: 1.15rem;
    margin-bottom: 18px;
    font-weight: 700;
}
.card input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 14px;
    transition: border-color 0.15s;
}
.card input:focus {
    outline: none;
    border-color: var(--accent);
}
.card button {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}
.card button:hover {
    background: var(--accent-hover);
}
.divider {
    text-align: center;
    color: var(--text-secondary);
    margin: 28px 0;
    position: relative;
    font-weight: 600;
}
.divider::before, .divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 38%;
    height: 2px;
    background: var(--border);
}
.divider::before { left: 0; }
.divider::after { right: 0; }

/* Invite box */
.invite-box {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}
.invite-box input {
    flex: 1;
    margin-bottom: 0;
}
.invite-box button {
    width: auto;
    padding: 14px 24px;
}
.hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--bg-secondary);
    padding: 14px 28px;
    border-radius: 12px;
    z-index: 1000;
    font-weight: 600;
    animation: fadeInOut 3s ease;
}
@keyframes fadeInOut {
    0%, 100% { opacity: 0; transform: translateX(-50%) translateY(10px); }
    10%, 90% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Whiteboard */
.whiteboard-container {
    max-width: 100%;
    width: 100%;
}
.whiteboard-tools {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    gap: 12px;
    flex-wrap: wrap;
}
.color-palette {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}
.color-btn:hover {
    transform: scale(1.1);
}
.color-btn.active {
    border-color: var(--text-primary);
}
.whiteboard-actions {
    display: flex;
    gap: 8px;
}
.tool-btn {
    background: var(--bg-tertiary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.15s;
}
.tool-btn:hover {
    background: var(--border);
}
.tool-btn.active {
    background: var(--accent);
}
.whiteboard-canvas {
    width: 100%;
    height: auto;
    aspect-ratio: 4/3;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: white;
    touch-action: none;
    cursor: crosshair;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal.open {
    display: flex;
}
.modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 28px;
    max-width: 420px;
    width: 100%;
}
.modal-content h2 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}
.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 0.9rem;
}
.modal-content input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 12px;
}
.modal-content input:focus {
    outline: none;
    border-color: var(--accent);
}
.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}
.modal-buttons button {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
}
.btn-primary {
    background: var(--accent);
    color: white;
}
.btn-primary:hover {
    background: var(--accent-hover);
}
.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background: var(--border);
}
.invite-link {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}
.invite-link input {
    flex: 1;
    margin-bottom: 0;
}
.invite-link button {
    padding: 12px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}
.invite-link button:hover {
    background: var(--accent-hover);
}

/* YouTube embed */
.youtube-embed {
    padding: 0;
    overflow: clip;
    max-width: 400px;
}
.youtube-thumbnail-wrapper {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    cursor: pointer;
}
.youtube-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 14px 14px 0 0;
}
.youtube-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.9;
    transition: opacity 0.2s, transform 0.2s;
}
.youtube-thumbnail-wrapper:hover .youtube-play-btn {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}
.youtube-info {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.youtube-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.youtube-title:hover {
    text-decoration: underline;
}
.youtube-author {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
}
.youtube-author:hover {
    text-decoration: underline;
}

/* Link preview embed */
.link-preview {
    padding: 0;
    overflow: clip;
    max-width: 400px;
}
.link-preview-image-wrapper {
    display: block;
    width: 100%;
    max-height: 200px;
    overflow: hidden;
}
.link-preview-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 14px 14px 0 0;
}
.link-preview-info {
    padding: 12px 14px;
}
.link-preview-site {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.link-preview-title {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    text-decoration: none;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.link-preview-title:hover {
    text-decoration: underline;
}
.link-preview-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Responsive */
@media (max-width: 768px) {
    .chat {
        max-width: 100%;
    }
    .message {
        max-width: 88%;
    }
    .sidebar {
        width: 100%;
        transform: translateX(-100%); /* Hidden by default on mobile */
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .messages {
        padding: 16px;
    }
}

/* Desktop: offset content for sidebar */
@media (min-width: 769px) {
    .app {
        margin-left: 300px;
    }
    .app.sidebar-closed {
        margin-left: 0;
    }
}
