/* =============================================================================
   HERMES - Motor Grupo Mugiwara
   ============================================================================= */

:root {
    --bg-primary: #212121;
    --bg-secondary: #171717;
    --bg-tertiary: #2f2f2f;
    --bg-hover: #3a3a3a;
    --bg-user-msg: #2f2f2f;
    --bg-assistant-msg: transparent;
    --text-primary: #ececec;
    --text-secondary: #b4b4b4;
    --text-muted: #8e8e8e;
    --border-color: #3a3a3a;
    --accent: #7c5cfc;
    --accent-hover: #6a48e8;
    --accent-light: rgba(124, 92, 252, 0.15);
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --sidebar-width: 260px;
    --font: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --radius: 8px;
    --radius-lg: 12px;
}

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

html, body {
    height: 100%;
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* =============================================================================
   AUTH PAGES
   ============================================================================= */

.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--bg-secondary);
}

.auth-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    width: 48px;
    height: 48px;
    color: var(--accent);
    margin-bottom: 16px;
}

.auth-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input {
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font);
    transition: border-color 0.2s;
    outline: none;
}

.form-group input:focus {
    border-color: var(--accent);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-footer p {
    margin-bottom: 4px;
}

.auth-note {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

.messages {
    margin-bottom: 20px;
}

.message {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 8px;
}

.message-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.message-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.message-info {
    background: rgba(124, 92, 252, 0.1);
    color: var(--accent);
    border: 1px solid rgba(124, 92, 252, 0.2);
}

/* =============================================================================
   BUTTONS
   ============================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    text-decoration: none;
}

.btn-full {
    width: 100%;
    padding: 12px;
}

.btn-icon {
    padding: 8px;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: 4px;
}

.btn-input-action {
    padding: 8px;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 6px;
    flex-shrink: 0;
}

.btn-input-action:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-new-chat {
    width: calc(100% - 16px);
    margin: 8px;
    padding: 10px;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 400;
    font-family: var(--font);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-new-chat:hover {
    background: var(--bg-hover);
}

/* =============================================================================
   SIDEBAR
   ============================================================================= */

#app {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    transition: transform 0.3s;
    z-index: 100;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-logo-icon {
    width: 24px;
    height: 24px;
    color: var(--accent);
}

.sidebar-toggle {
    display: block;
}

.sidebar-conversations {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.sidebar-conversation {
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
    transition: background 0.2s;
}

.sidebar-conversation:hover {
    background: var(--bg-hover);
}

.sidebar-conversation.active {
    background: var(--accent-light);
}

.sidebar-conversation-title {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.sidebar-conversation-delete {
    padding: 4px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
}

.sidebar-conversation:hover .sidebar-conversation-delete {
    opacity: 1;
}

.sidebar-conversation-delete:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.sidebar-user-plan {
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-tokens {
    margin-bottom: 12px;
}

.token-bar {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.token-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.5s;
}

.token-text {
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.sidebar-logout:hover {
    background: var(--bg-hover);
    color: var(--danger);
    text-decoration: none;
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
    display: block;
}

/* Sidebar API Section */
.sidebar-api {
    border-top: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.sidebar-api-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-muted);
    transition: background 0.2s, color 0.2s;
}

.sidebar-api-header:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.sidebar-api-header span {
    flex: 1;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-api-chevron {
    transition: transform 0.2s;
}

.sidebar-api-chevron.open {
    transform: rotate(180deg);
}

.sidebar-api-body {
    display: none;
    padding: 0 10px 8px;
}

.sidebar-api-body.open {
    display: block;
}

.api-key-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.api-key-value {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 8px;
    margin-bottom: 8px;
}

.api-key-text {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    flex: 1;
    word-break: break-all;
}

.btn-api-generate {
    width: 100%;
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    font-family: var(--font);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-api-generate:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-api-generate:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Sidebar Docs Button */
.sidebar-docs-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    margin: 0 0 4px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s;
    border-top: 1px solid var(--border-color);
}

.sidebar-docs-btn:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.sidebar-docs-btn svg {
    flex-shrink: 0;
}

/* =============================================================================
   API DOCS MODAL
   ============================================================================= */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    backdrop-filter: blur(4px);
    padding: 20px;
    overflow-y: auto;
}

.modal-overlay.open {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.modal-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 800px;
    margin: 40px auto;
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-header-left svg {
    color: var(--accent);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 3px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* Docs Sections */
.docs-section {
    margin-bottom: 28px;
}

.docs-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.docs-section p {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.docs-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-primary);
}

.docs-info code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    color: var(--accent);
    background: var(--accent-light);
    padding: 2px 6px;
    border-radius: 4px;
}

.docs-code-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    margin: 8px 0;
}

.docs-code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.docs-code-header .copy-code-btn {
    padding: 4px 10px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 11px;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
    opacity: 1;
    position: static;
}

.docs-code-header .copy-code-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.docs-code-header .copy-code-btn.copied {
    color: var(--success);
    border-color: var(--success);
}

.docs-code-block pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
}

.docs-code-block pre code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre;
}

.docs-table-wrapper {
    overflow-x: auto;
}

.docs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.docs-table th,
.docs-table td {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.docs-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
}

.docs-table td {
    color: var(--text-secondary);
}

.docs-table td code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-primary);
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.tag-required {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.tag-optional {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.tag-success {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.tag-error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.tag-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.docs-list {
    list-style: none;
    padding: 0;
}

.docs-list li {
    padding: 8px 12px;
    margin-bottom: 4px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.docs-list li strong {
    color: var(--text-primary);
}

/* =============================================================================
   REPORT DOWNLOAD
   ============================================================================= */

.report-download-wrapper {
    padding: 8px 24px !important;
}

.report-download {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    animation: fadeIn 0.3s;
}

.report-download-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.report-download-icon svg {
    color: var(--accent);
}

.report-download-info {
    flex: 1;
    min-width: 0;
}

.report-download-info strong {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.report-download-info span {
    font-size: 12px;
    color: var(--text-muted);
}

.report-download-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-report {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-report:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

/* Key Notification */
.key-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    background: var(--bg-primary);
    border: 1px solid var(--accent);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 999;
    overflow: hidden;
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.key-notification.show {
    transform: translateX(0);
}

.key-notification-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--accent-light);
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
}

.key-notification-header button {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
}

.key-notification-body {
    padding: 16px;
}

.key-notification-code {
    display: block;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px;
    font-size: 12px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    word-break: break-all;
    line-height: 1.5;
    margin-bottom: 12px;
    color: var(--text-primary);
    user-select: all;
}

.key-notification-body .btn-primary {
    width: 100%;
    padding: 8px;
    font-size: 13px;
}

.key-notification-footer {
    padding: 8px 16px 12px;
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

/* =============================================================================
   MAIN CONTENT
   ============================================================================= */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

.top-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.top-bar-title {
    font-size: 16px;
    font-weight: 600;
}

/* Messages */

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    scroll-behavior: smooth;
}

.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.messages-container::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 3px;
}

.messages-list {
    max-width: 768px;
    margin: 0 auto;
    padding: 24px 24px 100px;
}

.message-wrapper {
    padding: 16px 24px;
    animation: fadeIn 0.3s;
}

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

.message-wrapper.user {
    background: transparent;
}

.message-wrapper.assistant {
    background: transparent;
}

.message-content {
    max-width: 768px;
    margin: 0 auto;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.message-avatar.user {
    background: var(--accent);
    color: white;
}

.message-avatar.assistant {
    background: var(--accent-light);
    color: var(--accent);
}

.message-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.message-text {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message-text p {
    margin-bottom: 12px;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
}

.message-text pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    overflow-x: auto;
    margin: 12px 0;
    position: relative;
}

.message-text pre code {
    background: none;
    padding: 0;
    font-size: 13px;
    line-height: 1.6;
}

.message-text ul, .message-text ol {
    margin: 8px 0;
    padding-left: 24px;
}

.message-text li {
    margin-bottom: 4px;
}

.message-text h1, .message-text h2, .message-text h3, .message-text h4 {
    margin: 16px 0 8px;
    font-weight: 600;
}

.message-text h1 { font-size: 20px; }
.message-text h2 { font-size: 18px; }
.message-text h3 { font-size: 16px; }

.message-text blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 12px;
    color: var(--text-secondary);
    margin: 12px 0;
}

.message-text table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
}

.message-text th, .message-text td {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-align: left;
}

.message-text th {
    background: var(--bg-tertiary);
    font-weight: 600;
}

.message-text a {
    color: var(--accent);
}

.message-tokens {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.message-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.message-actions button {
    padding: 6px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

.message-actions button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.message-actions button.copied {
    color: var(--success);
}

/* Code block with copy button */
.code-block-wrapper {
    position: relative;
    margin: 12px 0;
}

.code-block-wrapper pre {
    margin: 0;
}

.copy-code-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.code-block-wrapper:hover .copy-code-btn {
    opacity: 1;
}

.copy-code-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.copy-code-btn.copied {
    color: var(--success);
    opacity: 1;
}

/* Welcome Screen */

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 24px;
    text-align: center;
}

.welcome-icon svg {
    width: 64px;
    height: 64px;
    color: var(--accent);
    margin-bottom: 16px;
}

.welcome-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 4px;
}

.welcome-brand {
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 32px;
    opacity: 0.8;
}

.welcome-suggestions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    max-width: 500px;
    width: 100%;
}

.suggestion-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 13px;
    font-family: var(--font);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.suggestion-chip:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--text-primary);
}

