/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #0f1117;
    color: #e1e4e8;
    min-height: 100vh;
    overflow: hidden;
}

/* === HEADER === */
.app-header {
    background: linear-gradient(135deg, #0a0e17 0%, #1a1f35 100%);
    border-bottom: 1px solid #2d333b;
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.4rem;
    font-weight: 700;
    color: #0a66c2;
}

.logo i {
    font-size: 1.8rem;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #666;
}

.status-indicator.online {
    background: #2ea043;
    box-shadow: 0 0 8px #2ea043;
    animation: pulse 2s infinite;
}

.status-text {
    font-size: 0.85rem;
    color: #8b949e;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* === MAIN LAYOUT === */
body:has(.chat-layout) {
    background:
        radial-gradient(ellipse 80% 50% at 20% -10%, rgba(10, 102, 194, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse 60% 40% at 90% 100%, rgba(31, 111, 235, 0.08) 0%, transparent 50%),
        #0a0c10;
}

.chat-layout {
    display: flex;
    height: calc(100vh - 60px);
    gap: 0;
    overflow: hidden;
    max-width: 1440px;
    margin: 0 auto;
}

.app-body {
    display: flex;
    height: calc(100vh - 70px);
    gap: 0;
}

/* === CHAT PANEL === */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: rgba(13, 17, 23, 0.6);
    backdrop-filter: blur(8px);
    border-right: 1px solid rgba(48, 54, 61, 0.8);
}

.chat-header {
    padding: 22px 28px 18px;
    border-bottom: 1px solid rgba(48, 54, 61, 0.6);
    background: linear-gradient(180deg, rgba(22, 27, 34, 0.95) 0%, rgba(13, 17, 23, 0.85) 100%);
    position: relative;
}

.chat-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 28px;
    right: 28px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(10, 102, 194, 0.5), transparent);
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.15rem;
    font-weight: 600;
    color: #f0f3f6;
    letter-spacing: -0.02em;
}

.chat-title i {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a66c2 0%, #004182 100%);
    border-radius: 10px;
    font-size: 1rem;
    color: #fff;
    box-shadow: 0 4px 14px rgba(10, 102, 194, 0.35);
}

.chat-subtitle {
    display: block;
    margin-top: 8px;
    margin-left: 50px;
    color: #8b949e;
    font-size: 0.875rem;
    line-height: 1.5;
    max-width: 520px;
}

/* === MESSAGES === */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 28px 28px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background:
        radial-gradient(circle at 1px 1px, rgba(48, 54, 61, 0.35) 1px, transparent 0);
    background-size: 24px 24px;
    background-color: rgba(10, 12, 16, 0.4);
}

.message {
    display: flex;
    gap: 12px;
    max-width: 78%;
    animation: fadeIn 0.35s ease;
}

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