/* Loading */

.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: typing 1.4s infinite ease-in-out;
}

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

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1); }
}

/* Input Area */

.input-area {
    padding: 16px 24px 24px;
    background: linear-gradient(transparent, var(--bg-primary) 30%);
    position: sticky;
    bottom: 0;
}

.input-container {
    max-width: 768px;
    margin: 0 auto;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 8px 12px;
    transition: border-color 0.2s;
}

.input-container:focus-within {
    border-color: var(--accent);
}

.file-preview {
    padding: 8px 4px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}

.file-preview-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-hover);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-primary);
}

.input-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.message-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 4px;
    font-size: 15px;
    color: var(--text-primary);
    font-family: var(--font);
    outline: none;
    resize: none;
}

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

.input-footer {
    padding: 4px 4px 0;
    text-align: center;
}

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

/* File Message */
.file-attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.file-attachment svg {
    flex-shrink: 0;
}

/* =============================================================================
   TOKEN STATS MODAL
   ============================================================================= */

.modal-lg {
    max-width: 1000px;
}

.stats-totals {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stats-total-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.stats-total-card .stats-number {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    display: block;
}

.stats-total-card .stats-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.stats-table th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.stats-table tr:last-child td {
    border-bottom: none;
}

.stats-table tr:hover td {
    background: var(--bg-hover);
}

.stats-table .num {
    text-align: right;
    font-family: var(--font-mono);
    font-size: 12px;
}

.stats-table .total-row td {
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-light);
}

.stats-section-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        z-index: 200;
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: none;
    }

    .sidebar-overlay.show {
        display: block;
    }

    .top-bar {
        display: flex;
    }

    .sidebar-toggle {
        display: none;
    }

    .welcome-suggestions {
        grid-template-columns: 1fr;
    }

    .message-wrapper {
        padding: 12px 16px;
    }

    .input-area {
        padding: 8px 12px 16px;
    }
}

@media (min-width: 769px) {
    .sidebar-toggle {
        display: block;
    }
}