.message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-ai {
    align-self: flex-start;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.message-user .message-avatar {
    background: linear-gradient(145deg, #388bfd 0%, #1f6feb 100%);
    color: white;
}

.message-avatar-ai {
    background: linear-gradient(145deg, #0a66c2 0%, #065092 100%);
    color: white;
}

.message-bubble {
    padding: 14px 18px;
    border-radius: 18px;
    line-height: 1.65;
    font-size: 0.9375rem;
    word-wrap: break-word;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.message-bubble-user {
    background: linear-gradient(145deg, #2563eb 0%, #1d4ed8 100%);
    color: #f8fafc;
    border-bottom-right-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.message-bubble-ai {
    background: rgba(22, 27, 34, 0.9);
    color: #e6edf3;
    border: 1px solid rgba(48, 54, 61, 0.9);
    border-bottom-left-radius: 6px;
    border-left: 3px solid #0a66c2;
}

.message-bubble-ai .message-content strong {
    color: #58a6ff;
    font-weight: 600;
}

.message-content {
    white-space: pre-wrap;
}

.message-time {
    font-size: 0.7rem;
    margin-top: 8px;
    opacity: 0.55;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.message-user .message-time {
    text-align: right;
    color: rgba(255, 255, 255, 0.75);
}

/* Welcome / empty state message */
.message-ai:first-child .message-bubble-ai {
    background: linear-gradient(135deg, rgba(22, 27, 34, 0.95) 0%, rgba(13, 17, 23, 0.98) 100%);
    border-left-color: #58a6ff;
    padding: 18px 20px;
}

.message-ai:first-child .message-content {
    color: #c9d1d9;
}

/* === PUBLICATIONS PANEL (inline in chat) === */
.publications-panel {
    padding: 20px 28px;
    border-top: 1px solid rgba(48, 54, 61, 0.6);
    background: linear-gradient(180deg, rgba(22, 27, 34, 0.6) 0%, rgba(13, 17, 23, 0.9) 100%);
    max-height: 38vh;
    overflow-y: auto;
    animation: fadeIn 0.5s ease;
    display: none;
}

.publications-panel:has(> .publications-list > .publication-card) {
    display: block;
}

.publications-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #f0f3f6;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.01em;
}

.publications-header h3 i {
    color: #0a66c2;
}

.publications-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.publication-card {
    background: rgba(13, 17, 23, 0.8);
    border: 1px solid rgba(48, 54, 61, 0.8);
    border-radius: 14px;
    padding: 18px 18px 14px;
    position: relative;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.publication-card:hover {
    border-color: rgba(10, 102, 194, 0.4);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.publication-number {
    position: absolute;
    top: -11px;
    left: 18px;
    background: linear-gradient(135deg, #0a66c2, #004182);
    color: white;
    min-width: 26px;
    height: 26px;
    padding: 0 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(10, 102, 194, 0.4);
}

.publication-content {
    white-space: pre-wrap;
    line-height: 1.7;
    font-size: 0.9rem;
    color: #c9d1d9;
    margin-bottom: 14px;
}

.publication-actions {
    display: flex;
    justify-content: flex-end;
}

.btn-copy {
    background: rgba(31, 111, 235, 0.1);
    border: 1px solid rgba(88, 166, 255, 0.25);
    color: #58a6ff;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-copy:hover {
    background: rgba(31, 111, 235, 0.2);
    color: #79b8ff;
    border-color: #58a6ff;
    transform: translateY(-1px);
}

/* === INPUT AREA === */
.chat-input-area {
    padding: 18px 28px 22px;
    border-top: 1px solid rgba(48, 54, 61, 0.6);
    background: linear-gradient(0deg, rgba(13, 17, 23, 0.98) 0%, rgba(22, 27, 34, 0.85) 100%);
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: rgba(13, 17, 23, 0.9);
    border: 1px solid rgba(48, 54, 61, 0.9);
    border-radius: 16px;
    padding: 10px 12px 10px 18px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.input-wrapper:focus-within {
    border-color: rgba(10, 102, 194, 0.6);
    box-shadow: 0 0 0 3px rgba(10, 102, 194, 0.12), 0 4px 24px rgba(0, 0, 0, 0.25);
}

#message-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #f0f3f6;
    font-family: 'Inter', sans-serif;
    font-size: 0.9375rem;
    resize: none;
    outline: none;
    min-height: 26px;
    max-height: 150px;
    line-height: 1.55;
}

#message-input::placeholder {
    color: #6e7681;
}

.btn-send {
    background: linear-gradient(145deg, #0a66c2 0%, #004182 100%);
    border: none;
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, box-shadow 0.2s;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(10, 102, 194, 0.35);
}

.btn-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(10, 102, 194, 0.45);
}

.btn-send:active {
    transform: scale(0.98);
}

.btn-send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.input-actions {
    margin-top: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-generate {
    background: linear-gradient(135deg, #0a66c2 0%, #065092 100%);
    border: none;
    color: white;
    padding: 11px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 14px rgba(10, 102, 194, 0.3);
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(10, 102, 194, 0.4);
}

.btn-generate:active {
    transform: translateY(0);
}

/* === SIDEBAR === */
.sidebar-panel {
    width: 300px;
    background: linear-gradient(180deg, rgba(22, 27, 34, 0.95) 0%, rgba(13, 17, 23, 0.98) 100%);
    border-left: 1px solid rgba(48, 54, 61, 0.5);
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    flex-shrink: 0;
}

.sidebar-card {
    background: rgba(13, 17, 23, 0.7);
    border: 1px solid rgba(48, 54, 61, 0.7);
    border-radius: 14px;
    padding: 18px;
    transition: border-color 0.2s;
}

.sidebar-card:hover {
    border-color: rgba(10, 102, 194, 0.25);
}

.sidebar-card h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #f0f3f6;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.01em;
}

.sidebar-card h4 i {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 102, 194, 0.15);
    border-radius: 8px;
    color: #58a6ff;
    font-size: 0.85rem;
}

.tips-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tips-list li {
    padding: 12px 0;
    border-bottom: 1px solid rgba(33, 38, 45, 0.8);
}

.tips-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.tips-list li:first-child {
    padding-top: 0;
}

.tips-list strong {
    display: block;
    color: #e6edf3;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.tips-list p {
    color: #8b949e;
    font-size: 0.8125rem;
    line-height: 1.55;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-item {
    text-align: center;
    padding: 16px 12px;
    background: rgba(22, 27, 34, 0.8);
    border: 1px solid rgba(48, 54, 61, 0.6);
    border-radius: 12px;
    transition: border-color 0.2s;
}

.stat-item:hover {
    border-color: rgba(10, 102, 194, 0.3);
}

.stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #58a6ff 0%, #0a66c2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    color: #8b949e;
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* === TOAST === */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #238636;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

.toast.show {
    display: flex;
}

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

/* === SCROLLBAR === */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

.chat-messages::-webkit-scrollbar,
.sidebar-panel::-webkit-scrollbar,
.publications-panel::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-thumb,
.sidebar-panel::-webkit-scrollbar-thumb,
.publications-panel::-webkit-scrollbar-thumb {
    background: rgba(10, 102, 194, 0.35);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.sidebar-panel::-webkit-scrollbar-thumb:hover,
.publications-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(10, 102, 194, 0.55);
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
    .sidebar-panel {
        display: none;
    }
}

@media (max-width: 600px) {
    .chat-layout,
    .app-body {
        flex-direction: column;
    }

    .chat-panel {
        border-right: none;
        border-bottom: 1px solid rgba(48, 54, 61, 0.6);
        height: 100%;
    }

    .message {
        max-width: 92%;
    }

    .chat-messages {
        padding: 18px 16px;
    }

    .chat-header {
        padding: 18px 16px 14px;
    }

    .chat-subtitle {
        margin-left: 0;
        margin-top: 10px;
    }

    .chat-input-area {
        padding: 14px 16px 18px;
    }

    .input-actions {
        flex-direction: column;
        width: 100%;
    }

    .input-actions .inline-form {
        width: 100%;
    }

    .btn-generate,
    .btn-clear-chat {
        width: 100%;
        justify-content: center;
    }

    .publications-page .publications-grid {
        grid-template-columns: 1fr;
    }

    .publications-page > .container {
        padding: 0 16px;
    }

    .publications-page .page-subtitle {
        padding-left: 0;
    }

    .publications-page .publication-card-header {
        flex-wrap: wrap;
    }

    .publications-page .pub-meta {
        order: 3;
        width: 100%;
        margin-left: 0;
        margin-top: 4px;
    }
}

/* === HTMX LOADING INDICATOR === */
.htmx-indicator {
    opacity: 0.5;
    pointer-events: none;
}

.htmx-request .btn-send {
    opacity: 0.6;
}

.htmx-request .btn-generate {
    opacity: 0.6;
}

/* === NAVBAR === */
.navbar-main {
    background: linear-gradient(135deg, #0a0e17 0%, #1a1f35 100%);
    border-bottom: 1px solid #2d333b;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-main .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #0a66c2;
}

.navbar-brand i {
    font-size: 1.5rem;
}

.navbar-links {
    display: flex;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    color: #8b949e;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    position: relative;
}

.nav-link:hover {
    background: #21262d;
    color: #e1e4e8;
}

.nav-link.active {
    background: #1f6feb22;
    color: #58a6ff;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 12px;
    right: 12px;
    height: 2px;
    background: #58a6ff;
    border-radius: 2px;
}

.badge-count {
    background: #0a66c2;
    color: white;
    font-size: 0.7rem;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 600;
}

/* === PUBLICATIONS PAGE === */
body:has(.publications-page) {
    background:
        radial-gradient(ellipse 70% 45% at 50% -5%, rgba(10, 102, 194, 0.1) 0%, transparent 55%),
        #0a0c10;
}

.publications-page {
    min-height: calc(100vh - 60px);
    height: calc(100vh - 60px);
    overflow-y: auto;
    padding: 0 0 48px;
}

.publications-page > .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.publications-page .page-header {
    text-align: left;
    margin-bottom: 28px;
    padding: 28px 0 24px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(10, 12, 16, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(48, 54, 61, 0.5);
}

.publications-page .page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #f0f3f6;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.02em;
}

.publications-page .page-header h1 i {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 102, 194, 0.15);
    border-radius: 10px;
    color: #0a66c2;
    font-size: 0.95rem;
}

.publications-page .page-subtitle {
    color: #8b949e;
    font-size: 0.875rem;
    margin: 0;
    padding-left: 46px;
}

.publications-page .publications-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    padding: 0;
}

/* Reset chat inline styles */
.publications-page .publication-card {
    background: rgba(22, 27, 34, 0.6);
    border: 1px solid rgba(48, 54, 61, 0.7);
    border-radius: 14px;
    overflow: hidden;
    padding: 0;
    position: relative;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.publications-page .publication-card:hover {
    border-color: rgba(10, 102, 194, 0.45);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    transform: translateY(-2px);
}

.publications-page .publication-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(13, 17, 23, 0.5);
    border-bottom: 1px solid rgba(48, 54, 61, 0.5);
}

.publications-page .publication-card-header > .author-badge {
    order: 1;
    margin: 0;
}

.publications-page .pub-meta {
    order: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    margin-right: 4px;
}

.publications-page .pub-id {
    color: #58a6ff;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
}

.publications-page .pub-date {
    color: #6e7681;
    font-size: 0.75rem;
    font-weight: 500;
}

.publications-page .pub-date::before {
    content: '·';
    margin-right: 10px;
    color: #484f58;
}

.publications-page .pub-actions {
    order: 3;
    display: flex;
    gap: 2px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.publications-page .publication-card:hover .pub-actions {
    opacity: 1;
}

.publications-page .btn-icon {
    background: transparent;
    border: none;
    color: #8b949e;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    font-size: 0.875rem;
}

.publications-page .btn-icon:hover {
    background: rgba(48, 54, 61, 0.5);
    color: #e6edf3;
}

.publications-page .btn-icon.btn-copy-global:hover,
.publications-page .btn-icon.btn-copy:hover {
    background: rgba(10, 102, 194, 0.12);
    color: #58a6ff;
}

.publications-page .btn-icon.btn-delete:hover {
    background: rgba(248, 81, 73, 0.1);
    color: #f85149;
}

.publications-page .publication-card-content {
    padding: 18px 18px 20px;
    line-height: 1.75;
    font-size: 0.875rem;
    color: #c9d1d9;
    max-height: 320px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(10, 102, 194, 0.3) transparent;
    counter-reset: pub-part;
}

.publications-page .publication-card-content::-webkit-scrollbar {
    width: 4px;
}

.publications-page .publication-card-content::-webkit-scrollbar-thumb {
    background: rgba(10, 102, 194, 0.3);
    border-radius: 4px;
}

.publications-page .publication-card-content::-webkit-scrollbar-thumb:hover {
    background: rgba(10, 102, 194, 0.5);
}

.publications-page .publication-part {
    position: relative;
    padding-left: 28px;
    margin-bottom: 0;
    counter-increment: pub-part;
}

.publications-page .publication-part::before {
    content: counter(pub-part);
    position: absolute;
    left: 0;
    top: 2px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: #0a66c2;
    background: rgba(10, 102, 194, 0.12);
    border-radius: 6px;
}

.publications-page .publication-separator {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(48, 54, 61, 0.8), transparent);
    margin: 20px 0 20px 28px;
}

.publications-page .author-badge {
    background: transparent;
    color: #8b949e;
    padding: 0;
    border: none;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.publications-page::-webkit-scrollbar {
    width: 6px;
}

.publications-page::-webkit-scrollbar-track {
    background: transparent;
}

.publications-page::-webkit-scrollbar-thumb {
    background: rgba(10, 102, 194, 0.25);
    border-radius: 4px;
}

.publications-page::-webkit-scrollbar-thumb:hover {
    background: rgba(10, 102, 194, 0.45);
}

/* Empty state — publications */
.publications-page .empty-state {
    text-align: center;
    padding: 72px 24px;
    max-width: 420px;
    margin: 40px auto 0;
}

.publications-page .empty-state i {
    font-size: 2.5rem;
    color: rgba(10, 102, 194, 0.35);
    margin-bottom: 20px;
    display: block;
}

.publications-page .empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #e6edf3;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.publications-page .empty-state p {
    color: #8b949e;
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 28px;
}

.publications-page .empty-state .btn-primary {
    background: linear-gradient(135deg, #0a66c2 0%, #065092 100%);
    border-radius: 10px;
    padding: 11px 22px;
    font-size: 0.875rem;
    box-shadow: 0 4px 14px rgba(10, 102, 194, 0.25);
}

.publications-page .empty-state .btn-primary:hover {
    background: linear-gradient(135deg, #0d74d8 0%, #0a66c2 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(10, 102, 194, 0.35);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #1f6feb;
    color: white;
    padding: 10px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #388bfd;
    color: white;
}

/* === CLEAR CHAT BUTTON === */
.btn-clear-chat {
    background: rgba(248, 81, 73, 0.06);
    border: 1px solid rgba(248, 81, 73, 0.35);
    color: #f85149;
    padding: 11px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.btn-clear-chat:hover {
    background: rgba(248, 81, 73, 0.12);
    border-color: #f85149;
    transform: translateY(-1px);
}

/* === TOAST DELETE === */
.toast-delete {
    background: #da3633;
}

/* === PROFILE SELECTOR === */
.profile-selector {
    display: flex;
    align-items: center;
    gap: 6px;
}

.profile-selector i {
    color: #58a6ff;
    font-size: 0.85rem;
}

/* Dropdown selector */
.profile-dropdown {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #e1e4e8;
    padding: 6px 32px 6px 12px;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b949e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.profile-dropdown:hover {
    border-color: #58a6ff;
}

.profile-dropdown:focus {
    border-color: #1f6feb;
    box-shadow: 0 0 0 2px rgba(31, 111, 235, 0.2);
}

.profile-dropdown option {
    background: #161b22;
    color: #e1e4e8;
    padding: 8px;
}

.profile-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #21262d;
    color: #8b949e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.profile-btn:hover {
    background: #30363d;
    color: #e1e4e8;
    border-color: #58a6ff;
}

.profile-btn.active {
    background: #1f6feb;
    color: white;
    border-color: #58a6ff;
    box-shadow: 0 0 8px rgba(31, 111, 235, 0.4);
}

/* === AUTHOR BADGE === */
.author-badge {
    display: inline-block;
    background: #1f6feb33;
    color: #58a6ff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 4px;
    border: 1px solid #1f6feb55;
}

.message-author {
    display: block;
    font-size: 0.75rem;
    color: #58a6ff;
    font-weight: 600;
    margin-bottom: 4px;
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* === LOGIN === */
body.login-page {
    overflow: auto;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, #1a2332 0%, #0f1117 55%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 24px;
}

.login-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 16px;
    background: linear-gradient(135deg, #0a66c2, #004182);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #fff;
}

.login-header h1 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.login-header p {
    color: #8b949e;
    font-size: 0.9rem;
    margin: 0;
}

.login-alert {
    background: #3d1214;
    border: 1px solid #f8514966;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 20px;
}

.login-alert p {
    margin: 0;
    color: #ffa198;
    font-size: 0.875rem;
}

.login-form .form-group {
    margin-bottom: 18px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #c9d1d9;
}

.login-form .form-control {
    width: 100%;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #e6edf3;
    padding: 12px 14px;
    font-size: 0.95rem;
}

.login-form .form-control:focus {
    outline: none;
    border-color: #1f6feb;
    box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.15);
}

.field-error {
    display: block;
    margin-top: 6px;
    color: #f85149;
    font-size: 0.8rem;
}

.btn-login {
    width: 100%;
    margin-top: 8px;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #0a66c2, #004182);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-login:hover {
    opacity: 0.92;
}

/* === NAVBAR USER === */
.navbar-user {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
}

.user-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--profile-color) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--profile-color) 35%, transparent);
}

.user-badge .avatar-emoji {
    font-size: 1rem;
}

.user-badge .user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #e6edf3;
}

.user-email {
    font-size: 0.75rem;
    color: #8b949e;
    padding-left: 4px;
}

.logout-form {
    margin: 0;
}

.nav-link-button {
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
}

.nav-link-button:hover {
    color: #f85149;
}

@media (max-width: 768px) {
    .navbar-user .user-email {
        display: none;
    }

    .navbar-inner {
        flex-wrap: wrap;
    }
}

/* === CALENDAR === */
body.calendar-body {
    overflow: auto;
}

.calendar-page {
    padding: 24px 0 48px;
    min-height: calc(100vh - 60px);
}

.calendar-container {
    max-width: 1600px;
    padding: 0 20px;
}

.calendar-page-header {
    margin-bottom: 24px;
}

.calendar-create-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
}

.calendar-create-card h3 {
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.calendar-create-form .form-row {
    margin-bottom: 16px;
}

.calendar-create-form label,
.calendar-edit-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.875rem;
    color: #8b949e;
}

.form-control-dark {
    width: 100%;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #e6edf3;
    padding: 10px 12px;
    font-size: 0.9rem;
}

.form-control-dark:focus {
    outline: none;
    border-color: #1f6feb;
}

.calendar-weeks-list h3 {
    margin-bottom: 16px;
}

.calendar-week-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 10px;
    margin-bottom: 10px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s;
}

.calendar-week-item:hover {
    border-color: #1f6feb;
    color: inherit;
}

.week-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.week-item-info span {
    color: #8b949e;
    font-size: 0.85rem;
}

.status-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 600;
}

.status-draft { background: #30363d; color: #8b949e; }
.status-ready { background: #1f6feb33; color: #58a6ff; }
.status-generating { background: #9e6a0333; color: #d29922; }
.status-completed { background: #23863633; color: #3fb950; }
.status-error { background: #da363333; color: #f85149; }

.calendar-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.calendar-toolbar-left {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.calendar-toolbar-left h1 {
    font-size: 1.4rem;
    margin-bottom: 8px;
}

.theme-form {
    display: flex;
    gap: 8px;
    max-width: 500px;
}

.theme-input {
    flex: 1;
}

.calendar-toolbar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.calendar-trends-panel {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.trends-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.trends-panel-header h3 {
    margin: 0;
    font-size: 1.05rem;
}

.trends-block {
    margin-bottom: 16px;
}

.trends-block h4 {
    font-size: 0.85rem;
    color: #58a6ff;
    margin-bottom: 8px;
}

.trends-block p {
    color: #c9d1d9;
    font-size: 0.9rem;
    line-height: 1.6;
}

.trends-list {
    margin: 0;
    padding-left: 20px;
    color: #c9d1d9;
    font-size: 0.9rem;
}

.trends-list li {
    margin-bottom: 4px;
}

.trends-empty {
    color: #8b949e;
    font-size: 0.9rem;
    margin: 0;
}

.hashtags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hashtag-chip {
    background: #1f6feb22;
    color: #58a6ff;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    border: 1px solid #1f6feb44;
}

.status-suggesting { background: #8957e533; color: #a371f7; }

.progress-bar-suggest {
    background: linear-gradient(90deg, #8957e5, #a371f7);
}

.calendar-suggest-progress .progress-header i {
    color: #a371f7;
}

.inline-form {
    display: inline;
    margin: 0;
}

.btn-secondary-sm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #e6edf3;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
}

.btn-secondary-sm:hover {
    background: #30363d;
    color: #e6edf3;
}

.btn-danger-sm {
    padding: 8px 12px;
    background: #da363322;
    border: 1px solid #da363355;
    border-radius: 8px;
    color: #f85149;
    cursor: pointer;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
}

.calendar-day-column {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    overflow: hidden;
    min-width: 0;
}

.calendar-day-header {
    background: #0d1117;
    padding: 12px;
    border-bottom: 1px solid #30363d;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.calendar-day-header .day-name {
    font-weight: 700;
    color: #58a6ff;
    font-size: 0.9rem;
}

.calendar-day-header .day-theme {
    font-size: 0.8rem;
    color: #e6edf3;
}

.calendar-day-header .day-date {
    font-size: 0.75rem;
    color: #8b949e;
}

.calendar-day-slots {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.calendar-slot-card {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 10px;
    font-size: 0.8rem;
}

.calendar-slot-card.slot-status-generated {
    border-left: 3px solid #3fb950;
}

.calendar-slot-card.slot-status-error {
    border-left: 3px solid #f85149;
}

.calendar-slot-card.slot-status-planned {
    border-left: 3px solid #8b949e;
}

.slot-card-header {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    align-items: center;
}

.slot-time {
    font-weight: 700;
    color: #58a6ff;
    font-size: 0.95rem;
}

.slot-type-badge {
    background: #1f6feb22;
    color: #58a6ff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
}

.slot-category-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    background: #30363d;
    color: #8b949e;
}

.slot-brief {
    color: #8b949e;
    margin-bottom: 8px;
    line-height: 1.4;
}

.slot-content {
    color: #e6edf3;
    line-height: 1.5;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 8px;
    white-space: pre-wrap;
}

.slot-placeholder {
    color: #484f58;
    font-style: italic;
    margin-bottom: 8px;
}

.slot-error {
    color: #f85149;
    margin-bottom: 8px;
    font-size: 0.75rem;
}

.slot-actions {
    display: flex;
    gap: 6px;
}

.btn-copy-slot,
.btn-regenerate-slot {
    padding: 4px 10px;
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #e6edf3;
    font-size: 0.75rem;
    cursor: pointer;
}

.btn-copy-slot:hover,
.btn-regenerate-slot:hover {
    background: #30363d;
}

.calendar-progress-panel {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
}

.progress-header h3 {
    margin: 12px 0 8px;
}

.progress-header p {
    color: #8b949e;
}

.progress-bar-wrapper {
    height: 8px;
    background: #21262d;
    border-radius: 4px;
    margin: 24px auto;
    max-width: 400px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #1f6feb, #58a6ff);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-hint {
    color: #484f58;
    font-size: 0.85rem;
}

.calendar-alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.calendar-alert-success {
    background: #23863622;
    border: 1px solid #23863655;
    color: #3fb950;
}

.calendar-alert-error {
    background: #da363322;
    border: 1px solid #da363355;
    color: #f85149;
}

.calendar-edit-container {
    max-width: 900px;
}

.calendar-edit-day {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.calendar-edit-day h3 {
    margin-bottom: 16px;
    font-size: 1rem;
    color: #58a6ff;
}

.calendar-edit-slot {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.slot-edit-header {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.slot-badge {
    background: #1f6feb33;
    color: #58a6ff;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.slot-time-badge {
    color: #8b949e;
    font-size: 0.75rem;
}

.form-row-inline {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.calendar-edit-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

@media (max-width: 1200px) {
    .calendar-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .calendar-grid {
        grid-template-columns: 1fr;
    }

    .form-row-inline {
        grid-template-columns: 1fr;
    }

    .calendar-toolbar {
        flex-direction: column;
    }
}

